@smartledger/bsv 7.10.0 → 7.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bsv-ltp.min.js CHANGED
@@ -1,5 +1,5 @@
1
- var bsvLTP=(()=>{var dR=Object.create;var Qa=Object.defineProperty;var pR=Object.getOwnPropertyDescriptor;var gR=Object.getOwnPropertyNames;var vR=Object.getPrototypeOf,yR=Object.prototype.hasOwnProperty;var mR=(e,t,r)=>t in e?Qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var br=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var B=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},bR=(e,t)=>{for(var r in t)Qa(e,r,{get:t[r],enumerable:!0})},$v=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of gR(t))!yR.call(e,n)&&n!==r&&Qa(e,n,{get:()=>t[n],enumerable:!(i=pR(t,n))||i.enumerable});return e};var Xv=(e,t,r)=>(r=e!=null?dR(vR(e)):{},$v(t||!e||!e.__esModule?Qa(r,"default",{value:e,enumerable:!0}):r,e)),_R=e=>$v(Qa({},"__esModule",{value:!0}),e);var de=(e,t,r)=>mR(e,typeof t!="symbol"?t+"":t,r);var ry=B((YF,ty)=>{y();var Ot=ty.exports={},wi,Si;function id(){throw new Error("setTimeout has not been defined")}function nd(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?wi=setTimeout:wi=id}catch{wi=id}try{typeof clearTimeout=="function"?Si=clearTimeout:Si=nd}catch{Si=nd}})();function Jv(e){if(wi===setTimeout)return setTimeout(e,0);if((wi===id||!wi)&&setTimeout)return wi=setTimeout,setTimeout(e,0);try{return wi(e,0)}catch{try{return wi.call(null,e,0)}catch{return wi.call(this,e,0)}}}function wR(e){if(Si===clearTimeout)return clearTimeout(e);if((Si===nd||!Si)&&clearTimeout)return Si=clearTimeout,clearTimeout(e);try{return Si(e)}catch{try{return Si.call(null,e)}catch{return Si.call(this,e)}}}var Wi=[],Is=!1,So,zu=-1;function SR(){!Is||!So||(Is=!1,So.length?Wi=So.concat(Wi):zu=-1,Wi.length&&Qv())}function Qv(){if(!Is){var e=Jv(SR);Is=!0;for(var t=Wi.length;t;){for(So=Wi,Wi=[];++zu<t;)So&&So[zu].run();zu=-1,t=Wi.length}So=null,Is=!1,wR(e)}}Ot.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Wi.push(new ey(e,t)),Wi.length===1&&!Is&&Jv(Qv)};function ey(e,t){this.fun=e,this.array=t}ey.prototype.run=function(){this.fun.apply(null,this.array)};Ot.title="browser";Ot.browser=!0;Ot.env={};Ot.argv=[];Ot.version="";Ot.versions={};function Yi(){}Ot.on=Yi;Ot.addListener=Yi;Ot.once=Yi;Ot.off=Yi;Ot.removeListener=Yi;Ot.removeAllListeners=Yi;Ot.emit=Yi;Ot.prependListener=Yi;Ot.prependOnceListener=Yi;Ot.listeners=function(e){return[]};Ot.binding=function(e){throw new Error("process.binding is not supported")};Ot.cwd=function(){return"/"};Ot.chdir=function(e){throw new Error("process.chdir is not supported")};Ot.umask=function(){return 0}});var oy=B(Wu=>{"use strict";y();Wu.byteLength=xR;Wu.toByteArray=AR;Wu.fromByteArray=TR;var Ei=[],Tr=[],ER=typeof Uint8Array<"u"?Uint8Array:Array,od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Eo=0,iy=od.length;Eo<iy;++Eo)Ei[Eo]=od[Eo],Tr[od.charCodeAt(Eo)]=Eo;var Eo,iy;Tr[45]=62;Tr[95]=63;function ny(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function xR(e){var t=ny(e),r=t[0],i=t[1];return(r+i)*3/4-i}function IR(e,t,r){return(t+r)*3/4-r}function AR(e){var t,r=ny(e),i=r[0],n=r[1],o=new ER(IR(e,i,n)),s=0,f=n>0?i-4:i,h;for(h=0;h<f;h+=4)t=Tr[e.charCodeAt(h)]<<18|Tr[e.charCodeAt(h+1)]<<12|Tr[e.charCodeAt(h+2)]<<6|Tr[e.charCodeAt(h+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return n===2&&(t=Tr[e.charCodeAt(h)]<<2|Tr[e.charCodeAt(h+1)]>>4,o[s++]=t&255),n===1&&(t=Tr[e.charCodeAt(h)]<<10|Tr[e.charCodeAt(h+1)]<<4|Tr[e.charCodeAt(h+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function OR(e){return Ei[e>>18&63]+Ei[e>>12&63]+Ei[e>>6&63]+Ei[e&63]}function RR(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(OR(i));return n.join("")}function TR(e){for(var t,r=e.length,i=r%3,n=[],o=16383,s=0,f=r-i;s<f;s+=o)n.push(RR(e,s,s+o>f?f:s+o));return i===1?(t=e[r-1],n.push(Ei[t>>2]+Ei[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],n.push(Ei[t>>10]+Ei[t>>4&63]+Ei[t<<2&63]+"=")),n.join("")}});var sy=B(sd=>{y();sd.read=function(e,t,r,i,n){var o,s,f=n*8-i-1,h=(1<<f)-1,m=h>>1,S=-7,x=r?n-1:0,I=r?-1:1,T=e[t+x];for(x+=I,o=T&(1<<-S)-1,T>>=-S,S+=f;S>0;o=o*256+e[t+x],x+=I,S-=8);for(s=o&(1<<-S)-1,o>>=-S,S+=i;S>0;s=s*256+e[t+x],x+=I,S-=8);if(o===0)o=1-m;else{if(o===h)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-m}return(T?-1:1)*s*Math.pow(2,o-i)};sd.write=function(e,t,r,i,n,o){var s,f,h,m=o*8-n-1,S=(1<<m)-1,x=S>>1,I=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:o-1,M=i?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,s=S):(s=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-s))<1&&(s--,h*=2),s+x>=1?t+=I/h:t+=I*Math.pow(2,1-x),t*h>=2&&(s++,h/=2),s+x>=S?(f=0,s=S):s+x>=1?(f=(t*h-1)*Math.pow(2,n),s=s+x):(f=t*Math.pow(2,x-1)*Math.pow(2,n),s=0));n>=8;e[r+T]=f&255,T+=M,f/=256,n-=8);for(s=s<<n|f,m+=n;m>0;e[r+T]=s&255,T+=M,s/=256,m-=8);e[r+T-M]|=N*128}});var xt=B(Ts=>{"use strict";y();var ad=oy(),Os=sy(),ay=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ts.Buffer=G;Ts.SlowBuffer=CR;Ts.INSPECT_MAX_BYTES=50;var Yu=2147483647;Ts.kMaxLength=Yu;G.TYPED_ARRAY_SUPPORT=BR();!G.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 BR(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(G.prototype,"parent",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.buffer}});Object.defineProperty(G.prototype,"offset",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.byteOffset}});function Zi(e){if(e>Yu)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,G.prototype),t}function G(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return hd(e)}return hy(e,t,r)}G.poolSize=8192;function hy(e,t,r){if(typeof e=="string")return MR(e,t);if(ArrayBuffer.isView(e))return kR(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(xi(e,ArrayBuffer)||e&&xi(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xi(e,SharedArrayBuffer)||e&&xi(e.buffer,SharedArrayBuffer)))return ud(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return G.from(i,t,r);let n=NR(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return G.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}G.from=function(e,t,r){return hy(e,t,r)};Object.setPrototypeOf(G.prototype,Uint8Array.prototype);Object.setPrototypeOf(G,Uint8Array);function ly(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function PR(e,t,r){return ly(e),e<=0?Zi(e):t!==void 0?typeof r=="string"?Zi(e).fill(t,r):Zi(e).fill(t):Zi(e)}G.alloc=function(e,t,r){return PR(e,t,r)};function hd(e){return ly(e),Zi(e<0?0:ld(e)|0)}G.allocUnsafe=function(e){return hd(e)};G.allocUnsafeSlow=function(e){return hd(e)};function MR(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!G.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=dy(e,t)|0,i=Zi(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}function fd(e){let t=e.length<0?0:ld(e.length)|0,r=Zi(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function kR(e){if(xi(e,Uint8Array)){let t=new Uint8Array(e);return ud(t.buffer,t.byteOffset,t.byteLength)}return fd(e)}function ud(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,G.prototype),i}function NR(e){if(G.isBuffer(e)){let t=ld(e.length)|0,r=Zi(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||pd(e.length)?Zi(0):fd(e);if(e.type==="Buffer"&&Array.isArray(e.data))return fd(e.data)}function ld(e){if(e>=Yu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yu.toString(16)+" bytes");return e|0}function CR(e){return+e!=e&&(e=0),G.alloc(+e)}G.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==G.prototype};G.compare=function(t,r){if(xi(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),xi(r,Uint8Array)&&(r=G.from(r,r.offset,r.byteLength)),!G.isBuffer(t)||!G.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let i=t.length,n=r.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(t[o]!==r[o]){i=t[o],n=r[o];break}return i<n?-1:n<i?1:0};G.isEncoding=function(t){switch(String(t).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}};G.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return G.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;let n=G.allocUnsafe(r),o=0;for(i=0;i<t.length;++i){let s=t[i];if(xi(s,Uint8Array))o+s.length>n.length?(G.isBuffer(s)||(s=G.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(G.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function dy(e,t){if(G.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||xi(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return cd(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Sy(e).length;default:if(n)return i?-1:cd(e).length;t=(""+t).toLowerCase(),n=!0}}G.byteLength=dy;function DR(e,t,r){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return zR(this,t,r);case"utf8":case"utf-8":return gy(this,t,r);case"ascii":return VR(this,t,r);case"latin1":case"binary":return GR(this,t,r);case"base64":return HR(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return WR(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}G.prototype._isBuffer=!0;function xo(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}G.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)xo(this,r,r+1);return this};G.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)xo(this,r,r+3),xo(this,r+1,r+2);return this};G.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)xo(this,r,r+7),xo(this,r+1,r+6),xo(this,r+2,r+5),xo(this,r+3,r+4);return this};G.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?gy(this,0,t):DR.apply(this,arguments)};G.prototype.toLocaleString=G.prototype.toString;G.prototype.equals=function(t){if(!G.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:G.compare(this,t)===0};G.prototype.inspect=function(){let t="",r=Ts.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};ay&&(G.prototype[ay]=G.prototype.inspect);G.prototype.compare=function(t,r,i,n,o){if(xi(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),!G.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let s=o-n,f=i-r,h=Math.min(s,f),m=this.slice(n,o),S=t.slice(r,i);for(let x=0;x<h;++x)if(m[x]!==S[x]){s=m[x],f=S[x];break}return s<f?-1:f<s?1:0};function py(e,t,r,i,n){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pd(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=G.from(t,i)),G.isBuffer(t))return t.length===0?-1:fy(e,t,r,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):fy(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function fy(e,t,r,i,n){let o=1,s=e.length,f=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,f/=2,r/=2}function h(S,x){return o===1?S[x]:S.readUInt16BE(x*o)}let m;if(n){let S=-1;for(m=r;m<s;m++)if(h(e,m)===h(t,S===-1?0:m-S)){if(S===-1&&(S=m),m-S+1===f)return S*o}else S!==-1&&(m-=m-S),S=-1}else for(r+f>s&&(r=s-f),m=r;m>=0;m--){let S=!0;for(let x=0;x<f;x++)if(h(e,m+x)!==h(t,x)){S=!1;break}if(S)return m}return-1}G.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};G.prototype.indexOf=function(t,r,i){return py(this,t,r,i,!0)};G.prototype.lastIndexOf=function(t,r,i){return py(this,t,r,i,!1)};function qR(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let f=parseInt(t.substr(s*2,2),16);if(pd(f))return s;e[r+s]=f}return s}function UR(e,t,r,i){return Zu(cd(t,e.length-r),e,r,i)}function LR(e,t,r,i){return Zu(XR(t),e,r,i)}function FR(e,t,r,i){return Zu(Sy(t),e,r,i)}function jR(e,t,r,i){return Zu(JR(t,e.length-r),e,r,i)}G.prototype.write=function(t,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return qR(this,t,r,i);case"utf8":case"utf-8":return UR(this,t,r,i);case"ascii":case"latin1":case"binary":return LR(this,t,r,i);case"base64":return FR(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jR(this,t,r,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};G.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function HR(e,t,r){return t===0&&r===e.length?ad.fromByteArray(e):ad.fromByteArray(e.slice(t,r))}function gy(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let o=e[n],s=null,f=o>239?4:o>223?3:o>191?2:1;if(n+f<=r){let h,m,S,x;switch(f){case 1:o<128&&(s=o);break;case 2:h=e[n+1],(h&192)===128&&(x=(o&31)<<6|h&63,x>127&&(s=x));break;case 3:h=e[n+1],m=e[n+2],(h&192)===128&&(m&192)===128&&(x=(o&15)<<12|(h&63)<<6|m&63,x>2047&&(x<55296||x>57343)&&(s=x));break;case 4:h=e[n+1],m=e[n+2],S=e[n+3],(h&192)===128&&(m&192)===128&&(S&192)===128&&(x=(o&15)<<18|(h&63)<<12|(m&63)<<6|S&63,x>65535&&x<1114112&&(s=x))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=f}return KR(i)}var uy=4096;function KR(e){let t=e.length;if(t<=uy)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=uy));return r}function VR(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function GR(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function zR(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=t;o<r;++o)n+=QR[e[o]];return n}function WR(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}G.prototype.slice=function(t,r){let i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,G.prototype),n};function jt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}G.prototype.readUintLE=G.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[t+s]*o;return n};G.prototype.readUintBE=G.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};G.prototype.readUint8=G.prototype.readUInt8=function(t,r){return t=t>>>0,r||jt(t,1,this.length),this[t]};G.prototype.readUint16LE=G.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||jt(t,2,this.length),this[t]|this[t+1]<<8};G.prototype.readUint16BE=G.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||jt(t,2,this.length),this[t]<<8|this[t+1]};G.prototype.readUint32LE=G.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};G.prototype.readUint32BE=G.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};G.prototype.readBigUInt64LE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});G.prototype.readBigUInt64BE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});G.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[t+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};G.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=r,o=1,s=this[t+--n];for(;n>0&&(o*=256);)s+=this[t+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};G.prototype.readInt8=function(t,r){return t=t>>>0,r||jt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};G.prototype.readInt16LE=function(t,r){t=t>>>0,r||jt(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};G.prototype.readInt16BE=function(t,r){t=t>>>0,r||jt(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};G.prototype.readInt32LE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};G.prototype.readInt32BE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};G.prototype.readBigInt64LE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});G.prototype.readBigInt64BE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});G.prototype.readFloatLE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),Os.read(this,t,!0,23,4)};G.prototype.readFloatBE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),Os.read(this,t,!1,23,4)};G.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||jt(t,8,this.length),Os.read(this,t,!0,52,8)};G.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||jt(t,8,this.length),Os.read(this,t,!1,52,8)};function cr(e,t,r,i,n,o){if(!G.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}G.prototype.writeUintLE=G.prototype.writeUIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let f=Math.pow(2,8*i)-1;cr(this,t,r,i,f,0)}let o=1,s=0;for(this[r]=t&255;++s<i&&(o*=256);)this[r+s]=t/o&255;return r+i};G.prototype.writeUintBE=G.prototype.writeUIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let f=Math.pow(2,8*i)-1;cr(this,t,r,i,f,0)}let o=i-1,s=1;for(this[r+o]=t&255;--o>=0&&(s*=256);)this[r+o]=t/s&255;return r+i};G.prototype.writeUint8=G.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,1,255,0),this[r]=t&255,r+1};G.prototype.writeUint16LE=G.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};G.prototype.writeUint16BE=G.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};G.prototype.writeUint32LE=G.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};G.prototype.writeUint32BE=G.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function vy(e,t,r,i,n){wy(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function yy(e,t,r,i,n){wy(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}G.prototype.writeBigUInt64LE=Tn(function(t,r=0){return vy(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeBigUInt64BE=Tn(function(t,r=0){return yy(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let h=Math.pow(2,8*i-1);cr(this,t,r,i,h-1,-h)}let o=0,s=1,f=0;for(this[r]=t&255;++o<i&&(s*=256);)t<0&&f===0&&this[r+o-1]!==0&&(f=1),this[r+o]=(t/s>>0)-f&255;return r+i};G.prototype.writeIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let h=Math.pow(2,8*i-1);cr(this,t,r,i,h-1,-h)}let o=i-1,s=1,f=0;for(this[r+o]=t&255;--o>=0&&(s*=256);)t<0&&f===0&&this[r+o+1]!==0&&(f=1),this[r+o]=(t/s>>0)-f&255;return r+i};G.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};G.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};G.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};G.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};G.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};G.prototype.writeBigInt64LE=Tn(function(t,r=0){return vy(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});G.prototype.writeBigInt64BE=Tn(function(t,r=0){return yy(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function my(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function by(e,t,r,i,n){return t=+t,r=r>>>0,n||my(e,t,r,4,34028234663852886e22,-34028234663852886e22),Os.write(e,t,r,i,23,4),r+4}G.prototype.writeFloatLE=function(t,r,i){return by(this,t,r,!0,i)};G.prototype.writeFloatBE=function(t,r,i){return by(this,t,r,!1,i)};function _y(e,t,r,i,n){return t=+t,r=r>>>0,n||my(e,t,r,8,17976931348623157e292,-17976931348623157e292),Os.write(e,t,r,i,52,8),r+8}G.prototype.writeDoubleLE=function(t,r,i){return _y(this,t,r,!0,i)};G.prototype.writeDoubleBE=function(t,r,i){return _y(this,t,r,!1,i)};G.prototype.copy=function(t,r,i,n){if(!G.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-i&&(n=t.length-r+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),r),o};G.prototype.fill=function(t,r,i,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!G.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let s=t.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<i;++o)this[o]=t;else{let s=G.isBuffer(t)?t:G.from(t,n),f=s.length;if(f===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=s[o%f]}return this};var As={};function dd(e,t,r){As[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}dd("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);dd("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);dd("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=cy(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=cy(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function cy(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function YR(e,t,r){Rs(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&ef(t,e.length-(r+1))}function wy(e,t,r,i,n,o){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",f;throw o>3?t===0||t===BigInt(0)?f=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:f=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:f=`>= ${t}${s} and <= ${r}${s}`,new As.ERR_OUT_OF_RANGE("value",f,e)}YR(i,n,o)}function Rs(e,t){if(typeof e!="number")throw new As.ERR_INVALID_ARG_TYPE(t,"number",e)}function ef(e,t,r){throw Math.floor(e)!==e?(Rs(e,r),new As.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new As.ERR_BUFFER_OUT_OF_BOUNDS:new As.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var ZR=/[^+/0-9A-Za-z-_]/g;function $R(e){if(e=e.split("=")[0],e=e.trim().replace(ZR,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function cd(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=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 XR(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function JR(e,t){let r,i,n,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function Sy(e){return ad.toByteArray($R(e))}function Zu(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function xi(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pd(e){return e!==e}var QR=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t})();function Tn(e){return typeof BigInt>"u"?eT:e}function eT(){throw new Error("BigInt not supported")}});var O,_,y=br(()=>{O=Xv(ry()),_=Xv(xt())});var $i=B((Ey,gd)=>{y();(function(e,t){"use strict";function r(P,l){if(!P)throw new Error(l||"Assertion failed")}function i(P,l){P.super_=l;var E=function(){};E.prototype=l.prototype,P.prototype=new E,P.prototype.constructor=P}function n(P,l,E){if(n.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((l==="le"||l==="be")&&(E=l,l=10),this._init(P||0,l||10,E||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=xt().Buffer}catch{}n.isBN=function(l){return l instanceof n?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===n.wordSize&&Array.isArray(l.words)},n.max=function(l,E){return l.cmp(E)>0?l:E},n.min=function(l,E){return l.cmp(E)<0?l:E},n.prototype._init=function(l,E,d){if(typeof l=="number")return this._initNumber(l,E,d);if(typeof l=="object")return this._initArray(l,E,d);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),l=l.toString().replace(/\s+/g,"");var a=0;l[0]==="-"&&(a++,this.negative=1),a<l.length&&(E===16?this._parseHex(l,a,d):(this._parseBase(l,E,a),d==="le"&&this._initArray(this.toArray(),E,d)))},n.prototype._initNumber=function(l,E,d){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),d==="le"&&this._initArray(this.toArray(),E,d)},n.prototype._initArray=function(l,E,d){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 a=0;a<this.length;a++)this.words[a]=0;var u,p,b=0;if(d==="be")for(a=l.length-1,u=0;a>=0;a-=3)p=l[a]|l[a-1]<<8|l[a-2]<<16,this.words[u]|=p<<b&67108863,this.words[u+1]=p>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(d==="le")for(a=0,u=0;a<l.length;a+=3)p=l[a]|l[a+1]<<8|l[a+2]<<16,this.words[u]|=p<<b&67108863,this.words[u+1]=p>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this.strip()};function s(P,l){var E=P.charCodeAt(l);return E>=65&&E<=70?E-55:E>=97&&E<=102?E-87:E-48&15}function f(P,l,E){var d=s(P,E);return E-1>=l&&(d|=s(P,E-1)<<4),d}n.prototype._parseHex=function(l,E,d){this.length=Math.ceil((l.length-E)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u=0,p=0,b;if(d==="be")for(a=l.length-1;a>=E;a-=2)b=f(l,E,a)<<u,this.words[p]|=b&67108863,u>=18?(u-=18,p+=1,this.words[p]|=b>>>26):u+=8;else{var v=l.length-E;for(a=v%2===0?E+1:E;a<l.length;a+=2)b=f(l,E,a)<<u,this.words[p]|=b&67108863,u>=18?(u-=18,p+=1,this.words[p]|=b>>>26):u+=8}this.strip()};function h(P,l,E,d){for(var a=0,u=Math.min(P.length,E),p=l;p<u;p++){var b=P.charCodeAt(p)-48;a*=d,b>=49?a+=b-49+10:b>=17?a+=b-17+10:a+=b}return a}n.prototype._parseBase=function(l,E,d){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=E)a++;a--,u=u/E|0;for(var p=l.length-d,b=p%a,v=Math.min(p,p-b)+d,c=0,w=d;w<v;w+=a)c=h(l,w,w+a,E),this.imuln(u),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(b!==0){var A=1;for(c=h(l,w,l.length,E),w=0;w<b;w++)A*=E;this.imuln(A),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(l){l.words=new Array(this.length);for(var E=0;E<this.length;E++)l.words[E]=this.words[E];l.length=this.length,l.negative=this.negative,l.red=this.red},n.prototype.clone=function(){var l=new n(null);return this.copy(l),l},n.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.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"],S=[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],x=[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];n.prototype.toString=function(l,E){l=l||10,E=E|0||1;var d;if(l===16||l==="hex"){d="";for(var a=0,u=0,p=0;p<this.length;p++){var b=this.words[p],v=((b<<a|u)&16777215).toString(16);u=b>>>24-a&16777215,a+=2,a>=26&&(a-=26,p--),u!==0||p!==this.length-1?d=m[6-v.length]+v+d:d=v+d}for(u!==0&&(d=u.toString(16)+d);d.length%E!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(l===(l|0)&&l>=2&&l<=36){var c=S[l],w=x[l];d="";var A=this.clone();for(A.negative=0;!A.isZero();){var g=A.modn(w).toString(l);A=A.idivn(w),A.isZero()?d=g+d:d=m[c-g.length]+g+d}for(this.isZero()&&(d="0"+d);d.length%E!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},n.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},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(l,E){return r(typeof o<"u"),this.toArrayLike(o,l,E)},n.prototype.toArray=function(l,E){return this.toArrayLike(Array,l,E)},n.prototype.toArrayLike=function(l,E,d){var a=this.byteLength(),u=d||Math.max(1,a);r(a<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0"),this.strip();var p=E==="le",b=new l(u),v,c,w=this.clone();if(p){for(c=0;!w.isZero();c++)v=w.andln(255),w.iushrn(8),b[c]=v;for(;c<u;c++)b[c]=0}else{for(c=0;c<u-a;c++)b[c]=0;for(c=0;!w.isZero();c++)v=w.andln(255),w.iushrn(8),b[u-c-1]=v}return b},Math.clz32?n.prototype._countBits=function(l){return 32-Math.clz32(l)}:n.prototype._countBits=function(l){var E=l,d=0;return E>=4096&&(d+=13,E>>>=13),E>=64&&(d+=7,E>>>=7),E>=8&&(d+=4,E>>>=4),E>=2&&(d+=2,E>>>=2),d+E},n.prototype._zeroBits=function(l){if(l===0)return 26;var E=l,d=0;return(E&8191)===0&&(d+=13,E>>>=13),(E&127)===0&&(d+=7,E>>>=7),(E&15)===0&&(d+=4,E>>>=4),(E&3)===0&&(d+=2,E>>>=2),(E&1)===0&&d++,d},n.prototype.bitLength=function(){var l=this.words[this.length-1],E=this._countBits(l);return(this.length-1)*26+E};function I(P){for(var l=new Array(P.bitLength()),E=0;E<l.length;E++){var d=E/26|0,a=E%26;l[E]=(P.words[d]&1<<a)>>>a}return l}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,E=0;E<this.length;E++){var d=this._zeroBits(this.words[E]);if(l+=d,d!==26)break}return l},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},n.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var E=0;E<l.length;E++)this.words[E]=this.words[E]|l.words[E];return this.strip()},n.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},n.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},n.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},n.prototype.iuand=function(l){var E;this.length>l.length?E=l:E=this;for(var d=0;d<E.length;d++)this.words[d]=this.words[d]&l.words[d];return this.length=E.length,this.strip()},n.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},n.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},n.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},n.prototype.iuxor=function(l){var E,d;this.length>l.length?(E=this,d=l):(E=l,d=this);for(var a=0;a<d.length;a++)this.words[a]=E.words[a]^d.words[a];if(this!==E)for(;a<E.length;a++)this.words[a]=E.words[a];return this.length=E.length,this.strip()},n.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},n.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},n.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},n.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var E=Math.ceil(l/26)|0,d=l%26;this._expand(E),d>0&&E--;for(var a=0;a<E;a++)this.words[a]=~this.words[a]&67108863;for(d>0&&(this.words[a]=~this.words[a]&67108863>>26-d,a++);a<this.length;a++)this.words[a]=0;return this.strip()},n.prototype.notn=function(l){return this.clone().inotn(l)},n.prototype.setn=function(l,E){r(typeof l=="number"&&l>=0);var d=l/26|0,a=l%26;return this._expand(d+1),E?this.words[d]=this.words[d]|1<<a:this.words[d]=this.words[d]&~(1<<a),this.strip()},n.prototype.iadd=function(l){var E;if(this.negative!==0&&l.negative===0)return this.negative=0,E=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,E=this.isub(l),l.negative=1,E._normSign();var d,a;this.length>l.length?(d=this,a=l):(d=l,a=this);for(var u=0,p=0;p<a.length;p++)E=(d.words[p]|0)+(a.words[p]|0)+u,this.words[p]=E&67108863,u=E>>>26;for(;u!==0&&p<d.length;p++)E=(d.words[p]|0)+u,this.words[p]=E&67108863,u=E>>>26;if(this.length=d.length,u!==0)this.words[this.length]=u,this.length++;else if(d!==this)for(;p<d.length;p++)this.words[p]=d.words[p];return this},n.prototype.add=function(l){var E;return l.negative!==0&&this.negative===0?(l.negative=0,E=this.sub(l),l.negative^=1,E):l.negative===0&&this.negative!==0?(this.negative=0,E=l.sub(this),this.negative=1,E):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},n.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var E=this.iadd(l);return l.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var d=this.cmp(l);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,u;d>0?(a=this,u=l):(a=l,u=this);for(var p=0,b=0;b<u.length;b++)E=(a.words[b]|0)-(u.words[b]|0)+p,p=E>>26,this.words[b]=E&67108863;for(;p!==0&&b<a.length;b++)E=(a.words[b]|0)+p,p=E>>26,this.words[b]=E&67108863;if(p===0&&b<a.length&&a!==this)for(;b<a.length;b++)this.words[b]=a.words[b];return this.length=Math.max(this.length,b),a!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(l){return this.clone().isub(l)};function T(P,l,E){E.negative=l.negative^P.negative;var d=P.length+l.length|0;E.length=d,d=d-1|0;var a=P.words[0]|0,u=l.words[0]|0,p=a*u,b=p&67108863,v=p/67108864|0;E.words[0]=b;for(var c=1;c<d;c++){for(var w=v>>>26,A=v&67108863,g=Math.min(c,l.length-1),R=Math.max(0,c-P.length+1);R<=g;R++){var U=c-R|0;a=P.words[U]|0,u=l.words[R]|0,p=a*u+A,w+=p/67108864|0,A=p&67108863}E.words[c]=A|0,v=w|0}return v!==0?E.words[c]=v|0:E.length--,E.strip()}var M=function(l,E,d){var a=l.words,u=E.words,p=d.words,b=0,v,c,w,A=a[0]|0,g=A&8191,R=A>>>13,U=a[1]|0,H=U&8191,z=U>>>13,re=a[2]|0,oe=re&8191,k=re>>>13,q=a[3]|0,L=q&8191,V=q>>>13,fe=a[4]|0,Z=fe&8191,X=fe>>>13,ge=a[5]|0,ee=ge&8191,ae=ge>>>13,ht=a[6]|0,pe=ht&8191,J=ht>>>13,_e=a[7]|0,he=_e&8191,le=_e>>>13,Rr=a[8]|0,xe=Rr&8191,Se=Rr>>>13,no=a[9]|0,Ie=no&8191,Ae=no>>>13,Ka=u[0]|0,Oe=Ka&8191,Re=Ka>>>13,Va=u[1]|0,Te=Va&8191,Be=Va>>>13,Ga=u[2]|0,Pe=Ga&8191,Me=Ga>>>13,za=u[3]|0,ke=za&8191,Ne=za>>>13,Wa=u[4]|0,Ce=Wa&8191,De=Wa>>>13,Ya=u[5]|0,qe=Ya&8191,Ue=Ya>>>13,Za=u[6]|0,Le=Za&8191,Fe=Za>>>13,$a=u[7]|0,je=$a&8191,He=$a>>>13,Xa=u[8]|0,Ke=Xa&8191,Ve=Xa>>>13,Ja=u[9]|0,Ge=Ja&8191,ze=Ja>>>13;d.negative=l.negative^E.negative,d.length=19,v=Math.imul(g,Oe),c=Math.imul(g,Re),c=c+Math.imul(R,Oe)|0,w=Math.imul(R,Re);var xs=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(xs>>>26)|0,xs&=67108863,v=Math.imul(H,Oe),c=Math.imul(H,Re),c=c+Math.imul(z,Oe)|0,w=Math.imul(z,Re),v=v+Math.imul(g,Te)|0,c=c+Math.imul(g,Be)|0,c=c+Math.imul(R,Te)|0,w=w+Math.imul(R,Be)|0;var wt=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(oe,Oe),c=Math.imul(oe,Re),c=c+Math.imul(k,Oe)|0,w=Math.imul(k,Re),v=v+Math.imul(H,Te)|0,c=c+Math.imul(H,Be)|0,c=c+Math.imul(z,Te)|0,w=w+Math.imul(z,Be)|0,v=v+Math.imul(g,Pe)|0,c=c+Math.imul(g,Me)|0,c=c+Math.imul(R,Pe)|0,w=w+Math.imul(R,Me)|0;var St=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(St>>>26)|0,St&=67108863,v=Math.imul(L,Oe),c=Math.imul(L,Re),c=c+Math.imul(V,Oe)|0,w=Math.imul(V,Re),v=v+Math.imul(oe,Te)|0,c=c+Math.imul(oe,Be)|0,c=c+Math.imul(k,Te)|0,w=w+Math.imul(k,Be)|0,v=v+Math.imul(H,Pe)|0,c=c+Math.imul(H,Me)|0,c=c+Math.imul(z,Pe)|0,w=w+Math.imul(z,Me)|0,v=v+Math.imul(g,ke)|0,c=c+Math.imul(g,Ne)|0,c=c+Math.imul(R,ke)|0,w=w+Math.imul(R,Ne)|0;var oo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(oo>>>26)|0,oo&=67108863,v=Math.imul(Z,Oe),c=Math.imul(Z,Re),c=c+Math.imul(X,Oe)|0,w=Math.imul(X,Re),v=v+Math.imul(L,Te)|0,c=c+Math.imul(L,Be)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Be)|0,v=v+Math.imul(oe,Pe)|0,c=c+Math.imul(oe,Me)|0,c=c+Math.imul(k,Pe)|0,w=w+Math.imul(k,Me)|0,v=v+Math.imul(H,ke)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(z,ke)|0,w=w+Math.imul(z,Ne)|0,v=v+Math.imul(g,Ce)|0,c=c+Math.imul(g,De)|0,c=c+Math.imul(R,Ce)|0,w=w+Math.imul(R,De)|0;var so=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(so>>>26)|0,so&=67108863,v=Math.imul(ee,Oe),c=Math.imul(ee,Re),c=c+Math.imul(ae,Oe)|0,w=Math.imul(ae,Re),v=v+Math.imul(Z,Te)|0,c=c+Math.imul(Z,Be)|0,c=c+Math.imul(X,Te)|0,w=w+Math.imul(X,Be)|0,v=v+Math.imul(L,Pe)|0,c=c+Math.imul(L,Me)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,Me)|0,v=v+Math.imul(oe,ke)|0,c=c+Math.imul(oe,Ne)|0,c=c+Math.imul(k,ke)|0,w=w+Math.imul(k,Ne)|0,v=v+Math.imul(H,Ce)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(z,Ce)|0,w=w+Math.imul(z,De)|0,v=v+Math.imul(g,qe)|0,c=c+Math.imul(g,Ue)|0,c=c+Math.imul(R,qe)|0,w=w+Math.imul(R,Ue)|0;var ao=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(ao>>>26)|0,ao&=67108863,v=Math.imul(pe,Oe),c=Math.imul(pe,Re),c=c+Math.imul(J,Oe)|0,w=Math.imul(J,Re),v=v+Math.imul(ee,Te)|0,c=c+Math.imul(ee,Be)|0,c=c+Math.imul(ae,Te)|0,w=w+Math.imul(ae,Be)|0,v=v+Math.imul(Z,Pe)|0,c=c+Math.imul(Z,Me)|0,c=c+Math.imul(X,Pe)|0,w=w+Math.imul(X,Me)|0,v=v+Math.imul(L,ke)|0,c=c+Math.imul(L,Ne)|0,c=c+Math.imul(V,ke)|0,w=w+Math.imul(V,Ne)|0,v=v+Math.imul(oe,Ce)|0,c=c+Math.imul(oe,De)|0,c=c+Math.imul(k,Ce)|0,w=w+Math.imul(k,De)|0,v=v+Math.imul(H,qe)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(z,qe)|0,w=w+Math.imul(z,Ue)|0,v=v+Math.imul(g,Le)|0,c=c+Math.imul(g,Fe)|0,c=c+Math.imul(R,Le)|0,w=w+Math.imul(R,Fe)|0;var fo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(fo>>>26)|0,fo&=67108863,v=Math.imul(he,Oe),c=Math.imul(he,Re),c=c+Math.imul(le,Oe)|0,w=Math.imul(le,Re),v=v+Math.imul(pe,Te)|0,c=c+Math.imul(pe,Be)|0,c=c+Math.imul(J,Te)|0,w=w+Math.imul(J,Be)|0,v=v+Math.imul(ee,Pe)|0,c=c+Math.imul(ee,Me)|0,c=c+Math.imul(ae,Pe)|0,w=w+Math.imul(ae,Me)|0,v=v+Math.imul(Z,ke)|0,c=c+Math.imul(Z,Ne)|0,c=c+Math.imul(X,ke)|0,w=w+Math.imul(X,Ne)|0,v=v+Math.imul(L,Ce)|0,c=c+Math.imul(L,De)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,De)|0,v=v+Math.imul(oe,qe)|0,c=c+Math.imul(oe,Ue)|0,c=c+Math.imul(k,qe)|0,w=w+Math.imul(k,Ue)|0,v=v+Math.imul(H,Le)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(z,Le)|0,w=w+Math.imul(z,Fe)|0,v=v+Math.imul(g,je)|0,c=c+Math.imul(g,He)|0,c=c+Math.imul(R,je)|0,w=w+Math.imul(R,He)|0;var uo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(uo>>>26)|0,uo&=67108863,v=Math.imul(xe,Oe),c=Math.imul(xe,Re),c=c+Math.imul(Se,Oe)|0,w=Math.imul(Se,Re),v=v+Math.imul(he,Te)|0,c=c+Math.imul(he,Be)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Be)|0,v=v+Math.imul(pe,Pe)|0,c=c+Math.imul(pe,Me)|0,c=c+Math.imul(J,Pe)|0,w=w+Math.imul(J,Me)|0,v=v+Math.imul(ee,ke)|0,c=c+Math.imul(ee,Ne)|0,c=c+Math.imul(ae,ke)|0,w=w+Math.imul(ae,Ne)|0,v=v+Math.imul(Z,Ce)|0,c=c+Math.imul(Z,De)|0,c=c+Math.imul(X,Ce)|0,w=w+Math.imul(X,De)|0,v=v+Math.imul(L,qe)|0,c=c+Math.imul(L,Ue)|0,c=c+Math.imul(V,qe)|0,w=w+Math.imul(V,Ue)|0,v=v+Math.imul(oe,Le)|0,c=c+Math.imul(oe,Fe)|0,c=c+Math.imul(k,Le)|0,w=w+Math.imul(k,Fe)|0,v=v+Math.imul(H,je)|0,c=c+Math.imul(H,He)|0,c=c+Math.imul(z,je)|0,w=w+Math.imul(z,He)|0,v=v+Math.imul(g,Ke)|0,c=c+Math.imul(g,Ve)|0,c=c+Math.imul(R,Ke)|0,w=w+Math.imul(R,Ve)|0;var co=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(co>>>26)|0,co&=67108863,v=Math.imul(Ie,Oe),c=Math.imul(Ie,Re),c=c+Math.imul(Ae,Oe)|0,w=Math.imul(Ae,Re),v=v+Math.imul(xe,Te)|0,c=c+Math.imul(xe,Be)|0,c=c+Math.imul(Se,Te)|0,w=w+Math.imul(Se,Be)|0,v=v+Math.imul(he,Pe)|0,c=c+Math.imul(he,Me)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,Me)|0,v=v+Math.imul(pe,ke)|0,c=c+Math.imul(pe,Ne)|0,c=c+Math.imul(J,ke)|0,w=w+Math.imul(J,Ne)|0,v=v+Math.imul(ee,Ce)|0,c=c+Math.imul(ee,De)|0,c=c+Math.imul(ae,Ce)|0,w=w+Math.imul(ae,De)|0,v=v+Math.imul(Z,qe)|0,c=c+Math.imul(Z,Ue)|0,c=c+Math.imul(X,qe)|0,w=w+Math.imul(X,Ue)|0,v=v+Math.imul(L,Le)|0,c=c+Math.imul(L,Fe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Fe)|0,v=v+Math.imul(oe,je)|0,c=c+Math.imul(oe,He)|0,c=c+Math.imul(k,je)|0,w=w+Math.imul(k,He)|0,v=v+Math.imul(H,Ke)|0,c=c+Math.imul(H,Ve)|0,c=c+Math.imul(z,Ke)|0,w=w+Math.imul(z,Ve)|0,v=v+Math.imul(g,Ge)|0,c=c+Math.imul(g,ze)|0,c=c+Math.imul(R,Ge)|0,w=w+Math.imul(R,ze)|0;var ho=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(ho>>>26)|0,ho&=67108863,v=Math.imul(Ie,Te),c=Math.imul(Ie,Be),c=c+Math.imul(Ae,Te)|0,w=Math.imul(Ae,Be),v=v+Math.imul(xe,Pe)|0,c=c+Math.imul(xe,Me)|0,c=c+Math.imul(Se,Pe)|0,w=w+Math.imul(Se,Me)|0,v=v+Math.imul(he,ke)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(le,ke)|0,w=w+Math.imul(le,Ne)|0,v=v+Math.imul(pe,Ce)|0,c=c+Math.imul(pe,De)|0,c=c+Math.imul(J,Ce)|0,w=w+Math.imul(J,De)|0,v=v+Math.imul(ee,qe)|0,c=c+Math.imul(ee,Ue)|0,c=c+Math.imul(ae,qe)|0,w=w+Math.imul(ae,Ue)|0,v=v+Math.imul(Z,Le)|0,c=c+Math.imul(Z,Fe)|0,c=c+Math.imul(X,Le)|0,w=w+Math.imul(X,Fe)|0,v=v+Math.imul(L,je)|0,c=c+Math.imul(L,He)|0,c=c+Math.imul(V,je)|0,w=w+Math.imul(V,He)|0,v=v+Math.imul(oe,Ke)|0,c=c+Math.imul(oe,Ve)|0,c=c+Math.imul(k,Ke)|0,w=w+Math.imul(k,Ve)|0,v=v+Math.imul(H,Ge)|0,c=c+Math.imul(H,ze)|0,c=c+Math.imul(z,Ge)|0,w=w+Math.imul(z,ze)|0;var lo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(lo>>>26)|0,lo&=67108863,v=Math.imul(Ie,Pe),c=Math.imul(Ie,Me),c=c+Math.imul(Ae,Pe)|0,w=Math.imul(Ae,Me),v=v+Math.imul(xe,ke)|0,c=c+Math.imul(xe,Ne)|0,c=c+Math.imul(Se,ke)|0,w=w+Math.imul(Se,Ne)|0,v=v+Math.imul(he,Ce)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,De)|0,v=v+Math.imul(pe,qe)|0,c=c+Math.imul(pe,Ue)|0,c=c+Math.imul(J,qe)|0,w=w+Math.imul(J,Ue)|0,v=v+Math.imul(ee,Le)|0,c=c+Math.imul(ee,Fe)|0,c=c+Math.imul(ae,Le)|0,w=w+Math.imul(ae,Fe)|0,v=v+Math.imul(Z,je)|0,c=c+Math.imul(Z,He)|0,c=c+Math.imul(X,je)|0,w=w+Math.imul(X,He)|0,v=v+Math.imul(L,Ke)|0,c=c+Math.imul(L,Ve)|0,c=c+Math.imul(V,Ke)|0,w=w+Math.imul(V,Ve)|0,v=v+Math.imul(oe,Ge)|0,c=c+Math.imul(oe,ze)|0,c=c+Math.imul(k,Ge)|0,w=w+Math.imul(k,ze)|0;var po=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(po>>>26)|0,po&=67108863,v=Math.imul(Ie,ke),c=Math.imul(Ie,Ne),c=c+Math.imul(Ae,ke)|0,w=Math.imul(Ae,Ne),v=v+Math.imul(xe,Ce)|0,c=c+Math.imul(xe,De)|0,c=c+Math.imul(Se,Ce)|0,w=w+Math.imul(Se,De)|0,v=v+Math.imul(he,qe)|0,c=c+Math.imul(he,Ue)|0,c=c+Math.imul(le,qe)|0,w=w+Math.imul(le,Ue)|0,v=v+Math.imul(pe,Le)|0,c=c+Math.imul(pe,Fe)|0,c=c+Math.imul(J,Le)|0,w=w+Math.imul(J,Fe)|0,v=v+Math.imul(ee,je)|0,c=c+Math.imul(ee,He)|0,c=c+Math.imul(ae,je)|0,w=w+Math.imul(ae,He)|0,v=v+Math.imul(Z,Ke)|0,c=c+Math.imul(Z,Ve)|0,c=c+Math.imul(X,Ke)|0,w=w+Math.imul(X,Ve)|0,v=v+Math.imul(L,Ge)|0,c=c+Math.imul(L,ze)|0,c=c+Math.imul(V,Ge)|0,w=w+Math.imul(V,ze)|0;var go=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(go>>>26)|0,go&=67108863,v=Math.imul(Ie,Ce),c=Math.imul(Ie,De),c=c+Math.imul(Ae,Ce)|0,w=Math.imul(Ae,De),v=v+Math.imul(xe,qe)|0,c=c+Math.imul(xe,Ue)|0,c=c+Math.imul(Se,qe)|0,w=w+Math.imul(Se,Ue)|0,v=v+Math.imul(he,Le)|0,c=c+Math.imul(he,Fe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Fe)|0,v=v+Math.imul(pe,je)|0,c=c+Math.imul(pe,He)|0,c=c+Math.imul(J,je)|0,w=w+Math.imul(J,He)|0,v=v+Math.imul(ee,Ke)|0,c=c+Math.imul(ee,Ve)|0,c=c+Math.imul(ae,Ke)|0,w=w+Math.imul(ae,Ve)|0,v=v+Math.imul(Z,Ge)|0,c=c+Math.imul(Z,ze)|0,c=c+Math.imul(X,Ge)|0,w=w+Math.imul(X,ze)|0;var vo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(vo>>>26)|0,vo&=67108863,v=Math.imul(Ie,qe),c=Math.imul(Ie,Ue),c=c+Math.imul(Ae,qe)|0,w=Math.imul(Ae,Ue),v=v+Math.imul(xe,Le)|0,c=c+Math.imul(xe,Fe)|0,c=c+Math.imul(Se,Le)|0,w=w+Math.imul(Se,Fe)|0,v=v+Math.imul(he,je)|0,c=c+Math.imul(he,He)|0,c=c+Math.imul(le,je)|0,w=w+Math.imul(le,He)|0,v=v+Math.imul(pe,Ke)|0,c=c+Math.imul(pe,Ve)|0,c=c+Math.imul(J,Ke)|0,w=w+Math.imul(J,Ve)|0,v=v+Math.imul(ee,Ge)|0,c=c+Math.imul(ee,ze)|0,c=c+Math.imul(ae,Ge)|0,w=w+Math.imul(ae,ze)|0;var yo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(yo>>>26)|0,yo&=67108863,v=Math.imul(Ie,Le),c=Math.imul(Ie,Fe),c=c+Math.imul(Ae,Le)|0,w=Math.imul(Ae,Fe),v=v+Math.imul(xe,je)|0,c=c+Math.imul(xe,He)|0,c=c+Math.imul(Se,je)|0,w=w+Math.imul(Se,He)|0,v=v+Math.imul(he,Ke)|0,c=c+Math.imul(he,Ve)|0,c=c+Math.imul(le,Ke)|0,w=w+Math.imul(le,Ve)|0,v=v+Math.imul(pe,Ge)|0,c=c+Math.imul(pe,ze)|0,c=c+Math.imul(J,Ge)|0,w=w+Math.imul(J,ze)|0;var mo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(mo>>>26)|0,mo&=67108863,v=Math.imul(Ie,je),c=Math.imul(Ie,He),c=c+Math.imul(Ae,je)|0,w=Math.imul(Ae,He),v=v+Math.imul(xe,Ke)|0,c=c+Math.imul(xe,Ve)|0,c=c+Math.imul(Se,Ke)|0,w=w+Math.imul(Se,Ve)|0,v=v+Math.imul(he,Ge)|0,c=c+Math.imul(he,ze)|0,c=c+Math.imul(le,Ge)|0,w=w+Math.imul(le,ze)|0;var bo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(bo>>>26)|0,bo&=67108863,v=Math.imul(Ie,Ke),c=Math.imul(Ie,Ve),c=c+Math.imul(Ae,Ke)|0,w=Math.imul(Ae,Ve),v=v+Math.imul(xe,Ge)|0,c=c+Math.imul(xe,ze)|0,c=c+Math.imul(Se,Ge)|0,w=w+Math.imul(Se,ze)|0;var _o=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(_o>>>26)|0,_o&=67108863,v=Math.imul(Ie,Ge),c=Math.imul(Ie,ze),c=c+Math.imul(Ae,Ge)|0,w=Math.imul(Ae,ze);var wo=(b+v|0)+((c&8191)<<13)|0;return b=(w+(c>>>13)|0)+(wo>>>26)|0,wo&=67108863,p[0]=xs,p[1]=wt,p[2]=St,p[3]=oo,p[4]=so,p[5]=ao,p[6]=fo,p[7]=uo,p[8]=co,p[9]=ho,p[10]=lo,p[11]=po,p[12]=go,p[13]=vo,p[14]=yo,p[15]=mo,p[16]=bo,p[17]=_o,p[18]=wo,b!==0&&(p[19]=b,d.length++),d};Math.imul||(M=T);function N(P,l,E){E.negative=l.negative^P.negative,E.length=P.length+l.length;for(var d=0,a=0,u=0;u<E.length-1;u++){var p=a;a=0;for(var b=d&67108863,v=Math.min(u,l.length-1),c=Math.max(0,u-P.length+1);c<=v;c++){var w=u-c,A=P.words[w]|0,g=l.words[c]|0,R=A*g,U=R&67108863;p=p+(R/67108864|0)|0,U=U+b|0,b=U&67108863,p=p+(U>>>26)|0,a+=p>>>26,p&=67108863}E.words[u]=b,d=p,p=a}return d!==0?E.words[u]=d:E.length--,E.strip()}function D(P,l,E){var d=new j;return d.mulp(P,l,E)}n.prototype.mulTo=function(l,E){var d,a=this.length+l.length;return this.length===10&&l.length===10?d=M(this,l,E):a<63?d=T(this,l,E):a<1024?d=N(this,l,E):d=D(this,l,E),d};function j(P,l){this.x=P,this.y=l}j.prototype.makeRBT=function(l){for(var E=new Array(l),d=n.prototype._countBits(l)-1,a=0;a<l;a++)E[a]=this.revBin(a,d,l);return E},j.prototype.revBin=function(l,E,d){if(l===0||l===d-1)return l;for(var a=0,u=0;u<E;u++)a|=(l&1)<<E-u-1,l>>=1;return a},j.prototype.permute=function(l,E,d,a,u,p){for(var b=0;b<p;b++)a[b]=E[l[b]],u[b]=d[l[b]]},j.prototype.transform=function(l,E,d,a,u,p){this.permute(p,l,E,d,a,u);for(var b=1;b<u;b<<=1)for(var v=b<<1,c=Math.cos(2*Math.PI/v),w=Math.sin(2*Math.PI/v),A=0;A<u;A+=v)for(var g=c,R=w,U=0;U<b;U++){var H=d[A+U],z=a[A+U],re=d[A+U+b],oe=a[A+U+b],k=g*re-R*oe;oe=g*oe+R*re,re=k,d[A+U]=H+re,a[A+U]=z+oe,d[A+U+b]=H-re,a[A+U+b]=z-oe,U!==v&&(k=c*g-w*R,R=c*R+w*g,g=k)}},j.prototype.guessLen13b=function(l,E){var d=Math.max(E,l)|1,a=d&1,u=0;for(d=d/2|0;d;d=d>>>1)u++;return 1<<u+1+a},j.prototype.conjugate=function(l,E,d){if(!(d<=1))for(var a=0;a<d/2;a++){var u=l[a];l[a]=l[d-a-1],l[d-a-1]=u,u=E[a],E[a]=-E[d-a-1],E[d-a-1]=-u}},j.prototype.normalize13b=function(l,E){for(var d=0,a=0;a<E/2;a++){var u=Math.round(l[2*a+1]/E)*8192+Math.round(l[2*a]/E)+d;l[a]=u&67108863,u<67108864?d=0:d=u/67108864|0}return l},j.prototype.convert13b=function(l,E,d,a){for(var u=0,p=0;p<E;p++)u=u+(l[p]|0),d[2*p]=u&8191,u=u>>>13,d[2*p+1]=u&8191,u=u>>>13;for(p=2*E;p<a;++p)d[p]=0;r(u===0),r((u&-8192)===0)},j.prototype.stub=function(l){for(var E=new Array(l),d=0;d<l;d++)E[d]=0;return E},j.prototype.mulp=function(l,E,d){var a=2*this.guessLen13b(l.length,E.length),u=this.makeRBT(a),p=this.stub(a),b=new Array(a),v=new Array(a),c=new Array(a),w=new Array(a),A=new Array(a),g=new Array(a),R=d.words;R.length=a,this.convert13b(l.words,l.length,b,a),this.convert13b(E.words,E.length,w,a),this.transform(b,p,v,c,a,u),this.transform(w,p,A,g,a,u);for(var U=0;U<a;U++){var H=v[U]*A[U]-c[U]*g[U];c[U]=v[U]*g[U]+c[U]*A[U],v[U]=H}return this.conjugate(v,c,a),this.transform(v,c,R,p,a,u),this.conjugate(R,p,a),this.normalize13b(R,a),d.negative=l.negative^E.negative,d.length=l.length+E.length,d.strip()},n.prototype.mul=function(l){var E=new n(null);return E.words=new Array(this.length+l.length),this.mulTo(l,E)},n.prototype.mulf=function(l){var E=new n(null);return E.words=new Array(this.length+l.length),D(this,l,E)},n.prototype.imul=function(l){return this.clone().mulTo(l,this)},n.prototype.imuln=function(l){r(typeof l=="number"),r(l<67108864);for(var E=0,d=0;d<this.length;d++){var a=(this.words[d]|0)*l,u=(a&67108863)+(E&67108863);E>>=26,E+=a/67108864|0,E+=u>>>26,this.words[d]=u&67108863}return E!==0&&(this.words[d]=E,this.length++),l===0&&(this.length=1,this._normSign()),this},n.prototype.muln=function(l){return this.clone().imuln(l)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(l){var E=I(l);if(E.length===0)return new n(1);for(var d=this,a=0;a<E.length&&E[a]===0;a++,d=d.sqr());if(++a<E.length)for(var u=d.sqr();a<E.length;a++,u=u.sqr())E[a]!==0&&(d=d.mul(u));return d},n.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26,a=67108863>>>26-E<<26-E,u;if(E!==0){var p=0;for(u=0;u<this.length;u++){var b=this.words[u]&a,v=(this.words[u]|0)-b<<E;this.words[u]=v|p,p=b>>>26-E}p&&(this.words[u]=p,this.length++)}if(d!==0){for(u=this.length-1;u>=0;u--)this.words[u+d]=this.words[u];for(u=0;u<d;u++)this.words[u]=0;this.length+=d}return this.strip()},n.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},n.prototype.iushrn=function(l,E,d){r(typeof l=="number"&&l>=0);var a;E?a=(E-E%26)/26:a=0;var u=l%26,p=Math.min((l-u)/26,this.length),b=67108863^67108863>>>u<<u,v=d;if(a-=p,a=Math.max(0,a),v){for(var c=0;c<p;c++)v.words[c]=this.words[c];v.length=p}if(p!==0)if(this.length>p)for(this.length-=p,c=0;c<this.length;c++)this.words[c]=this.words[c+p];else this.words[0]=0,this.length=1;var w=0;for(c=this.length-1;c>=0&&(w!==0||c>=a);c--){var A=this.words[c]|0;this.words[c]=w<<26-u|A>>>u,w=A&b}return v&&w!==0&&(v.words[v.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(l,E,d){return r(this.negative===0),this.iushrn(l,E,d)},n.prototype.shln=function(l){return this.clone().ishln(l)},n.prototype.ushln=function(l){return this.clone().iushln(l)},n.prototype.shrn=function(l){return this.clone().ishrn(l)},n.prototype.ushrn=function(l){return this.clone().iushrn(l)},n.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26,a=1<<E;if(this.length<=d)return!1;var u=this.words[d];return!!(u&a)},n.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(E!==0&&d++,this.length=Math.min(d,this.length),E!==0){var a=67108863^67108863>>>E<<E;this.words[this.length-1]&=a}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.maskn=function(l){return this.clone().imaskn(l)},n.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)},n.prototype._iaddn=function(l){this.words[0]+=l;for(var E=0;E<this.length&&this.words[E]>=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},n.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 E=0;E<this.length&&this.words[E]<0;E++)this.words[E]+=67108864,this.words[E+1]-=1;return this.strip()},n.prototype.addn=function(l){return this.clone().iaddn(l)},n.prototype.subn=function(l){return this.clone().isubn(l)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(l,E,d){var a=l.length+d,u;this._expand(a);var p,b=0;for(u=0;u<l.length;u++){p=(this.words[u+d]|0)+b;var v=(l.words[u]|0)*E;p-=v&67108863,b=(p>>26)-(v/67108864|0),this.words[u+d]=p&67108863}for(;u<this.length-d;u++)p=(this.words[u+d]|0)+b,b=p>>26,this.words[u+d]=p&67108863;if(b===0)return this.strip();for(r(b===-1),b=0,u=0;u<this.length;u++)p=-(this.words[u]|0)+b,b=p>>26,this.words[u]=p&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(l,E){var d=this.length-l.length,a=this.clone(),u=l,p=u.words[u.length-1]|0,b=this._countBits(p);d=26-b,d!==0&&(u=u.ushln(d),a.iushln(d),p=u.words[u.length-1]|0);var v=a.length-u.length,c;if(E!=="mod"){c=new n(null),c.length=v+1,c.words=new Array(c.length);for(var w=0;w<c.length;w++)c.words[w]=0}var A=a.clone()._ishlnsubmul(u,1,v);A.negative===0&&(a=A,c&&(c.words[v]=1));for(var g=v-1;g>=0;g--){var R=(a.words[u.length+g]|0)*67108864+(a.words[u.length+g-1]|0);for(R=Math.min(R/p|0,67108863),a._ishlnsubmul(u,R,g);a.negative!==0;)R--,a.negative=0,a._ishlnsubmul(u,1,g),a.isZero()||(a.negative^=1);c&&(c.words[g]=R)}return c&&c.strip(),a.strip(),E!=="div"&&d!==0&&a.iushrn(d),{div:c||null,mod:a}},n.prototype.divmod=function(l,E,d){if(r(!l.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var a,u,p;return this.negative!==0&&l.negative===0?(p=this.neg().divmod(l,E),E!=="mod"&&(a=p.div.neg()),E!=="div"&&(u=p.mod.neg(),d&&u.negative!==0&&u.iadd(l)),{div:a,mod:u}):this.negative===0&&l.negative!==0?(p=this.divmod(l.neg(),E),E!=="mod"&&(a=p.div.neg()),{div:a,mod:p.mod}):(this.negative&l.negative)!==0?(p=this.neg().divmod(l.neg(),E),E!=="div"&&(u=p.mod.neg(),d&&u.negative!==0&&u.isub(l)),{div:p.div,mod:u}):l.length>this.length||this.cmp(l)<0?{div:new n(0),mod:this}:l.length===1?E==="div"?{div:this.divn(l.words[0]),mod:null}:E==="mod"?{div:null,mod:new n(this.modn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new n(this.modn(l.words[0]))}:this._wordDiv(l,E)},n.prototype.div=function(l){return this.divmod(l,"div",!1).div},n.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},n.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},n.prototype.divRound=function(l){var E=this.divmod(l);if(E.mod.isZero())return E.div;var d=E.mod.abs(),a=l.abs().iushrn(1),u=l.words[0]&1,p=d.cmp(a);if(p<0||u===1&&p===0)return E.div;var b=new n(1);return b.negative=this.negative^l.negative,E.div.iadd(b)},n.prototype.modn=function(l){r(l<=67108863);for(var E=(1<<26)%l,d=0,a=this.length-1;a>=0;a--)d=(E*d+(this.words[a]|0))%l;return d},n.prototype.idivn=function(l){r(l<=67108863);for(var E=0,d=this.length-1;d>=0;d--){var a=(this.words[d]|0)+E*67108864;this.words[d]=a/l|0,E=a%l}return this.strip()},n.prototype.divn=function(l){return this.clone().idivn(l)},n.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var E=this,d=l.clone();E.negative!==0?E=E.umod(l):E=E.clone();for(var a=new n(1),u=new n(0),p=new n(0),b=new n(1),v=0;E.isEven()&&d.isEven();)E.iushrn(1),d.iushrn(1),++v;for(var c=d.clone(),w=E.clone();!E.isZero();){for(var A=0,g=1;(E.words[0]&g)===0&&A<26;++A,g<<=1);if(A>0)for(E.iushrn(A);A-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(w)),a.iushrn(1),u.iushrn(1);for(var R=0,U=1;(d.words[0]&U)===0&&R<26;++R,U<<=1);if(R>0)for(d.iushrn(R);R-- >0;)(p.isOdd()||b.isOdd())&&(p.iadd(c),b.isub(w)),p.iushrn(1),b.iushrn(1);E.cmp(d)>=0?(E.isub(d),a.isub(p),u.isub(b)):(d.isub(E),p.isub(a),b.isub(u))}return{a:p,b,gcd:d.iushln(v)}},n.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var E=this,d=l.clone();E.negative!==0?E=E.umod(l):E=E.clone();for(var a=new n(1),u=new n(0),p=d.clone();E.cmpn(1)>0&&d.cmpn(1)>0;){for(var b=0,v=1;(E.words[0]&v)===0&&b<26;++b,v<<=1);if(b>0)for(E.iushrn(b);b-- >0;)a.isOdd()&&a.iadd(p),a.iushrn(1);for(var c=0,w=1;(d.words[0]&w)===0&&c<26;++c,w<<=1);if(c>0)for(d.iushrn(c);c-- >0;)u.isOdd()&&u.iadd(p),u.iushrn(1);E.cmp(d)>=0?(E.isub(d),a.isub(u)):(d.isub(E),u.isub(a))}var A;return E.cmpn(1)===0?A=a:A=u,A.cmpn(0)<0&&A.iadd(l),A},n.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var E=this.clone(),d=l.clone();E.negative=0,d.negative=0;for(var a=0;E.isEven()&&d.isEven();a++)E.iushrn(1),d.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;d.isEven();)d.iushrn(1);var u=E.cmp(d);if(u<0){var p=E;E=d,d=p}else if(u===0||d.cmpn(1)===0)break;E.isub(d)}while(!0);return d.iushln(a)},n.prototype.invm=function(l){return this.egcd(l).a.umod(l)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(l){return this.words[0]&l},n.prototype.bincn=function(l){r(typeof l=="number");var E=l%26,d=(l-E)/26,a=1<<E;if(this.length<=d)return this._expand(d+1),this.words[d]|=a,this;for(var u=a,p=d;u!==0&&p<this.length;p++){var b=this.words[p]|0;b+=u,u=b>>>26,b&=67108863,this.words[p]=b}return u!==0&&(this.words[p]=u,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(l){var E=l<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this.strip();var d;if(this.length>1)d=1;else{E&&(l=-l),r(l<=67108863,"Number is too big");var a=this.words[0]|0;d=a===l?0:a<l?-1:1}return this.negative!==0?-d|0:d},n.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var E=this.ucmp(l);return this.negative!==0?-E|0:E},n.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var E=0,d=this.length-1;d>=0;d--){var a=this.words[d]|0,u=l.words[d]|0;if(a!==u){a<u?E=-1:a>u&&(E=1);break}}return E},n.prototype.gtn=function(l){return this.cmpn(l)===1},n.prototype.gt=function(l){return this.cmp(l)===1},n.prototype.gten=function(l){return this.cmpn(l)>=0},n.prototype.gte=function(l){return this.cmp(l)>=0},n.prototype.ltn=function(l){return this.cmpn(l)===-1},n.prototype.lt=function(l){return this.cmp(l)===-1},n.prototype.lten=function(l){return this.cmpn(l)<=0},n.prototype.lte=function(l){return this.cmp(l)<=0},n.prototype.eqn=function(l){return this.cmpn(l)===0},n.prototype.eq=function(l){return this.cmp(l)===0},n.red=function(l){return new ue(l)},n.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)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(l){return this.red=l,this},n.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},n.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},n.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},n.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},n.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},n.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},n.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},n.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var Y={k256:null,p224:null,p192:null,p25519:null};function Q(P,l){this.name=P,this.p=new n(l,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var l=new n(null);return l.words=new Array(Math.ceil(this.n/13)),l},Q.prototype.ireduce=function(l){var E=l,d;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),d=E.bitLength();while(d>this.n);var a=d<this.n?-1:E.ucmp(this.p);return a===0?(E.words[0]=0,E.length=1):a>0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},Q.prototype.split=function(l,E){l.iushrn(this.n,0,E)},Q.prototype.imulK=function(l){return l.imul(this.k)};function W(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,Q),W.prototype.split=function(l,E){for(var d=4194303,a=Math.min(l.length,9),u=0;u<a;u++)E.words[u]=l.words[u];if(E.length=a,l.length<=9){l.words[0]=0,l.length=1;return}var p=l.words[9];for(E.words[E.length++]=p&d,u=10;u<l.length;u++){var b=l.words[u]|0;l.words[u-10]=(b&d)<<4|p>>>22,p=b}p>>>=22,l.words[u-10]=p,p===0&&l.length>10?l.length-=10:l.length-=9},W.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var E=0,d=0;d<l.length;d++){var a=l.words[d]|0;E+=a*977,l.words[d]=E&67108863,E=a*64+(E/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function te(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(te,Q);function ne(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,Q);function se(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(se,Q),se.prototype.imulK=function(l){for(var E=0,d=0;d<l.length;d++){var a=(l.words[d]|0)*19+E,u=a&67108863;a>>>=26,l.words[d]=u,E=a}return E!==0&&(l.words[l.length++]=E),l},n._prime=function(l){if(Y[l])return Y[l];var E;if(l==="k256")E=new W;else if(l==="p224")E=new te;else if(l==="p192")E=new ne;else if(l==="p25519")E=new se;else throw new Error("Unknown prime "+l);return Y[l]=E,E};function ue(P){if(typeof P=="string"){var l=n._prime(P);this.m=l.p,this.prime=l}else r(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}ue.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},ue.prototype._verify2=function(l,E){r((l.negative|E.negative)===0,"red works only with positives"),r(l.red&&l.red===E.red,"red works only with red numbers")},ue.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):l.umod(this.m)._forceRed(this)},ue.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},ue.prototype.add=function(l,E){this._verify2(l,E);var d=l.add(E);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},ue.prototype.iadd=function(l,E){this._verify2(l,E);var d=l.iadd(E);return d.cmp(this.m)>=0&&d.isub(this.m),d},ue.prototype.sub=function(l,E){this._verify2(l,E);var d=l.sub(E);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},ue.prototype.isub=function(l,E){this._verify2(l,E);var d=l.isub(E);return d.cmpn(0)<0&&d.iadd(this.m),d},ue.prototype.shl=function(l,E){return this._verify1(l),this.imod(l.ushln(E))},ue.prototype.imul=function(l,E){return this._verify2(l,E),this.imod(l.imul(E))},ue.prototype.mul=function(l,E){return this._verify2(l,E),this.imod(l.mul(E))},ue.prototype.isqr=function(l){return this.imul(l,l.clone())},ue.prototype.sqr=function(l){return this.mul(l,l)},ue.prototype.sqrt=function(l){if(l.isZero())return l.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var d=this.m.add(new n(1)).iushrn(2);return this.pow(l,d)}for(var a=this.m.subn(1),u=0;!a.isZero()&&a.andln(1)===0;)u++,a.iushrn(1);r(!a.isZero());var p=new n(1).toRed(this),b=p.redNeg(),v=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,v).cmp(b)!==0;)c.redIAdd(b);for(var w=this.pow(c,a),A=this.pow(l,a.addn(1).iushrn(1)),g=this.pow(l,a),R=u;g.cmp(p)!==0;){for(var U=g,H=0;U.cmp(p)!==0;H++)U=U.redSqr();r(H<R);var z=this.pow(w,new n(1).iushln(R-H-1));A=A.redMul(z),w=z.redSqr(),g=g.redMul(w),R=H}return A},ue.prototype.invm=function(l){var E=l._invmp(this.m);return E.negative!==0?(E.negative=0,this.imod(E).redNeg()):this.imod(E)},ue.prototype.pow=function(l,E){if(E.isZero())return new n(1).toRed(this);if(E.cmpn(1)===0)return l.clone();var d=4,a=new Array(1<<d);a[0]=new n(1).toRed(this),a[1]=l;for(var u=2;u<a.length;u++)a[u]=this.mul(a[u-1],l);var p=a[0],b=0,v=0,c=E.bitLength()%26;for(c===0&&(c=26),u=E.length-1;u>=0;u--){for(var w=E.words[u],A=c-1;A>=0;A--){var g=w>>A&1;if(p!==a[0]&&(p=this.sqr(p)),g===0&&b===0){v=0;continue}b<<=1,b|=g,v++,!(v!==d&&(u!==0||A!==0))&&(p=this.mul(p,a[b]),v=0,b=0)}c=26}return p},ue.prototype.convertTo=function(l){var E=l.umod(this.m);return E===l?E.clone():E},ue.prototype.convertFrom=function(l){var E=l.clone();return E.red=null,E},n.mont=function(l){return new be(l)};function be(P){ue.call(this,P),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(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)}i(be,ue),be.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},be.prototype.convertFrom=function(l){var E=this.imod(l.mul(this.rinv));return E.red=null,E},be.prototype.imul=function(l,E){if(l.isZero()||E.isZero())return l.words[0]=0,l.length=1,l;var d=l.imul(E),a=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=d.isub(a).iushrn(this.shift),p=u;return u.cmp(this.m)>=0?p=u.isub(this.m):u.cmpn(0)<0&&(p=u.iadd(this.m)),p._forceRed(this)},be.prototype.mul=function(l,E){if(l.isZero()||E.isZero())return new n(0)._forceRed(this);var d=l.mul(E),a=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=d.isub(a).iushrn(this.shift),p=u;return u.cmp(this.m)>=0?p=u.isub(this.m):u.cmpn(0)<0&&(p=u.iadd(this.m)),p._forceRed(this)},be.prototype.invm=function(l){var E=this.imod(l._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(typeof gd>"u"||gd,Ey)});var We=B((vd,Iy)=>{y();var $u=xt(),Ii=$u.Buffer;function xy(e,t){for(var r in e)t[r]=e[r]}Ii.from&&Ii.alloc&&Ii.allocUnsafe&&Ii.allocUnsafeSlow?Iy.exports=$u:(xy($u,vd),vd.Buffer=Io);function Io(e,t,r){return Ii(e,t,r)}Io.prototype=Object.create(Ii.prototype);xy(Ii,Io);Io.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Ii(e,t,r)};Io.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Ii(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Io.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Ii(e)};Io.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return $u.SlowBuffer(e)}});var Ao=B((sj,md)=>{"use strict";y();var yd=65536,tT=4294967295;function rT(){throw new Error(`Secure random number generation is not supported by this browser.
2
- Use Chrome, Firefox or Internet Explorer 11`)}var iT=We().Buffer,Xu=globalThis.crypto||globalThis.msCrypto;Xu&&Xu.getRandomValues?md.exports=nT:md.exports=rT;function nT(e,t){if(e>tT)throw new RangeError("requested too many random bytes");var r=iT.allocUnsafe(e);if(e>0)if(e>yd)for(var i=0;i<e;i+=yd)Xu.getRandomValues(r.slice(i,i+yd));else Xu.getRandomValues(r);return typeof t=="function"?O.default.nextTick(function(){t(null,r)}):r}});var we=B((fj,bd)=>{y();typeof Object.create=="function"?bd.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:bd.exports=function(t,r){if(r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}});var Ps=B((cj,_d)=>{"use strict";y();var Bs=typeof Reflect=="object"?Reflect:null,Ay=Bs&&typeof Bs.apply=="function"?Bs.apply:function(t,r,i){return Function.prototype.apply.call(t,r,i)},Ju;Bs&&typeof Bs.ownKeys=="function"?Ju=Bs.ownKeys:Object.getOwnPropertySymbols?Ju=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ju=function(t){return Object.getOwnPropertyNames(t)};function oT(e){console&&console.warn&&console.warn(e)}var Ry=Number.isNaN||function(t){return t!==t};function ft(){ft.init.call(this)}_d.exports=ft;_d.exports.once=uT;ft.EventEmitter=ft;ft.prototype._events=void 0;ft.prototype._eventsCount=0;ft.prototype._maxListeners=void 0;var Oy=10;function Qu(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(ft,"defaultMaxListeners",{enumerable:!0,get:function(){return Oy},set:function(e){if(typeof e!="number"||e<0||Ry(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Oy=e}});ft.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};ft.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Ry(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Ty(e){return e._maxListeners===void 0?ft.defaultMaxListeners:e._maxListeners}ft.prototype.getMaxListeners=function(){return Ty(this)};ft.prototype.emit=function(t){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=t==="error",o=this._events;if(o!==void 0)n=n&&o.error===void 0;else if(!n)return!1;if(n){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var f=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw f.context=s,f}var h=o[t];if(h===void 0)return!1;if(typeof h=="function")Ay(h,this,r);else for(var m=h.length,S=Ny(h,m),i=0;i<m;++i)Ay(S[i],this,r);return!0};function By(e,t,r,i){var n,o,s;if(Qu(r),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),s===void 0)s=o[t]=r,++e._eventsCount;else if(typeof s=="function"?s=o[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),n=Ty(e),n>0&&s.length>n&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,oT(f)}return e}ft.prototype.addListener=function(t,r){return By(this,t,r,!1)};ft.prototype.on=ft.prototype.addListener;ft.prototype.prependListener=function(t,r){return By(this,t,r,!0)};function sT(){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 Py(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=sT.bind(i);return n.listener=r,i.wrapFn=n,n}ft.prototype.once=function(t,r){return Qu(r),this.on(t,Py(this,t,r)),this};ft.prototype.prependOnceListener=function(t,r){return Qu(r),this.prependListener(t,Py(this,t,r)),this};ft.prototype.removeListener=function(t,r){var i,n,o,s,f;if(Qu(r),n=this._events,n===void 0)return this;if(i=n[t],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||r));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===r||i[s].listener===r){f=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():aT(i,o),i.length===1&&(n[t]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",t,f||r)}return this};ft.prototype.off=ft.prototype.removeListener;ft.prototype.removeAllListeners=function(t){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var o=Object.keys(i),s;for(n=0;n<o.length;++n)s=o[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(t,r[n]);return this};function My(e,t,r){var i=e._events;if(i===void 0)return[];var n=i[t];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?fT(n):Ny(n,n.length)}ft.prototype.listeners=function(t){return My(this,t,!0)};ft.prototype.rawListeners=function(t){return My(this,t,!1)};ft.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ky.call(e,t)};ft.prototype.listenerCount=ky;function ky(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ft.prototype.eventNames=function(){return this._eventsCount>0?Ju(this._events):[]};function Ny(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function aT(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function fT(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function uT(e,t){return new Promise(function(r,i){function n(s){e.removeListener(t,o),i(s)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",n),r([].slice.call(arguments))}Cy(e,t,o,{once:!0}),t!=="error"&&cT(e,n,{once:!0})})}function cT(e,t,r){typeof e.on=="function"&&Cy(e,"error",t,r)}function Cy(e,t,r,i){if(typeof e.on=="function")i.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function n(o){i.once&&e.removeEventListener(t,n),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}});var wd=B((lj,Dy)=>{y();Dy.exports=Ps().EventEmitter});var ec=B((pj,qy)=>{"use strict";y();qy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;t[r]=n;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0}});var tf=B((vj,Uy)=>{"use strict";y();var hT=ec();Uy.exports=function(){return hT()&&!!Symbol.toStringTag}});var tc=B((mj,Ly)=>{"use strict";y();Ly.exports=Object});var jy=B((_j,Fy)=>{"use strict";y();Fy.exports=Error});var Ky=B((Sj,Hy)=>{"use strict";y();Hy.exports=EvalError});var Gy=B((xj,Vy)=>{"use strict";y();Vy.exports=RangeError});var Wy=B((Aj,zy)=>{"use strict";y();zy.exports=ReferenceError});var Sd=B((Rj,Yy)=>{"use strict";y();Yy.exports=SyntaxError});var Oo=B((Bj,Zy)=>{"use strict";y();Zy.exports=TypeError});var Xy=B((Mj,$y)=>{"use strict";y();$y.exports=URIError});var Qy=B((Nj,Jy)=>{"use strict";y();Jy.exports=Math.abs});var tm=B((Dj,em)=>{"use strict";y();em.exports=Math.floor});var im=B((Uj,rm)=>{"use strict";y();rm.exports=Math.max});var om=B((Fj,nm)=>{"use strict";y();nm.exports=Math.min});var am=B((Hj,sm)=>{"use strict";y();sm.exports=Math.pow});var um=B((Vj,fm)=>{"use strict";y();fm.exports=Math.round});var hm=B((zj,cm)=>{"use strict";y();cm.exports=Number.isNaN||function(t){return t!==t}});var dm=B((Yj,lm)=>{"use strict";y();var lT=hm();lm.exports=function(t){return lT(t)||t===0?t:t<0?-1:1}});var gm=B(($j,pm)=>{"use strict";y();pm.exports=Object.getOwnPropertyDescriptor});var Ro=B((Jj,vm)=>{"use strict";y();var rc=gm();if(rc)try{rc([],"length")}catch{rc=null}vm.exports=rc});var rf=B((eH,ym)=>{"use strict";y();var ic=Object.defineProperty||!1;if(ic)try{ic({},"a",{value:1})}catch{ic=!1}ym.exports=ic});var _m=B((rH,bm)=>{"use strict";y();var mm=typeof Symbol<"u"&&Symbol,dT=ec();bm.exports=function(){return typeof mm!="function"||typeof Symbol!="function"||typeof mm("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dT()}});var Ed=B((nH,wm)=>{"use strict";y();wm.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var xd=B((sH,Sm)=>{"use strict";y();var pT=tc();Sm.exports=pT.getPrototypeOf||null});var Im=B((fH,xm)=>{"use strict";y();var gT="Function.prototype.bind called on incompatible ",vT=Object.prototype.toString,yT=Math.max,mT="[object Function]",Em=function(t,r){for(var i=[],n=0;n<t.length;n+=1)i[n]=t[n];for(var o=0;o<r.length;o+=1)i[o+t.length]=r[o];return i},bT=function(t,r){for(var i=[],n=r||0,o=0;n<t.length;n+=1,o+=1)i[o]=t[n];return i},_T=function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r};xm.exports=function(t){var r=this;if(typeof r!="function"||vT.apply(r)!==mT)throw new TypeError(gT+r);for(var i=bT(arguments,1),n,o=function(){if(this instanceof n){var S=r.apply(this,Em(i,arguments));return Object(S)===S?S:this}return r.apply(t,Em(i,arguments))},s=yT(0,r.length-i.length),f=[],h=0;h<s;h++)f[h]="$"+h;if(n=Function("binder","return function ("+_T(f,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var m=function(){};m.prototype=r.prototype,n.prototype=new m,m.prototype=null}return n}});var Ms=B((cH,Am)=>{"use strict";y();var wT=Im();Am.exports=Function.prototype.bind||wT});var nc=B((lH,Om)=>{"use strict";y();Om.exports=Function.prototype.call});var oc=B((pH,Rm)=>{"use strict";y();Rm.exports=Function.prototype.apply});var Bm=B((vH,Tm)=>{"use strict";y();Tm.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Id=B((mH,Pm)=>{"use strict";y();var ST=Ms(),ET=oc(),xT=nc(),IT=Bm();Pm.exports=IT||ST.call(xT,ET)});var sc=B((_H,Mm)=>{"use strict";y();var AT=Ms(),OT=Oo(),RT=nc(),TT=Id();Mm.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new OT("a function is required");return TT(AT,RT,t)}});var Um=B((SH,qm)=>{"use strict";y();var BT=sc(),km=Ro(),Cm;try{Cm=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Ad=!!Cm&&km&&km(Object.prototype,"__proto__"),Dm=Object,Nm=Dm.getPrototypeOf;qm.exports=Ad&&typeof Ad.get=="function"?BT([Ad.get]):typeof Nm=="function"?function(t){return Nm(t==null?t:Dm(t))}:!1});var ac=B((xH,Hm)=>{"use strict";y();var Lm=Ed(),Fm=xd(),jm=Um();Hm.exports=Lm?function(t){return Lm(t)}:Fm?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Fm(t)}:jm?function(t){return jm(t)}:null});var Od=B((AH,Km)=>{"use strict";y();var PT=Function.prototype.call,MT=Object.prototype.hasOwnProperty,kT=Ms();Km.exports=kT.call(PT,MT)});var cc=B((RH,Zm)=>{"use strict";y();var $e,NT=tc(),CT=jy(),DT=Ky(),qT=Gy(),UT=Wy(),Ds=Sd(),Cs=Oo(),LT=Xy(),FT=Qy(),jT=tm(),HT=im(),KT=om(),VT=am(),GT=um(),zT=dm(),Wm=Function,Rd=function(e){try{return Wm('"use strict"; return ('+e+").constructor;")()}catch{}},nf=Ro(),WT=rf(),Td=function(){throw new Cs},YT=nf?(function(){try{return arguments.callee,Td}catch{try{return nf(arguments,"callee").get}catch{return Td}}})():Td,ks=_m()(),Ht=ac(),ZT=xd(),$T=Ed(),Ym=oc(),of=nc(),Ns={},XT=typeof Uint8Array>"u"||!Ht?$e:Ht(Uint8Array),To={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$e:ArrayBuffer,"%ArrayIteratorPrototype%":ks&&Ht?Ht([][Symbol.iterator]()):$e,"%AsyncFromSyncIteratorPrototype%":$e,"%AsyncFunction%":Ns,"%AsyncGenerator%":Ns,"%AsyncGeneratorFunction%":Ns,"%AsyncIteratorPrototype%":Ns,"%Atomics%":typeof Atomics>"u"?$e:Atomics,"%BigInt%":typeof BigInt>"u"?$e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":CT,"%eval%":eval,"%EvalError%":DT,"%Float16Array%":typeof Float16Array>"u"?$e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?$e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$e:FinalizationRegistry,"%Function%":Wm,"%GeneratorFunction%":Ns,"%Int8Array%":typeof Int8Array>"u"?$e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ks&&Ht?Ht(Ht([][Symbol.iterator]())):$e,"%JSON%":typeof JSON=="object"?JSON:$e,"%Map%":typeof Map>"u"?$e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ks||!Ht?$e:Ht(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":NT,"%Object.getOwnPropertyDescriptor%":nf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$e:Promise,"%Proxy%":typeof Proxy>"u"?$e:Proxy,"%RangeError%":qT,"%ReferenceError%":UT,"%Reflect%":typeof Reflect>"u"?$e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ks||!Ht?$e:Ht(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ks&&Ht?Ht(""[Symbol.iterator]()):$e,"%Symbol%":ks?Symbol:$e,"%SyntaxError%":Ds,"%ThrowTypeError%":YT,"%TypedArray%":XT,"%TypeError%":Cs,"%Uint8Array%":typeof Uint8Array>"u"?$e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$e:Uint32Array,"%URIError%":LT,"%WeakMap%":typeof WeakMap>"u"?$e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$e:WeakSet,"%Function.prototype.call%":of,"%Function.prototype.apply%":Ym,"%Object.defineProperty%":WT,"%Object.getPrototypeOf%":ZT,"%Math.abs%":FT,"%Math.floor%":jT,"%Math.max%":HT,"%Math.min%":KT,"%Math.pow%":VT,"%Math.round%":GT,"%Math.sign%":zT,"%Reflect.getPrototypeOf%":$T};if(Ht)try{null.error}catch(e){Vm=Ht(Ht(e)),To["%Error.prototype%"]=Vm}var Vm,JT=function e(t){var r;if(t==="%AsyncFunction%")r=Rd("async function () {}");else if(t==="%GeneratorFunction%")r=Rd("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Rd("async function* () {}");else if(t==="%AsyncGenerator%"){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=e("%AsyncGenerator%");n&&Ht&&(r=Ht(n.prototype))}return To[t]=r,r},Gm={__proto__:null,"%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"]},sf=Ms(),fc=Od(),QT=sf.call(of,Array.prototype.concat),e4=sf.call(Ym,Array.prototype.splice),zm=sf.call(of,String.prototype.replace),uc=sf.call(of,String.prototype.slice),t4=sf.call(of,RegExp.prototype.exec),r4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,i4=/\\(\\)?/g,n4=function(t){var r=uc(t,0,1),i=uc(t,-1);if(r==="%"&&i!=="%")throw new Ds("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ds("invalid intrinsic syntax, expected opening `%`");var n=[];return zm(t,r4,function(o,s,f,h){n[n.length]=f?zm(h,i4,"$1"):s||o}),n},o4=function(t,r){var i=t,n;if(fc(Gm,i)&&(n=Gm[i],i="%"+n[0]+"%"),fc(To,i)){var o=To[i];if(o===Ns&&(o=JT(i)),typeof o>"u"&&!r)throw new Cs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new Ds("intrinsic "+t+" does not exist!")};Zm.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new Cs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Cs('"allowMissing" argument must be a boolean');if(t4(/^%?[^%]*%?$/,t)===null)throw new Ds("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=n4(t),n=i.length>0?i[0]:"",o=o4("%"+n+"%",r),s=o.name,f=o.value,h=!1,m=o.alias;m&&(n=m[0],e4(i,QT([0,1],m)));for(var S=1,x=!0;S<i.length;S+=1){var I=i[S],T=uc(I,0,1),M=uc(I,-1);if((T==='"'||T==="'"||T==="`"||M==='"'||M==="'"||M==="`")&&T!==M)throw new Ds("property names with quotes must have matching quotes");if((I==="constructor"||!x)&&(h=!0),n+="."+I,s="%"+n+"%",fc(To,s))f=To[s];else if(f!=null){if(!(I in f)){if(!r)throw new Cs("base intrinsic for "+t+" exists, but the property is not available.");return}if(nf&&S+1>=i.length){var N=nf(f,I);x=!!N,x&&"get"in N&&!("originalValue"in N.get)?f=N.get:f=f[I]}else x=fc(f,I),f=f[I];x&&!h&&(To[s]=f)}}return f}});var Bn=B((BH,Jm)=>{"use strict";y();var $m=cc(),Xm=sc(),s4=Xm([$m("%String.prototype.indexOf%")]);Jm.exports=function(t,r){var i=$m(t,!!r);return typeof i=="function"&&s4(t,".prototype.")>-1?Xm([i]):i}});var tb=B((MH,eb)=>{"use strict";y();var a4=tf()(),f4=Bn(),Bd=f4("Object.prototype.toString"),hc=function(t){return a4&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Bd(t)==="[object Arguments]"},Qm=function(t){return hc(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&Bd(t)!=="[object Array]"&&"callee"in t&&Bd(t.callee)==="[object Function]"},u4=(function(){return hc(arguments)})();hc.isLegacyArguments=Qm;eb.exports=u4?hc:Qm});var ab=B((NH,sb)=>{"use strict";y();var rb=Bn(),c4=tf()(),h4=Od(),l4=Ro(),kd;c4?(ib=rb("RegExp.prototype.exec"),Pd={},lc=function(){throw Pd},Md={toString:lc,valueOf:lc},typeof Symbol.toPrimitive=="symbol"&&(Md[Symbol.toPrimitive]=lc),kd=function(t){if(!t||typeof t!="object")return!1;var r=l4(t,"lastIndex"),i=r&&h4(r,"value");if(!i)return!1;try{ib(t,Md)}catch(n){return n===Pd}}):(nb=rb("Object.prototype.toString"),ob="[object RegExp]",kd=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:nb(t)===ob});var ib,Pd,lc,Md,nb,ob;sb.exports=kd});var ub=B((DH,fb)=>{"use strict";y();var d4=Bn(),p4=ab(),g4=d4("RegExp.prototype.exec"),v4=Oo();fb.exports=function(t){if(!p4(t))throw new v4("`regex` must be a RegExp");return function(i){return g4(t,i)!==null}}});var hb=B((UH,cb)=>{"use strict";y();var y4=function*(){}.constructor;cb.exports=()=>y4});var gb=B((FH,pb)=>{"use strict";y();var db=Bn(),m4=ub(),b4=m4(/^\s*(?:function)?\*/),_4=tf()(),lb=ac(),w4=db("Object.prototype.toString"),S4=db("Function.prototype.toString"),E4=hb();pb.exports=function(t){if(typeof t!="function")return!1;if(b4(S4(t)))return!0;if(!_4){var r=w4(t);return r==="[object GeneratorFunction]"}if(!lb)return!1;var i=E4();return i&&lb(t)===i.prototype}});var bb=B((HH,mb)=>{"use strict";y();var yb=Function.prototype.toString,qs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Cd,dc;if(typeof qs=="function"&&typeof Object.defineProperty=="function")try{Cd=Object.defineProperty({},"length",{get:function(){throw dc}}),dc={},qs(function(){throw 42},null,Cd)}catch(e){e!==dc&&(qs=null)}else qs=null;var x4=/^\s*class\b/,Dd=function(t){try{var r=yb.call(t);return x4.test(r)}catch{return!1}},Nd=function(t){try{return Dd(t)?!1:(yb.call(t),!0)}catch{return!1}},pc=Object.prototype.toString,I4="[object Object]",A4="[object Function]",O4="[object GeneratorFunction]",R4="[object HTMLAllCollection]",T4="[object HTML document.all class]",B4="[object HTMLCollection]",P4=typeof Symbol=="function"&&!!Symbol.toStringTag,M4=!(0 in[,]),qd=function(){return!1};typeof document=="object"&&(vb=document.all,pc.call(vb)===pc.call(document.all)&&(qd=function(t){if((M4||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=pc.call(t);return(r===R4||r===T4||r===B4||r===I4)&&t("")==null}catch{}return!1}));var vb;mb.exports=qs?function(t){if(qd(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{qs(t,null,Cd)}catch(r){if(r!==dc)return!1}return!Dd(t)&&Nd(t)}:function(t){if(qd(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(P4)return Nd(t);if(Dd(t))return!1;var r=pc.call(t);return r!==A4&&r!==O4&&!/^\[object HTML/.test(r)?!1:Nd(t)}});var Sb=B((VH,wb)=>{"use strict";y();var k4=bb(),N4=Object.prototype.toString,_b=Object.prototype.hasOwnProperty,C4=function(t,r,i){for(var n=0,o=t.length;n<o;n++)_b.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))},D4=function(t,r,i){for(var n=0,o=t.length;n<o;n++)i==null?r(t.charAt(n),n,t):r.call(i,t.charAt(n),n,t)},q4=function(t,r,i){for(var n in t)_b.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))};function U4(e){return N4.call(e)==="[object Array]"}wb.exports=function(t,r,i){if(!k4(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),U4(t)?C4(t,r,n):typeof t=="string"?D4(t,r,n):q4(t,r,n)}});var xb=B((zH,Eb)=>{"use strict";y();Eb.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Ab=B((YH,Ib)=>{"use strict";y();var Ud=xb(),L4=globalThis;Ib.exports=function(){for(var t=[],r=0;r<Ud.length;r++)typeof L4[Ud[r]]=="function"&&(t[t.length]=Ud[r]);return t}});var Ld=B(($H,Tb)=>{"use strict";y();var Ob=rf(),F4=Sd(),Us=Oo(),Rb=Ro();Tb.exports=function(t,r,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Us("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Us("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Us("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Us("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Us("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Us("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,h=!!Rb&&Rb(t,r);if(Ob)Ob(t,r,{configurable:s===null&&h?h.configurable:!s,enumerable:n===null&&h?h.enumerable:!n,value:i,writable:o===null&&h?h.writable:!o});else if(f||!n&&!o&&!s)t[r]=i;else throw new F4("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var jd=B((JH,Pb)=>{"use strict";y();var Fd=rf(),Bb=function(){return!!Fd};Bb.hasArrayLengthDefineBug=function(){if(!Fd)return null;try{return Fd([],"length",{value:1}).length!==1}catch{return!0}};Pb.exports=Bb});var Db=B((eK,Cb)=>{"use strict";y();var j4=cc(),Mb=Ld(),H4=jd()(),kb=Ro(),Nb=Oo(),K4=j4("%Math.floor%");Cb.exports=function(t,r){if(typeof t!="function")throw new Nb("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||K4(r)!==r)throw new Nb("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&kb){var s=kb(t,"length");s&&!s.configurable&&(n=!1),s&&!s.writable&&(o=!1)}return(n||o||!i)&&(H4?Mb(t,"length",r,!0,!0):Mb(t,"length",r)),t}});var Ub=B((rK,qb)=>{"use strict";y();var V4=Ms(),G4=oc(),z4=Id();qb.exports=function(){return z4(V4,G4,arguments)}});var af=B((nK,gc)=>{"use strict";y();var W4=Db(),Lb=rf(),Y4=sc(),Fb=Ub();gc.exports=function(t){var r=Y4(arguments),i=1+t.length-(arguments.length-1);return W4(r,i>0?i:0,!0)};Lb?Lb(gc.exports,"apply",{value:Fb}):gc.exports.apply=Fb});var Gd=B((sK,Vb)=>{"use strict";y();var mc=Sb(),Z4=Ab(),jb=af(),Kd=Bn(),yc=Ro(),vc=ac(),$4=Kd("Object.prototype.toString"),Kb=tf()(),Hb=globalThis,Hd=Z4(),Vd=Kd("String.prototype.slice"),X4=Kd("Array.prototype.indexOf",!0)||function(t,r){for(var i=0;i<t.length;i+=1)if(t[i]===r)return i;return-1},bc={__proto__:null};Kb&&yc&&vc?mc(Hd,function(e){var t=new Hb[e];if(Symbol.toStringTag in t&&vc){var r=vc(t),i=yc(r,Symbol.toStringTag);if(!i&&r){var n=vc(r);i=yc(n,Symbol.toStringTag)}if(i&&i.get){var o=jb(i.get);bc["$"+e]=o}}}):mc(Hd,function(e){var t=new Hb[e],r=t.slice||t.set;if(r){var i=jb(r);bc["$"+e]=i}});var J4=function(t){var r=!1;return mc(bc,function(i,n){if(!r)try{"$"+i(t)===n&&(r=Vd(n,1))}catch{}}),r},Q4=function(t){var r=!1;return mc(bc,function(i,n){if(!r)try{i(t),r=Vd(n,1)}catch{}}),r};Vb.exports=function(t){if(!t||typeof t!="object")return!1;if(!Kb){var r=Vd($4(t),8,-1);return X4(Hd,r)>-1?r:r!=="Object"?!1:Q4(t)}return yc?J4(t):null}});var zd=B((fK,Gb)=>{"use strict";y();var e8=Gd();Gb.exports=function(t){return!!e8(t)}});var o1=B(Xe=>{"use strict";y();var t8=tb(),r8=gb(),Yr=Gd(),zb=zd();function Ls(e){return e.call.bind(e)}var Wb=typeof BigInt<"u",Yb=typeof Symbol<"u",Br=Ls(Object.prototype.toString),i8=Ls(Number.prototype.valueOf),n8=Ls(String.prototype.valueOf),o8=Ls(Boolean.prototype.valueOf);Wb&&(Zb=Ls(BigInt.prototype.valueOf));var Zb;Yb&&($b=Ls(Symbol.prototype.valueOf));var $b;function uf(e,t){if(typeof e!="object")return!1;try{return t(e),!0}catch{return!1}}Xe.isArgumentsObject=t8;Xe.isGeneratorFunction=r8;Xe.isTypedArray=zb;function s8(e){return typeof Promise<"u"&&e instanceof Promise||e!==null&&typeof e=="object"&&typeof e.then=="function"&&typeof e.catch=="function"}Xe.isPromise=s8;function a8(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):zb(e)||Jb(e)}Xe.isArrayBufferView=a8;function f8(e){return Yr(e)==="Uint8Array"}Xe.isUint8Array=f8;function u8(e){return Yr(e)==="Uint8ClampedArray"}Xe.isUint8ClampedArray=u8;function c8(e){return Yr(e)==="Uint16Array"}Xe.isUint16Array=c8;function h8(e){return Yr(e)==="Uint32Array"}Xe.isUint32Array=h8;function l8(e){return Yr(e)==="Int8Array"}Xe.isInt8Array=l8;function d8(e){return Yr(e)==="Int16Array"}Xe.isInt16Array=d8;function p8(e){return Yr(e)==="Int32Array"}Xe.isInt32Array=p8;function g8(e){return Yr(e)==="Float32Array"}Xe.isFloat32Array=g8;function v8(e){return Yr(e)==="Float64Array"}Xe.isFloat64Array=v8;function y8(e){return Yr(e)==="BigInt64Array"}Xe.isBigInt64Array=y8;function m8(e){return Yr(e)==="BigUint64Array"}Xe.isBigUint64Array=m8;function _c(e){return Br(e)==="[object Map]"}_c.working=typeof Map<"u"&&_c(new Map);function b8(e){return typeof Map>"u"?!1:_c.working?_c(e):e instanceof Map}Xe.isMap=b8;function wc(e){return Br(e)==="[object Set]"}wc.working=typeof Set<"u"&&wc(new Set);function _8(e){return typeof Set>"u"?!1:wc.working?wc(e):e instanceof Set}Xe.isSet=_8;function Sc(e){return Br(e)==="[object WeakMap]"}Sc.working=typeof WeakMap<"u"&&Sc(new WeakMap);function w8(e){return typeof WeakMap>"u"?!1:Sc.working?Sc(e):e instanceof WeakMap}Xe.isWeakMap=w8;function Yd(e){return Br(e)==="[object WeakSet]"}Yd.working=typeof WeakSet<"u"&&Yd(new WeakSet);function S8(e){return Yd(e)}Xe.isWeakSet=S8;function Ec(e){return Br(e)==="[object ArrayBuffer]"}Ec.working=typeof ArrayBuffer<"u"&&Ec(new ArrayBuffer);function Xb(e){return typeof ArrayBuffer>"u"?!1:Ec.working?Ec(e):e instanceof ArrayBuffer}Xe.isArrayBuffer=Xb;function xc(e){return Br(e)==="[object DataView]"}xc.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&xc(new DataView(new ArrayBuffer(1),0,1));function Jb(e){return typeof DataView>"u"?!1:xc.working?xc(e):e instanceof DataView}Xe.isDataView=Jb;var Wd=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ff(e){return Br(e)==="[object SharedArrayBuffer]"}function Qb(e){return typeof Wd>"u"?!1:(typeof ff.working>"u"&&(ff.working=ff(new Wd)),ff.working?ff(e):e instanceof Wd)}Xe.isSharedArrayBuffer=Qb;function E8(e){return Br(e)==="[object AsyncFunction]"}Xe.isAsyncFunction=E8;function x8(e){return Br(e)==="[object Map Iterator]"}Xe.isMapIterator=x8;function I8(e){return Br(e)==="[object Set Iterator]"}Xe.isSetIterator=I8;function A8(e){return Br(e)==="[object Generator]"}Xe.isGeneratorObject=A8;function O8(e){return Br(e)==="[object WebAssembly.Module]"}Xe.isWebAssemblyCompiledModule=O8;function e1(e){return uf(e,i8)}Xe.isNumberObject=e1;function t1(e){return uf(e,n8)}Xe.isStringObject=t1;function r1(e){return uf(e,o8)}Xe.isBooleanObject=r1;function i1(e){return Wb&&uf(e,Zb)}Xe.isBigIntObject=i1;function n1(e){return Yb&&uf(e,$b)}Xe.isSymbolObject=n1;function R8(e){return e1(e)||t1(e)||r1(e)||i1(e)||n1(e)}Xe.isBoxedPrimitive=R8;function T8(e){return typeof Uint8Array<"u"&&(Xb(e)||Qb(e))}Xe.isAnyArrayBuffer=T8;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(Xe,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})})});var a1=B((lK,s1)=>{y();s1.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}});var Ai=B(Je=>{y();var f1=Object.getOwnPropertyDescriptors||function(t){for(var r=Object.keys(t),i={},n=0;n<r.length;n++)i[r[n]]=Object.getOwnPropertyDescriptor(t,r[n]);return i},B8=/%[sdj%]/g;Je.format=function(e){if(!Pc(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Pn(arguments[r]));return t.join(" ")}for(var r=1,i=arguments,n=i.length,o=String(e).replace(B8,function(f){if(f==="%%")return"%";if(r>=n)return f;switch(f){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch{return"[Circular]"}default:return f}}),s=i[r];r<n;s=i[++r])Bc(s)||!Fs(s)?o+=" "+s:o+=" "+Pn(s);return o};Je.deprecate=function(e,t){if(typeof O.default<"u"&&O.default.noDeprecation===!0)return e;if(typeof O.default>"u")return function(){return Je.deprecate(e,t).apply(this,arguments)};var r=!1;function i(){if(!r){if(O.default.throwDeprecation)throw new Error(t);O.default.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}return i};var Ic={},u1=/^$/;O.default.env.NODE_DEBUG&&(Ac=O.default.env.NODE_DEBUG,Ac=Ac.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u1=new RegExp("^"+Ac+"$","i"));var Ac;Je.debuglog=function(e){if(e=e.toUpperCase(),!Ic[e])if(u1.test(e)){var t=O.default.pid;Ic[e]=function(){var r=Je.format.apply(Je,arguments);console.error("%s %d: %s",e,t,r)}}else Ic[e]=function(){};return Ic[e]};function Pn(e,t){var r={seen:[],stylize:M8};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Jd(t)?r.showHidden=t:t&&Je._extend(r,t),Po(r.showHidden)&&(r.showHidden=!1),Po(r.depth)&&(r.depth=2),Po(r.colors)&&(r.colors=!1),Po(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=P8),Rc(r,e,r.depth)}Je.inspect=Pn;Pn.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]};Pn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function P8(e,t){var r=Pn.styles[t];return r?"\x1B["+Pn.colors[r][0]+"m"+e+"\x1B["+Pn.colors[r][1]+"m":e}function M8(e,t){return e}function k8(e){var t={};return e.forEach(function(r,i){t[r]=!0}),t}function Rc(e,t,r){if(e.customInspect&&t&&Oc(t.inspect)&&t.inspect!==Je.inspect&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);return Pc(i)||(i=Rc(e,i,r)),i}var n=N8(e,t);if(n)return n;var o=Object.keys(t),s=k8(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),hf(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Zd(t);if(o.length===0){if(Oc(t)){var f=t.name?": "+t.name:"";return e.stylize("[Function"+f+"]","special")}if(cf(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Tc(t))return e.stylize(Date.prototype.toString.call(t),"date");if(hf(t))return Zd(t)}var h="",m=!1,S=["{","}"];if(c1(t)&&(m=!0,S=["[","]"]),Oc(t)){var x=t.name?": "+t.name:"";h=" [Function"+x+"]"}if(cf(t)&&(h=" "+RegExp.prototype.toString.call(t)),Tc(t)&&(h=" "+Date.prototype.toUTCString.call(t)),hf(t)&&(h=" "+Zd(t)),o.length===0&&(!m||t.length==0))return S[0]+h+S[1];if(r<0)return cf(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var I;return m?I=C8(e,t,r,s,o):I=o.map(function(T){return Xd(e,t,r,s,T,m)}),e.seen.pop(),D8(I,h,S)}function N8(e,t){if(Po(t))return e.stylize("undefined","undefined");if(Pc(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(h1(t))return e.stylize(""+t,"number");if(Jd(t))return e.stylize(""+t,"boolean");if(Bc(t))return e.stylize("null","null")}function Zd(e){return"["+Error.prototype.toString.call(e)+"]"}function C8(e,t,r,i,n){for(var o=[],s=0,f=t.length;s<f;++s)l1(t,String(s))?o.push(Xd(e,t,r,i,String(s),!0)):o.push("");return n.forEach(function(h){h.match(/^\d+$/)||o.push(Xd(e,t,r,i,h,!0))}),o}function Xd(e,t,r,i,n,o){var s,f,h;if(h=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]},h.get?h.set?f=e.stylize("[Getter/Setter]","special"):f=e.stylize("[Getter]","special"):h.set&&(f=e.stylize("[Setter]","special")),l1(i,n)||(s="["+n+"]"),f||(e.seen.indexOf(h.value)<0?(Bc(r)?f=Rc(e,h.value,null):f=Rc(e,h.value,r-1),f.indexOf(`
1
+ var bsvLTP=(()=>{var dR=Object.create;var Qa=Object.defineProperty;var pR=Object.getOwnPropertyDescriptor;var gR=Object.getOwnPropertyNames;var vR=Object.getPrototypeOf,yR=Object.prototype.hasOwnProperty;var mR=(e,t,r)=>t in e?Qa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var br=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(i){throw r=[i],i}};var B=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},bR=(e,t)=>{for(var r in t)Qa(e,r,{get:t[r],enumerable:!0})},$v=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of gR(t))!yR.call(e,n)&&n!==r&&Qa(e,n,{get:()=>t[n],enumerable:!(i=pR(t,n))||i.enumerable});return e};var Xv=(e,t,r)=>(r=e!=null?dR(vR(e)):{},$v(t||!e||!e.__esModule?Qa(r,"default",{value:e,enumerable:!0}):r,e)),_R=e=>$v(Qa({},"__esModule",{value:!0}),e);var de=(e,t,r)=>mR(e,typeof t!="symbol"?t+"":t,r);var ry=B((YF,ty)=>{y();var Ot=ty.exports={},wi,Si;function id(){throw new Error("setTimeout has not been defined")}function nd(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?wi=setTimeout:wi=id}catch{wi=id}try{typeof clearTimeout=="function"?Si=clearTimeout:Si=nd}catch{Si=nd}})();function Jv(e){if(wi===setTimeout)return setTimeout(e,0);if((wi===id||!wi)&&setTimeout)return wi=setTimeout,setTimeout(e,0);try{return wi(e,0)}catch{try{return wi.call(null,e,0)}catch{return wi.call(this,e,0)}}}function wR(e){if(Si===clearTimeout)return clearTimeout(e);if((Si===nd||!Si)&&clearTimeout)return Si=clearTimeout,clearTimeout(e);try{return Si(e)}catch{try{return Si.call(null,e)}catch{return Si.call(this,e)}}}var Wi=[],Is=!1,So,zu=-1;function SR(){!Is||!So||(Is=!1,So.length?Wi=So.concat(Wi):zu=-1,Wi.length&&Qv())}function Qv(){if(!Is){var e=Jv(SR);Is=!0;for(var t=Wi.length;t;){for(So=Wi,Wi=[];++zu<t;)So&&So[zu].run();zu=-1,t=Wi.length}So=null,Is=!1,wR(e)}}Ot.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];Wi.push(new ey(e,t)),Wi.length===1&&!Is&&Jv(Qv)};function ey(e,t){this.fun=e,this.array=t}ey.prototype.run=function(){this.fun.apply(null,this.array)};Ot.title="browser";Ot.browser=!0;Ot.env={};Ot.argv=[];Ot.version="";Ot.versions={};function Yi(){}Ot.on=Yi;Ot.addListener=Yi;Ot.once=Yi;Ot.off=Yi;Ot.removeListener=Yi;Ot.removeAllListeners=Yi;Ot.emit=Yi;Ot.prependListener=Yi;Ot.prependOnceListener=Yi;Ot.listeners=function(e){return[]};Ot.binding=function(e){throw new Error("process.binding is not supported")};Ot.cwd=function(){return"/"};Ot.chdir=function(e){throw new Error("process.chdir is not supported")};Ot.umask=function(){return 0}});var oy=B(Wu=>{"use strict";y();Wu.byteLength=xR;Wu.toByteArray=AR;Wu.fromByteArray=TR;var Ei=[],Tr=[],ER=typeof Uint8Array<"u"?Uint8Array:Array,od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Eo=0,iy=od.length;Eo<iy;++Eo)Ei[Eo]=od[Eo],Tr[od.charCodeAt(Eo)]=Eo;var Eo,iy;Tr[45]=62;Tr[95]=63;function ny(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function xR(e){var t=ny(e),r=t[0],i=t[1];return(r+i)*3/4-i}function IR(e,t,r){return(t+r)*3/4-r}function AR(e){var t,r=ny(e),i=r[0],n=r[1],o=new ER(IR(e,i,n)),s=0,f=n>0?i-4:i,h;for(h=0;h<f;h+=4)t=Tr[e.charCodeAt(h)]<<18|Tr[e.charCodeAt(h+1)]<<12|Tr[e.charCodeAt(h+2)]<<6|Tr[e.charCodeAt(h+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=t&255;return n===2&&(t=Tr[e.charCodeAt(h)]<<2|Tr[e.charCodeAt(h+1)]>>4,o[s++]=t&255),n===1&&(t=Tr[e.charCodeAt(h)]<<10|Tr[e.charCodeAt(h+1)]<<4|Tr[e.charCodeAt(h+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function OR(e){return Ei[e>>18&63]+Ei[e>>12&63]+Ei[e>>6&63]+Ei[e&63]}function RR(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(OR(i));return n.join("")}function TR(e){for(var t,r=e.length,i=r%3,n=[],o=16383,s=0,f=r-i;s<f;s+=o)n.push(RR(e,s,s+o>f?f:s+o));return i===1?(t=e[r-1],n.push(Ei[t>>2]+Ei[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],n.push(Ei[t>>10]+Ei[t>>4&63]+Ei[t<<2&63]+"=")),n.join("")}});var sy=B(sd=>{y();sd.read=function(e,t,r,i,n){var o,s,f=n*8-i-1,h=(1<<f)-1,m=h>>1,S=-7,x=r?n-1:0,I=r?-1:1,T=e[t+x];for(x+=I,o=T&(1<<-S)-1,T>>=-S,S+=f;S>0;o=o*256+e[t+x],x+=I,S-=8);for(s=o&(1<<-S)-1,o>>=-S,S+=i;S>0;s=s*256+e[t+x],x+=I,S-=8);if(o===0)o=1-m;else{if(o===h)return s?NaN:(T?-1:1)*(1/0);s=s+Math.pow(2,i),o=o-m}return(T?-1:1)*s*Math.pow(2,o-i)};sd.write=function(e,t,r,i,n,o){var s,f,h,m=o*8-n-1,S=(1<<m)-1,x=S>>1,I=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=i?0:o-1,M=i?1:-1,N=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(f=isNaN(t)?1:0,s=S):(s=Math.floor(Math.log(t)/Math.LN2),t*(h=Math.pow(2,-s))<1&&(s--,h*=2),s+x>=1?t+=I/h:t+=I*Math.pow(2,1-x),t*h>=2&&(s++,h/=2),s+x>=S?(f=0,s=S):s+x>=1?(f=(t*h-1)*Math.pow(2,n),s=s+x):(f=t*Math.pow(2,x-1)*Math.pow(2,n),s=0));n>=8;e[r+T]=f&255,T+=M,f/=256,n-=8);for(s=s<<n|f,m+=n;m>0;e[r+T]=s&255,T+=M,s/=256,m-=8);e[r+T-M]|=N*128}});var xt=B(Ts=>{"use strict";y();var ad=oy(),Os=sy(),ay=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ts.Buffer=G;Ts.SlowBuffer=CR;Ts.INSPECT_MAX_BYTES=50;var Yu=2147483647;Ts.kMaxLength=Yu;G.TYPED_ARRAY_SUPPORT=BR();!G.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 BR(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(G.prototype,"parent",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.buffer}});Object.defineProperty(G.prototype,"offset",{enumerable:!0,get:function(){if(G.isBuffer(this))return this.byteOffset}});function Zi(e){if(e>Yu)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,G.prototype),t}function G(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return hd(e)}return hy(e,t,r)}G.poolSize=8192;function hy(e,t,r){if(typeof e=="string")return MR(e,t);if(ArrayBuffer.isView(e))return kR(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(xi(e,ArrayBuffer)||e&&xi(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xi(e,SharedArrayBuffer)||e&&xi(e.buffer,SharedArrayBuffer)))return ud(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return G.from(i,t,r);let n=NR(e);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return G.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}G.from=function(e,t,r){return hy(e,t,r)};Object.setPrototypeOf(G.prototype,Uint8Array.prototype);Object.setPrototypeOf(G,Uint8Array);function ly(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function PR(e,t,r){return ly(e),e<=0?Zi(e):t!==void 0?typeof r=="string"?Zi(e).fill(t,r):Zi(e).fill(t):Zi(e)}G.alloc=function(e,t,r){return PR(e,t,r)};function hd(e){return ly(e),Zi(e<0?0:ld(e)|0)}G.allocUnsafe=function(e){return hd(e)};G.allocUnsafeSlow=function(e){return hd(e)};function MR(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!G.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=dy(e,t)|0,i=Zi(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}function fd(e){let t=e.length<0?0:ld(e.length)|0,r=Zi(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function kR(e){if(xi(e,Uint8Array)){let t=new Uint8Array(e);return ud(t.buffer,t.byteOffset,t.byteLength)}return fd(e)}function ud(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,G.prototype),i}function NR(e){if(G.isBuffer(e)){let t=ld(e.length)|0,r=Zi(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||pd(e.length)?Zi(0):fd(e);if(e.type==="Buffer"&&Array.isArray(e.data))return fd(e.data)}function ld(e){if(e>=Yu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Yu.toString(16)+" bytes");return e|0}function CR(e){return+e!=e&&(e=0),G.alloc(+e)}G.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==G.prototype};G.compare=function(t,r){if(xi(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),xi(r,Uint8Array)&&(r=G.from(r,r.offset,r.byteLength)),!G.isBuffer(t)||!G.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let i=t.length,n=r.length;for(let o=0,s=Math.min(i,n);o<s;++o)if(t[o]!==r[o]){i=t[o],n=r[o];break}return i<n?-1:n<i?1:0};G.isEncoding=function(t){switch(String(t).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}};G.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return G.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;let n=G.allocUnsafe(r),o=0;for(i=0;i<t.length;++i){let s=t[i];if(xi(s,Uint8Array))o+s.length>n.length?(G.isBuffer(s)||(s=G.from(s)),s.copy(n,o)):Uint8Array.prototype.set.call(n,s,o);else if(G.isBuffer(s))s.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return n};function dy(e,t){if(G.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||xi(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return cd(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Sy(e).length;default:if(n)return i?-1:cd(e).length;t=(""+t).toLowerCase(),n=!0}}G.byteLength=dy;function DR(e,t,r){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return zR(this,t,r);case"utf8":case"utf-8":return gy(this,t,r);case"ascii":return VR(this,t,r);case"latin1":case"binary":return GR(this,t,r);case"base64":return HR(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return WR(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}G.prototype._isBuffer=!0;function xo(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}G.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)xo(this,r,r+1);return this};G.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)xo(this,r,r+3),xo(this,r+1,r+2);return this};G.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)xo(this,r,r+7),xo(this,r+1,r+6),xo(this,r+2,r+5),xo(this,r+3,r+4);return this};G.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?gy(this,0,t):DR.apply(this,arguments)};G.prototype.toLocaleString=G.prototype.toString;G.prototype.equals=function(t){if(!G.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:G.compare(this,t)===0};G.prototype.inspect=function(){let t="",r=Ts.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};ay&&(G.prototype[ay]=G.prototype.inspect);G.prototype.compare=function(t,r,i,n,o){if(xi(t,Uint8Array)&&(t=G.from(t,t.offset,t.byteLength)),!G.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let s=o-n,f=i-r,h=Math.min(s,f),m=this.slice(n,o),S=t.slice(r,i);for(let x=0;x<h;++x)if(m[x]!==S[x]){s=m[x],f=S[x];break}return s<f?-1:f<s?1:0};function py(e,t,r,i,n){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,pd(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=G.from(t,i)),G.isBuffer(t))return t.length===0?-1:fy(e,t,r,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):fy(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function fy(e,t,r,i,n){let o=1,s=e.length,f=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,s/=2,f/=2,r/=2}function h(S,x){return o===1?S[x]:S.readUInt16BE(x*o)}let m;if(n){let S=-1;for(m=r;m<s;m++)if(h(e,m)===h(t,S===-1?0:m-S)){if(S===-1&&(S=m),m-S+1===f)return S*o}else S!==-1&&(m-=m-S),S=-1}else for(r+f>s&&(r=s-f),m=r;m>=0;m--){let S=!0;for(let x=0;x<f;x++)if(h(e,m+x)!==h(t,x)){S=!1;break}if(S)return m}return-1}G.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};G.prototype.indexOf=function(t,r,i){return py(this,t,r,i,!0)};G.prototype.lastIndexOf=function(t,r,i){return py(this,t,r,i,!1)};function qR(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let s;for(s=0;s<i;++s){let f=parseInt(t.substr(s*2,2),16);if(pd(f))return s;e[r+s]=f}return s}function LR(e,t,r,i){return Zu(cd(t,e.length-r),e,r,i)}function UR(e,t,r,i){return Zu(XR(t),e,r,i)}function FR(e,t,r,i){return Zu(Sy(t),e,r,i)}function jR(e,t,r,i){return Zu(JR(t,e.length-r),e,r,i)}G.prototype.write=function(t,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return qR(this,t,r,i);case"utf8":case"utf-8":return LR(this,t,r,i);case"ascii":case"latin1":case"binary":return UR(this,t,r,i);case"base64":return FR(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jR(this,t,r,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}};G.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function HR(e,t,r){return t===0&&r===e.length?ad.fromByteArray(e):ad.fromByteArray(e.slice(t,r))}function gy(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let o=e[n],s=null,f=o>239?4:o>223?3:o>191?2:1;if(n+f<=r){let h,m,S,x;switch(f){case 1:o<128&&(s=o);break;case 2:h=e[n+1],(h&192)===128&&(x=(o&31)<<6|h&63,x>127&&(s=x));break;case 3:h=e[n+1],m=e[n+2],(h&192)===128&&(m&192)===128&&(x=(o&15)<<12|(h&63)<<6|m&63,x>2047&&(x<55296||x>57343)&&(s=x));break;case 4:h=e[n+1],m=e[n+2],S=e[n+3],(h&192)===128&&(m&192)===128&&(S&192)===128&&(x=(o&15)<<18|(h&63)<<12|(m&63)<<6|S&63,x>65535&&x<1114112&&(s=x))}}s===null?(s=65533,f=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|s&1023),i.push(s),n+=f}return KR(i)}var uy=4096;function KR(e){let t=e.length;if(t<=uy)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=uy));return r}function VR(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function GR(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function zR(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=t;o<r;++o)n+=QR[e[o]];return n}function WR(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}G.prototype.slice=function(t,r){let i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,G.prototype),n};function jt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}G.prototype.readUintLE=G.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[t+s]*o;return n};G.prototype.readUintBE=G.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};G.prototype.readUint8=G.prototype.readUInt8=function(t,r){return t=t>>>0,r||jt(t,1,this.length),this[t]};G.prototype.readUint16LE=G.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||jt(t,2,this.length),this[t]|this[t+1]<<8};G.prototype.readUint16BE=G.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||jt(t,2,this.length),this[t]<<8|this[t+1]};G.prototype.readUint32LE=G.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};G.prototype.readUint32BE=G.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};G.prototype.readBigUInt64LE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});G.prototype.readBigUInt64BE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});G.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=this[t],o=1,s=0;for(;++s<r&&(o*=256);)n+=this[t+s]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};G.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||jt(t,r,this.length);let n=r,o=1,s=this[t+--n];for(;n>0&&(o*=256);)s+=this[t+--n]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};G.prototype.readInt8=function(t,r){return t=t>>>0,r||jt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};G.prototype.readInt16LE=function(t,r){t=t>>>0,r||jt(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};G.prototype.readInt16BE=function(t,r){t=t>>>0,r||jt(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};G.prototype.readInt32LE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};G.prototype.readInt32BE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};G.prototype.readBigInt64LE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});G.prototype.readBigInt64BE=Tn(function(t){t=t>>>0,Rs(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&ef(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});G.prototype.readFloatLE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),Os.read(this,t,!0,23,4)};G.prototype.readFloatBE=function(t,r){return t=t>>>0,r||jt(t,4,this.length),Os.read(this,t,!1,23,4)};G.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||jt(t,8,this.length),Os.read(this,t,!0,52,8)};G.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||jt(t,8,this.length),Os.read(this,t,!1,52,8)};function cr(e,t,r,i,n,o){if(!G.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}G.prototype.writeUintLE=G.prototype.writeUIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let f=Math.pow(2,8*i)-1;cr(this,t,r,i,f,0)}let o=1,s=0;for(this[r]=t&255;++s<i&&(o*=256);)this[r+s]=t/o&255;return r+i};G.prototype.writeUintBE=G.prototype.writeUIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let f=Math.pow(2,8*i)-1;cr(this,t,r,i,f,0)}let o=i-1,s=1;for(this[r+o]=t&255;--o>=0&&(s*=256);)this[r+o]=t/s&255;return r+i};G.prototype.writeUint8=G.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,1,255,0),this[r]=t&255,r+1};G.prototype.writeUint16LE=G.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};G.prototype.writeUint16BE=G.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};G.prototype.writeUint32LE=G.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};G.prototype.writeUint32BE=G.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function vy(e,t,r,i,n){wy(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,r}function yy(e,t,r,i,n){wy(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s=s>>8,e[r+2]=s,s=s>>8,e[r+1]=s,s=s>>8,e[r]=s,r+8}G.prototype.writeBigUInt64LE=Tn(function(t,r=0){return vy(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeBigUInt64BE=Tn(function(t,r=0){return yy(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});G.prototype.writeIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let h=Math.pow(2,8*i-1);cr(this,t,r,i,h-1,-h)}let o=0,s=1,f=0;for(this[r]=t&255;++o<i&&(s*=256);)t<0&&f===0&&this[r+o-1]!==0&&(f=1),this[r+o]=(t/s>>0)-f&255;return r+i};G.prototype.writeIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let h=Math.pow(2,8*i-1);cr(this,t,r,i,h-1,-h)}let o=i-1,s=1,f=0;for(this[r+o]=t&255;--o>=0&&(s*=256);)t<0&&f===0&&this[r+o+1]!==0&&(f=1),this[r+o]=(t/s>>0)-f&255;return r+i};G.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};G.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};G.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};G.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};G.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||cr(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};G.prototype.writeBigInt64LE=Tn(function(t,r=0){return vy(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});G.prototype.writeBigInt64BE=Tn(function(t,r=0){return yy(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function my(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function by(e,t,r,i,n){return t=+t,r=r>>>0,n||my(e,t,r,4,34028234663852886e22,-34028234663852886e22),Os.write(e,t,r,i,23,4),r+4}G.prototype.writeFloatLE=function(t,r,i){return by(this,t,r,!0,i)};G.prototype.writeFloatBE=function(t,r,i){return by(this,t,r,!1,i)};function _y(e,t,r,i,n){return t=+t,r=r>>>0,n||my(e,t,r,8,17976931348623157e292,-17976931348623157e292),Os.write(e,t,r,i,52,8),r+8}G.prototype.writeDoubleLE=function(t,r,i){return _y(this,t,r,!0,i)};G.prototype.writeDoubleBE=function(t,r,i){return _y(this,t,r,!1,i)};G.prototype.copy=function(t,r,i,n){if(!G.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-i&&(n=t.length-r+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),r),o};G.prototype.fill=function(t,r,i,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!G.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let s=t.charCodeAt(0);(n==="utf8"&&s<128||n==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<i;++o)this[o]=t;else{let s=G.isBuffer(t)?t:G.from(t,n),f=s.length;if(f===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=s[o%f]}return this};var As={};function dd(e,t,r){As[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}dd("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);dd("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);dd("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=cy(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=cy(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function cy(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function YR(e,t,r){Rs(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&ef(t,e.length-(r+1))}function wy(e,t,r,i,n,o){if(e>r||e<t){let s=typeof t=="bigint"?"n":"",f;throw o>3?t===0||t===BigInt(0)?f=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:f=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:f=`>= ${t}${s} and <= ${r}${s}`,new As.ERR_OUT_OF_RANGE("value",f,e)}YR(i,n,o)}function Rs(e,t){if(typeof e!="number")throw new As.ERR_INVALID_ARG_TYPE(t,"number",e)}function ef(e,t,r){throw Math.floor(e)!==e?(Rs(e,r),new As.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new As.ERR_BUFFER_OUT_OF_BOUNDS:new As.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var ZR=/[^+/0-9A-Za-z-_]/g;function $R(e){if(e=e.split("=")[0],e=e.trim().replace(ZR,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function cd(e,t){t=t||1/0;let r,i=e.length,n=null,o=[];for(let s=0;s<i;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=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 XR(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function JR(e,t){let r,i,n,o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function Sy(e){return ad.toByteArray($R(e))}function Zu(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function xi(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function pd(e){return e!==e}var QR=(function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t})();function Tn(e){return typeof BigInt>"u"?eT:e}function eT(){throw new Error("BigInt not supported")}});var O,_,y=br(()=>{O=Xv(ry()),_=Xv(xt())});var $i=B((Ey,gd)=>{y();(function(e,t){"use strict";function r(P,l){if(!P)throw new Error(l||"Assertion failed")}function i(P,l){P.super_=l;var E=function(){};E.prototype=l.prototype,P.prototype=new E,P.prototype.constructor=P}function n(P,l,E){if(n.isBN(P))return P;this.negative=0,this.words=null,this.length=0,this.red=null,P!==null&&((l==="le"||l==="be")&&(E=l,l=10),this._init(P||0,l||10,E||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=xt().Buffer}catch{}n.isBN=function(l){return l instanceof n?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===n.wordSize&&Array.isArray(l.words)},n.max=function(l,E){return l.cmp(E)>0?l:E},n.min=function(l,E){return l.cmp(E)<0?l:E},n.prototype._init=function(l,E,d){if(typeof l=="number")return this._initNumber(l,E,d);if(typeof l=="object")return this._initArray(l,E,d);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),l=l.toString().replace(/\s+/g,"");var a=0;l[0]==="-"&&(a++,this.negative=1),a<l.length&&(E===16?this._parseHex(l,a,d):(this._parseBase(l,E,a),d==="le"&&this._initArray(this.toArray(),E,d)))},n.prototype._initNumber=function(l,E,d){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),d==="le"&&this._initArray(this.toArray(),E,d)},n.prototype._initArray=function(l,E,d){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 a=0;a<this.length;a++)this.words[a]=0;var u,p,b=0;if(d==="be")for(a=l.length-1,u=0;a>=0;a-=3)p=l[a]|l[a-1]<<8|l[a-2]<<16,this.words[u]|=p<<b&67108863,this.words[u+1]=p>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);else if(d==="le")for(a=0,u=0;a<l.length;a+=3)p=l[a]|l[a+1]<<8|l[a+2]<<16,this.words[u]|=p<<b&67108863,this.words[u+1]=p>>>26-b&67108863,b+=24,b>=26&&(b-=26,u++);return this.strip()};function s(P,l){var E=P.charCodeAt(l);return E>=65&&E<=70?E-55:E>=97&&E<=102?E-87:E-48&15}function f(P,l,E){var d=s(P,E);return E-1>=l&&(d|=s(P,E-1)<<4),d}n.prototype._parseHex=function(l,E,d){this.length=Math.ceil((l.length-E)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u=0,p=0,b;if(d==="be")for(a=l.length-1;a>=E;a-=2)b=f(l,E,a)<<u,this.words[p]|=b&67108863,u>=18?(u-=18,p+=1,this.words[p]|=b>>>26):u+=8;else{var v=l.length-E;for(a=v%2===0?E+1:E;a<l.length;a+=2)b=f(l,E,a)<<u,this.words[p]|=b&67108863,u>=18?(u-=18,p+=1,this.words[p]|=b>>>26):u+=8}this.strip()};function h(P,l,E,d){for(var a=0,u=Math.min(P.length,E),p=l;p<u;p++){var b=P.charCodeAt(p)-48;a*=d,b>=49?a+=b-49+10:b>=17?a+=b-17+10:a+=b}return a}n.prototype._parseBase=function(l,E,d){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=E)a++;a--,u=u/E|0;for(var p=l.length-d,b=p%a,v=Math.min(p,p-b)+d,c=0,w=d;w<v;w+=a)c=h(l,w,w+a,E),this.imuln(u),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(b!==0){var A=1;for(c=h(l,w,l.length,E),w=0;w<b;w++)A*=E;this.imuln(A),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(l){l.words=new Array(this.length);for(var E=0;E<this.length;E++)l.words[E]=this.words[E];l.length=this.length,l.negative=this.negative,l.red=this.red},n.prototype.clone=function(){var l=new n(null);return this.copy(l),l},n.prototype._expand=function(l){for(;this.length<l;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.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"],S=[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],x=[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];n.prototype.toString=function(l,E){l=l||10,E=E|0||1;var d;if(l===16||l==="hex"){d="";for(var a=0,u=0,p=0;p<this.length;p++){var b=this.words[p],v=((b<<a|u)&16777215).toString(16);u=b>>>24-a&16777215,a+=2,a>=26&&(a-=26,p--),u!==0||p!==this.length-1?d=m[6-v.length]+v+d:d=v+d}for(u!==0&&(d=u.toString(16)+d);d.length%E!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}if(l===(l|0)&&l>=2&&l<=36){var c=S[l],w=x[l];d="";var A=this.clone();for(A.negative=0;!A.isZero();){var g=A.modn(w).toString(l);A=A.idivn(w),A.isZero()?d=g+d:d=m[c-g.length]+g+d}for(this.isZero()&&(d="0"+d);d.length%E!==0;)d="0"+d;return this.negative!==0&&(d="-"+d),d}r(!1,"Base should be between 2 and 36")},n.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},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(l,E){return r(typeof o<"u"),this.toArrayLike(o,l,E)},n.prototype.toArray=function(l,E){return this.toArrayLike(Array,l,E)},n.prototype.toArrayLike=function(l,E,d){var a=this.byteLength(),u=d||Math.max(1,a);r(a<=u,"byte array longer than desired length"),r(u>0,"Requested array length <= 0"),this.strip();var p=E==="le",b=new l(u),v,c,w=this.clone();if(p){for(c=0;!w.isZero();c++)v=w.andln(255),w.iushrn(8),b[c]=v;for(;c<u;c++)b[c]=0}else{for(c=0;c<u-a;c++)b[c]=0;for(c=0;!w.isZero();c++)v=w.andln(255),w.iushrn(8),b[u-c-1]=v}return b},Math.clz32?n.prototype._countBits=function(l){return 32-Math.clz32(l)}:n.prototype._countBits=function(l){var E=l,d=0;return E>=4096&&(d+=13,E>>>=13),E>=64&&(d+=7,E>>>=7),E>=8&&(d+=4,E>>>=4),E>=2&&(d+=2,E>>>=2),d+E},n.prototype._zeroBits=function(l){if(l===0)return 26;var E=l,d=0;return(E&8191)===0&&(d+=13,E>>>=13),(E&127)===0&&(d+=7,E>>>=7),(E&15)===0&&(d+=4,E>>>=4),(E&3)===0&&(d+=2,E>>>=2),(E&1)===0&&d++,d},n.prototype.bitLength=function(){var l=this.words[this.length-1],E=this._countBits(l);return(this.length-1)*26+E};function I(P){for(var l=new Array(P.bitLength()),E=0;E<l.length;E++){var d=E/26|0,a=E%26;l[E]=(P.words[d]&1<<a)>>>a}return l}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var l=0,E=0;E<this.length;E++){var d=this._zeroBits(this.words[E]);if(l+=d,d!==26)break}return l},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},n.prototype.fromTwos=function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var E=0;E<l.length;E++)this.words[E]=this.words[E]|l.words[E];return this.strip()},n.prototype.ior=function(l){return r((this.negative|l.negative)===0),this.iuor(l)},n.prototype.or=function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},n.prototype.uor=function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},n.prototype.iuand=function(l){var E;this.length>l.length?E=l:E=this;for(var d=0;d<E.length;d++)this.words[d]=this.words[d]&l.words[d];return this.length=E.length,this.strip()},n.prototype.iand=function(l){return r((this.negative|l.negative)===0),this.iuand(l)},n.prototype.and=function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},n.prototype.uand=function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},n.prototype.iuxor=function(l){var E,d;this.length>l.length?(E=this,d=l):(E=l,d=this);for(var a=0;a<d.length;a++)this.words[a]=E.words[a]^d.words[a];if(this!==E)for(;a<E.length;a++)this.words[a]=E.words[a];return this.length=E.length,this.strip()},n.prototype.ixor=function(l){return r((this.negative|l.negative)===0),this.iuxor(l)},n.prototype.xor=function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},n.prototype.uxor=function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},n.prototype.inotn=function(l){r(typeof l=="number"&&l>=0);var E=Math.ceil(l/26)|0,d=l%26;this._expand(E),d>0&&E--;for(var a=0;a<E;a++)this.words[a]=~this.words[a]&67108863;for(d>0&&(this.words[a]=~this.words[a]&67108863>>26-d,a++);a<this.length;a++)this.words[a]=0;return this.strip()},n.prototype.notn=function(l){return this.clone().inotn(l)},n.prototype.setn=function(l,E){r(typeof l=="number"&&l>=0);var d=l/26|0,a=l%26;return this._expand(d+1),E?this.words[d]=this.words[d]|1<<a:this.words[d]=this.words[d]&~(1<<a),this.strip()},n.prototype.iadd=function(l){var E;if(this.negative!==0&&l.negative===0)return this.negative=0,E=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,E=this.isub(l),l.negative=1,E._normSign();var d,a;this.length>l.length?(d=this,a=l):(d=l,a=this);for(var u=0,p=0;p<a.length;p++)E=(d.words[p]|0)+(a.words[p]|0)+u,this.words[p]=E&67108863,u=E>>>26;for(;u!==0&&p<d.length;p++)E=(d.words[p]|0)+u,this.words[p]=E&67108863,u=E>>>26;if(this.length=d.length,u!==0)this.words[this.length]=u,this.length++;else if(d!==this)for(;p<d.length;p++)this.words[p]=d.words[p];return this},n.prototype.add=function(l){var E;return l.negative!==0&&this.negative===0?(l.negative=0,E=this.sub(l),l.negative^=1,E):l.negative===0&&this.negative!==0?(this.negative=0,E=l.sub(this),this.negative=1,E):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},n.prototype.isub=function(l){if(l.negative!==0){l.negative=0;var E=this.iadd(l);return l.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var d=this.cmp(l);if(d===0)return this.negative=0,this.length=1,this.words[0]=0,this;var a,u;d>0?(a=this,u=l):(a=l,u=this);for(var p=0,b=0;b<u.length;b++)E=(a.words[b]|0)-(u.words[b]|0)+p,p=E>>26,this.words[b]=E&67108863;for(;p!==0&&b<a.length;b++)E=(a.words[b]|0)+p,p=E>>26,this.words[b]=E&67108863;if(p===0&&b<a.length&&a!==this)for(;b<a.length;b++)this.words[b]=a.words[b];return this.length=Math.max(this.length,b),a!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(l){return this.clone().isub(l)};function T(P,l,E){E.negative=l.negative^P.negative;var d=P.length+l.length|0;E.length=d,d=d-1|0;var a=P.words[0]|0,u=l.words[0]|0,p=a*u,b=p&67108863,v=p/67108864|0;E.words[0]=b;for(var c=1;c<d;c++){for(var w=v>>>26,A=v&67108863,g=Math.min(c,l.length-1),R=Math.max(0,c-P.length+1);R<=g;R++){var U=c-R|0;a=P.words[U]|0,u=l.words[R]|0,p=a*u+A,w+=p/67108864|0,A=p&67108863}E.words[c]=A|0,v=w|0}return v!==0?E.words[c]=v|0:E.length--,E.strip()}var M=function(l,E,d){var a=l.words,u=E.words,p=d.words,b=0,v,c,w,A=a[0]|0,g=A&8191,R=A>>>13,U=a[1]|0,H=U&8191,z=U>>>13,re=a[2]|0,oe=re&8191,k=re>>>13,L=a[3]|0,F=L&8191,V=L>>>13,fe=a[4]|0,Z=fe&8191,X=fe>>>13,ge=a[5]|0,ee=ge&8191,ae=ge>>>13,ht=a[6]|0,pe=ht&8191,J=ht>>>13,_e=a[7]|0,he=_e&8191,le=_e>>>13,Rr=a[8]|0,xe=Rr&8191,Se=Rr>>>13,no=a[9]|0,Ie=no&8191,Ae=no>>>13,Ka=u[0]|0,Oe=Ka&8191,Re=Ka>>>13,Va=u[1]|0,Te=Va&8191,Be=Va>>>13,Ga=u[2]|0,Pe=Ga&8191,Me=Ga>>>13,za=u[3]|0,ke=za&8191,Ne=za>>>13,Wa=u[4]|0,Ce=Wa&8191,De=Wa>>>13,Ya=u[5]|0,qe=Ya&8191,Le=Ya>>>13,Za=u[6]|0,Ue=Za&8191,Fe=Za>>>13,$a=u[7]|0,je=$a&8191,He=$a>>>13,Xa=u[8]|0,Ke=Xa&8191,Ve=Xa>>>13,Ja=u[9]|0,Ge=Ja&8191,ze=Ja>>>13;d.negative=l.negative^E.negative,d.length=19,v=Math.imul(g,Oe),c=Math.imul(g,Re),c=c+Math.imul(R,Oe)|0,w=Math.imul(R,Re);var xs=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(xs>>>26)|0,xs&=67108863,v=Math.imul(H,Oe),c=Math.imul(H,Re),c=c+Math.imul(z,Oe)|0,w=Math.imul(z,Re),v=v+Math.imul(g,Te)|0,c=c+Math.imul(g,Be)|0,c=c+Math.imul(R,Te)|0,w=w+Math.imul(R,Be)|0;var wt=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(wt>>>26)|0,wt&=67108863,v=Math.imul(oe,Oe),c=Math.imul(oe,Re),c=c+Math.imul(k,Oe)|0,w=Math.imul(k,Re),v=v+Math.imul(H,Te)|0,c=c+Math.imul(H,Be)|0,c=c+Math.imul(z,Te)|0,w=w+Math.imul(z,Be)|0,v=v+Math.imul(g,Pe)|0,c=c+Math.imul(g,Me)|0,c=c+Math.imul(R,Pe)|0,w=w+Math.imul(R,Me)|0;var St=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(St>>>26)|0,St&=67108863,v=Math.imul(F,Oe),c=Math.imul(F,Re),c=c+Math.imul(V,Oe)|0,w=Math.imul(V,Re),v=v+Math.imul(oe,Te)|0,c=c+Math.imul(oe,Be)|0,c=c+Math.imul(k,Te)|0,w=w+Math.imul(k,Be)|0,v=v+Math.imul(H,Pe)|0,c=c+Math.imul(H,Me)|0,c=c+Math.imul(z,Pe)|0,w=w+Math.imul(z,Me)|0,v=v+Math.imul(g,ke)|0,c=c+Math.imul(g,Ne)|0,c=c+Math.imul(R,ke)|0,w=w+Math.imul(R,Ne)|0;var oo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(oo>>>26)|0,oo&=67108863,v=Math.imul(Z,Oe),c=Math.imul(Z,Re),c=c+Math.imul(X,Oe)|0,w=Math.imul(X,Re),v=v+Math.imul(F,Te)|0,c=c+Math.imul(F,Be)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Be)|0,v=v+Math.imul(oe,Pe)|0,c=c+Math.imul(oe,Me)|0,c=c+Math.imul(k,Pe)|0,w=w+Math.imul(k,Me)|0,v=v+Math.imul(H,ke)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(z,ke)|0,w=w+Math.imul(z,Ne)|0,v=v+Math.imul(g,Ce)|0,c=c+Math.imul(g,De)|0,c=c+Math.imul(R,Ce)|0,w=w+Math.imul(R,De)|0;var so=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(so>>>26)|0,so&=67108863,v=Math.imul(ee,Oe),c=Math.imul(ee,Re),c=c+Math.imul(ae,Oe)|0,w=Math.imul(ae,Re),v=v+Math.imul(Z,Te)|0,c=c+Math.imul(Z,Be)|0,c=c+Math.imul(X,Te)|0,w=w+Math.imul(X,Be)|0,v=v+Math.imul(F,Pe)|0,c=c+Math.imul(F,Me)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,Me)|0,v=v+Math.imul(oe,ke)|0,c=c+Math.imul(oe,Ne)|0,c=c+Math.imul(k,ke)|0,w=w+Math.imul(k,Ne)|0,v=v+Math.imul(H,Ce)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(z,Ce)|0,w=w+Math.imul(z,De)|0,v=v+Math.imul(g,qe)|0,c=c+Math.imul(g,Le)|0,c=c+Math.imul(R,qe)|0,w=w+Math.imul(R,Le)|0;var ao=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(ao>>>26)|0,ao&=67108863,v=Math.imul(pe,Oe),c=Math.imul(pe,Re),c=c+Math.imul(J,Oe)|0,w=Math.imul(J,Re),v=v+Math.imul(ee,Te)|0,c=c+Math.imul(ee,Be)|0,c=c+Math.imul(ae,Te)|0,w=w+Math.imul(ae,Be)|0,v=v+Math.imul(Z,Pe)|0,c=c+Math.imul(Z,Me)|0,c=c+Math.imul(X,Pe)|0,w=w+Math.imul(X,Me)|0,v=v+Math.imul(F,ke)|0,c=c+Math.imul(F,Ne)|0,c=c+Math.imul(V,ke)|0,w=w+Math.imul(V,Ne)|0,v=v+Math.imul(oe,Ce)|0,c=c+Math.imul(oe,De)|0,c=c+Math.imul(k,Ce)|0,w=w+Math.imul(k,De)|0,v=v+Math.imul(H,qe)|0,c=c+Math.imul(H,Le)|0,c=c+Math.imul(z,qe)|0,w=w+Math.imul(z,Le)|0,v=v+Math.imul(g,Ue)|0,c=c+Math.imul(g,Fe)|0,c=c+Math.imul(R,Ue)|0,w=w+Math.imul(R,Fe)|0;var fo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(fo>>>26)|0,fo&=67108863,v=Math.imul(he,Oe),c=Math.imul(he,Re),c=c+Math.imul(le,Oe)|0,w=Math.imul(le,Re),v=v+Math.imul(pe,Te)|0,c=c+Math.imul(pe,Be)|0,c=c+Math.imul(J,Te)|0,w=w+Math.imul(J,Be)|0,v=v+Math.imul(ee,Pe)|0,c=c+Math.imul(ee,Me)|0,c=c+Math.imul(ae,Pe)|0,w=w+Math.imul(ae,Me)|0,v=v+Math.imul(Z,ke)|0,c=c+Math.imul(Z,Ne)|0,c=c+Math.imul(X,ke)|0,w=w+Math.imul(X,Ne)|0,v=v+Math.imul(F,Ce)|0,c=c+Math.imul(F,De)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,De)|0,v=v+Math.imul(oe,qe)|0,c=c+Math.imul(oe,Le)|0,c=c+Math.imul(k,qe)|0,w=w+Math.imul(k,Le)|0,v=v+Math.imul(H,Ue)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(z,Ue)|0,w=w+Math.imul(z,Fe)|0,v=v+Math.imul(g,je)|0,c=c+Math.imul(g,He)|0,c=c+Math.imul(R,je)|0,w=w+Math.imul(R,He)|0;var uo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(uo>>>26)|0,uo&=67108863,v=Math.imul(xe,Oe),c=Math.imul(xe,Re),c=c+Math.imul(Se,Oe)|0,w=Math.imul(Se,Re),v=v+Math.imul(he,Te)|0,c=c+Math.imul(he,Be)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Be)|0,v=v+Math.imul(pe,Pe)|0,c=c+Math.imul(pe,Me)|0,c=c+Math.imul(J,Pe)|0,w=w+Math.imul(J,Me)|0,v=v+Math.imul(ee,ke)|0,c=c+Math.imul(ee,Ne)|0,c=c+Math.imul(ae,ke)|0,w=w+Math.imul(ae,Ne)|0,v=v+Math.imul(Z,Ce)|0,c=c+Math.imul(Z,De)|0,c=c+Math.imul(X,Ce)|0,w=w+Math.imul(X,De)|0,v=v+Math.imul(F,qe)|0,c=c+Math.imul(F,Le)|0,c=c+Math.imul(V,qe)|0,w=w+Math.imul(V,Le)|0,v=v+Math.imul(oe,Ue)|0,c=c+Math.imul(oe,Fe)|0,c=c+Math.imul(k,Ue)|0,w=w+Math.imul(k,Fe)|0,v=v+Math.imul(H,je)|0,c=c+Math.imul(H,He)|0,c=c+Math.imul(z,je)|0,w=w+Math.imul(z,He)|0,v=v+Math.imul(g,Ke)|0,c=c+Math.imul(g,Ve)|0,c=c+Math.imul(R,Ke)|0,w=w+Math.imul(R,Ve)|0;var co=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(co>>>26)|0,co&=67108863,v=Math.imul(Ie,Oe),c=Math.imul(Ie,Re),c=c+Math.imul(Ae,Oe)|0,w=Math.imul(Ae,Re),v=v+Math.imul(xe,Te)|0,c=c+Math.imul(xe,Be)|0,c=c+Math.imul(Se,Te)|0,w=w+Math.imul(Se,Be)|0,v=v+Math.imul(he,Pe)|0,c=c+Math.imul(he,Me)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,Me)|0,v=v+Math.imul(pe,ke)|0,c=c+Math.imul(pe,Ne)|0,c=c+Math.imul(J,ke)|0,w=w+Math.imul(J,Ne)|0,v=v+Math.imul(ee,Ce)|0,c=c+Math.imul(ee,De)|0,c=c+Math.imul(ae,Ce)|0,w=w+Math.imul(ae,De)|0,v=v+Math.imul(Z,qe)|0,c=c+Math.imul(Z,Le)|0,c=c+Math.imul(X,qe)|0,w=w+Math.imul(X,Le)|0,v=v+Math.imul(F,Ue)|0,c=c+Math.imul(F,Fe)|0,c=c+Math.imul(V,Ue)|0,w=w+Math.imul(V,Fe)|0,v=v+Math.imul(oe,je)|0,c=c+Math.imul(oe,He)|0,c=c+Math.imul(k,je)|0,w=w+Math.imul(k,He)|0,v=v+Math.imul(H,Ke)|0,c=c+Math.imul(H,Ve)|0,c=c+Math.imul(z,Ke)|0,w=w+Math.imul(z,Ve)|0,v=v+Math.imul(g,Ge)|0,c=c+Math.imul(g,ze)|0,c=c+Math.imul(R,Ge)|0,w=w+Math.imul(R,ze)|0;var ho=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(ho>>>26)|0,ho&=67108863,v=Math.imul(Ie,Te),c=Math.imul(Ie,Be),c=c+Math.imul(Ae,Te)|0,w=Math.imul(Ae,Be),v=v+Math.imul(xe,Pe)|0,c=c+Math.imul(xe,Me)|0,c=c+Math.imul(Se,Pe)|0,w=w+Math.imul(Se,Me)|0,v=v+Math.imul(he,ke)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(le,ke)|0,w=w+Math.imul(le,Ne)|0,v=v+Math.imul(pe,Ce)|0,c=c+Math.imul(pe,De)|0,c=c+Math.imul(J,Ce)|0,w=w+Math.imul(J,De)|0,v=v+Math.imul(ee,qe)|0,c=c+Math.imul(ee,Le)|0,c=c+Math.imul(ae,qe)|0,w=w+Math.imul(ae,Le)|0,v=v+Math.imul(Z,Ue)|0,c=c+Math.imul(Z,Fe)|0,c=c+Math.imul(X,Ue)|0,w=w+Math.imul(X,Fe)|0,v=v+Math.imul(F,je)|0,c=c+Math.imul(F,He)|0,c=c+Math.imul(V,je)|0,w=w+Math.imul(V,He)|0,v=v+Math.imul(oe,Ke)|0,c=c+Math.imul(oe,Ve)|0,c=c+Math.imul(k,Ke)|0,w=w+Math.imul(k,Ve)|0,v=v+Math.imul(H,Ge)|0,c=c+Math.imul(H,ze)|0,c=c+Math.imul(z,Ge)|0,w=w+Math.imul(z,ze)|0;var lo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(lo>>>26)|0,lo&=67108863,v=Math.imul(Ie,Pe),c=Math.imul(Ie,Me),c=c+Math.imul(Ae,Pe)|0,w=Math.imul(Ae,Me),v=v+Math.imul(xe,ke)|0,c=c+Math.imul(xe,Ne)|0,c=c+Math.imul(Se,ke)|0,w=w+Math.imul(Se,Ne)|0,v=v+Math.imul(he,Ce)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,De)|0,v=v+Math.imul(pe,qe)|0,c=c+Math.imul(pe,Le)|0,c=c+Math.imul(J,qe)|0,w=w+Math.imul(J,Le)|0,v=v+Math.imul(ee,Ue)|0,c=c+Math.imul(ee,Fe)|0,c=c+Math.imul(ae,Ue)|0,w=w+Math.imul(ae,Fe)|0,v=v+Math.imul(Z,je)|0,c=c+Math.imul(Z,He)|0,c=c+Math.imul(X,je)|0,w=w+Math.imul(X,He)|0,v=v+Math.imul(F,Ke)|0,c=c+Math.imul(F,Ve)|0,c=c+Math.imul(V,Ke)|0,w=w+Math.imul(V,Ve)|0,v=v+Math.imul(oe,Ge)|0,c=c+Math.imul(oe,ze)|0,c=c+Math.imul(k,Ge)|0,w=w+Math.imul(k,ze)|0;var po=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(po>>>26)|0,po&=67108863,v=Math.imul(Ie,ke),c=Math.imul(Ie,Ne),c=c+Math.imul(Ae,ke)|0,w=Math.imul(Ae,Ne),v=v+Math.imul(xe,Ce)|0,c=c+Math.imul(xe,De)|0,c=c+Math.imul(Se,Ce)|0,w=w+Math.imul(Se,De)|0,v=v+Math.imul(he,qe)|0,c=c+Math.imul(he,Le)|0,c=c+Math.imul(le,qe)|0,w=w+Math.imul(le,Le)|0,v=v+Math.imul(pe,Ue)|0,c=c+Math.imul(pe,Fe)|0,c=c+Math.imul(J,Ue)|0,w=w+Math.imul(J,Fe)|0,v=v+Math.imul(ee,je)|0,c=c+Math.imul(ee,He)|0,c=c+Math.imul(ae,je)|0,w=w+Math.imul(ae,He)|0,v=v+Math.imul(Z,Ke)|0,c=c+Math.imul(Z,Ve)|0,c=c+Math.imul(X,Ke)|0,w=w+Math.imul(X,Ve)|0,v=v+Math.imul(F,Ge)|0,c=c+Math.imul(F,ze)|0,c=c+Math.imul(V,Ge)|0,w=w+Math.imul(V,ze)|0;var go=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(go>>>26)|0,go&=67108863,v=Math.imul(Ie,Ce),c=Math.imul(Ie,De),c=c+Math.imul(Ae,Ce)|0,w=Math.imul(Ae,De),v=v+Math.imul(xe,qe)|0,c=c+Math.imul(xe,Le)|0,c=c+Math.imul(Se,qe)|0,w=w+Math.imul(Se,Le)|0,v=v+Math.imul(he,Ue)|0,c=c+Math.imul(he,Fe)|0,c=c+Math.imul(le,Ue)|0,w=w+Math.imul(le,Fe)|0,v=v+Math.imul(pe,je)|0,c=c+Math.imul(pe,He)|0,c=c+Math.imul(J,je)|0,w=w+Math.imul(J,He)|0,v=v+Math.imul(ee,Ke)|0,c=c+Math.imul(ee,Ve)|0,c=c+Math.imul(ae,Ke)|0,w=w+Math.imul(ae,Ve)|0,v=v+Math.imul(Z,Ge)|0,c=c+Math.imul(Z,ze)|0,c=c+Math.imul(X,Ge)|0,w=w+Math.imul(X,ze)|0;var vo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(vo>>>26)|0,vo&=67108863,v=Math.imul(Ie,qe),c=Math.imul(Ie,Le),c=c+Math.imul(Ae,qe)|0,w=Math.imul(Ae,Le),v=v+Math.imul(xe,Ue)|0,c=c+Math.imul(xe,Fe)|0,c=c+Math.imul(Se,Ue)|0,w=w+Math.imul(Se,Fe)|0,v=v+Math.imul(he,je)|0,c=c+Math.imul(he,He)|0,c=c+Math.imul(le,je)|0,w=w+Math.imul(le,He)|0,v=v+Math.imul(pe,Ke)|0,c=c+Math.imul(pe,Ve)|0,c=c+Math.imul(J,Ke)|0,w=w+Math.imul(J,Ve)|0,v=v+Math.imul(ee,Ge)|0,c=c+Math.imul(ee,ze)|0,c=c+Math.imul(ae,Ge)|0,w=w+Math.imul(ae,ze)|0;var yo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(yo>>>26)|0,yo&=67108863,v=Math.imul(Ie,Ue),c=Math.imul(Ie,Fe),c=c+Math.imul(Ae,Ue)|0,w=Math.imul(Ae,Fe),v=v+Math.imul(xe,je)|0,c=c+Math.imul(xe,He)|0,c=c+Math.imul(Se,je)|0,w=w+Math.imul(Se,He)|0,v=v+Math.imul(he,Ke)|0,c=c+Math.imul(he,Ve)|0,c=c+Math.imul(le,Ke)|0,w=w+Math.imul(le,Ve)|0,v=v+Math.imul(pe,Ge)|0,c=c+Math.imul(pe,ze)|0,c=c+Math.imul(J,Ge)|0,w=w+Math.imul(J,ze)|0;var mo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(mo>>>26)|0,mo&=67108863,v=Math.imul(Ie,je),c=Math.imul(Ie,He),c=c+Math.imul(Ae,je)|0,w=Math.imul(Ae,He),v=v+Math.imul(xe,Ke)|0,c=c+Math.imul(xe,Ve)|0,c=c+Math.imul(Se,Ke)|0,w=w+Math.imul(Se,Ve)|0,v=v+Math.imul(he,Ge)|0,c=c+Math.imul(he,ze)|0,c=c+Math.imul(le,Ge)|0,w=w+Math.imul(le,ze)|0;var bo=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(bo>>>26)|0,bo&=67108863,v=Math.imul(Ie,Ke),c=Math.imul(Ie,Ve),c=c+Math.imul(Ae,Ke)|0,w=Math.imul(Ae,Ve),v=v+Math.imul(xe,Ge)|0,c=c+Math.imul(xe,ze)|0,c=c+Math.imul(Se,Ge)|0,w=w+Math.imul(Se,ze)|0;var _o=(b+v|0)+((c&8191)<<13)|0;b=(w+(c>>>13)|0)+(_o>>>26)|0,_o&=67108863,v=Math.imul(Ie,Ge),c=Math.imul(Ie,ze),c=c+Math.imul(Ae,Ge)|0,w=Math.imul(Ae,ze);var wo=(b+v|0)+((c&8191)<<13)|0;return b=(w+(c>>>13)|0)+(wo>>>26)|0,wo&=67108863,p[0]=xs,p[1]=wt,p[2]=St,p[3]=oo,p[4]=so,p[5]=ao,p[6]=fo,p[7]=uo,p[8]=co,p[9]=ho,p[10]=lo,p[11]=po,p[12]=go,p[13]=vo,p[14]=yo,p[15]=mo,p[16]=bo,p[17]=_o,p[18]=wo,b!==0&&(p[19]=b,d.length++),d};Math.imul||(M=T);function N(P,l,E){E.negative=l.negative^P.negative,E.length=P.length+l.length;for(var d=0,a=0,u=0;u<E.length-1;u++){var p=a;a=0;for(var b=d&67108863,v=Math.min(u,l.length-1),c=Math.max(0,u-P.length+1);c<=v;c++){var w=u-c,A=P.words[w]|0,g=l.words[c]|0,R=A*g,U=R&67108863;p=p+(R/67108864|0)|0,U=U+b|0,b=U&67108863,p=p+(U>>>26)|0,a+=p>>>26,p&=67108863}E.words[u]=b,d=p,p=a}return d!==0?E.words[u]=d:E.length--,E.strip()}function D(P,l,E){var d=new j;return d.mulp(P,l,E)}n.prototype.mulTo=function(l,E){var d,a=this.length+l.length;return this.length===10&&l.length===10?d=M(this,l,E):a<63?d=T(this,l,E):a<1024?d=N(this,l,E):d=D(this,l,E),d};function j(P,l){this.x=P,this.y=l}j.prototype.makeRBT=function(l){for(var E=new Array(l),d=n.prototype._countBits(l)-1,a=0;a<l;a++)E[a]=this.revBin(a,d,l);return E},j.prototype.revBin=function(l,E,d){if(l===0||l===d-1)return l;for(var a=0,u=0;u<E;u++)a|=(l&1)<<E-u-1,l>>=1;return a},j.prototype.permute=function(l,E,d,a,u,p){for(var b=0;b<p;b++)a[b]=E[l[b]],u[b]=d[l[b]]},j.prototype.transform=function(l,E,d,a,u,p){this.permute(p,l,E,d,a,u);for(var b=1;b<u;b<<=1)for(var v=b<<1,c=Math.cos(2*Math.PI/v),w=Math.sin(2*Math.PI/v),A=0;A<u;A+=v)for(var g=c,R=w,U=0;U<b;U++){var H=d[A+U],z=a[A+U],re=d[A+U+b],oe=a[A+U+b],k=g*re-R*oe;oe=g*oe+R*re,re=k,d[A+U]=H+re,a[A+U]=z+oe,d[A+U+b]=H-re,a[A+U+b]=z-oe,U!==v&&(k=c*g-w*R,R=c*R+w*g,g=k)}},j.prototype.guessLen13b=function(l,E){var d=Math.max(E,l)|1,a=d&1,u=0;for(d=d/2|0;d;d=d>>>1)u++;return 1<<u+1+a},j.prototype.conjugate=function(l,E,d){if(!(d<=1))for(var a=0;a<d/2;a++){var u=l[a];l[a]=l[d-a-1],l[d-a-1]=u,u=E[a],E[a]=-E[d-a-1],E[d-a-1]=-u}},j.prototype.normalize13b=function(l,E){for(var d=0,a=0;a<E/2;a++){var u=Math.round(l[2*a+1]/E)*8192+Math.round(l[2*a]/E)+d;l[a]=u&67108863,u<67108864?d=0:d=u/67108864|0}return l},j.prototype.convert13b=function(l,E,d,a){for(var u=0,p=0;p<E;p++)u=u+(l[p]|0),d[2*p]=u&8191,u=u>>>13,d[2*p+1]=u&8191,u=u>>>13;for(p=2*E;p<a;++p)d[p]=0;r(u===0),r((u&-8192)===0)},j.prototype.stub=function(l){for(var E=new Array(l),d=0;d<l;d++)E[d]=0;return E},j.prototype.mulp=function(l,E,d){var a=2*this.guessLen13b(l.length,E.length),u=this.makeRBT(a),p=this.stub(a),b=new Array(a),v=new Array(a),c=new Array(a),w=new Array(a),A=new Array(a),g=new Array(a),R=d.words;R.length=a,this.convert13b(l.words,l.length,b,a),this.convert13b(E.words,E.length,w,a),this.transform(b,p,v,c,a,u),this.transform(w,p,A,g,a,u);for(var U=0;U<a;U++){var H=v[U]*A[U]-c[U]*g[U];c[U]=v[U]*g[U]+c[U]*A[U],v[U]=H}return this.conjugate(v,c,a),this.transform(v,c,R,p,a,u),this.conjugate(R,p,a),this.normalize13b(R,a),d.negative=l.negative^E.negative,d.length=l.length+E.length,d.strip()},n.prototype.mul=function(l){var E=new n(null);return E.words=new Array(this.length+l.length),this.mulTo(l,E)},n.prototype.mulf=function(l){var E=new n(null);return E.words=new Array(this.length+l.length),D(this,l,E)},n.prototype.imul=function(l){return this.clone().mulTo(l,this)},n.prototype.imuln=function(l){r(typeof l=="number"),r(l<67108864);for(var E=0,d=0;d<this.length;d++){var a=(this.words[d]|0)*l,u=(a&67108863)+(E&67108863);E>>=26,E+=a/67108864|0,E+=u>>>26,this.words[d]=u&67108863}return E!==0&&(this.words[d]=E,this.length++),l===0&&(this.length=1,this._normSign()),this},n.prototype.muln=function(l){return this.clone().imuln(l)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(l){var E=I(l);if(E.length===0)return new n(1);for(var d=this,a=0;a<E.length&&E[a]===0;a++,d=d.sqr());if(++a<E.length)for(var u=d.sqr();a<E.length;a++,u=u.sqr())E[a]!==0&&(d=d.mul(u));return d},n.prototype.iushln=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26,a=67108863>>>26-E<<26-E,u;if(E!==0){var p=0;for(u=0;u<this.length;u++){var b=this.words[u]&a,v=(this.words[u]|0)-b<<E;this.words[u]=v|p,p=b>>>26-E}p&&(this.words[u]=p,this.length++)}if(d!==0){for(u=this.length-1;u>=0;u--)this.words[u+d]=this.words[u];for(u=0;u<d;u++)this.words[u]=0;this.length+=d}return this.strip()},n.prototype.ishln=function(l){return r(this.negative===0),this.iushln(l)},n.prototype.iushrn=function(l,E,d){r(typeof l=="number"&&l>=0);var a;E?a=(E-E%26)/26:a=0;var u=l%26,p=Math.min((l-u)/26,this.length),b=67108863^67108863>>>u<<u,v=d;if(a-=p,a=Math.max(0,a),v){for(var c=0;c<p;c++)v.words[c]=this.words[c];v.length=p}if(p!==0)if(this.length>p)for(this.length-=p,c=0;c<this.length;c++)this.words[c]=this.words[c+p];else this.words[0]=0,this.length=1;var w=0;for(c=this.length-1;c>=0&&(w!==0||c>=a);c--){var A=this.words[c]|0;this.words[c]=w<<26-u|A>>>u,w=A&b}return v&&w!==0&&(v.words[v.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(l,E,d){return r(this.negative===0),this.iushrn(l,E,d)},n.prototype.shln=function(l){return this.clone().ishln(l)},n.prototype.ushln=function(l){return this.clone().iushln(l)},n.prototype.shrn=function(l){return this.clone().ishrn(l)},n.prototype.ushrn=function(l){return this.clone().iushrn(l)},n.prototype.testn=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26,a=1<<E;if(this.length<=d)return!1;var u=this.words[d];return!!(u&a)},n.prototype.imaskn=function(l){r(typeof l=="number"&&l>=0);var E=l%26,d=(l-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=d)return this;if(E!==0&&d++,this.length=Math.min(d,this.length),E!==0){var a=67108863^67108863>>>E<<E;this.words[this.length-1]&=a}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.maskn=function(l){return this.clone().imaskn(l)},n.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)},n.prototype._iaddn=function(l){this.words[0]+=l;for(var E=0;E<this.length&&this.words[E]>=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},n.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 E=0;E<this.length&&this.words[E]<0;E++)this.words[E]+=67108864,this.words[E+1]-=1;return this.strip()},n.prototype.addn=function(l){return this.clone().iaddn(l)},n.prototype.subn=function(l){return this.clone().isubn(l)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(l,E,d){var a=l.length+d,u;this._expand(a);var p,b=0;for(u=0;u<l.length;u++){p=(this.words[u+d]|0)+b;var v=(l.words[u]|0)*E;p-=v&67108863,b=(p>>26)-(v/67108864|0),this.words[u+d]=p&67108863}for(;u<this.length-d;u++)p=(this.words[u+d]|0)+b,b=p>>26,this.words[u+d]=p&67108863;if(b===0)return this.strip();for(r(b===-1),b=0,u=0;u<this.length;u++)p=-(this.words[u]|0)+b,b=p>>26,this.words[u]=p&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(l,E){var d=this.length-l.length,a=this.clone(),u=l,p=u.words[u.length-1]|0,b=this._countBits(p);d=26-b,d!==0&&(u=u.ushln(d),a.iushln(d),p=u.words[u.length-1]|0);var v=a.length-u.length,c;if(E!=="mod"){c=new n(null),c.length=v+1,c.words=new Array(c.length);for(var w=0;w<c.length;w++)c.words[w]=0}var A=a.clone()._ishlnsubmul(u,1,v);A.negative===0&&(a=A,c&&(c.words[v]=1));for(var g=v-1;g>=0;g--){var R=(a.words[u.length+g]|0)*67108864+(a.words[u.length+g-1]|0);for(R=Math.min(R/p|0,67108863),a._ishlnsubmul(u,R,g);a.negative!==0;)R--,a.negative=0,a._ishlnsubmul(u,1,g),a.isZero()||(a.negative^=1);c&&(c.words[g]=R)}return c&&c.strip(),a.strip(),E!=="div"&&d!==0&&a.iushrn(d),{div:c||null,mod:a}},n.prototype.divmod=function(l,E,d){if(r(!l.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var a,u,p;return this.negative!==0&&l.negative===0?(p=this.neg().divmod(l,E),E!=="mod"&&(a=p.div.neg()),E!=="div"&&(u=p.mod.neg(),d&&u.negative!==0&&u.iadd(l)),{div:a,mod:u}):this.negative===0&&l.negative!==0?(p=this.divmod(l.neg(),E),E!=="mod"&&(a=p.div.neg()),{div:a,mod:p.mod}):(this.negative&l.negative)!==0?(p=this.neg().divmod(l.neg(),E),E!=="div"&&(u=p.mod.neg(),d&&u.negative!==0&&u.isub(l)),{div:p.div,mod:u}):l.length>this.length||this.cmp(l)<0?{div:new n(0),mod:this}:l.length===1?E==="div"?{div:this.divn(l.words[0]),mod:null}:E==="mod"?{div:null,mod:new n(this.modn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new n(this.modn(l.words[0]))}:this._wordDiv(l,E)},n.prototype.div=function(l){return this.divmod(l,"div",!1).div},n.prototype.mod=function(l){return this.divmod(l,"mod",!1).mod},n.prototype.umod=function(l){return this.divmod(l,"mod",!0).mod},n.prototype.divRound=function(l){var E=this.divmod(l);if(E.mod.isZero())return E.div;var d=E.mod.abs(),a=l.abs().iushrn(1),u=l.words[0]&1,p=d.cmp(a);if(p<0||u===1&&p===0)return E.div;var b=new n(1);return b.negative=this.negative^l.negative,E.div.iadd(b)},n.prototype.modn=function(l){r(l<=67108863);for(var E=(1<<26)%l,d=0,a=this.length-1;a>=0;a--)d=(E*d+(this.words[a]|0))%l;return d},n.prototype.idivn=function(l){r(l<=67108863);for(var E=0,d=this.length-1;d>=0;d--){var a=(this.words[d]|0)+E*67108864;this.words[d]=a/l|0,E=a%l}return this.strip()},n.prototype.divn=function(l){return this.clone().idivn(l)},n.prototype.egcd=function(l){r(l.negative===0),r(!l.isZero());var E=this,d=l.clone();E.negative!==0?E=E.umod(l):E=E.clone();for(var a=new n(1),u=new n(0),p=new n(0),b=new n(1),v=0;E.isEven()&&d.isEven();)E.iushrn(1),d.iushrn(1),++v;for(var c=d.clone(),w=E.clone();!E.isZero();){for(var A=0,g=1;(E.words[0]&g)===0&&A<26;++A,g<<=1);if(A>0)for(E.iushrn(A);A-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(c),u.isub(w)),a.iushrn(1),u.iushrn(1);for(var R=0,U=1;(d.words[0]&U)===0&&R<26;++R,U<<=1);if(R>0)for(d.iushrn(R);R-- >0;)(p.isOdd()||b.isOdd())&&(p.iadd(c),b.isub(w)),p.iushrn(1),b.iushrn(1);E.cmp(d)>=0?(E.isub(d),a.isub(p),u.isub(b)):(d.isub(E),p.isub(a),b.isub(u))}return{a:p,b,gcd:d.iushln(v)}},n.prototype._invmp=function(l){r(l.negative===0),r(!l.isZero());var E=this,d=l.clone();E.negative!==0?E=E.umod(l):E=E.clone();for(var a=new n(1),u=new n(0),p=d.clone();E.cmpn(1)>0&&d.cmpn(1)>0;){for(var b=0,v=1;(E.words[0]&v)===0&&b<26;++b,v<<=1);if(b>0)for(E.iushrn(b);b-- >0;)a.isOdd()&&a.iadd(p),a.iushrn(1);for(var c=0,w=1;(d.words[0]&w)===0&&c<26;++c,w<<=1);if(c>0)for(d.iushrn(c);c-- >0;)u.isOdd()&&u.iadd(p),u.iushrn(1);E.cmp(d)>=0?(E.isub(d),a.isub(u)):(d.isub(E),u.isub(a))}var A;return E.cmpn(1)===0?A=a:A=u,A.cmpn(0)<0&&A.iadd(l),A},n.prototype.gcd=function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var E=this.clone(),d=l.clone();E.negative=0,d.negative=0;for(var a=0;E.isEven()&&d.isEven();a++)E.iushrn(1),d.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;d.isEven();)d.iushrn(1);var u=E.cmp(d);if(u<0){var p=E;E=d,d=p}else if(u===0||d.cmpn(1)===0)break;E.isub(d)}while(!0);return d.iushln(a)},n.prototype.invm=function(l){return this.egcd(l).a.umod(l)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(l){return this.words[0]&l},n.prototype.bincn=function(l){r(typeof l=="number");var E=l%26,d=(l-E)/26,a=1<<E;if(this.length<=d)return this._expand(d+1),this.words[d]|=a,this;for(var u=a,p=d;u!==0&&p<this.length;p++){var b=this.words[p]|0;b+=u,u=b>>>26,b&=67108863,this.words[p]=b}return u!==0&&(this.words[p]=u,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(l){var E=l<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this.strip();var d;if(this.length>1)d=1;else{E&&(l=-l),r(l<=67108863,"Number is too big");var a=this.words[0]|0;d=a===l?0:a<l?-1:1}return this.negative!==0?-d|0:d},n.prototype.cmp=function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var E=this.ucmp(l);return this.negative!==0?-E|0:E},n.prototype.ucmp=function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var E=0,d=this.length-1;d>=0;d--){var a=this.words[d]|0,u=l.words[d]|0;if(a!==u){a<u?E=-1:a>u&&(E=1);break}}return E},n.prototype.gtn=function(l){return this.cmpn(l)===1},n.prototype.gt=function(l){return this.cmp(l)===1},n.prototype.gten=function(l){return this.cmpn(l)>=0},n.prototype.gte=function(l){return this.cmp(l)>=0},n.prototype.ltn=function(l){return this.cmpn(l)===-1},n.prototype.lt=function(l){return this.cmp(l)===-1},n.prototype.lten=function(l){return this.cmpn(l)<=0},n.prototype.lte=function(l){return this.cmp(l)<=0},n.prototype.eqn=function(l){return this.cmpn(l)===0},n.prototype.eq=function(l){return this.cmp(l)===0},n.red=function(l){return new ue(l)},n.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)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(l){return this.red=l,this},n.prototype.forceRed=function(l){return r(!this.red,"Already a number in reduction context"),this._forceRed(l)},n.prototype.redAdd=function(l){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},n.prototype.redIAdd=function(l){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},n.prototype.redSub=function(l){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},n.prototype.redISub=function(l){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},n.prototype.redShl=function(l){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},n.prototype.redMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},n.prototype.redIMul=function(l){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(l){return r(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)};var Y={k256:null,p224:null,p192:null,p25519:null};function Q(P,l){this.name=P,this.p=new n(l,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var l=new n(null);return l.words=new Array(Math.ceil(this.n/13)),l},Q.prototype.ireduce=function(l){var E=l,d;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),d=E.bitLength();while(d>this.n);var a=d<this.n?-1:E.ucmp(this.p);return a===0?(E.words[0]=0,E.length=1):a>0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},Q.prototype.split=function(l,E){l.iushrn(this.n,0,E)},Q.prototype.imulK=function(l){return l.imul(this.k)};function W(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,Q),W.prototype.split=function(l,E){for(var d=4194303,a=Math.min(l.length,9),u=0;u<a;u++)E.words[u]=l.words[u];if(E.length=a,l.length<=9){l.words[0]=0,l.length=1;return}var p=l.words[9];for(E.words[E.length++]=p&d,u=10;u<l.length;u++){var b=l.words[u]|0;l.words[u-10]=(b&d)<<4|p>>>22,p=b}p>>>=22,l.words[u-10]=p,p===0&&l.length>10?l.length-=10:l.length-=9},W.prototype.imulK=function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var E=0,d=0;d<l.length;d++){var a=l.words[d]|0;E+=a*977,l.words[d]=E&67108863,E=a*64+(E/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l};function te(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(te,Q);function ne(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ne,Q);function se(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(se,Q),se.prototype.imulK=function(l){for(var E=0,d=0;d<l.length;d++){var a=(l.words[d]|0)*19+E,u=a&67108863;a>>>=26,l.words[d]=u,E=a}return E!==0&&(l.words[l.length++]=E),l},n._prime=function(l){if(Y[l])return Y[l];var E;if(l==="k256")E=new W;else if(l==="p224")E=new te;else if(l==="p192")E=new ne;else if(l==="p25519")E=new se;else throw new Error("Unknown prime "+l);return Y[l]=E,E};function ue(P){if(typeof P=="string"){var l=n._prime(P);this.m=l.p,this.prime=l}else r(P.gtn(1),"modulus must be greater than 1"),this.m=P,this.prime=null}ue.prototype._verify1=function(l){r(l.negative===0,"red works only with positives"),r(l.red,"red works only with red numbers")},ue.prototype._verify2=function(l,E){r((l.negative|E.negative)===0,"red works only with positives"),r(l.red&&l.red===E.red,"red works only with red numbers")},ue.prototype.imod=function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):l.umod(this.m)._forceRed(this)},ue.prototype.neg=function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},ue.prototype.add=function(l,E){this._verify2(l,E);var d=l.add(E);return d.cmp(this.m)>=0&&d.isub(this.m),d._forceRed(this)},ue.prototype.iadd=function(l,E){this._verify2(l,E);var d=l.iadd(E);return d.cmp(this.m)>=0&&d.isub(this.m),d},ue.prototype.sub=function(l,E){this._verify2(l,E);var d=l.sub(E);return d.cmpn(0)<0&&d.iadd(this.m),d._forceRed(this)},ue.prototype.isub=function(l,E){this._verify2(l,E);var d=l.isub(E);return d.cmpn(0)<0&&d.iadd(this.m),d},ue.prototype.shl=function(l,E){return this._verify1(l),this.imod(l.ushln(E))},ue.prototype.imul=function(l,E){return this._verify2(l,E),this.imod(l.imul(E))},ue.prototype.mul=function(l,E){return this._verify2(l,E),this.imod(l.mul(E))},ue.prototype.isqr=function(l){return this.imul(l,l.clone())},ue.prototype.sqr=function(l){return this.mul(l,l)},ue.prototype.sqrt=function(l){if(l.isZero())return l.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var d=this.m.add(new n(1)).iushrn(2);return this.pow(l,d)}for(var a=this.m.subn(1),u=0;!a.isZero()&&a.andln(1)===0;)u++,a.iushrn(1);r(!a.isZero());var p=new n(1).toRed(this),b=p.redNeg(),v=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,v).cmp(b)!==0;)c.redIAdd(b);for(var w=this.pow(c,a),A=this.pow(l,a.addn(1).iushrn(1)),g=this.pow(l,a),R=u;g.cmp(p)!==0;){for(var U=g,H=0;U.cmp(p)!==0;H++)U=U.redSqr();r(H<R);var z=this.pow(w,new n(1).iushln(R-H-1));A=A.redMul(z),w=z.redSqr(),g=g.redMul(w),R=H}return A},ue.prototype.invm=function(l){var E=l._invmp(this.m);return E.negative!==0?(E.negative=0,this.imod(E).redNeg()):this.imod(E)},ue.prototype.pow=function(l,E){if(E.isZero())return new n(1).toRed(this);if(E.cmpn(1)===0)return l.clone();var d=4,a=new Array(1<<d);a[0]=new n(1).toRed(this),a[1]=l;for(var u=2;u<a.length;u++)a[u]=this.mul(a[u-1],l);var p=a[0],b=0,v=0,c=E.bitLength()%26;for(c===0&&(c=26),u=E.length-1;u>=0;u--){for(var w=E.words[u],A=c-1;A>=0;A--){var g=w>>A&1;if(p!==a[0]&&(p=this.sqr(p)),g===0&&b===0){v=0;continue}b<<=1,b|=g,v++,!(v!==d&&(u!==0||A!==0))&&(p=this.mul(p,a[b]),v=0,b=0)}c=26}return p},ue.prototype.convertTo=function(l){var E=l.umod(this.m);return E===l?E.clone():E},ue.prototype.convertFrom=function(l){var E=l.clone();return E.red=null,E},n.mont=function(l){return new be(l)};function be(P){ue.call(this,P),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(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)}i(be,ue),be.prototype.convertTo=function(l){return this.imod(l.ushln(this.shift))},be.prototype.convertFrom=function(l){var E=this.imod(l.mul(this.rinv));return E.red=null,E},be.prototype.imul=function(l,E){if(l.isZero()||E.isZero())return l.words[0]=0,l.length=1,l;var d=l.imul(E),a=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=d.isub(a).iushrn(this.shift),p=u;return u.cmp(this.m)>=0?p=u.isub(this.m):u.cmpn(0)<0&&(p=u.iadd(this.m)),p._forceRed(this)},be.prototype.mul=function(l,E){if(l.isZero()||E.isZero())return new n(0)._forceRed(this);var d=l.mul(E),a=d.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=d.isub(a).iushrn(this.shift),p=u;return u.cmp(this.m)>=0?p=u.isub(this.m):u.cmpn(0)<0&&(p=u.iadd(this.m)),p._forceRed(this)},be.prototype.invm=function(l){var E=this.imod(l._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(typeof gd>"u"||gd,Ey)});var We=B((vd,Iy)=>{y();var $u=xt(),Ii=$u.Buffer;function xy(e,t){for(var r in e)t[r]=e[r]}Ii.from&&Ii.alloc&&Ii.allocUnsafe&&Ii.allocUnsafeSlow?Iy.exports=$u:(xy($u,vd),vd.Buffer=Io);function Io(e,t,r){return Ii(e,t,r)}Io.prototype=Object.create(Ii.prototype);xy(Ii,Io);Io.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Ii(e,t,r)};Io.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Ii(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Io.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Ii(e)};Io.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return $u.SlowBuffer(e)}});var Ao=B((sj,md)=>{"use strict";y();var yd=65536,tT=4294967295;function rT(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}var iT=We().Buffer,Xu=globalThis.crypto||globalThis.msCrypto;Xu&&Xu.getRandomValues?md.exports=nT:md.exports=rT;function nT(e,t){if(e>tT)throw new RangeError("requested too many random bytes");var r=iT.allocUnsafe(e);if(e>0)if(e>yd)for(var i=0;i<e;i+=yd)Xu.getRandomValues(r.slice(i,i+yd));else Xu.getRandomValues(r);return typeof t=="function"?O.default.nextTick(function(){t(null,r)}):r}});var we=B((fj,bd)=>{y();typeof Object.create=="function"?bd.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:bd.exports=function(t,r){if(r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}});var Ps=B((cj,_d)=>{"use strict";y();var Bs=typeof Reflect=="object"?Reflect:null,Ay=Bs&&typeof Bs.apply=="function"?Bs.apply:function(t,r,i){return Function.prototype.apply.call(t,r,i)},Ju;Bs&&typeof Bs.ownKeys=="function"?Ju=Bs.ownKeys:Object.getOwnPropertySymbols?Ju=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ju=function(t){return Object.getOwnPropertyNames(t)};function oT(e){console&&console.warn&&console.warn(e)}var Ry=Number.isNaN||function(t){return t!==t};function ft(){ft.init.call(this)}_d.exports=ft;_d.exports.once=uT;ft.EventEmitter=ft;ft.prototype._events=void 0;ft.prototype._eventsCount=0;ft.prototype._maxListeners=void 0;var Oy=10;function Qu(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(ft,"defaultMaxListeners",{enumerable:!0,get:function(){return Oy},set:function(e){if(typeof e!="number"||e<0||Ry(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Oy=e}});ft.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};ft.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Ry(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Ty(e){return e._maxListeners===void 0?ft.defaultMaxListeners:e._maxListeners}ft.prototype.getMaxListeners=function(){return Ty(this)};ft.prototype.emit=function(t){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=t==="error",o=this._events;if(o!==void 0)n=n&&o.error===void 0;else if(!n)return!1;if(n){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var f=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw f.context=s,f}var h=o[t];if(h===void 0)return!1;if(typeof h=="function")Ay(h,this,r);else for(var m=h.length,S=Ny(h,m),i=0;i<m;++i)Ay(S[i],this,r);return!0};function By(e,t,r,i){var n,o,s;if(Qu(r),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),s===void 0)s=o[t]=r,++e._eventsCount;else if(typeof s=="function"?s=o[t]=i?[r,s]:[s,r]:i?s.unshift(r):s.push(r),n=Ty(e),n>0&&s.length>n&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,oT(f)}return e}ft.prototype.addListener=function(t,r){return By(this,t,r,!1)};ft.prototype.on=ft.prototype.addListener;ft.prototype.prependListener=function(t,r){return By(this,t,r,!0)};function sT(){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 Py(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=sT.bind(i);return n.listener=r,i.wrapFn=n,n}ft.prototype.once=function(t,r){return Qu(r),this.on(t,Py(this,t,r)),this};ft.prototype.prependOnceListener=function(t,r){return Qu(r),this.prependListener(t,Py(this,t,r)),this};ft.prototype.removeListener=function(t,r){var i,n,o,s,f;if(Qu(r),n=this._events,n===void 0)return this;if(i=n[t],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,i.listener||r));else if(typeof i!="function"){for(o=-1,s=i.length-1;s>=0;s--)if(i[s]===r||i[s].listener===r){f=i[s].listener,o=s;break}if(o<0)return this;o===0?i.shift():aT(i,o),i.length===1&&(n[t]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",t,f||r)}return this};ft.prototype.off=ft.prototype.removeListener;ft.prototype.removeAllListeners=function(t){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[t]),this;if(arguments.length===0){var o=Object.keys(i),s;for(n=0;n<o.length;++n)s=o[n],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(t,r[n]);return this};function My(e,t,r){var i=e._events;if(i===void 0)return[];var n=i[t];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?fT(n):Ny(n,n.length)}ft.prototype.listeners=function(t){return My(this,t,!0)};ft.prototype.rawListeners=function(t){return My(this,t,!1)};ft.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):ky.call(e,t)};ft.prototype.listenerCount=ky;function ky(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ft.prototype.eventNames=function(){return this._eventsCount>0?Ju(this._events):[]};function Ny(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function aT(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function fT(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function uT(e,t){return new Promise(function(r,i){function n(s){e.removeListener(t,o),i(s)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",n),r([].slice.call(arguments))}Cy(e,t,o,{once:!0}),t!=="error"&&cT(e,n,{once:!0})})}function cT(e,t,r){typeof e.on=="function"&&Cy(e,"error",t,r)}function Cy(e,t,r,i){if(typeof e.on=="function")i.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function n(o){i.once&&e.removeEventListener(t,n),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}});var wd=B((lj,Dy)=>{y();Dy.exports=Ps().EventEmitter});var ec=B((pj,qy)=>{"use strict";y();qy.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;t[r]=n;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var s=Object.getOwnPropertySymbols(t);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,r);if(f.value!==n||f.enumerable!==!0)return!1}return!0}});var tf=B((vj,Ly)=>{"use strict";y();var hT=ec();Ly.exports=function(){return hT()&&!!Symbol.toStringTag}});var tc=B((mj,Uy)=>{"use strict";y();Uy.exports=Object});var jy=B((_j,Fy)=>{"use strict";y();Fy.exports=Error});var Ky=B((Sj,Hy)=>{"use strict";y();Hy.exports=EvalError});var Gy=B((xj,Vy)=>{"use strict";y();Vy.exports=RangeError});var Wy=B((Aj,zy)=>{"use strict";y();zy.exports=ReferenceError});var Sd=B((Rj,Yy)=>{"use strict";y();Yy.exports=SyntaxError});var Oo=B((Bj,Zy)=>{"use strict";y();Zy.exports=TypeError});var Xy=B((Mj,$y)=>{"use strict";y();$y.exports=URIError});var Qy=B((Nj,Jy)=>{"use strict";y();Jy.exports=Math.abs});var tm=B((Dj,em)=>{"use strict";y();em.exports=Math.floor});var im=B((Lj,rm)=>{"use strict";y();rm.exports=Math.max});var om=B((Fj,nm)=>{"use strict";y();nm.exports=Math.min});var am=B((Hj,sm)=>{"use strict";y();sm.exports=Math.pow});var um=B((Vj,fm)=>{"use strict";y();fm.exports=Math.round});var hm=B((zj,cm)=>{"use strict";y();cm.exports=Number.isNaN||function(t){return t!==t}});var dm=B((Yj,lm)=>{"use strict";y();var lT=hm();lm.exports=function(t){return lT(t)||t===0?t:t<0?-1:1}});var gm=B(($j,pm)=>{"use strict";y();pm.exports=Object.getOwnPropertyDescriptor});var Ro=B((Jj,vm)=>{"use strict";y();var rc=gm();if(rc)try{rc([],"length")}catch{rc=null}vm.exports=rc});var rf=B((eH,ym)=>{"use strict";y();var ic=Object.defineProperty||!1;if(ic)try{ic({},"a",{value:1})}catch{ic=!1}ym.exports=ic});var _m=B((rH,bm)=>{"use strict";y();var mm=typeof Symbol<"u"&&Symbol,dT=ec();bm.exports=function(){return typeof mm!="function"||typeof Symbol!="function"||typeof mm("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:dT()}});var Ed=B((nH,wm)=>{"use strict";y();wm.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var xd=B((sH,Sm)=>{"use strict";y();var pT=tc();Sm.exports=pT.getPrototypeOf||null});var Im=B((fH,xm)=>{"use strict";y();var gT="Function.prototype.bind called on incompatible ",vT=Object.prototype.toString,yT=Math.max,mT="[object Function]",Em=function(t,r){for(var i=[],n=0;n<t.length;n+=1)i[n]=t[n];for(var o=0;o<r.length;o+=1)i[o+t.length]=r[o];return i},bT=function(t,r){for(var i=[],n=r||0,o=0;n<t.length;n+=1,o+=1)i[o]=t[n];return i},_T=function(e,t){for(var r="",i=0;i<e.length;i+=1)r+=e[i],i+1<e.length&&(r+=t);return r};xm.exports=function(t){var r=this;if(typeof r!="function"||vT.apply(r)!==mT)throw new TypeError(gT+r);for(var i=bT(arguments,1),n,o=function(){if(this instanceof n){var S=r.apply(this,Em(i,arguments));return Object(S)===S?S:this}return r.apply(t,Em(i,arguments))},s=yT(0,r.length-i.length),f=[],h=0;h<s;h++)f[h]="$"+h;if(n=Function("binder","return function ("+_T(f,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var m=function(){};m.prototype=r.prototype,n.prototype=new m,m.prototype=null}return n}});var Ms=B((cH,Am)=>{"use strict";y();var wT=Im();Am.exports=Function.prototype.bind||wT});var nc=B((lH,Om)=>{"use strict";y();Om.exports=Function.prototype.call});var oc=B((pH,Rm)=>{"use strict";y();Rm.exports=Function.prototype.apply});var Bm=B((vH,Tm)=>{"use strict";y();Tm.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var Id=B((mH,Pm)=>{"use strict";y();var ST=Ms(),ET=oc(),xT=nc(),IT=Bm();Pm.exports=IT||ST.call(xT,ET)});var sc=B((_H,Mm)=>{"use strict";y();var AT=Ms(),OT=Oo(),RT=nc(),TT=Id();Mm.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new OT("a function is required");return TT(AT,RT,t)}});var Lm=B((SH,qm)=>{"use strict";y();var BT=sc(),km=Ro(),Cm;try{Cm=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!="object"||!("code"in e)||e.code!=="ERR_PROTO_ACCESS")throw e}var Ad=!!Cm&&km&&km(Object.prototype,"__proto__"),Dm=Object,Nm=Dm.getPrototypeOf;qm.exports=Ad&&typeof Ad.get=="function"?BT([Ad.get]):typeof Nm=="function"?function(t){return Nm(t==null?t:Dm(t))}:!1});var ac=B((xH,Hm)=>{"use strict";y();var Um=Ed(),Fm=xd(),jm=Lm();Hm.exports=Um?function(t){return Um(t)}:Fm?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Fm(t)}:jm?function(t){return jm(t)}:null});var Od=B((AH,Km)=>{"use strict";y();var PT=Function.prototype.call,MT=Object.prototype.hasOwnProperty,kT=Ms();Km.exports=kT.call(PT,MT)});var cc=B((RH,Zm)=>{"use strict";y();var $e,NT=tc(),CT=jy(),DT=Ky(),qT=Gy(),LT=Wy(),Ds=Sd(),Cs=Oo(),UT=Xy(),FT=Qy(),jT=tm(),HT=im(),KT=om(),VT=am(),GT=um(),zT=dm(),Wm=Function,Rd=function(e){try{return Wm('"use strict"; return ('+e+").constructor;")()}catch{}},nf=Ro(),WT=rf(),Td=function(){throw new Cs},YT=nf?(function(){try{return arguments.callee,Td}catch{try{return nf(arguments,"callee").get}catch{return Td}}})():Td,ks=_m()(),Ht=ac(),ZT=xd(),$T=Ed(),Ym=oc(),of=nc(),Ns={},XT=typeof Uint8Array>"u"||!Ht?$e:Ht(Uint8Array),To={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$e:ArrayBuffer,"%ArrayIteratorPrototype%":ks&&Ht?Ht([][Symbol.iterator]()):$e,"%AsyncFromSyncIteratorPrototype%":$e,"%AsyncFunction%":Ns,"%AsyncGenerator%":Ns,"%AsyncGeneratorFunction%":Ns,"%AsyncIteratorPrototype%":Ns,"%Atomics%":typeof Atomics>"u"?$e:Atomics,"%BigInt%":typeof BigInt>"u"?$e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":CT,"%eval%":eval,"%EvalError%":DT,"%Float16Array%":typeof Float16Array>"u"?$e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?$e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$e:FinalizationRegistry,"%Function%":Wm,"%GeneratorFunction%":Ns,"%Int8Array%":typeof Int8Array>"u"?$e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ks&&Ht?Ht(Ht([][Symbol.iterator]())):$e,"%JSON%":typeof JSON=="object"?JSON:$e,"%Map%":typeof Map>"u"?$e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ks||!Ht?$e:Ht(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":NT,"%Object.getOwnPropertyDescriptor%":nf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$e:Promise,"%Proxy%":typeof Proxy>"u"?$e:Proxy,"%RangeError%":qT,"%ReferenceError%":LT,"%Reflect%":typeof Reflect>"u"?$e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ks||!Ht?$e:Ht(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ks&&Ht?Ht(""[Symbol.iterator]()):$e,"%Symbol%":ks?Symbol:$e,"%SyntaxError%":Ds,"%ThrowTypeError%":YT,"%TypedArray%":XT,"%TypeError%":Cs,"%Uint8Array%":typeof Uint8Array>"u"?$e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$e:Uint32Array,"%URIError%":UT,"%WeakMap%":typeof WeakMap>"u"?$e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$e:WeakSet,"%Function.prototype.call%":of,"%Function.prototype.apply%":Ym,"%Object.defineProperty%":WT,"%Object.getPrototypeOf%":ZT,"%Math.abs%":FT,"%Math.floor%":jT,"%Math.max%":HT,"%Math.min%":KT,"%Math.pow%":VT,"%Math.round%":GT,"%Math.sign%":zT,"%Reflect.getPrototypeOf%":$T};if(Ht)try{null.error}catch(e){Vm=Ht(Ht(e)),To["%Error.prototype%"]=Vm}var Vm,JT=function e(t){var r;if(t==="%AsyncFunction%")r=Rd("async function () {}");else if(t==="%GeneratorFunction%")r=Rd("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Rd("async function* () {}");else if(t==="%AsyncGenerator%"){var i=e("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=e("%AsyncGenerator%");n&&Ht&&(r=Ht(n.prototype))}return To[t]=r,r},Gm={__proto__:null,"%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"]},sf=Ms(),fc=Od(),QT=sf.call(of,Array.prototype.concat),e4=sf.call(Ym,Array.prototype.splice),zm=sf.call(of,String.prototype.replace),uc=sf.call(of,String.prototype.slice),t4=sf.call(of,RegExp.prototype.exec),r4=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,i4=/\\(\\)?/g,n4=function(t){var r=uc(t,0,1),i=uc(t,-1);if(r==="%"&&i!=="%")throw new Ds("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Ds("invalid intrinsic syntax, expected opening `%`");var n=[];return zm(t,r4,function(o,s,f,h){n[n.length]=f?zm(h,i4,"$1"):s||o}),n},o4=function(t,r){var i=t,n;if(fc(Gm,i)&&(n=Gm[i],i="%"+n[0]+"%"),fc(To,i)){var o=To[i];if(o===Ns&&(o=JT(i)),typeof o>"u"&&!r)throw new Cs("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new Ds("intrinsic "+t+" does not exist!")};Zm.exports=function(t,r){if(typeof t!="string"||t.length===0)throw new Cs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Cs('"allowMissing" argument must be a boolean');if(t4(/^%?[^%]*%?$/,t)===null)throw new Ds("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=n4(t),n=i.length>0?i[0]:"",o=o4("%"+n+"%",r),s=o.name,f=o.value,h=!1,m=o.alias;m&&(n=m[0],e4(i,QT([0,1],m)));for(var S=1,x=!0;S<i.length;S+=1){var I=i[S],T=uc(I,0,1),M=uc(I,-1);if((T==='"'||T==="'"||T==="`"||M==='"'||M==="'"||M==="`")&&T!==M)throw new Ds("property names with quotes must have matching quotes");if((I==="constructor"||!x)&&(h=!0),n+="."+I,s="%"+n+"%",fc(To,s))f=To[s];else if(f!=null){if(!(I in f)){if(!r)throw new Cs("base intrinsic for "+t+" exists, but the property is not available.");return}if(nf&&S+1>=i.length){var N=nf(f,I);x=!!N,x&&"get"in N&&!("originalValue"in N.get)?f=N.get:f=f[I]}else x=fc(f,I),f=f[I];x&&!h&&(To[s]=f)}}return f}});var Bn=B((BH,Jm)=>{"use strict";y();var $m=cc(),Xm=sc(),s4=Xm([$m("%String.prototype.indexOf%")]);Jm.exports=function(t,r){var i=$m(t,!!r);return typeof i=="function"&&s4(t,".prototype.")>-1?Xm([i]):i}});var tb=B((MH,eb)=>{"use strict";y();var a4=tf()(),f4=Bn(),Bd=f4("Object.prototype.toString"),hc=function(t){return a4&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Bd(t)==="[object Arguments]"},Qm=function(t){return hc(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&Bd(t)!=="[object Array]"&&"callee"in t&&Bd(t.callee)==="[object Function]"},u4=(function(){return hc(arguments)})();hc.isLegacyArguments=Qm;eb.exports=u4?hc:Qm});var ab=B((NH,sb)=>{"use strict";y();var rb=Bn(),c4=tf()(),h4=Od(),l4=Ro(),kd;c4?(ib=rb("RegExp.prototype.exec"),Pd={},lc=function(){throw Pd},Md={toString:lc,valueOf:lc},typeof Symbol.toPrimitive=="symbol"&&(Md[Symbol.toPrimitive]=lc),kd=function(t){if(!t||typeof t!="object")return!1;var r=l4(t,"lastIndex"),i=r&&h4(r,"value");if(!i)return!1;try{ib(t,Md)}catch(n){return n===Pd}}):(nb=rb("Object.prototype.toString"),ob="[object RegExp]",kd=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:nb(t)===ob});var ib,Pd,lc,Md,nb,ob;sb.exports=kd});var ub=B((DH,fb)=>{"use strict";y();var d4=Bn(),p4=ab(),g4=d4("RegExp.prototype.exec"),v4=Oo();fb.exports=function(t){if(!p4(t))throw new v4("`regex` must be a RegExp");return function(i){return g4(t,i)!==null}}});var hb=B((LH,cb)=>{"use strict";y();var y4=function*(){}.constructor;cb.exports=()=>y4});var gb=B((FH,pb)=>{"use strict";y();var db=Bn(),m4=ub(),b4=m4(/^\s*(?:function)?\*/),_4=tf()(),lb=ac(),w4=db("Object.prototype.toString"),S4=db("Function.prototype.toString"),E4=hb();pb.exports=function(t){if(typeof t!="function")return!1;if(b4(S4(t)))return!0;if(!_4){var r=w4(t);return r==="[object GeneratorFunction]"}if(!lb)return!1;var i=E4();return i&&lb(t)===i.prototype}});var bb=B((HH,mb)=>{"use strict";y();var yb=Function.prototype.toString,qs=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Cd,dc;if(typeof qs=="function"&&typeof Object.defineProperty=="function")try{Cd=Object.defineProperty({},"length",{get:function(){throw dc}}),dc={},qs(function(){throw 42},null,Cd)}catch(e){e!==dc&&(qs=null)}else qs=null;var x4=/^\s*class\b/,Dd=function(t){try{var r=yb.call(t);return x4.test(r)}catch{return!1}},Nd=function(t){try{return Dd(t)?!1:(yb.call(t),!0)}catch{return!1}},pc=Object.prototype.toString,I4="[object Object]",A4="[object Function]",O4="[object GeneratorFunction]",R4="[object HTMLAllCollection]",T4="[object HTML document.all class]",B4="[object HTMLCollection]",P4=typeof Symbol=="function"&&!!Symbol.toStringTag,M4=!(0 in[,]),qd=function(){return!1};typeof document=="object"&&(vb=document.all,pc.call(vb)===pc.call(document.all)&&(qd=function(t){if((M4||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=pc.call(t);return(r===R4||r===T4||r===B4||r===I4)&&t("")==null}catch{}return!1}));var vb;mb.exports=qs?function(t){if(qd(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{qs(t,null,Cd)}catch(r){if(r!==dc)return!1}return!Dd(t)&&Nd(t)}:function(t){if(qd(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(P4)return Nd(t);if(Dd(t))return!1;var r=pc.call(t);return r!==A4&&r!==O4&&!/^\[object HTML/.test(r)?!1:Nd(t)}});var Sb=B((VH,wb)=>{"use strict";y();var k4=bb(),N4=Object.prototype.toString,_b=Object.prototype.hasOwnProperty,C4=function(t,r,i){for(var n=0,o=t.length;n<o;n++)_b.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))},D4=function(t,r,i){for(var n=0,o=t.length;n<o;n++)i==null?r(t.charAt(n),n,t):r.call(i,t.charAt(n),n,t)},q4=function(t,r,i){for(var n in t)_b.call(t,n)&&(i==null?r(t[n],n,t):r.call(i,t[n],n,t))};function L4(e){return N4.call(e)==="[object Array]"}wb.exports=function(t,r,i){if(!k4(r))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),L4(t)?C4(t,r,n):typeof t=="string"?D4(t,r,n):q4(t,r,n)}});var xb=B((zH,Eb)=>{"use strict";y();Eb.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var Ab=B((YH,Ib)=>{"use strict";y();var Ld=xb(),U4=globalThis;Ib.exports=function(){for(var t=[],r=0;r<Ld.length;r++)typeof U4[Ld[r]]=="function"&&(t[t.length]=Ld[r]);return t}});var Ud=B(($H,Tb)=>{"use strict";y();var Ob=rf(),F4=Sd(),Ls=Oo(),Rb=Ro();Tb.exports=function(t,r,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Ls("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ls("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ls("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ls("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ls("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ls("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,h=!!Rb&&Rb(t,r);if(Ob)Ob(t,r,{configurable:s===null&&h?h.configurable:!s,enumerable:n===null&&h?h.enumerable:!n,value:i,writable:o===null&&h?h.writable:!o});else if(f||!n&&!o&&!s)t[r]=i;else throw new F4("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var jd=B((JH,Pb)=>{"use strict";y();var Fd=rf(),Bb=function(){return!!Fd};Bb.hasArrayLengthDefineBug=function(){if(!Fd)return null;try{return Fd([],"length",{value:1}).length!==1}catch{return!0}};Pb.exports=Bb});var Db=B((eK,Cb)=>{"use strict";y();var j4=cc(),Mb=Ud(),H4=jd()(),kb=Ro(),Nb=Oo(),K4=j4("%Math.floor%");Cb.exports=function(t,r){if(typeof t!="function")throw new Nb("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||K4(r)!==r)throw new Nb("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&kb){var s=kb(t,"length");s&&!s.configurable&&(n=!1),s&&!s.writable&&(o=!1)}return(n||o||!i)&&(H4?Mb(t,"length",r,!0,!0):Mb(t,"length",r)),t}});var Lb=B((rK,qb)=>{"use strict";y();var V4=Ms(),G4=oc(),z4=Id();qb.exports=function(){return z4(V4,G4,arguments)}});var af=B((nK,gc)=>{"use strict";y();var W4=Db(),Ub=rf(),Y4=sc(),Fb=Lb();gc.exports=function(t){var r=Y4(arguments),i=1+t.length-(arguments.length-1);return W4(r,i>0?i:0,!0)};Ub?Ub(gc.exports,"apply",{value:Fb}):gc.exports.apply=Fb});var Gd=B((sK,Vb)=>{"use strict";y();var mc=Sb(),Z4=Ab(),jb=af(),Kd=Bn(),yc=Ro(),vc=ac(),$4=Kd("Object.prototype.toString"),Kb=tf()(),Hb=globalThis,Hd=Z4(),Vd=Kd("String.prototype.slice"),X4=Kd("Array.prototype.indexOf",!0)||function(t,r){for(var i=0;i<t.length;i+=1)if(t[i]===r)return i;return-1},bc={__proto__:null};Kb&&yc&&vc?mc(Hd,function(e){var t=new Hb[e];if(Symbol.toStringTag in t&&vc){var r=vc(t),i=yc(r,Symbol.toStringTag);if(!i&&r){var n=vc(r);i=yc(n,Symbol.toStringTag)}if(i&&i.get){var o=jb(i.get);bc["$"+e]=o}}}):mc(Hd,function(e){var t=new Hb[e],r=t.slice||t.set;if(r){var i=jb(r);bc["$"+e]=i}});var J4=function(t){var r=!1;return mc(bc,function(i,n){if(!r)try{"$"+i(t)===n&&(r=Vd(n,1))}catch{}}),r},Q4=function(t){var r=!1;return mc(bc,function(i,n){if(!r)try{i(t),r=Vd(n,1)}catch{}}),r};Vb.exports=function(t){if(!t||typeof t!="object")return!1;if(!Kb){var r=Vd($4(t),8,-1);return X4(Hd,r)>-1?r:r!=="Object"?!1:Q4(t)}return yc?J4(t):null}});var zd=B((fK,Gb)=>{"use strict";y();var e8=Gd();Gb.exports=function(t){return!!e8(t)}});var o1=B(Xe=>{"use strict";y();var t8=tb(),r8=gb(),Yr=Gd(),zb=zd();function Us(e){return e.call.bind(e)}var Wb=typeof BigInt<"u",Yb=typeof Symbol<"u",Br=Us(Object.prototype.toString),i8=Us(Number.prototype.valueOf),n8=Us(String.prototype.valueOf),o8=Us(Boolean.prototype.valueOf);Wb&&(Zb=Us(BigInt.prototype.valueOf));var Zb;Yb&&($b=Us(Symbol.prototype.valueOf));var $b;function uf(e,t){if(typeof e!="object")return!1;try{return t(e),!0}catch{return!1}}Xe.isArgumentsObject=t8;Xe.isGeneratorFunction=r8;Xe.isTypedArray=zb;function s8(e){return typeof Promise<"u"&&e instanceof Promise||e!==null&&typeof e=="object"&&typeof e.then=="function"&&typeof e.catch=="function"}Xe.isPromise=s8;function a8(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):zb(e)||Jb(e)}Xe.isArrayBufferView=a8;function f8(e){return Yr(e)==="Uint8Array"}Xe.isUint8Array=f8;function u8(e){return Yr(e)==="Uint8ClampedArray"}Xe.isUint8ClampedArray=u8;function c8(e){return Yr(e)==="Uint16Array"}Xe.isUint16Array=c8;function h8(e){return Yr(e)==="Uint32Array"}Xe.isUint32Array=h8;function l8(e){return Yr(e)==="Int8Array"}Xe.isInt8Array=l8;function d8(e){return Yr(e)==="Int16Array"}Xe.isInt16Array=d8;function p8(e){return Yr(e)==="Int32Array"}Xe.isInt32Array=p8;function g8(e){return Yr(e)==="Float32Array"}Xe.isFloat32Array=g8;function v8(e){return Yr(e)==="Float64Array"}Xe.isFloat64Array=v8;function y8(e){return Yr(e)==="BigInt64Array"}Xe.isBigInt64Array=y8;function m8(e){return Yr(e)==="BigUint64Array"}Xe.isBigUint64Array=m8;function _c(e){return Br(e)==="[object Map]"}_c.working=typeof Map<"u"&&_c(new Map);function b8(e){return typeof Map>"u"?!1:_c.working?_c(e):e instanceof Map}Xe.isMap=b8;function wc(e){return Br(e)==="[object Set]"}wc.working=typeof Set<"u"&&wc(new Set);function _8(e){return typeof Set>"u"?!1:wc.working?wc(e):e instanceof Set}Xe.isSet=_8;function Sc(e){return Br(e)==="[object WeakMap]"}Sc.working=typeof WeakMap<"u"&&Sc(new WeakMap);function w8(e){return typeof WeakMap>"u"?!1:Sc.working?Sc(e):e instanceof WeakMap}Xe.isWeakMap=w8;function Yd(e){return Br(e)==="[object WeakSet]"}Yd.working=typeof WeakSet<"u"&&Yd(new WeakSet);function S8(e){return Yd(e)}Xe.isWeakSet=S8;function Ec(e){return Br(e)==="[object ArrayBuffer]"}Ec.working=typeof ArrayBuffer<"u"&&Ec(new ArrayBuffer);function Xb(e){return typeof ArrayBuffer>"u"?!1:Ec.working?Ec(e):e instanceof ArrayBuffer}Xe.isArrayBuffer=Xb;function xc(e){return Br(e)==="[object DataView]"}xc.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&xc(new DataView(new ArrayBuffer(1),0,1));function Jb(e){return typeof DataView>"u"?!1:xc.working?xc(e):e instanceof DataView}Xe.isDataView=Jb;var Wd=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ff(e){return Br(e)==="[object SharedArrayBuffer]"}function Qb(e){return typeof Wd>"u"?!1:(typeof ff.working>"u"&&(ff.working=ff(new Wd)),ff.working?ff(e):e instanceof Wd)}Xe.isSharedArrayBuffer=Qb;function E8(e){return Br(e)==="[object AsyncFunction]"}Xe.isAsyncFunction=E8;function x8(e){return Br(e)==="[object Map Iterator]"}Xe.isMapIterator=x8;function I8(e){return Br(e)==="[object Set Iterator]"}Xe.isSetIterator=I8;function A8(e){return Br(e)==="[object Generator]"}Xe.isGeneratorObject=A8;function O8(e){return Br(e)==="[object WebAssembly.Module]"}Xe.isWebAssemblyCompiledModule=O8;function e1(e){return uf(e,i8)}Xe.isNumberObject=e1;function t1(e){return uf(e,n8)}Xe.isStringObject=t1;function r1(e){return uf(e,o8)}Xe.isBooleanObject=r1;function i1(e){return Wb&&uf(e,Zb)}Xe.isBigIntObject=i1;function n1(e){return Yb&&uf(e,$b)}Xe.isSymbolObject=n1;function R8(e){return e1(e)||t1(e)||r1(e)||i1(e)||n1(e)}Xe.isBoxedPrimitive=R8;function T8(e){return typeof Uint8Array<"u"&&(Xb(e)||Qb(e))}Xe.isAnyArrayBuffer=T8;["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(e){Object.defineProperty(Xe,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})})});var a1=B((lK,s1)=>{y();s1.exports=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"}});var Ai=B(Je=>{y();var f1=Object.getOwnPropertyDescriptors||function(t){for(var r=Object.keys(t),i={},n=0;n<r.length;n++)i[r[n]]=Object.getOwnPropertyDescriptor(t,r[n]);return i},B8=/%[sdj%]/g;Je.format=function(e){if(!Pc(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Pn(arguments[r]));return t.join(" ")}for(var r=1,i=arguments,n=i.length,o=String(e).replace(B8,function(f){if(f==="%%")return"%";if(r>=n)return f;switch(f){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch{return"[Circular]"}default:return f}}),s=i[r];r<n;s=i[++r])Bc(s)||!Fs(s)?o+=" "+s:o+=" "+Pn(s);return o};Je.deprecate=function(e,t){if(typeof O.default<"u"&&O.default.noDeprecation===!0)return e;if(typeof O.default>"u")return function(){return Je.deprecate(e,t).apply(this,arguments)};var r=!1;function i(){if(!r){if(O.default.throwDeprecation)throw new Error(t);O.default.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)}return i};var Ic={},u1=/^$/;O.default.env.NODE_DEBUG&&(Ac=O.default.env.NODE_DEBUG,Ac=Ac.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u1=new RegExp("^"+Ac+"$","i"));var Ac;Je.debuglog=function(e){if(e=e.toUpperCase(),!Ic[e])if(u1.test(e)){var t=O.default.pid;Ic[e]=function(){var r=Je.format.apply(Je,arguments);console.error("%s %d: %s",e,t,r)}}else Ic[e]=function(){};return Ic[e]};function Pn(e,t){var r={seen:[],stylize:M8};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Jd(t)?r.showHidden=t:t&&Je._extend(r,t),Po(r.showHidden)&&(r.showHidden=!1),Po(r.depth)&&(r.depth=2),Po(r.colors)&&(r.colors=!1),Po(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=P8),Rc(r,e,r.depth)}Je.inspect=Pn;Pn.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]};Pn.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function P8(e,t){var r=Pn.styles[t];return r?"\x1B["+Pn.colors[r][0]+"m"+e+"\x1B["+Pn.colors[r][1]+"m":e}function M8(e,t){return e}function k8(e){var t={};return e.forEach(function(r,i){t[r]=!0}),t}function Rc(e,t,r){if(e.customInspect&&t&&Oc(t.inspect)&&t.inspect!==Je.inspect&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);return Pc(i)||(i=Rc(e,i,r)),i}var n=N8(e,t);if(n)return n;var o=Object.keys(t),s=k8(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),hf(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return Zd(t);if(o.length===0){if(Oc(t)){var f=t.name?": "+t.name:"";return e.stylize("[Function"+f+"]","special")}if(cf(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Tc(t))return e.stylize(Date.prototype.toString.call(t),"date");if(hf(t))return Zd(t)}var h="",m=!1,S=["{","}"];if(c1(t)&&(m=!0,S=["[","]"]),Oc(t)){var x=t.name?": "+t.name:"";h=" [Function"+x+"]"}if(cf(t)&&(h=" "+RegExp.prototype.toString.call(t)),Tc(t)&&(h=" "+Date.prototype.toUTCString.call(t)),hf(t)&&(h=" "+Zd(t)),o.length===0&&(!m||t.length==0))return S[0]+h+S[1];if(r<0)return cf(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var I;return m?I=C8(e,t,r,s,o):I=o.map(function(T){return Xd(e,t,r,s,T,m)}),e.seen.pop(),D8(I,h,S)}function N8(e,t){if(Po(t))return e.stylize("undefined","undefined");if(Pc(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(h1(t))return e.stylize(""+t,"number");if(Jd(t))return e.stylize(""+t,"boolean");if(Bc(t))return e.stylize("null","null")}function Zd(e){return"["+Error.prototype.toString.call(e)+"]"}function C8(e,t,r,i,n){for(var o=[],s=0,f=t.length;s<f;++s)l1(t,String(s))?o.push(Xd(e,t,r,i,String(s),!0)):o.push("");return n.forEach(function(h){h.match(/^\d+$/)||o.push(Xd(e,t,r,i,h,!0))}),o}function Xd(e,t,r,i,n,o){var s,f,h;if(h=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]},h.get?h.set?f=e.stylize("[Getter/Setter]","special"):f=e.stylize("[Getter]","special"):h.set&&(f=e.stylize("[Setter]","special")),l1(i,n)||(s="["+n+"]"),f||(e.seen.indexOf(h.value)<0?(Bc(r)?f=Rc(e,h.value,null):f=Rc(e,h.value,r-1),f.indexOf(`
3
3
  `)>-1&&(o?f=f.split(`
4
4
  `).map(function(m){return" "+m}).join(`
5
5
  `).slice(2):f=`
@@ -8,15 +8,15 @@ Use Chrome, Firefox or Internet Explorer 11`)}var iT=We().Buffer,Xu=globalThis.c
8
8
  `))):f=e.stylize("[Circular]","special")),Po(s)){if(o&&n.match(/^\d+$/))return f;s=JSON.stringify(""+n),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.slice(1,-1),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+f}function D8(e,t,r){var i=0,n=e.reduce(function(o,s){return i++,s.indexOf(`
9
9
  `)>=0&&i++,o+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?r[0]+(t===""?"":t+`
10
10
  `)+" "+e.join(`,
11
- `)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}Je.types=o1();function c1(e){return Array.isArray(e)}Je.isArray=c1;function Jd(e){return typeof e=="boolean"}Je.isBoolean=Jd;function Bc(e){return e===null}Je.isNull=Bc;function q8(e){return e==null}Je.isNullOrUndefined=q8;function h1(e){return typeof e=="number"}Je.isNumber=h1;function Pc(e){return typeof e=="string"}Je.isString=Pc;function U8(e){return typeof e=="symbol"}Je.isSymbol=U8;function Po(e){return e===void 0}Je.isUndefined=Po;function cf(e){return Fs(e)&&Qd(e)==="[object RegExp]"}Je.isRegExp=cf;Je.types.isRegExp=cf;function Fs(e){return typeof e=="object"&&e!==null}Je.isObject=Fs;function Tc(e){return Fs(e)&&Qd(e)==="[object Date]"}Je.isDate=Tc;Je.types.isDate=Tc;function hf(e){return Fs(e)&&(Qd(e)==="[object Error]"||e instanceof Error)}Je.isError=hf;Je.types.isNativeError=hf;function Oc(e){return typeof e=="function"}Je.isFunction=Oc;function L8(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Je.isPrimitive=L8;Je.isBuffer=a1();function Qd(e){return Object.prototype.toString.call(e)}function $d(e){return e<10?"0"+e.toString(10):e.toString(10)}var F8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j8(){var e=new Date,t=[$d(e.getHours()),$d(e.getMinutes()),$d(e.getSeconds())].join(":");return[e.getDate(),F8[e.getMonth()],t].join(" ")}Je.log=function(){console.log("%s - %s",j8(),Je.format.apply(Je,arguments))};Je.inherits=we();Je._extend=function(e,t){if(!t||!Fs(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};function l1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Bo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Je.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Bo&&t[Bo]){var r=t[Bo];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,Bo,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var i,n,o=new Promise(function(h,m){i=h,n=m}),s=[],f=0;f<arguments.length;f++)s.push(arguments[f]);s.push(function(h,m){h?n(h):i(m)});try{t.apply(this,s)}catch(h){n(h)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Bo&&Object.defineProperty(r,Bo,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,f1(t))};Je.promisify.custom=Bo;function H8(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function K8(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if(typeof n!="function")throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return n.apply(o,arguments)};e.apply(this,r).then(function(f){O.default.nextTick(s.bind(null,null,f))},function(f){O.default.nextTick(H8.bind(null,f,s))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,f1(e)),t}Je.callbackify=K8});var m1=B((vK,y1)=>{"use strict";y();function d1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function p1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?d1(Object(r),!0).forEach(function(i){V8(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d1(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function V8(e,t,r){return t=v1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g1(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,v1(i.key),i)}}function z8(e,t,r){return t&&g1(e.prototype,t),r&&g1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v1(e){var t=W8(e,"string");return typeof t=="symbol"?t:String(t)}function W8(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y8=xt(),Mc=Y8.Buffer,Z8=Ai(),e0=Z8.inspect,$8=e0&&e0.custom||"inspect";function X8(e,t,r){Mc.prototype.copy.call(e,t,r)}y1.exports=(function(){function e(){G8(this,e),this.head=null,this.tail=null,this.length=0}return z8(e,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++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 i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return Mc.alloc(0);for(var i=Mc.allocUnsafe(r>>>0),n=this.head,o=0;n;)X8(n.data,i,o),o+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,o=i.data;for(r-=o.length;i=i.next;){var s=i.data,f=r>s.length?s.length:r;if(f===s.length?o+=s:o+=s.slice(0,r),r-=f,r===0){f===s.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(f));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=Mc.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var s=n.data,f=r>s.length?s.length:r;if(s.copy(i,i.length-r,0,f),r-=f,r===0){f===s.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(f));break}++o}return this.length-=o,i}},{key:$8,value:function(r,i){return e0(this,p1(p1({},i),{},{depth:0,customInspect:!1}))}}]),e})()});var r0=B((mK,_1)=>{"use strict";y();function J8(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,O.default.nextTick(t0,this,e)):O.default.nextTick(t0,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted?O.default.nextTick(kc,r):(r._writableState.errorEmitted=!0,O.default.nextTick(b1,r,o)):O.default.nextTick(b1,r,o):t?(O.default.nextTick(kc,r),t(o)):O.default.nextTick(kc,r)}),this)}function b1(e,t){t0(e,t),kc(e)}function kc(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Q8(){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 t0(e,t){e.emit("error",t)}function eB(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}_1.exports={destroy:J8,undestroy:Q8,errorOrDestroy:eB}});var Mo=B((_K,E1)=>{"use strict";y();function tB(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var S1={};function Pr(e,t,r){r||(r=Error);function i(o,s,f){return typeof t=="string"?t:t(o,s,f)}var n=(function(o){tB(s,o);function s(f,h,m){return o.call(this,i(f,h,m))||this}return s})(r);n.prototype.name=r.name,n.prototype.code=e,S1[e]=n}function w1(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function rB(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function iB(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function nB(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Pr("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Pr("ERR_INVALID_ARG_TYPE",function(e,t,r){var i;typeof t=="string"&&rB(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(iB(e," argument"))n="The ".concat(e," ").concat(i," ").concat(w1(t,"type"));else{var o=nB(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(i," ").concat(w1(t,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError);Pr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Pr("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Pr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Pr("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Pr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Pr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Pr("ERR_STREAM_WRITE_AFTER_END","write after end");Pr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Pr("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Pr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");E1.exports.codes=S1});var i0=B((SK,x1)=>{"use strict";y();var oB=Mo().codes.ERR_INVALID_OPT_VALUE;function sB(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function aB(e,t,r,i){var n=sB(t,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new oB(o,n)}return Math.floor(n)}return e.objectMode?16:16*1024}x1.exports={getHighWaterMark:aB}});var o0=B((xK,I1)=>{y();I1.exports=fB;function fB(e,t){if(n0("noDeprecation"))return e;var r=!1;function i(){if(!r){if(n0("throwDeprecation"))throw new Error(t);n0("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function n0(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}});var f0=B((AK,P1)=>{"use strict";y();P1.exports=It;function O1(e){var t=this;this.next=null,this.entry=null,this.finish=function(){CB(t,e)}}var js;It.WritableState=df;var uB={deprecate:o0()},R1=wd(),Cc=xt().Buffer,cB=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hB(e){return Cc.from(e)}function lB(e){return Cc.isBuffer(e)||e instanceof cB}var a0=r0(),dB=i0(),pB=dB.getHighWaterMark,Mn=Mo().codes,gB=Mn.ERR_INVALID_ARG_TYPE,vB=Mn.ERR_METHOD_NOT_IMPLEMENTED,yB=Mn.ERR_MULTIPLE_CALLBACK,mB=Mn.ERR_STREAM_CANNOT_PIPE,bB=Mn.ERR_STREAM_DESTROYED,_B=Mn.ERR_STREAM_NULL_VALUES,wB=Mn.ERR_STREAM_WRITE_AFTER_END,SB=Mn.ERR_UNKNOWN_ENCODING,Hs=a0.errorOrDestroy;we()(It,R1);function EB(){}function df(e,t,r){js=js||ko(),e=e||{},typeof r!="boolean"&&(r=t instanceof js),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=pB(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){BB(t,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new O1(this)}df.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(df.prototype,"buffer",{get:uB.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Nc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Nc=Function.prototype[Symbol.hasInstance],Object.defineProperty(It,Symbol.hasInstance,{value:function(t){return Nc.call(this,t)?!0:this!==It?!1:t&&t._writableState instanceof df}})):Nc=function(t){return t instanceof this};function It(e){js=js||ko();var t=this instanceof js;if(!t&&!Nc.call(It,this))return new It(e);this._writableState=new df(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),R1.call(this)}It.prototype.pipe=function(){Hs(this,new mB)};function xB(e,t){var r=new wB;Hs(e,r),O.default.nextTick(t,r)}function IB(e,t,r,i){var n;return r===null?n=new _B:typeof r!="string"&&!t.objectMode&&(n=new gB("chunk",["string","Buffer"],r)),n?(Hs(e,n),O.default.nextTick(i,n),!1):!0}It.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&lB(e);return o&&!Cc.isBuffer(e)&&(e=hB(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=EB),i.ending?xB(this,r):(o||IB(this,i,e,r))&&(i.pendingcb++,n=OB(this,i,o,e,t,r)),n};It.prototype.cork=function(){this._writableState.corked++};It.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&T1(this,e))};It.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new SB(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(It.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function AB(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Cc.from(t,r)),t}Object.defineProperty(It.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function OB(e,t,r,i,n,o){if(!r){var s=AB(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var f=t.objectMode?1:i.length;t.length+=f;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var m=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else s0(e,t,!1,f,i,n,o);return h}function s0(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new bB("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function RB(e,t,r,i,n){--t.pendingcb,r?(O.default.nextTick(n,i),O.default.nextTick(lf,e,t),e._writableState.errorEmitted=!0,Hs(e,i)):(n(i),e._writableState.errorEmitted=!0,Hs(e,i),lf(e,t))}function TB(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function BB(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new yB;if(TB(r),t)RB(e,r,i,t,n);else{var o=B1(r)||e.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&T1(e,r),i?O.default.nextTick(A1,e,r,o,n):A1(e,r,o,n)}}function A1(e,t,r,i){r||PB(e,t),t.pendingcb--,i(),lf(e,t)}function PB(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function T1(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)n[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;n.allBuffers=f,s0(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new O1(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,m=r.encoding,S=r.callback,x=t.objectMode?1:h.length;if(s0(e,t,!1,x,h,m,S),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}It.prototype._write=function(e,t,r){r(new vB("_write()"))};It.prototype._writev=null;It.prototype.end=function(e,t,r){var i=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||NB(this,i,r),this};Object.defineProperty(It.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function B1(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function MB(e,t){e._final(function(r){t.pendingcb--,r&&Hs(e,r),t.prefinished=!0,e.emit("prefinish"),lf(e,t)})}function kB(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,O.default.nextTick(MB,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function lf(e,t){var r=B1(t);if(r&&(kB(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}function NB(e,t,r){t.ending=!0,lf(e,t),r&&(t.finished?O.default.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function CB(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(It.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}});It.prototype.destroy=a0.destroy;It.prototype._undestroy=a0.undestroy;It.prototype._destroy=function(e,t){t(e)}});var ko=B((RK,k1)=>{"use strict";y();var DB=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};k1.exports=Oi;var M1=h0(),c0=f0();we()(Oi,M1);for(u0=DB(c0.prototype),Dc=0;Dc<u0.length;Dc++)qc=u0[Dc],Oi.prototype[qc]||(Oi.prototype[qc]=c0.prototype[qc]);var u0,qc,Dc;function Oi(e){if(!(this instanceof Oi))return new Oi(e);M1.call(this,e),c0.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",qB)))}Object.defineProperty(Oi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Oi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Oi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function qB(){this._writableState.ended||O.default.nextTick(UB,this)}function UB(e){e.end()}Object.defineProperty(Oi.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)}})});var D1=B((l0,C1)=>{y();var Uc=xt(),Xi=Uc.Buffer;function N1(e,t){for(var r in e)t[r]=e[r]}Xi.from&&Xi.alloc&&Xi.allocUnsafe&&Xi.allocUnsafeSlow?C1.exports=Uc:(N1(Uc,l0),l0.Buffer=Ks);function Ks(e,t,r){return Xi(e,t,r)}N1(Xi,Ks);Ks.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Xi(e,t,r)};Ks.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Xi(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Ks.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xi(e)};Ks.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Uc.SlowBuffer(e)}});var Vs=B(U1=>{"use strict";y();var p0=D1().Buffer,q1=p0.isEncoding||function(e){switch(e=""+e,e&&e.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 LB(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function FB(e){var t=LB(e);if(typeof t!="string"&&(p0.isEncoding===q1||!q1(e)))throw new Error("Unknown encoding: "+e);return t||e}U1.StringDecoder=pf;function pf(e){this.encoding=FB(e);var t;switch(this.encoding){case"utf16le":this.text=zB,this.end=WB,t=4;break;case"utf8":this.fillLast=KB,t=4;break;case"base64":this.text=YB,this.end=ZB,t=3;break;default:this.write=$B,this.end=XB;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=p0.allocUnsafe(t)}pf.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};pf.prototype.end=GB;pf.prototype.text=VB;pf.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function d0(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function jB(e,t,r){var i=t.length-1;if(i<r)return 0;var n=d0(t[i]);return n>=0?(n>0&&(e.lastNeed=n-1),n):--i<r||n===-2?0:(n=d0(t[i]),n>=0?(n>0&&(e.lastNeed=n-2),n):--i<r||n===-2?0:(n=d0(t[i]),n>=0?(n>0&&(n===2?n=0:e.lastNeed=n-3),n):0))}function HB(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function KB(e){var t=this.lastTotal-this.lastNeed,r=HB(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function VB(e,t){var r=jB(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function GB(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function zB(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function WB(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function YB(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function ZB(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function $B(e){return e.toString(this.encoding)}function XB(e){return e&&e.length?this.write(e):""}});var Lc=B((kK,j1)=>{"use strict";y();var L1=Mo().codes.ERR_STREAM_PREMATURE_CLOSE;function JB(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}function QB(){}function eP(e){return e.setHeader&&typeof e.abort=="function"}function F1(e,t,r){if(typeof t=="function")return F1(e,null,t);t||(t={}),r=JB(r||QB);var i=t.readable||t.readable!==!1&&e.readable,n=t.writable||t.writable!==!1&&e.writable,o=function(){e.writable||f()},s=e._writableState&&e._writableState.finished,f=function(){n=!1,s=!0,i||r.call(e)},h=e._readableState&&e._readableState.endEmitted,m=function(){i=!1,h=!0,n||r.call(e)},S=function(M){r.call(e,M)},x=function(){var M;if(i&&!h)return(!e._readableState||!e._readableState.ended)&&(M=new L1),r.call(e,M);if(n&&!s)return(!e._writableState||!e._writableState.ended)&&(M=new L1),r.call(e,M)},I=function(){e.req.on("finish",f)};return eP(e)?(e.on("complete",f),e.on("abort",x),e.req?I():e.on("request",I)):n&&!e._writableState&&(e.on("end",o),e.on("close",o)),e.on("end",m),e.on("finish",f),t.error!==!1&&e.on("error",S),e.on("close",x),function(){e.removeListener("complete",f),e.removeListener("abort",x),e.removeListener("request",I),e.req&&e.req.removeListener("finish",f),e.removeListener("end",o),e.removeListener("close",o),e.removeListener("finish",f),e.removeListener("end",m),e.removeListener("error",S),e.removeListener("close",x)}}j1.exports=F1});var K1=B((CK,H1)=>{"use strict";y();var Fc;function kn(e,t,r){return t=tP(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tP(e){var t=rP(e,"string");return typeof t=="symbol"?t:String(t)}function rP(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iP=Lc(),Nn=Symbol("lastResolve"),No=Symbol("lastReject"),gf=Symbol("error"),jc=Symbol("ended"),Co=Symbol("lastPromise"),g0=Symbol("handlePromise"),Do=Symbol("stream");function Cn(e,t){return{value:e,done:t}}function nP(e){var t=e[Nn];if(t!==null){var r=e[Do].read();r!==null&&(e[Co]=null,e[Nn]=null,e[No]=null,t(Cn(r,!1)))}}function oP(e){O.default.nextTick(nP,e)}function sP(e,t){return function(r,i){e.then(function(){if(t[jc]){r(Cn(void 0,!0));return}t[g0](r,i)},i)}}var aP=Object.getPrototypeOf(function(){}),fP=Object.setPrototypeOf((Fc={get stream(){return this[Do]},next:function(){var t=this,r=this[gf];if(r!==null)return Promise.reject(r);if(this[jc])return Promise.resolve(Cn(void 0,!0));if(this[Do].destroyed)return new Promise(function(s,f){O.default.nextTick(function(){t[gf]?f(t[gf]):s(Cn(void 0,!0))})});var i=this[Co],n;if(i)n=new Promise(sP(i,this));else{var o=this[Do].read();if(o!==null)return Promise.resolve(Cn(o,!1));n=new Promise(this[g0])}return this[Co]=n,n}},kn(Fc,Symbol.asyncIterator,function(){return this}),kn(Fc,"return",function(){var t=this;return new Promise(function(r,i){t[Do].destroy(null,function(n){if(n){i(n);return}r(Cn(void 0,!0))})})}),Fc),aP),uP=function(t){var r,i=Object.create(fP,(r={},kn(r,Do,{value:t,writable:!0}),kn(r,Nn,{value:null,writable:!0}),kn(r,No,{value:null,writable:!0}),kn(r,gf,{value:null,writable:!0}),kn(r,jc,{value:t._readableState.endEmitted,writable:!0}),kn(r,g0,{value:function(o,s){var f=i[Do].read();f?(i[Co]=null,i[Nn]=null,i[No]=null,o(Cn(f,!1))):(i[Nn]=o,i[No]=s)},writable:!0}),r));return i[Co]=null,iP(t,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[No];o!==null&&(i[Co]=null,i[Nn]=null,i[No]=null,o(n)),i[gf]=n;return}var s=i[Nn];s!==null&&(i[Co]=null,i[Nn]=null,i[No]=null,s(Cn(void 0,!0))),i[jc]=!0}),t.on("readable",oP.bind(null,i)),i};H1.exports=uP});var G1=B((qK,V1)=>{y();V1.exports=function(){throw new Error("Readable.from is not available in the browser")}});var h0=B((FK,t_)=>{"use strict";y();t_.exports=rt;var Gs;rt.ReadableState=Z1;var LK=Ps().EventEmitter,Y1=function(t,r){return t.listeners(r).length},yf=wd(),Hc=xt().Buffer,cP=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hP(e){return Hc.from(e)}function lP(e){return Hc.isBuffer(e)||e instanceof cP}var v0=Ai(),Ze;v0&&v0.debuglog?Ze=v0.debuglog("stream"):Ze=function(){};var dP=m1(),E0=r0(),pP=i0(),gP=pP.getHighWaterMark,Kc=Mo().codes,vP=Kc.ERR_INVALID_ARG_TYPE,yP=Kc.ERR_STREAM_PUSH_AFTER_EOF,mP=Kc.ERR_METHOD_NOT_IMPLEMENTED,bP=Kc.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,zs,y0,m0;we()(rt,yf);var vf=E0.errorOrDestroy,b0=["error","close","destroy","pause","resume"];function _P(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function Z1(e,t,r){Gs=Gs||ko(),e=e||{},typeof r!="boolean"&&(r=t instanceof Gs),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=gP(this,e,"readableHighWaterMark",r),this.buffer=new dP,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=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(zs||(zs=Vs().StringDecoder),this.decoder=new zs(e.encoding),this.encoding=e.encoding)}function rt(e){if(Gs=Gs||ko(),!(this instanceof rt))return new rt(e);var t=this instanceof Gs;this._readableState=new Z1(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),yf.call(this)}Object.defineProperty(rt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}});rt.prototype.destroy=E0.destroy;rt.prototype._undestroy=E0.undestroy;rt.prototype._destroy=function(e,t){t(e)};rt.prototype.push=function(e,t){var r=this._readableState,i;return r.objectMode?i=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Hc.from(e,t),t=""),i=!0),$1(this,e,t,!1,i)};rt.prototype.unshift=function(e){return $1(this,e,null,!0,!1)};function $1(e,t,r,i,n){Ze("readableAddChunk",t);var o=e._readableState;if(t===null)o.reading=!1,EP(e,o);else{var s;if(n||(s=wP(o,t)),s)vf(e,s);else if(o.objectMode||t&&t.length>0)if(typeof t!="string"&&!o.objectMode&&Object.getPrototypeOf(t)!==Hc.prototype&&(t=hP(t)),i)o.endEmitted?vf(e,new bP):_0(e,o,t,!0);else if(o.ended)vf(e,new yP);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||t.length!==0?_0(e,o,t,!1):S0(e,o)):_0(e,o,t,!1)}else i||(o.reading=!1,S0(e,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function _0(e,t,r,i){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Vc(e)),S0(e,t)}function wP(e,t){var r;return!lP(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new vP("chunk",["string","Buffer","Uint8Array"],t)),r}rt.prototype.isPaused=function(){return this._readableState.flowing===!1};rt.prototype.setEncoding=function(e){zs||(zs=Vs().StringDecoder);var t=new zs(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var z1=1073741824;function SP(e){return e>=z1?e=z1:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function W1(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=SP(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}rt.prototype.read=function(e){Ze("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return Ze("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?w0(this):Vc(this),null;if(e=W1(e,t),e===0&&t.ended)return t.length===0&&w0(this),null;var i=t.needReadable;Ze("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Ze("length less than watermark",i)),t.ended||t.reading?(i=!1,Ze("reading or ended",i)):i&&(Ze("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=W1(r,t)));var n;return e>0?n=Q1(e,t):n=null,n===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&w0(this)),n!==null&&this.emit("data",n),n};function EP(e,t){if(Ze("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Vc(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,X1(e)))}}function Vc(e){var t=e._readableState;Ze("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Ze("emitReadable",t.flowing),t.emittedReadable=!0,O.default.nextTick(X1,e))}function X1(e){var t=e._readableState;Ze("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,x0(e)}function S0(e,t){t.readingMore||(t.readingMore=!0,O.default.nextTick(xP,e,t))}function xP(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(Ze("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}rt.prototype._read=function(e){vf(this,new mP("_read()"))};rt.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,Ze("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==O.default.stdout&&e!==O.default.stderr,o=n?f:N;i.endEmitted?O.default.nextTick(o):r.once("end",o),e.on("unpipe",s);function s(D,j){Ze("onunpipe"),D===r&&j&&j.hasUnpiped===!1&&(j.hasUnpiped=!0,S())}function f(){Ze("onend"),e.end()}var h=IP(r);e.on("drain",h);var m=!1;function S(){Ze("cleanup"),e.removeListener("close",T),e.removeListener("finish",M),e.removeListener("drain",h),e.removeListener("error",I),e.removeListener("unpipe",s),r.removeListener("end",f),r.removeListener("end",N),r.removeListener("data",x),m=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&h()}r.on("data",x);function x(D){Ze("ondata");var j=e.write(D);Ze("dest.write",j),j===!1&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&e_(i.pipes,e)!==-1)&&!m&&(Ze("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function I(D){Ze("onerror",D),N(),e.removeListener("error",I),Y1(e,"error")===0&&vf(e,D)}_P(e,"error",I);function T(){e.removeListener("finish",M),N()}e.once("close",T);function M(){Ze("onfinish"),e.removeListener("close",T),N()}e.once("finish",M);function N(){Ze("unpipe"),r.unpipe(e)}return e.emit("pipe",r),i.flowing||(Ze("pipe resume"),r.resume()),e};function IP(e){return function(){var r=e._readableState;Ze("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Y1(e,"data")&&(r.flowing=!0,x0(e))}}rt.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=e_(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};rt.prototype.on=function(e,t){var r=yf.prototype.on.call(this,e,t),i=this._readableState;return e==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):e==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,Ze("on readable",i.length,i.reading),i.length?Vc(this):i.reading||O.default.nextTick(AP,this)),r};rt.prototype.addListener=rt.prototype.on;rt.prototype.removeListener=function(e,t){var r=yf.prototype.removeListener.call(this,e,t);return e==="readable"&&O.default.nextTick(J1,this),r};rt.prototype.removeAllListeners=function(e){var t=yf.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&O.default.nextTick(J1,this),t};function J1(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function AP(e){Ze("readable nexttick read 0"),e.read(0)}rt.prototype.resume=function(){var e=this._readableState;return e.flowing||(Ze("resume"),e.flowing=!e.readableListening,OP(this,e)),e.paused=!1,this};function OP(e,t){t.resumeScheduled||(t.resumeScheduled=!0,O.default.nextTick(RP,e,t))}function RP(e,t){Ze("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),x0(e),t.flowing&&!t.reading&&e.read(0)}rt.prototype.pause=function(){return Ze("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ze("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function x0(e){var t=e._readableState;for(Ze("flow",t.flowing);t.flowing&&e.read()!==null;);}rt.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(Ze("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(Ze("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var f=t.push(s);f||(i=!0,e.pause())}});for(var n in e)this[n]===void 0&&typeof e[n]=="function"&&(this[n]=(function(f){return function(){return e[f].apply(e,arguments)}})(n));for(var o=0;o<b0.length;o++)e.on(b0[o],this.emit.bind(this,b0[o]));return this._read=function(s){Ze("wrapped _read",s),i&&(i=!1,e.resume())},this};typeof Symbol=="function"&&(rt.prototype[Symbol.asyncIterator]=function(){return y0===void 0&&(y0=K1()),y0(this)});Object.defineProperty(rt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(rt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(rt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}});rt._fromList=Q1;Object.defineProperty(rt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Q1(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function w0(e){var t=e._readableState;Ze("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,O.default.nextTick(TP,t,e))}function TP(e,t){if(Ze("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}typeof Symbol=="function"&&(rt.from=function(e,t){return m0===void 0&&(m0=G1()),m0(rt,e,t)});function e_(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var I0=B((HK,i_)=>{"use strict";y();i_.exports=Ji;var Gc=Mo().codes,BP=Gc.ERR_METHOD_NOT_IMPLEMENTED,PP=Gc.ERR_MULTIPLE_CALLBACK,MP=Gc.ERR_TRANSFORM_ALREADY_TRANSFORMING,kP=Gc.ERR_TRANSFORM_WITH_LENGTH_0,zc=ko();we()(Ji,zc);function NP(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new PP);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function Ji(e){if(!(this instanceof Ji))return new Ji(e);zc.call(this,e),this._transformState={afterTransform:NP.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",CP)}function CP(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){r_(e,t,r)}):r_(this,null,null)}Ji.prototype.push=function(e,t){return this._transformState.needTransform=!1,zc.prototype.push.call(this,e,t)};Ji.prototype._transform=function(e,t,r){r(new BP("_transform()"))};Ji.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Ji.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Ji.prototype._destroy=function(e,t){zc.prototype._destroy.call(this,e,function(r){t(r)})};function r_(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new kP;if(e._transformState.transforming)throw new MP;return e.push(null)}});var s_=B((VK,o_)=>{"use strict";y();o_.exports=mf;var n_=I0();we()(mf,n_);function mf(e){if(!(this instanceof mf))return new mf(e);n_.call(this,e)}mf.prototype._transform=function(e,t,r){r(null,e)}});var h_=B((zK,c_)=>{"use strict";y();var A0;function DP(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var u_=Mo().codes,qP=u_.ERR_MISSING_ARGS,UP=u_.ERR_STREAM_DESTROYED;function a_(e){if(e)throw e}function LP(e){return e.setHeader&&typeof e.abort=="function"}function FP(e,t,r,i){i=DP(i);var n=!1;e.on("close",function(){n=!0}),A0===void 0&&(A0=Lc()),A0(e,{readable:t,writable:r},function(s){if(s)return i(s);n=!0,i()});var o=!1;return function(s){if(!n&&!o){if(o=!0,LP(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();i(s||new UP("pipe"))}}}function f_(e){e()}function jP(e,t){return e.pipe(t)}function HP(e){return!e.length||typeof e[e.length-1]!="function"?a_:e.pop()}function KP(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=HP(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new qP("streams");var n,o=t.map(function(s,f){var h=f<t.length-1,m=f>0;return FP(s,h,m,function(S){n||(n=S),S&&o.forEach(f_),!h&&(o.forEach(f_),i(n))})});return t.reduce(jP)}c_.exports=KP});var R0=B((YK,l_)=>{y();l_.exports=Mr;var O0=Ps().EventEmitter,VP=we();VP(Mr,O0);Mr.Readable=h0();Mr.Writable=f0();Mr.Duplex=ko();Mr.Transform=I0();Mr.PassThrough=s_();Mr.finished=Lc();Mr.pipeline=h_();Mr.Stream=Mr;function Mr(){O0.call(this)}Mr.prototype.pipe=function(e,t){var r=this;function i(S){e.writable&&e.write(S)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}e.on("drain",n),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",s),r.on("close",f));var o=!1;function s(){o||(o=!0,e.end())}function f(){o||(o=!0,typeof e.destroy=="function"&&e.destroy())}function h(S){if(m(),O0.listenerCount(this,"error")===0)throw S}r.on("error",h),e.on("error",h);function m(){r.removeListener("data",i),e.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",f),r.removeListener("error",h),e.removeListener("error",h),r.removeListener("end",m),r.removeListener("close",m),e.removeListener("close",m)}return r.on("end",m),r.on("close",m),e.on("close",m),e.emit("pipe",r),e}});var g_=B(($K,p_)=>{"use strict";y();var Ri=We().Buffer,d_=R0().Transform,GP=we();function Dn(e){d_.call(this),this._block=Ri.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}GP(Dn,d_);Dn.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(n){i=n}r(i)};Dn.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};var zP=typeof Uint8Array<"u",WP=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Ri.prototype instanceof Uint8Array||Ri.TYPED_ARRAY_SUPPORT);function YP(e,t){if(e instanceof Ri)return e;if(typeof e=="string")return Ri.from(e,t);if(WP&&ArrayBuffer.isView(e)){if(e.byteLength===0)return Ri.alloc(0);var r=Ri.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(zP&&e instanceof Uint8Array||Ri.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Ri.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}Dn.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=YP(e,t);for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var n=this._blockOffset;n<this._blockSize;)r[n++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var o=0,s=e.length*8;s>0;++o)this._length[o]+=s,s=this._length[o]/4294967296|0,s>0&&(this._length[o]-=4294967296*s);return this};Dn.prototype._update=function(){throw new Error("_update is not implemented")};Dn.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};Dn.prototype._digest=function(){throw new Error("_digest is not implemented")};p_.exports=Dn});var Zc=B((JK,y_)=>{"use strict";y();var ZP=we(),v_=g_(),$P=We().Buffer,XP=new Array(16);function Wc(){v_.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}ZP(Wc,v_);Wc.prototype._update=function(){for(var e=XP,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var r=this._a,i=this._b,n=this._c,o=this._d;r=Jt(r,i,n,o,e[0],3614090360,7),o=Jt(o,r,i,n,e[1],3905402710,12),n=Jt(n,o,r,i,e[2],606105819,17),i=Jt(i,n,o,r,e[3],3250441966,22),r=Jt(r,i,n,o,e[4],4118548399,7),o=Jt(o,r,i,n,e[5],1200080426,12),n=Jt(n,o,r,i,e[6],2821735955,17),i=Jt(i,n,o,r,e[7],4249261313,22),r=Jt(r,i,n,o,e[8],1770035416,7),o=Jt(o,r,i,n,e[9],2336552879,12),n=Jt(n,o,r,i,e[10],4294925233,17),i=Jt(i,n,o,r,e[11],2304563134,22),r=Jt(r,i,n,o,e[12],1804603682,7),o=Jt(o,r,i,n,e[13],4254626195,12),n=Jt(n,o,r,i,e[14],2792965006,17),i=Jt(i,n,o,r,e[15],1236535329,22),r=Qt(r,i,n,o,e[1],4129170786,5),o=Qt(o,r,i,n,e[6],3225465664,9),n=Qt(n,o,r,i,e[11],643717713,14),i=Qt(i,n,o,r,e[0],3921069994,20),r=Qt(r,i,n,o,e[5],3593408605,5),o=Qt(o,r,i,n,e[10],38016083,9),n=Qt(n,o,r,i,e[15],3634488961,14),i=Qt(i,n,o,r,e[4],3889429448,20),r=Qt(r,i,n,o,e[9],568446438,5),o=Qt(o,r,i,n,e[14],3275163606,9),n=Qt(n,o,r,i,e[3],4107603335,14),i=Qt(i,n,o,r,e[8],1163531501,20),r=Qt(r,i,n,o,e[13],2850285829,5),o=Qt(o,r,i,n,e[2],4243563512,9),n=Qt(n,o,r,i,e[7],1735328473,14),i=Qt(i,n,o,r,e[12],2368359562,20),r=er(r,i,n,o,e[5],4294588738,4),o=er(o,r,i,n,e[8],2272392833,11),n=er(n,o,r,i,e[11],1839030562,16),i=er(i,n,o,r,e[14],4259657740,23),r=er(r,i,n,o,e[1],2763975236,4),o=er(o,r,i,n,e[4],1272893353,11),n=er(n,o,r,i,e[7],4139469664,16),i=er(i,n,o,r,e[10],3200236656,23),r=er(r,i,n,o,e[13],681279174,4),o=er(o,r,i,n,e[0],3936430074,11),n=er(n,o,r,i,e[3],3572445317,16),i=er(i,n,o,r,e[6],76029189,23),r=er(r,i,n,o,e[9],3654602809,4),o=er(o,r,i,n,e[12],3873151461,11),n=er(n,o,r,i,e[15],530742520,16),i=er(i,n,o,r,e[2],3299628645,23),r=tr(r,i,n,o,e[0],4096336452,6),o=tr(o,r,i,n,e[7],1126891415,10),n=tr(n,o,r,i,e[14],2878612391,15),i=tr(i,n,o,r,e[5],4237533241,21),r=tr(r,i,n,o,e[12],1700485571,6),o=tr(o,r,i,n,e[3],2399980690,10),n=tr(n,o,r,i,e[10],4293915773,15),i=tr(i,n,o,r,e[1],2240044497,21),r=tr(r,i,n,o,e[8],1873313359,6),o=tr(o,r,i,n,e[15],4264355552,10),n=tr(n,o,r,i,e[6],2734768916,15),i=tr(i,n,o,r,e[13],1309151649,21),r=tr(r,i,n,o,e[4],4149444226,6),o=tr(o,r,i,n,e[11],3174756917,10),n=tr(n,o,r,i,e[2],718787259,15),i=tr(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0};Wc.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 e=$P.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function Yc(e,t){return e<<t|e>>>32-t}function Jt(e,t,r,i,n,o,s){return Yc(e+(t&r|~t&i)+n+o|0,s)+t|0}function Qt(e,t,r,i,n,o,s){return Yc(e+(t&i|r&~i)+n+o|0,s)+t|0}function er(e,t,r,i,n,o,s){return Yc(e+(t^r^i)+n+o|0,s)+t|0}function tr(e,t,r,i,n,o,s){return Yc(e+(r^(t|~i))+n+o|0,s)+t|0}y_.exports=Wc});var b_=B((eV,m_)=>{y();var JP={}.toString;m_.exports=Array.isArray||function(e){return JP.call(e)=="[object Array]"}});var w_=B((rV,__)=>{"use strict";y();var QP=Oo(),eM=Bn(),tM=eM("TypedArray.prototype.buffer",!0),rM=zd();__.exports=tM||function(t){if(!rM(t))throw new QP("Not a Typed Array");return t.buffer}});var bf=B((nV,E_)=>{"use strict";y();var Zr=We().Buffer,iM=b_(),nM=w_(),oM=ArrayBuffer.isView||function(t){try{return nM(t),!0}catch{return!1}},sM=typeof Uint8Array<"u",S_=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",aM=S_&&(Zr.prototype instanceof Uint8Array||Zr.TYPED_ARRAY_SUPPORT);E_.exports=function(t,r){if(Zr.isBuffer(t))return t.constructor&&!("isBuffer"in t)?Zr.from(t):t;if(typeof t=="string")return Zr.from(t,r);if(S_&&oM(t)){if(t.byteLength===0)return Zr.alloc(0);if(aM){var i=Zr.from(t.buffer,t.byteOffset,t.byteLength);if(i.byteLength===t.byteLength)return i}var n=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=Zr.from(n);if(o.length===t.byteLength)return o}if(sM&&t instanceof Uint8Array)return Zr.from(t);var s=iM(t);if(s)for(var f=0;f<t.length;f+=1){var h=t[f];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||Zr.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return Zr.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var O_=B((sV,A_)=>{"use strict";y();var fM=We().Buffer,uM=bf(),I_=typeof Uint8Array<"u",cM=I_&&typeof ArrayBuffer<"u",x_=cM&&ArrayBuffer.isView;A_.exports=function(e,t){if(typeof e=="string"||fM.isBuffer(e)||I_&&e instanceof Uint8Array||x_&&x_(e))return uM(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')}});var _f=B((fV,T0)=>{"use strict";y();typeof O.default>"u"||!O.default.version||O.default.version.indexOf("v0.")===0||O.default.version.indexOf("v1.")===0&&O.default.version.indexOf("v1.8.")!==0?T0.exports={nextTick:hM}:T0.exports=O.default;function hM(e,t,r,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return O.default.nextTick(e);case 2:return O.default.nextTick(function(){e.call(null,t)});case 3:return O.default.nextTick(function(){e.call(null,t,r)});case 4:return O.default.nextTick(function(){e.call(null,t,r,i)});default:for(o=new Array(n-1),s=0;s<o.length;)o[s++]=arguments[s];return O.default.nextTick(function(){e.apply(null,o)})}}});var T_=B((cV,R_)=>{y();var lM={}.toString;R_.exports=Array.isArray||function(e){return lM.call(e)=="[object Array]"}});var B0=B((lV,B_)=>{y();B_.exports=Ps().EventEmitter});var Xc=B((P0,M_)=>{y();var $c=xt(),Qi=$c.Buffer;function P_(e,t){for(var r in e)t[r]=e[r]}Qi.from&&Qi.alloc&&Qi.allocUnsafe&&Qi.allocUnsafeSlow?M_.exports=$c:(P_($c,P0),P0.Buffer=Ws);function Ws(e,t,r){return Qi(e,t,r)}P_(Qi,Ws);Ws.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Qi(e,t,r)};Ws.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Qi(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Ws.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Qi(e)};Ws.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return $c.SlowBuffer(e)}});var Ys=B(rr=>{y();function dM(e){return Array.isArray?Array.isArray(e):Jc(e)==="[object Array]"}rr.isArray=dM;function pM(e){return typeof e=="boolean"}rr.isBoolean=pM;function gM(e){return e===null}rr.isNull=gM;function vM(e){return e==null}rr.isNullOrUndefined=vM;function yM(e){return typeof e=="number"}rr.isNumber=yM;function mM(e){return typeof e=="string"}rr.isString=mM;function bM(e){return typeof e=="symbol"}rr.isSymbol=bM;function _M(e){return e===void 0}rr.isUndefined=_M;function wM(e){return Jc(e)==="[object RegExp]"}rr.isRegExp=wM;function SM(e){return typeof e=="object"&&e!==null}rr.isObject=SM;function EM(e){return Jc(e)==="[object Date]"}rr.isDate=EM;function xM(e){return Jc(e)==="[object Error]"||e instanceof Error}rr.isError=xM;function IM(e){return typeof e=="function"}rr.isFunction=IM;function AM(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}rr.isPrimitive=AM;rr.isBuffer=xt().Buffer.isBuffer;function Jc(e){return Object.prototype.toString.call(e)}});var N_=B((yV,M0)=>{"use strict";y();function OM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var k_=Xc().Buffer,wf=Ai();function RM(e,t,r){e.copy(t,r)}M0.exports=(function(){function e(){OM(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=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}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},e.prototype.concat=function(r){if(this.length===0)return k_.alloc(0);for(var i=k_.allocUnsafe(r>>>0),n=this.head,o=0;n;)RM(n.data,i,o),o+=n.data.length,n=n.next;return i},e})();wf&&wf.inspect&&wf.inspect.custom&&(M0.exports.prototype[wf.inspect.custom]=function(){var e=wf.inspect({length:this.length});return this.constructor.name+" "+e})});var k0=B((bV,C_)=>{"use strict";y();var Qc=_f();function TM(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Qc.nextTick(eh,this,e)):Qc.nextTick(eh,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Qc.nextTick(eh,r,o)):Qc.nextTick(eh,r,o):t&&t(o)}),this)}function BM(){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 eh(e,t){e.emit("error",t)}C_.exports={destroy:TM,undestroy:BM}});var C0=B((wV,K_)=>{"use strict";y();var qo=_f();K_.exports=Bt;function q_(e){var t=this;this.next=null,this.entry=null,this.finish=function(){YM(t,e)}}var PM=!O.default.browser&&["v0.10","v0.9."].indexOf(O.default.version.slice(0,5))>-1?setImmediate:qo.nextTick,Zs;Bt.WritableState=Ef;var U_=Object.create(Ys());U_.inherits=we();var MM={deprecate:o0()},L_=B0(),rh=Xc().Buffer,kM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NM(e){return rh.from(e)}function CM(e){return rh.isBuffer(e)||e instanceof kM}var F_=k0();U_.inherits(Bt,L_);function DM(){}function Ef(e,t){Zs=Zs||Uo(),e=e||{};var r=t instanceof Zs;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(f){KM(t,f)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new q_(this)}Ef.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Ef.prototype,"buffer",{get:MM.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var th;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(th=Function.prototype[Symbol.hasInstance],Object.defineProperty(Bt,Symbol.hasInstance,{value:function(e){return th.call(this,e)?!0:this!==Bt?!1:e&&e._writableState instanceof Ef}})):th=function(e){return e instanceof this};function Bt(e){if(Zs=Zs||Uo(),!th.call(Bt,this)&&!(this instanceof Zs))return new Bt(e);this._writableState=new Ef(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),L_.call(this)}Bt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function qM(e,t){var r=new Error("write after end");e.emit("error",r),qo.nextTick(t,r)}function UM(e,t,r,i){var n=!0,o=!1;return r===null?o=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),qo.nextTick(i,o),n=!1),n}Bt.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&CM(e);return o&&!rh.isBuffer(e)&&(e=NM(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=DM),i.ended?qM(this,r):(o||UM(this,i,e,r))&&(i.pendingcb++,n=FM(this,i,o,e,t,r)),n};Bt.prototype.cork=function(){var e=this._writableState;e.corked++};Bt.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&j_(this,e))};Bt.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function LM(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=rh.from(t,r)),t}Object.defineProperty(Bt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function FM(e,t,r,i,n,o){if(!r){var s=LM(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var f=t.objectMode?1:i.length;t.length+=f;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var m=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else N0(e,t,!1,f,i,n,o);return h}function N0(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function jM(e,t,r,i,n){--t.pendingcb,r?(qo.nextTick(n,i),qo.nextTick(Sf,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),Sf(e,t))}function HM(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function KM(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(HM(r),t)jM(e,r,i,t,n);else{var o=H_(r);!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&j_(e,r),i?PM(D_,e,r,o,n):D_(e,r,o,n)}}function D_(e,t,r,i){r||VM(e,t),t.pendingcb--,i(),Sf(e,t)}function VM(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function j_(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)n[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;n.allBuffers=f,N0(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new q_(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,m=r.encoding,S=r.callback,x=t.objectMode?1:h.length;if(N0(e,t,!1,x,h,m,S),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}Bt.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};Bt.prototype._writev=null;Bt.prototype.end=function(e,t,r){var i=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||WM(this,i,r)};function H_(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function GM(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Sf(e,t)})}function zM(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,qo.nextTick(GM,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Sf(e,t){var r=H_(t);return r&&(zM(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function WM(e,t,r){t.ending=!0,Sf(e,t),r&&(t.finished?qo.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function YM(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Bt.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Bt.prototype.destroy=F_.destroy;Bt.prototype._undestroy=F_.undestroy;Bt.prototype._destroy=function(e,t){this.end(),t(e)}});var Uo=B((EV,W_)=>{"use strict";y();var V_=_f(),ZM=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};W_.exports=en;var G_=Object.create(Ys());G_.inherits=we();var z_=U0(),q0=C0();G_.inherits(en,z_);for(D0=ZM(q0.prototype),ih=0;ih<D0.length;ih++)nh=D0[ih],en.prototype[nh]||(en.prototype[nh]=q0.prototype[nh]);var D0,nh,ih;function en(e){if(!(this instanceof en))return new en(e);z_.call(this,e),q0.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",$M)}Object.defineProperty(en.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function $M(){this.allowHalfOpen||this._writableState.ended||V_.nextTick(XM,this)}function XM(e){e.end()}Object.defineProperty(en.prototype,"destroyed",{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)}});en.prototype._destroy=function(e,t){this.push(null),this.end(),V_.nextTick(t,e)}});var U0=B((AV,ow)=>{"use strict";y();var Xs=_f();ow.exports=_t;var JM=T_(),xf;_t.ReadableState=ew;var IV=Ps().EventEmitter,X_=function(e,t){return e.listeners(t).length},K0=B0(),If=Xc().Buffer,QM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function e5(e){return If.from(e)}function t5(e){return If.isBuffer(e)||e instanceof QM}var J_=Object.create(Ys());J_.inherits=we();var L0=Ai(),ot=void 0;L0&&L0.debuglog?ot=L0.debuglog("stream"):ot=function(){};var r5=N_(),Q_=k0(),$s;J_.inherits(_t,K0);var F0=["error","close","destroy","pause","resume"];function i5(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):JM(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function ew(e,t){xf=xf||Uo(),e=e||{};var r=t instanceof xf;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,n=e.readableHighWaterMark,o=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new r5,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&($s||($s=Vs().StringDecoder),this.decoder=new $s(e.encoding),this.encoding=e.encoding)}function _t(e){if(xf=xf||Uo(),!(this instanceof _t))return new _t(e);this._readableState=new ew(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),K0.call(this)}Object.defineProperty(_t.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});_t.prototype.destroy=Q_.destroy;_t.prototype._undestroy=Q_.undestroy;_t.prototype._destroy=function(e,t){this.push(null),t(e)};_t.prototype.push=function(e,t){var r=this._readableState,i;return r.objectMode?i=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=If.from(e,t),t=""),i=!0),tw(this,e,t,!1,i)};_t.prototype.unshift=function(e){return tw(this,e,null,!0,!1)};function tw(e,t,r,i,n){var o=e._readableState;if(t===null)o.reading=!1,a5(e,o);else{var s;n||(s=n5(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?(typeof t!="string"&&!o.objectMode&&Object.getPrototypeOf(t)!==If.prototype&&(t=e5(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):j0(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||t.length!==0?j0(e,o,t,!1):rw(e,o)):j0(e,o,t,!1))):i||(o.reading=!1)}return o5(o)}function j0(e,t,r,i){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&oh(e)),rw(e,t)}function n5(e,t){var r;return!t5(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function o5(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}_t.prototype.isPaused=function(){return this._readableState.flowing===!1};_t.prototype.setEncoding=function(e){return $s||($s=Vs().StringDecoder),this._readableState.decoder=new $s(e),this._readableState.encoding=e,this};var Y_=8388608;function s5(e){return e>=Y_?e=Y_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Z_(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=s5(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}_t.prototype.read=function(e){ot("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return ot("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?H0(this):oh(this),null;if(e=Z_(e,t),e===0&&t.ended)return t.length===0&&H0(this),null;var i=t.needReadable;ot("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,ot("length less than watermark",i)),t.ended||t.reading?(i=!1,ot("reading or ended",i)):i&&(ot("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Z_(r,t)));var n;return e>0?n=iw(e,t):n=null,n===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&H0(this)),n!==null&&this.emit("data",n),n};function a5(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,oh(e)}}function oh(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(ot("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Xs.nextTick($_,e):$_(e))}function $_(e){ot("emit readable"),e.emit("readable"),V0(e)}function rw(e,t){t.readingMore||(t.readingMore=!0,Xs.nextTick(f5,e,t))}function f5(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(ot("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}_t.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};_t.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,ot("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==O.default.stdout&&e!==O.default.stderr,o=n?f:D;i.endEmitted?Xs.nextTick(o):r.once("end",o),e.on("unpipe",s);function s(j,Y){ot("onunpipe"),j===r&&Y&&Y.hasUnpiped===!1&&(Y.hasUnpiped=!0,S())}function f(){ot("onend"),e.end()}var h=u5(r);e.on("drain",h);var m=!1;function S(){ot("cleanup"),e.removeListener("close",M),e.removeListener("finish",N),e.removeListener("drain",h),e.removeListener("error",T),e.removeListener("unpipe",s),r.removeListener("end",f),r.removeListener("end",D),r.removeListener("data",I),m=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&h()}var x=!1;r.on("data",I);function I(j){ot("ondata"),x=!1;var Y=e.write(j);Y===!1&&!x&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&nw(i.pipes,e)!==-1)&&!m&&(ot("false write response, pause",i.awaitDrain),i.awaitDrain++,x=!0),r.pause())}function T(j){ot("onerror",j),D(),e.removeListener("error",T),X_(e,"error")===0&&e.emit("error",j)}i5(e,"error",T);function M(){e.removeListener("finish",N),D()}e.once("close",M);function N(){ot("onfinish"),e.removeListener("close",M),D()}e.once("finish",N);function D(){ot("unpipe"),r.unpipe(e)}return e.emit("pipe",r),i.flowing||(ot("pipe resume"),r.resume()),e};function u5(e){return function(){var t=e._readableState;ot("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&X_(e,"data")&&(t.flowing=!0,V0(e))}}_t.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=nw(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};_t.prototype.on=function(e,t){var r=K0.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var i=this._readableState;!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&oh(this):Xs.nextTick(c5,this))}return r};_t.prototype.addListener=_t.prototype.on;function c5(e){ot("readable nexttick read 0"),e.read(0)}_t.prototype.resume=function(){var e=this._readableState;return e.flowing||(ot("resume"),e.flowing=!0,h5(this,e)),this};function h5(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Xs.nextTick(l5,e,t))}function l5(e,t){t.reading||(ot("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),V0(e),t.flowing&&!t.reading&&e.read(0)}_t.prototype.pause=function(){return ot("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ot("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function V0(e){var t=e._readableState;for(ot("flow",t.flowing);t.flowing&&e.read()!==null;);}_t.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(ot("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(ot("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var f=t.push(s);f||(i=!0,e.pause())}});for(var n in e)this[n]===void 0&&typeof e[n]=="function"&&(this[n]=(function(s){return function(){return e[s].apply(e,arguments)}})(n));for(var o=0;o<F0.length;o++)e.on(F0[o],this.emit.bind(this,F0[o]));return this._read=function(s){ot("wrapped _read",s),i&&(i=!1,e.resume())},this};Object.defineProperty(_t.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_t._fromList=iw;function iw(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=d5(e,t.buffer,t.decoder),r}function d5(e,t,r){var i;return e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?i=t.shift():i=r?p5(e,t):g5(e,t),i}function p5(e,t){var r=t.head,i=1,n=r.data;for(e-=n.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?n+=o:n+=o.slice(0,e),e-=s,e===0){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function g5(e,t){var r=If.allocUnsafe(e),i=t.head,n=1;for(i.data.copy(r),e-=i.data.length;i=i.next;){var o=i.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,e===0){s===o.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=o.slice(s));break}++n}return t.length-=n,r}function H0(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Xs.nextTick(v5,t,e))}function v5(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function nw(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var G0=B((RV,fw)=>{"use strict";y();fw.exports=tn;var sh=Uo(),aw=Object.create(Ys());aw.inherits=we();aw.inherits(tn,sh);function y5(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function tn(e){if(!(this instanceof tn))return new tn(e);sh.call(this,e),this._transformState={afterTransform:y5.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",m5)}function m5(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){sw(e,t,r)}):sw(this,null,null)}tn.prototype.push=function(e,t){return this._transformState.needTransform=!1,sh.prototype.push.call(this,e,t)};tn.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};tn.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};tn.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};tn.prototype._destroy=function(e,t){var r=this;sh.prototype._destroy.call(this,e,function(i){t(i),r.emit("close")})};function sw(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var lw=B((BV,hw)=>{"use strict";y();hw.exports=Af;var uw=G0(),cw=Object.create(Ys());cw.inherits=we();cw.inherits(Af,uw);function Af(e){if(!(this instanceof Af))return new Af(e);uw.call(this,e)}Af.prototype._transform=function(e,t,r){r(null,e)}});var pw=B((Ti,dw)=>{y();Ti=dw.exports=U0();Ti.Stream=Ti;Ti.Readable=Ti;Ti.Writable=C0();Ti.Duplex=Uo();Ti.Transform=G0();Ti.PassThrough=lw()});var yw=B((kV,vw)=>{"use strict";y();var b5=We().Buffer,_5=O_(),gw=pw().Transform,w5=we();function qn(e){gw.call(this),this._block=b5.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}w5(qn,gw);qn.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(n){i=n}r(i)};qn.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};qn.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var r=_5(e,t),i=this._block,n=0;this._blockOffset+r.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o]=r[n],o+=1,n+=1;this._update(),this._blockOffset=0}for(;n<r.length;)i[this._blockOffset]=r[n],this._blockOffset+=1,n+=1;for(var s=0,f=r.length*8;f>0;++s)this._length[s]+=f,f=this._length[s]/4294967296|0,f>0&&(this._length[s]-=4294967296*f);return this};qn.prototype._update=function(){throw new Error("_update is not implemented")};qn.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};qn.prototype._digest=function(){throw new Error("_digest is not implemented")};vw.exports=qn});var fh=B((CV,xw)=>{"use strict";y();var z0=xt().Buffer,S5=we(),Ew=yw(),E5=new Array(16),Of=[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],Rf=[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],Tf=[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],Bf=[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],Pf=[0,1518500249,1859775393,2400959708,2840853838],Mf=[1352829926,1548603684,1836072691,2053994217,0];function Lo(e,t){return e<<t|e>>>32-t}function mw(e,t,r,i,n,o,s,f){return Lo(e+(t^r^i)+o+s|0,f)+n|0}function bw(e,t,r,i,n,o,s,f){return Lo(e+(t&r|~t&i)+o+s|0,f)+n|0}function _w(e,t,r,i,n,o,s,f){return Lo(e+((t|~r)^i)+o+s|0,f)+n|0}function ww(e,t,r,i,n,o,s,f){return Lo(e+(t&i|r&~i)+o+s|0,f)+n|0}function Sw(e,t,r,i,n,o,s,f){return Lo(e+(t^(r|~i))+o+s|0,f)+n|0}function ah(){Ew.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}S5(ah,Ew);ah.prototype._update=function(){for(var e=E5,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=this._a|0,h=this._b|0,m=this._c|0,S=this._d|0,x=this._e|0,I=0;I<80;I+=1){var T,M;I<16?(T=mw(r,i,n,o,s,e[Of[I]],Pf[0],Tf[I]),M=Sw(f,h,m,S,x,e[Rf[I]],Mf[0],Bf[I])):I<32?(T=bw(r,i,n,o,s,e[Of[I]],Pf[1],Tf[I]),M=ww(f,h,m,S,x,e[Rf[I]],Mf[1],Bf[I])):I<48?(T=_w(r,i,n,o,s,e[Of[I]],Pf[2],Tf[I]),M=_w(f,h,m,S,x,e[Rf[I]],Mf[2],Bf[I])):I<64?(T=ww(r,i,n,o,s,e[Of[I]],Pf[3],Tf[I]),M=bw(f,h,m,S,x,e[Rf[I]],Mf[3],Bf[I])):(T=Sw(r,i,n,o,s,e[Of[I]],Pf[4],Tf[I]),M=mw(f,h,m,S,x,e[Rf[I]],Mf[4],Bf[I])),r=s,s=o,o=Lo(n,10),n=i,i=T,f=x,x=S,S=Lo(m,10),m=h,h=M}var N=this._b+n+S|0;this._b=this._c+o+x|0,this._c=this._d+s+f|0,this._d=this._e+r+h|0,this._e=this._a+i+m|0,this._a=N};ah.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,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 e=z0.alloc?z0.alloc(20):new z0(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};xw.exports=ah});var Fo=B((qV,Iw)=>{"use strict";y();var x5=We().Buffer,I5=bf();function uh(e,t){this._block=x5.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}uh.prototype.update=function(e,t){e=I5(e,t||"utf8");for(var r=this._block,i=this._blockSize,n=e.length,o=this._len,s=0;s<n;){for(var f=o%i,h=Math.min(n-s,i-f),m=0;m<h;m++)r[f+m]=e[s+m];o+=h,s+=h,o%i===0&&this._update(r)}return this._len+=n,this};uh.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o};uh.prototype._update=function(){throw new Error("_update must be implemented by subclass")};Iw.exports=uh});var Rw=B((LV,Ow)=>{"use strict";y();var A5=we(),Aw=Fo(),O5=We().Buffer,R5=[1518500249,1859775393,-1894007588,-899497514],T5=new Array(80);function kf(){this.init(),this._w=T5,Aw.call(this,64,56)}A5(kf,Aw);kf.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function B5(e){return e<<5|e>>>27}function P5(e){return e<<30|e>>>2}function M5(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}kf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<80;++f)t[f]=t[f-3]^t[f-8]^t[f-14]^t[f-16];for(var h=0;h<80;++h){var m=~~(h/20),S=B5(r)+M5(m,i,n,o)+s+t[h]+R5[m]|0;s=o,o=n,n=P5(i),i=r,r=S}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};kf.prototype._hash=function(){var e=O5.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};Ow.exports=kf});var Pw=B((jV,Bw)=>{"use strict";y();var k5=we(),Tw=Fo(),N5=We().Buffer,C5=[1518500249,1859775393,-1894007588,-899497514],D5=new Array(80);function Nf(){this.init(),this._w=D5,Tw.call(this,64,56)}k5(Nf,Tw);Nf.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function q5(e){return e<<1|e>>>31}function U5(e){return e<<5|e>>>27}function L5(e){return e<<30|e>>>2}function F5(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Nf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<80;++f)t[f]=q5(t[f-3]^t[f-8]^t[f-14]^t[f-16]);for(var h=0;h<80;++h){var m=~~(h/20),S=U5(r)+F5(m,i,n,o)+s+t[h]+C5[m]|0;s=o,o=n,n=L5(i),i=r,r=S}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};Nf.prototype._hash=function(){var e=N5.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};Bw.exports=Nf});var W0=B((KV,kw)=>{"use strict";y();var j5=we(),Mw=Fo(),H5=We().Buffer,K5=[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],V5=new Array(64);function Cf(){this.init(),this._w=V5,Mw.call(this,64,56)}j5(Cf,Mw);Cf.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 G5(e,t,r){return r^e&(t^r)}function z5(e,t,r){return e&t|r&(e|t)}function W5(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Y5(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Z5(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function $5(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Cf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=this._f|0,h=this._g|0,m=this._h|0,S=0;S<16;++S)t[S]=e.readInt32BE(S*4);for(;S<64;++S)t[S]=$5(t[S-2])+t[S-7]+Z5(t[S-15])+t[S-16]|0;for(var x=0;x<64;++x){var I=m+Y5(s)+G5(s,f,h)+K5[x]+t[x]|0,T=W5(r)+z5(r,i,n)|0;m=h,h=f,f=s,s=o+I|0,o=n,n=i,i=r,r=I+T|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=f+this._f|0,this._g=h+this._g|0,this._h=m+this._h|0};Cf.prototype._hash=function(){var e=H5.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};kw.exports=Cf});var Cw=B((GV,Nw)=>{"use strict";y();var X5=we(),J5=W0(),Q5=Fo(),ek=We().Buffer,tk=new Array(64);function ch(){this.init(),this._w=tk,Q5.call(this,64,56)}X5(ch,J5);ch.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};ch.prototype._hash=function(){var e=ek.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};Nw.exports=ch});var Y0=B((WV,Hw)=>{"use strict";y();var rk=we(),jw=Fo(),ik=We().Buffer,Dw=[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],nk=new Array(160);function Df(){this.init(),this._w=nk,jw.call(this,128,112)}rk(Df,jw);Df.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 qw(e,t,r){return r^e&(t^r)}function Uw(e,t,r){return e&t|r&(e|t)}function Lw(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Fw(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ok(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function sk(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ak(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function fk(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Kt(e,t){return e>>>0<t>>>0?1:0}Df.prototype._update=function(e){for(var t=this._w,r=this._ah|0,i=this._bh|0,n=this._ch|0,o=this._dh|0,s=this._eh|0,f=this._fh|0,h=this._gh|0,m=this._hh|0,S=this._al|0,x=this._bl|0,I=this._cl|0,T=this._dl|0,M=this._el|0,N=this._fl|0,D=this._gl|0,j=this._hl|0,Y=0;Y<32;Y+=2)t[Y]=e.readInt32BE(Y*4),t[Y+1]=e.readInt32BE(Y*4+4);for(;Y<160;Y+=2){var Q=t[Y-30],W=t[Y-30+1],te=ok(Q,W),ne=sk(W,Q);Q=t[Y-4],W=t[Y-4+1];var se=ak(Q,W),ue=fk(W,Q),be=t[Y-14],P=t[Y-14+1],l=t[Y-32],E=t[Y-32+1],d=ne+P|0,a=te+be+Kt(d,ne)|0;d=d+ue|0,a=a+se+Kt(d,ue)|0,d=d+E|0,a=a+l+Kt(d,E)|0,t[Y]=a,t[Y+1]=d}for(var u=0;u<160;u+=2){a=t[u],d=t[u+1];var p=Uw(r,i,n),b=Uw(S,x,I),v=Lw(r,S),c=Lw(S,r),w=Fw(s,M),A=Fw(M,s),g=Dw[u],R=Dw[u+1],U=qw(s,f,h),H=qw(M,N,D),z=j+A|0,re=m+w+Kt(z,j)|0;z=z+H|0,re=re+U+Kt(z,H)|0,z=z+R|0,re=re+g+Kt(z,R)|0,z=z+d|0,re=re+a+Kt(z,d)|0;var oe=c+b|0,k=v+p+Kt(oe,c)|0;m=h,j=D,h=f,D=N,f=s,N=M,M=T+z|0,s=o+re+Kt(M,T)|0,o=n,T=I,n=i,I=x,i=r,x=S,S=z+oe|0,r=re+k+Kt(S,z)|0}this._al=this._al+S|0,this._bl=this._bl+x|0,this._cl=this._cl+I|0,this._dl=this._dl+T|0,this._el=this._el+M|0,this._fl=this._fl+N|0,this._gl=this._gl+D|0,this._hl=this._hl+j|0,this._ah=this._ah+r+Kt(this._al,S)|0,this._bh=this._bh+i+Kt(this._bl,x)|0,this._ch=this._ch+n+Kt(this._cl,I)|0,this._dh=this._dh+o+Kt(this._dl,T)|0,this._eh=this._eh+s+Kt(this._el,M)|0,this._fh=this._fh+f+Kt(this._fl,N)|0,this._gh=this._gh+h+Kt(this._gl,D)|0,this._hh=this._hh+m+Kt(this._hl,j)|0};Df.prototype._hash=function(){var e=ik.allocUnsafe(64);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};Hw.exports=Df});var Vw=B((ZV,Kw)=>{"use strict";y();var uk=we(),ck=Y0(),hk=Fo(),lk=We().Buffer,dk=new Array(160);function hh(){this.init(),this._w=dk,hk.call(this,128,112)}uk(hh,ck);hh.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};hh.prototype._hash=function(){var e=lk.allocUnsafe(48);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};Kw.exports=hh});var lh=B((XV,rn)=>{"use strict";y();rn.exports=function(t){var r=t.toLowerCase(),i=rn.exports[r];if(!i)throw new Error(r+" is not supported (we accept pull requests)");return new i};rn.exports.sha=Rw();rn.exports.sha1=Pw();rn.exports.sha224=Cw();rn.exports.sha256=W0();rn.exports.sha384=Vw();rn.exports.sha512=Y0()});var nn=B((QV,zw)=>{"use strict";y();var pk=We().Buffer,Gw=R0().Transform,gk=Vs().StringDecoder,vk=we(),yk=bf();function $r(e){Gw.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}vk($r,Gw);$r.prototype.update=function(e,t,r){var i=yk(e,t),n=this._update(i);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};$r.prototype.setAutoPadding=function(){};$r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};$r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};$r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};$r.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(n){i=n}finally{r(i)}};$r.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)};$r.prototype._finalOrDigest=function(e){var t=this.__final()||pk.alloc(0);return e&&(t=this._toString(t,e,!0)),t};$r.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new gk(t),this._encoding=t),this._encoding!==t)throw new Error("can\u2019t switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i};zw.exports=$r});var qf=B((tG,Yw)=>{"use strict";y();var mk=we(),bk=Zc(),_k=fh(),wk=lh(),Ww=nn();function dh(e){Ww.call(this,"digest"),this._hash=e}mk(dh,Ww);dh.prototype._update=function(e){this._hash.update(e)};dh.prototype._final=function(){return this._hash.digest()};Yw.exports=function(t){return t=t.toLowerCase(),t==="md5"?new bk:t==="rmd160"||t==="ripemd160"?new _k:new dh(wk(t))}});var Xw=B((iG,$w)=>{"use strict";y();var Sk=we(),jo=We().Buffer,Zw=nn(),Ek=jo.alloc(128),Js=64;function ph(e,t){Zw.call(this,"digest"),typeof t=="string"&&(t=jo.from(t)),this._alg=e,this._key=t,t.length>Js?t=e(t):t.length<Js&&(t=jo.concat([t,Ek],Js));for(var r=this._ipad=jo.allocUnsafe(Js),i=this._opad=jo.allocUnsafe(Js),n=0;n<Js;n++)r[n]=t[n]^54,i[n]=t[n]^92;this._hash=[r]}Sk(ph,Zw);ph.prototype._update=function(e){this._hash.push(e)};ph.prototype._final=function(){var e=this._alg(jo.concat(this._hash));return this._alg(jo.concat([this._opad,e]))};$w.exports=ph});var Z0=B((oG,Jw)=>{y();var xk=Zc();Jw.exports=function(e){return new xk().update(e).digest()}});var tS=B((aG,eS)=>{"use strict";y();var Ik=we(),Ak=Xw(),Qw=nn(),Uf=We().Buffer,Ok=Z0(),$0=fh(),X0=lh(),Rk=Uf.alloc(128);function Lf(e,t){Qw.call(this,"digest"),typeof t=="string"&&(t=Uf.from(t));var r=e==="sha512"||e==="sha384"?128:64;if(this._alg=e,this._key=t,t.length>r){var i=e==="rmd160"?new $0:X0(e);t=i.update(t).digest()}else t.length<r&&(t=Uf.concat([t,Rk],r));for(var n=this._ipad=Uf.allocUnsafe(r),o=this._opad=Uf.allocUnsafe(r),s=0;s<r;s++)n[s]=t[s]^54,o[s]=t[s]^92;this._hash=e==="rmd160"?new $0:X0(e),this._hash.update(n)}Ik(Lf,Qw);Lf.prototype._update=function(e){this._hash.update(e)};Lf.prototype._final=function(){var e=this._hash.digest(),t=this._alg==="rmd160"?new $0:X0(this._alg);return t.update(this._opad).update(e).digest()};eS.exports=function(t,r){return t=t.toLowerCase(),t==="rmd160"||t==="ripemd160"?new Lf("rmd160",r):t==="md5"?new Ak(Ok,r):new Lf(t,r)}});var gh=B((uG,rS)=>{"use strict";y();rS.exports={}});var J0=B((hG,iS)=>{"use strict";y();var Tk=isFinite,Bk=Math.pow(2,30)-1;iS.exports=function(e,t){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0||!Tk(e))throw new TypeError("Bad iterations");if(typeof t!="number")throw new TypeError("Key length not a number");if(t<0||t>Bk||t!==t)throw new TypeError("Bad key length")}});var Q0=B((dG,oS)=>{"use strict";y();var vh;globalThis.process&&globalThis.process.browser?vh="utf-8":globalThis.process&&globalThis.process.version?(nS=parseInt(O.default.version.split(".")[0].slice(1),10),vh=nS>=6?"utf-8":"binary"):vh="utf-8";var nS;oS.exports=vh});var ep=B((gG,fS)=>{"use strict";y();var Pk=We().Buffer,Mk=bf(),aS=typeof Uint8Array<"u",kk=aS&&typeof ArrayBuffer<"u",sS=kk&&ArrayBuffer.isView;fS.exports=function(e,t,r){if(typeof e=="string"||Pk.isBuffer(e)||aS&&e instanceof Uint8Array||sS&&sS(e))return Mk(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}});var tp=B((yG,lS)=>{"use strict";y();var Nk=Z0(),Ck=fh(),Dk=lh(),Ho=We().Buffer,qk=J0(),uS=Q0(),cS=ep(),Uk=Ho.alloc(128),yh={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},Lk={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function Fk(e){return new Ck().update(e).digest()}function jk(e){function t(r){return Dk(e).update(r).digest()}return e==="rmd160"||e==="ripemd160"?Fk:e==="md5"?Nk:t}function hS(e,t,r){var i=jk(e),n=e==="sha512"||e==="sha384"?128:64;t.length>n?t=i(t):t.length<n&&(t=Ho.concat([t,Uk],n));for(var o=Ho.allocUnsafe(n+yh[e]),s=Ho.allocUnsafe(n+yh[e]),f=0;f<n;f++)o[f]=t[f]^54,s[f]=t[f]^92;var h=Ho.allocUnsafe(n+r+4);o.copy(h,0,0,n),this.ipad1=h,this.ipad2=o,this.opad=s,this.alg=e,this.blocksize=n,this.hash=i,this.size=yh[e]}hS.prototype.run=function(e,t){e.copy(t,this.blocksize);var r=this.hash(t);return r.copy(this.opad,this.blocksize),this.hash(this.opad)};function Hk(e,t,r,i,n){qk(r,i),e=cS(e,uS,"Password"),t=cS(t,uS,"Salt");var o=(n||"sha1").toLowerCase(),s=Lk[o]||o,f=yh[s];if(typeof f!="number"||!f)throw new TypeError("Digest algorithm not supported: "+n);var h=new hS(s,e,t.length),m=Ho.allocUnsafe(i),S=Ho.allocUnsafe(t.length+4);t.copy(S,0,0,t.length);for(var x=0,I=f,T=Math.ceil(i/I),M=1;M<=T;M++){S.writeUInt32BE(M,t.length);for(var N=h.run(S,h.ipad1),D=N,j=1;j<r;j++){D=h.run(D,h.ipad2);for(var Y=0;Y<I;Y++)N[Y]^=D[Y]}N.copy(m,x),x+=I}return m}lS.exports=Hk});var bS=B((bG,mS)=>{"use strict";y();var vS=We().Buffer,Kk=J0(),dS=Q0(),pS=tp(),gS=ep(),mh,Ff=globalThis.crypto&&globalThis.crypto.subtle,Vk={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"},rp=[],Ko;function ip(){return Ko||(globalThis.process&&globalThis.process.nextTick?Ko=globalThis.process.nextTick:globalThis.queueMicrotask?Ko=globalThis.queueMicrotask:globalThis.setImmediate?Ko=globalThis.setImmediate:Ko=globalThis.setTimeout,Ko)}function yS(e,t,r,i,n){return Ff.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(o){return Ff.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:n}},o,i<<3)}).then(function(o){return vS.from(o)})}function Gk(e){if(globalThis.process&&!globalThis.process.browser||!Ff||!Ff.importKey||!Ff.deriveBits)return Promise.resolve(!1);if(rp[e]!==void 0)return rp[e];mh=mh||vS.alloc(8);var t=yS(mh,mh,10,128,e).then(function(){return!0},function(){return!1});return rp[e]=t,t}function zk(e,t){e.then(function(r){ip()(function(){t(null,r)})},function(r){ip()(function(){t(r)})})}mS.exports=function(e,t,r,i,n,o){if(typeof n=="function"&&(o=n,n=void 0),Kk(r,i),e=gS(e,dS,"Password"),t=gS(t,dS,"Salt"),typeof o!="function")throw new Error("No callback provided to pbkdf2");n=n||"sha1";var s=Vk[n.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){ip()(function(){var f;try{f=pS(e,t,r,i,n)}catch(h){o(h);return}o(null,f)});return}zk(Gk(s).then(function(f){return f?yS(e,t,r,i,s):pS(e,t,r,i,n)}),o)}});var op=B(np=>{"use strict";y();np.pbkdf2=bS();np.pbkdf2Sync=tp()});var sp=B(kr=>{"use strict";y();kr.readUInt32BE=function(t,r){var i=t[0+r]<<24|t[1+r]<<16|t[2+r]<<8|t[3+r];return i>>>0};kr.writeUInt32BE=function(t,r,i){t[0+i]=r>>>24,t[1+i]=r>>>16&255,t[2+i]=r>>>8&255,t[3+i]=r&255};kr.ip=function(t,r,i,n){for(var o=0,s=0,f=6;f>=0;f-=2){for(var h=0;h<=24;h+=8)o<<=1,o|=r>>>h+f&1;for(var h=0;h<=24;h+=8)o<<=1,o|=t>>>h+f&1}for(var f=6;f>=0;f-=2){for(var h=1;h<=25;h+=8)s<<=1,s|=r>>>h+f&1;for(var h=1;h<=25;h+=8)s<<=1,s|=t>>>h+f&1}i[n+0]=o>>>0,i[n+1]=s>>>0};kr.rip=function(t,r,i,n){for(var o=0,s=0,f=0;f<4;f++)for(var h=24;h>=0;h-=8)o<<=1,o|=r>>>h+f&1,o<<=1,o|=t>>>h+f&1;for(var f=4;f<8;f++)for(var h=24;h>=0;h-=8)s<<=1,s|=r>>>h+f&1,s<<=1,s|=t>>>h+f&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.pc1=function(t,r,i,n){for(var o=0,s=0,f=7;f>=5;f--){for(var h=0;h<=24;h+=8)o<<=1,o|=r>>h+f&1;for(var h=0;h<=24;h+=8)o<<=1,o|=t>>h+f&1}for(var h=0;h<=24;h+=8)o<<=1,o|=r>>h+f&1;for(var f=1;f<=3;f++){for(var h=0;h<=24;h+=8)s<<=1,s|=r>>h+f&1;for(var h=0;h<=24;h+=8)s<<=1,s|=t>>h+f&1}for(var h=0;h<=24;h+=8)s<<=1,s|=t>>h+f&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.r28shl=function(t,r){return t<<r&268435455|t>>>28-r};var bh=[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];kr.pc2=function(t,r,i,n){for(var o=0,s=0,f=bh.length>>>1,h=0;h<f;h++)o<<=1,o|=t>>>bh[h]&1;for(var h=f;h<bh.length;h++)s<<=1,s|=r>>>bh[h]&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.expand=function(t,r,i){var n=0,o=0;n=(t&1)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(var s=11;s>=3;s-=4)o|=t>>>s&63,o<<=6;o|=(t&31)<<1|t>>>31,r[i+0]=n>>>0,r[i+1]=o>>>0};var _S=[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];kr.substitute=function(t,r){for(var i=0,n=0;n<4;n++){var o=t>>>18-n*6&63,s=_S[n*64+o];i<<=4,i|=s}for(var n=0;n<4;n++){var o=r>>>18-n*6&63,s=_S[256+n*64+o];i<<=4,i|=s}return i>>>0};var wS=[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];kr.permute=function(t){for(var r=0,i=0;i<wS.length;i++)r<<=1,r|=t>>>wS[i]&1;return r>>>0};kr.padSplit=function(t,r,i){for(var n=t.toString(2);n.length<r;)n="0"+n;for(var o=[],s=0;s<r;s+=i)o.push(n.slice(s,s+i));return o.join(" ")}});var Xr=B((IG,ES)=>{y();ES.exports=SS;function SS(e,t){if(!e)throw new Error(t||"Assertion failed")}SS.equal=function(t,r,i){if(t!=r)throw new Error(i||"Assertion failed: "+t+" != "+r)}});var _h=B((OG,xS)=>{"use strict";y();var Wk=Xr();function Nr(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}xS.exports=Nr;Nr.prototype._init=function(){};Nr.prototype.update=function(t){return t.length===0?[]:this.type==="decrypt"?this._updateDecrypt(t):this._updateEncrypt(t)};Nr.prototype._buffer=function(t,r){for(var i=Math.min(this.buffer.length-this.bufferOff,t.length-r),n=0;n<i;n++)this.buffer[this.bufferOff+n]=t[r+n];return this.bufferOff+=i,i};Nr.prototype._flushBuffer=function(t,r){return this._update(this.buffer,0,t,r),this.bufferOff=0,this.blockSize};Nr.prototype._updateEncrypt=function(t){var r=0,i=0,n=(this.bufferOff+t.length)/this.blockSize|0,o=new Array(n*this.blockSize);this.bufferOff!==0&&(r+=this._buffer(t,r),this.bufferOff===this.buffer.length&&(i+=this._flushBuffer(o,i)));for(var s=t.length-(t.length-r)%this.blockSize;r<s;r+=this.blockSize)this._update(t,r,o,i),i+=this.blockSize;for(;r<t.length;r++,this.bufferOff++)this.buffer[this.bufferOff]=t[r];return o};Nr.prototype._updateDecrypt=function(t){for(var r=0,i=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,o=new Array(n*this.blockSize);n>0;n--)r+=this._buffer(t,r),i+=this._flushBuffer(o,i);return r+=this._buffer(t,r),o};Nr.prototype.final=function(t){var r;t&&(r=this.update(t));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),r?r.concat(i):i};Nr.prototype._pad=function(t,r){if(r===0)return!1;for(;r<t.length;)t[r++]=0;return!0};Nr.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t};Nr.prototype._unpad=function(t){return t};Nr.prototype._finalDecrypt=function(){Wk.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}});var ap=B((TG,OS)=>{"use strict";y();var IS=Xr(),Yk=we(),qt=sp(),AS=_h();function Zk(){this.tmp=new Array(2),this.keys=null}function Bi(e){AS.call(this,e);var t=new Zk;this._desState=t,this.deriveKeys(t,e.key)}Yk(Bi,AS);OS.exports=Bi;Bi.create=function(t){return new Bi(t)};var $k=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];Bi.prototype.deriveKeys=function(t,r){t.keys=new Array(32),IS.equal(r.length,this.blockSize,"Invalid key length");var i=qt.readUInt32BE(r,0),n=qt.readUInt32BE(r,4);qt.pc1(i,n,t.tmp,0),i=t.tmp[0],n=t.tmp[1];for(var o=0;o<t.keys.length;o+=2){var s=$k[o>>>1];i=qt.r28shl(i,s),n=qt.r28shl(n,s),qt.pc2(i,n,t.keys,o)}};Bi.prototype._update=function(t,r,i,n){var o=this._desState,s=qt.readUInt32BE(t,r),f=qt.readUInt32BE(t,r+4);qt.ip(s,f,o.tmp,0),s=o.tmp[0],f=o.tmp[1],this.type==="encrypt"?this._encrypt(o,s,f,o.tmp,0):this._decrypt(o,s,f,o.tmp,0),s=o.tmp[0],f=o.tmp[1],qt.writeUInt32BE(i,s,n),qt.writeUInt32BE(i,f,n+4)};Bi.prototype._pad=function(t,r){if(this.padding===!1)return!1;for(var i=t.length-r,n=r;n<t.length;n++)t[n]=i;return!0};Bi.prototype._unpad=function(t){if(this.padding===!1)return t;for(var r=t[t.length-1],i=t.length-r;i<t.length;i++)IS.equal(t[i],r);return t.slice(0,t.length-r)};Bi.prototype._encrypt=function(t,r,i,n,o){for(var s=r,f=i,h=0;h<t.keys.length;h+=2){var m=t.keys[h],S=t.keys[h+1];qt.expand(f,t.tmp,0),m^=t.tmp[0],S^=t.tmp[1];var x=qt.substitute(m,S),I=qt.permute(x),T=f;f=(s^I)>>>0,s=T}qt.rip(f,s,n,o)};Bi.prototype._decrypt=function(t,r,i,n,o){for(var s=i,f=r,h=t.keys.length-2;h>=0;h-=2){var m=t.keys[h],S=t.keys[h+1];qt.expand(s,t.tmp,0),m^=t.tmp[0],S^=t.tmp[1];var x=qt.substitute(m,S),I=qt.permute(x),T=s;s=(f^I)>>>0,f=T}qt.rip(s,f,n,o)}});var TS=B(RS=>{"use strict";y();var Xk=Xr(),Jk=we(),wh={};function Qk(e){Xk.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}function eN(e){function t(o){e.call(this,o),this._cbcInit()}Jk(t,e);for(var r=Object.keys(wh),i=0;i<r.length;i++){var n=r[i];t.prototype[n]=wh[n]}return t.create=function(s){return new t(s)},t}RS.instantiate=eN;wh._cbcInit=function(){var t=new Qk(this.options.iv);this._cbcState=t};wh._update=function(t,r,i,n){var o=this._cbcState,s=this.constructor.super_.prototype,f=o.iv;if(this.type==="encrypt"){for(var h=0;h<this.blockSize;h++)f[h]^=t[r+h];s._update.call(this,f,0,i,n);for(var h=0;h<this.blockSize;h++)f[h]=i[n+h]}else{s._update.call(this,t,r,i,n);for(var h=0;h<this.blockSize;h++)i[n+h]^=f[h];for(var h=0;h<this.blockSize;h++)f[h]=t[r+h]}}});var MS=B((kG,PS)=>{"use strict";y();var tN=Xr(),rN=we(),BS=_h(),Un=ap();function iN(e,t){tN.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),i=t.slice(8,16),n=t.slice(16,24);e==="encrypt"?this.ciphers=[Un.create({type:"encrypt",key:r}),Un.create({type:"decrypt",key:i}),Un.create({type:"encrypt",key:n})]:this.ciphers=[Un.create({type:"decrypt",key:n}),Un.create({type:"encrypt",key:i}),Un.create({type:"decrypt",key:r})]}function Vo(e){BS.call(this,e);var t=new iN(this.type,this.options.key);this._edeState=t}rN(Vo,BS);PS.exports=Vo;Vo.create=function(t){return new Vo(t)};Vo.prototype._update=function(t,r,i,n){var o=this._edeState;o.ciphers[0]._update(t,r,i,n),o.ciphers[1]._update(i,n,i,n),o.ciphers[2]._update(i,n,i,n)};Vo.prototype._pad=Un.prototype._pad;Vo.prototype._unpad=Un.prototype._unpad});var kS=B(Qs=>{"use strict";y();Qs.utils=sp();Qs.Cipher=_h();Qs.DES=ap();Qs.CBC=TS();Qs.EDE=MS()});var DS=B((qG,CS)=>{y();var NS=nn(),on=kS(),nN=we(),Go=We().Buffer,jf={"des-ede3-cbc":on.CBC.instantiate(on.EDE),"des-ede3":on.EDE,"des-ede-cbc":on.CBC.instantiate(on.EDE),"des-ede":on.EDE,"des-cbc":on.CBC.instantiate(on.DES),"des-ecb":on.DES};jf.des=jf["des-cbc"];jf.des3=jf["des-ede3-cbc"];CS.exports=Sh;nN(Sh,NS);function Sh(e){NS.call(this);var t=e.mode.toLowerCase(),r=jf[t],i;e.decrypt?i="decrypt":i="encrypt";var n=e.key;Go.isBuffer(n)||(n=Go.from(n)),(t==="des-ede"||t==="des-ede-cbc")&&(n=Go.concat([n,n.slice(0,8)]));var o=e.iv;Go.isBuffer(o)||(o=Go.from(o)),this._des=r.create({key:n,iv:o,type:i})}Sh.prototype._update=function(e){return Go.from(this._des.update(e))};Sh.prototype._final=function(){return Go.from(this._des.final())}});var qS=B(fp=>{y();fp.encrypt=function(e,t){return e._cipher.encryptBlock(t)};fp.decrypt=function(e,t){return e._cipher.decryptBlock(t)}});var ea=B((jG,US)=>{y();US.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new _.Buffer(i),o=0;o<i;++o)n[o]=t[o]^r[o];return n}});var FS=B(up=>{y();var LS=ea();up.encrypt=function(e,t){var r=LS(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev};up.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return LS(i,r)}});var KS=B(HS=>{y();var Hf=We().Buffer,oN=ea();function jS(e,t,r){var i=t.length,n=oN(t,e._cache);return e._cache=e._cache.slice(i),e._prev=Hf.concat([e._prev,r?t:n]),n}HS.encrypt=function(e,t,r){for(var i=Hf.allocUnsafe(0),n;t.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Hf.allocUnsafe(0)),e._cache.length<=t.length)n=e._cache.length,i=Hf.concat([i,jS(e,t.slice(0,n),r)]),t=t.slice(n);else{i=Hf.concat([i,jS(e,t,r)]);break}return i}});var GS=B(VS=>{y();var cp=We().Buffer;function sN(e,t,r){var i=e._cipher.encryptBlock(e._prev),n=i[0]^t;return e._prev=cp.concat([e._prev.slice(1),cp.from([r?t:n])]),n}VS.encrypt=function(e,t,r){for(var i=t.length,n=cp.allocUnsafe(i),o=-1;++o<i;)n[o]=sN(e,t[o],r);return n}});var WS=B(zS=>{y();var Eh=We().Buffer;function aN(e,t,r){for(var i,n=-1,o=8,s=0,f,h;++n<o;)i=e._cipher.encryptBlock(e._prev),f=t&1<<7-n?128:0,h=i[0]^f,s+=(h&128)>>n%8,e._prev=fN(e._prev,r?f:h);return s}function fN(e,t){var r=e.length,i=-1,n=Eh.allocUnsafe(e.length);for(e=Eh.concat([e,Eh.from([t])]);++i<r;)n[i]=e[i]<<1|e[i+1]>>7;return n}zS.encrypt=function(e,t,r){for(var i=t.length,n=Eh.allocUnsafe(i),o=-1;++o<i;)n[o]=aN(e,t[o],r);return n}});var ZS=B(YS=>{y();var uN=ea();function cN(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}YS.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=_.Buffer.concat([e._cache,cN(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),uN(t,r)}});var hp=B((QG,$S)=>{y();function hN(e){for(var t=e.length,r;t--;)if(r=e.readUInt8(t),r===255)e.writeUInt8(0,t);else{r++,e.writeUInt8(r,t);break}}$S.exports=hN});var dp=B(JS=>{y();var lN=ea(),XS=We().Buffer,dN=hp();function pN(e){var t=e._cipher.encryptBlockRaw(e._prev);return dN(e._prev),t}var lp=16;JS.encrypt=function(e,t){var r=Math.ceil(t.length/lp),i=e._cache.length;e._cache=XS.concat([e._cache,XS.allocUnsafe(r*lp)]);for(var n=0;n<r;n++){var o=pN(e),s=i+n*lp;e._cache.writeUInt32BE(o[0],s+0),e._cache.writeUInt32BE(o[1],s+4),e._cache.writeUInt32BE(o[2],s+8),e._cache.writeUInt32BE(o[3],s+12)}var f=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),lN(t,f)}});var pp=B((iz,gN)=>{gN.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 Ih=B((nz,QS)=>{y();var vN={ECB:qS(),CBC:FS(),CFB:KS(),CFB8:GS(),CFB1:WS(),OFB:ZS(),CTR:dp(),GCM:dp()},xh=pp();for(gp in xh)xh[gp].module=vN[xh[gp].mode];var gp;QS.exports=xh});var Kf=B((sz,t2)=>{y();var Ah=We().Buffer;function yp(e){Ah.isBuffer(e)||(e=Ah.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(i*4);return r}function vp(e){for(var t=0;t<e.length;e++)e[t]=0}function e2(e,t,r,i,n){for(var o=r[0],s=r[1],f=r[2],h=r[3],m=e[0]^t[0],S=e[1]^t[1],x=e[2]^t[2],I=e[3]^t[3],T,M,N,D,j=4,Y=1;Y<n;Y++)T=o[m>>>24]^s[S>>>16&255]^f[x>>>8&255]^h[I&255]^t[j++],M=o[S>>>24]^s[x>>>16&255]^f[I>>>8&255]^h[m&255]^t[j++],N=o[x>>>24]^s[I>>>16&255]^f[m>>>8&255]^h[S&255]^t[j++],D=o[I>>>24]^s[m>>>16&255]^f[S>>>8&255]^h[x&255]^t[j++],m=T,S=M,x=N,I=D;return T=(i[m>>>24]<<24|i[S>>>16&255]<<16|i[x>>>8&255]<<8|i[I&255])^t[j++],M=(i[S>>>24]<<24|i[x>>>16&255]<<16|i[I>>>8&255]<<8|i[m&255])^t[j++],N=(i[x>>>24]<<24|i[I>>>16&255]<<16|i[m>>>8&255]<<8|i[S&255])^t[j++],D=(i[I>>>24]<<24|i[m>>>16&255]<<16|i[S>>>8&255]<<8|i[x&255])^t[j++],T=T>>>0,M=M>>>0,N=N>>>0,D=D>>>0,[T,M,N,D]}var yN=[0,1,2,4,8,16,32,64,128,27,54],Pt=(function(){for(var e=new Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],s=0,f=0,h=0;h<256;++h){var m=f^f<<1^f<<2^f<<3^f<<4;m=m>>>8^m&255^99,r[s]=m,i[m]=s;var S=e[s],x=e[S],I=e[x],T=e[m]*257^m*16843008;n[0][s]=T<<24|T>>>8,n[1][s]=T<<16|T>>>16,n[2][s]=T<<8|T>>>24,n[3][s]=T,T=I*16843009^x*65537^S*257^s*16843008,o[0][m]=T<<24|T>>>8,o[1][m]=T<<16|T>>>16,o[2][m]=T<<8|T>>>24,o[3][m]=T,s===0?s=f=1:(s=S^e[e[e[I^S]]],f^=e[e[f]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}})();function Cr(e){this._key=yp(e),this._reset()}Cr.blockSize=16;Cr.keySize=256/8;Cr.prototype.blockSize=Cr.blockSize;Cr.prototype.keySize=Cr.keySize;Cr.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=(r+1)*4,n=[],o=0;o<t;o++)n[o]=e[o];for(o=t;o<i;o++){var s=n[o-1];o%t===0?(s=s<<8|s>>>24,s=Pt.SBOX[s>>>24]<<24|Pt.SBOX[s>>>16&255]<<16|Pt.SBOX[s>>>8&255]<<8|Pt.SBOX[s&255],s^=yN[o/t|0]<<24):t>6&&o%t===4&&(s=Pt.SBOX[s>>>24]<<24|Pt.SBOX[s>>>16&255]<<16|Pt.SBOX[s>>>8&255]<<8|Pt.SBOX[s&255]),n[o]=n[o-t]^s}for(var f=[],h=0;h<i;h++){var m=i-h,S=n[m-(h%4?0:4)];h<4||m<=4?f[h]=S:f[h]=Pt.INV_SUB_MIX[0][Pt.SBOX[S>>>24]]^Pt.INV_SUB_MIX[1][Pt.SBOX[S>>>16&255]]^Pt.INV_SUB_MIX[2][Pt.SBOX[S>>>8&255]]^Pt.INV_SUB_MIX[3][Pt.SBOX[S&255]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=f};Cr.prototype.encryptBlockRaw=function(e){return e=yp(e),e2(e,this._keySchedule,Pt.SUB_MIX,Pt.SBOX,this._nRounds)};Cr.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=Ah.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r};Cr.prototype.decryptBlock=function(e){e=yp(e);var t=e[1];e[1]=e[3],e[3]=t;var r=e2(e,this._invKeySchedule,Pt.INV_SUB_MIX,Pt.INV_SBOX,this._nRounds),i=Ah.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i};Cr.prototype.scrub=function(){vp(this._keySchedule),vp(this._invKeySchedule),vp(this._key)};t2.exports.AES=Cr});var n2=B((fz,i2)=>{y();var ta=We().Buffer,mN=ta.alloc(16,0);function bN(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function r2(e){var t=ta.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function Vf(e){this.h=e,this.state=ta.alloc(16,0),this.cache=ta.allocUnsafe(0)}Vf.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()};Vf.prototype._multiply=function(){for(var e=bN(this.h),t=[0,0,0,0],r,i,n,o=-1;++o<128;){for(i=(this.state[~~(o/8)]&1<<7-o%8)!==0,i&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),n=(e[3]&1)!==0,r=3;r>0;r--)e[r]=e[r]>>>1|(e[r-1]&1)<<31;e[0]=e[0]>>>1,n&&(e[0]=e[0]^225<<24)}this.state=r2(t)};Vf.prototype.update=function(e){this.cache=ta.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)};Vf.prototype.final=function(e,t){return this.cache.length&&this.ghash(ta.concat([this.cache,mN],16)),this.ghash(r2([0,e,0,t])),this.state};i2.exports=Vf});var mp=B((cz,a2)=>{y();var _N=Kf(),hr=We().Buffer,o2=nn(),wN=we(),s2=n2(),SN=ea(),EN=hp();function xN(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}function IN(e,t,r){if(t.length===12)return e._finID=hr.concat([t,hr.from([0,0,0,1])]),hr.concat([t,hr.from([0,0,0,2])]);var i=new s2(r),n=t.length,o=n%16;i.update(t),o&&(o=16-o,i.update(hr.alloc(o,0))),i.update(hr.alloc(8,0));var s=n*8,f=hr.alloc(8);f.writeUIntBE(s,0,8),i.update(f),e._finID=i.state;var h=hr.from(e._finID);return EN(h),h}function zo(e,t,r,i){o2.call(this);var n=hr.alloc(4,0);this._cipher=new _N.AES(t);var o=this._cipher.encryptBlock(n);this._ghash=new s2(o),r=IN(this,r,o),this._prev=hr.from(r),this._cache=hr.allocUnsafe(0),this._secCache=hr.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}wN(zo,o2);zo.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=hr.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r};zo.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=SN(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&xN(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()};zo.prototype.getAuthTag=function(){if(this._decrypt||!hr.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};zo.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t};zo.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};a2.exports=zo});var _p=B((lz,u2)=>{y();var AN=Kf(),bp=We().Buffer,f2=nn(),ON=we();function Oh(e,t,r,i){f2.call(this),this._cipher=new AN.AES(t),this._prev=bp.from(r),this._cache=bp.allocUnsafe(0),this._secCache=bp.allocUnsafe(0),this._decrypt=i,this._mode=e}ON(Oh,f2);Oh.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)};Oh.prototype._final=function(){this._cipher.scrub()};u2.exports=Oh});var Gf=B((pz,c2)=>{y();var Wo=We().Buffer,RN=Zc();function TN(e,t,r,i){if(Wo.isBuffer(e)||(e=Wo.from(e,"binary")),t&&(Wo.isBuffer(t)||(t=Wo.from(t,"binary")),t.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var n=r/8,o=Wo.alloc(n),s=Wo.alloc(i||0),f=Wo.alloc(0);n>0||i>0;){var h=new RN;h.update(f),h.update(e),t&&h.update(t),f=h.digest();var m=0;if(n>0){var S=o.length-n;m=Math.min(n,f.length),f.copy(o,S,0,m),n-=m}if(m<f.length&&i>0){var x=s.length-i,I=Math.min(i,f.length-m);f.copy(s,x,m,m+I),i-=I}}return f.fill(0),{key:o,iv:s}}c2.exports=TN});var p2=B(wp=>{y();var h2=Ih(),BN=mp(),sn=We().Buffer,PN=_p(),l2=nn(),MN=Kf(),kN=Gf(),NN=we();function zf(e,t,r){l2.call(this),this._cache=new Rh,this._cipher=new MN.AES(t),this._prev=sn.from(r),this._mode=e,this._autopadding=!0}NN(zf,l2);zf.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return sn.concat(i)};var CN=sn.alloc(16,16);zf.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(CN))throw this._cipher.scrub(),new Error("data not multiple of block length")};zf.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Rh(){this.cache=sn.allocUnsafe(0)}Rh.prototype.add=function(e){this.cache=sn.concat([this.cache,e])};Rh.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null};Rh.prototype.flush=function(){for(var e=16-this.cache.length,t=sn.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return sn.concat([this.cache,t])};function d2(e,t,r){var i=h2[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if(typeof t=="string"&&(t=sn.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);if(typeof r=="string"&&(r=sn.from(r)),i.mode!=="GCM"&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return i.type==="stream"?new PN(i.module,t,r):i.type==="auth"?new BN(i.module,t,r):new zf(i.module,t,r)}function DN(e,t){var r=h2[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=kN(t,!1,r.key,r.iv);return d2(e,i.key,i.iv)}wp.createCipheriv=d2;wp.createCipher=DN});var m2=B(Sp=>{y();var qN=mp(),ra=We().Buffer,g2=Ih(),UN=_p(),v2=nn(),LN=Kf(),FN=Gf(),jN=we();function Wf(e,t,r){v2.call(this),this._cache=new Th,this._last=void 0,this._cipher=new LN.AES(t),this._prev=ra.from(r),this._mode=e,this._autopadding=!0}jN(Wf,v2);Wf.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return ra.concat(i)};Wf.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return HN(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")};Wf.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Th(){this.cache=ra.allocUnsafe(0)}Th.prototype.add=function(e){this.cache=ra.concat([this.cache,e])};Th.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null};Th.prototype.flush=function(){if(this.cache.length)return this.cache};function HN(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(t!==16)return e.slice(0,16-t)}function y2(e,t,r){var i=g2[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if(typeof r=="string"&&(r=ra.from(r)),i.mode!=="GCM"&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);if(typeof t=="string"&&(t=ra.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);return i.type==="stream"?new UN(i.module,t,r,!0):i.type==="auth"?new qN(i.module,t,r,!0):new Wf(i.module,t,r)}function KN(e,t){var r=g2[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=FN(t,!1,r.key,r.iv);return y2(e,i.key,i.iv)}Sp.createDecipher=KN;Sp.createDecipheriv=y2});var Bh=B(Jr=>{y();var b2=p2(),_2=m2(),VN=pp();function GN(){return Object.keys(VN)}Jr.createCipher=Jr.Cipher=b2.createCipher;Jr.createCipheriv=Jr.Cipheriv=b2.createCipheriv;Jr.createDecipher=Jr.Decipher=_2.createDecipher;Jr.createDecipheriv=Jr.Decipheriv=_2.createDecipheriv;Jr.listCiphers=Jr.getCiphers=GN});var w2=B(an=>{y();an["des-ecb"]={key:8,iv:0};an["des-cbc"]=an.des={key:8,iv:8};an["des-ede3-cbc"]=an.des3={key:24,iv:8};an["des-ede3"]={key:24,iv:0};an["des-ede-cbc"]={key:16,iv:8};an["des-ede"]={key:16,iv:0}});var A2=B(Qr=>{y();var S2=DS(),Ep=Bh(),Ln=Ih(),fn=w2(),E2=Gf();function zN(e,t){e=e.toLowerCase();var r,i;if(Ln[e])r=Ln[e].key,i=Ln[e].iv;else if(fn[e])r=fn[e].key*8,i=fn[e].iv;else throw new TypeError("invalid suite type");var n=E2(t,!1,r,i);return x2(e,n.key,n.iv)}function WN(e,t){e=e.toLowerCase();var r,i;if(Ln[e])r=Ln[e].key,i=Ln[e].iv;else if(fn[e])r=fn[e].key*8,i=fn[e].iv;else throw new TypeError("invalid suite type");var n=E2(t,!1,r,i);return I2(e,n.key,n.iv)}function x2(e,t,r){if(e=e.toLowerCase(),Ln[e])return Ep.createCipheriv(e,t,r);if(fn[e])return new S2({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function I2(e,t,r){if(e=e.toLowerCase(),Ln[e])return Ep.createDecipheriv(e,t,r);if(fn[e])return new S2({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function YN(){return Object.keys(fn).concat(Ep.getCiphers())}Qr.createCipher=Qr.Cipher=zN;Qr.createCipheriv=Qr.Cipheriv=x2;Qr.createDecipher=Qr.Decipher=WN;Qr.createDecipheriv=Qr.Decipheriv=I2;Qr.listCiphers=Qr.getCiphers=YN});var O2=B((Az,Ap)=>{y();var xp;Ap.exports=function(t){return xp||(xp=new Fn(null)),xp.generate(t)};function Fn(e){this.rand=e}Ap.exports.Rand=Fn;Fn.prototype.generate=function(t){return this._rand(t)};Fn.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Fn.prototype._rand=function(t){var r=new Uint8Array(t);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Fn.prototype._rand=function(t){var r=new Uint8Array(t);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Fn.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(Ip=Ph(),typeof Ip.randomBytes!="function")throw new Error("Not supported");Fn.prototype._rand=function(t){return Ip.randomBytes(t)}}catch{}var Ip});var Op=B((Rz,R2)=>{y();var Yo=$i(),ZN=O2();function Zo(e){this.rand=e||new ZN.Rand}R2.exports=Zo;Zo.create=function(t){return new Zo(t)};Zo.prototype._randbelow=function(t){var r=t.bitLength(),i=Math.ceil(r/8);do var n=new Yo(this.rand.generate(i));while(n.cmp(t)>=0);return n};Zo.prototype._randrange=function(t,r){var i=r.sub(t);return t.add(this._randbelow(i))};Zo.prototype.test=function(t,r,i){var n=t.bitLength(),o=Yo.mont(t),s=new Yo(1).toRed(o);r||(r=Math.max(1,n/48|0));for(var f=t.subn(1),h=0;!f.testn(h);h++);for(var m=t.shrn(h),S=f.toRed(o),x=!0;r>0;r--){var I=this._randrange(new Yo(2),f);i&&i(I);var T=I.toRed(o).redPow(m);if(!(T.cmp(s)===0||T.cmp(S)===0)){for(var M=1;M<h;M++){if(T=T.redSqr(),T.cmp(s)===0)return!1;if(T.cmp(S)===0)break}if(M===h)return!1}}return x};Zo.prototype.getDivisor=function(t,r){var i=t.bitLength(),n=Yo.mont(t),o=new Yo(1).toRed(n);r||(r=Math.max(1,i/48|0));for(var s=t.subn(1),f=0;!s.testn(f);f++);for(var h=t.shrn(f),m=s.toRed(n);r>0;r--){var S=this._randrange(new Yo(2),s),x=t.gcd(S);if(x.cmpn(1)!==0)return x;var I=S.toRed(n).redPow(h);if(!(I.cmp(o)===0||I.cmp(m)===0)){for(var T=1;T<f;T++){if(I=I.redSqr(),I.cmp(o)===0)return I.fromRed().subn(1).gcd(t);if(I.cmp(m)===0)break}if(T===f)return I=I.redSqr(),I.fromRed().subn(1).gcd(t)}}return!1}});var kp=B((Nz,P2)=>{y();var $N=Ao();P2.exports=Mp;Mp.simpleSieve=Bp;Mp.fermatTest=Pp;var Yt=$i(),XN=new Yt(24),JN=Op(),T2=new JN,QN=new Yt(1),Tp=new Yt(2),eC=new Yt(5),Bz=new Yt(16),Pz=new Yt(8),tC=new Yt(10),rC=new Yt(3),Mz=new Yt(7),iC=new Yt(11),B2=new Yt(4),kz=new Yt(12),Rp=null;function nC(){if(Rp!==null)return Rp;var e=1048576,t=[];t[0]=2;for(var r=1,i=3;i<e;i+=2){for(var n=Math.ceil(Math.sqrt(i)),o=0;o<r&&t[o]<=n&&i%t[o]!==0;o++);r!==o&&t[o]<=n||(t[r++]=i)}return Rp=t,t}function Bp(e){for(var t=nC(),r=0;r<t.length;r++)if(e.modn(t[r])===0)return e.cmpn(t[r])===0;return!0}function Pp(e){var t=Yt.mont(e);return Tp.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)===0}function Mp(e,t){if(e<16)return t===2||t===5?new Yt([140,123]):new Yt([140,39]);t=new Yt(t);for(var r,i;;){for(r=new Yt($N(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(QN),r.testn(1)||r.iadd(Tp),t.cmp(Tp)){if(!t.cmp(eC))for(;r.mod(tC).cmp(rC);)r.iadd(B2)}else for(;r.mod(XN).cmp(iC);)r.iadd(B2);if(i=r.shrn(1),Bp(i)&&Bp(r)&&Pp(i)&&Pp(r)&&T2.test(i)&&T2.test(r))return r}}});var M2=B((Dz,oC)=>{oC.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 D2=B((qz,C2)=>{y();var Dr=$i(),sC=Op(),k2=new sC,aC=new Dr(24),fC=new Dr(11),uC=new Dr(10),cC=new Dr(3),hC=new Dr(7),N2=kp(),lC=Ao();C2.exports=un;function dC(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this._pub=new Dr(e),this}function pC(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this._priv=new Dr(e),this}var Mh={};function gC(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in Mh)return Mh[i];var n=0;if(e.isEven()||!N2.simpleSieve||!N2.fermatTest(e)||!k2.test(e))return n+=1,r==="02"||r==="05"?n+=8:n+=4,Mh[i]=n,n;k2.test(e.shrn(1))||(n+=2);var o;switch(r){case"02":e.mod(aC).cmp(fC)&&(n+=8);break;case"05":o=e.mod(uC),o.cmp(cC)&&o.cmp(hC)&&(n+=8);break;default:n+=4}return Mh[i]=n,n}function un(e,t,r){this.setGenerator(t),this.__prime=new Dr(e),this._prime=Dr.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=dC,this.setPrivateKey=pC):this._primeCode=8}Object.defineProperty(un.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=gC(this.__prime,this.__gen)),this._primeCode}});un.prototype.generateKeys=function(){return this._priv||(this._priv=new Dr(lC(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()};un.prototype.computeSecret=function(e){e=new Dr(e),e=e.toRed(this._prime);var t=e.redPow(this._priv).fromRed(),r=new _.Buffer(t.toArray()),i=this.getPrime();if(r.length<i.length){var n=new _.Buffer(i.length-r.length);n.fill(0),r=_.Buffer.concat([n,r])}return r};un.prototype.getPublicKey=function(t){return kh(this._pub,t)};un.prototype.getPrivateKey=function(t){return kh(this._priv,t)};un.prototype.getPrime=function(e){return kh(this.__prime,e)};un.prototype.getGenerator=function(e){return kh(this._gen,e)};un.prototype.setGenerator=function(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this.__gen=e,this._gen=new Dr(e),this};function kh(e,t){var r=new _.Buffer(e.toArray());return t?r.toString(t):r}});var L2=B(ia=>{y();var vC=kp(),q2=M2(),Np=D2();function yC(e){var t=new _.Buffer(q2[e].prime,"hex"),r=new _.Buffer(q2[e].gen,"hex");return new Np(t,r)}var mC={binary:!0,hex:!0,base64:!0};function U2(e,t,r,i){return _.Buffer.isBuffer(t)||mC[t]===void 0?U2(e,"binary",t,r):(t=t||"binary",i=i||"binary",r=r||new _.Buffer([2]),_.Buffer.isBuffer(r)||(r=new _.Buffer(r,i)),typeof e=="number"?new Np(vC(e,r),r,!0):(_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),new Np(e,r,!0)))}ia.DiffieHellmanGroup=ia.createDiffieHellmanGroup=ia.getDiffieHellman=yC;ia.createDiffieHellman=ia.DiffieHellman=U2});var F2=B((exports,module)=>{y();var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=(function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch{return function(t,r,i){t[r]=i}}})(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,i=r.eval,n=r.execScript;!i&&n&&(n.call(r,"null"),i=r.eval),forEach(Object_keys(e),function(f){r[f]=e[f]}),forEach(globals,function(f){e[f]&&(r[f]=e[f])});var o=Object_keys(r),s=i.call(r,this.code);return forEach(Object_keys(r),function(f){(f in e||indexOf(o,f)===-1)&&(e[f]=r[f])}),forEach(globals,function(f){f in e||defineProp(e,f,r[f])}),document.body.removeChild(t),s};Script.prototype.runInThisContext=function(){return eval(this.code)};Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),function(i){e[i]=t[i]}),r};forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}});exports.isContext=function(e){return e instanceof Context};exports.createScript=function(e){return exports.Script(e)};exports.createContext=Script.createContext=function(e){var t=new Context;return typeof e=="object"&&forEach(Object_keys(e),function(r){t[r]=e[r]}),t}});var K2=B(H2=>{y();var j2=oa(),bC=we(),_C=H2;_C.define=function(t,r){return new na(t,r)};function na(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}na.prototype._createNamed=function(t){var r;try{r=F2().runInThisContext("(function "+this.name+`(entity) {
11
+ `)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}Je.types=o1();function c1(e){return Array.isArray(e)}Je.isArray=c1;function Jd(e){return typeof e=="boolean"}Je.isBoolean=Jd;function Bc(e){return e===null}Je.isNull=Bc;function q8(e){return e==null}Je.isNullOrUndefined=q8;function h1(e){return typeof e=="number"}Je.isNumber=h1;function Pc(e){return typeof e=="string"}Je.isString=Pc;function L8(e){return typeof e=="symbol"}Je.isSymbol=L8;function Po(e){return e===void 0}Je.isUndefined=Po;function cf(e){return Fs(e)&&Qd(e)==="[object RegExp]"}Je.isRegExp=cf;Je.types.isRegExp=cf;function Fs(e){return typeof e=="object"&&e!==null}Je.isObject=Fs;function Tc(e){return Fs(e)&&Qd(e)==="[object Date]"}Je.isDate=Tc;Je.types.isDate=Tc;function hf(e){return Fs(e)&&(Qd(e)==="[object Error]"||e instanceof Error)}Je.isError=hf;Je.types.isNativeError=hf;function Oc(e){return typeof e=="function"}Je.isFunction=Oc;function U8(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}Je.isPrimitive=U8;Je.isBuffer=a1();function Qd(e){return Object.prototype.toString.call(e)}function $d(e){return e<10?"0"+e.toString(10):e.toString(10)}var F8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function j8(){var e=new Date,t=[$d(e.getHours()),$d(e.getMinutes()),$d(e.getSeconds())].join(":");return[e.getDate(),F8[e.getMonth()],t].join(" ")}Je.log=function(){console.log("%s - %s",j8(),Je.format.apply(Je,arguments))};Je.inherits=we();Je._extend=function(e,t){if(!t||!Fs(t))return e;for(var r=Object.keys(t),i=r.length;i--;)e[r[i]]=t[r[i]];return e};function l1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Bo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Je.promisify=function(t){if(typeof t!="function")throw new TypeError('The "original" argument must be of type Function');if(Bo&&t[Bo]){var r=t[Bo];if(typeof r!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(r,Bo,{value:r,enumerable:!1,writable:!1,configurable:!0}),r}function r(){for(var i,n,o=new Promise(function(h,m){i=h,n=m}),s=[],f=0;f<arguments.length;f++)s.push(arguments[f]);s.push(function(h,m){h?n(h):i(m)});try{t.apply(this,s)}catch(h){n(h)}return o}return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),Bo&&Object.defineProperty(r,Bo,{value:r,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(r,f1(t))};Je.promisify.custom=Bo;function H8(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}function K8(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');function t(){for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);var n=r.pop();if(typeof n!="function")throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return n.apply(o,arguments)};e.apply(this,r).then(function(f){O.default.nextTick(s.bind(null,null,f))},function(f){O.default.nextTick(H8.bind(null,f,s))})}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,f1(e)),t}Je.callbackify=K8});var m1=B((vK,y1)=>{"use strict";y();function d1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function p1(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?d1(Object(r),!0).forEach(function(i){V8(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d1(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function V8(e,t,r){return t=v1(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g1(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,v1(i.key),i)}}function z8(e,t,r){return t&&g1(e.prototype,t),r&&g1(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function v1(e){var t=W8(e,"string");return typeof t=="symbol"?t:String(t)}function W8(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Y8=xt(),Mc=Y8.Buffer,Z8=Ai(),e0=Z8.inspect,$8=e0&&e0.custom||"inspect";function X8(e,t,r){Mc.prototype.copy.call(e,t,r)}y1.exports=(function(){function e(){G8(this,e),this.head=null,this.tail=null,this.length=0}return z8(e,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++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 i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return Mc.alloc(0);for(var i=Mc.allocUnsafe(r>>>0),n=this.head,o=0;n;)X8(n.data,i,o),o+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,o=i.data;for(r-=o.length;i=i.next;){var s=i.data,f=r>s.length?s.length:r;if(f===s.length?o+=s:o+=s.slice(0,r),r-=f,r===0){f===s.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=s.slice(f));break}++n}return this.length-=n,o}},{key:"_getBuffer",value:function(r){var i=Mc.allocUnsafe(r),n=this.head,o=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var s=n.data,f=r>s.length?s.length:r;if(s.copy(i,i.length-r,0,f),r-=f,r===0){f===s.length?(++o,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=s.slice(f));break}++o}return this.length-=o,i}},{key:$8,value:function(r,i){return e0(this,p1(p1({},i),{},{depth:0,customInspect:!1}))}}]),e})()});var r0=B((mK,_1)=>{"use strict";y();function J8(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,O.default.nextTick(t0,this,e)):O.default.nextTick(t0,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted?O.default.nextTick(kc,r):(r._writableState.errorEmitted=!0,O.default.nextTick(b1,r,o)):O.default.nextTick(b1,r,o):t?(O.default.nextTick(kc,r),t(o)):O.default.nextTick(kc,r)}),this)}function b1(e,t){t0(e,t),kc(e)}function kc(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Q8(){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 t0(e,t){e.emit("error",t)}function eB(e,t){var r=e._readableState,i=e._writableState;r&&r.autoDestroy||i&&i.autoDestroy?e.destroy(t):e.emit("error",t)}_1.exports={destroy:J8,undestroy:Q8,errorOrDestroy:eB}});var Mo=B((_K,E1)=>{"use strict";y();function tB(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var S1={};function Pr(e,t,r){r||(r=Error);function i(o,s,f){return typeof t=="string"?t:t(o,s,f)}var n=(function(o){tB(s,o);function s(f,h,m){return o.call(this,i(f,h,m))||this}return s})(r);n.prototype.name=r.name,n.prototype.code=e,S1[e]=n}function w1(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function rB(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function iB(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function nB(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}Pr("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);Pr("ERR_INVALID_ARG_TYPE",function(e,t,r){var i;typeof t=="string"&&rB(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(iB(e," argument"))n="The ".concat(e," ").concat(i," ").concat(w1(t,"type"));else{var o=nB(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(i," ").concat(w1(t,"type"))}return n+=". Received type ".concat(typeof r),n},TypeError);Pr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");Pr("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});Pr("ERR_STREAM_PREMATURE_CLOSE","Premature close");Pr("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});Pr("ERR_MULTIPLE_CALLBACK","Callback called multiple times");Pr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");Pr("ERR_STREAM_WRITE_AFTER_END","write after end");Pr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Pr("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);Pr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");E1.exports.codes=S1});var i0=B((SK,x1)=>{"use strict";y();var oB=Mo().codes.ERR_INVALID_OPT_VALUE;function sB(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function aB(e,t,r,i){var n=sB(t,i,r);if(n!=null){if(!(isFinite(n)&&Math.floor(n)===n)||n<0){var o=i?r:"highWaterMark";throw new oB(o,n)}return Math.floor(n)}return e.objectMode?16:16*1024}x1.exports={getHighWaterMark:aB}});var o0=B((xK,I1)=>{y();I1.exports=fB;function fB(e,t){if(n0("noDeprecation"))return e;var r=!1;function i(){if(!r){if(n0("throwDeprecation"))throw new Error(t);n0("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return i}function n0(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}});var f0=B((AK,P1)=>{"use strict";y();P1.exports=It;function O1(e){var t=this;this.next=null,this.entry=null,this.finish=function(){CB(t,e)}}var js;It.WritableState=df;var uB={deprecate:o0()},R1=wd(),Cc=xt().Buffer,cB=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hB(e){return Cc.from(e)}function lB(e){return Cc.isBuffer(e)||e instanceof cB}var a0=r0(),dB=i0(),pB=dB.getHighWaterMark,Mn=Mo().codes,gB=Mn.ERR_INVALID_ARG_TYPE,vB=Mn.ERR_METHOD_NOT_IMPLEMENTED,yB=Mn.ERR_MULTIPLE_CALLBACK,mB=Mn.ERR_STREAM_CANNOT_PIPE,bB=Mn.ERR_STREAM_DESTROYED,_B=Mn.ERR_STREAM_NULL_VALUES,wB=Mn.ERR_STREAM_WRITE_AFTER_END,SB=Mn.ERR_UNKNOWN_ENCODING,Hs=a0.errorOrDestroy;we()(It,R1);function EB(){}function df(e,t,r){js=js||ko(),e=e||{},typeof r!="boolean"&&(r=t instanceof js),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=pB(this,e,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(n){BB(t,n)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new O1(this)}df.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(df.prototype,"buffer",{get:uB.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var Nc;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Nc=Function.prototype[Symbol.hasInstance],Object.defineProperty(It,Symbol.hasInstance,{value:function(t){return Nc.call(this,t)?!0:this!==It?!1:t&&t._writableState instanceof df}})):Nc=function(t){return t instanceof this};function It(e){js=js||ko();var t=this instanceof js;if(!t&&!Nc.call(It,this))return new It(e);this._writableState=new df(e,this,t),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),R1.call(this)}It.prototype.pipe=function(){Hs(this,new mB)};function xB(e,t){var r=new wB;Hs(e,r),O.default.nextTick(t,r)}function IB(e,t,r,i){var n;return r===null?n=new _B:typeof r!="string"&&!t.objectMode&&(n=new gB("chunk",["string","Buffer"],r)),n?(Hs(e,n),O.default.nextTick(i,n),!1):!0}It.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&lB(e);return o&&!Cc.isBuffer(e)&&(e=hB(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=EB),i.ending?xB(this,r):(o||IB(this,i,e,r))&&(i.pendingcb++,n=OB(this,i,o,e,t,r)),n};It.prototype.cork=function(){this._writableState.corked++};It.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&T1(this,e))};It.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new SB(t);return this._writableState.defaultEncoding=t,this};Object.defineProperty(It.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function AB(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=Cc.from(t,r)),t}Object.defineProperty(It.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function OB(e,t,r,i,n,o){if(!r){var s=AB(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var f=t.objectMode?1:i.length;t.length+=f;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var m=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else s0(e,t,!1,f,i,n,o);return h}function s0(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new bB("write")):r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function RB(e,t,r,i,n){--t.pendingcb,r?(O.default.nextTick(n,i),O.default.nextTick(lf,e,t),e._writableState.errorEmitted=!0,Hs(e,i)):(n(i),e._writableState.errorEmitted=!0,Hs(e,i),lf(e,t))}function TB(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function BB(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(typeof n!="function")throw new yB;if(TB(r),t)RB(e,r,i,t,n);else{var o=B1(r)||e.destroyed;!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&T1(e,r),i?O.default.nextTick(A1,e,r,o,n):A1(e,r,o,n)}}function A1(e,t,r,i){r||PB(e,t),t.pendingcb--,i(),lf(e,t)}function PB(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function T1(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)n[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;n.allBuffers=f,s0(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new O1(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,m=r.encoding,S=r.callback,x=t.objectMode?1:h.length;if(s0(e,t,!1,x,h,m,S),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}It.prototype._write=function(e,t,r){r(new vB("_write()"))};It.prototype._writev=null;It.prototype.end=function(e,t,r){var i=this._writableState;return typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||NB(this,i,r),this};Object.defineProperty(It.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function B1(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function MB(e,t){e._final(function(r){t.pendingcb--,r&&Hs(e,r),t.prefinished=!0,e.emit("prefinish"),lf(e,t)})}function kB(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"&&!t.destroyed?(t.pendingcb++,t.finalCalled=!0,O.default.nextTick(MB,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function lf(e,t){var r=B1(t);if(r&&(kB(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return r}function NB(e,t,r){t.ending=!0,lf(e,t),r&&(t.finished?O.default.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function CB(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(It.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}});It.prototype.destroy=a0.destroy;It.prototype._undestroy=a0.undestroy;It.prototype._destroy=function(e,t){t(e)}});var ko=B((RK,k1)=>{"use strict";y();var DB=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};k1.exports=Oi;var M1=h0(),c0=f0();we()(Oi,M1);for(u0=DB(c0.prototype),Dc=0;Dc<u0.length;Dc++)qc=u0[Dc],Oi.prototype[qc]||(Oi.prototype[qc]=c0.prototype[qc]);var u0,qc,Dc;function Oi(e){if(!(this instanceof Oi))return new Oi(e);M1.call(this,e),c0.call(this,e),this.allowHalfOpen=!0,e&&(e.readable===!1&&(this.readable=!1),e.writable===!1&&(this.writable=!1),e.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",qB)))}Object.defineProperty(Oi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});Object.defineProperty(Oi.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});Object.defineProperty(Oi.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function qB(){this._writableState.ended||O.default.nextTick(LB,this)}function LB(e){e.end()}Object.defineProperty(Oi.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(t){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=t,this._writableState.destroyed=t)}})});var D1=B((l0,C1)=>{y();var Lc=xt(),Xi=Lc.Buffer;function N1(e,t){for(var r in e)t[r]=e[r]}Xi.from&&Xi.alloc&&Xi.allocUnsafe&&Xi.allocUnsafeSlow?C1.exports=Lc:(N1(Lc,l0),l0.Buffer=Ks);function Ks(e,t,r){return Xi(e,t,r)}N1(Xi,Ks);Ks.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Xi(e,t,r)};Ks.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Xi(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Ks.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Xi(e)};Ks.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Lc.SlowBuffer(e)}});var Vs=B(L1=>{"use strict";y();var p0=D1().Buffer,q1=p0.isEncoding||function(e){switch(e=""+e,e&&e.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 UB(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function FB(e){var t=UB(e);if(typeof t!="string"&&(p0.isEncoding===q1||!q1(e)))throw new Error("Unknown encoding: "+e);return t||e}L1.StringDecoder=pf;function pf(e){this.encoding=FB(e);var t;switch(this.encoding){case"utf16le":this.text=zB,this.end=WB,t=4;break;case"utf8":this.fillLast=KB,t=4;break;case"base64":this.text=YB,this.end=ZB,t=3;break;default:this.write=$B,this.end=XB;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=p0.allocUnsafe(t)}pf.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};pf.prototype.end=GB;pf.prototype.text=VB;pf.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function d0(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function jB(e,t,r){var i=t.length-1;if(i<r)return 0;var n=d0(t[i]);return n>=0?(n>0&&(e.lastNeed=n-1),n):--i<r||n===-2?0:(n=d0(t[i]),n>=0?(n>0&&(e.lastNeed=n-2),n):--i<r||n===-2?0:(n=d0(t[i]),n>=0?(n>0&&(n===2?n=0:e.lastNeed=n-3),n):0))}function HB(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function KB(e){var t=this.lastTotal-this.lastNeed,r=HB(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function VB(e,t){var r=jB(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var i=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)}function GB(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function zB(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function WB(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function YB(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function ZB(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function $B(e){return e.toString(this.encoding)}function XB(e){return e&&e.length?this.write(e):""}});var Uc=B((kK,j1)=>{"use strict";y();var U1=Mo().codes.ERR_STREAM_PREMATURE_CLOSE;function JB(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,i=new Array(r),n=0;n<r;n++)i[n]=arguments[n];e.apply(this,i)}}}function QB(){}function eP(e){return e.setHeader&&typeof e.abort=="function"}function F1(e,t,r){if(typeof t=="function")return F1(e,null,t);t||(t={}),r=JB(r||QB);var i=t.readable||t.readable!==!1&&e.readable,n=t.writable||t.writable!==!1&&e.writable,o=function(){e.writable||f()},s=e._writableState&&e._writableState.finished,f=function(){n=!1,s=!0,i||r.call(e)},h=e._readableState&&e._readableState.endEmitted,m=function(){i=!1,h=!0,n||r.call(e)},S=function(M){r.call(e,M)},x=function(){var M;if(i&&!h)return(!e._readableState||!e._readableState.ended)&&(M=new U1),r.call(e,M);if(n&&!s)return(!e._writableState||!e._writableState.ended)&&(M=new U1),r.call(e,M)},I=function(){e.req.on("finish",f)};return eP(e)?(e.on("complete",f),e.on("abort",x),e.req?I():e.on("request",I)):n&&!e._writableState&&(e.on("end",o),e.on("close",o)),e.on("end",m),e.on("finish",f),t.error!==!1&&e.on("error",S),e.on("close",x),function(){e.removeListener("complete",f),e.removeListener("abort",x),e.removeListener("request",I),e.req&&e.req.removeListener("finish",f),e.removeListener("end",o),e.removeListener("close",o),e.removeListener("finish",f),e.removeListener("end",m),e.removeListener("error",S),e.removeListener("close",x)}}j1.exports=F1});var K1=B((CK,H1)=>{"use strict";y();var Fc;function kn(e,t,r){return t=tP(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tP(e){var t=rP(e,"string");return typeof t=="symbol"?t:String(t)}function rP(e,t){if(typeof e!="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var iP=Uc(),Nn=Symbol("lastResolve"),No=Symbol("lastReject"),gf=Symbol("error"),jc=Symbol("ended"),Co=Symbol("lastPromise"),g0=Symbol("handlePromise"),Do=Symbol("stream");function Cn(e,t){return{value:e,done:t}}function nP(e){var t=e[Nn];if(t!==null){var r=e[Do].read();r!==null&&(e[Co]=null,e[Nn]=null,e[No]=null,t(Cn(r,!1)))}}function oP(e){O.default.nextTick(nP,e)}function sP(e,t){return function(r,i){e.then(function(){if(t[jc]){r(Cn(void 0,!0));return}t[g0](r,i)},i)}}var aP=Object.getPrototypeOf(function(){}),fP=Object.setPrototypeOf((Fc={get stream(){return this[Do]},next:function(){var t=this,r=this[gf];if(r!==null)return Promise.reject(r);if(this[jc])return Promise.resolve(Cn(void 0,!0));if(this[Do].destroyed)return new Promise(function(s,f){O.default.nextTick(function(){t[gf]?f(t[gf]):s(Cn(void 0,!0))})});var i=this[Co],n;if(i)n=new Promise(sP(i,this));else{var o=this[Do].read();if(o!==null)return Promise.resolve(Cn(o,!1));n=new Promise(this[g0])}return this[Co]=n,n}},kn(Fc,Symbol.asyncIterator,function(){return this}),kn(Fc,"return",function(){var t=this;return new Promise(function(r,i){t[Do].destroy(null,function(n){if(n){i(n);return}r(Cn(void 0,!0))})})}),Fc),aP),uP=function(t){var r,i=Object.create(fP,(r={},kn(r,Do,{value:t,writable:!0}),kn(r,Nn,{value:null,writable:!0}),kn(r,No,{value:null,writable:!0}),kn(r,gf,{value:null,writable:!0}),kn(r,jc,{value:t._readableState.endEmitted,writable:!0}),kn(r,g0,{value:function(o,s){var f=i[Do].read();f?(i[Co]=null,i[Nn]=null,i[No]=null,o(Cn(f,!1))):(i[Nn]=o,i[No]=s)},writable:!0}),r));return i[Co]=null,iP(t,function(n){if(n&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"){var o=i[No];o!==null&&(i[Co]=null,i[Nn]=null,i[No]=null,o(n)),i[gf]=n;return}var s=i[Nn];s!==null&&(i[Co]=null,i[Nn]=null,i[No]=null,s(Cn(void 0,!0))),i[jc]=!0}),t.on("readable",oP.bind(null,i)),i};H1.exports=uP});var G1=B((qK,V1)=>{y();V1.exports=function(){throw new Error("Readable.from is not available in the browser")}});var h0=B((FK,t_)=>{"use strict";y();t_.exports=rt;var Gs;rt.ReadableState=Z1;var UK=Ps().EventEmitter,Y1=function(t,r){return t.listeners(r).length},yf=wd(),Hc=xt().Buffer,cP=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hP(e){return Hc.from(e)}function lP(e){return Hc.isBuffer(e)||e instanceof cP}var v0=Ai(),Ze;v0&&v0.debuglog?Ze=v0.debuglog("stream"):Ze=function(){};var dP=m1(),E0=r0(),pP=i0(),gP=pP.getHighWaterMark,Kc=Mo().codes,vP=Kc.ERR_INVALID_ARG_TYPE,yP=Kc.ERR_STREAM_PUSH_AFTER_EOF,mP=Kc.ERR_METHOD_NOT_IMPLEMENTED,bP=Kc.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,zs,y0,m0;we()(rt,yf);var vf=E0.errorOrDestroy,b0=["error","close","destroy","pause","resume"];function _P(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function Z1(e,t,r){Gs=Gs||ko(),e=e||{},typeof r!="boolean"&&(r=t instanceof Gs),this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=gP(this,e,"readableHighWaterMark",r),this.buffer=new dP,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=e.emitClose!==!1,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(zs||(zs=Vs().StringDecoder),this.decoder=new zs(e.encoding),this.encoding=e.encoding)}function rt(e){if(Gs=Gs||ko(),!(this instanceof rt))return new rt(e);var t=this instanceof Gs;this._readableState=new Z1(e,this,t),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),yf.call(this)}Object.defineProperty(rt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}});rt.prototype.destroy=E0.destroy;rt.prototype._undestroy=E0.undestroy;rt.prototype._destroy=function(e,t){t(e)};rt.prototype.push=function(e,t){var r=this._readableState,i;return r.objectMode?i=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Hc.from(e,t),t=""),i=!0),$1(this,e,t,!1,i)};rt.prototype.unshift=function(e){return $1(this,e,null,!0,!1)};function $1(e,t,r,i,n){Ze("readableAddChunk",t);var o=e._readableState;if(t===null)o.reading=!1,EP(e,o);else{var s;if(n||(s=wP(o,t)),s)vf(e,s);else if(o.objectMode||t&&t.length>0)if(typeof t!="string"&&!o.objectMode&&Object.getPrototypeOf(t)!==Hc.prototype&&(t=hP(t)),i)o.endEmitted?vf(e,new bP):_0(e,o,t,!0);else if(o.ended)vf(e,new yP);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||t.length!==0?_0(e,o,t,!1):S0(e,o)):_0(e,o,t,!1)}else i||(o.reading=!1,S0(e,o))}return!o.ended&&(o.length<o.highWaterMark||o.length===0)}function _0(e,t,r,i){t.flowing&&t.length===0&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Vc(e)),S0(e,t)}function wP(e,t){var r;return!lP(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new vP("chunk",["string","Buffer","Uint8Array"],t)),r}rt.prototype.isPaused=function(){return this._readableState.flowing===!1};rt.prototype.setEncoding=function(e){zs||(zs=Vs().StringDecoder);var t=new zs(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";r!==null;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),i!==""&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var z1=1073741824;function SP(e){return e>=z1?e=z1:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function W1(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=SP(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}rt.prototype.read=function(e){Ze("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&((t.highWaterMark!==0?t.length>=t.highWaterMark:t.length>0)||t.ended))return Ze("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?w0(this):Vc(this),null;if(e=W1(e,t),e===0&&t.ended)return t.length===0&&w0(this),null;var i=t.needReadable;Ze("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,Ze("length less than watermark",i)),t.ended||t.reading?(i=!1,Ze("reading or ended",i)):i&&(Ze("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=W1(r,t)));var n;return e>0?n=Q1(e,t):n=null,n===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&w0(this)),n!==null&&this.emit("data",n),n};function EP(e,t){if(Ze("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?Vc(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,X1(e)))}}function Vc(e){var t=e._readableState;Ze("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(Ze("emitReadable",t.flowing),t.emittedReadable=!0,O.default.nextTick(X1,e))}function X1(e){var t=e._readableState;Ze("emitReadable_",t.destroyed,t.length,t.ended),!t.destroyed&&(t.length||t.ended)&&(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,x0(e)}function S0(e,t){t.readingMore||(t.readingMore=!0,O.default.nextTick(xP,e,t))}function xP(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){var r=t.length;if(Ze("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}rt.prototype._read=function(e){vf(this,new mP("_read()"))};rt.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,Ze("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==O.default.stdout&&e!==O.default.stderr,o=n?f:N;i.endEmitted?O.default.nextTick(o):r.once("end",o),e.on("unpipe",s);function s(D,j){Ze("onunpipe"),D===r&&j&&j.hasUnpiped===!1&&(j.hasUnpiped=!0,S())}function f(){Ze("onend"),e.end()}var h=IP(r);e.on("drain",h);var m=!1;function S(){Ze("cleanup"),e.removeListener("close",T),e.removeListener("finish",M),e.removeListener("drain",h),e.removeListener("error",I),e.removeListener("unpipe",s),r.removeListener("end",f),r.removeListener("end",N),r.removeListener("data",x),m=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&h()}r.on("data",x);function x(D){Ze("ondata");var j=e.write(D);Ze("dest.write",j),j===!1&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&e_(i.pipes,e)!==-1)&&!m&&(Ze("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function I(D){Ze("onerror",D),N(),e.removeListener("error",I),Y1(e,"error")===0&&vf(e,D)}_P(e,"error",I);function T(){e.removeListener("finish",M),N()}e.once("close",T);function M(){Ze("onfinish"),e.removeListener("close",T),N()}e.once("finish",M);function N(){Ze("unpipe"),r.unpipe(e)}return e.emit("pipe",r),i.flowing||(Ze("pipe resume"),r.resume()),e};function IP(e){return function(){var r=e._readableState;Ze("pipeOnDrain",r.awaitDrain),r.awaitDrain&&r.awaitDrain--,r.awaitDrain===0&&Y1(e,"data")&&(r.flowing=!0,x0(e))}}rt.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=e_(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};rt.prototype.on=function(e,t){var r=yf.prototype.on.call(this,e,t),i=this._readableState;return e==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):e==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,Ze("on readable",i.length,i.reading),i.length?Vc(this):i.reading||O.default.nextTick(AP,this)),r};rt.prototype.addListener=rt.prototype.on;rt.prototype.removeListener=function(e,t){var r=yf.prototype.removeListener.call(this,e,t);return e==="readable"&&O.default.nextTick(J1,this),r};rt.prototype.removeAllListeners=function(e){var t=yf.prototype.removeAllListeners.apply(this,arguments);return(e==="readable"||e===void 0)&&O.default.nextTick(J1,this),t};function J1(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function AP(e){Ze("readable nexttick read 0"),e.read(0)}rt.prototype.resume=function(){var e=this._readableState;return e.flowing||(Ze("resume"),e.flowing=!e.readableListening,OP(this,e)),e.paused=!1,this};function OP(e,t){t.resumeScheduled||(t.resumeScheduled=!0,O.default.nextTick(RP,e,t))}function RP(e,t){Ze("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),x0(e),t.flowing&&!t.reading&&e.read(0)}rt.prototype.pause=function(){return Ze("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Ze("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function x0(e){var t=e._readableState;for(Ze("flow",t.flowing);t.flowing&&e.read()!==null;);}rt.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(Ze("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(Ze("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var f=t.push(s);f||(i=!0,e.pause())}});for(var n in e)this[n]===void 0&&typeof e[n]=="function"&&(this[n]=(function(f){return function(){return e[f].apply(e,arguments)}})(n));for(var o=0;o<b0.length;o++)e.on(b0[o],this.emit.bind(this,b0[o]));return this._read=function(s){Ze("wrapped _read",s),i&&(i=!1,e.resume())},this};typeof Symbol=="function"&&(rt.prototype[Symbol.asyncIterator]=function(){return y0===void 0&&(y0=K1()),y0(this)});Object.defineProperty(rt.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});Object.defineProperty(rt.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}});Object.defineProperty(rt.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}});rt._fromList=Q1;Object.defineProperty(rt.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function Q1(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.first():r=t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function w0(e){var t=e._readableState;Ze("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,O.default.nextTick(TP,t,e))}function TP(e,t){if(Ze("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}typeof Symbol=="function"&&(rt.from=function(e,t){return m0===void 0&&(m0=G1()),m0(rt,e,t)});function e_(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var I0=B((HK,i_)=>{"use strict";y();i_.exports=Ji;var Gc=Mo().codes,BP=Gc.ERR_METHOD_NOT_IMPLEMENTED,PP=Gc.ERR_MULTIPLE_CALLBACK,MP=Gc.ERR_TRANSFORM_ALREADY_TRANSFORMING,kP=Gc.ERR_TRANSFORM_WITH_LENGTH_0,zc=ko();we()(Ji,zc);function NP(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(i===null)return this.emit("error",new PP);r.writechunk=null,r.writecb=null,t!=null&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function Ji(e){if(!(this instanceof Ji))return new Ji(e);zc.call(this,e),this._transformState={afterTransform:NP.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",CP)}function CP(){var e=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(t,r){r_(e,t,r)}):r_(this,null,null)}Ji.prototype.push=function(e,t){return this._transformState.needTransform=!1,zc.prototype.push.call(this,e,t)};Ji.prototype._transform=function(e,t,r){r(new BP("_transform()"))};Ji.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};Ji.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};Ji.prototype._destroy=function(e,t){zc.prototype._destroy.call(this,e,function(r){t(r)})};function r_(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new kP;if(e._transformState.transforming)throw new MP;return e.push(null)}});var s_=B((VK,o_)=>{"use strict";y();o_.exports=mf;var n_=I0();we()(mf,n_);function mf(e){if(!(this instanceof mf))return new mf(e);n_.call(this,e)}mf.prototype._transform=function(e,t,r){r(null,e)}});var h_=B((zK,c_)=>{"use strict";y();var A0;function DP(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var u_=Mo().codes,qP=u_.ERR_MISSING_ARGS,LP=u_.ERR_STREAM_DESTROYED;function a_(e){if(e)throw e}function UP(e){return e.setHeader&&typeof e.abort=="function"}function FP(e,t,r,i){i=DP(i);var n=!1;e.on("close",function(){n=!0}),A0===void 0&&(A0=Uc()),A0(e,{readable:t,writable:r},function(s){if(s)return i(s);n=!0,i()});var o=!1;return function(s){if(!n&&!o){if(o=!0,UP(e))return e.abort();if(typeof e.destroy=="function")return e.destroy();i(s||new LP("pipe"))}}}function f_(e){e()}function jP(e,t){return e.pipe(t)}function HP(e){return!e.length||typeof e[e.length-1]!="function"?a_:e.pop()}function KP(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=HP(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new qP("streams");var n,o=t.map(function(s,f){var h=f<t.length-1,m=f>0;return FP(s,h,m,function(S){n||(n=S),S&&o.forEach(f_),!h&&(o.forEach(f_),i(n))})});return t.reduce(jP)}c_.exports=KP});var R0=B((YK,l_)=>{y();l_.exports=Mr;var O0=Ps().EventEmitter,VP=we();VP(Mr,O0);Mr.Readable=h0();Mr.Writable=f0();Mr.Duplex=ko();Mr.Transform=I0();Mr.PassThrough=s_();Mr.finished=Uc();Mr.pipeline=h_();Mr.Stream=Mr;function Mr(){O0.call(this)}Mr.prototype.pipe=function(e,t){var r=this;function i(S){e.writable&&e.write(S)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}e.on("drain",n),!e._isStdio&&(!t||t.end!==!1)&&(r.on("end",s),r.on("close",f));var o=!1;function s(){o||(o=!0,e.end())}function f(){o||(o=!0,typeof e.destroy=="function"&&e.destroy())}function h(S){if(m(),O0.listenerCount(this,"error")===0)throw S}r.on("error",h),e.on("error",h);function m(){r.removeListener("data",i),e.removeListener("drain",n),r.removeListener("end",s),r.removeListener("close",f),r.removeListener("error",h),e.removeListener("error",h),r.removeListener("end",m),r.removeListener("close",m),e.removeListener("close",m)}return r.on("end",m),r.on("close",m),e.on("close",m),e.emit("pipe",r),e}});var g_=B(($K,p_)=>{"use strict";y();var Ri=We().Buffer,d_=R0().Transform,GP=we();function Dn(e){d_.call(this),this._block=Ri.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}GP(Dn,d_);Dn.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(n){i=n}r(i)};Dn.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};var zP=typeof Uint8Array<"u",WP=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(Ri.prototype instanceof Uint8Array||Ri.TYPED_ARRAY_SUPPORT);function YP(e,t){if(e instanceof Ri)return e;if(typeof e=="string")return Ri.from(e,t);if(WP&&ArrayBuffer.isView(e)){if(e.byteLength===0)return Ri.alloc(0);var r=Ri.from(e.buffer,e.byteOffset,e.byteLength);if(r.byteLength===e.byteLength)return r}if(zP&&e instanceof Uint8Array||Ri.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Ri.from(e);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}Dn.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");e=YP(e,t);for(var r=this._block,i=0;this._blockOffset+e.length-i>=this._blockSize;){for(var n=this._blockOffset;n<this._blockSize;)r[n++]=e[i++];this._update(),this._blockOffset=0}for(;i<e.length;)r[this._blockOffset++]=e[i++];for(var o=0,s=e.length*8;s>0;++o)this._length[o]+=s,s=this._length[o]/4294967296|0,s>0&&(this._length[o]-=4294967296*s);return this};Dn.prototype._update=function(){throw new Error("_update is not implemented")};Dn.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};Dn.prototype._digest=function(){throw new Error("_digest is not implemented")};p_.exports=Dn});var Zc=B((JK,y_)=>{"use strict";y();var ZP=we(),v_=g_(),$P=We().Buffer,XP=new Array(16);function Wc(){v_.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}ZP(Wc,v_);Wc.prototype._update=function(){for(var e=XP,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);var r=this._a,i=this._b,n=this._c,o=this._d;r=Jt(r,i,n,o,e[0],3614090360,7),o=Jt(o,r,i,n,e[1],3905402710,12),n=Jt(n,o,r,i,e[2],606105819,17),i=Jt(i,n,o,r,e[3],3250441966,22),r=Jt(r,i,n,o,e[4],4118548399,7),o=Jt(o,r,i,n,e[5],1200080426,12),n=Jt(n,o,r,i,e[6],2821735955,17),i=Jt(i,n,o,r,e[7],4249261313,22),r=Jt(r,i,n,o,e[8],1770035416,7),o=Jt(o,r,i,n,e[9],2336552879,12),n=Jt(n,o,r,i,e[10],4294925233,17),i=Jt(i,n,o,r,e[11],2304563134,22),r=Jt(r,i,n,o,e[12],1804603682,7),o=Jt(o,r,i,n,e[13],4254626195,12),n=Jt(n,o,r,i,e[14],2792965006,17),i=Jt(i,n,o,r,e[15],1236535329,22),r=Qt(r,i,n,o,e[1],4129170786,5),o=Qt(o,r,i,n,e[6],3225465664,9),n=Qt(n,o,r,i,e[11],643717713,14),i=Qt(i,n,o,r,e[0],3921069994,20),r=Qt(r,i,n,o,e[5],3593408605,5),o=Qt(o,r,i,n,e[10],38016083,9),n=Qt(n,o,r,i,e[15],3634488961,14),i=Qt(i,n,o,r,e[4],3889429448,20),r=Qt(r,i,n,o,e[9],568446438,5),o=Qt(o,r,i,n,e[14],3275163606,9),n=Qt(n,o,r,i,e[3],4107603335,14),i=Qt(i,n,o,r,e[8],1163531501,20),r=Qt(r,i,n,o,e[13],2850285829,5),o=Qt(o,r,i,n,e[2],4243563512,9),n=Qt(n,o,r,i,e[7],1735328473,14),i=Qt(i,n,o,r,e[12],2368359562,20),r=er(r,i,n,o,e[5],4294588738,4),o=er(o,r,i,n,e[8],2272392833,11),n=er(n,o,r,i,e[11],1839030562,16),i=er(i,n,o,r,e[14],4259657740,23),r=er(r,i,n,o,e[1],2763975236,4),o=er(o,r,i,n,e[4],1272893353,11),n=er(n,o,r,i,e[7],4139469664,16),i=er(i,n,o,r,e[10],3200236656,23),r=er(r,i,n,o,e[13],681279174,4),o=er(o,r,i,n,e[0],3936430074,11),n=er(n,o,r,i,e[3],3572445317,16),i=er(i,n,o,r,e[6],76029189,23),r=er(r,i,n,o,e[9],3654602809,4),o=er(o,r,i,n,e[12],3873151461,11),n=er(n,o,r,i,e[15],530742520,16),i=er(i,n,o,r,e[2],3299628645,23),r=tr(r,i,n,o,e[0],4096336452,6),o=tr(o,r,i,n,e[7],1126891415,10),n=tr(n,o,r,i,e[14],2878612391,15),i=tr(i,n,o,r,e[5],4237533241,21),r=tr(r,i,n,o,e[12],1700485571,6),o=tr(o,r,i,n,e[3],2399980690,10),n=tr(n,o,r,i,e[10],4293915773,15),i=tr(i,n,o,r,e[1],2240044497,21),r=tr(r,i,n,o,e[8],1873313359,6),o=tr(o,r,i,n,e[15],4264355552,10),n=tr(n,o,r,i,e[6],2734768916,15),i=tr(i,n,o,r,e[13],1309151649,21),r=tr(r,i,n,o,e[4],4149444226,6),o=tr(o,r,i,n,e[11],3174756917,10),n=tr(n,o,r,i,e[2],718787259,15),i=tr(i,n,o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+i|0,this._c=this._c+n|0,this._d=this._d+o|0};Wc.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 e=$P.allocUnsafe(16);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e};function Yc(e,t){return e<<t|e>>>32-t}function Jt(e,t,r,i,n,o,s){return Yc(e+(t&r|~t&i)+n+o|0,s)+t|0}function Qt(e,t,r,i,n,o,s){return Yc(e+(t&i|r&~i)+n+o|0,s)+t|0}function er(e,t,r,i,n,o,s){return Yc(e+(t^r^i)+n+o|0,s)+t|0}function tr(e,t,r,i,n,o,s){return Yc(e+(r^(t|~i))+n+o|0,s)+t|0}y_.exports=Wc});var b_=B((eV,m_)=>{y();var JP={}.toString;m_.exports=Array.isArray||function(e){return JP.call(e)=="[object Array]"}});var w_=B((rV,__)=>{"use strict";y();var QP=Oo(),eM=Bn(),tM=eM("TypedArray.prototype.buffer",!0),rM=zd();__.exports=tM||function(t){if(!rM(t))throw new QP("Not a Typed Array");return t.buffer}});var bf=B((nV,E_)=>{"use strict";y();var Zr=We().Buffer,iM=b_(),nM=w_(),oM=ArrayBuffer.isView||function(t){try{return nM(t),!0}catch{return!1}},sM=typeof Uint8Array<"u",S_=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",aM=S_&&(Zr.prototype instanceof Uint8Array||Zr.TYPED_ARRAY_SUPPORT);E_.exports=function(t,r){if(Zr.isBuffer(t))return t.constructor&&!("isBuffer"in t)?Zr.from(t):t;if(typeof t=="string")return Zr.from(t,r);if(S_&&oM(t)){if(t.byteLength===0)return Zr.alloc(0);if(aM){var i=Zr.from(t.buffer,t.byteOffset,t.byteLength);if(i.byteLength===t.byteLength)return i}var n=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=Zr.from(n);if(o.length===t.byteLength)return o}if(sM&&t instanceof Uint8Array)return Zr.from(t);var s=iM(t);if(s)for(var f=0;f<t.length;f+=1){var h=t[f];if(typeof h!="number"||h<0||h>255||~~h!==h)throw new RangeError("Array items must be numbers in the range 0-255.")}if(s||Zr.isBuffer(t)&&t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t))return Zr.from(t);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var O_=B((sV,A_)=>{"use strict";y();var fM=We().Buffer,uM=bf(),I_=typeof Uint8Array<"u",cM=I_&&typeof ArrayBuffer<"u",x_=cM&&ArrayBuffer.isView;A_.exports=function(e,t){if(typeof e=="string"||fM.isBuffer(e)||I_&&e instanceof Uint8Array||x_&&x_(e))return uM(e,t);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')}});var _f=B((fV,T0)=>{"use strict";y();typeof O.default>"u"||!O.default.version||O.default.version.indexOf("v0.")===0||O.default.version.indexOf("v1.")===0&&O.default.version.indexOf("v1.8.")!==0?T0.exports={nextTick:hM}:T0.exports=O.default;function hM(e,t,r,i){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var n=arguments.length,o,s;switch(n){case 0:case 1:return O.default.nextTick(e);case 2:return O.default.nextTick(function(){e.call(null,t)});case 3:return O.default.nextTick(function(){e.call(null,t,r)});case 4:return O.default.nextTick(function(){e.call(null,t,r,i)});default:for(o=new Array(n-1),s=0;s<o.length;)o[s++]=arguments[s];return O.default.nextTick(function(){e.apply(null,o)})}}});var T_=B((cV,R_)=>{y();var lM={}.toString;R_.exports=Array.isArray||function(e){return lM.call(e)=="[object Array]"}});var B0=B((lV,B_)=>{y();B_.exports=Ps().EventEmitter});var Xc=B((P0,M_)=>{y();var $c=xt(),Qi=$c.Buffer;function P_(e,t){for(var r in e)t[r]=e[r]}Qi.from&&Qi.alloc&&Qi.allocUnsafe&&Qi.allocUnsafeSlow?M_.exports=$c:(P_($c,P0),P0.Buffer=Ws);function Ws(e,t,r){return Qi(e,t,r)}P_(Qi,Ws);Ws.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Qi(e,t,r)};Ws.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var i=Qi(e);return t!==void 0?typeof r=="string"?i.fill(t,r):i.fill(t):i.fill(0),i};Ws.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Qi(e)};Ws.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return $c.SlowBuffer(e)}});var Ys=B(rr=>{y();function dM(e){return Array.isArray?Array.isArray(e):Jc(e)==="[object Array]"}rr.isArray=dM;function pM(e){return typeof e=="boolean"}rr.isBoolean=pM;function gM(e){return e===null}rr.isNull=gM;function vM(e){return e==null}rr.isNullOrUndefined=vM;function yM(e){return typeof e=="number"}rr.isNumber=yM;function mM(e){return typeof e=="string"}rr.isString=mM;function bM(e){return typeof e=="symbol"}rr.isSymbol=bM;function _M(e){return e===void 0}rr.isUndefined=_M;function wM(e){return Jc(e)==="[object RegExp]"}rr.isRegExp=wM;function SM(e){return typeof e=="object"&&e!==null}rr.isObject=SM;function EM(e){return Jc(e)==="[object Date]"}rr.isDate=EM;function xM(e){return Jc(e)==="[object Error]"||e instanceof Error}rr.isError=xM;function IM(e){return typeof e=="function"}rr.isFunction=IM;function AM(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}rr.isPrimitive=AM;rr.isBuffer=xt().Buffer.isBuffer;function Jc(e){return Object.prototype.toString.call(e)}});var N_=B((yV,M0)=>{"use strict";y();function OM(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var k_=Xc().Buffer,wf=Ai();function RM(e,t,r){e.copy(t,r)}M0.exports=(function(){function e(){OM(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},e.prototype.unshift=function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length},e.prototype.shift=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}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n},e.prototype.concat=function(r){if(this.length===0)return k_.alloc(0);for(var i=k_.allocUnsafe(r>>>0),n=this.head,o=0;n;)RM(n.data,i,o),o+=n.data.length,n=n.next;return i},e})();wf&&wf.inspect&&wf.inspect.custom&&(M0.exports.prototype[wf.inspect.custom]=function(){var e=wf.inspect({length:this.length});return this.constructor.name+" "+e})});var k0=B((bV,C_)=>{"use strict";y();var Qc=_f();function TM(e,t){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,Qc.nextTick(eh,this,e)):Qc.nextTick(eh,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(o){!t&&o?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,Qc.nextTick(eh,r,o)):Qc.nextTick(eh,r,o):t&&t(o)}),this)}function BM(){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 eh(e,t){e.emit("error",t)}C_.exports={destroy:TM,undestroy:BM}});var C0=B((wV,K_)=>{"use strict";y();var qo=_f();K_.exports=Bt;function q_(e){var t=this;this.next=null,this.entry=null,this.finish=function(){YM(t,e)}}var PM=!O.default.browser&&["v0.10","v0.9."].indexOf(O.default.version.slice(0,5))>-1?setImmediate:qo.nextTick,Zs;Bt.WritableState=Ef;var L_=Object.create(Ys());L_.inherits=we();var MM={deprecate:o0()},U_=B0(),rh=Xc().Buffer,kM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function NM(e){return rh.from(e)}function CM(e){return rh.isBuffer(e)||e instanceof kM}var F_=k0();L_.inherits(Bt,U_);function DM(){}function Ef(e,t){Zs=Zs||Lo(),e=e||{};var r=t instanceof Zs;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,n=e.writableHighWaterMark,o=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=e.decodeStrings===!1;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(f){KM(t,f)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new q_(this)}Ef.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(Ef.prototype,"buffer",{get:MM.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var th;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(th=Function.prototype[Symbol.hasInstance],Object.defineProperty(Bt,Symbol.hasInstance,{value:function(e){return th.call(this,e)?!0:this!==Bt?!1:e&&e._writableState instanceof Ef}})):th=function(e){return e instanceof this};function Bt(e){if(Zs=Zs||Lo(),!th.call(Bt,this)&&!(this instanceof Zs))return new Bt(e);this._writableState=new Ef(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),U_.call(this)}Bt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function qM(e,t){var r=new Error("write after end");e.emit("error",r),qo.nextTick(t,r)}function LM(e,t,r,i){var n=!0,o=!1;return r===null?o=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),qo.nextTick(i,o),n=!1),n}Bt.prototype.write=function(e,t,r){var i=this._writableState,n=!1,o=!i.objectMode&&CM(e);return o&&!rh.isBuffer(e)&&(e=NM(e)),typeof t=="function"&&(r=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),typeof r!="function"&&(r=DM),i.ended?qM(this,r):(o||LM(this,i,e,r))&&(i.pendingcb++,n=FM(this,i,o,e,t,r)),n};Bt.prototype.cork=function(){var e=this._writableState;e.corked++};Bt.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&j_(this,e))};Bt.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function UM(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=rh.from(t,r)),t}Object.defineProperty(Bt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function FM(e,t,r,i,n,o){if(!r){var s=UM(t,i,n);i!==s&&(r=!0,n="buffer",i=s)}var f=t.objectMode?1:i.length;t.length+=f;var h=t.length<t.highWaterMark;if(h||(t.needDrain=!0),t.writing||t.corked){var m=t.lastBufferedRequest;t.lastBufferedRequest={chunk:i,encoding:n,isBuf:r,callback:o,next:null},m?m.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else N0(e,t,!1,f,i,n,o);return h}function N0(e,t,r,i,n,o,s){t.writelen=i,t.writecb=s,t.writing=!0,t.sync=!0,r?e._writev(n,t.onwrite):e._write(n,o,t.onwrite),t.sync=!1}function jM(e,t,r,i,n){--t.pendingcb,r?(qo.nextTick(n,i),qo.nextTick(Sf,e,t),e._writableState.errorEmitted=!0,e.emit("error",i)):(n(i),e._writableState.errorEmitted=!0,e.emit("error",i),Sf(e,t))}function HM(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function KM(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(HM(r),t)jM(e,r,i,t,n);else{var o=H_(r);!o&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&j_(e,r),i?PM(D_,e,r,o,n):D_(e,r,o,n)}}function D_(e,t,r,i){r||VM(e,t),t.pendingcb--,i(),Sf(e,t)}function VM(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function j_(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var i=t.bufferedRequestCount,n=new Array(i),o=t.corkedRequestsFree;o.entry=r;for(var s=0,f=!0;r;)n[s]=r,r.isBuf||(f=!1),r=r.next,s+=1;n.allBuffers=f,N0(e,t,!0,t.length,n,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new q_(t),t.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,m=r.encoding,S=r.callback,x=t.objectMode?1:h.length;if(N0(e,t,!1,x,h,m,S),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}Bt.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};Bt.prototype._writev=null;Bt.prototype.end=function(e,t,r){var i=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||WM(this,i,r)};function H_(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function GM(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Sf(e,t)})}function zM(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,qo.nextTick(GM,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Sf(e,t){var r=H_(t);return r&&(zM(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function WM(e,t,r){t.ending=!0,Sf(e,t),r&&(t.finished?qo.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function YM(e,t,r){var i=e.entry;for(e.entry=null;i;){var n=i.callback;t.pendingcb--,n(r),i=i.next}t.corkedRequestsFree.next=e}Object.defineProperty(Bt.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});Bt.prototype.destroy=F_.destroy;Bt.prototype._undestroy=F_.undestroy;Bt.prototype._destroy=function(e,t){this.end(),t(e)}});var Lo=B((EV,W_)=>{"use strict";y();var V_=_f(),ZM=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};W_.exports=en;var G_=Object.create(Ys());G_.inherits=we();var z_=L0(),q0=C0();G_.inherits(en,z_);for(D0=ZM(q0.prototype),ih=0;ih<D0.length;ih++)nh=D0[ih],en.prototype[nh]||(en.prototype[nh]=q0.prototype[nh]);var D0,nh,ih;function en(e){if(!(this instanceof en))return new en(e);z_.call(this,e),q0.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",$M)}Object.defineProperty(en.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function $M(){this.allowHalfOpen||this._writableState.ended||V_.nextTick(XM,this)}function XM(e){e.end()}Object.defineProperty(en.prototype,"destroyed",{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)}});en.prototype._destroy=function(e,t){this.push(null),this.end(),V_.nextTick(t,e)}});var L0=B((AV,ow)=>{"use strict";y();var Xs=_f();ow.exports=_t;var JM=T_(),xf;_t.ReadableState=ew;var IV=Ps().EventEmitter,X_=function(e,t){return e.listeners(t).length},K0=B0(),If=Xc().Buffer,QM=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function e5(e){return If.from(e)}function t5(e){return If.isBuffer(e)||e instanceof QM}var J_=Object.create(Ys());J_.inherits=we();var U0=Ai(),ot=void 0;U0&&U0.debuglog?ot=U0.debuglog("stream"):ot=function(){};var r5=N_(),Q_=k0(),$s;J_.inherits(_t,K0);var F0=["error","close","destroy","pause","resume"];function i5(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):JM(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function ew(e,t){xf=xf||Lo(),e=e||{};var r=t instanceof xf;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,n=e.readableHighWaterMark,o=this.objectMode?16:16*1024;i||i===0?this.highWaterMark=i:r&&(n||n===0)?this.highWaterMark=n:this.highWaterMark=o,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new r5,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&($s||($s=Vs().StringDecoder),this.decoder=new $s(e.encoding),this.encoding=e.encoding)}function _t(e){if(xf=xf||Lo(),!(this instanceof _t))return new _t(e);this._readableState=new ew(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),K0.call(this)}Object.defineProperty(_t.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});_t.prototype.destroy=Q_.destroy;_t.prototype._undestroy=Q_.undestroy;_t.prototype._destroy=function(e,t){this.push(null),t(e)};_t.prototype.push=function(e,t){var r=this._readableState,i;return r.objectMode?i=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=If.from(e,t),t=""),i=!0),tw(this,e,t,!1,i)};_t.prototype.unshift=function(e){return tw(this,e,null,!0,!1)};function tw(e,t,r,i,n){var o=e._readableState;if(t===null)o.reading=!1,a5(e,o);else{var s;n||(s=n5(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?(typeof t!="string"&&!o.objectMode&&Object.getPrototypeOf(t)!==If.prototype&&(t=e5(t)),i?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):j0(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||t.length!==0?j0(e,o,t,!1):rw(e,o)):j0(e,o,t,!1))):i||(o.reading=!1)}return o5(o)}function j0(e,t,r,i){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&oh(e)),rw(e,t)}function n5(e,t){var r;return!t5(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function o5(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}_t.prototype.isPaused=function(){return this._readableState.flowing===!1};_t.prototype.setEncoding=function(e){return $s||($s=Vs().StringDecoder),this._readableState.decoder=new $s(e),this._readableState.encoding=e,this};var Y_=8388608;function s5(e){return e>=Y_?e=Y_:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Z_(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=s5(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}_t.prototype.read=function(e){ot("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return ot("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?H0(this):oh(this),null;if(e=Z_(e,t),e===0&&t.ended)return t.length===0&&H0(this),null;var i=t.needReadable;ot("need readable",i),(t.length===0||t.length-e<t.highWaterMark)&&(i=!0,ot("length less than watermark",i)),t.ended||t.reading?(i=!1,ot("reading or ended",i)):i&&(ot("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=Z_(r,t)));var n;return e>0?n=iw(e,t):n=null,n===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&H0(this)),n!==null&&this.emit("data",n),n};function a5(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,oh(e)}}function oh(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(ot("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?Xs.nextTick($_,e):$_(e))}function $_(e){ot("emit readable"),e.emit("readable"),V0(e)}function rw(e,t){t.readingMore||(t.readingMore=!0,Xs.nextTick(f5,e,t))}function f5(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(ot("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}_t.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};_t.prototype.pipe=function(e,t){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e);break}i.pipesCount+=1,ot("pipe count=%d opts=%j",i.pipesCount,t);var n=(!t||t.end!==!1)&&e!==O.default.stdout&&e!==O.default.stderr,o=n?f:D;i.endEmitted?Xs.nextTick(o):r.once("end",o),e.on("unpipe",s);function s(j,Y){ot("onunpipe"),j===r&&Y&&Y.hasUnpiped===!1&&(Y.hasUnpiped=!0,S())}function f(){ot("onend"),e.end()}var h=u5(r);e.on("drain",h);var m=!1;function S(){ot("cleanup"),e.removeListener("close",M),e.removeListener("finish",N),e.removeListener("drain",h),e.removeListener("error",T),e.removeListener("unpipe",s),r.removeListener("end",f),r.removeListener("end",D),r.removeListener("data",I),m=!0,i.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&h()}var x=!1;r.on("data",I);function I(j){ot("ondata"),x=!1;var Y=e.write(j);Y===!1&&!x&&((i.pipesCount===1&&i.pipes===e||i.pipesCount>1&&nw(i.pipes,e)!==-1)&&!m&&(ot("false write response, pause",i.awaitDrain),i.awaitDrain++,x=!0),r.pause())}function T(j){ot("onerror",j),D(),e.removeListener("error",T),X_(e,"error")===0&&e.emit("error",j)}i5(e,"error",T);function M(){e.removeListener("finish",N),D()}e.once("close",M);function N(){ot("onfinish"),e.removeListener("close",M),D()}e.once("finish",N);function D(){ot("unpipe"),r.unpipe(e)}return e.emit("pipe",r),i.flowing||(ot("pipe resume"),r.resume()),e};function u5(e){return function(){var t=e._readableState;ot("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&X_(e,"data")&&(t.flowing=!0,V0(e))}}_t.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=nw(t.pipes,e);return s===-1?this:(t.pipes.splice(s,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};_t.prototype.on=function(e,t){var r=K0.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var i=this._readableState;!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&oh(this):Xs.nextTick(c5,this))}return r};_t.prototype.addListener=_t.prototype.on;function c5(e){ot("readable nexttick read 0"),e.read(0)}_t.prototype.resume=function(){var e=this._readableState;return e.flowing||(ot("resume"),e.flowing=!0,h5(this,e)),this};function h5(e,t){t.resumeScheduled||(t.resumeScheduled=!0,Xs.nextTick(l5,e,t))}function l5(e,t){t.reading||(ot("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),V0(e),t.flowing&&!t.reading&&e.read(0)}_t.prototype.pause=function(){return ot("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(ot("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function V0(e){var t=e._readableState;for(ot("flow",t.flowing);t.flowing&&e.read()!==null;);}_t.prototype.wrap=function(e){var t=this,r=this._readableState,i=!1;e.on("end",function(){if(ot("wrapped end"),r.decoder&&!r.ended){var s=r.decoder.end();s&&s.length&&t.push(s)}t.push(null)}),e.on("data",function(s){if(ot("wrapped data"),r.decoder&&(s=r.decoder.write(s)),!(r.objectMode&&s==null)&&!(!r.objectMode&&(!s||!s.length))){var f=t.push(s);f||(i=!0,e.pause())}});for(var n in e)this[n]===void 0&&typeof e[n]=="function"&&(this[n]=(function(s){return function(){return e[s].apply(e,arguments)}})(n));for(var o=0;o<F0.length;o++)e.on(F0[o],this.emit.bind(this,F0[o]));return this._read=function(s){ot("wrapped _read",s),i&&(i=!1,e.resume())},this};Object.defineProperty(_t.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_t._fromList=iw;function iw(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=d5(e,t.buffer,t.decoder),r}function d5(e,t,r){var i;return e<t.head.data.length?(i=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?i=t.shift():i=r?p5(e,t):g5(e,t),i}function p5(e,t){var r=t.head,i=1,n=r.data;for(e-=n.length;r=r.next;){var o=r.data,s=e>o.length?o.length:e;if(s===o.length?n+=o:n+=o.slice(0,e),e-=s,e===0){s===o.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(s));break}++i}return t.length-=i,n}function g5(e,t){var r=If.allocUnsafe(e),i=t.head,n=1;for(i.data.copy(r),e-=i.data.length;i=i.next;){var o=i.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),e-=s,e===0){s===o.length?(++n,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=o.slice(s));break}++n}return t.length-=n,r}function H0(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,Xs.nextTick(v5,t,e))}function v5(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function nw(e,t){for(var r=0,i=e.length;r<i;r++)if(e[r]===t)return r;return-1}});var G0=B((RV,fw)=>{"use strict";y();fw.exports=tn;var sh=Lo(),aw=Object.create(Ys());aw.inherits=we();aw.inherits(tn,sh);function y5(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),i(e);var n=this._readableState;n.reading=!1,(n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}function tn(e){if(!(this instanceof tn))return new tn(e);sh.call(this,e),this._transformState={afterTransform:y5.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",m5)}function m5(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){sw(e,t,r)}):sw(this,null,null)}tn.prototype.push=function(e,t){return this._transformState.needTransform=!1,sh.prototype.push.call(this,e,t)};tn.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};tn.prototype._write=function(e,t,r){var i=this._transformState;if(i.writecb=r,i.writechunk=e,i.writeencoding=t,!i.transforming){var n=this._readableState;(i.needTransform||n.needReadable||n.length<n.highWaterMark)&&this._read(n.highWaterMark)}};tn.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};tn.prototype._destroy=function(e,t){var r=this;sh.prototype._destroy.call(this,e,function(i){t(i),r.emit("close")})};function sw(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var lw=B((BV,hw)=>{"use strict";y();hw.exports=Af;var uw=G0(),cw=Object.create(Ys());cw.inherits=we();cw.inherits(Af,uw);function Af(e){if(!(this instanceof Af))return new Af(e);uw.call(this,e)}Af.prototype._transform=function(e,t,r){r(null,e)}});var pw=B((Ti,dw)=>{y();Ti=dw.exports=L0();Ti.Stream=Ti;Ti.Readable=Ti;Ti.Writable=C0();Ti.Duplex=Lo();Ti.Transform=G0();Ti.PassThrough=lw()});var yw=B((kV,vw)=>{"use strict";y();var b5=We().Buffer,_5=O_(),gw=pw().Transform,w5=we();function qn(e){gw.call(this),this._block=b5.allocUnsafe(e),this._blockSize=e,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}w5(qn,gw);qn.prototype._transform=function(e,t,r){var i=null;try{this.update(e,t)}catch(n){i=n}r(i)};qn.prototype._flush=function(e){var t=null;try{this.push(this.digest())}catch(r){t=r}e(t)};qn.prototype.update=function(e,t){if(this._finalized)throw new Error("Digest already called");for(var r=_5(e,t),i=this._block,n=0;this._blockOffset+r.length-n>=this._blockSize;){for(var o=this._blockOffset;o<this._blockSize;)i[o]=r[n],o+=1,n+=1;this._update(),this._blockOffset=0}for(;n<r.length;)i[this._blockOffset]=r[n],this._blockOffset+=1,n+=1;for(var s=0,f=r.length*8;f>0;++s)this._length[s]+=f,f=this._length[s]/4294967296|0,f>0&&(this._length[s]-=4294967296*f);return this};qn.prototype._update=function(){throw new Error("_update is not implemented")};qn.prototype.digest=function(e){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();e!==void 0&&(t=t.toString(e)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return t};qn.prototype._digest=function(){throw new Error("_digest is not implemented")};vw.exports=qn});var fh=B((CV,xw)=>{"use strict";y();var z0=xt().Buffer,S5=we(),Ew=yw(),E5=new Array(16),Of=[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],Rf=[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],Tf=[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],Bf=[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],Pf=[0,1518500249,1859775393,2400959708,2840853838],Mf=[1352829926,1548603684,1836072691,2053994217,0];function Uo(e,t){return e<<t|e>>>32-t}function mw(e,t,r,i,n,o,s,f){return Uo(e+(t^r^i)+o+s|0,f)+n|0}function bw(e,t,r,i,n,o,s,f){return Uo(e+(t&r|~t&i)+o+s|0,f)+n|0}function _w(e,t,r,i,n,o,s,f){return Uo(e+((t|~r)^i)+o+s|0,f)+n|0}function ww(e,t,r,i,n,o,s,f){return Uo(e+(t&i|r&~i)+o+s|0,f)+n|0}function Sw(e,t,r,i,n,o,s,f){return Uo(e+(t^(r|~i))+o+s|0,f)+n|0}function ah(){Ew.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}S5(ah,Ew);ah.prototype._update=function(){for(var e=E5,t=0;t<16;++t)e[t]=this._block.readInt32LE(t*4);for(var r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=this._a|0,h=this._b|0,m=this._c|0,S=this._d|0,x=this._e|0,I=0;I<80;I+=1){var T,M;I<16?(T=mw(r,i,n,o,s,e[Of[I]],Pf[0],Tf[I]),M=Sw(f,h,m,S,x,e[Rf[I]],Mf[0],Bf[I])):I<32?(T=bw(r,i,n,o,s,e[Of[I]],Pf[1],Tf[I]),M=ww(f,h,m,S,x,e[Rf[I]],Mf[1],Bf[I])):I<48?(T=_w(r,i,n,o,s,e[Of[I]],Pf[2],Tf[I]),M=_w(f,h,m,S,x,e[Rf[I]],Mf[2],Bf[I])):I<64?(T=ww(r,i,n,o,s,e[Of[I]],Pf[3],Tf[I]),M=bw(f,h,m,S,x,e[Rf[I]],Mf[3],Bf[I])):(T=Sw(r,i,n,o,s,e[Of[I]],Pf[4],Tf[I]),M=mw(f,h,m,S,x,e[Rf[I]],Mf[4],Bf[I])),r=s,s=o,o=Uo(n,10),n=i,i=T,f=x,x=S,S=Uo(m,10),m=h,h=M}var N=this._b+n+S|0;this._b=this._c+o+x|0,this._c=this._d+s+f|0,this._d=this._e+r+h|0,this._e=this._a+i+m|0,this._a=N};ah.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,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 e=z0.alloc?z0.alloc(20):new z0(20);return e.writeInt32LE(this._a,0),e.writeInt32LE(this._b,4),e.writeInt32LE(this._c,8),e.writeInt32LE(this._d,12),e.writeInt32LE(this._e,16),e};xw.exports=ah});var Fo=B((qV,Iw)=>{"use strict";y();var x5=We().Buffer,I5=bf();function uh(e,t){this._block=x5.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}uh.prototype.update=function(e,t){e=I5(e,t||"utf8");for(var r=this._block,i=this._blockSize,n=e.length,o=this._len,s=0;s<n;){for(var f=o%i,h=Math.min(n-s,i-f),m=0;m<h;m++)r[f+m]=e[s+m];o+=h,s+=h,o%i===0&&this._update(r)}return this._len+=n,this};uh.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=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 i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o};uh.prototype._update=function(){throw new Error("_update must be implemented by subclass")};Iw.exports=uh});var Rw=B((UV,Ow)=>{"use strict";y();var A5=we(),Aw=Fo(),O5=We().Buffer,R5=[1518500249,1859775393,-1894007588,-899497514],T5=new Array(80);function kf(){this.init(),this._w=T5,Aw.call(this,64,56)}A5(kf,Aw);kf.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function B5(e){return e<<5|e>>>27}function P5(e){return e<<30|e>>>2}function M5(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}kf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<80;++f)t[f]=t[f-3]^t[f-8]^t[f-14]^t[f-16];for(var h=0;h<80;++h){var m=~~(h/20),S=B5(r)+M5(m,i,n,o)+s+t[h]+R5[m]|0;s=o,o=n,n=P5(i),i=r,r=S}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};kf.prototype._hash=function(){var e=O5.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};Ow.exports=kf});var Pw=B((jV,Bw)=>{"use strict";y();var k5=we(),Tw=Fo(),N5=We().Buffer,C5=[1518500249,1859775393,-1894007588,-899497514],D5=new Array(80);function Nf(){this.init(),this._w=D5,Tw.call(this,64,56)}k5(Nf,Tw);Nf.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function q5(e){return e<<1|e>>>31}function L5(e){return e<<5|e>>>27}function U5(e){return e<<30|e>>>2}function F5(e,t,r,i){return e===0?t&r|~t&i:e===2?t&r|t&i|r&i:t^r^i}Nf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=0;f<16;++f)t[f]=e.readInt32BE(f*4);for(;f<80;++f)t[f]=q5(t[f-3]^t[f-8]^t[f-14]^t[f-16]);for(var h=0;h<80;++h){var m=~~(h/20),S=L5(r)+F5(m,i,n,o)+s+t[h]+C5[m]|0;s=o,o=n,n=U5(i),i=r,r=S}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0};Nf.prototype._hash=function(){var e=N5.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};Bw.exports=Nf});var W0=B((KV,kw)=>{"use strict";y();var j5=we(),Mw=Fo(),H5=We().Buffer,K5=[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],V5=new Array(64);function Cf(){this.init(),this._w=V5,Mw.call(this,64,56)}j5(Cf,Mw);Cf.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 G5(e,t,r){return r^e&(t^r)}function z5(e,t,r){return e&t|r&(e|t)}function W5(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Y5(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function Z5(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function $5(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Cf.prototype._update=function(e){for(var t=this._w,r=this._a|0,i=this._b|0,n=this._c|0,o=this._d|0,s=this._e|0,f=this._f|0,h=this._g|0,m=this._h|0,S=0;S<16;++S)t[S]=e.readInt32BE(S*4);for(;S<64;++S)t[S]=$5(t[S-2])+t[S-7]+Z5(t[S-15])+t[S-16]|0;for(var x=0;x<64;++x){var I=m+Y5(s)+G5(s,f,h)+K5[x]+t[x]|0,T=W5(r)+z5(r,i,n)|0;m=h,h=f,f=s,s=o+I|0,o=n,n=i,i=r,r=I+T|0}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=o+this._d|0,this._e=s+this._e|0,this._f=f+this._f|0,this._g=h+this._g|0,this._h=m+this._h|0};Cf.prototype._hash=function(){var e=H5.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};kw.exports=Cf});var Cw=B((GV,Nw)=>{"use strict";y();var X5=we(),J5=W0(),Q5=Fo(),ek=We().Buffer,tk=new Array(64);function ch(){this.init(),this._w=tk,Q5.call(this,64,56)}X5(ch,J5);ch.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};ch.prototype._hash=function(){var e=ek.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};Nw.exports=ch});var Y0=B((WV,Hw)=>{"use strict";y();var rk=we(),jw=Fo(),ik=We().Buffer,Dw=[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],nk=new Array(160);function Df(){this.init(),this._w=nk,jw.call(this,128,112)}rk(Df,jw);Df.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 qw(e,t,r){return r^e&(t^r)}function Lw(e,t,r){return e&t|r&(e|t)}function Uw(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function Fw(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function ok(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function sk(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function ak(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function fk(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function Kt(e,t){return e>>>0<t>>>0?1:0}Df.prototype._update=function(e){for(var t=this._w,r=this._ah|0,i=this._bh|0,n=this._ch|0,o=this._dh|0,s=this._eh|0,f=this._fh|0,h=this._gh|0,m=this._hh|0,S=this._al|0,x=this._bl|0,I=this._cl|0,T=this._dl|0,M=this._el|0,N=this._fl|0,D=this._gl|0,j=this._hl|0,Y=0;Y<32;Y+=2)t[Y]=e.readInt32BE(Y*4),t[Y+1]=e.readInt32BE(Y*4+4);for(;Y<160;Y+=2){var Q=t[Y-30],W=t[Y-30+1],te=ok(Q,W),ne=sk(W,Q);Q=t[Y-4],W=t[Y-4+1];var se=ak(Q,W),ue=fk(W,Q),be=t[Y-14],P=t[Y-14+1],l=t[Y-32],E=t[Y-32+1],d=ne+P|0,a=te+be+Kt(d,ne)|0;d=d+ue|0,a=a+se+Kt(d,ue)|0,d=d+E|0,a=a+l+Kt(d,E)|0,t[Y]=a,t[Y+1]=d}for(var u=0;u<160;u+=2){a=t[u],d=t[u+1];var p=Lw(r,i,n),b=Lw(S,x,I),v=Uw(r,S),c=Uw(S,r),w=Fw(s,M),A=Fw(M,s),g=Dw[u],R=Dw[u+1],U=qw(s,f,h),H=qw(M,N,D),z=j+A|0,re=m+w+Kt(z,j)|0;z=z+H|0,re=re+U+Kt(z,H)|0,z=z+R|0,re=re+g+Kt(z,R)|0,z=z+d|0,re=re+a+Kt(z,d)|0;var oe=c+b|0,k=v+p+Kt(oe,c)|0;m=h,j=D,h=f,D=N,f=s,N=M,M=T+z|0,s=o+re+Kt(M,T)|0,o=n,T=I,n=i,I=x,i=r,x=S,S=z+oe|0,r=re+k+Kt(S,z)|0}this._al=this._al+S|0,this._bl=this._bl+x|0,this._cl=this._cl+I|0,this._dl=this._dl+T|0,this._el=this._el+M|0,this._fl=this._fl+N|0,this._gl=this._gl+D|0,this._hl=this._hl+j|0,this._ah=this._ah+r+Kt(this._al,S)|0,this._bh=this._bh+i+Kt(this._bl,x)|0,this._ch=this._ch+n+Kt(this._cl,I)|0,this._dh=this._dh+o+Kt(this._dl,T)|0,this._eh=this._eh+s+Kt(this._el,M)|0,this._fh=this._fh+f+Kt(this._fl,N)|0,this._gh=this._gh+h+Kt(this._gl,D)|0,this._hh=this._hh+m+Kt(this._hl,j)|0};Df.prototype._hash=function(){var e=ik.allocUnsafe(64);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};Hw.exports=Df});var Vw=B((ZV,Kw)=>{"use strict";y();var uk=we(),ck=Y0(),hk=Fo(),lk=We().Buffer,dk=new Array(160);function hh(){this.init(),this._w=dk,hk.call(this,128,112)}uk(hh,ck);hh.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};hh.prototype._hash=function(){var e=lk.allocUnsafe(48);function t(r,i,n){e.writeInt32BE(r,n),e.writeInt32BE(i,n+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};Kw.exports=hh});var lh=B((XV,rn)=>{"use strict";y();rn.exports=function(t){var r=t.toLowerCase(),i=rn.exports[r];if(!i)throw new Error(r+" is not supported (we accept pull requests)");return new i};rn.exports.sha=Rw();rn.exports.sha1=Pw();rn.exports.sha224=Cw();rn.exports.sha256=W0();rn.exports.sha384=Vw();rn.exports.sha512=Y0()});var nn=B((QV,zw)=>{"use strict";y();var pk=We().Buffer,Gw=R0().Transform,gk=Vs().StringDecoder,vk=we(),yk=bf();function $r(e){Gw.call(this),this.hashMode=typeof e=="string",this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}vk($r,Gw);$r.prototype.update=function(e,t,r){var i=yk(e,t),n=this._update(i);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)};$r.prototype.setAutoPadding=function(){};$r.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};$r.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};$r.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};$r.prototype._transform=function(e,t,r){var i;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(n){i=n}finally{r(i)}};$r.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(r){t=r}e(t)};$r.prototype._finalOrDigest=function(e){var t=this.__final()||pk.alloc(0);return e&&(t=this._toString(t,e,!0)),t};$r.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new gk(t),this._encoding=t),this._encoding!==t)throw new Error("can\u2019t switch encodings");var i=this._decoder.write(e);return r&&(i+=this._decoder.end()),i};zw.exports=$r});var qf=B((tG,Yw)=>{"use strict";y();var mk=we(),bk=Zc(),_k=fh(),wk=lh(),Ww=nn();function dh(e){Ww.call(this,"digest"),this._hash=e}mk(dh,Ww);dh.prototype._update=function(e){this._hash.update(e)};dh.prototype._final=function(){return this._hash.digest()};Yw.exports=function(t){return t=t.toLowerCase(),t==="md5"?new bk:t==="rmd160"||t==="ripemd160"?new _k:new dh(wk(t))}});var Xw=B((iG,$w)=>{"use strict";y();var Sk=we(),jo=We().Buffer,Zw=nn(),Ek=jo.alloc(128),Js=64;function ph(e,t){Zw.call(this,"digest"),typeof t=="string"&&(t=jo.from(t)),this._alg=e,this._key=t,t.length>Js?t=e(t):t.length<Js&&(t=jo.concat([t,Ek],Js));for(var r=this._ipad=jo.allocUnsafe(Js),i=this._opad=jo.allocUnsafe(Js),n=0;n<Js;n++)r[n]=t[n]^54,i[n]=t[n]^92;this._hash=[r]}Sk(ph,Zw);ph.prototype._update=function(e){this._hash.push(e)};ph.prototype._final=function(){var e=this._alg(jo.concat(this._hash));return this._alg(jo.concat([this._opad,e]))};$w.exports=ph});var Z0=B((oG,Jw)=>{y();var xk=Zc();Jw.exports=function(e){return new xk().update(e).digest()}});var tS=B((aG,eS)=>{"use strict";y();var Ik=we(),Ak=Xw(),Qw=nn(),Lf=We().Buffer,Ok=Z0(),$0=fh(),X0=lh(),Rk=Lf.alloc(128);function Uf(e,t){Qw.call(this,"digest"),typeof t=="string"&&(t=Lf.from(t));var r=e==="sha512"||e==="sha384"?128:64;if(this._alg=e,this._key=t,t.length>r){var i=e==="rmd160"?new $0:X0(e);t=i.update(t).digest()}else t.length<r&&(t=Lf.concat([t,Rk],r));for(var n=this._ipad=Lf.allocUnsafe(r),o=this._opad=Lf.allocUnsafe(r),s=0;s<r;s++)n[s]=t[s]^54,o[s]=t[s]^92;this._hash=e==="rmd160"?new $0:X0(e),this._hash.update(n)}Ik(Uf,Qw);Uf.prototype._update=function(e){this._hash.update(e)};Uf.prototype._final=function(){var e=this._hash.digest(),t=this._alg==="rmd160"?new $0:X0(this._alg);return t.update(this._opad).update(e).digest()};eS.exports=function(t,r){return t=t.toLowerCase(),t==="rmd160"||t==="ripemd160"?new Uf("rmd160",r):t==="md5"?new Ak(Ok,r):new Uf(t,r)}});var gh=B((uG,rS)=>{"use strict";y();rS.exports={}});var J0=B((hG,iS)=>{"use strict";y();var Tk=isFinite,Bk=Math.pow(2,30)-1;iS.exports=function(e,t){if(typeof e!="number")throw new TypeError("Iterations not a number");if(e<0||!Tk(e))throw new TypeError("Bad iterations");if(typeof t!="number")throw new TypeError("Key length not a number");if(t<0||t>Bk||t!==t)throw new TypeError("Bad key length")}});var Q0=B((dG,oS)=>{"use strict";y();var vh;globalThis.process&&globalThis.process.browser?vh="utf-8":globalThis.process&&globalThis.process.version?(nS=parseInt(O.default.version.split(".")[0].slice(1),10),vh=nS>=6?"utf-8":"binary"):vh="utf-8";var nS;oS.exports=vh});var ep=B((gG,fS)=>{"use strict";y();var Pk=We().Buffer,Mk=bf(),aS=typeof Uint8Array<"u",kk=aS&&typeof ArrayBuffer<"u",sS=kk&&ArrayBuffer.isView;fS.exports=function(e,t,r){if(typeof e=="string"||Pk.isBuffer(e)||aS&&e instanceof Uint8Array||sS&&sS(e))return Mk(e,t);throw new TypeError(r+" must be a string, a Buffer, a Uint8Array, or a DataView")}});var tp=B((yG,lS)=>{"use strict";y();var Nk=Z0(),Ck=fh(),Dk=lh(),Ho=We().Buffer,qk=J0(),uS=Q0(),cS=ep(),Lk=Ho.alloc(128),yh={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},Uk={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function Fk(e){return new Ck().update(e).digest()}function jk(e){function t(r){return Dk(e).update(r).digest()}return e==="rmd160"||e==="ripemd160"?Fk:e==="md5"?Nk:t}function hS(e,t,r){var i=jk(e),n=e==="sha512"||e==="sha384"?128:64;t.length>n?t=i(t):t.length<n&&(t=Ho.concat([t,Lk],n));for(var o=Ho.allocUnsafe(n+yh[e]),s=Ho.allocUnsafe(n+yh[e]),f=0;f<n;f++)o[f]=t[f]^54,s[f]=t[f]^92;var h=Ho.allocUnsafe(n+r+4);o.copy(h,0,0,n),this.ipad1=h,this.ipad2=o,this.opad=s,this.alg=e,this.blocksize=n,this.hash=i,this.size=yh[e]}hS.prototype.run=function(e,t){e.copy(t,this.blocksize);var r=this.hash(t);return r.copy(this.opad,this.blocksize),this.hash(this.opad)};function Hk(e,t,r,i,n){qk(r,i),e=cS(e,uS,"Password"),t=cS(t,uS,"Salt");var o=(n||"sha1").toLowerCase(),s=Uk[o]||o,f=yh[s];if(typeof f!="number"||!f)throw new TypeError("Digest algorithm not supported: "+n);var h=new hS(s,e,t.length),m=Ho.allocUnsafe(i),S=Ho.allocUnsafe(t.length+4);t.copy(S,0,0,t.length);for(var x=0,I=f,T=Math.ceil(i/I),M=1;M<=T;M++){S.writeUInt32BE(M,t.length);for(var N=h.run(S,h.ipad1),D=N,j=1;j<r;j++){D=h.run(D,h.ipad2);for(var Y=0;Y<I;Y++)N[Y]^=D[Y]}N.copy(m,x),x+=I}return m}lS.exports=Hk});var bS=B((bG,mS)=>{"use strict";y();var vS=We().Buffer,Kk=J0(),dS=Q0(),pS=tp(),gS=ep(),mh,Ff=globalThis.crypto&&globalThis.crypto.subtle,Vk={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"},rp=[],Ko;function ip(){return Ko||(globalThis.process&&globalThis.process.nextTick?Ko=globalThis.process.nextTick:globalThis.queueMicrotask?Ko=globalThis.queueMicrotask:globalThis.setImmediate?Ko=globalThis.setImmediate:Ko=globalThis.setTimeout,Ko)}function yS(e,t,r,i,n){return Ff.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(o){return Ff.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:n}},o,i<<3)}).then(function(o){return vS.from(o)})}function Gk(e){if(globalThis.process&&!globalThis.process.browser||!Ff||!Ff.importKey||!Ff.deriveBits)return Promise.resolve(!1);if(rp[e]!==void 0)return rp[e];mh=mh||vS.alloc(8);var t=yS(mh,mh,10,128,e).then(function(){return!0},function(){return!1});return rp[e]=t,t}function zk(e,t){e.then(function(r){ip()(function(){t(null,r)})},function(r){ip()(function(){t(r)})})}mS.exports=function(e,t,r,i,n,o){if(typeof n=="function"&&(o=n,n=void 0),Kk(r,i),e=gS(e,dS,"Password"),t=gS(t,dS,"Salt"),typeof o!="function")throw new Error("No callback provided to pbkdf2");n=n||"sha1";var s=Vk[n.toLowerCase()];if(!s||typeof globalThis.Promise!="function"){ip()(function(){var f;try{f=pS(e,t,r,i,n)}catch(h){o(h);return}o(null,f)});return}zk(Gk(s).then(function(f){return f?yS(e,t,r,i,s):pS(e,t,r,i,n)}),o)}});var op=B(np=>{"use strict";y();np.pbkdf2=bS();np.pbkdf2Sync=tp()});var sp=B(kr=>{"use strict";y();kr.readUInt32BE=function(t,r){var i=t[0+r]<<24|t[1+r]<<16|t[2+r]<<8|t[3+r];return i>>>0};kr.writeUInt32BE=function(t,r,i){t[0+i]=r>>>24,t[1+i]=r>>>16&255,t[2+i]=r>>>8&255,t[3+i]=r&255};kr.ip=function(t,r,i,n){for(var o=0,s=0,f=6;f>=0;f-=2){for(var h=0;h<=24;h+=8)o<<=1,o|=r>>>h+f&1;for(var h=0;h<=24;h+=8)o<<=1,o|=t>>>h+f&1}for(var f=6;f>=0;f-=2){for(var h=1;h<=25;h+=8)s<<=1,s|=r>>>h+f&1;for(var h=1;h<=25;h+=8)s<<=1,s|=t>>>h+f&1}i[n+0]=o>>>0,i[n+1]=s>>>0};kr.rip=function(t,r,i,n){for(var o=0,s=0,f=0;f<4;f++)for(var h=24;h>=0;h-=8)o<<=1,o|=r>>>h+f&1,o<<=1,o|=t>>>h+f&1;for(var f=4;f<8;f++)for(var h=24;h>=0;h-=8)s<<=1,s|=r>>>h+f&1,s<<=1,s|=t>>>h+f&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.pc1=function(t,r,i,n){for(var o=0,s=0,f=7;f>=5;f--){for(var h=0;h<=24;h+=8)o<<=1,o|=r>>h+f&1;for(var h=0;h<=24;h+=8)o<<=1,o|=t>>h+f&1}for(var h=0;h<=24;h+=8)o<<=1,o|=r>>h+f&1;for(var f=1;f<=3;f++){for(var h=0;h<=24;h+=8)s<<=1,s|=r>>h+f&1;for(var h=0;h<=24;h+=8)s<<=1,s|=t>>h+f&1}for(var h=0;h<=24;h+=8)s<<=1,s|=t>>h+f&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.r28shl=function(t,r){return t<<r&268435455|t>>>28-r};var bh=[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];kr.pc2=function(t,r,i,n){for(var o=0,s=0,f=bh.length>>>1,h=0;h<f;h++)o<<=1,o|=t>>>bh[h]&1;for(var h=f;h<bh.length;h++)s<<=1,s|=r>>>bh[h]&1;i[n+0]=o>>>0,i[n+1]=s>>>0};kr.expand=function(t,r,i){var n=0,o=0;n=(t&1)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(var s=11;s>=3;s-=4)o|=t>>>s&63,o<<=6;o|=(t&31)<<1|t>>>31,r[i+0]=n>>>0,r[i+1]=o>>>0};var _S=[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];kr.substitute=function(t,r){for(var i=0,n=0;n<4;n++){var o=t>>>18-n*6&63,s=_S[n*64+o];i<<=4,i|=s}for(var n=0;n<4;n++){var o=r>>>18-n*6&63,s=_S[256+n*64+o];i<<=4,i|=s}return i>>>0};var wS=[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];kr.permute=function(t){for(var r=0,i=0;i<wS.length;i++)r<<=1,r|=t>>>wS[i]&1;return r>>>0};kr.padSplit=function(t,r,i){for(var n=t.toString(2);n.length<r;)n="0"+n;for(var o=[],s=0;s<r;s+=i)o.push(n.slice(s,s+i));return o.join(" ")}});var Xr=B((IG,ES)=>{y();ES.exports=SS;function SS(e,t){if(!e)throw new Error(t||"Assertion failed")}SS.equal=function(t,r,i){if(t!=r)throw new Error(i||"Assertion failed: "+t+" != "+r)}});var _h=B((OG,xS)=>{"use strict";y();var Wk=Xr();function Nr(e){this.options=e,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=e.padding!==!1}xS.exports=Nr;Nr.prototype._init=function(){};Nr.prototype.update=function(t){return t.length===0?[]:this.type==="decrypt"?this._updateDecrypt(t):this._updateEncrypt(t)};Nr.prototype._buffer=function(t,r){for(var i=Math.min(this.buffer.length-this.bufferOff,t.length-r),n=0;n<i;n++)this.buffer[this.bufferOff+n]=t[r+n];return this.bufferOff+=i,i};Nr.prototype._flushBuffer=function(t,r){return this._update(this.buffer,0,t,r),this.bufferOff=0,this.blockSize};Nr.prototype._updateEncrypt=function(t){var r=0,i=0,n=(this.bufferOff+t.length)/this.blockSize|0,o=new Array(n*this.blockSize);this.bufferOff!==0&&(r+=this._buffer(t,r),this.bufferOff===this.buffer.length&&(i+=this._flushBuffer(o,i)));for(var s=t.length-(t.length-r)%this.blockSize;r<s;r+=this.blockSize)this._update(t,r,o,i),i+=this.blockSize;for(;r<t.length;r++,this.bufferOff++)this.buffer[this.bufferOff]=t[r];return o};Nr.prototype._updateDecrypt=function(t){for(var r=0,i=0,n=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,o=new Array(n*this.blockSize);n>0;n--)r+=this._buffer(t,r),i+=this._flushBuffer(o,i);return r+=this._buffer(t,r),o};Nr.prototype.final=function(t){var r;t&&(r=this.update(t));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),r?r.concat(i):i};Nr.prototype._pad=function(t,r){if(r===0)return!1;for(;r<t.length;)t[r++]=0;return!0};Nr.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t};Nr.prototype._unpad=function(t){return t};Nr.prototype._finalDecrypt=function(){Wk.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}});var ap=B((TG,OS)=>{"use strict";y();var IS=Xr(),Yk=we(),qt=sp(),AS=_h();function Zk(){this.tmp=new Array(2),this.keys=null}function Bi(e){AS.call(this,e);var t=new Zk;this._desState=t,this.deriveKeys(t,e.key)}Yk(Bi,AS);OS.exports=Bi;Bi.create=function(t){return new Bi(t)};var $k=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];Bi.prototype.deriveKeys=function(t,r){t.keys=new Array(32),IS.equal(r.length,this.blockSize,"Invalid key length");var i=qt.readUInt32BE(r,0),n=qt.readUInt32BE(r,4);qt.pc1(i,n,t.tmp,0),i=t.tmp[0],n=t.tmp[1];for(var o=0;o<t.keys.length;o+=2){var s=$k[o>>>1];i=qt.r28shl(i,s),n=qt.r28shl(n,s),qt.pc2(i,n,t.keys,o)}};Bi.prototype._update=function(t,r,i,n){var o=this._desState,s=qt.readUInt32BE(t,r),f=qt.readUInt32BE(t,r+4);qt.ip(s,f,o.tmp,0),s=o.tmp[0],f=o.tmp[1],this.type==="encrypt"?this._encrypt(o,s,f,o.tmp,0):this._decrypt(o,s,f,o.tmp,0),s=o.tmp[0],f=o.tmp[1],qt.writeUInt32BE(i,s,n),qt.writeUInt32BE(i,f,n+4)};Bi.prototype._pad=function(t,r){if(this.padding===!1)return!1;for(var i=t.length-r,n=r;n<t.length;n++)t[n]=i;return!0};Bi.prototype._unpad=function(t){if(this.padding===!1)return t;for(var r=t[t.length-1],i=t.length-r;i<t.length;i++)IS.equal(t[i],r);return t.slice(0,t.length-r)};Bi.prototype._encrypt=function(t,r,i,n,o){for(var s=r,f=i,h=0;h<t.keys.length;h+=2){var m=t.keys[h],S=t.keys[h+1];qt.expand(f,t.tmp,0),m^=t.tmp[0],S^=t.tmp[1];var x=qt.substitute(m,S),I=qt.permute(x),T=f;f=(s^I)>>>0,s=T}qt.rip(f,s,n,o)};Bi.prototype._decrypt=function(t,r,i,n,o){for(var s=i,f=r,h=t.keys.length-2;h>=0;h-=2){var m=t.keys[h],S=t.keys[h+1];qt.expand(s,t.tmp,0),m^=t.tmp[0],S^=t.tmp[1];var x=qt.substitute(m,S),I=qt.permute(x),T=s;s=(f^I)>>>0,f=T}qt.rip(s,f,n,o)}});var TS=B(RS=>{"use strict";y();var Xk=Xr(),Jk=we(),wh={};function Qk(e){Xk.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t<this.iv.length;t++)this.iv[t]=e[t]}function eN(e){function t(o){e.call(this,o),this._cbcInit()}Jk(t,e);for(var r=Object.keys(wh),i=0;i<r.length;i++){var n=r[i];t.prototype[n]=wh[n]}return t.create=function(s){return new t(s)},t}RS.instantiate=eN;wh._cbcInit=function(){var t=new Qk(this.options.iv);this._cbcState=t};wh._update=function(t,r,i,n){var o=this._cbcState,s=this.constructor.super_.prototype,f=o.iv;if(this.type==="encrypt"){for(var h=0;h<this.blockSize;h++)f[h]^=t[r+h];s._update.call(this,f,0,i,n);for(var h=0;h<this.blockSize;h++)f[h]=i[n+h]}else{s._update.call(this,t,r,i,n);for(var h=0;h<this.blockSize;h++)i[n+h]^=f[h];for(var h=0;h<this.blockSize;h++)f[h]=t[r+h]}}});var MS=B((kG,PS)=>{"use strict";y();var tN=Xr(),rN=we(),BS=_h(),Ln=ap();function iN(e,t){tN.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),i=t.slice(8,16),n=t.slice(16,24);e==="encrypt"?this.ciphers=[Ln.create({type:"encrypt",key:r}),Ln.create({type:"decrypt",key:i}),Ln.create({type:"encrypt",key:n})]:this.ciphers=[Ln.create({type:"decrypt",key:n}),Ln.create({type:"encrypt",key:i}),Ln.create({type:"decrypt",key:r})]}function Vo(e){BS.call(this,e);var t=new iN(this.type,this.options.key);this._edeState=t}rN(Vo,BS);PS.exports=Vo;Vo.create=function(t){return new Vo(t)};Vo.prototype._update=function(t,r,i,n){var o=this._edeState;o.ciphers[0]._update(t,r,i,n),o.ciphers[1]._update(i,n,i,n),o.ciphers[2]._update(i,n,i,n)};Vo.prototype._pad=Ln.prototype._pad;Vo.prototype._unpad=Ln.prototype._unpad});var kS=B(Qs=>{"use strict";y();Qs.utils=sp();Qs.Cipher=_h();Qs.DES=ap();Qs.CBC=TS();Qs.EDE=MS()});var DS=B((qG,CS)=>{y();var NS=nn(),on=kS(),nN=we(),Go=We().Buffer,jf={"des-ede3-cbc":on.CBC.instantiate(on.EDE),"des-ede3":on.EDE,"des-ede-cbc":on.CBC.instantiate(on.EDE),"des-ede":on.EDE,"des-cbc":on.CBC.instantiate(on.DES),"des-ecb":on.DES};jf.des=jf["des-cbc"];jf.des3=jf["des-ede3-cbc"];CS.exports=Sh;nN(Sh,NS);function Sh(e){NS.call(this);var t=e.mode.toLowerCase(),r=jf[t],i;e.decrypt?i="decrypt":i="encrypt";var n=e.key;Go.isBuffer(n)||(n=Go.from(n)),(t==="des-ede"||t==="des-ede-cbc")&&(n=Go.concat([n,n.slice(0,8)]));var o=e.iv;Go.isBuffer(o)||(o=Go.from(o)),this._des=r.create({key:n,iv:o,type:i})}Sh.prototype._update=function(e){return Go.from(this._des.update(e))};Sh.prototype._final=function(){return Go.from(this._des.final())}});var qS=B(fp=>{y();fp.encrypt=function(e,t){return e._cipher.encryptBlock(t)};fp.decrypt=function(e,t){return e._cipher.decryptBlock(t)}});var ea=B((jG,LS)=>{y();LS.exports=function(t,r){for(var i=Math.min(t.length,r.length),n=new _.Buffer(i),o=0;o<i;++o)n[o]=t[o]^r[o];return n}});var FS=B(up=>{y();var US=ea();up.encrypt=function(e,t){var r=US(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev};up.decrypt=function(e,t){var r=e._prev;e._prev=t;var i=e._cipher.decryptBlock(t);return US(i,r)}});var KS=B(HS=>{y();var Hf=We().Buffer,oN=ea();function jS(e,t,r){var i=t.length,n=oN(t,e._cache);return e._cache=e._cache.slice(i),e._prev=Hf.concat([e._prev,r?t:n]),n}HS.encrypt=function(e,t,r){for(var i=Hf.allocUnsafe(0),n;t.length;)if(e._cache.length===0&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=Hf.allocUnsafe(0)),e._cache.length<=t.length)n=e._cache.length,i=Hf.concat([i,jS(e,t.slice(0,n),r)]),t=t.slice(n);else{i=Hf.concat([i,jS(e,t,r)]);break}return i}});var GS=B(VS=>{y();var cp=We().Buffer;function sN(e,t,r){var i=e._cipher.encryptBlock(e._prev),n=i[0]^t;return e._prev=cp.concat([e._prev.slice(1),cp.from([r?t:n])]),n}VS.encrypt=function(e,t,r){for(var i=t.length,n=cp.allocUnsafe(i),o=-1;++o<i;)n[o]=sN(e,t[o],r);return n}});var WS=B(zS=>{y();var Eh=We().Buffer;function aN(e,t,r){for(var i,n=-1,o=8,s=0,f,h;++n<o;)i=e._cipher.encryptBlock(e._prev),f=t&1<<7-n?128:0,h=i[0]^f,s+=(h&128)>>n%8,e._prev=fN(e._prev,r?f:h);return s}function fN(e,t){var r=e.length,i=-1,n=Eh.allocUnsafe(e.length);for(e=Eh.concat([e,Eh.from([t])]);++i<r;)n[i]=e[i]<<1|e[i+1]>>7;return n}zS.encrypt=function(e,t,r){for(var i=t.length,n=Eh.allocUnsafe(i),o=-1;++o<i;)n[o]=aN(e,t[o],r);return n}});var ZS=B(YS=>{y();var uN=ea();function cN(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}YS.encrypt=function(e,t){for(;e._cache.length<t.length;)e._cache=_.Buffer.concat([e._cache,cN(e)]);var r=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),uN(t,r)}});var hp=B((QG,$S)=>{y();function hN(e){for(var t=e.length,r;t--;)if(r=e.readUInt8(t),r===255)e.writeUInt8(0,t);else{r++,e.writeUInt8(r,t);break}}$S.exports=hN});var dp=B(JS=>{y();var lN=ea(),XS=We().Buffer,dN=hp();function pN(e){var t=e._cipher.encryptBlockRaw(e._prev);return dN(e._prev),t}var lp=16;JS.encrypt=function(e,t){var r=Math.ceil(t.length/lp),i=e._cache.length;e._cache=XS.concat([e._cache,XS.allocUnsafe(r*lp)]);for(var n=0;n<r;n++){var o=pN(e),s=i+n*lp;e._cache.writeUInt32BE(o[0],s+0),e._cache.writeUInt32BE(o[1],s+4),e._cache.writeUInt32BE(o[2],s+8),e._cache.writeUInt32BE(o[3],s+12)}var f=e._cache.slice(0,t.length);return e._cache=e._cache.slice(t.length),lN(t,f)}});var pp=B((iz,gN)=>{gN.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 Ih=B((nz,QS)=>{y();var vN={ECB:qS(),CBC:FS(),CFB:KS(),CFB8:GS(),CFB1:WS(),OFB:ZS(),CTR:dp(),GCM:dp()},xh=pp();for(gp in xh)xh[gp].module=vN[xh[gp].mode];var gp;QS.exports=xh});var Kf=B((sz,t2)=>{y();var Ah=We().Buffer;function yp(e){Ah.isBuffer(e)||(e=Ah.from(e));for(var t=e.length/4|0,r=new Array(t),i=0;i<t;i++)r[i]=e.readUInt32BE(i*4);return r}function vp(e){for(var t=0;t<e.length;e++)e[t]=0}function e2(e,t,r,i,n){for(var o=r[0],s=r[1],f=r[2],h=r[3],m=e[0]^t[0],S=e[1]^t[1],x=e[2]^t[2],I=e[3]^t[3],T,M,N,D,j=4,Y=1;Y<n;Y++)T=o[m>>>24]^s[S>>>16&255]^f[x>>>8&255]^h[I&255]^t[j++],M=o[S>>>24]^s[x>>>16&255]^f[I>>>8&255]^h[m&255]^t[j++],N=o[x>>>24]^s[I>>>16&255]^f[m>>>8&255]^h[S&255]^t[j++],D=o[I>>>24]^s[m>>>16&255]^f[S>>>8&255]^h[x&255]^t[j++],m=T,S=M,x=N,I=D;return T=(i[m>>>24]<<24|i[S>>>16&255]<<16|i[x>>>8&255]<<8|i[I&255])^t[j++],M=(i[S>>>24]<<24|i[x>>>16&255]<<16|i[I>>>8&255]<<8|i[m&255])^t[j++],N=(i[x>>>24]<<24|i[I>>>16&255]<<16|i[m>>>8&255]<<8|i[S&255])^t[j++],D=(i[I>>>24]<<24|i[m>>>16&255]<<16|i[S>>>8&255]<<8|i[x&255])^t[j++],T=T>>>0,M=M>>>0,N=N>>>0,D=D>>>0,[T,M,N,D]}var yN=[0,1,2,4,8,16,32,64,128,27,54],Pt=(function(){for(var e=new Array(256),t=0;t<256;t++)t<128?e[t]=t<<1:e[t]=t<<1^283;for(var r=[],i=[],n=[[],[],[],[]],o=[[],[],[],[]],s=0,f=0,h=0;h<256;++h){var m=f^f<<1^f<<2^f<<3^f<<4;m=m>>>8^m&255^99,r[s]=m,i[m]=s;var S=e[s],x=e[S],I=e[x],T=e[m]*257^m*16843008;n[0][s]=T<<24|T>>>8,n[1][s]=T<<16|T>>>16,n[2][s]=T<<8|T>>>24,n[3][s]=T,T=I*16843009^x*65537^S*257^s*16843008,o[0][m]=T<<24|T>>>8,o[1][m]=T<<16|T>>>16,o[2][m]=T<<8|T>>>24,o[3][m]=T,s===0?s=f=1:(s=S^e[e[e[I^S]]],f^=e[e[f]])}return{SBOX:r,INV_SBOX:i,SUB_MIX:n,INV_SUB_MIX:o}})();function Cr(e){this._key=yp(e),this._reset()}Cr.blockSize=16;Cr.keySize=256/8;Cr.prototype.blockSize=Cr.blockSize;Cr.prototype.keySize=Cr.keySize;Cr.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,i=(r+1)*4,n=[],o=0;o<t;o++)n[o]=e[o];for(o=t;o<i;o++){var s=n[o-1];o%t===0?(s=s<<8|s>>>24,s=Pt.SBOX[s>>>24]<<24|Pt.SBOX[s>>>16&255]<<16|Pt.SBOX[s>>>8&255]<<8|Pt.SBOX[s&255],s^=yN[o/t|0]<<24):t>6&&o%t===4&&(s=Pt.SBOX[s>>>24]<<24|Pt.SBOX[s>>>16&255]<<16|Pt.SBOX[s>>>8&255]<<8|Pt.SBOX[s&255]),n[o]=n[o-t]^s}for(var f=[],h=0;h<i;h++){var m=i-h,S=n[m-(h%4?0:4)];h<4||m<=4?f[h]=S:f[h]=Pt.INV_SUB_MIX[0][Pt.SBOX[S>>>24]]^Pt.INV_SUB_MIX[1][Pt.SBOX[S>>>16&255]]^Pt.INV_SUB_MIX[2][Pt.SBOX[S>>>8&255]]^Pt.INV_SUB_MIX[3][Pt.SBOX[S&255]]}this._nRounds=r,this._keySchedule=n,this._invKeySchedule=f};Cr.prototype.encryptBlockRaw=function(e){return e=yp(e),e2(e,this._keySchedule,Pt.SUB_MIX,Pt.SBOX,this._nRounds)};Cr.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=Ah.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r};Cr.prototype.decryptBlock=function(e){e=yp(e);var t=e[1];e[1]=e[3],e[3]=t;var r=e2(e,this._invKeySchedule,Pt.INV_SUB_MIX,Pt.INV_SBOX,this._nRounds),i=Ah.allocUnsafe(16);return i.writeUInt32BE(r[0],0),i.writeUInt32BE(r[3],4),i.writeUInt32BE(r[2],8),i.writeUInt32BE(r[1],12),i};Cr.prototype.scrub=function(){vp(this._keySchedule),vp(this._invKeySchedule),vp(this._key)};t2.exports.AES=Cr});var n2=B((fz,i2)=>{y();var ta=We().Buffer,mN=ta.alloc(16,0);function bN(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function r2(e){var t=ta.allocUnsafe(16);return t.writeUInt32BE(e[0]>>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function Vf(e){this.h=e,this.state=ta.alloc(16,0),this.cache=ta.allocUnsafe(0)}Vf.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()};Vf.prototype._multiply=function(){for(var e=bN(this.h),t=[0,0,0,0],r,i,n,o=-1;++o<128;){for(i=(this.state[~~(o/8)]&1<<7-o%8)!==0,i&&(t[0]^=e[0],t[1]^=e[1],t[2]^=e[2],t[3]^=e[3]),n=(e[3]&1)!==0,r=3;r>0;r--)e[r]=e[r]>>>1|(e[r-1]&1)<<31;e[0]=e[0]>>>1,n&&(e[0]=e[0]^225<<24)}this.state=r2(t)};Vf.prototype.update=function(e){this.cache=ta.concat([this.cache,e]);for(var t;this.cache.length>=16;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)};Vf.prototype.final=function(e,t){return this.cache.length&&this.ghash(ta.concat([this.cache,mN],16)),this.ghash(r2([0,e,0,t])),this.state};i2.exports=Vf});var mp=B((cz,a2)=>{y();var _N=Kf(),hr=We().Buffer,o2=nn(),wN=we(),s2=n2(),SN=ea(),EN=hp();function xN(e,t){var r=0;e.length!==t.length&&r++;for(var i=Math.min(e.length,t.length),n=0;n<i;++n)r+=e[n]^t[n];return r}function IN(e,t,r){if(t.length===12)return e._finID=hr.concat([t,hr.from([0,0,0,1])]),hr.concat([t,hr.from([0,0,0,2])]);var i=new s2(r),n=t.length,o=n%16;i.update(t),o&&(o=16-o,i.update(hr.alloc(o,0))),i.update(hr.alloc(8,0));var s=n*8,f=hr.alloc(8);f.writeUIntBE(s,0,8),i.update(f),e._finID=i.state;var h=hr.from(e._finID);return EN(h),h}function zo(e,t,r,i){o2.call(this);var n=hr.alloc(4,0);this._cipher=new _N.AES(t);var o=this._cipher.encryptBlock(n);this._ghash=new s2(o),r=IN(this,r,o),this._prev=hr.from(r),this._cache=hr.allocUnsafe(0),this._secCache=hr.allocUnsafe(0),this._decrypt=i,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}wN(zo,o2);zo.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=hr.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r};zo.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=SN(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&xN(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=e,this._cipher.scrub()};zo.prototype.getAuthTag=function(){if(this._decrypt||!hr.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag};zo.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t};zo.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length};a2.exports=zo});var _p=B((lz,u2)=>{y();var AN=Kf(),bp=We().Buffer,f2=nn(),ON=we();function Oh(e,t,r,i){f2.call(this),this._cipher=new AN.AES(t),this._prev=bp.from(r),this._cache=bp.allocUnsafe(0),this._secCache=bp.allocUnsafe(0),this._decrypt=i,this._mode=e}ON(Oh,f2);Oh.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)};Oh.prototype._final=function(){this._cipher.scrub()};u2.exports=Oh});var Gf=B((pz,c2)=>{y();var Wo=We().Buffer,RN=Zc();function TN(e,t,r,i){if(Wo.isBuffer(e)||(e=Wo.from(e,"binary")),t&&(Wo.isBuffer(t)||(t=Wo.from(t,"binary")),t.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var n=r/8,o=Wo.alloc(n),s=Wo.alloc(i||0),f=Wo.alloc(0);n>0||i>0;){var h=new RN;h.update(f),h.update(e),t&&h.update(t),f=h.digest();var m=0;if(n>0){var S=o.length-n;m=Math.min(n,f.length),f.copy(o,S,0,m),n-=m}if(m<f.length&&i>0){var x=s.length-i,I=Math.min(i,f.length-m);f.copy(s,x,m,m+I),i-=I}}return f.fill(0),{key:o,iv:s}}c2.exports=TN});var p2=B(wp=>{y();var h2=Ih(),BN=mp(),sn=We().Buffer,PN=_p(),l2=nn(),MN=Kf(),kN=Gf(),NN=we();function zf(e,t,r){l2.call(this),this._cache=new Rh,this._cipher=new MN.AES(t),this._prev=sn.from(r),this._mode=e,this._autopadding=!0}NN(zf,l2);zf.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get();)r=this._mode.encrypt(this,t),i.push(r);return sn.concat(i)};var CN=sn.alloc(16,16);zf.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if(!e.equals(CN))throw this._cipher.scrub(),new Error("data not multiple of block length")};zf.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Rh(){this.cache=sn.allocUnsafe(0)}Rh.prototype.add=function(e){this.cache=sn.concat([this.cache,e])};Rh.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null};Rh.prototype.flush=function(){for(var e=16-this.cache.length,t=sn.allocUnsafe(e),r=-1;++r<e;)t.writeUInt8(e,r);return sn.concat([this.cache,t])};function d2(e,t,r){var i=h2[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if(typeof t=="string"&&(t=sn.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);if(typeof r=="string"&&(r=sn.from(r)),i.mode!=="GCM"&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);return i.type==="stream"?new PN(i.module,t,r):i.type==="auth"?new BN(i.module,t,r):new zf(i.module,t,r)}function DN(e,t){var r=h2[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=kN(t,!1,r.key,r.iv);return d2(e,i.key,i.iv)}wp.createCipheriv=d2;wp.createCipher=DN});var m2=B(Sp=>{y();var qN=mp(),ra=We().Buffer,g2=Ih(),LN=_p(),v2=nn(),UN=Kf(),FN=Gf(),jN=we();function Wf(e,t,r){v2.call(this),this._cache=new Th,this._last=void 0,this._cipher=new UN.AES(t),this._prev=ra.from(r),this._mode=e,this._autopadding=!0}jN(Wf,v2);Wf.prototype._update=function(e){this._cache.add(e);for(var t,r,i=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),i.push(r);return ra.concat(i)};Wf.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return HN(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")};Wf.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this};function Th(){this.cache=ra.allocUnsafe(0)}Th.prototype.add=function(e){this.cache=ra.concat([this.cache,e])};Th.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null};Th.prototype.flush=function(){if(this.cache.length)return this.cache};function HN(e){var t=e[15];if(t<1||t>16)throw new Error("unable to decrypt data");for(var r=-1;++r<t;)if(e[r+(16-t)]!==t)throw new Error("unable to decrypt data");if(t!==16)return e.slice(0,16-t)}function y2(e,t,r){var i=g2[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");if(typeof r=="string"&&(r=ra.from(r)),i.mode!=="GCM"&&r.length!==i.iv)throw new TypeError("invalid iv length "+r.length);if(typeof t=="string"&&(t=ra.from(t)),t.length!==i.key/8)throw new TypeError("invalid key length "+t.length);return i.type==="stream"?new LN(i.module,t,r,!0):i.type==="auth"?new qN(i.module,t,r,!0):new Wf(i.module,t,r)}function KN(e,t){var r=g2[e.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var i=FN(t,!1,r.key,r.iv);return y2(e,i.key,i.iv)}Sp.createDecipher=KN;Sp.createDecipheriv=y2});var Bh=B(Jr=>{y();var b2=p2(),_2=m2(),VN=pp();function GN(){return Object.keys(VN)}Jr.createCipher=Jr.Cipher=b2.createCipher;Jr.createCipheriv=Jr.Cipheriv=b2.createCipheriv;Jr.createDecipher=Jr.Decipher=_2.createDecipher;Jr.createDecipheriv=Jr.Decipheriv=_2.createDecipheriv;Jr.listCiphers=Jr.getCiphers=GN});var w2=B(an=>{y();an["des-ecb"]={key:8,iv:0};an["des-cbc"]=an.des={key:8,iv:8};an["des-ede3-cbc"]=an.des3={key:24,iv:8};an["des-ede3"]={key:24,iv:0};an["des-ede-cbc"]={key:16,iv:8};an["des-ede"]={key:16,iv:0}});var A2=B(Qr=>{y();var S2=DS(),Ep=Bh(),Un=Ih(),fn=w2(),E2=Gf();function zN(e,t){e=e.toLowerCase();var r,i;if(Un[e])r=Un[e].key,i=Un[e].iv;else if(fn[e])r=fn[e].key*8,i=fn[e].iv;else throw new TypeError("invalid suite type");var n=E2(t,!1,r,i);return x2(e,n.key,n.iv)}function WN(e,t){e=e.toLowerCase();var r,i;if(Un[e])r=Un[e].key,i=Un[e].iv;else if(fn[e])r=fn[e].key*8,i=fn[e].iv;else throw new TypeError("invalid suite type");var n=E2(t,!1,r,i);return I2(e,n.key,n.iv)}function x2(e,t,r){if(e=e.toLowerCase(),Un[e])return Ep.createCipheriv(e,t,r);if(fn[e])return new S2({key:t,iv:r,mode:e});throw new TypeError("invalid suite type")}function I2(e,t,r){if(e=e.toLowerCase(),Un[e])return Ep.createDecipheriv(e,t,r);if(fn[e])return new S2({key:t,iv:r,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function YN(){return Object.keys(fn).concat(Ep.getCiphers())}Qr.createCipher=Qr.Cipher=zN;Qr.createCipheriv=Qr.Cipheriv=x2;Qr.createDecipher=Qr.Decipher=WN;Qr.createDecipheriv=Qr.Decipheriv=I2;Qr.listCiphers=Qr.getCiphers=YN});var O2=B((Az,Ap)=>{y();var xp;Ap.exports=function(t){return xp||(xp=new Fn(null)),xp.generate(t)};function Fn(e){this.rand=e}Ap.exports.Rand=Fn;Fn.prototype.generate=function(t){return this._rand(t)};Fn.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var r=new Uint8Array(t),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Fn.prototype._rand=function(t){var r=new Uint8Array(t);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Fn.prototype._rand=function(t){var r=new Uint8Array(t);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Fn.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(Ip=Ph(),typeof Ip.randomBytes!="function")throw new Error("Not supported");Fn.prototype._rand=function(t){return Ip.randomBytes(t)}}catch{}var Ip});var Op=B((Rz,R2)=>{y();var Yo=$i(),ZN=O2();function Zo(e){this.rand=e||new ZN.Rand}R2.exports=Zo;Zo.create=function(t){return new Zo(t)};Zo.prototype._randbelow=function(t){var r=t.bitLength(),i=Math.ceil(r/8);do var n=new Yo(this.rand.generate(i));while(n.cmp(t)>=0);return n};Zo.prototype._randrange=function(t,r){var i=r.sub(t);return t.add(this._randbelow(i))};Zo.prototype.test=function(t,r,i){var n=t.bitLength(),o=Yo.mont(t),s=new Yo(1).toRed(o);r||(r=Math.max(1,n/48|0));for(var f=t.subn(1),h=0;!f.testn(h);h++);for(var m=t.shrn(h),S=f.toRed(o),x=!0;r>0;r--){var I=this._randrange(new Yo(2),f);i&&i(I);var T=I.toRed(o).redPow(m);if(!(T.cmp(s)===0||T.cmp(S)===0)){for(var M=1;M<h;M++){if(T=T.redSqr(),T.cmp(s)===0)return!1;if(T.cmp(S)===0)break}if(M===h)return!1}}return x};Zo.prototype.getDivisor=function(t,r){var i=t.bitLength(),n=Yo.mont(t),o=new Yo(1).toRed(n);r||(r=Math.max(1,i/48|0));for(var s=t.subn(1),f=0;!s.testn(f);f++);for(var h=t.shrn(f),m=s.toRed(n);r>0;r--){var S=this._randrange(new Yo(2),s),x=t.gcd(S);if(x.cmpn(1)!==0)return x;var I=S.toRed(n).redPow(h);if(!(I.cmp(o)===0||I.cmp(m)===0)){for(var T=1;T<f;T++){if(I=I.redSqr(),I.cmp(o)===0)return I.fromRed().subn(1).gcd(t);if(I.cmp(m)===0)break}if(T===f)return I=I.redSqr(),I.fromRed().subn(1).gcd(t)}}return!1}});var kp=B((Nz,P2)=>{y();var $N=Ao();P2.exports=Mp;Mp.simpleSieve=Bp;Mp.fermatTest=Pp;var Yt=$i(),XN=new Yt(24),JN=Op(),T2=new JN,QN=new Yt(1),Tp=new Yt(2),eC=new Yt(5),Bz=new Yt(16),Pz=new Yt(8),tC=new Yt(10),rC=new Yt(3),Mz=new Yt(7),iC=new Yt(11),B2=new Yt(4),kz=new Yt(12),Rp=null;function nC(){if(Rp!==null)return Rp;var e=1048576,t=[];t[0]=2;for(var r=1,i=3;i<e;i+=2){for(var n=Math.ceil(Math.sqrt(i)),o=0;o<r&&t[o]<=n&&i%t[o]!==0;o++);r!==o&&t[o]<=n||(t[r++]=i)}return Rp=t,t}function Bp(e){for(var t=nC(),r=0;r<t.length;r++)if(e.modn(t[r])===0)return e.cmpn(t[r])===0;return!0}function Pp(e){var t=Yt.mont(e);return Tp.toRed(t).redPow(e.subn(1)).fromRed().cmpn(1)===0}function Mp(e,t){if(e<16)return t===2||t===5?new Yt([140,123]):new Yt([140,39]);t=new Yt(t);for(var r,i;;){for(r=new Yt($N(Math.ceil(e/8)));r.bitLength()>e;)r.ishrn(1);if(r.isEven()&&r.iadd(QN),r.testn(1)||r.iadd(Tp),t.cmp(Tp)){if(!t.cmp(eC))for(;r.mod(tC).cmp(rC);)r.iadd(B2)}else for(;r.mod(XN).cmp(iC);)r.iadd(B2);if(i=r.shrn(1),Bp(i)&&Bp(r)&&Pp(i)&&Pp(r)&&T2.test(i)&&T2.test(r))return r}}});var M2=B((Dz,oC)=>{oC.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 D2=B((qz,C2)=>{y();var Dr=$i(),sC=Op(),k2=new sC,aC=new Dr(24),fC=new Dr(11),uC=new Dr(10),cC=new Dr(3),hC=new Dr(7),N2=kp(),lC=Ao();C2.exports=un;function dC(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this._pub=new Dr(e),this}function pC(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this._priv=new Dr(e),this}var Mh={};function gC(e,t){var r=t.toString("hex"),i=[r,e.toString(16)].join("_");if(i in Mh)return Mh[i];var n=0;if(e.isEven()||!N2.simpleSieve||!N2.fermatTest(e)||!k2.test(e))return n+=1,r==="02"||r==="05"?n+=8:n+=4,Mh[i]=n,n;k2.test(e.shrn(1))||(n+=2);var o;switch(r){case"02":e.mod(aC).cmp(fC)&&(n+=8);break;case"05":o=e.mod(uC),o.cmp(cC)&&o.cmp(hC)&&(n+=8);break;default:n+=4}return Mh[i]=n,n}function un(e,t,r){this.setGenerator(t),this.__prime=new Dr(e),this._prime=Dr.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=dC,this.setPrivateKey=pC):this._primeCode=8}Object.defineProperty(un.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=gC(this.__prime,this.__gen)),this._primeCode}});un.prototype.generateKeys=function(){return this._priv||(this._priv=new Dr(lC(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()};un.prototype.computeSecret=function(e){e=new Dr(e),e=e.toRed(this._prime);var t=e.redPow(this._priv).fromRed(),r=new _.Buffer(t.toArray()),i=this.getPrime();if(r.length<i.length){var n=new _.Buffer(i.length-r.length);n.fill(0),r=_.Buffer.concat([n,r])}return r};un.prototype.getPublicKey=function(t){return kh(this._pub,t)};un.prototype.getPrivateKey=function(t){return kh(this._priv,t)};un.prototype.getPrime=function(e){return kh(this.__prime,e)};un.prototype.getGenerator=function(e){return kh(this._gen,e)};un.prototype.setGenerator=function(e,t){return t=t||"utf8",_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),this.__gen=e,this._gen=new Dr(e),this};function kh(e,t){var r=new _.Buffer(e.toArray());return t?r.toString(t):r}});var U2=B(ia=>{y();var vC=kp(),q2=M2(),Np=D2();function yC(e){var t=new _.Buffer(q2[e].prime,"hex"),r=new _.Buffer(q2[e].gen,"hex");return new Np(t,r)}var mC={binary:!0,hex:!0,base64:!0};function L2(e,t,r,i){return _.Buffer.isBuffer(t)||mC[t]===void 0?L2(e,"binary",t,r):(t=t||"binary",i=i||"binary",r=r||new _.Buffer([2]),_.Buffer.isBuffer(r)||(r=new _.Buffer(r,i)),typeof e=="number"?new Np(vC(e,r),r,!0):(_.Buffer.isBuffer(e)||(e=new _.Buffer(e,t)),new Np(e,r,!0)))}ia.DiffieHellmanGroup=ia.createDiffieHellmanGroup=ia.getDiffieHellman=yC;ia.createDiffieHellman=ia.DiffieHellman=L2});var F2=B((exports,module)=>{y();var indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1},Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var r in e)t.push(r);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var r=0;r<e.length;r++)t(e[r],r,e)},defineProp=(function(){try{return Object.defineProperty({},"_",{}),function(e,t,r){Object.defineProperty(e,t,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch{return function(t,r,i){t[r]=i}}})(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(e){if(!(e instanceof Context))throw new TypeError("needs a 'context' argument.");var t=document.createElement("iframe");t.style||(t.style={}),t.style.display="none",document.body.appendChild(t);var r=t.contentWindow,i=r.eval,n=r.execScript;!i&&n&&(n.call(r,"null"),i=r.eval),forEach(Object_keys(e),function(f){r[f]=e[f]}),forEach(globals,function(f){e[f]&&(r[f]=e[f])});var o=Object_keys(r),s=i.call(r,this.code);return forEach(Object_keys(r),function(f){(f in e||indexOf(o,f)===-1)&&(e[f]=r[f])}),forEach(globals,function(f){f in e||defineProp(e,f,r[f])}),document.body.removeChild(t),s};Script.prototype.runInThisContext=function(){return eval(this.code)};Script.prototype.runInNewContext=function(e){var t=Script.createContext(e),r=this.runInContext(t);return e&&forEach(Object_keys(t),function(i){e[i]=t[i]}),r};forEach(Object_keys(Script.prototype),function(e){exports[e]=Script[e]=function(t){var r=Script(t);return r[e].apply(r,[].slice.call(arguments,1))}});exports.isContext=function(e){return e instanceof Context};exports.createScript=function(e){return exports.Script(e)};exports.createContext=Script.createContext=function(e){var t=new Context;return typeof e=="object"&&forEach(Object_keys(e),function(r){t[r]=e[r]}),t}});var K2=B(H2=>{y();var j2=oa(),bC=we(),_C=H2;_C.define=function(t,r){return new na(t,r)};function na(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}na.prototype._createNamed=function(t){var r;try{r=F2().runInThisContext("(function "+this.name+`(entity) {
12
12
  this._initNamed(entity);
13
- })`)}catch{r=function(n){this._initNamed(n)}}return bC(r,t),r.prototype._initNamed=function(n){t.call(this,n)},new r(this)};na.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(j2.decoders[t])),this.decoders[t]};na.prototype.decode=function(t,r,i){return this._getDecoder(r).decode(t,i)};na.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(j2.encoders[t])),this.encoders[t]};na.prototype.encode=function(t,r,i){return this._getEncoder(r).encode(t,i)}});var G2=B(V2=>{y();var wC=we();function qr(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}V2.Reporter=qr;qr.prototype.isError=function(t){return t instanceof sa};qr.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}};qr.prototype.restore=function(t){var r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)};qr.prototype.enterKey=function(t){return this._reporterState.path.push(t)};qr.prototype.exitKey=function(t){var r=this._reporterState;r.path=r.path.slice(0,t-1)};qr.prototype.leaveKey=function(t,r,i){var n=this._reporterState;this.exitKey(t),n.obj!==null&&(n.obj[r]=i)};qr.prototype.path=function(){return this._reporterState.path.join("/")};qr.prototype.enterObject=function(){var t=this._reporterState,r=t.obj;return t.obj={},r};qr.prototype.leaveObject=function(t){var r=this._reporterState,i=r.obj;return r.obj=t,i};qr.prototype.error=function(t){var r,i=this._reporterState,n=t instanceof sa;if(n?r=t:r=new sa(i.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),t.message||t,t.stack),!i.options.partial)throw r;return n||i.errors.push(r),r};qr.prototype.wrapResult=function(t){var r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t};function sa(e,t){this.path=e,this.rethrow(t)}wC(sa,Error);sa.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,sa),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}});var Dp=B(Cp=>{y();var SC=we(),Ch=aa().Reporter,Yf=xt().Buffer;function Pi(e,t){if(Ch.call(this,t),!Yf.isBuffer(e)){this.error("Input not Buffer");return}this.base=e,this.offset=0,this.length=e.length}SC(Pi,Ch);Cp.DecoderBuffer=Pi;Pi.prototype.save=function(){return{offset:this.offset,reporter:Ch.prototype.save.call(this)}};Pi.prototype.restore=function(t){var r=new Pi(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,Ch.prototype.restore.call(this,t.reporter),r};Pi.prototype.isEmpty=function(){return this.offset===this.length};Pi.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")};Pi.prototype.skip=function(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");var i=new Pi(this.base);return i._reporterState=this._reporterState,i.offset=this.offset,i.length=this.offset+t,this.offset+=t,i};Pi.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)};function Nh(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(r){return r instanceof Nh||(r=new Nh(r,t)),this.length+=r.length,r},this);else if(typeof e=="number"){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if(typeof e=="string")this.value=e,this.length=Yf.byteLength(e);else if(Yf.isBuffer(e))this.value=e,this.length=e.length;else return t.error("Unsupported type: "+typeof e)}Cp.EncoderBuffer=Nh;Nh.prototype.join=function(t,r){return t||(t=new Yf(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(i){i.join(t,r),r+=i.length}):(typeof this.value=="number"?t[r]=this.value:typeof this.value=="string"?t.write(this.value,r):Yf.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length)),t}});var Y2=B((Yz,W2)=>{y();var EC=aa().Reporter,xC=aa().EncoderBuffer,IC=aa().DecoderBuffer,nr=Xr(),z2=["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"],AC=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(z2),OC=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function ut(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}W2.exports=ut;var RC=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];ut.prototype.clone=function(){var t=this._baseState,r={};RC.forEach(function(n){r[n]=t[n]});var i=new this.constructor(r.parent);return i._baseState=r,i};ut.prototype._wrap=function(){var t=this._baseState;AC.forEach(function(r){this[r]=function(){var n=new this.constructor(this);return t.children.push(n),n[r].apply(n,arguments)}},this)};ut.prototype._init=function(t){var r=this._baseState;nr(r.parent===null),t.call(this),r.children=r.children.filter(function(i){return i._baseState.parent===this},this),nr.equal(r.children.length,1,"Root node can have only one child")};ut.prototype._useArgs=function(t){var r=this._baseState,i=t.filter(function(n){return n instanceof this.constructor},this);t=t.filter(function(n){return!(n instanceof this.constructor)},this),i.length!==0&&(nr(r.children===null),r.children=i,i.forEach(function(n){n._baseState.parent=this},this)),t.length!==0&&(nr(r.args===null),r.args=t,r.reverseArgs=t.map(function(n){if(typeof n!="object"||n.constructor!==Object)return n;var o={};return Object.keys(n).forEach(function(s){s==(s|0)&&(s|=0);var f=n[s];o[f]=s}),o}))};OC.forEach(function(e){ut.prototype[e]=function(){var r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}});z2.forEach(function(e){ut.prototype[e]=function(){var r=this._baseState,i=Array.prototype.slice.call(arguments);return nr(r.tag===null),r.tag=e,this._useArgs(i),this}});ut.prototype.use=function(t){nr(t);var r=this._baseState;return nr(r.use===null),r.use=t,this};ut.prototype.optional=function(){var t=this._baseState;return t.optional=!0,this};ut.prototype.def=function(t){var r=this._baseState;return nr(r.default===null),r.default=t,r.optional=!0,this};ut.prototype.explicit=function(t){var r=this._baseState;return nr(r.explicit===null&&r.implicit===null),r.explicit=t,this};ut.prototype.implicit=function(t){var r=this._baseState;return nr(r.explicit===null&&r.implicit===null),r.implicit=t,this};ut.prototype.obj=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,r.length!==0&&this._useArgs(r),this};ut.prototype.key=function(t){var r=this._baseState;return nr(r.key===null),r.key=t,this};ut.prototype.any=function(){var t=this._baseState;return t.any=!0,this};ut.prototype.choice=function(t){var r=this._baseState;return nr(r.choice===null),r.choice=t,this._useArgs(Object.keys(t).map(function(i){return t[i]})),this};ut.prototype.contains=function(t){var r=this._baseState;return nr(r.use===null),r.contains=t,this};ut.prototype._decode=function(t,r){var i=this._baseState;if(i.parent===null)return t.wrapResult(i.children[0]._decode(t,r));var n=i.default,o=!0,s=null;if(i.key!==null&&(s=t.enterKey(i.key)),i.optional){var f=null;if(i.explicit!==null?f=i.explicit:i.implicit!==null?f=i.implicit:i.tag!==null&&(f=i.tag),f===null&&!i.any){var h=t.save();try{i.choice===null?this._decodeGeneric(i.tag,t,r):this._decodeChoice(t,r),o=!0}catch{o=!1}t.restore(h)}else if(o=this._peekTag(t,f,i.any),t.isError(o))return o}var m;if(i.obj&&o&&(m=t.enterObject()),o){if(i.explicit!==null){var S=this._decodeTag(t,i.explicit);if(t.isError(S))return S;t=S}var x=t.offset;if(i.use===null&&i.choice===null){if(i.any)var h=t.save();var I=this._decodeTag(t,i.implicit!==null?i.implicit:i.tag,i.any);if(t.isError(I))return I;i.any?n=t.raw(h):t=I}if(r&&r.track&&i.tag!==null&&r.track(t.path(),x,t.length,"tagged"),r&&r.track&&i.tag!==null&&r.track(t.path(),t.offset,t.length,"content"),i.any?n=n:i.choice===null?n=this._decodeGeneric(i.tag,t,r):n=this._decodeChoice(t,r),t.isError(n))return n;if(!i.any&&i.choice===null&&i.children!==null&&i.children.forEach(function(N){N._decode(t,r)}),i.contains&&(i.tag==="octstr"||i.tag==="bitstr")){var T=new IC(n);n=this._getUse(i.contains,t._reporterState.obj)._decode(T,r)}}return i.obj&&o&&(n=t.leaveObject(m)),i.key!==null&&(n!==null||o===!0)?t.leaveKey(s,i.key,n):s!==null&&t.exitKey(s),n};ut.prototype._decodeGeneric=function(t,r,i){var n=this._baseState;return t==="seq"||t==="set"?null:t==="seqof"||t==="setof"?this._decodeList(r,t,n.args[0],i):/str$/.test(t)?this._decodeStr(r,t,i):t==="objid"&&n.args?this._decodeObjid(r,n.args[0],n.args[1],i):t==="objid"?this._decodeObjid(r,null,null,i):t==="gentime"||t==="utctime"?this._decodeTime(r,t,i):t==="null_"?this._decodeNull(r,i):t==="bool"?this._decodeBool(r,i):t==="objDesc"?this._decodeStr(r,t,i):t==="int"||t==="enum"?this._decodeInt(r,n.args&&n.args[0],i):n.use!==null?this._getUse(n.use,r._reporterState.obj)._decode(r,i):r.error("unknown tag: "+t)};ut.prototype._getUse=function(t,r){var i=this._baseState;return i.useDecoder=this._use(t,r),nr(i.useDecoder._baseState.parent===null),i.useDecoder=i.useDecoder._baseState.children[0],i.implicit!==i.useDecoder._baseState.implicit&&(i.useDecoder=i.useDecoder.clone(),i.useDecoder._baseState.implicit=i.implicit),i.useDecoder};ut.prototype._decodeChoice=function(t,r){var i=this._baseState,n=null,o=!1;return Object.keys(i.choice).some(function(s){var f=t.save(),h=i.choice[s];try{var m=h._decode(t,r);if(t.isError(m))return!1;n={type:s,value:m},o=!0}catch{return t.restore(f),!1}return!0},this),o?n:t.error("Choice not matched")};ut.prototype._createEncoderBuffer=function(t){return new xC(t,this.reporter)};ut.prototype._encode=function(t,r,i){var n=this._baseState;if(!(n.default!==null&&n.default===t)){var o=this._encodeValue(t,r,i);if(o!==void 0&&!this._skipDefault(o,r,i))return o}};ut.prototype._encodeValue=function(t,r,i){var n=this._baseState;if(n.parent===null)return n.children[0]._encode(t,r||new EC);var h=null;if(this.reporter=r,n.optional&&t===void 0)if(n.default!==null)t=n.default;else return;var o=null,s=!1;if(n.any)h=this._createEncoderBuffer(t);else if(n.choice)h=this._encodeChoice(t,r);else if(n.contains)o=this._getUse(n.contains,i)._encode(t,r),s=!0;else if(n.children)o=n.children.map(function(x){if(x._baseState.tag==="null_")return x._encode(null,r,t);if(x._baseState.key===null)return r.error("Child should have a key");var I=r.enterKey(x._baseState.key);if(typeof t!="object")return r.error("Child expected, but input is not object");var T=x._encode(t[x._baseState.key],r,t);return r.leaveKey(I),T},this).filter(function(x){return x}),o=this._createEncoderBuffer(o);else if(n.tag==="seqof"||n.tag==="setof"){if(!(n.args&&n.args.length===1))return r.error("Too many args for : "+n.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(x){var I=this._baseState;return this._getUse(I.args[0],t)._encode(x,r)},f))}else n.use!==null?h=this._getUse(n.use,i)._encode(t,r):(o=this._encodePrimitive(n.tag,t),s=!0);var h;if(!n.any&&n.choice===null){var m=n.implicit!==null?n.implicit:n.tag,S=n.implicit===null?"universal":"context";m===null?n.use===null&&r.error("Tag could be omitted only for .use()"):n.use===null&&(h=this._encodeComposite(m,s,S,o))}return n.explicit!==null&&(h=this._encodeComposite(n.explicit,!1,"context",h)),h};ut.prototype._encodeChoice=function(t,r){var i=this._baseState,n=i.choice[t.type];return n||nr(!1,t.type+" not found in "+JSON.stringify(Object.keys(i.choice))),n._encode(t.value,r)};ut.prototype._encodePrimitive=function(t,r){var i=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if(t==="objid"&&i.args)return this._encodeObjid(r,i.reverseArgs[0],i.args[1]);if(t==="objid")return this._encodeObjid(r,null,null);if(t==="gentime"||t==="utctime")return this._encodeTime(r,t);if(t==="null_")return this._encodeNull();if(t==="int"||t==="enum")return this._encodeInt(r,i.args&&i.reverseArgs[0]);if(t==="bool")return this._encodeBool(r);if(t==="objDesc")return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)};ut.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)};ut.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}});var aa=B(Z2=>{y();var Dh=Z2;Dh.Reporter=G2().Reporter;Dh.DecoderBuffer=Dp().DecoderBuffer;Dh.EncoderBuffer=Dp().EncoderBuffer;Dh.Node=Y2()});var X2=B($o=>{y();var $2=qp();$o.tagClass={0:"universal",1:"application",2:"context",3:"private"};$o.tagClassByName=$2._reverse($o.tagClass);$o.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"};$o.tagByName=$2._reverse($o.tag)});var qp=B(Q2=>{y();var J2=Q2;J2._reverse=function(t){var r={};return Object.keys(t).forEach(function(i){(i|0)==i&&(i=i|0);var n=t[i];r[n]=i}),r};J2.der=X2()});var Fp=B((rW,iE)=>{y();var TC=we(),Up=oa(),qh=Up.base,BC=Up.bignum,eE=Up.constants.der;function tE(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new _r,this.tree._init(e.body)}iE.exports=tE;tE.prototype.decode=function(t,r){return t instanceof qh.DecoderBuffer||(t=new qh.DecoderBuffer(t,r)),this.tree._decode(t,r)};function _r(e){qh.Node.call(this,"der",e)}TC(_r,qh.Node);_r.prototype._peekTag=function(t,r,i){if(t.isEmpty())return!1;var n=t.save(),o=Lp(t,'Failed to peek tag: "'+r+'"');return t.isError(o)?o:(t.restore(n),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||i)};_r.prototype._decodeTag=function(t,r,i){var n=Lp(t,'Failed to decode tag of "'+r+'"');if(t.isError(n))return n;var o=rE(t,n.primitive,'Failed to get length of "'+r+'"');if(t.isError(o))return o;if(!i&&n.tag!==r&&n.tagStr!==r&&n.tagStr+"of"!==r)return t.error('Failed to match tag: "'+r+'"');if(n.primitive||o!==null)return t.skip(o,'Failed to match body of: "'+r+'"');var s=t.save(),f=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(f)?f:(o=t.offset-s.offset,t.restore(s),t.skip(o,'Failed to match body of: "'+r+'"'))};_r.prototype._skipUntilEnd=function(t,r){for(;;){var i=Lp(t,r);if(t.isError(i))return i;var n=rE(t,i.primitive,r);if(t.isError(n))return n;var o;if(i.primitive||n!==null?o=t.skip(n):o=this._skipUntilEnd(t,r),t.isError(o))return o;if(i.tagStr==="end")break}};_r.prototype._decodeList=function(t,r,i,n){for(var o=[];!t.isEmpty();){var s=this._peekTag(t,"end");if(t.isError(s))return s;var f=i.decode(t,"der",n);if(t.isError(f)&&s)break;o.push(f)}return o};_r.prototype._decodeStr=function(t,r){if(r==="bitstr"){var i=t.readUInt8();return t.isError(i)?i:{unused:i,data:t.raw()}}else if(r==="bmpstr"){var n=t.raw();if(n.length%2===1)return t.error("Decoding of string type: bmpstr length mismatch");for(var o="",s=0;s<n.length/2;s++)o+=String.fromCharCode(n.readUInt16BE(s*2));return o}else if(r==="numstr"){var f=t.raw().toString("ascii");return this._isNumstr(f)?f:t.error("Decoding of string type: numstr unsupported characters")}else{if(r==="octstr")return t.raw();if(r==="objDesc")return t.raw();if(r==="printstr"){var h=t.raw().toString("ascii");return this._isPrintstr(h)?h:t.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(r)?t.raw().toString():t.error("Decoding of string type: "+r+" unsupported")}};_r.prototype._decodeObjid=function(t,r,i){for(var n,o=[],s=0;!t.isEmpty();){var f=t.readUInt8();s<<=7,s|=f&127,(f&128)===0&&(o.push(s),s=0)}f&128&&o.push(s);var h=o[0]/40|0,m=o[0]%40;if(i?n=o:n=[h,m].concat(o.slice(1)),r){var S=r[n.join(" ")];S===void 0&&(S=r[n.join(".")]),S!==void 0&&(n=S)}return n};_r.prototype._decodeTime=function(t,r){var i=t.raw().toString();if(r==="gentime")var n=i.slice(0,4)|0,o=i.slice(4,6)|0,s=i.slice(6,8)|0,f=i.slice(8,10)|0,h=i.slice(10,12)|0,m=i.slice(12,14)|0;else if(r==="utctime"){var n=i.slice(0,2)|0,o=i.slice(2,4)|0,s=i.slice(4,6)|0,f=i.slice(6,8)|0,h=i.slice(8,10)|0,m=i.slice(10,12)|0;n<70?n=2e3+n:n=1900+n}else return t.error("Decoding "+r+" time is not supported yet");return Date.UTC(n,o-1,s,f,h,m,0)};_r.prototype._decodeNull=function(t){return null};_r.prototype._decodeBool=function(t){var r=t.readUInt8();return t.isError(r)?r:r!==0};_r.prototype._decodeInt=function(t,r){var i=t.raw(),n=new BC(i);return r&&(n=r[n.toString(10)]||n),n};_r.prototype._use=function(t,r){return typeof t=="function"&&(t=t(r)),t._getDecoder("der").tree};function Lp(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=eE.tagClass[r>>6],n=(r&32)===0;if((r&31)===31){var o=r;for(r=0;(o&128)===128;){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=o&127}}else r&=31;var s=eE.tag[r];return{cls:i,primitive:n,tag:r,tagStr:s}}function rE(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&i===128)return null;if((i&128)===0)return i;var n=i&127;if(n>4)return e.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var s=e.readUInt8(r);if(e.isError(s))return s;i|=s}return i}});var oE=B((nW,nE)=>{y();var PC=we(),MC=xt().Buffer,jp=Fp();function Hp(e){jp.call(this,e),this.enc="pem"}PC(Hp,jp);nE.exports=Hp;Hp.prototype.decode=function(t,r){for(var i=t.toString().split(/[\r\n]+/g),n=r.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,f=-1,h=0;h<i.length;h++){var m=i[h].match(o);if(m!==null&&m[2]===n)if(s===-1){if(m[1]!=="BEGIN")break;s=h}else{if(m[1]!=="END")break;f=h;break}}if(s===-1||f===-1)throw new Error("PEM section not found for: "+n);var S=i.slice(s+1,f).join("");S.replace(/[^a-z0-9\+\/=]+/gi,"");var x=new MC(S,"base64");return jp.prototype.decode.call(this,x,r)}});var fE=B(aE=>{y();var sE=aE;sE.der=Fp();sE.pem=oE()});var Vp=B((fW,lE)=>{y();var kC=we(),cn=xt().Buffer,uE=oa(),cE=uE.base,Kp=uE.constants.der;function hE(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new ei,this.tree._init(e.body)}lE.exports=hE;hE.prototype.encode=function(t,r){return this.tree._encode(t,r).join()};function ei(e){cE.Node.call(this,"der",e)}kC(ei,cE.Node);ei.prototype._encodeComposite=function(t,r,i,n){var o=NC(t,r,i,this.reporter);if(n.length<128){var h=new cn(2);return h[0]=o,h[1]=n.length,this._createEncoderBuffer([h,n])}for(var s=1,f=n.length;f>=256;f>>=8)s++;var h=new cn(2+s);h[0]=o,h[1]=128|s;for(var f=1+s,m=n.length;m>0;f--,m>>=8)h[f]=m&255;return this._createEncoderBuffer([h,n])};ei.prototype._encodeStr=function(t,r){if(r==="bitstr")return this._createEncoderBuffer([t.unused|0,t.data]);if(r==="bmpstr"){for(var i=new cn(t.length*2),n=0;n<t.length;n++)i.writeUInt16BE(t.charCodeAt(n),n*2);return this._createEncoderBuffer(i)}else return r==="numstr"?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):r==="printstr"?this._isPrintstr(t)?this._createEncoderBuffer(t):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(t):r==="objDesc"?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+r+" unsupported")};ei.prototype._encodeObjid=function(t,r,i){if(typeof t=="string"){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=r[t].split(/[\s\.]+/g);for(var n=0;n<t.length;n++)t[n]|=0}else if(Array.isArray(t)){t=t.slice();for(var n=0;n<t.length;n++)t[n]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!i){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,t[0]*40+t[1])}for(var o=0,n=0;n<t.length;n++){var s=t[n];for(o++;s>=128;s>>=7)o++}for(var f=new cn(o),h=f.length-1,n=t.length-1;n>=0;n--){var s=t[n];for(f[h--]=s&127;(s>>=7)>0;)f[h--]=128|s&127}return this._createEncoderBuffer(f)};function Ur(e){return e<10?"0"+e:e}ei.prototype._encodeTime=function(t,r){var i,n=new Date(t);return r==="gentime"?i=[Ur(n.getFullYear()),Ur(n.getUTCMonth()+1),Ur(n.getUTCDate()),Ur(n.getUTCHours()),Ur(n.getUTCMinutes()),Ur(n.getUTCSeconds()),"Z"].join(""):r==="utctime"?i=[Ur(n.getFullYear()%100),Ur(n.getUTCMonth()+1),Ur(n.getUTCDate()),Ur(n.getUTCHours()),Ur(n.getUTCMinutes()),Ur(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(i,"octstr")};ei.prototype._encodeNull=function(){return this._createEncoderBuffer("")};ei.prototype._encodeInt=function(t,r){if(typeof t=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=r[t]}if(typeof t!="number"&&!cn.isBuffer(t)){var i=t.toArray();!t.sign&&i[0]&128&&i.unshift(0),t=new cn(i)}if(cn.isBuffer(t)){var n=t.length;t.length===0&&n++;var s=new cn(n);return t.copy(s),t.length===0&&(s[0]=0),this._createEncoderBuffer(s)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var n=1,o=t;o>=256;o>>=8)n++;for(var s=new Array(n),o=s.length-1;o>=0;o--)s[o]=t&255,t>>=8;return s[0]&128&&s.unshift(0),this._createEncoderBuffer(new cn(s))};ei.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)};ei.prototype._use=function(t,r){return typeof t=="function"&&(t=t(r)),t._getEncoder("der").tree};ei.prototype._skipDefault=function(t,r,i){var n=this._baseState,o;if(n.default===null)return!1;var s=t.join();if(n.defaultBuffer===void 0&&(n.defaultBuffer=this._encodeValue(n.default,r,i).join()),s.length!==n.defaultBuffer.length)return!1;for(o=0;o<s.length;o++)if(s[o]!==n.defaultBuffer[o])return!1;return!0};function NC(e,t,r,i){var n;if(e==="seqof"?e="seq":e==="setof"&&(e="set"),Kp.tagByName.hasOwnProperty(e))n=Kp.tagByName[e];else if(typeof e=="number"&&(e|0)===e)n=e;else return i.error("Unknown tag: "+e);return n>=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=Kp.tagClassByName[r||"universal"]<<6,n)}});var pE=B((cW,dE)=>{y();var CC=we(),Gp=Vp();function zp(e){Gp.call(this,e),this.enc="pem"}CC(zp,Gp);dE.exports=zp;zp.prototype.encode=function(t,r){for(var i=Gp.prototype.encode.call(this,t),n=i.toString("base64"),o=["-----BEGIN "+r.label+"-----"],s=0;s<n.length;s+=64)o.push(n.slice(s,s+64));return o.push("-----END "+r.label+"-----"),o.join(`
14
- `)}});var yE=B(vE=>{y();var gE=vE;gE.der=Vp();gE.pem=pE()});var oa=B(mE=>{y();var fa=mE;fa.bignum=$i();fa.define=K2().define;fa.base=aa();fa.constants=qp();fa.decoders=fE();fa.encoders=yE()});var SE=B((vW,wE)=>{"use strict";y();var ti=oa(),bE=ti.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),DC=ti.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),Wp=ti.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),qC=ti.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(Wp),this.key("subjectPublicKey").bitstr())}),UC=ti.define("RelativeDistinguishedName",function(){this.setof(DC)}),LC=ti.define("RDNSequence",function(){this.seqof(UC)}),_E=ti.define("Name",function(){this.choice({rdnSequence:this.use(LC)})}),FC=ti.define("Validity",function(){this.seq().obj(this.key("notBefore").use(bE),this.key("notAfter").use(bE))}),jC=ti.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),HC=ti.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(Wp),this.key("issuer").use(_E),this.key("validity").use(FC),this.key("subject").use(_E),this.key("subjectPublicKeyInfo").use(qC),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(jC).optional())}),KC=ti.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(HC),this.key("signatureAlgorithm").use(Wp),this.key("signatureValue").bitstr())});wE.exports=KC});var xE=B(ii=>{"use strict";y();var ri=oa();ii.certificate=SE();var VC=ri.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())});ii.RSAPrivateKey=VC;var GC=ri.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});ii.RSAPublicKey=GC;var EE=ri.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())}),zC=ri.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(EE),this.key("subjectPublicKey").bitstr())});ii.PublicKey=zC;var WC=ri.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(EE),this.key("subjectPrivateKey").octstr())});ii.PrivateKey=WC;var YC=ri.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())});ii.EncryptedPrivateKey=YC;var ZC=ri.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())});ii.DSAPrivateKey=ZC;ii.DSAparam=ri.define("DSAparam",function(){this.int()});var $C=ri.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),XC=ri.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use($C),this.key("publicKey").optional().explicit(1).bitstr())});ii.ECPrivateKey=XC;ii.signature=ri.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})});var IE=B((_W,JC)=>{JC.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 OE=B((wW,AE)=>{"use strict";y();var QC=/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,e7=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,t7=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,r7=Gf(),i7=Bh(),Uh=We().Buffer;AE.exports=function(e,t){var r=e.toString(),i=r.match(QC),n;if(i){var s="aes"+i[1],f=Uh.from(i[2],"hex"),h=Uh.from(i[3].replace(/[\r\n]/g,""),"base64"),m=r7(t,f.slice(0,8),parseInt(i[1],10)).key,S=[],x=i7.createDecipheriv(s,m,f);S.push(x.update(h)),S.push(x.final()),n=Uh.concat(S)}else{var o=r.match(t7);n=Uh.from(o[2].replace(/[\r\n]/g,""),"base64")}var I=r.match(e7)[1];return{tag:I,data:n}}});var Zp=B((EW,TE)=>{"use strict";y();var lr=xE(),n7=IE(),o7=OE(),s7=Bh(),a7=op().pbkdf2Sync,Yp=We().Buffer;function f7(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=n7[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,s=e.subjectPrivateKey,f=parseInt(n.split("-")[1],10)/8,h=a7(t,r,i,f,"sha1"),m=s7.createDecipheriv(n,h,o),S=[];return S.push(m.update(s)),S.push(m.final()),Yp.concat(S)}function RE(e){var t;typeof e=="object"&&!Yp.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e=="string"&&(e=Yp.from(e));var r=o7(e,t),i=r.tag,n=r.data,o,s;switch(i){case"CERTIFICATE":s=lr.certificate.decode(n,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(s||(s=lr.PublicKey.decode(n,"der")),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return lr.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=lr.DSAparam.decode(s.subjectPublicKey.data,"der"),{type:"dsa",data:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":n=lr.EncryptedPrivateKey.decode(n,"der"),n=f7(n,t);case"PRIVATE KEY":switch(s=lr.PrivateKey.decode(n,"der"),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return lr.RSAPrivateKey.decode(s.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:s.algorithm.curve,privateKey:lr.ECPrivateKey.decode(s.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return s.algorithm.params.priv_key=lr.DSAparam.decode(s.subjectPrivateKey,"der"),{type:"dsa",params:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return lr.RSAPublicKey.decode(n,"der");case"RSA PRIVATE KEY":return lr.RSAPrivateKey.decode(n,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:lr.DSAPrivateKey.decode(n,"der")};case"EC PRIVATE KEY":return n=lr.ECPrivateKey.decode(n,"der"),{curve:n.parameters.value,privateKey:n.privateKey};default:throw new Error("unknown key type "+i)}}RE.signature=lr.signature;TE.exports=RE});var Xp=B((IW,BE)=>{y();var u7=qf(),$p=We().Buffer;BE.exports=function(e,t){for(var r=$p.alloc(0),i=0,n;r.length<t;)n=c7(i++),r=$p.concat([r,u7("sha1").update(e).update(n).digest()]);return r.slice(0,t)};function c7(e){var t=$p.allocUnsafe(4);return t.writeUInt32BE(e,0),t}});var Jp=B((OW,PE)=>{y();PE.exports=function(t,r){for(var i=t.length,n=-1;++n<i;)t[n]^=r[n];return t}});var Qp=B((TW,kE)=>{y();var ME=$i(),h7=We().Buffer;function l7(e,t){return h7.from(e.toRed(ME.mont(t.modulus)).redPow(new ME(t.publicExponent)).fromRed().toArray())}kE.exports=l7});var CE=B((NE,eg)=>{y();(function(e,t){"use strict";function r(d,a){if(!d)throw new Error(a||"Assertion failed")}function i(d,a){d.super_=a;var u=function(){};u.prototype=a.prototype,d.prototype=new u,d.prototype.constructor=d}function n(d,a,u){if(n.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((a==="le"||a==="be")&&(u=a,a=10),this._init(d||0,a||10,u||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=xt().Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,u){return a.cmp(u)>0?a:u},n.min=function(a,u){return a.cmp(u)<0?a:u},n.prototype._init=function(a,u,p){if(typeof a=="number")return this._initNumber(a,u,p);if(typeof a=="object")return this._initArray(a,u,p);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),a=a.toString().replace(/\s+/g,"");var b=0;a[0]==="-"&&(b++,this.negative=1),b<a.length&&(u===16?this._parseHex(a,b,p):(this._parseBase(a,u,b),p==="le"&&this._initArray(this.toArray(),u,p)))},n.prototype._initNumber=function(a,u,p){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(r(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),p==="le"&&this._initArray(this.toArray(),u,p)},n.prototype._initArray=function(a,u,p){if(r(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var v,c,w=0;if(p==="be")for(b=a.length-1,v=0;b>=0;b-=3)c=a[b]|a[b-1]<<8|a[b-2]<<16,this.words[v]|=c<<w&67108863,this.words[v+1]=c>>>26-w&67108863,w+=24,w>=26&&(w-=26,v++);else if(p==="le")for(b=0,v=0;b<a.length;b+=3)c=a[b]|a[b+1]<<8|a[b+2]<<16,this.words[v]|=c<<w&67108863,this.words[v+1]=c>>>26-w&67108863,w+=24,w>=26&&(w-=26,v++);return this._strip()};function s(d,a){var u=d.charCodeAt(a);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;r(!1,"Invalid character in "+d)}function f(d,a,u){var p=s(d,u);return u-1>=a&&(p|=s(d,u-1)<<4),p}n.prototype._parseHex=function(a,u,p){this.length=Math.ceil((a.length-u)/6),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var v=0,c=0,w;if(p==="be")for(b=a.length-1;b>=u;b-=2)w=f(a,u,b)<<v,this.words[c]|=w&67108863,v>=18?(v-=18,c+=1,this.words[c]|=w>>>26):v+=8;else{var A=a.length-u;for(b=A%2===0?u+1:u;b<a.length;b+=2)w=f(a,u,b)<<v,this.words[c]|=w&67108863,v>=18?(v-=18,c+=1,this.words[c]|=w>>>26):v+=8}this._strip()};function h(d,a,u,p){for(var b=0,v=0,c=Math.min(d.length,u),w=a;w<c;w++){var A=d.charCodeAt(w)-48;b*=p,A>=49?v=A-49+10:A>=17?v=A-17+10:v=A,r(A>=0&&v<p,"Invalid character"),b+=v}return b}n.prototype._parseBase=function(a,u,p){this.words=[0],this.length=1;for(var b=0,v=1;v<=67108863;v*=u)b++;b--,v=v/u|0;for(var c=a.length-p,w=c%b,A=Math.min(c,c-w)+p,g=0,R=p;R<A;R+=b)g=h(a,R,R+b,u),this.imuln(v),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(w!==0){var U=1;for(g=h(a,R,a.length,u),R=0;R<w;R++)U*=u;this.imuln(U),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},n.prototype.copy=function(a){a.words=new Array(this.length);for(var u=0;u<this.length;u++)a.words[u]=this.words[u];a.length=this.length,a.negative=this.negative,a.red=this.red};function m(d,a){d.words=a.words,d.length=a.length,d.negative=a.negative,d.red=a.red}if(n.prototype._move=function(a){m(a,this)},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{n.prototype.inspect=S}else n.prototype.inspect=S;function S(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var x=["","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"],I=[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],T=[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];n.prototype.toString=function(a,u){a=a||10,u=u|0||1;var p;if(a===16||a==="hex"){p="";for(var b=0,v=0,c=0;c<this.length;c++){var w=this.words[c],A=((w<<b|v)&16777215).toString(16);v=w>>>24-b&16777215,b+=2,b>=26&&(b-=26,c--),v!==0||c!==this.length-1?p=x[6-A.length]+A+p:p=A+p}for(v!==0&&(p=v.toString(16)+p);p.length%u!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}if(a===(a|0)&&a>=2&&a<=36){var g=I[a],R=T[a];p="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(R).toString(a);U=U.idivn(R),U.isZero()?p=H+p:p=x[g-H.length]+H+p}for(this.isZero()&&(p="0"+p);p.length%u!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(a,u){return this.toArrayLike(o,a,u)}),n.prototype.toArray=function(a,u){return this.toArrayLike(Array,a,u)};var M=function(a,u){return a.allocUnsafe?a.allocUnsafe(u):new a(u)};n.prototype.toArrayLike=function(a,u,p){this._strip();var b=this.byteLength(),v=p||Math.max(1,b);r(b<=v,"byte array longer than desired length"),r(v>0,"Requested array length <= 0");var c=M(a,v),w=u==="le"?"LE":"BE";return this["_toArrayLike"+w](c,b),c},n.prototype._toArrayLikeLE=function(a,u){for(var p=0,b=0,v=0,c=0;v<this.length;v++){var w=this.words[v]<<c|b;a[p++]=w&255,p<a.length&&(a[p++]=w>>8&255),p<a.length&&(a[p++]=w>>16&255),c===6?(p<a.length&&(a[p++]=w>>24&255),b=0,c=0):(b=w>>>24,c+=2)}if(p<a.length)for(a[p++]=b;p<a.length;)a[p++]=0},n.prototype._toArrayLikeBE=function(a,u){for(var p=a.length-1,b=0,v=0,c=0;v<this.length;v++){var w=this.words[v]<<c|b;a[p--]=w&255,p>=0&&(a[p--]=w>>8&255),p>=0&&(a[p--]=w>>16&255),c===6?(p>=0&&(a[p--]=w>>24&255),b=0,c=0):(b=w>>>24,c+=2)}if(p>=0)for(a[p--]=b;p>=0;)a[p--]=0},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var u=a,p=0;return u>=4096&&(p+=13,u>>>=13),u>=64&&(p+=7,u>>>=7),u>=8&&(p+=4,u>>>=4),u>=2&&(p+=2,u>>>=2),p+u},n.prototype._zeroBits=function(a){if(a===0)return 26;var u=a,p=0;return(u&8191)===0&&(p+=13,u>>>=13),(u&127)===0&&(p+=7,u>>>=7),(u&15)===0&&(p+=4,u>>>=4),(u&3)===0&&(p+=2,u>>>=2),(u&1)===0&&p++,p},n.prototype.bitLength=function(){var a=this.words[this.length-1],u=this._countBits(a);return(this.length-1)*26+u};function N(d){for(var a=new Array(d.bitLength()),u=0;u<a.length;u++){var p=u/26|0,b=u%26;a[u]=d.words[p]>>>b&1}return a}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,u=0;u<this.length;u++){var p=this._zeroBits(this.words[u]);if(a+=p,p!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var u=0;u<a.length;u++)this.words[u]=this.words[u]|a.words[u];return this._strip()},n.prototype.ior=function(a){return r((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var u;this.length>a.length?u=a:u=this;for(var p=0;p<u.length;p++)this.words[p]=this.words[p]&a.words[p];return this.length=u.length,this._strip()},n.prototype.iand=function(a){return r((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var u,p;this.length>a.length?(u=this,p=a):(u=a,p=this);for(var b=0;b<p.length;b++)this.words[b]=u.words[b]^p.words[b];if(this!==u)for(;b<u.length;b++)this.words[b]=u.words[b];return this.length=u.length,this._strip()},n.prototype.ixor=function(a){return r((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){r(typeof a=="number"&&a>=0);var u=Math.ceil(a/26)|0,p=a%26;this._expand(u),p>0&&u--;for(var b=0;b<u;b++)this.words[b]=~this.words[b]&67108863;return p>0&&(this.words[b]=~this.words[b]&67108863>>26-p),this._strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,u){r(typeof a=="number"&&a>=0);var p=a/26|0,b=a%26;return this._expand(p+1),u?this.words[p]=this.words[p]|1<<b:this.words[p]=this.words[p]&~(1<<b),this._strip()},n.prototype.iadd=function(a){var u;if(this.negative!==0&&a.negative===0)return this.negative=0,u=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,u=this.isub(a),a.negative=1,u._normSign();var p,b;this.length>a.length?(p=this,b=a):(p=a,b=this);for(var v=0,c=0;c<b.length;c++)u=(p.words[c]|0)+(b.words[c]|0)+v,this.words[c]=u&67108863,v=u>>>26;for(;v!==0&&c<p.length;c++)u=(p.words[c]|0)+v,this.words[c]=u&67108863,v=u>>>26;if(this.length=p.length,v!==0)this.words[this.length]=v,this.length++;else if(p!==this)for(;c<p.length;c++)this.words[c]=p.words[c];return this},n.prototype.add=function(a){var u;return a.negative!==0&&this.negative===0?(a.negative=0,u=this.sub(a),a.negative^=1,u):a.negative===0&&this.negative!==0?(this.negative=0,u=a.sub(this),this.negative=1,u):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var u=this.iadd(a);return a.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var p=this.cmp(a);if(p===0)return this.negative=0,this.length=1,this.words[0]=0,this;var b,v;p>0?(b=this,v=a):(b=a,v=this);for(var c=0,w=0;w<v.length;w++)u=(b.words[w]|0)-(v.words[w]|0)+c,c=u>>26,this.words[w]=u&67108863;for(;c!==0&&w<b.length;w++)u=(b.words[w]|0)+c,c=u>>26,this.words[w]=u&67108863;if(c===0&&w<b.length&&b!==this)for(;w<b.length;w++)this.words[w]=b.words[w];return this.length=Math.max(this.length,w),b!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function D(d,a,u){u.negative=a.negative^d.negative;var p=d.length+a.length|0;u.length=p,p=p-1|0;var b=d.words[0]|0,v=a.words[0]|0,c=b*v,w=c&67108863,A=c/67108864|0;u.words[0]=w;for(var g=1;g<p;g++){for(var R=A>>>26,U=A&67108863,H=Math.min(g,a.length-1),z=Math.max(0,g-d.length+1);z<=H;z++){var re=g-z|0;b=d.words[re]|0,v=a.words[z]|0,c=b*v+U,R+=c/67108864|0,U=c&67108863}u.words[g]=U|0,A=R|0}return A!==0?u.words[g]=A|0:u.length--,u._strip()}var j=function(a,u,p){var b=a.words,v=u.words,c=p.words,w=0,A,g,R,U=b[0]|0,H=U&8191,z=U>>>13,re=b[1]|0,oe=re&8191,k=re>>>13,q=b[2]|0,L=q&8191,V=q>>>13,fe=b[3]|0,Z=fe&8191,X=fe>>>13,ge=b[4]|0,ee=ge&8191,ae=ge>>>13,ht=b[5]|0,pe=ht&8191,J=ht>>>13,_e=b[6]|0,he=_e&8191,le=_e>>>13,Rr=b[7]|0,xe=Rr&8191,Se=Rr>>>13,no=b[8]|0,Ie=no&8191,Ae=no>>>13,Ka=b[9]|0,Oe=Ka&8191,Re=Ka>>>13,Va=v[0]|0,Te=Va&8191,Be=Va>>>13,Ga=v[1]|0,Pe=Ga&8191,Me=Ga>>>13,za=v[2]|0,ke=za&8191,Ne=za>>>13,Wa=v[3]|0,Ce=Wa&8191,De=Wa>>>13,Ya=v[4]|0,qe=Ya&8191,Ue=Ya>>>13,Za=v[5]|0,Le=Za&8191,Fe=Za>>>13,$a=v[6]|0,je=$a&8191,He=$a>>>13,Xa=v[7]|0,Ke=Xa&8191,Ve=Xa>>>13,Ja=v[8]|0,Ge=Ja&8191,ze=Ja>>>13,xs=v[9]|0,wt=xs&8191,St=xs>>>13;p.negative=a.negative^u.negative,p.length=19,A=Math.imul(H,Te),g=Math.imul(H,Be),g=g+Math.imul(z,Te)|0,R=Math.imul(z,Be);var oo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(oo>>>26)|0,oo&=67108863,A=Math.imul(oe,Te),g=Math.imul(oe,Be),g=g+Math.imul(k,Te)|0,R=Math.imul(k,Be),A=A+Math.imul(H,Pe)|0,g=g+Math.imul(H,Me)|0,g=g+Math.imul(z,Pe)|0,R=R+Math.imul(z,Me)|0;var so=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(so>>>26)|0,so&=67108863,A=Math.imul(L,Te),g=Math.imul(L,Be),g=g+Math.imul(V,Te)|0,R=Math.imul(V,Be),A=A+Math.imul(oe,Pe)|0,g=g+Math.imul(oe,Me)|0,g=g+Math.imul(k,Pe)|0,R=R+Math.imul(k,Me)|0,A=A+Math.imul(H,ke)|0,g=g+Math.imul(H,Ne)|0,g=g+Math.imul(z,ke)|0,R=R+Math.imul(z,Ne)|0;var ao=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ao>>>26)|0,ao&=67108863,A=Math.imul(Z,Te),g=Math.imul(Z,Be),g=g+Math.imul(X,Te)|0,R=Math.imul(X,Be),A=A+Math.imul(L,Pe)|0,g=g+Math.imul(L,Me)|0,g=g+Math.imul(V,Pe)|0,R=R+Math.imul(V,Me)|0,A=A+Math.imul(oe,ke)|0,g=g+Math.imul(oe,Ne)|0,g=g+Math.imul(k,ke)|0,R=R+Math.imul(k,Ne)|0,A=A+Math.imul(H,Ce)|0,g=g+Math.imul(H,De)|0,g=g+Math.imul(z,Ce)|0,R=R+Math.imul(z,De)|0;var fo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(fo>>>26)|0,fo&=67108863,A=Math.imul(ee,Te),g=Math.imul(ee,Be),g=g+Math.imul(ae,Te)|0,R=Math.imul(ae,Be),A=A+Math.imul(Z,Pe)|0,g=g+Math.imul(Z,Me)|0,g=g+Math.imul(X,Pe)|0,R=R+Math.imul(X,Me)|0,A=A+Math.imul(L,ke)|0,g=g+Math.imul(L,Ne)|0,g=g+Math.imul(V,ke)|0,R=R+Math.imul(V,Ne)|0,A=A+Math.imul(oe,Ce)|0,g=g+Math.imul(oe,De)|0,g=g+Math.imul(k,Ce)|0,R=R+Math.imul(k,De)|0,A=A+Math.imul(H,qe)|0,g=g+Math.imul(H,Ue)|0,g=g+Math.imul(z,qe)|0,R=R+Math.imul(z,Ue)|0;var uo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(uo>>>26)|0,uo&=67108863,A=Math.imul(pe,Te),g=Math.imul(pe,Be),g=g+Math.imul(J,Te)|0,R=Math.imul(J,Be),A=A+Math.imul(ee,Pe)|0,g=g+Math.imul(ee,Me)|0,g=g+Math.imul(ae,Pe)|0,R=R+Math.imul(ae,Me)|0,A=A+Math.imul(Z,ke)|0,g=g+Math.imul(Z,Ne)|0,g=g+Math.imul(X,ke)|0,R=R+Math.imul(X,Ne)|0,A=A+Math.imul(L,Ce)|0,g=g+Math.imul(L,De)|0,g=g+Math.imul(V,Ce)|0,R=R+Math.imul(V,De)|0,A=A+Math.imul(oe,qe)|0,g=g+Math.imul(oe,Ue)|0,g=g+Math.imul(k,qe)|0,R=R+Math.imul(k,Ue)|0,A=A+Math.imul(H,Le)|0,g=g+Math.imul(H,Fe)|0,g=g+Math.imul(z,Le)|0,R=R+Math.imul(z,Fe)|0;var co=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(co>>>26)|0,co&=67108863,A=Math.imul(he,Te),g=Math.imul(he,Be),g=g+Math.imul(le,Te)|0,R=Math.imul(le,Be),A=A+Math.imul(pe,Pe)|0,g=g+Math.imul(pe,Me)|0,g=g+Math.imul(J,Pe)|0,R=R+Math.imul(J,Me)|0,A=A+Math.imul(ee,ke)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(ae,ke)|0,R=R+Math.imul(ae,Ne)|0,A=A+Math.imul(Z,Ce)|0,g=g+Math.imul(Z,De)|0,g=g+Math.imul(X,Ce)|0,R=R+Math.imul(X,De)|0,A=A+Math.imul(L,qe)|0,g=g+Math.imul(L,Ue)|0,g=g+Math.imul(V,qe)|0,R=R+Math.imul(V,Ue)|0,A=A+Math.imul(oe,Le)|0,g=g+Math.imul(oe,Fe)|0,g=g+Math.imul(k,Le)|0,R=R+Math.imul(k,Fe)|0,A=A+Math.imul(H,je)|0,g=g+Math.imul(H,He)|0,g=g+Math.imul(z,je)|0,R=R+Math.imul(z,He)|0;var ho=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ho>>>26)|0,ho&=67108863,A=Math.imul(xe,Te),g=Math.imul(xe,Be),g=g+Math.imul(Se,Te)|0,R=Math.imul(Se,Be),A=A+Math.imul(he,Pe)|0,g=g+Math.imul(he,Me)|0,g=g+Math.imul(le,Pe)|0,R=R+Math.imul(le,Me)|0,A=A+Math.imul(pe,ke)|0,g=g+Math.imul(pe,Ne)|0,g=g+Math.imul(J,ke)|0,R=R+Math.imul(J,Ne)|0,A=A+Math.imul(ee,Ce)|0,g=g+Math.imul(ee,De)|0,g=g+Math.imul(ae,Ce)|0,R=R+Math.imul(ae,De)|0,A=A+Math.imul(Z,qe)|0,g=g+Math.imul(Z,Ue)|0,g=g+Math.imul(X,qe)|0,R=R+Math.imul(X,Ue)|0,A=A+Math.imul(L,Le)|0,g=g+Math.imul(L,Fe)|0,g=g+Math.imul(V,Le)|0,R=R+Math.imul(V,Fe)|0,A=A+Math.imul(oe,je)|0,g=g+Math.imul(oe,He)|0,g=g+Math.imul(k,je)|0,R=R+Math.imul(k,He)|0,A=A+Math.imul(H,Ke)|0,g=g+Math.imul(H,Ve)|0,g=g+Math.imul(z,Ke)|0,R=R+Math.imul(z,Ve)|0;var lo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(lo>>>26)|0,lo&=67108863,A=Math.imul(Ie,Te),g=Math.imul(Ie,Be),g=g+Math.imul(Ae,Te)|0,R=Math.imul(Ae,Be),A=A+Math.imul(xe,Pe)|0,g=g+Math.imul(xe,Me)|0,g=g+Math.imul(Se,Pe)|0,R=R+Math.imul(Se,Me)|0,A=A+Math.imul(he,ke)|0,g=g+Math.imul(he,Ne)|0,g=g+Math.imul(le,ke)|0,R=R+Math.imul(le,Ne)|0,A=A+Math.imul(pe,Ce)|0,g=g+Math.imul(pe,De)|0,g=g+Math.imul(J,Ce)|0,R=R+Math.imul(J,De)|0,A=A+Math.imul(ee,qe)|0,g=g+Math.imul(ee,Ue)|0,g=g+Math.imul(ae,qe)|0,R=R+Math.imul(ae,Ue)|0,A=A+Math.imul(Z,Le)|0,g=g+Math.imul(Z,Fe)|0,g=g+Math.imul(X,Le)|0,R=R+Math.imul(X,Fe)|0,A=A+Math.imul(L,je)|0,g=g+Math.imul(L,He)|0,g=g+Math.imul(V,je)|0,R=R+Math.imul(V,He)|0,A=A+Math.imul(oe,Ke)|0,g=g+Math.imul(oe,Ve)|0,g=g+Math.imul(k,Ke)|0,R=R+Math.imul(k,Ve)|0,A=A+Math.imul(H,Ge)|0,g=g+Math.imul(H,ze)|0,g=g+Math.imul(z,Ge)|0,R=R+Math.imul(z,ze)|0;var po=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(po>>>26)|0,po&=67108863,A=Math.imul(Oe,Te),g=Math.imul(Oe,Be),g=g+Math.imul(Re,Te)|0,R=Math.imul(Re,Be),A=A+Math.imul(Ie,Pe)|0,g=g+Math.imul(Ie,Me)|0,g=g+Math.imul(Ae,Pe)|0,R=R+Math.imul(Ae,Me)|0,A=A+Math.imul(xe,ke)|0,g=g+Math.imul(xe,Ne)|0,g=g+Math.imul(Se,ke)|0,R=R+Math.imul(Se,Ne)|0,A=A+Math.imul(he,Ce)|0,g=g+Math.imul(he,De)|0,g=g+Math.imul(le,Ce)|0,R=R+Math.imul(le,De)|0,A=A+Math.imul(pe,qe)|0,g=g+Math.imul(pe,Ue)|0,g=g+Math.imul(J,qe)|0,R=R+Math.imul(J,Ue)|0,A=A+Math.imul(ee,Le)|0,g=g+Math.imul(ee,Fe)|0,g=g+Math.imul(ae,Le)|0,R=R+Math.imul(ae,Fe)|0,A=A+Math.imul(Z,je)|0,g=g+Math.imul(Z,He)|0,g=g+Math.imul(X,je)|0,R=R+Math.imul(X,He)|0,A=A+Math.imul(L,Ke)|0,g=g+Math.imul(L,Ve)|0,g=g+Math.imul(V,Ke)|0,R=R+Math.imul(V,Ve)|0,A=A+Math.imul(oe,Ge)|0,g=g+Math.imul(oe,ze)|0,g=g+Math.imul(k,Ge)|0,R=R+Math.imul(k,ze)|0,A=A+Math.imul(H,wt)|0,g=g+Math.imul(H,St)|0,g=g+Math.imul(z,wt)|0,R=R+Math.imul(z,St)|0;var go=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(go>>>26)|0,go&=67108863,A=Math.imul(Oe,Pe),g=Math.imul(Oe,Me),g=g+Math.imul(Re,Pe)|0,R=Math.imul(Re,Me),A=A+Math.imul(Ie,ke)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Ae,ke)|0,R=R+Math.imul(Ae,Ne)|0,A=A+Math.imul(xe,Ce)|0,g=g+Math.imul(xe,De)|0,g=g+Math.imul(Se,Ce)|0,R=R+Math.imul(Se,De)|0,A=A+Math.imul(he,qe)|0,g=g+Math.imul(he,Ue)|0,g=g+Math.imul(le,qe)|0,R=R+Math.imul(le,Ue)|0,A=A+Math.imul(pe,Le)|0,g=g+Math.imul(pe,Fe)|0,g=g+Math.imul(J,Le)|0,R=R+Math.imul(J,Fe)|0,A=A+Math.imul(ee,je)|0,g=g+Math.imul(ee,He)|0,g=g+Math.imul(ae,je)|0,R=R+Math.imul(ae,He)|0,A=A+Math.imul(Z,Ke)|0,g=g+Math.imul(Z,Ve)|0,g=g+Math.imul(X,Ke)|0,R=R+Math.imul(X,Ve)|0,A=A+Math.imul(L,Ge)|0,g=g+Math.imul(L,ze)|0,g=g+Math.imul(V,Ge)|0,R=R+Math.imul(V,ze)|0,A=A+Math.imul(oe,wt)|0,g=g+Math.imul(oe,St)|0,g=g+Math.imul(k,wt)|0,R=R+Math.imul(k,St)|0;var vo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(vo>>>26)|0,vo&=67108863,A=Math.imul(Oe,ke),g=Math.imul(Oe,Ne),g=g+Math.imul(Re,ke)|0,R=Math.imul(Re,Ne),A=A+Math.imul(Ie,Ce)|0,g=g+Math.imul(Ie,De)|0,g=g+Math.imul(Ae,Ce)|0,R=R+Math.imul(Ae,De)|0,A=A+Math.imul(xe,qe)|0,g=g+Math.imul(xe,Ue)|0,g=g+Math.imul(Se,qe)|0,R=R+Math.imul(Se,Ue)|0,A=A+Math.imul(he,Le)|0,g=g+Math.imul(he,Fe)|0,g=g+Math.imul(le,Le)|0,R=R+Math.imul(le,Fe)|0,A=A+Math.imul(pe,je)|0,g=g+Math.imul(pe,He)|0,g=g+Math.imul(J,je)|0,R=R+Math.imul(J,He)|0,A=A+Math.imul(ee,Ke)|0,g=g+Math.imul(ee,Ve)|0,g=g+Math.imul(ae,Ke)|0,R=R+Math.imul(ae,Ve)|0,A=A+Math.imul(Z,Ge)|0,g=g+Math.imul(Z,ze)|0,g=g+Math.imul(X,Ge)|0,R=R+Math.imul(X,ze)|0,A=A+Math.imul(L,wt)|0,g=g+Math.imul(L,St)|0,g=g+Math.imul(V,wt)|0,R=R+Math.imul(V,St)|0;var yo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(yo>>>26)|0,yo&=67108863,A=Math.imul(Oe,Ce),g=Math.imul(Oe,De),g=g+Math.imul(Re,Ce)|0,R=Math.imul(Re,De),A=A+Math.imul(Ie,qe)|0,g=g+Math.imul(Ie,Ue)|0,g=g+Math.imul(Ae,qe)|0,R=R+Math.imul(Ae,Ue)|0,A=A+Math.imul(xe,Le)|0,g=g+Math.imul(xe,Fe)|0,g=g+Math.imul(Se,Le)|0,R=R+Math.imul(Se,Fe)|0,A=A+Math.imul(he,je)|0,g=g+Math.imul(he,He)|0,g=g+Math.imul(le,je)|0,R=R+Math.imul(le,He)|0,A=A+Math.imul(pe,Ke)|0,g=g+Math.imul(pe,Ve)|0,g=g+Math.imul(J,Ke)|0,R=R+Math.imul(J,Ve)|0,A=A+Math.imul(ee,Ge)|0,g=g+Math.imul(ee,ze)|0,g=g+Math.imul(ae,Ge)|0,R=R+Math.imul(ae,ze)|0,A=A+Math.imul(Z,wt)|0,g=g+Math.imul(Z,St)|0,g=g+Math.imul(X,wt)|0,R=R+Math.imul(X,St)|0;var mo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(mo>>>26)|0,mo&=67108863,A=Math.imul(Oe,qe),g=Math.imul(Oe,Ue),g=g+Math.imul(Re,qe)|0,R=Math.imul(Re,Ue),A=A+Math.imul(Ie,Le)|0,g=g+Math.imul(Ie,Fe)|0,g=g+Math.imul(Ae,Le)|0,R=R+Math.imul(Ae,Fe)|0,A=A+Math.imul(xe,je)|0,g=g+Math.imul(xe,He)|0,g=g+Math.imul(Se,je)|0,R=R+Math.imul(Se,He)|0,A=A+Math.imul(he,Ke)|0,g=g+Math.imul(he,Ve)|0,g=g+Math.imul(le,Ke)|0,R=R+Math.imul(le,Ve)|0,A=A+Math.imul(pe,Ge)|0,g=g+Math.imul(pe,ze)|0,g=g+Math.imul(J,Ge)|0,R=R+Math.imul(J,ze)|0,A=A+Math.imul(ee,wt)|0,g=g+Math.imul(ee,St)|0,g=g+Math.imul(ae,wt)|0,R=R+Math.imul(ae,St)|0;var bo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(bo>>>26)|0,bo&=67108863,A=Math.imul(Oe,Le),g=Math.imul(Oe,Fe),g=g+Math.imul(Re,Le)|0,R=Math.imul(Re,Fe),A=A+Math.imul(Ie,je)|0,g=g+Math.imul(Ie,He)|0,g=g+Math.imul(Ae,je)|0,R=R+Math.imul(Ae,He)|0,A=A+Math.imul(xe,Ke)|0,g=g+Math.imul(xe,Ve)|0,g=g+Math.imul(Se,Ke)|0,R=R+Math.imul(Se,Ve)|0,A=A+Math.imul(he,Ge)|0,g=g+Math.imul(he,ze)|0,g=g+Math.imul(le,Ge)|0,R=R+Math.imul(le,ze)|0,A=A+Math.imul(pe,wt)|0,g=g+Math.imul(pe,St)|0,g=g+Math.imul(J,wt)|0,R=R+Math.imul(J,St)|0;var _o=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(_o>>>26)|0,_o&=67108863,A=Math.imul(Oe,je),g=Math.imul(Oe,He),g=g+Math.imul(Re,je)|0,R=Math.imul(Re,He),A=A+Math.imul(Ie,Ke)|0,g=g+Math.imul(Ie,Ve)|0,g=g+Math.imul(Ae,Ke)|0,R=R+Math.imul(Ae,Ve)|0,A=A+Math.imul(xe,Ge)|0,g=g+Math.imul(xe,ze)|0,g=g+Math.imul(Se,Ge)|0,R=R+Math.imul(Se,ze)|0,A=A+Math.imul(he,wt)|0,g=g+Math.imul(he,St)|0,g=g+Math.imul(le,wt)|0,R=R+Math.imul(le,St)|0;var wo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(wo>>>26)|0,wo&=67108863,A=Math.imul(Oe,Ke),g=Math.imul(Oe,Ve),g=g+Math.imul(Re,Ke)|0,R=Math.imul(Re,Ve),A=A+Math.imul(Ie,Ge)|0,g=g+Math.imul(Ie,ze)|0,g=g+Math.imul(Ae,Ge)|0,R=R+Math.imul(Ae,ze)|0,A=A+Math.imul(xe,wt)|0,g=g+Math.imul(xe,St)|0,g=g+Math.imul(Se,wt)|0,R=R+Math.imul(Se,St)|0;var ed=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ed>>>26)|0,ed&=67108863,A=Math.imul(Oe,Ge),g=Math.imul(Oe,ze),g=g+Math.imul(Re,Ge)|0,R=Math.imul(Re,ze),A=A+Math.imul(Ie,wt)|0,g=g+Math.imul(Ie,St)|0,g=g+Math.imul(Ae,wt)|0,R=R+Math.imul(Ae,St)|0;var td=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(td>>>26)|0,td&=67108863,A=Math.imul(Oe,wt),g=Math.imul(Oe,St),g=g+Math.imul(Re,wt)|0,R=Math.imul(Re,St);var rd=(w+A|0)+((g&8191)<<13)|0;return w=(R+(g>>>13)|0)+(rd>>>26)|0,rd&=67108863,c[0]=oo,c[1]=so,c[2]=ao,c[3]=fo,c[4]=uo,c[5]=co,c[6]=ho,c[7]=lo,c[8]=po,c[9]=go,c[10]=vo,c[11]=yo,c[12]=mo,c[13]=bo,c[14]=_o,c[15]=wo,c[16]=ed,c[17]=td,c[18]=rd,w!==0&&(c[19]=w,p.length++),p};Math.imul||(j=D);function Y(d,a,u){u.negative=a.negative^d.negative,u.length=d.length+a.length;for(var p=0,b=0,v=0;v<u.length-1;v++){var c=b;b=0;for(var w=p&67108863,A=Math.min(v,a.length-1),g=Math.max(0,v-d.length+1);g<=A;g++){var R=v-g,U=d.words[R]|0,H=a.words[g]|0,z=U*H,re=z&67108863;c=c+(z/67108864|0)|0,re=re+w|0,w=re&67108863,c=c+(re>>>26)|0,b+=c>>>26,c&=67108863}u.words[v]=w,p=c,c=b}return p!==0?u.words[v]=p:u.length--,u._strip()}function Q(d,a,u){return Y(d,a,u)}n.prototype.mulTo=function(a,u){var p,b=this.length+a.length;return this.length===10&&a.length===10?p=j(this,a,u):b<63?p=D(this,a,u):b<1024?p=Y(this,a,u):p=Q(this,a,u),p};function W(d,a){this.x=d,this.y=a}W.prototype.makeRBT=function(a){for(var u=new Array(a),p=n.prototype._countBits(a)-1,b=0;b<a;b++)u[b]=this.revBin(b,p,a);return u},W.prototype.revBin=function(a,u,p){if(a===0||a===p-1)return a;for(var b=0,v=0;v<u;v++)b|=(a&1)<<u-v-1,a>>=1;return b},W.prototype.permute=function(a,u,p,b,v,c){for(var w=0;w<c;w++)b[w]=u[a[w]],v[w]=p[a[w]]},W.prototype.transform=function(a,u,p,b,v,c){this.permute(c,a,u,p,b,v);for(var w=1;w<v;w<<=1)for(var A=w<<1,g=Math.cos(2*Math.PI/A),R=Math.sin(2*Math.PI/A),U=0;U<v;U+=A)for(var H=g,z=R,re=0;re<w;re++){var oe=p[U+re],k=b[U+re],q=p[U+re+w],L=b[U+re+w],V=H*q-z*L;L=H*L+z*q,q=V,p[U+re]=oe+q,b[U+re]=k+L,p[U+re+w]=oe-q,b[U+re+w]=k-L,re!==A&&(V=g*H-R*z,z=g*z+R*H,H=V)}},W.prototype.guessLen13b=function(a,u){var p=Math.max(u,a)|1,b=p&1,v=0;for(p=p/2|0;p;p=p>>>1)v++;return 1<<v+1+b},W.prototype.conjugate=function(a,u,p){if(!(p<=1))for(var b=0;b<p/2;b++){var v=a[b];a[b]=a[p-b-1],a[p-b-1]=v,v=u[b],u[b]=-u[p-b-1],u[p-b-1]=-v}},W.prototype.normalize13b=function(a,u){for(var p=0,b=0;b<u/2;b++){var v=Math.round(a[2*b+1]/u)*8192+Math.round(a[2*b]/u)+p;a[b]=v&67108863,v<67108864?p=0:p=v/67108864|0}return a},W.prototype.convert13b=function(a,u,p,b){for(var v=0,c=0;c<u;c++)v=v+(a[c]|0),p[2*c]=v&8191,v=v>>>13,p[2*c+1]=v&8191,v=v>>>13;for(c=2*u;c<b;++c)p[c]=0;r(v===0),r((v&-8192)===0)},W.prototype.stub=function(a){for(var u=new Array(a),p=0;p<a;p++)u[p]=0;return u},W.prototype.mulp=function(a,u,p){var b=2*this.guessLen13b(a.length,u.length),v=this.makeRBT(b),c=this.stub(b),w=new Array(b),A=new Array(b),g=new Array(b),R=new Array(b),U=new Array(b),H=new Array(b),z=p.words;z.length=b,this.convert13b(a.words,a.length,w,b),this.convert13b(u.words,u.length,R,b),this.transform(w,c,A,g,b,v),this.transform(R,c,U,H,b,v);for(var re=0;re<b;re++){var oe=A[re]*U[re]-g[re]*H[re];g[re]=A[re]*H[re]+g[re]*U[re],A[re]=oe}return this.conjugate(A,g,b),this.transform(A,g,z,c,b,v),this.conjugate(z,c,b),this.normalize13b(z,b),p.negative=a.negative^u.negative,p.length=a.length+u.length,p._strip()},n.prototype.mul=function(a){var u=new n(null);return u.words=new Array(this.length+a.length),this.mulTo(a,u)},n.prototype.mulf=function(a){var u=new n(null);return u.words=new Array(this.length+a.length),Q(this,a,u)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){var u=a<0;u&&(a=-a),r(typeof a=="number"),r(a<67108864);for(var p=0,b=0;b<this.length;b++){var v=(this.words[b]|0)*a,c=(v&67108863)+(p&67108863);p>>=26,p+=v/67108864|0,p+=c>>>26,this.words[b]=c&67108863}return p!==0&&(this.words[b]=p,this.length++),this.length=a===0?1:this.length,u?this.ineg():this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var u=N(a);if(u.length===0)return new n(1);for(var p=this,b=0;b<u.length&&u[b]===0;b++,p=p.sqr());if(++b<u.length)for(var v=p.sqr();b<u.length;b++,v=v.sqr())u[b]!==0&&(p=p.mul(v));return p},n.prototype.iushln=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26,b=67108863>>>26-u<<26-u,v;if(u!==0){var c=0;for(v=0;v<this.length;v++){var w=this.words[v]&b,A=(this.words[v]|0)-w<<u;this.words[v]=A|c,c=w>>>26-u}c&&(this.words[v]=c,this.length++)}if(p!==0){for(v=this.length-1;v>=0;v--)this.words[v+p]=this.words[v];for(v=0;v<p;v++)this.words[v]=0;this.length+=p}return this._strip()},n.prototype.ishln=function(a){return r(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,u,p){r(typeof a=="number"&&a>=0);var b;u?b=(u-u%26)/26:b=0;var v=a%26,c=Math.min((a-v)/26,this.length),w=67108863^67108863>>>v<<v,A=p;if(b-=c,b=Math.max(0,b),A){for(var g=0;g<c;g++)A.words[g]=this.words[g];A.length=c}if(c!==0)if(this.length>c)for(this.length-=c,g=0;g<this.length;g++)this.words[g]=this.words[g+c];else this.words[0]=0,this.length=1;var R=0;for(g=this.length-1;g>=0&&(R!==0||g>=b);g--){var U=this.words[g]|0;this.words[g]=R<<26-v|U>>>v,R=U&w}return A&&R!==0&&(A.words[A.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(a,u,p){return r(this.negative===0),this.iushrn(a,u,p)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26,b=1<<u;if(this.length<=p)return!1;var v=this.words[p];return!!(v&b)},n.prototype.imaskn=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=p)return this;if(u!==0&&p++,this.length=Math.min(p,this.length),u!==0){var b=67108863^67108863>>>u<<u;this.words[this.length-1]&=b}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return r(typeof a=="number"),r(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;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},n.prototype.isubn=function(a){if(r(typeof a=="number"),r(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,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()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,u,p){var b=a.length+p,v;this._expand(b);var c,w=0;for(v=0;v<a.length;v++){c=(this.words[v+p]|0)+w;var A=(a.words[v]|0)*u;c-=A&67108863,w=(c>>26)-(A/67108864|0),this.words[v+p]=c&67108863}for(;v<this.length-p;v++)c=(this.words[v+p]|0)+w,w=c>>26,this.words[v+p]=c&67108863;if(w===0)return this._strip();for(r(w===-1),w=0,v=0;v<this.length;v++)c=-(this.words[v]|0)+w,w=c>>26,this.words[v]=c&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(a,u){var p=this.length-a.length,b=this.clone(),v=a,c=v.words[v.length-1]|0,w=this._countBits(c);p=26-w,p!==0&&(v=v.ushln(p),b.iushln(p),c=v.words[v.length-1]|0);var A=b.length-v.length,g;if(u!=="mod"){g=new n(null),g.length=A+1,g.words=new Array(g.length);for(var R=0;R<g.length;R++)g.words[R]=0}var U=b.clone()._ishlnsubmul(v,1,A);U.negative===0&&(b=U,g&&(g.words[A]=1));for(var H=A-1;H>=0;H--){var z=(b.words[v.length+H]|0)*67108864+(b.words[v.length+H-1]|0);for(z=Math.min(z/c|0,67108863),b._ishlnsubmul(v,z,H);b.negative!==0;)z--,b.negative=0,b._ishlnsubmul(v,1,H),b.isZero()||(b.negative^=1);g&&(g.words[H]=z)}return g&&g._strip(),b._strip(),u!=="div"&&p!==0&&b.iushrn(p),{div:g||null,mod:b}},n.prototype.divmod=function(a,u,p){if(r(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var b,v,c;return this.negative!==0&&a.negative===0?(c=this.neg().divmod(a,u),u!=="mod"&&(b=c.div.neg()),u!=="div"&&(v=c.mod.neg(),p&&v.negative!==0&&v.iadd(a)),{div:b,mod:v}):this.negative===0&&a.negative!==0?(c=this.divmod(a.neg(),u),u!=="mod"&&(b=c.div.neg()),{div:b,mod:c.mod}):(this.negative&a.negative)!==0?(c=this.neg().divmod(a.neg(),u),u!=="div"&&(v=c.mod.neg(),p&&v.negative!==0&&v.isub(a)),{div:c.div,mod:v}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?u==="div"?{div:this.divn(a.words[0]),mod:null}:u==="mod"?{div:null,mod:new n(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modrn(a.words[0]))}:this._wordDiv(a,u)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var u=this.divmod(a);if(u.mod.isZero())return u.div;var p=u.div.negative!==0?u.mod.isub(a):u.mod,b=a.ushrn(1),v=a.andln(1),c=p.cmp(b);return c<0||v===1&&c===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},n.prototype.modrn=function(a){var u=a<0;u&&(a=-a),r(a<=67108863);for(var p=(1<<26)%a,b=0,v=this.length-1;v>=0;v--)b=(p*b+(this.words[v]|0))%a;return u?-b:b},n.prototype.modn=function(a){return this.modrn(a)},n.prototype.idivn=function(a){var u=a<0;u&&(a=-a),r(a<=67108863);for(var p=0,b=this.length-1;b>=0;b--){var v=(this.words[b]|0)+p*67108864;this.words[b]=v/a|0,p=v%a}return this._strip(),u?this.ineg():this},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){r(a.negative===0),r(!a.isZero());var u=this,p=a.clone();u.negative!==0?u=u.umod(a):u=u.clone();for(var b=new n(1),v=new n(0),c=new n(0),w=new n(1),A=0;u.isEven()&&p.isEven();)u.iushrn(1),p.iushrn(1),++A;for(var g=p.clone(),R=u.clone();!u.isZero();){for(var U=0,H=1;(u.words[0]&H)===0&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(b.isOdd()||v.isOdd())&&(b.iadd(g),v.isub(R)),b.iushrn(1),v.iushrn(1);for(var z=0,re=1;(p.words[0]&re)===0&&z<26;++z,re<<=1);if(z>0)for(p.iushrn(z);z-- >0;)(c.isOdd()||w.isOdd())&&(c.iadd(g),w.isub(R)),c.iushrn(1),w.iushrn(1);u.cmp(p)>=0?(u.isub(p),b.isub(c),v.isub(w)):(p.isub(u),c.isub(b),w.isub(v))}return{a:c,b:w,gcd:p.iushln(A)}},n.prototype._invmp=function(a){r(a.negative===0),r(!a.isZero());var u=this,p=a.clone();u.negative!==0?u=u.umod(a):u=u.clone();for(var b=new n(1),v=new n(0),c=p.clone();u.cmpn(1)>0&&p.cmpn(1)>0;){for(var w=0,A=1;(u.words[0]&A)===0&&w<26;++w,A<<=1);if(w>0)for(u.iushrn(w);w-- >0;)b.isOdd()&&b.iadd(c),b.iushrn(1);for(var g=0,R=1;(p.words[0]&R)===0&&g<26;++g,R<<=1);if(g>0)for(p.iushrn(g);g-- >0;)v.isOdd()&&v.iadd(c),v.iushrn(1);u.cmp(p)>=0?(u.isub(p),b.isub(v)):(p.isub(u),v.isub(b))}var U;return u.cmpn(1)===0?U=b:U=v,U.cmpn(0)<0&&U.iadd(a),U},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var u=this.clone(),p=a.clone();u.negative=0,p.negative=0;for(var b=0;u.isEven()&&p.isEven();b++)u.iushrn(1),p.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;p.isEven();)p.iushrn(1);var v=u.cmp(p);if(v<0){var c=u;u=p,p=c}else if(v===0||p.cmpn(1)===0)break;u.isub(p)}while(!0);return p.iushln(b)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){r(typeof a=="number");var u=a%26,p=(a-u)/26,b=1<<u;if(this.length<=p)return this._expand(p+1),this.words[p]|=b,this;for(var v=b,c=p;v!==0&&c<this.length;c++){var w=this.words[c]|0;w+=v,v=w>>>26,w&=67108863,this.words[c]=w}return v!==0&&(this.words[c]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var u=a<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var p;if(this.length>1)p=1;else{u&&(a=-a),r(a<=67108863,"Number is too big");var b=this.words[0]|0;p=b===a?0:b<a?-1:1}return this.negative!==0?-p|0:p},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var u=this.ucmp(a);return this.negative!==0?-u|0:u},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var u=0,p=this.length-1;p>=0;p--){var b=this.words[p]|0,v=a.words[p]|0;if(b!==v){b<v?u=-1:b>v&&(u=1);break}}return u},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new l(a)},n.prototype.toRed=function(a){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return r(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return r(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var te={k256:null,p224:null,p192:null,p25519:null};function ne(d,a){this.name=d,this.p=new n(a,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ne.prototype._tmp=function(){var a=new n(null);return a.words=new Array(Math.ceil(this.n/13)),a},ne.prototype.ireduce=function(a){var u=a,p;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),p=u.bitLength();while(p>this.n);var b=p<this.n?-1:u.ucmp(this.p);return b===0?(u.words[0]=0,u.length=1):b>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},ne.prototype.split=function(a,u){a.iushrn(this.n,0,u)},ne.prototype.imulK=function(a){return a.imul(this.k)};function se(){ne.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(se,ne),se.prototype.split=function(a,u){for(var p=4194303,b=Math.min(a.length,9),v=0;v<b;v++)u.words[v]=a.words[v];if(u.length=b,a.length<=9){a.words[0]=0,a.length=1;return}var c=a.words[9];for(u.words[u.length++]=c&p,v=10;v<a.length;v++){var w=a.words[v]|0;a.words[v-10]=(w&p)<<4|c>>>22,c=w}c>>>=22,a.words[v-10]=c,c===0&&a.length>10?a.length-=10:a.length-=9},se.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var u=0,p=0;p<a.length;p++){var b=a.words[p]|0;u+=b*977,a.words[p]=u&67108863,u=b*64+(u/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function ue(){ne.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(ue,ne);function be(){ne.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(be,ne);function P(){ne.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(P,ne),P.prototype.imulK=function(a){for(var u=0,p=0;p<a.length;p++){var b=(a.words[p]|0)*19+u,v=b&67108863;b>>>=26,a.words[p]=v,u=b}return u!==0&&(a.words[a.length++]=u),a},n._prime=function(a){if(te[a])return te[a];var u;if(a==="k256")u=new se;else if(a==="p224")u=new ue;else if(a==="p192")u=new be;else if(a==="p25519")u=new P;else throw new Error("Unknown prime "+a);return te[a]=u,u};function l(d){if(typeof d=="string"){var a=n._prime(d);this.m=a.p,this.prime=a}else r(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}l.prototype._verify1=function(a){r(a.negative===0,"red works only with positives"),r(a.red,"red works only with red numbers")},l.prototype._verify2=function(a,u){r((a.negative|u.negative)===0,"red works only with positives"),r(a.red&&a.red===u.red,"red works only with red numbers")},l.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(m(a,a.umod(this.m)._forceRed(this)),a)},l.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},l.prototype.add=function(a,u){this._verify2(a,u);var p=a.add(u);return p.cmp(this.m)>=0&&p.isub(this.m),p._forceRed(this)},l.prototype.iadd=function(a,u){this._verify2(a,u);var p=a.iadd(u);return p.cmp(this.m)>=0&&p.isub(this.m),p},l.prototype.sub=function(a,u){this._verify2(a,u);var p=a.sub(u);return p.cmpn(0)<0&&p.iadd(this.m),p._forceRed(this)},l.prototype.isub=function(a,u){this._verify2(a,u);var p=a.isub(u);return p.cmpn(0)<0&&p.iadd(this.m),p},l.prototype.shl=function(a,u){return this._verify1(a),this.imod(a.ushln(u))},l.prototype.imul=function(a,u){return this._verify2(a,u),this.imod(a.imul(u))},l.prototype.mul=function(a,u){return this._verify2(a,u),this.imod(a.mul(u))},l.prototype.isqr=function(a){return this.imul(a,a.clone())},l.prototype.sqr=function(a){return this.mul(a,a)},l.prototype.sqrt=function(a){if(a.isZero())return a.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var p=this.m.add(new n(1)).iushrn(2);return this.pow(a,p)}for(var b=this.m.subn(1),v=0;!b.isZero()&&b.andln(1)===0;)v++,b.iushrn(1);r(!b.isZero());var c=new n(1).toRed(this),w=c.redNeg(),A=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new n(2*g*g).toRed(this);this.pow(g,A).cmp(w)!==0;)g.redIAdd(w);for(var R=this.pow(g,b),U=this.pow(a,b.addn(1).iushrn(1)),H=this.pow(a,b),z=v;H.cmp(c)!==0;){for(var re=H,oe=0;re.cmp(c)!==0;oe++)re=re.redSqr();r(oe<z);var k=this.pow(R,new n(1).iushln(z-oe-1));U=U.redMul(k),R=k.redSqr(),H=H.redMul(R),z=oe}return U},l.prototype.invm=function(a){var u=a._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},l.prototype.pow=function(a,u){if(u.isZero())return new n(1).toRed(this);if(u.cmpn(1)===0)return a.clone();var p=4,b=new Array(1<<p);b[0]=new n(1).toRed(this),b[1]=a;for(var v=2;v<b.length;v++)b[v]=this.mul(b[v-1],a);var c=b[0],w=0,A=0,g=u.bitLength()%26;for(g===0&&(g=26),v=u.length-1;v>=0;v--){for(var R=u.words[v],U=g-1;U>=0;U--){var H=R>>U&1;if(c!==b[0]&&(c=this.sqr(c)),H===0&&w===0){A=0;continue}w<<=1,w|=H,A++,!(A!==p&&(v!==0||U!==0))&&(c=this.mul(c,b[w]),A=0,w=0)}g=26}return c},l.prototype.convertTo=function(a){var u=a.umod(this.m);return u===a?u.clone():u},l.prototype.convertFrom=function(a){var u=a.clone();return u.red=null,u},n.mont=function(a){return new E(a)};function E(d){l.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(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)}i(E,l),E.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},E.prototype.convertFrom=function(a){var u=this.imod(a.mul(this.rinv));return u.red=null,u},E.prototype.imul=function(a,u){if(a.isZero()||u.isZero())return a.words[0]=0,a.length=1,a;var p=a.imul(u),b=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=p.isub(b).iushrn(this.shift),c=v;return v.cmp(this.m)>=0?c=v.isub(this.m):v.cmpn(0)<0&&(c=v.iadd(this.m)),c._forceRed(this)},E.prototype.mul=function(a,u){if(a.isZero()||u.isZero())return new n(0)._forceRed(this);var p=a.mul(u),b=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=p.isub(b).iushrn(this.shift),c=v;return v.cmp(this.m)>=0?c=v.isub(this.m):v.cmpn(0)<0&&(c=v.iadd(this.m)),c._forceRed(this)},E.prototype.invm=function(a){var u=this.imod(a._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof eg>"u"||eg,NE)});var tg=B((MW,UE)=>{"use strict";y();var ua=CE(),d7=Ao(),p7=We().Buffer;function DE(e){var t=e.modulus.byteLength(),r;do r=new ua(d7(t));while(r.cmp(e.modulus)>=0||!r.umod(e.prime1)||!r.umod(e.prime2));return r}function g7(e){var t=DE(e),r=t.toRed(ua.mont(e.modulus)).redPow(new ua(e.publicExponent)).fromRed();return{blinder:r,unblinder:t.invm(e.modulus)}}function qE(e,t){var r=g7(t),i=t.modulus.byteLength(),n=new ua(e).mul(r.blinder).umod(t.modulus),o=n.toRed(ua.mont(t.prime1)),s=n.toRed(ua.mont(t.prime2)),f=t.coefficient,h=t.prime1,m=t.prime2,S=o.redPow(t.exponent1).fromRed(),x=s.redPow(t.exponent2).fromRed(),I=S.isub(x).imul(f).umod(h).imul(m);return x.iadd(I).imul(r.unblinder).umod(t.modulus).toArrayLike(p7,"be",i)}qE.getr=DE;UE.exports=qE});var HE=B((NW,jE)=>{y();var v7=Zp(),rg=Ao(),y7=qf(),LE=Xp(),FE=Jp(),ig=$i(),m7=Qp(),b7=tg(),ni=We().Buffer;jE.exports=function(t,r,i){var n;t.padding?n=t.padding:i?n=1:n=4;var o=v7(t),s;if(n===4)s=_7(o,r);else if(n===1)s=w7(o,r,i);else if(n===3){if(s=new ig(r),s.cmp(o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return i?b7(s,o):m7(s,o)};function _7(e,t){var r=e.modulus.byteLength(),i=t.length,n=y7("sha1").update(ni.alloc(0)).digest(),o=n.length,s=2*o;if(i>r-s-2)throw new Error("message too long");var f=ni.alloc(r-i-s-2),h=r-o-1,m=rg(o),S=FE(ni.concat([n,f,ni.alloc(1,1),t],h),LE(m,h)),x=FE(m,LE(S,o));return new ig(ni.concat([ni.alloc(1),x,S],r))}function w7(e,t,r){var i=t.length,n=e.modulus.byteLength();if(i>n-11)throw new Error("message too long");var o;return r?o=ni.alloc(n-i-3,255):o=S7(n-i-3),new ig(ni.concat([ni.from([0,r?1:2]),o,ni.alloc(1),t],n))}function S7(e){for(var t=ni.allocUnsafe(e),r=0,i=rg(e*2),n=0,o;r<e;)n===i.length&&(i=rg(e*2),n=0),o=i[n++],o&&(t[r++]=o);return t}});var WE=B((DW,zE)=>{y();var E7=Zp(),KE=Xp(),VE=Jp(),GE=$i(),x7=tg(),I7=qf(),A7=Qp(),Zf=We().Buffer;zE.exports=function(t,r,i){var n;t.padding?n=t.padding:i?n=1:n=4;var o=E7(t),s=o.modulus.byteLength();if(r.length>s||new GE(r).cmp(o.modulus)>=0)throw new Error("decryption error");var f;i?f=A7(new GE(r),o):f=x7(r,o);var h=Zf.alloc(s-f.length);if(f=Zf.concat([h,f],s),n===4)return O7(o,f);if(n===1)return R7(o,f,i);if(n===3)return f;throw new Error("unknown padding")};function O7(e,t){var r=e.modulus.byteLength(),i=I7("sha1").update(Zf.alloc(0)).digest(),n=i.length;if(t[0]!==0)throw new Error("decryption error");var o=t.slice(1,n+1),s=t.slice(n+1),f=VE(o,KE(s,n)),h=VE(s,KE(f,r-n-1));if(T7(i,h.slice(0,n)))throw new Error("decryption error");for(var m=n;h[m]===0;)m++;if(h[m++]!==1)throw new Error("decryption error");return h.slice(m)}function R7(e,t,r){for(var i=t.slice(0,2),n=2,o=0;t[n++]!==0;)if(n>=t.length){o++;break}var s=t.slice(2,n-1);if((i.toString("hex")!=="0002"&&!r||i.toString("hex")!=="0001"&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return t.slice(n)}function T7(e,t){e=Zf.from(e),t=Zf.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));for(var n=-1;++n<i;)r+=e[n]^t[n];return r}});var YE=B(Xo=>{y();Xo.publicEncrypt=HE();Xo.privateDecrypt=WE();Xo.privateEncrypt=function(t,r){return Xo.publicEncrypt(t,r,!0)};Xo.publicDecrypt=function(t,r){return Xo.privateDecrypt(t,r,!0)}});var nx=B($f=>{"use strict";y();function ZE(){throw new Error(`secure random number generation not supported by this browser
15
- use chrome, FireFox or Internet Explorer 11`)}var XE=We(),$E=Ao(),JE=XE.Buffer,QE=XE.kMaxLength,ng=globalThis.crypto||globalThis.msCrypto,ex=Math.pow(2,32)-1;function tx(e,t){if(typeof e!="number"||e!==e)throw new TypeError("offset must be a number");if(e>ex||e<0)throw new TypeError("offset must be a uint32");if(e>QE||e>t)throw new RangeError("offset out of range")}function rx(e,t,r){if(typeof e!="number"||e!==e)throw new TypeError("size must be a number");if(e>ex||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>QE)throw new RangeError("buffer too small")}ng&&ng.getRandomValues||!O.default.browser?($f.randomFill=B7,$f.randomFillSync=P7):($f.randomFill=ZE,$f.randomFillSync=ZE);function B7(e,t,r,i){if(!JE.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof t=="function")i=t,t=0,r=e.length;else if(typeof r=="function")i=r,r=e.length-t;else if(typeof i!="function")throw new TypeError('"cb" argument must be a function');return tx(t,e.length),rx(r,t,e.length),ix(e,t,r,i)}function ix(e,t,r,i){if(O.default.browser){var n=e.buffer,o=new Uint8Array(n,t,r);if(ng.getRandomValues(o),i){O.default.nextTick(function(){i(null,e)});return}return e}if(i){$E(r,function(f,h){if(f)return i(f);h.copy(e,t),i(null,e)});return}var s=$E(r);return s.copy(e,t),e}function P7(e,t,r){if(typeof t>"u"&&(t=0),!JE.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return tx(t,e.length),r===void 0&&(r=e.length-t),rx(r,t,e.length),ix(e,t,r)}});var Ph=B(Ye=>{"use strict";y();Ye.randomBytes=Ye.rng=Ye.pseudoRandomBytes=Ye.prng=Ao();Ye.createHash=Ye.Hash=qf();Ye.createHmac=Ye.Hmac=tS();var M7=gh(),k7=Object.keys(M7),N7=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(k7);Ye.getHashes=function(){return N7};var ox=op();Ye.pbkdf2=ox.pbkdf2;Ye.pbkdf2Sync=ox.pbkdf2Sync;var Mi=A2();Ye.Cipher=Mi.Cipher;Ye.createCipher=Mi.createCipher;Ye.Cipheriv=Mi.Cipheriv;Ye.createCipheriv=Mi.createCipheriv;Ye.Decipher=Mi.Decipher;Ye.createDecipher=Mi.createDecipher;Ye.Decipheriv=Mi.Decipheriv;Ye.createDecipheriv=Mi.createDecipheriv;Ye.getCiphers=Mi.getCiphers;Ye.listCiphers=Mi.listCiphers;var Xf=L2();Ye.DiffieHellmanGroup=Xf.DiffieHellmanGroup;Ye.createDiffieHellmanGroup=Xf.createDiffieHellmanGroup;Ye.getDiffieHellman=Xf.getDiffieHellman;Ye.createDiffieHellman=Xf.createDiffieHellman;Ye.DiffieHellman=Xf.DiffieHellman;var Lh=gh();Ye.createSign=Lh.createSign;Ye.Sign=Lh.Sign;Ye.createVerify=Lh.createVerify;Ye.Verify=Lh.Verify;Ye.createECDH=gh();var Fh=YE();Ye.publicEncrypt=Fh.publicEncrypt;Ye.privateEncrypt=Fh.privateEncrypt;Ye.publicDecrypt=Fh.publicDecrypt;Ye.privateDecrypt=Fh.privateDecrypt;var sx=nx();Ye.randomFill=sx.randomFill;Ye.randomFillSync=sx.randomFillSync;Ye.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
13
+ })`)}catch{r=function(n){this._initNamed(n)}}return bC(r,t),r.prototype._initNamed=function(n){t.call(this,n)},new r(this)};na.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(j2.decoders[t])),this.decoders[t]};na.prototype.decode=function(t,r,i){return this._getDecoder(r).decode(t,i)};na.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(j2.encoders[t])),this.encoders[t]};na.prototype.encode=function(t,r,i){return this._getEncoder(r).encode(t,i)}});var G2=B(V2=>{y();var wC=we();function qr(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}V2.Reporter=qr;qr.prototype.isError=function(t){return t instanceof sa};qr.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}};qr.prototype.restore=function(t){var r=this._reporterState;r.obj=t.obj,r.path=r.path.slice(0,t.pathLen)};qr.prototype.enterKey=function(t){return this._reporterState.path.push(t)};qr.prototype.exitKey=function(t){var r=this._reporterState;r.path=r.path.slice(0,t-1)};qr.prototype.leaveKey=function(t,r,i){var n=this._reporterState;this.exitKey(t),n.obj!==null&&(n.obj[r]=i)};qr.prototype.path=function(){return this._reporterState.path.join("/")};qr.prototype.enterObject=function(){var t=this._reporterState,r=t.obj;return t.obj={},r};qr.prototype.leaveObject=function(t){var r=this._reporterState,i=r.obj;return r.obj=t,i};qr.prototype.error=function(t){var r,i=this._reporterState,n=t instanceof sa;if(n?r=t:r=new sa(i.path.map(function(o){return"["+JSON.stringify(o)+"]"}).join(""),t.message||t,t.stack),!i.options.partial)throw r;return n||i.errors.push(r),r};qr.prototype.wrapResult=function(t){var r=this._reporterState;return r.options.partial?{result:this.isError(t)?null:t,errors:r.errors}:t};function sa(e,t){this.path=e,this.rethrow(t)}wC(sa,Error);sa.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,sa),!this.stack)try{throw new Error(this.message)}catch(r){this.stack=r.stack}return this}});var Dp=B(Cp=>{y();var SC=we(),Ch=aa().Reporter,Yf=xt().Buffer;function Pi(e,t){if(Ch.call(this,t),!Yf.isBuffer(e)){this.error("Input not Buffer");return}this.base=e,this.offset=0,this.length=e.length}SC(Pi,Ch);Cp.DecoderBuffer=Pi;Pi.prototype.save=function(){return{offset:this.offset,reporter:Ch.prototype.save.call(this)}};Pi.prototype.restore=function(t){var r=new Pi(this.base);return r.offset=t.offset,r.length=this.offset,this.offset=t.offset,Ch.prototype.restore.call(this,t.reporter),r};Pi.prototype.isEmpty=function(){return this.offset===this.length};Pi.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")};Pi.prototype.skip=function(t,r){if(!(this.offset+t<=this.length))return this.error(r||"DecoderBuffer overrun");var i=new Pi(this.base);return i._reporterState=this._reporterState,i.offset=this.offset,i.length=this.offset+t,this.offset+=t,i};Pi.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)};function Nh(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(r){return r instanceof Nh||(r=new Nh(r,t)),this.length+=r.length,r},this);else if(typeof e=="number"){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if(typeof e=="string")this.value=e,this.length=Yf.byteLength(e);else if(Yf.isBuffer(e))this.value=e,this.length=e.length;else return t.error("Unsupported type: "+typeof e)}Cp.EncoderBuffer=Nh;Nh.prototype.join=function(t,r){return t||(t=new Yf(this.length)),r||(r=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(i){i.join(t,r),r+=i.length}):(typeof this.value=="number"?t[r]=this.value:typeof this.value=="string"?t.write(this.value,r):Yf.isBuffer(this.value)&&this.value.copy(t,r),r+=this.length)),t}});var Y2=B((Yz,W2)=>{y();var EC=aa().Reporter,xC=aa().EncoderBuffer,IC=aa().DecoderBuffer,nr=Xr(),z2=["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"],AC=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(z2),OC=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function ut(e,t){var r={};this._baseState=r,r.enc=e,r.parent=t||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}W2.exports=ut;var RC=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];ut.prototype.clone=function(){var t=this._baseState,r={};RC.forEach(function(n){r[n]=t[n]});var i=new this.constructor(r.parent);return i._baseState=r,i};ut.prototype._wrap=function(){var t=this._baseState;AC.forEach(function(r){this[r]=function(){var n=new this.constructor(this);return t.children.push(n),n[r].apply(n,arguments)}},this)};ut.prototype._init=function(t){var r=this._baseState;nr(r.parent===null),t.call(this),r.children=r.children.filter(function(i){return i._baseState.parent===this},this),nr.equal(r.children.length,1,"Root node can have only one child")};ut.prototype._useArgs=function(t){var r=this._baseState,i=t.filter(function(n){return n instanceof this.constructor},this);t=t.filter(function(n){return!(n instanceof this.constructor)},this),i.length!==0&&(nr(r.children===null),r.children=i,i.forEach(function(n){n._baseState.parent=this},this)),t.length!==0&&(nr(r.args===null),r.args=t,r.reverseArgs=t.map(function(n){if(typeof n!="object"||n.constructor!==Object)return n;var o={};return Object.keys(n).forEach(function(s){s==(s|0)&&(s|=0);var f=n[s];o[f]=s}),o}))};OC.forEach(function(e){ut.prototype[e]=function(){var r=this._baseState;throw new Error(e+" not implemented for encoding: "+r.enc)}});z2.forEach(function(e){ut.prototype[e]=function(){var r=this._baseState,i=Array.prototype.slice.call(arguments);return nr(r.tag===null),r.tag=e,this._useArgs(i),this}});ut.prototype.use=function(t){nr(t);var r=this._baseState;return nr(r.use===null),r.use=t,this};ut.prototype.optional=function(){var t=this._baseState;return t.optional=!0,this};ut.prototype.def=function(t){var r=this._baseState;return nr(r.default===null),r.default=t,r.optional=!0,this};ut.prototype.explicit=function(t){var r=this._baseState;return nr(r.explicit===null&&r.implicit===null),r.explicit=t,this};ut.prototype.implicit=function(t){var r=this._baseState;return nr(r.explicit===null&&r.implicit===null),r.implicit=t,this};ut.prototype.obj=function(){var t=this._baseState,r=Array.prototype.slice.call(arguments);return t.obj=!0,r.length!==0&&this._useArgs(r),this};ut.prototype.key=function(t){var r=this._baseState;return nr(r.key===null),r.key=t,this};ut.prototype.any=function(){var t=this._baseState;return t.any=!0,this};ut.prototype.choice=function(t){var r=this._baseState;return nr(r.choice===null),r.choice=t,this._useArgs(Object.keys(t).map(function(i){return t[i]})),this};ut.prototype.contains=function(t){var r=this._baseState;return nr(r.use===null),r.contains=t,this};ut.prototype._decode=function(t,r){var i=this._baseState;if(i.parent===null)return t.wrapResult(i.children[0]._decode(t,r));var n=i.default,o=!0,s=null;if(i.key!==null&&(s=t.enterKey(i.key)),i.optional){var f=null;if(i.explicit!==null?f=i.explicit:i.implicit!==null?f=i.implicit:i.tag!==null&&(f=i.tag),f===null&&!i.any){var h=t.save();try{i.choice===null?this._decodeGeneric(i.tag,t,r):this._decodeChoice(t,r),o=!0}catch{o=!1}t.restore(h)}else if(o=this._peekTag(t,f,i.any),t.isError(o))return o}var m;if(i.obj&&o&&(m=t.enterObject()),o){if(i.explicit!==null){var S=this._decodeTag(t,i.explicit);if(t.isError(S))return S;t=S}var x=t.offset;if(i.use===null&&i.choice===null){if(i.any)var h=t.save();var I=this._decodeTag(t,i.implicit!==null?i.implicit:i.tag,i.any);if(t.isError(I))return I;i.any?n=t.raw(h):t=I}if(r&&r.track&&i.tag!==null&&r.track(t.path(),x,t.length,"tagged"),r&&r.track&&i.tag!==null&&r.track(t.path(),t.offset,t.length,"content"),i.any?n=n:i.choice===null?n=this._decodeGeneric(i.tag,t,r):n=this._decodeChoice(t,r),t.isError(n))return n;if(!i.any&&i.choice===null&&i.children!==null&&i.children.forEach(function(N){N._decode(t,r)}),i.contains&&(i.tag==="octstr"||i.tag==="bitstr")){var T=new IC(n);n=this._getUse(i.contains,t._reporterState.obj)._decode(T,r)}}return i.obj&&o&&(n=t.leaveObject(m)),i.key!==null&&(n!==null||o===!0)?t.leaveKey(s,i.key,n):s!==null&&t.exitKey(s),n};ut.prototype._decodeGeneric=function(t,r,i){var n=this._baseState;return t==="seq"||t==="set"?null:t==="seqof"||t==="setof"?this._decodeList(r,t,n.args[0],i):/str$/.test(t)?this._decodeStr(r,t,i):t==="objid"&&n.args?this._decodeObjid(r,n.args[0],n.args[1],i):t==="objid"?this._decodeObjid(r,null,null,i):t==="gentime"||t==="utctime"?this._decodeTime(r,t,i):t==="null_"?this._decodeNull(r,i):t==="bool"?this._decodeBool(r,i):t==="objDesc"?this._decodeStr(r,t,i):t==="int"||t==="enum"?this._decodeInt(r,n.args&&n.args[0],i):n.use!==null?this._getUse(n.use,r._reporterState.obj)._decode(r,i):r.error("unknown tag: "+t)};ut.prototype._getUse=function(t,r){var i=this._baseState;return i.useDecoder=this._use(t,r),nr(i.useDecoder._baseState.parent===null),i.useDecoder=i.useDecoder._baseState.children[0],i.implicit!==i.useDecoder._baseState.implicit&&(i.useDecoder=i.useDecoder.clone(),i.useDecoder._baseState.implicit=i.implicit),i.useDecoder};ut.prototype._decodeChoice=function(t,r){var i=this._baseState,n=null,o=!1;return Object.keys(i.choice).some(function(s){var f=t.save(),h=i.choice[s];try{var m=h._decode(t,r);if(t.isError(m))return!1;n={type:s,value:m},o=!0}catch{return t.restore(f),!1}return!0},this),o?n:t.error("Choice not matched")};ut.prototype._createEncoderBuffer=function(t){return new xC(t,this.reporter)};ut.prototype._encode=function(t,r,i){var n=this._baseState;if(!(n.default!==null&&n.default===t)){var o=this._encodeValue(t,r,i);if(o!==void 0&&!this._skipDefault(o,r,i))return o}};ut.prototype._encodeValue=function(t,r,i){var n=this._baseState;if(n.parent===null)return n.children[0]._encode(t,r||new EC);var h=null;if(this.reporter=r,n.optional&&t===void 0)if(n.default!==null)t=n.default;else return;var o=null,s=!1;if(n.any)h=this._createEncoderBuffer(t);else if(n.choice)h=this._encodeChoice(t,r);else if(n.contains)o=this._getUse(n.contains,i)._encode(t,r),s=!0;else if(n.children)o=n.children.map(function(x){if(x._baseState.tag==="null_")return x._encode(null,r,t);if(x._baseState.key===null)return r.error("Child should have a key");var I=r.enterKey(x._baseState.key);if(typeof t!="object")return r.error("Child expected, but input is not object");var T=x._encode(t[x._baseState.key],r,t);return r.leaveKey(I),T},this).filter(function(x){return x}),o=this._createEncoderBuffer(o);else if(n.tag==="seqof"||n.tag==="setof"){if(!(n.args&&n.args.length===1))return r.error("Too many args for : "+n.tag);if(!Array.isArray(t))return r.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(x){var I=this._baseState;return this._getUse(I.args[0],t)._encode(x,r)},f))}else n.use!==null?h=this._getUse(n.use,i)._encode(t,r):(o=this._encodePrimitive(n.tag,t),s=!0);var h;if(!n.any&&n.choice===null){var m=n.implicit!==null?n.implicit:n.tag,S=n.implicit===null?"universal":"context";m===null?n.use===null&&r.error("Tag could be omitted only for .use()"):n.use===null&&(h=this._encodeComposite(m,s,S,o))}return n.explicit!==null&&(h=this._encodeComposite(n.explicit,!1,"context",h)),h};ut.prototype._encodeChoice=function(t,r){var i=this._baseState,n=i.choice[t.type];return n||nr(!1,t.type+" not found in "+JSON.stringify(Object.keys(i.choice))),n._encode(t.value,r)};ut.prototype._encodePrimitive=function(t,r){var i=this._baseState;if(/str$/.test(t))return this._encodeStr(r,t);if(t==="objid"&&i.args)return this._encodeObjid(r,i.reverseArgs[0],i.args[1]);if(t==="objid")return this._encodeObjid(r,null,null);if(t==="gentime"||t==="utctime")return this._encodeTime(r,t);if(t==="null_")return this._encodeNull();if(t==="int"||t==="enum")return this._encodeInt(r,i.args&&i.reverseArgs[0]);if(t==="bool")return this._encodeBool(r);if(t==="objDesc")return this._encodeStr(r,t);throw new Error("Unsupported tag: "+t)};ut.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)};ut.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}});var aa=B(Z2=>{y();var Dh=Z2;Dh.Reporter=G2().Reporter;Dh.DecoderBuffer=Dp().DecoderBuffer;Dh.EncoderBuffer=Dp().EncoderBuffer;Dh.Node=Y2()});var X2=B($o=>{y();var $2=qp();$o.tagClass={0:"universal",1:"application",2:"context",3:"private"};$o.tagClassByName=$2._reverse($o.tagClass);$o.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"};$o.tagByName=$2._reverse($o.tag)});var qp=B(Q2=>{y();var J2=Q2;J2._reverse=function(t){var r={};return Object.keys(t).forEach(function(i){(i|0)==i&&(i=i|0);var n=t[i];r[n]=i}),r};J2.der=X2()});var Fp=B((rW,iE)=>{y();var TC=we(),Lp=oa(),qh=Lp.base,BC=Lp.bignum,eE=Lp.constants.der;function tE(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new _r,this.tree._init(e.body)}iE.exports=tE;tE.prototype.decode=function(t,r){return t instanceof qh.DecoderBuffer||(t=new qh.DecoderBuffer(t,r)),this.tree._decode(t,r)};function _r(e){qh.Node.call(this,"der",e)}TC(_r,qh.Node);_r.prototype._peekTag=function(t,r,i){if(t.isEmpty())return!1;var n=t.save(),o=Up(t,'Failed to peek tag: "'+r+'"');return t.isError(o)?o:(t.restore(n),o.tag===r||o.tagStr===r||o.tagStr+"of"===r||i)};_r.prototype._decodeTag=function(t,r,i){var n=Up(t,'Failed to decode tag of "'+r+'"');if(t.isError(n))return n;var o=rE(t,n.primitive,'Failed to get length of "'+r+'"');if(t.isError(o))return o;if(!i&&n.tag!==r&&n.tagStr!==r&&n.tagStr+"of"!==r)return t.error('Failed to match tag: "'+r+'"');if(n.primitive||o!==null)return t.skip(o,'Failed to match body of: "'+r+'"');var s=t.save(),f=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(f)?f:(o=t.offset-s.offset,t.restore(s),t.skip(o,'Failed to match body of: "'+r+'"'))};_r.prototype._skipUntilEnd=function(t,r){for(;;){var i=Up(t,r);if(t.isError(i))return i;var n=rE(t,i.primitive,r);if(t.isError(n))return n;var o;if(i.primitive||n!==null?o=t.skip(n):o=this._skipUntilEnd(t,r),t.isError(o))return o;if(i.tagStr==="end")break}};_r.prototype._decodeList=function(t,r,i,n){for(var o=[];!t.isEmpty();){var s=this._peekTag(t,"end");if(t.isError(s))return s;var f=i.decode(t,"der",n);if(t.isError(f)&&s)break;o.push(f)}return o};_r.prototype._decodeStr=function(t,r){if(r==="bitstr"){var i=t.readUInt8();return t.isError(i)?i:{unused:i,data:t.raw()}}else if(r==="bmpstr"){var n=t.raw();if(n.length%2===1)return t.error("Decoding of string type: bmpstr length mismatch");for(var o="",s=0;s<n.length/2;s++)o+=String.fromCharCode(n.readUInt16BE(s*2));return o}else if(r==="numstr"){var f=t.raw().toString("ascii");return this._isNumstr(f)?f:t.error("Decoding of string type: numstr unsupported characters")}else{if(r==="octstr")return t.raw();if(r==="objDesc")return t.raw();if(r==="printstr"){var h=t.raw().toString("ascii");return this._isPrintstr(h)?h:t.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(r)?t.raw().toString():t.error("Decoding of string type: "+r+" unsupported")}};_r.prototype._decodeObjid=function(t,r,i){for(var n,o=[],s=0;!t.isEmpty();){var f=t.readUInt8();s<<=7,s|=f&127,(f&128)===0&&(o.push(s),s=0)}f&128&&o.push(s);var h=o[0]/40|0,m=o[0]%40;if(i?n=o:n=[h,m].concat(o.slice(1)),r){var S=r[n.join(" ")];S===void 0&&(S=r[n.join(".")]),S!==void 0&&(n=S)}return n};_r.prototype._decodeTime=function(t,r){var i=t.raw().toString();if(r==="gentime")var n=i.slice(0,4)|0,o=i.slice(4,6)|0,s=i.slice(6,8)|0,f=i.slice(8,10)|0,h=i.slice(10,12)|0,m=i.slice(12,14)|0;else if(r==="utctime"){var n=i.slice(0,2)|0,o=i.slice(2,4)|0,s=i.slice(4,6)|0,f=i.slice(6,8)|0,h=i.slice(8,10)|0,m=i.slice(10,12)|0;n<70?n=2e3+n:n=1900+n}else return t.error("Decoding "+r+" time is not supported yet");return Date.UTC(n,o-1,s,f,h,m,0)};_r.prototype._decodeNull=function(t){return null};_r.prototype._decodeBool=function(t){var r=t.readUInt8();return t.isError(r)?r:r!==0};_r.prototype._decodeInt=function(t,r){var i=t.raw(),n=new BC(i);return r&&(n=r[n.toString(10)]||n),n};_r.prototype._use=function(t,r){return typeof t=="function"&&(t=t(r)),t._getDecoder("der").tree};function Up(e,t){var r=e.readUInt8(t);if(e.isError(r))return r;var i=eE.tagClass[r>>6],n=(r&32)===0;if((r&31)===31){var o=r;for(r=0;(o&128)===128;){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=o&127}}else r&=31;var s=eE.tag[r];return{cls:i,primitive:n,tag:r,tagStr:s}}function rE(e,t,r){var i=e.readUInt8(r);if(e.isError(i))return i;if(!t&&i===128)return null;if((i&128)===0)return i;var n=i&127;if(n>4)return e.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var s=e.readUInt8(r);if(e.isError(s))return s;i|=s}return i}});var oE=B((nW,nE)=>{y();var PC=we(),MC=xt().Buffer,jp=Fp();function Hp(e){jp.call(this,e),this.enc="pem"}PC(Hp,jp);nE.exports=Hp;Hp.prototype.decode=function(t,r){for(var i=t.toString().split(/[\r\n]+/g),n=r.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,f=-1,h=0;h<i.length;h++){var m=i[h].match(o);if(m!==null&&m[2]===n)if(s===-1){if(m[1]!=="BEGIN")break;s=h}else{if(m[1]!=="END")break;f=h;break}}if(s===-1||f===-1)throw new Error("PEM section not found for: "+n);var S=i.slice(s+1,f).join("");S.replace(/[^a-z0-9\+\/=]+/gi,"");var x=new MC(S,"base64");return jp.prototype.decode.call(this,x,r)}});var fE=B(aE=>{y();var sE=aE;sE.der=Fp();sE.pem=oE()});var Vp=B((fW,lE)=>{y();var kC=we(),cn=xt().Buffer,uE=oa(),cE=uE.base,Kp=uE.constants.der;function hE(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new ei,this.tree._init(e.body)}lE.exports=hE;hE.prototype.encode=function(t,r){return this.tree._encode(t,r).join()};function ei(e){cE.Node.call(this,"der",e)}kC(ei,cE.Node);ei.prototype._encodeComposite=function(t,r,i,n){var o=NC(t,r,i,this.reporter);if(n.length<128){var h=new cn(2);return h[0]=o,h[1]=n.length,this._createEncoderBuffer([h,n])}for(var s=1,f=n.length;f>=256;f>>=8)s++;var h=new cn(2+s);h[0]=o,h[1]=128|s;for(var f=1+s,m=n.length;m>0;f--,m>>=8)h[f]=m&255;return this._createEncoderBuffer([h,n])};ei.prototype._encodeStr=function(t,r){if(r==="bitstr")return this._createEncoderBuffer([t.unused|0,t.data]);if(r==="bmpstr"){for(var i=new cn(t.length*2),n=0;n<t.length;n++)i.writeUInt16BE(t.charCodeAt(n),n*2);return this._createEncoderBuffer(i)}else return r==="numstr"?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):r==="printstr"?this._isPrintstr(t)?this._createEncoderBuffer(t):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(t):r==="objDesc"?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+r+" unsupported")};ei.prototype._encodeObjid=function(t,r,i){if(typeof t=="string"){if(!r)return this.reporter.error("string objid given, but no values map found");if(!r.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=r[t].split(/[\s\.]+/g);for(var n=0;n<t.length;n++)t[n]|=0}else if(Array.isArray(t)){t=t.slice();for(var n=0;n<t.length;n++)t[n]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!i){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,t[0]*40+t[1])}for(var o=0,n=0;n<t.length;n++){var s=t[n];for(o++;s>=128;s>>=7)o++}for(var f=new cn(o),h=f.length-1,n=t.length-1;n>=0;n--){var s=t[n];for(f[h--]=s&127;(s>>=7)>0;)f[h--]=128|s&127}return this._createEncoderBuffer(f)};function Lr(e){return e<10?"0"+e:e}ei.prototype._encodeTime=function(t,r){var i,n=new Date(t);return r==="gentime"?i=[Lr(n.getFullYear()),Lr(n.getUTCMonth()+1),Lr(n.getUTCDate()),Lr(n.getUTCHours()),Lr(n.getUTCMinutes()),Lr(n.getUTCSeconds()),"Z"].join(""):r==="utctime"?i=[Lr(n.getFullYear()%100),Lr(n.getUTCMonth()+1),Lr(n.getUTCDate()),Lr(n.getUTCHours()),Lr(n.getUTCMinutes()),Lr(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+r+" time is not supported yet"),this._encodeStr(i,"octstr")};ei.prototype._encodeNull=function(){return this._createEncoderBuffer("")};ei.prototype._encodeInt=function(t,r){if(typeof t=="string"){if(!r)return this.reporter.error("String int or enum given, but no values map");if(!r.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=r[t]}if(typeof t!="number"&&!cn.isBuffer(t)){var i=t.toArray();!t.sign&&i[0]&128&&i.unshift(0),t=new cn(i)}if(cn.isBuffer(t)){var n=t.length;t.length===0&&n++;var s=new cn(n);return t.copy(s),t.length===0&&(s[0]=0),this._createEncoderBuffer(s)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);for(var n=1,o=t;o>=256;o>>=8)n++;for(var s=new Array(n),o=s.length-1;o>=0;o--)s[o]=t&255,t>>=8;return s[0]&128&&s.unshift(0),this._createEncoderBuffer(new cn(s))};ei.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)};ei.prototype._use=function(t,r){return typeof t=="function"&&(t=t(r)),t._getEncoder("der").tree};ei.prototype._skipDefault=function(t,r,i){var n=this._baseState,o;if(n.default===null)return!1;var s=t.join();if(n.defaultBuffer===void 0&&(n.defaultBuffer=this._encodeValue(n.default,r,i).join()),s.length!==n.defaultBuffer.length)return!1;for(o=0;o<s.length;o++)if(s[o]!==n.defaultBuffer[o])return!1;return!0};function NC(e,t,r,i){var n;if(e==="seqof"?e="seq":e==="setof"&&(e="set"),Kp.tagByName.hasOwnProperty(e))n=Kp.tagByName[e];else if(typeof e=="number"&&(e|0)===e)n=e;else return i.error("Unknown tag: "+e);return n>=31?i.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=Kp.tagClassByName[r||"universal"]<<6,n)}});var pE=B((cW,dE)=>{y();var CC=we(),Gp=Vp();function zp(e){Gp.call(this,e),this.enc="pem"}CC(zp,Gp);dE.exports=zp;zp.prototype.encode=function(t,r){for(var i=Gp.prototype.encode.call(this,t),n=i.toString("base64"),o=["-----BEGIN "+r.label+"-----"],s=0;s<n.length;s+=64)o.push(n.slice(s,s+64));return o.push("-----END "+r.label+"-----"),o.join(`
14
+ `)}});var yE=B(vE=>{y();var gE=vE;gE.der=Vp();gE.pem=pE()});var oa=B(mE=>{y();var fa=mE;fa.bignum=$i();fa.define=K2().define;fa.base=aa();fa.constants=qp();fa.decoders=fE();fa.encoders=yE()});var SE=B((vW,wE)=>{"use strict";y();var ti=oa(),bE=ti.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),DC=ti.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),Wp=ti.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),qC=ti.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(Wp),this.key("subjectPublicKey").bitstr())}),LC=ti.define("RelativeDistinguishedName",function(){this.setof(DC)}),UC=ti.define("RDNSequence",function(){this.seqof(LC)}),_E=ti.define("Name",function(){this.choice({rdnSequence:this.use(UC)})}),FC=ti.define("Validity",function(){this.seq().obj(this.key("notBefore").use(bE),this.key("notAfter").use(bE))}),jC=ti.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),HC=ti.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(Wp),this.key("issuer").use(_E),this.key("validity").use(FC),this.key("subject").use(_E),this.key("subjectPublicKeyInfo").use(qC),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(jC).optional())}),KC=ti.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(HC),this.key("signatureAlgorithm").use(Wp),this.key("signatureValue").bitstr())});wE.exports=KC});var xE=B(ii=>{"use strict";y();var ri=oa();ii.certificate=SE();var VC=ri.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())});ii.RSAPrivateKey=VC;var GC=ri.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});ii.RSAPublicKey=GC;var EE=ri.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())}),zC=ri.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(EE),this.key("subjectPublicKey").bitstr())});ii.PublicKey=zC;var WC=ri.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(EE),this.key("subjectPrivateKey").octstr())});ii.PrivateKey=WC;var YC=ri.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())});ii.EncryptedPrivateKey=YC;var ZC=ri.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())});ii.DSAPrivateKey=ZC;ii.DSAparam=ri.define("DSAparam",function(){this.int()});var $C=ri.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),XC=ri.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use($C),this.key("publicKey").optional().explicit(1).bitstr())});ii.ECPrivateKey=XC;ii.signature=ri.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})});var IE=B((_W,JC)=>{JC.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 OE=B((wW,AE)=>{"use strict";y();var QC=/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,e7=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,t7=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,r7=Gf(),i7=Bh(),Lh=We().Buffer;AE.exports=function(e,t){var r=e.toString(),i=r.match(QC),n;if(i){var s="aes"+i[1],f=Lh.from(i[2],"hex"),h=Lh.from(i[3].replace(/[\r\n]/g,""),"base64"),m=r7(t,f.slice(0,8),parseInt(i[1],10)).key,S=[],x=i7.createDecipheriv(s,m,f);S.push(x.update(h)),S.push(x.final()),n=Lh.concat(S)}else{var o=r.match(t7);n=Lh.from(o[2].replace(/[\r\n]/g,""),"base64")}var I=r.match(e7)[1];return{tag:I,data:n}}});var Zp=B((EW,TE)=>{"use strict";y();var lr=xE(),n7=IE(),o7=OE(),s7=Bh(),a7=op().pbkdf2Sync,Yp=We().Buffer;function f7(e,t){var r=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),n=n7[e.algorithm.decrypt.cipher.algo.join(".")],o=e.algorithm.decrypt.cipher.iv,s=e.subjectPrivateKey,f=parseInt(n.split("-")[1],10)/8,h=a7(t,r,i,f,"sha1"),m=s7.createDecipheriv(n,h,o),S=[];return S.push(m.update(s)),S.push(m.final()),Yp.concat(S)}function RE(e){var t;typeof e=="object"&&!Yp.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e=="string"&&(e=Yp.from(e));var r=o7(e,t),i=r.tag,n=r.data,o,s;switch(i){case"CERTIFICATE":s=lr.certificate.decode(n,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(s||(s=lr.PublicKey.decode(n,"der")),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return lr.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=lr.DSAparam.decode(s.subjectPublicKey.data,"der"),{type:"dsa",data:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":n=lr.EncryptedPrivateKey.decode(n,"der"),n=f7(n,t);case"PRIVATE KEY":switch(s=lr.PrivateKey.decode(n,"der"),o=s.algorithm.algorithm.join("."),o){case"1.2.840.113549.1.1.1":return lr.RSAPrivateKey.decode(s.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:s.algorithm.curve,privateKey:lr.ECPrivateKey.decode(s.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return s.algorithm.params.priv_key=lr.DSAparam.decode(s.subjectPrivateKey,"der"),{type:"dsa",params:s.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return lr.RSAPublicKey.decode(n,"der");case"RSA PRIVATE KEY":return lr.RSAPrivateKey.decode(n,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:lr.DSAPrivateKey.decode(n,"der")};case"EC PRIVATE KEY":return n=lr.ECPrivateKey.decode(n,"der"),{curve:n.parameters.value,privateKey:n.privateKey};default:throw new Error("unknown key type "+i)}}RE.signature=lr.signature;TE.exports=RE});var Xp=B((IW,BE)=>{y();var u7=qf(),$p=We().Buffer;BE.exports=function(e,t){for(var r=$p.alloc(0),i=0,n;r.length<t;)n=c7(i++),r=$p.concat([r,u7("sha1").update(e).update(n).digest()]);return r.slice(0,t)};function c7(e){var t=$p.allocUnsafe(4);return t.writeUInt32BE(e,0),t}});var Jp=B((OW,PE)=>{y();PE.exports=function(t,r){for(var i=t.length,n=-1;++n<i;)t[n]^=r[n];return t}});var Qp=B((TW,kE)=>{y();var ME=$i(),h7=We().Buffer;function l7(e,t){return h7.from(e.toRed(ME.mont(t.modulus)).redPow(new ME(t.publicExponent)).fromRed().toArray())}kE.exports=l7});var CE=B((NE,eg)=>{y();(function(e,t){"use strict";function r(d,a){if(!d)throw new Error(a||"Assertion failed")}function i(d,a){d.super_=a;var u=function(){};u.prototype=a.prototype,d.prototype=new u,d.prototype.constructor=d}function n(d,a,u){if(n.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((a==="le"||a==="be")&&(u=a,a=10),this._init(d||0,a||10,u||"be"))}typeof e=="object"?e.exports=n:t.BN=n,n.BN=n,n.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=xt().Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,u){return a.cmp(u)>0?a:u},n.min=function(a,u){return a.cmp(u)<0?a:u},n.prototype._init=function(a,u,p){if(typeof a=="number")return this._initNumber(a,u,p);if(typeof a=="object")return this._initArray(a,u,p);u==="hex"&&(u=16),r(u===(u|0)&&u>=2&&u<=36),a=a.toString().replace(/\s+/g,"");var b=0;a[0]==="-"&&(b++,this.negative=1),b<a.length&&(u===16?this._parseHex(a,b,p):(this._parseBase(a,u,b),p==="le"&&this._initArray(this.toArray(),u,p)))},n.prototype._initNumber=function(a,u,p){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(r(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),p==="le"&&this._initArray(this.toArray(),u,p)},n.prototype._initArray=function(a,u,p){if(r(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var v,c,w=0;if(p==="be")for(b=a.length-1,v=0;b>=0;b-=3)c=a[b]|a[b-1]<<8|a[b-2]<<16,this.words[v]|=c<<w&67108863,this.words[v+1]=c>>>26-w&67108863,w+=24,w>=26&&(w-=26,v++);else if(p==="le")for(b=0,v=0;b<a.length;b+=3)c=a[b]|a[b+1]<<8|a[b+2]<<16,this.words[v]|=c<<w&67108863,this.words[v+1]=c>>>26-w&67108863,w+=24,w>=26&&(w-=26,v++);return this._strip()};function s(d,a){var u=d.charCodeAt(a);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;r(!1,"Invalid character in "+d)}function f(d,a,u){var p=s(d,u);return u-1>=a&&(p|=s(d,u-1)<<4),p}n.prototype._parseHex=function(a,u,p){this.length=Math.ceil((a.length-u)/6),this.words=new Array(this.length);for(var b=0;b<this.length;b++)this.words[b]=0;var v=0,c=0,w;if(p==="be")for(b=a.length-1;b>=u;b-=2)w=f(a,u,b)<<v,this.words[c]|=w&67108863,v>=18?(v-=18,c+=1,this.words[c]|=w>>>26):v+=8;else{var A=a.length-u;for(b=A%2===0?u+1:u;b<a.length;b+=2)w=f(a,u,b)<<v,this.words[c]|=w&67108863,v>=18?(v-=18,c+=1,this.words[c]|=w>>>26):v+=8}this._strip()};function h(d,a,u,p){for(var b=0,v=0,c=Math.min(d.length,u),w=a;w<c;w++){var A=d.charCodeAt(w)-48;b*=p,A>=49?v=A-49+10:A>=17?v=A-17+10:v=A,r(A>=0&&v<p,"Invalid character"),b+=v}return b}n.prototype._parseBase=function(a,u,p){this.words=[0],this.length=1;for(var b=0,v=1;v<=67108863;v*=u)b++;b--,v=v/u|0;for(var c=a.length-p,w=c%b,A=Math.min(c,c-w)+p,g=0,R=p;R<A;R+=b)g=h(a,R,R+b,u),this.imuln(v),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(w!==0){var U=1;for(g=h(a,R,a.length,u),R=0;R<w;R++)U*=u;this.imuln(U),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this._strip()},n.prototype.copy=function(a){a.words=new Array(this.length);for(var u=0;u<this.length;u++)a.words[u]=this.words[u];a.length=this.length,a.negative=this.negative,a.red=this.red};function m(d,a){d.words=a.words,d.length=a.length,d.negative=a.negative,d.red=a.red}if(n.prototype._move=function(a){m(a,this)},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=S}catch{n.prototype.inspect=S}else n.prototype.inspect=S;function S(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var x=["","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"],I=[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],T=[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];n.prototype.toString=function(a,u){a=a||10,u=u|0||1;var p;if(a===16||a==="hex"){p="";for(var b=0,v=0,c=0;c<this.length;c++){var w=this.words[c],A=((w<<b|v)&16777215).toString(16);v=w>>>24-b&16777215,b+=2,b>=26&&(b-=26,c--),v!==0||c!==this.length-1?p=x[6-A.length]+A+p:p=A+p}for(v!==0&&(p=v.toString(16)+p);p.length%u!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}if(a===(a|0)&&a>=2&&a<=36){var g=I[a],R=T[a];p="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(R).toString(a);U=U.idivn(R),U.isZero()?p=H+p:p=x[g-H.length]+H+p}for(this.isZero()&&(p="0"+p);p.length%u!==0;)p="0"+p;return this.negative!==0&&(p="-"+p),p}r(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16,2)},o&&(n.prototype.toBuffer=function(a,u){return this.toArrayLike(o,a,u)}),n.prototype.toArray=function(a,u){return this.toArrayLike(Array,a,u)};var M=function(a,u){return a.allocUnsafe?a.allocUnsafe(u):new a(u)};n.prototype.toArrayLike=function(a,u,p){this._strip();var b=this.byteLength(),v=p||Math.max(1,b);r(b<=v,"byte array longer than desired length"),r(v>0,"Requested array length <= 0");var c=M(a,v),w=u==="le"?"LE":"BE";return this["_toArrayLike"+w](c,b),c},n.prototype._toArrayLikeLE=function(a,u){for(var p=0,b=0,v=0,c=0;v<this.length;v++){var w=this.words[v]<<c|b;a[p++]=w&255,p<a.length&&(a[p++]=w>>8&255),p<a.length&&(a[p++]=w>>16&255),c===6?(p<a.length&&(a[p++]=w>>24&255),b=0,c=0):(b=w>>>24,c+=2)}if(p<a.length)for(a[p++]=b;p<a.length;)a[p++]=0},n.prototype._toArrayLikeBE=function(a,u){for(var p=a.length-1,b=0,v=0,c=0;v<this.length;v++){var w=this.words[v]<<c|b;a[p--]=w&255,p>=0&&(a[p--]=w>>8&255),p>=0&&(a[p--]=w>>16&255),c===6?(p>=0&&(a[p--]=w>>24&255),b=0,c=0):(b=w>>>24,c+=2)}if(p>=0)for(a[p--]=b;p>=0;)a[p--]=0},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var u=a,p=0;return u>=4096&&(p+=13,u>>>=13),u>=64&&(p+=7,u>>>=7),u>=8&&(p+=4,u>>>=4),u>=2&&(p+=2,u>>>=2),p+u},n.prototype._zeroBits=function(a){if(a===0)return 26;var u=a,p=0;return(u&8191)===0&&(p+=13,u>>>=13),(u&127)===0&&(p+=7,u>>>=7),(u&15)===0&&(p+=4,u>>>=4),(u&3)===0&&(p+=2,u>>>=2),(u&1)===0&&p++,p},n.prototype.bitLength=function(){var a=this.words[this.length-1],u=this._countBits(a);return(this.length-1)*26+u};function N(d){for(var a=new Array(d.bitLength()),u=0;u<a.length;u++){var p=u/26|0,b=u%26;a[u]=d.words[p]>>>b&1}return a}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,u=0;u<this.length;u++){var p=this._zeroBits(this.words[u]);if(a+=p,p!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var u=0;u<a.length;u++)this.words[u]=this.words[u]|a.words[u];return this._strip()},n.prototype.ior=function(a){return r((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var u;this.length>a.length?u=a:u=this;for(var p=0;p<u.length;p++)this.words[p]=this.words[p]&a.words[p];return this.length=u.length,this._strip()},n.prototype.iand=function(a){return r((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var u,p;this.length>a.length?(u=this,p=a):(u=a,p=this);for(var b=0;b<p.length;b++)this.words[b]=u.words[b]^p.words[b];if(this!==u)for(;b<u.length;b++)this.words[b]=u.words[b];return this.length=u.length,this._strip()},n.prototype.ixor=function(a){return r((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){r(typeof a=="number"&&a>=0);var u=Math.ceil(a/26)|0,p=a%26;this._expand(u),p>0&&u--;for(var b=0;b<u;b++)this.words[b]=~this.words[b]&67108863;return p>0&&(this.words[b]=~this.words[b]&67108863>>26-p),this._strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,u){r(typeof a=="number"&&a>=0);var p=a/26|0,b=a%26;return this._expand(p+1),u?this.words[p]=this.words[p]|1<<b:this.words[p]=this.words[p]&~(1<<b),this._strip()},n.prototype.iadd=function(a){var u;if(this.negative!==0&&a.negative===0)return this.negative=0,u=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,u=this.isub(a),a.negative=1,u._normSign();var p,b;this.length>a.length?(p=this,b=a):(p=a,b=this);for(var v=0,c=0;c<b.length;c++)u=(p.words[c]|0)+(b.words[c]|0)+v,this.words[c]=u&67108863,v=u>>>26;for(;v!==0&&c<p.length;c++)u=(p.words[c]|0)+v,this.words[c]=u&67108863,v=u>>>26;if(this.length=p.length,v!==0)this.words[this.length]=v,this.length++;else if(p!==this)for(;c<p.length;c++)this.words[c]=p.words[c];return this},n.prototype.add=function(a){var u;return a.negative!==0&&this.negative===0?(a.negative=0,u=this.sub(a),a.negative^=1,u):a.negative===0&&this.negative!==0?(this.negative=0,u=a.sub(this),this.negative=1,u):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var u=this.iadd(a);return a.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var p=this.cmp(a);if(p===0)return this.negative=0,this.length=1,this.words[0]=0,this;var b,v;p>0?(b=this,v=a):(b=a,v=this);for(var c=0,w=0;w<v.length;w++)u=(b.words[w]|0)-(v.words[w]|0)+c,c=u>>26,this.words[w]=u&67108863;for(;c!==0&&w<b.length;w++)u=(b.words[w]|0)+c,c=u>>26,this.words[w]=u&67108863;if(c===0&&w<b.length&&b!==this)for(;w<b.length;w++)this.words[w]=b.words[w];return this.length=Math.max(this.length,w),b!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function D(d,a,u){u.negative=a.negative^d.negative;var p=d.length+a.length|0;u.length=p,p=p-1|0;var b=d.words[0]|0,v=a.words[0]|0,c=b*v,w=c&67108863,A=c/67108864|0;u.words[0]=w;for(var g=1;g<p;g++){for(var R=A>>>26,U=A&67108863,H=Math.min(g,a.length-1),z=Math.max(0,g-d.length+1);z<=H;z++){var re=g-z|0;b=d.words[re]|0,v=a.words[z]|0,c=b*v+U,R+=c/67108864|0,U=c&67108863}u.words[g]=U|0,A=R|0}return A!==0?u.words[g]=A|0:u.length--,u._strip()}var j=function(a,u,p){var b=a.words,v=u.words,c=p.words,w=0,A,g,R,U=b[0]|0,H=U&8191,z=U>>>13,re=b[1]|0,oe=re&8191,k=re>>>13,L=b[2]|0,F=L&8191,V=L>>>13,fe=b[3]|0,Z=fe&8191,X=fe>>>13,ge=b[4]|0,ee=ge&8191,ae=ge>>>13,ht=b[5]|0,pe=ht&8191,J=ht>>>13,_e=b[6]|0,he=_e&8191,le=_e>>>13,Rr=b[7]|0,xe=Rr&8191,Se=Rr>>>13,no=b[8]|0,Ie=no&8191,Ae=no>>>13,Ka=b[9]|0,Oe=Ka&8191,Re=Ka>>>13,Va=v[0]|0,Te=Va&8191,Be=Va>>>13,Ga=v[1]|0,Pe=Ga&8191,Me=Ga>>>13,za=v[2]|0,ke=za&8191,Ne=za>>>13,Wa=v[3]|0,Ce=Wa&8191,De=Wa>>>13,Ya=v[4]|0,qe=Ya&8191,Le=Ya>>>13,Za=v[5]|0,Ue=Za&8191,Fe=Za>>>13,$a=v[6]|0,je=$a&8191,He=$a>>>13,Xa=v[7]|0,Ke=Xa&8191,Ve=Xa>>>13,Ja=v[8]|0,Ge=Ja&8191,ze=Ja>>>13,xs=v[9]|0,wt=xs&8191,St=xs>>>13;p.negative=a.negative^u.negative,p.length=19,A=Math.imul(H,Te),g=Math.imul(H,Be),g=g+Math.imul(z,Te)|0,R=Math.imul(z,Be);var oo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(oo>>>26)|0,oo&=67108863,A=Math.imul(oe,Te),g=Math.imul(oe,Be),g=g+Math.imul(k,Te)|0,R=Math.imul(k,Be),A=A+Math.imul(H,Pe)|0,g=g+Math.imul(H,Me)|0,g=g+Math.imul(z,Pe)|0,R=R+Math.imul(z,Me)|0;var so=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(so>>>26)|0,so&=67108863,A=Math.imul(F,Te),g=Math.imul(F,Be),g=g+Math.imul(V,Te)|0,R=Math.imul(V,Be),A=A+Math.imul(oe,Pe)|0,g=g+Math.imul(oe,Me)|0,g=g+Math.imul(k,Pe)|0,R=R+Math.imul(k,Me)|0,A=A+Math.imul(H,ke)|0,g=g+Math.imul(H,Ne)|0,g=g+Math.imul(z,ke)|0,R=R+Math.imul(z,Ne)|0;var ao=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ao>>>26)|0,ao&=67108863,A=Math.imul(Z,Te),g=Math.imul(Z,Be),g=g+Math.imul(X,Te)|0,R=Math.imul(X,Be),A=A+Math.imul(F,Pe)|0,g=g+Math.imul(F,Me)|0,g=g+Math.imul(V,Pe)|0,R=R+Math.imul(V,Me)|0,A=A+Math.imul(oe,ke)|0,g=g+Math.imul(oe,Ne)|0,g=g+Math.imul(k,ke)|0,R=R+Math.imul(k,Ne)|0,A=A+Math.imul(H,Ce)|0,g=g+Math.imul(H,De)|0,g=g+Math.imul(z,Ce)|0,R=R+Math.imul(z,De)|0;var fo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(fo>>>26)|0,fo&=67108863,A=Math.imul(ee,Te),g=Math.imul(ee,Be),g=g+Math.imul(ae,Te)|0,R=Math.imul(ae,Be),A=A+Math.imul(Z,Pe)|0,g=g+Math.imul(Z,Me)|0,g=g+Math.imul(X,Pe)|0,R=R+Math.imul(X,Me)|0,A=A+Math.imul(F,ke)|0,g=g+Math.imul(F,Ne)|0,g=g+Math.imul(V,ke)|0,R=R+Math.imul(V,Ne)|0,A=A+Math.imul(oe,Ce)|0,g=g+Math.imul(oe,De)|0,g=g+Math.imul(k,Ce)|0,R=R+Math.imul(k,De)|0,A=A+Math.imul(H,qe)|0,g=g+Math.imul(H,Le)|0,g=g+Math.imul(z,qe)|0,R=R+Math.imul(z,Le)|0;var uo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(uo>>>26)|0,uo&=67108863,A=Math.imul(pe,Te),g=Math.imul(pe,Be),g=g+Math.imul(J,Te)|0,R=Math.imul(J,Be),A=A+Math.imul(ee,Pe)|0,g=g+Math.imul(ee,Me)|0,g=g+Math.imul(ae,Pe)|0,R=R+Math.imul(ae,Me)|0,A=A+Math.imul(Z,ke)|0,g=g+Math.imul(Z,Ne)|0,g=g+Math.imul(X,ke)|0,R=R+Math.imul(X,Ne)|0,A=A+Math.imul(F,Ce)|0,g=g+Math.imul(F,De)|0,g=g+Math.imul(V,Ce)|0,R=R+Math.imul(V,De)|0,A=A+Math.imul(oe,qe)|0,g=g+Math.imul(oe,Le)|0,g=g+Math.imul(k,qe)|0,R=R+Math.imul(k,Le)|0,A=A+Math.imul(H,Ue)|0,g=g+Math.imul(H,Fe)|0,g=g+Math.imul(z,Ue)|0,R=R+Math.imul(z,Fe)|0;var co=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(co>>>26)|0,co&=67108863,A=Math.imul(he,Te),g=Math.imul(he,Be),g=g+Math.imul(le,Te)|0,R=Math.imul(le,Be),A=A+Math.imul(pe,Pe)|0,g=g+Math.imul(pe,Me)|0,g=g+Math.imul(J,Pe)|0,R=R+Math.imul(J,Me)|0,A=A+Math.imul(ee,ke)|0,g=g+Math.imul(ee,Ne)|0,g=g+Math.imul(ae,ke)|0,R=R+Math.imul(ae,Ne)|0,A=A+Math.imul(Z,Ce)|0,g=g+Math.imul(Z,De)|0,g=g+Math.imul(X,Ce)|0,R=R+Math.imul(X,De)|0,A=A+Math.imul(F,qe)|0,g=g+Math.imul(F,Le)|0,g=g+Math.imul(V,qe)|0,R=R+Math.imul(V,Le)|0,A=A+Math.imul(oe,Ue)|0,g=g+Math.imul(oe,Fe)|0,g=g+Math.imul(k,Ue)|0,R=R+Math.imul(k,Fe)|0,A=A+Math.imul(H,je)|0,g=g+Math.imul(H,He)|0,g=g+Math.imul(z,je)|0,R=R+Math.imul(z,He)|0;var ho=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ho>>>26)|0,ho&=67108863,A=Math.imul(xe,Te),g=Math.imul(xe,Be),g=g+Math.imul(Se,Te)|0,R=Math.imul(Se,Be),A=A+Math.imul(he,Pe)|0,g=g+Math.imul(he,Me)|0,g=g+Math.imul(le,Pe)|0,R=R+Math.imul(le,Me)|0,A=A+Math.imul(pe,ke)|0,g=g+Math.imul(pe,Ne)|0,g=g+Math.imul(J,ke)|0,R=R+Math.imul(J,Ne)|0,A=A+Math.imul(ee,Ce)|0,g=g+Math.imul(ee,De)|0,g=g+Math.imul(ae,Ce)|0,R=R+Math.imul(ae,De)|0,A=A+Math.imul(Z,qe)|0,g=g+Math.imul(Z,Le)|0,g=g+Math.imul(X,qe)|0,R=R+Math.imul(X,Le)|0,A=A+Math.imul(F,Ue)|0,g=g+Math.imul(F,Fe)|0,g=g+Math.imul(V,Ue)|0,R=R+Math.imul(V,Fe)|0,A=A+Math.imul(oe,je)|0,g=g+Math.imul(oe,He)|0,g=g+Math.imul(k,je)|0,R=R+Math.imul(k,He)|0,A=A+Math.imul(H,Ke)|0,g=g+Math.imul(H,Ve)|0,g=g+Math.imul(z,Ke)|0,R=R+Math.imul(z,Ve)|0;var lo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(lo>>>26)|0,lo&=67108863,A=Math.imul(Ie,Te),g=Math.imul(Ie,Be),g=g+Math.imul(Ae,Te)|0,R=Math.imul(Ae,Be),A=A+Math.imul(xe,Pe)|0,g=g+Math.imul(xe,Me)|0,g=g+Math.imul(Se,Pe)|0,R=R+Math.imul(Se,Me)|0,A=A+Math.imul(he,ke)|0,g=g+Math.imul(he,Ne)|0,g=g+Math.imul(le,ke)|0,R=R+Math.imul(le,Ne)|0,A=A+Math.imul(pe,Ce)|0,g=g+Math.imul(pe,De)|0,g=g+Math.imul(J,Ce)|0,R=R+Math.imul(J,De)|0,A=A+Math.imul(ee,qe)|0,g=g+Math.imul(ee,Le)|0,g=g+Math.imul(ae,qe)|0,R=R+Math.imul(ae,Le)|0,A=A+Math.imul(Z,Ue)|0,g=g+Math.imul(Z,Fe)|0,g=g+Math.imul(X,Ue)|0,R=R+Math.imul(X,Fe)|0,A=A+Math.imul(F,je)|0,g=g+Math.imul(F,He)|0,g=g+Math.imul(V,je)|0,R=R+Math.imul(V,He)|0,A=A+Math.imul(oe,Ke)|0,g=g+Math.imul(oe,Ve)|0,g=g+Math.imul(k,Ke)|0,R=R+Math.imul(k,Ve)|0,A=A+Math.imul(H,Ge)|0,g=g+Math.imul(H,ze)|0,g=g+Math.imul(z,Ge)|0,R=R+Math.imul(z,ze)|0;var po=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(po>>>26)|0,po&=67108863,A=Math.imul(Oe,Te),g=Math.imul(Oe,Be),g=g+Math.imul(Re,Te)|0,R=Math.imul(Re,Be),A=A+Math.imul(Ie,Pe)|0,g=g+Math.imul(Ie,Me)|0,g=g+Math.imul(Ae,Pe)|0,R=R+Math.imul(Ae,Me)|0,A=A+Math.imul(xe,ke)|0,g=g+Math.imul(xe,Ne)|0,g=g+Math.imul(Se,ke)|0,R=R+Math.imul(Se,Ne)|0,A=A+Math.imul(he,Ce)|0,g=g+Math.imul(he,De)|0,g=g+Math.imul(le,Ce)|0,R=R+Math.imul(le,De)|0,A=A+Math.imul(pe,qe)|0,g=g+Math.imul(pe,Le)|0,g=g+Math.imul(J,qe)|0,R=R+Math.imul(J,Le)|0,A=A+Math.imul(ee,Ue)|0,g=g+Math.imul(ee,Fe)|0,g=g+Math.imul(ae,Ue)|0,R=R+Math.imul(ae,Fe)|0,A=A+Math.imul(Z,je)|0,g=g+Math.imul(Z,He)|0,g=g+Math.imul(X,je)|0,R=R+Math.imul(X,He)|0,A=A+Math.imul(F,Ke)|0,g=g+Math.imul(F,Ve)|0,g=g+Math.imul(V,Ke)|0,R=R+Math.imul(V,Ve)|0,A=A+Math.imul(oe,Ge)|0,g=g+Math.imul(oe,ze)|0,g=g+Math.imul(k,Ge)|0,R=R+Math.imul(k,ze)|0,A=A+Math.imul(H,wt)|0,g=g+Math.imul(H,St)|0,g=g+Math.imul(z,wt)|0,R=R+Math.imul(z,St)|0;var go=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(go>>>26)|0,go&=67108863,A=Math.imul(Oe,Pe),g=Math.imul(Oe,Me),g=g+Math.imul(Re,Pe)|0,R=Math.imul(Re,Me),A=A+Math.imul(Ie,ke)|0,g=g+Math.imul(Ie,Ne)|0,g=g+Math.imul(Ae,ke)|0,R=R+Math.imul(Ae,Ne)|0,A=A+Math.imul(xe,Ce)|0,g=g+Math.imul(xe,De)|0,g=g+Math.imul(Se,Ce)|0,R=R+Math.imul(Se,De)|0,A=A+Math.imul(he,qe)|0,g=g+Math.imul(he,Le)|0,g=g+Math.imul(le,qe)|0,R=R+Math.imul(le,Le)|0,A=A+Math.imul(pe,Ue)|0,g=g+Math.imul(pe,Fe)|0,g=g+Math.imul(J,Ue)|0,R=R+Math.imul(J,Fe)|0,A=A+Math.imul(ee,je)|0,g=g+Math.imul(ee,He)|0,g=g+Math.imul(ae,je)|0,R=R+Math.imul(ae,He)|0,A=A+Math.imul(Z,Ke)|0,g=g+Math.imul(Z,Ve)|0,g=g+Math.imul(X,Ke)|0,R=R+Math.imul(X,Ve)|0,A=A+Math.imul(F,Ge)|0,g=g+Math.imul(F,ze)|0,g=g+Math.imul(V,Ge)|0,R=R+Math.imul(V,ze)|0,A=A+Math.imul(oe,wt)|0,g=g+Math.imul(oe,St)|0,g=g+Math.imul(k,wt)|0,R=R+Math.imul(k,St)|0;var vo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(vo>>>26)|0,vo&=67108863,A=Math.imul(Oe,ke),g=Math.imul(Oe,Ne),g=g+Math.imul(Re,ke)|0,R=Math.imul(Re,Ne),A=A+Math.imul(Ie,Ce)|0,g=g+Math.imul(Ie,De)|0,g=g+Math.imul(Ae,Ce)|0,R=R+Math.imul(Ae,De)|0,A=A+Math.imul(xe,qe)|0,g=g+Math.imul(xe,Le)|0,g=g+Math.imul(Se,qe)|0,R=R+Math.imul(Se,Le)|0,A=A+Math.imul(he,Ue)|0,g=g+Math.imul(he,Fe)|0,g=g+Math.imul(le,Ue)|0,R=R+Math.imul(le,Fe)|0,A=A+Math.imul(pe,je)|0,g=g+Math.imul(pe,He)|0,g=g+Math.imul(J,je)|0,R=R+Math.imul(J,He)|0,A=A+Math.imul(ee,Ke)|0,g=g+Math.imul(ee,Ve)|0,g=g+Math.imul(ae,Ke)|0,R=R+Math.imul(ae,Ve)|0,A=A+Math.imul(Z,Ge)|0,g=g+Math.imul(Z,ze)|0,g=g+Math.imul(X,Ge)|0,R=R+Math.imul(X,ze)|0,A=A+Math.imul(F,wt)|0,g=g+Math.imul(F,St)|0,g=g+Math.imul(V,wt)|0,R=R+Math.imul(V,St)|0;var yo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(yo>>>26)|0,yo&=67108863,A=Math.imul(Oe,Ce),g=Math.imul(Oe,De),g=g+Math.imul(Re,Ce)|0,R=Math.imul(Re,De),A=A+Math.imul(Ie,qe)|0,g=g+Math.imul(Ie,Le)|0,g=g+Math.imul(Ae,qe)|0,R=R+Math.imul(Ae,Le)|0,A=A+Math.imul(xe,Ue)|0,g=g+Math.imul(xe,Fe)|0,g=g+Math.imul(Se,Ue)|0,R=R+Math.imul(Se,Fe)|0,A=A+Math.imul(he,je)|0,g=g+Math.imul(he,He)|0,g=g+Math.imul(le,je)|0,R=R+Math.imul(le,He)|0,A=A+Math.imul(pe,Ke)|0,g=g+Math.imul(pe,Ve)|0,g=g+Math.imul(J,Ke)|0,R=R+Math.imul(J,Ve)|0,A=A+Math.imul(ee,Ge)|0,g=g+Math.imul(ee,ze)|0,g=g+Math.imul(ae,Ge)|0,R=R+Math.imul(ae,ze)|0,A=A+Math.imul(Z,wt)|0,g=g+Math.imul(Z,St)|0,g=g+Math.imul(X,wt)|0,R=R+Math.imul(X,St)|0;var mo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(mo>>>26)|0,mo&=67108863,A=Math.imul(Oe,qe),g=Math.imul(Oe,Le),g=g+Math.imul(Re,qe)|0,R=Math.imul(Re,Le),A=A+Math.imul(Ie,Ue)|0,g=g+Math.imul(Ie,Fe)|0,g=g+Math.imul(Ae,Ue)|0,R=R+Math.imul(Ae,Fe)|0,A=A+Math.imul(xe,je)|0,g=g+Math.imul(xe,He)|0,g=g+Math.imul(Se,je)|0,R=R+Math.imul(Se,He)|0,A=A+Math.imul(he,Ke)|0,g=g+Math.imul(he,Ve)|0,g=g+Math.imul(le,Ke)|0,R=R+Math.imul(le,Ve)|0,A=A+Math.imul(pe,Ge)|0,g=g+Math.imul(pe,ze)|0,g=g+Math.imul(J,Ge)|0,R=R+Math.imul(J,ze)|0,A=A+Math.imul(ee,wt)|0,g=g+Math.imul(ee,St)|0,g=g+Math.imul(ae,wt)|0,R=R+Math.imul(ae,St)|0;var bo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(bo>>>26)|0,bo&=67108863,A=Math.imul(Oe,Ue),g=Math.imul(Oe,Fe),g=g+Math.imul(Re,Ue)|0,R=Math.imul(Re,Fe),A=A+Math.imul(Ie,je)|0,g=g+Math.imul(Ie,He)|0,g=g+Math.imul(Ae,je)|0,R=R+Math.imul(Ae,He)|0,A=A+Math.imul(xe,Ke)|0,g=g+Math.imul(xe,Ve)|0,g=g+Math.imul(Se,Ke)|0,R=R+Math.imul(Se,Ve)|0,A=A+Math.imul(he,Ge)|0,g=g+Math.imul(he,ze)|0,g=g+Math.imul(le,Ge)|0,R=R+Math.imul(le,ze)|0,A=A+Math.imul(pe,wt)|0,g=g+Math.imul(pe,St)|0,g=g+Math.imul(J,wt)|0,R=R+Math.imul(J,St)|0;var _o=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(_o>>>26)|0,_o&=67108863,A=Math.imul(Oe,je),g=Math.imul(Oe,He),g=g+Math.imul(Re,je)|0,R=Math.imul(Re,He),A=A+Math.imul(Ie,Ke)|0,g=g+Math.imul(Ie,Ve)|0,g=g+Math.imul(Ae,Ke)|0,R=R+Math.imul(Ae,Ve)|0,A=A+Math.imul(xe,Ge)|0,g=g+Math.imul(xe,ze)|0,g=g+Math.imul(Se,Ge)|0,R=R+Math.imul(Se,ze)|0,A=A+Math.imul(he,wt)|0,g=g+Math.imul(he,St)|0,g=g+Math.imul(le,wt)|0,R=R+Math.imul(le,St)|0;var wo=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(wo>>>26)|0,wo&=67108863,A=Math.imul(Oe,Ke),g=Math.imul(Oe,Ve),g=g+Math.imul(Re,Ke)|0,R=Math.imul(Re,Ve),A=A+Math.imul(Ie,Ge)|0,g=g+Math.imul(Ie,ze)|0,g=g+Math.imul(Ae,Ge)|0,R=R+Math.imul(Ae,ze)|0,A=A+Math.imul(xe,wt)|0,g=g+Math.imul(xe,St)|0,g=g+Math.imul(Se,wt)|0,R=R+Math.imul(Se,St)|0;var ed=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(ed>>>26)|0,ed&=67108863,A=Math.imul(Oe,Ge),g=Math.imul(Oe,ze),g=g+Math.imul(Re,Ge)|0,R=Math.imul(Re,ze),A=A+Math.imul(Ie,wt)|0,g=g+Math.imul(Ie,St)|0,g=g+Math.imul(Ae,wt)|0,R=R+Math.imul(Ae,St)|0;var td=(w+A|0)+((g&8191)<<13)|0;w=(R+(g>>>13)|0)+(td>>>26)|0,td&=67108863,A=Math.imul(Oe,wt),g=Math.imul(Oe,St),g=g+Math.imul(Re,wt)|0,R=Math.imul(Re,St);var rd=(w+A|0)+((g&8191)<<13)|0;return w=(R+(g>>>13)|0)+(rd>>>26)|0,rd&=67108863,c[0]=oo,c[1]=so,c[2]=ao,c[3]=fo,c[4]=uo,c[5]=co,c[6]=ho,c[7]=lo,c[8]=po,c[9]=go,c[10]=vo,c[11]=yo,c[12]=mo,c[13]=bo,c[14]=_o,c[15]=wo,c[16]=ed,c[17]=td,c[18]=rd,w!==0&&(c[19]=w,p.length++),p};Math.imul||(j=D);function Y(d,a,u){u.negative=a.negative^d.negative,u.length=d.length+a.length;for(var p=0,b=0,v=0;v<u.length-1;v++){var c=b;b=0;for(var w=p&67108863,A=Math.min(v,a.length-1),g=Math.max(0,v-d.length+1);g<=A;g++){var R=v-g,U=d.words[R]|0,H=a.words[g]|0,z=U*H,re=z&67108863;c=c+(z/67108864|0)|0,re=re+w|0,w=re&67108863,c=c+(re>>>26)|0,b+=c>>>26,c&=67108863}u.words[v]=w,p=c,c=b}return p!==0?u.words[v]=p:u.length--,u._strip()}function Q(d,a,u){return Y(d,a,u)}n.prototype.mulTo=function(a,u){var p,b=this.length+a.length;return this.length===10&&a.length===10?p=j(this,a,u):b<63?p=D(this,a,u):b<1024?p=Y(this,a,u):p=Q(this,a,u),p};function W(d,a){this.x=d,this.y=a}W.prototype.makeRBT=function(a){for(var u=new Array(a),p=n.prototype._countBits(a)-1,b=0;b<a;b++)u[b]=this.revBin(b,p,a);return u},W.prototype.revBin=function(a,u,p){if(a===0||a===p-1)return a;for(var b=0,v=0;v<u;v++)b|=(a&1)<<u-v-1,a>>=1;return b},W.prototype.permute=function(a,u,p,b,v,c){for(var w=0;w<c;w++)b[w]=u[a[w]],v[w]=p[a[w]]},W.prototype.transform=function(a,u,p,b,v,c){this.permute(c,a,u,p,b,v);for(var w=1;w<v;w<<=1)for(var A=w<<1,g=Math.cos(2*Math.PI/A),R=Math.sin(2*Math.PI/A),U=0;U<v;U+=A)for(var H=g,z=R,re=0;re<w;re++){var oe=p[U+re],k=b[U+re],L=p[U+re+w],F=b[U+re+w],V=H*L-z*F;F=H*F+z*L,L=V,p[U+re]=oe+L,b[U+re]=k+F,p[U+re+w]=oe-L,b[U+re+w]=k-F,re!==A&&(V=g*H-R*z,z=g*z+R*H,H=V)}},W.prototype.guessLen13b=function(a,u){var p=Math.max(u,a)|1,b=p&1,v=0;for(p=p/2|0;p;p=p>>>1)v++;return 1<<v+1+b},W.prototype.conjugate=function(a,u,p){if(!(p<=1))for(var b=0;b<p/2;b++){var v=a[b];a[b]=a[p-b-1],a[p-b-1]=v,v=u[b],u[b]=-u[p-b-1],u[p-b-1]=-v}},W.prototype.normalize13b=function(a,u){for(var p=0,b=0;b<u/2;b++){var v=Math.round(a[2*b+1]/u)*8192+Math.round(a[2*b]/u)+p;a[b]=v&67108863,v<67108864?p=0:p=v/67108864|0}return a},W.prototype.convert13b=function(a,u,p,b){for(var v=0,c=0;c<u;c++)v=v+(a[c]|0),p[2*c]=v&8191,v=v>>>13,p[2*c+1]=v&8191,v=v>>>13;for(c=2*u;c<b;++c)p[c]=0;r(v===0),r((v&-8192)===0)},W.prototype.stub=function(a){for(var u=new Array(a),p=0;p<a;p++)u[p]=0;return u},W.prototype.mulp=function(a,u,p){var b=2*this.guessLen13b(a.length,u.length),v=this.makeRBT(b),c=this.stub(b),w=new Array(b),A=new Array(b),g=new Array(b),R=new Array(b),U=new Array(b),H=new Array(b),z=p.words;z.length=b,this.convert13b(a.words,a.length,w,b),this.convert13b(u.words,u.length,R,b),this.transform(w,c,A,g,b,v),this.transform(R,c,U,H,b,v);for(var re=0;re<b;re++){var oe=A[re]*U[re]-g[re]*H[re];g[re]=A[re]*H[re]+g[re]*U[re],A[re]=oe}return this.conjugate(A,g,b),this.transform(A,g,z,c,b,v),this.conjugate(z,c,b),this.normalize13b(z,b),p.negative=a.negative^u.negative,p.length=a.length+u.length,p._strip()},n.prototype.mul=function(a){var u=new n(null);return u.words=new Array(this.length+a.length),this.mulTo(a,u)},n.prototype.mulf=function(a){var u=new n(null);return u.words=new Array(this.length+a.length),Q(this,a,u)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){var u=a<0;u&&(a=-a),r(typeof a=="number"),r(a<67108864);for(var p=0,b=0;b<this.length;b++){var v=(this.words[b]|0)*a,c=(v&67108863)+(p&67108863);p>>=26,p+=v/67108864|0,p+=c>>>26,this.words[b]=c&67108863}return p!==0&&(this.words[b]=p,this.length++),this.length=a===0?1:this.length,u?this.ineg():this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var u=N(a);if(u.length===0)return new n(1);for(var p=this,b=0;b<u.length&&u[b]===0;b++,p=p.sqr());if(++b<u.length)for(var v=p.sqr();b<u.length;b++,v=v.sqr())u[b]!==0&&(p=p.mul(v));return p},n.prototype.iushln=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26,b=67108863>>>26-u<<26-u,v;if(u!==0){var c=0;for(v=0;v<this.length;v++){var w=this.words[v]&b,A=(this.words[v]|0)-w<<u;this.words[v]=A|c,c=w>>>26-u}c&&(this.words[v]=c,this.length++)}if(p!==0){for(v=this.length-1;v>=0;v--)this.words[v+p]=this.words[v];for(v=0;v<p;v++)this.words[v]=0;this.length+=p}return this._strip()},n.prototype.ishln=function(a){return r(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,u,p){r(typeof a=="number"&&a>=0);var b;u?b=(u-u%26)/26:b=0;var v=a%26,c=Math.min((a-v)/26,this.length),w=67108863^67108863>>>v<<v,A=p;if(b-=c,b=Math.max(0,b),A){for(var g=0;g<c;g++)A.words[g]=this.words[g];A.length=c}if(c!==0)if(this.length>c)for(this.length-=c,g=0;g<this.length;g++)this.words[g]=this.words[g+c];else this.words[0]=0,this.length=1;var R=0;for(g=this.length-1;g>=0&&(R!==0||g>=b);g--){var U=this.words[g]|0;this.words[g]=R<<26-v|U>>>v,R=U&w}return A&&R!==0&&(A.words[A.length++]=R),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(a,u,p){return r(this.negative===0),this.iushrn(a,u,p)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26,b=1<<u;if(this.length<=p)return!1;var v=this.words[p];return!!(v&b)},n.prototype.imaskn=function(a){r(typeof a=="number"&&a>=0);var u=a%26,p=(a-u)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=p)return this;if(u!==0&&p++,this.length=Math.min(p,this.length),u!==0){var b=67108863^67108863>>>u<<u;this.words[this.length-1]&=b}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return r(typeof a=="number"),r(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;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},n.prototype.isubn=function(a){if(r(typeof a=="number"),r(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,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()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,u,p){var b=a.length+p,v;this._expand(b);var c,w=0;for(v=0;v<a.length;v++){c=(this.words[v+p]|0)+w;var A=(a.words[v]|0)*u;c-=A&67108863,w=(c>>26)-(A/67108864|0),this.words[v+p]=c&67108863}for(;v<this.length-p;v++)c=(this.words[v+p]|0)+w,w=c>>26,this.words[v+p]=c&67108863;if(w===0)return this._strip();for(r(w===-1),w=0,v=0;v<this.length;v++)c=-(this.words[v]|0)+w,w=c>>26,this.words[v]=c&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(a,u){var p=this.length-a.length,b=this.clone(),v=a,c=v.words[v.length-1]|0,w=this._countBits(c);p=26-w,p!==0&&(v=v.ushln(p),b.iushln(p),c=v.words[v.length-1]|0);var A=b.length-v.length,g;if(u!=="mod"){g=new n(null),g.length=A+1,g.words=new Array(g.length);for(var R=0;R<g.length;R++)g.words[R]=0}var U=b.clone()._ishlnsubmul(v,1,A);U.negative===0&&(b=U,g&&(g.words[A]=1));for(var H=A-1;H>=0;H--){var z=(b.words[v.length+H]|0)*67108864+(b.words[v.length+H-1]|0);for(z=Math.min(z/c|0,67108863),b._ishlnsubmul(v,z,H);b.negative!==0;)z--,b.negative=0,b._ishlnsubmul(v,1,H),b.isZero()||(b.negative^=1);g&&(g.words[H]=z)}return g&&g._strip(),b._strip(),u!=="div"&&p!==0&&b.iushrn(p),{div:g||null,mod:b}},n.prototype.divmod=function(a,u,p){if(r(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var b,v,c;return this.negative!==0&&a.negative===0?(c=this.neg().divmod(a,u),u!=="mod"&&(b=c.div.neg()),u!=="div"&&(v=c.mod.neg(),p&&v.negative!==0&&v.iadd(a)),{div:b,mod:v}):this.negative===0&&a.negative!==0?(c=this.divmod(a.neg(),u),u!=="mod"&&(b=c.div.neg()),{div:b,mod:c.mod}):(this.negative&a.negative)!==0?(c=this.neg().divmod(a.neg(),u),u!=="div"&&(v=c.mod.neg(),p&&v.negative!==0&&v.isub(a)),{div:c.div,mod:v}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?u==="div"?{div:this.divn(a.words[0]),mod:null}:u==="mod"?{div:null,mod:new n(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modrn(a.words[0]))}:this._wordDiv(a,u)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var u=this.divmod(a);if(u.mod.isZero())return u.div;var p=u.div.negative!==0?u.mod.isub(a):u.mod,b=a.ushrn(1),v=a.andln(1),c=p.cmp(b);return c<0||v===1&&c===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},n.prototype.modrn=function(a){var u=a<0;u&&(a=-a),r(a<=67108863);for(var p=(1<<26)%a,b=0,v=this.length-1;v>=0;v--)b=(p*b+(this.words[v]|0))%a;return u?-b:b},n.prototype.modn=function(a){return this.modrn(a)},n.prototype.idivn=function(a){var u=a<0;u&&(a=-a),r(a<=67108863);for(var p=0,b=this.length-1;b>=0;b--){var v=(this.words[b]|0)+p*67108864;this.words[b]=v/a|0,p=v%a}return this._strip(),u?this.ineg():this},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){r(a.negative===0),r(!a.isZero());var u=this,p=a.clone();u.negative!==0?u=u.umod(a):u=u.clone();for(var b=new n(1),v=new n(0),c=new n(0),w=new n(1),A=0;u.isEven()&&p.isEven();)u.iushrn(1),p.iushrn(1),++A;for(var g=p.clone(),R=u.clone();!u.isZero();){for(var U=0,H=1;(u.words[0]&H)===0&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(b.isOdd()||v.isOdd())&&(b.iadd(g),v.isub(R)),b.iushrn(1),v.iushrn(1);for(var z=0,re=1;(p.words[0]&re)===0&&z<26;++z,re<<=1);if(z>0)for(p.iushrn(z);z-- >0;)(c.isOdd()||w.isOdd())&&(c.iadd(g),w.isub(R)),c.iushrn(1),w.iushrn(1);u.cmp(p)>=0?(u.isub(p),b.isub(c),v.isub(w)):(p.isub(u),c.isub(b),w.isub(v))}return{a:c,b:w,gcd:p.iushln(A)}},n.prototype._invmp=function(a){r(a.negative===0),r(!a.isZero());var u=this,p=a.clone();u.negative!==0?u=u.umod(a):u=u.clone();for(var b=new n(1),v=new n(0),c=p.clone();u.cmpn(1)>0&&p.cmpn(1)>0;){for(var w=0,A=1;(u.words[0]&A)===0&&w<26;++w,A<<=1);if(w>0)for(u.iushrn(w);w-- >0;)b.isOdd()&&b.iadd(c),b.iushrn(1);for(var g=0,R=1;(p.words[0]&R)===0&&g<26;++g,R<<=1);if(g>0)for(p.iushrn(g);g-- >0;)v.isOdd()&&v.iadd(c),v.iushrn(1);u.cmp(p)>=0?(u.isub(p),b.isub(v)):(p.isub(u),v.isub(b))}var U;return u.cmpn(1)===0?U=b:U=v,U.cmpn(0)<0&&U.iadd(a),U},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var u=this.clone(),p=a.clone();u.negative=0,p.negative=0;for(var b=0;u.isEven()&&p.isEven();b++)u.iushrn(1),p.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;p.isEven();)p.iushrn(1);var v=u.cmp(p);if(v<0){var c=u;u=p,p=c}else if(v===0||p.cmpn(1)===0)break;u.isub(p)}while(!0);return p.iushln(b)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){r(typeof a=="number");var u=a%26,p=(a-u)/26,b=1<<u;if(this.length<=p)return this._expand(p+1),this.words[p]|=b,this;for(var v=b,c=p;v!==0&&c<this.length;c++){var w=this.words[c]|0;w+=v,v=w>>>26,w&=67108863,this.words[c]=w}return v!==0&&(this.words[c]=v,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var u=a<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var p;if(this.length>1)p=1;else{u&&(a=-a),r(a<=67108863,"Number is too big");var b=this.words[0]|0;p=b===a?0:b<a?-1:1}return this.negative!==0?-p|0:p},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var u=this.ucmp(a);return this.negative!==0?-u|0:u},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var u=0,p=this.length-1;p>=0;p--){var b=this.words[p]|0,v=a.words[p]|0;if(b!==v){b<v?u=-1:b>v&&(u=1);break}}return u},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new l(a)},n.prototype.toRed=function(a){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return r(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return r(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var te={k256:null,p224:null,p192:null,p25519:null};function ne(d,a){this.name=d,this.p=new n(a,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ne.prototype._tmp=function(){var a=new n(null);return a.words=new Array(Math.ceil(this.n/13)),a},ne.prototype.ireduce=function(a){var u=a,p;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),p=u.bitLength();while(p>this.n);var b=p<this.n?-1:u.ucmp(this.p);return b===0?(u.words[0]=0,u.length=1):b>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},ne.prototype.split=function(a,u){a.iushrn(this.n,0,u)},ne.prototype.imulK=function(a){return a.imul(this.k)};function se(){ne.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(se,ne),se.prototype.split=function(a,u){for(var p=4194303,b=Math.min(a.length,9),v=0;v<b;v++)u.words[v]=a.words[v];if(u.length=b,a.length<=9){a.words[0]=0,a.length=1;return}var c=a.words[9];for(u.words[u.length++]=c&p,v=10;v<a.length;v++){var w=a.words[v]|0;a.words[v-10]=(w&p)<<4|c>>>22,c=w}c>>>=22,a.words[v-10]=c,c===0&&a.length>10?a.length-=10:a.length-=9},se.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var u=0,p=0;p<a.length;p++){var b=a.words[p]|0;u+=b*977,a.words[p]=u&67108863,u=b*64+(u/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function ue(){ne.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(ue,ne);function be(){ne.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(be,ne);function P(){ne.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(P,ne),P.prototype.imulK=function(a){for(var u=0,p=0;p<a.length;p++){var b=(a.words[p]|0)*19+u,v=b&67108863;b>>>=26,a.words[p]=v,u=b}return u!==0&&(a.words[a.length++]=u),a},n._prime=function(a){if(te[a])return te[a];var u;if(a==="k256")u=new se;else if(a==="p224")u=new ue;else if(a==="p192")u=new be;else if(a==="p25519")u=new P;else throw new Error("Unknown prime "+a);return te[a]=u,u};function l(d){if(typeof d=="string"){var a=n._prime(d);this.m=a.p,this.prime=a}else r(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}l.prototype._verify1=function(a){r(a.negative===0,"red works only with positives"),r(a.red,"red works only with red numbers")},l.prototype._verify2=function(a,u){r((a.negative|u.negative)===0,"red works only with positives"),r(a.red&&a.red===u.red,"red works only with red numbers")},l.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(m(a,a.umod(this.m)._forceRed(this)),a)},l.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},l.prototype.add=function(a,u){this._verify2(a,u);var p=a.add(u);return p.cmp(this.m)>=0&&p.isub(this.m),p._forceRed(this)},l.prototype.iadd=function(a,u){this._verify2(a,u);var p=a.iadd(u);return p.cmp(this.m)>=0&&p.isub(this.m),p},l.prototype.sub=function(a,u){this._verify2(a,u);var p=a.sub(u);return p.cmpn(0)<0&&p.iadd(this.m),p._forceRed(this)},l.prototype.isub=function(a,u){this._verify2(a,u);var p=a.isub(u);return p.cmpn(0)<0&&p.iadd(this.m),p},l.prototype.shl=function(a,u){return this._verify1(a),this.imod(a.ushln(u))},l.prototype.imul=function(a,u){return this._verify2(a,u),this.imod(a.imul(u))},l.prototype.mul=function(a,u){return this._verify2(a,u),this.imod(a.mul(u))},l.prototype.isqr=function(a){return this.imul(a,a.clone())},l.prototype.sqr=function(a){return this.mul(a,a)},l.prototype.sqrt=function(a){if(a.isZero())return a.clone();var u=this.m.andln(3);if(r(u%2===1),u===3){var p=this.m.add(new n(1)).iushrn(2);return this.pow(a,p)}for(var b=this.m.subn(1),v=0;!b.isZero()&&b.andln(1)===0;)v++,b.iushrn(1);r(!b.isZero());var c=new n(1).toRed(this),w=c.redNeg(),A=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new n(2*g*g).toRed(this);this.pow(g,A).cmp(w)!==0;)g.redIAdd(w);for(var R=this.pow(g,b),U=this.pow(a,b.addn(1).iushrn(1)),H=this.pow(a,b),z=v;H.cmp(c)!==0;){for(var re=H,oe=0;re.cmp(c)!==0;oe++)re=re.redSqr();r(oe<z);var k=this.pow(R,new n(1).iushln(z-oe-1));U=U.redMul(k),R=k.redSqr(),H=H.redMul(R),z=oe}return U},l.prototype.invm=function(a){var u=a._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},l.prototype.pow=function(a,u){if(u.isZero())return new n(1).toRed(this);if(u.cmpn(1)===0)return a.clone();var p=4,b=new Array(1<<p);b[0]=new n(1).toRed(this),b[1]=a;for(var v=2;v<b.length;v++)b[v]=this.mul(b[v-1],a);var c=b[0],w=0,A=0,g=u.bitLength()%26;for(g===0&&(g=26),v=u.length-1;v>=0;v--){for(var R=u.words[v],U=g-1;U>=0;U--){var H=R>>U&1;if(c!==b[0]&&(c=this.sqr(c)),H===0&&w===0){A=0;continue}w<<=1,w|=H,A++,!(A!==p&&(v!==0||U!==0))&&(c=this.mul(c,b[w]),A=0,w=0)}g=26}return c},l.prototype.convertTo=function(a){var u=a.umod(this.m);return u===a?u.clone():u},l.prototype.convertFrom=function(a){var u=a.clone();return u.red=null,u},n.mont=function(a){return new E(a)};function E(d){l.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(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)}i(E,l),E.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},E.prototype.convertFrom=function(a){var u=this.imod(a.mul(this.rinv));return u.red=null,u},E.prototype.imul=function(a,u){if(a.isZero()||u.isZero())return a.words[0]=0,a.length=1,a;var p=a.imul(u),b=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=p.isub(b).iushrn(this.shift),c=v;return v.cmp(this.m)>=0?c=v.isub(this.m):v.cmpn(0)<0&&(c=v.iadd(this.m)),c._forceRed(this)},E.prototype.mul=function(a,u){if(a.isZero()||u.isZero())return new n(0)._forceRed(this);var p=a.mul(u),b=p.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=p.isub(b).iushrn(this.shift),c=v;return v.cmp(this.m)>=0?c=v.isub(this.m):v.cmpn(0)<0&&(c=v.iadd(this.m)),c._forceRed(this)},E.prototype.invm=function(a){var u=this.imod(a._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(typeof eg>"u"||eg,NE)});var tg=B((MW,LE)=>{"use strict";y();var ua=CE(),d7=Ao(),p7=We().Buffer;function DE(e){var t=e.modulus.byteLength(),r;do r=new ua(d7(t));while(r.cmp(e.modulus)>=0||!r.umod(e.prime1)||!r.umod(e.prime2));return r}function g7(e){var t=DE(e),r=t.toRed(ua.mont(e.modulus)).redPow(new ua(e.publicExponent)).fromRed();return{blinder:r,unblinder:t.invm(e.modulus)}}function qE(e,t){var r=g7(t),i=t.modulus.byteLength(),n=new ua(e).mul(r.blinder).umod(t.modulus),o=n.toRed(ua.mont(t.prime1)),s=n.toRed(ua.mont(t.prime2)),f=t.coefficient,h=t.prime1,m=t.prime2,S=o.redPow(t.exponent1).fromRed(),x=s.redPow(t.exponent2).fromRed(),I=S.isub(x).imul(f).umod(h).imul(m);return x.iadd(I).imul(r.unblinder).umod(t.modulus).toArrayLike(p7,"be",i)}qE.getr=DE;LE.exports=qE});var HE=B((NW,jE)=>{y();var v7=Zp(),rg=Ao(),y7=qf(),UE=Xp(),FE=Jp(),ig=$i(),m7=Qp(),b7=tg(),ni=We().Buffer;jE.exports=function(t,r,i){var n;t.padding?n=t.padding:i?n=1:n=4;var o=v7(t),s;if(n===4)s=_7(o,r);else if(n===1)s=w7(o,r,i);else if(n===3){if(s=new ig(r),s.cmp(o.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return i?b7(s,o):m7(s,o)};function _7(e,t){var r=e.modulus.byteLength(),i=t.length,n=y7("sha1").update(ni.alloc(0)).digest(),o=n.length,s=2*o;if(i>r-s-2)throw new Error("message too long");var f=ni.alloc(r-i-s-2),h=r-o-1,m=rg(o),S=FE(ni.concat([n,f,ni.alloc(1,1),t],h),UE(m,h)),x=FE(m,UE(S,o));return new ig(ni.concat([ni.alloc(1),x,S],r))}function w7(e,t,r){var i=t.length,n=e.modulus.byteLength();if(i>n-11)throw new Error("message too long");var o;return r?o=ni.alloc(n-i-3,255):o=S7(n-i-3),new ig(ni.concat([ni.from([0,r?1:2]),o,ni.alloc(1),t],n))}function S7(e){for(var t=ni.allocUnsafe(e),r=0,i=rg(e*2),n=0,o;r<e;)n===i.length&&(i=rg(e*2),n=0),o=i[n++],o&&(t[r++]=o);return t}});var WE=B((DW,zE)=>{y();var E7=Zp(),KE=Xp(),VE=Jp(),GE=$i(),x7=tg(),I7=qf(),A7=Qp(),Zf=We().Buffer;zE.exports=function(t,r,i){var n;t.padding?n=t.padding:i?n=1:n=4;var o=E7(t),s=o.modulus.byteLength();if(r.length>s||new GE(r).cmp(o.modulus)>=0)throw new Error("decryption error");var f;i?f=A7(new GE(r),o):f=x7(r,o);var h=Zf.alloc(s-f.length);if(f=Zf.concat([h,f],s),n===4)return O7(o,f);if(n===1)return R7(o,f,i);if(n===3)return f;throw new Error("unknown padding")};function O7(e,t){var r=e.modulus.byteLength(),i=I7("sha1").update(Zf.alloc(0)).digest(),n=i.length;if(t[0]!==0)throw new Error("decryption error");var o=t.slice(1,n+1),s=t.slice(n+1),f=VE(o,KE(s,n)),h=VE(s,KE(f,r-n-1));if(T7(i,h.slice(0,n)))throw new Error("decryption error");for(var m=n;h[m]===0;)m++;if(h[m++]!==1)throw new Error("decryption error");return h.slice(m)}function R7(e,t,r){for(var i=t.slice(0,2),n=2,o=0;t[n++]!==0;)if(n>=t.length){o++;break}var s=t.slice(2,n-1);if((i.toString("hex")!=="0002"&&!r||i.toString("hex")!=="0001"&&r)&&o++,s.length<8&&o++,o)throw new Error("decryption error");return t.slice(n)}function T7(e,t){e=Zf.from(e),t=Zf.from(t);var r=0,i=e.length;e.length!==t.length&&(r++,i=Math.min(e.length,t.length));for(var n=-1;++n<i;)r+=e[n]^t[n];return r}});var YE=B(Xo=>{y();Xo.publicEncrypt=HE();Xo.privateDecrypt=WE();Xo.privateEncrypt=function(t,r){return Xo.publicEncrypt(t,r,!0)};Xo.publicDecrypt=function(t,r){return Xo.privateDecrypt(t,r,!0)}});var nx=B($f=>{"use strict";y();function ZE(){throw new Error(`secure random number generation not supported by this browser
15
+ use chrome, FireFox or Internet Explorer 11`)}var XE=We(),$E=Ao(),JE=XE.Buffer,QE=XE.kMaxLength,ng=globalThis.crypto||globalThis.msCrypto,ex=Math.pow(2,32)-1;function tx(e,t){if(typeof e!="number"||e!==e)throw new TypeError("offset must be a number");if(e>ex||e<0)throw new TypeError("offset must be a uint32");if(e>QE||e>t)throw new RangeError("offset out of range")}function rx(e,t,r){if(typeof e!="number"||e!==e)throw new TypeError("size must be a number");if(e>ex||e<0)throw new TypeError("size must be a uint32");if(e+t>r||e>QE)throw new RangeError("buffer too small")}ng&&ng.getRandomValues||!O.default.browser?($f.randomFill=B7,$f.randomFillSync=P7):($f.randomFill=ZE,$f.randomFillSync=ZE);function B7(e,t,r,i){if(!JE.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof t=="function")i=t,t=0,r=e.length;else if(typeof r=="function")i=r,r=e.length-t;else if(typeof i!="function")throw new TypeError('"cb" argument must be a function');return tx(t,e.length),rx(r,t,e.length),ix(e,t,r,i)}function ix(e,t,r,i){if(O.default.browser){var n=e.buffer,o=new Uint8Array(n,t,r);if(ng.getRandomValues(o),i){O.default.nextTick(function(){i(null,e)});return}return e}if(i){$E(r,function(f,h){if(f)return i(f);h.copy(e,t),i(null,e)});return}var s=$E(r);return s.copy(e,t),e}function P7(e,t,r){if(typeof t>"u"&&(t=0),!JE.isBuffer(e)&&!(e instanceof globalThis.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return tx(t,e.length),r===void 0&&(r=e.length-t),rx(r,t,e.length),ix(e,t,r)}});var Ph=B(Ye=>{"use strict";y();Ye.randomBytes=Ye.rng=Ye.pseudoRandomBytes=Ye.prng=Ao();Ye.createHash=Ye.Hash=qf();Ye.createHmac=Ye.Hmac=tS();var M7=gh(),k7=Object.keys(M7),N7=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(k7);Ye.getHashes=function(){return N7};var ox=op();Ye.pbkdf2=ox.pbkdf2;Ye.pbkdf2Sync=ox.pbkdf2Sync;var Mi=A2();Ye.Cipher=Mi.Cipher;Ye.createCipher=Mi.createCipher;Ye.Cipheriv=Mi.Cipheriv;Ye.createCipheriv=Mi.createCipheriv;Ye.Decipher=Mi.Decipher;Ye.createDecipher=Mi.createDecipher;Ye.Decipheriv=Mi.Decipheriv;Ye.createDecipheriv=Mi.createDecipheriv;Ye.getCiphers=Mi.getCiphers;Ye.listCiphers=Mi.listCiphers;var Xf=U2();Ye.DiffieHellmanGroup=Xf.DiffieHellmanGroup;Ye.createDiffieHellmanGroup=Xf.createDiffieHellmanGroup;Ye.getDiffieHellman=Xf.getDiffieHellman;Ye.createDiffieHellman=Xf.createDiffieHellman;Ye.DiffieHellman=Xf.DiffieHellman;var Uh=gh();Ye.createSign=Uh.createSign;Ye.Sign=Uh.Sign;Ye.createVerify=Uh.createVerify;Ye.Verify=Uh.Verify;Ye.createECDH=gh();var Fh=YE();Ye.publicEncrypt=Fh.publicEncrypt;Ye.privateEncrypt=Fh.privateEncrypt;Ye.publicDecrypt=Fh.publicDecrypt;Ye.privateDecrypt=Fh.privateDecrypt;var sx=nx();Ye.randomFill=sx.randomFill;Ye.randomFillSync=sx.randomFillSync;Ye.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
16
16
  we accept pull requests
17
17
  https://github.com/browserify/crypto-browserify`)};Ye.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 Jf=B((VW,ax)=>{"use strict";y();function ca(){}ca.getRandomBuffer=function(e){return O.default.browser?ca.getRandomBufferBrowser(e):ca.getRandomBufferNode(e)};ca.getRandomBufferNode=function(e){var t=Ph();return t.randomBytes(e)};ca.getRandomBufferBrowser=function(e){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");var t;if(window.crypto&&window.crypto.getRandomValues)t=window.crypto;else if(window.msCrypto&&window.msCrypto.getRandomValues)t=window.msCrypto;else throw new Error("window.crypto.getRandomValues not available");var r=new Uint8Array(e);t.getRandomValues(r);var i=_.Buffer.from(r);return i};ax.exports=ca});var mt=B((zW,fx)=>{"use strict";y();var C7=Jf(),yt={};yt.isArray=e=>Array.isArray(e);yt.isNumber=e=>typeof e=="number";yt.isObject=e=>e&&typeof e=="object";yt.isString=e=>typeof e=="string";yt.isUndefined=e=>typeof e>"u";yt.isFunction=e=>typeof e=="function";yt.isNull=e=>e===null;yt.isDate=e=>e instanceof Date;yt.extend=(e,t)=>Object.assign(e,t);yt.noop=()=>{};yt.every=(e,t)=>e.every(t||(r=>r));yt.map=(e,t)=>Array.from(e).map(t||(r=>r));yt.includes=(e,t)=>e.includes(t);yt.each=(e,t)=>e.forEach(t);yt.clone=e=>Object.assign({},e);yt.pick=(e,t)=>{let r={};return t.forEach(i=>{typeof e[i]<"u"&&(r[i]=e[i])}),r};yt.values=e=>Object.values(e);yt.filter=(e,t)=>e.filter(t);yt.reduce=(e,t,r)=>e.reduce(t,r);yt.without=(e,t)=>e.filter(r=>r!==t);yt.shuffle=e=>{let t=e.slice(0);for(let r=t.length-1;r>0;r--){let n=C7.getRandomBuffer(4).readUInt32BE(0)/4294967296,o=Math.floor(n*(r+1));[t[r],t[o]]=[t[o],t[r]]}return t};yt.difference=(e,t)=>e.filter(r=>!t.includes(r));yt.findIndex=(e,t)=>e.findIndex(t);yt.some=(e,t)=>e.some(t);yt.range=e=>[...Array(e).keys()];fx.exports=yt});var cx=B((YW,ux)=>{"use strict";y();var D7="https://docs.moneybutton.com/";ux.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+D7+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"MerkleBlock",message:"Internal Error on MerkleBlock {0}",errors:[{name:"InvalidMerkleTree",message:"This MerkleBlock contain an invalid Merkle Tree"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]});var jn=B(($W,sg)=>{"use strict";y();var og=mt();function q7(e,t){return e.replace("{0}",t[0]).replace("{1}",t[1]).replace("{2}",t[2])}var hx=function(e,t){var r=function(){if(og.isString(t.message))this.message=q7(t.message,arguments);else if(og.isFunction(t.message))this.message=t.message.apply(null,arguments);else throw new Error("Invalid error definition for "+t.name);this.stack=this.message+`
18
- `+new Error().stack};return r.prototype=Object.create(e.prototype),r.prototype.name=e.prototype.name+t.name,e[t.name]=r,t.errors&&lx(r,t.errors),r},lx=function(e,t){og.each(t,function(r){hx(e,r)})},U7=function(e,t){return lx(e,t),e},ha={};ha.Error=function(){this.message="Internal error",this.stack=this.message+`
19
- `+new Error().stack};ha.Error.prototype=Object.create(Error.prototype);ha.Error.prototype.name="bsv.Error";var L7=cx();U7(ha.Error,L7);sg.exports=ha.Error;sg.exports.extend=function(e){return hx(ha.Error,e)}});var at=B((JW,dx)=>{"use strict";y();var Qf=jn(),F7=mt();dx.exports={checkState:function(e,t){if(!e)throw new Qf.InvalidState(t)},checkArgument:function(e,t,r,i){if(!e)throw new Qf.InvalidArgument(t,r,i)},checkArgumentType:function(e,t,r){if(r=r||"(unknown name)",F7.isString(t)){if(t==="Buffer"){var i=xt();if(!i.Buffer.isBuffer(e))throw new Qf.InvalidArgumentType(e,t,r)}else if(typeof e!==t)throw new Qf.InvalidArgumentType(e,t,r)}else if(!(e instanceof t))throw new Qf.InvalidArgumentType(e,t.name,r)}}});var Lr=B((eY,gx)=>{"use strict";y();var nt=$i(),ag=at(),px=mt(),jh=function(e){for(var t=_.Buffer.alloc(e.length),r=0;r<e.length;r++)t[r]=e[e.length-1-r];return t};nt.Zero=new nt(0);nt.One=new nt(1);nt.Minus1=new nt(-1);nt.fromNumber=function(e){return ag.checkArgument(px.isNumber(e)),new nt(e)};nt.fromString=function(e,t){return ag.checkArgument(px.isString(e)),new nt(e,t)};nt.fromBuffer=function(e,t){typeof t<"u"&&t.endian==="little"&&(e=jh(e));var r=e.toString("hex"),i=new nt(r,16);return i};nt.fromSM=function(e,t){var r;if(e.length===0)return nt.fromBuffer(_.Buffer.from([0]));var i="big";return t&&(i=t.endian),i==="little"&&(e=jh(e)),e[0]&128?(e[0]=e[0]&127,r=nt.fromBuffer(e),r.neg().copy(r)):r=nt.fromBuffer(e),r};nt.prototype.toNumber=function(){return parseInt(this.toString(10),10)};nt.prototype.toBuffer=function(e){var t,r;if(e&&e.size){r=this.toString(16,2);var i=r.length/2;t=_.Buffer.from(r,"hex"),i===e.size||(i>e.size?t=nt.trim(t,i):i<e.size&&(t=nt.pad(t,i,e.size)))}else r=this.toString(16,2),t=_.Buffer.from(r,"hex");return typeof e<"u"&&e.endian==="little"&&(t=jh(t)),t};nt.prototype.toSMBigEndian=function(){var e;return this.cmp(nt.Zero)===-1?(e=this.neg().toBuffer(),e[0]&128?e=_.Buffer.concat([_.Buffer.from([128]),e]):e[0]=e[0]|128):(e=this.toBuffer(),e[0]&128&&(e=_.Buffer.concat([_.Buffer.from([0]),e]))),e.length===1&&e[0]===0&&(e=_.Buffer.from([])),e};nt.prototype.toSM=function(e){var t=e?e.endian:"big",r=this.toSMBigEndian();return t==="little"&&(r=jh(r)),r};nt.fromScriptNumBuffer=function(e,t,r){var i=r||4;if(ag.checkArgument(e.length<=i,new Error("script number overflow")),t&&e.length>0&&(e[e.length-1]&127)===0&&(e.length<=1||(e[e.length-2]&128)===0))throw new Error("non-minimally encoded script number");return nt.fromSM(e,{endian:"little"})};nt.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})};nt.trim=function(e,t){return e.slice(t-e.length,e.length)};nt.pad=function(e,t,r){for(var i=_.Buffer.alloc(r),n=0;n<e.length;n++)i[i.length-1-n]=e[e.length-1-n];for(n=0;n<r-t;n++)i[n]=0;return i};nt.prototype.toHex=function(...e){return this.toBuffer(...e).toString("hex")};nt.fromHex=function(e,...t){return nt.fromBuffer(_.Buffer.from(e,"hex"),...t)};gx.exports=nt});function fg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Hn(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new RangeError(`${r}expected integer >= 0, got ${e}`)}}function ki(e,t,r=""){let i=fg(e),n=e?.length,o=t!==void 0;if(!i||o&&n!==t){let s=r&&`"${r}" `,f=o?` of length ${t}`:"",h=i?`length=${n}`:`type=${typeof e}`,m=s+"expected Uint8Array"+f+", got "+h;throw i?new RangeError(m):new TypeError(m)}return e}function Hh(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Hn(e.outputLen),Hn(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function la(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Kh(e,t){ki(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function Jo(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Vh(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function oi(e,t){return e<<32-t|e>>>t}function Gh(e){if(ki(e),yx)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=j7[e[r]];return t}function vx(e){if(e>=hn._0&&e<=hn._9)return e-hn._0;if(e>=hn.A&&e<=hn.F)return e-(hn.A-10);if(e>=hn.a&&e<=hn.f)return e-(hn.a-10)}function ug(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(yx)try{return Uint8Array.fromHex(e)}catch(n){throw n instanceof SyntaxError?new RangeError(n.message):n}let t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let n=0,o=0;n<r;n++,o+=2){let s=vx(e.charCodeAt(o)),f=vx(e.charCodeAt(o+1));if(s===void 0||f===void 0){let h=e[o]+e[o+1];throw new RangeError('hex string expected, got non-hex character "'+h+'" at index '+o)}i[n]=s*16+f}return i}function ln(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function mx(...e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];ki(n),t+=n.length}let r=new Uint8Array(t);for(let i=0,n=0;i<e.length;i++){let o=e[i];r.set(o,n),n+=o.length}return r}function bx(e,t={}){let r=(n,o)=>e(o).update(n).digest(),i=e(void 0);return r.outputLen=i.outputLen,r.blockLen=i.blockLen,r.canXOF=i.canXOF,r.create=n=>e(n),Object.assign(r,t),Object.freeze(r)}function eu(e=32){Hn(e,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var yx,j7,hn,_x,Kn=br(()=>{y();yx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",j7=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));hn={_0:48,_9:57,A:65,F:70,a:97,f:102};_x=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})});function wx(e,t,r){return e&t^~e&r}function Sx(e,t,r){return e&t^e&r^t&r}var zh,dn,Ex=br(()=>{y();Kn();zh=class{constructor(t,r,i,n){de(this,"blockLen");de(this,"outputLen");de(this,"canXOF",!1);de(this,"padOffset");de(this,"isLE");de(this,"buffer");de(this,"view");de(this,"finished",!1);de(this,"length",0);de(this,"pos",0);de(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=Vh(this.buffer)}update(t){la(this),ki(t);let{view:r,buffer:i,blockLen:n}=this,o=t.length;for(let s=0;s<o;){let f=Math.min(n-this.pos,o-s);if(f===n){let h=Vh(t);for(;n<=o-s;s+=n)this.process(h,s);continue}i.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){la(this),Kh(t,this),this.finished=!0;let{buffer:r,view:i,blockLen:n,isLE:o}=this,{pos:s}=this;r[s++]=128,Jo(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(i,0),s=0);for(let x=s;x<n;x++)r[x]=0;i.setBigUint64(n-8,BigInt(this.length*8),o),this.process(i,0);let f=Vh(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let m=h/4,S=this.get();if(m>S.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<m;x++)f.setUint32(4*x,S[x],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let i=t.slice(0,r);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:i,length:n,finished:o,destroyed:s,pos:f}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=f,n%r&&t.buffer.set(i),t}clone(){return this._cloneInto()}},dn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225])});var H7,Vn,cg,hg,Qo,xx=br(()=>{y();Ex();Kn();H7=Uint32Array.from([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]),Vn=new Uint32Array(64),cg=class extends zh{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:i,D:n,E:o,F:s,G:f,H:h}=this;return[t,r,i,n,o,s,f,h]}set(t,r,i,n,o,s,f,h){this.A=t|0,this.B=r|0,this.C=i|0,this.D=n|0,this.E=o|0,this.F=s|0,this.G=f|0,this.H=h|0}process(t,r){for(let x=0;x<16;x++,r+=4)Vn[x]=t.getUint32(r,!1);for(let x=16;x<64;x++){let I=Vn[x-15],T=Vn[x-2],M=oi(I,7)^oi(I,18)^I>>>3,N=oi(T,17)^oi(T,19)^T>>>10;Vn[x]=N+Vn[x-7]+M+Vn[x-16]|0}let{A:i,B:n,C:o,D:s,E:f,F:h,G:m,H:S}=this;for(let x=0;x<64;x++){let I=oi(f,6)^oi(f,11)^oi(f,25),T=S+I+wx(f,h,m)+H7[x]+Vn[x]|0,N=(oi(i,2)^oi(i,13)^oi(i,22))+Sx(i,n,o)|0;S=m,m=h,h=f,f=s+T|0,s=o,o=n,n=i,i=T+N|0}i=i+this.A|0,n=n+this.B|0,o=o+this.C|0,s=s+this.D|0,f=f+this.E|0,h=h+this.F|0,m=m+this.G|0,S=S+this.H|0,this.set(i,n,o,s,f,h,m,S)}roundClean(){Jo(Vn)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Jo(this.buffer)}},hg=class extends cg{constructor(){super(32);de(this,"A",dn[0]|0);de(this,"B",dn[1]|0);de(this,"C",dn[2]|0);de(this,"D",dn[3]|0);de(this,"E",dn[4]|0);de(this,"F",dn[5]|0);de(this,"G",dn[6]|0);de(this,"H",dn[7]|0)}},Qo=bx(()=>new hg,_x(1))});function ts(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function Zh(e){if(typeof e=="bigint"){if(!Wh(e))throw new RangeError("positive bigint expected, got "+e)}else dg(e);return e}function Fr(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function tu(e){let t=Zh(e).toString(16);return t.length&1?"0"+t:t}function Ix(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Yh:BigInt("0x"+e)}function or(e){return Ix(Gh(e))}function pa(e){return Ix(Gh(Xh(ki(e)).reverse()))}function $h(e,t){if(Hn(t),t===0)throw new RangeError("zero length");e=Zh(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return ug(r.padStart(t*2,"0"))}function pg(e,t){return $h(e,t).reverse()}function Xh(e){return Uint8Array.from(ct(e))}function ga(e){if(typeof e!="string")throw new TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let i=t.charCodeAt(0);if(t.length!==1||i>127)throw new RangeError(`string contains non-ASCII character "${e[r]}" with code ${i} at position ${r}`);return i})}function K7(e,t,r){return Wh(e)&&Wh(t)&&Wh(r)&&t<=e&&e<r}function gg(e,t,r,i){if(!K7(t,r,i))throw new RangeError("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function rs(e){if(e<Yh)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Yh;e>>=lg,t+=1);return t}function Ax(e,t,r){if(Hn(e,"hashLen"),Hn(t,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let i=D=>new Uint8Array(D),n=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),f=1e3,h=i(e),m=i(e),S=0,x=()=>{h.fill(1),m.fill(0),S=0},I=(...D)=>r(m,st(h,...D)),T=(D=n)=>{m=I(o,D),h=I(),D.length!==0&&(m=I(s,D),h=I())},M=()=>{if(S++>=f)throw new Error("drbg: tried max amount of iterations");let D=0,j=[];for(;D<t;){h=I();let Y=h.slice();j.push(Y),D+=h.length}return st(...j)};return(D,j)=>{x(),T(D);let Y;for(;(Y=j(M()))===void 0;)T();return x(),Y}}function jr(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(o,s,f){if(!f&&s!=="function"&&!Object.hasOwn(e,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let h=e[o];if(f&&h===void 0)return;let m=typeof h;if(m!==s||h===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${m}`)}let n=(o,s)=>Object.entries(o).forEach(([f,h])=>i(f,h,s));n(t,!1),n(r,!0)}var ct,dg,pn,st,da,es,dr,Yh,lg,Wh,va,is=br(()=>{y();Kn();ct=(e,t,r)=>ki(e,t,r),dg=Hn,pn=Gh,st=(...e)=>mx(...e),da=e=>ug(e),es=fg,dr=e=>eu(e),Yh=BigInt(0),lg=BigInt(1);Wh=e=>typeof e=="bigint"&&Yh<=e;va=e=>(lg<<BigInt(e))-lg});function wr(e,t){if(t<=Zt)throw new Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=Zt?r:t+r}function Sr(e,t,r){if(t<Zt)throw new Error("pow2: expected non-negative exponent, got "+t);let i=e;for(;t-- >Zt;)i*=i,i%=r;return i}function Ox(e,t){if(e===Zt)throw new Error("invert: expected non-zero number");if(t<=Zt)throw new Error("invert: expected positive modulus, got "+t);let r=wr(e,t),i=t,n=Zt,o=Mt,s=Mt,f=Zt;for(;r!==Zt;){let m=i/r,S=i-r*m,x=n-s*m,I=o-f*m;i=r,r=S,n=s,o=f,s=x,f=I}if(i!==Mt)throw new Error("invert: does not exist");return wr(n,t)}function yg(e,t,r){let i=e;if(!i.eql(i.sqr(t),r))throw new Error("Cannot find square root")}function Nx(e,t){let r=e,i=(r.ORDER+Mt)/Bx,n=r.pow(t,i);return yg(r,n,t),n}function z7(e,t){let r=e,i=(r.ORDER-Px)/Mx,n=r.mul(t,ns),o=r.pow(n,i),s=r.mul(t,o),f=r.mul(r.mul(s,ns),o),h=r.mul(s,r.sub(f,r.ONE));return yg(r,h,t),h}function W7(e){let t=ya(e),r=Cx(e),i=r(t,t.neg(t.ONE)),n=r(t,i),o=r(t,t.neg(i)),s=(e+V7)/kx;return((f,h)=>{let m=f,S=m.pow(h,s),x=m.mul(S,i),I=m.mul(S,n),T=m.mul(S,o),M=m.eql(m.sqr(x),h),N=m.eql(m.sqr(I),h);S=m.cmov(S,x,M),x=m.cmov(T,I,N);let D=m.eql(m.sqr(x),h),j=m.cmov(S,x,D);return yg(m,j,h),j})}function Cx(e){if(e<Tx)throw new Error("sqrt is not defined for small field");let t=e-Mt,r=0;for(;t%ns===Zt;)t/=ns,r++;let i=ns,n=ya(e);for(;vg(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Nx;let o=n.pow(i,t),s=(t+Mt)/ns;return function(h,m){let S=h;if(S.is0(m))return m;if(vg(S,m)!==1)throw new Error("Cannot find square root");let x=r,I=S.mul(S.ONE,o),T=S.pow(m,t),M=S.pow(m,s);for(;!S.eql(T,S.ONE);){if(S.is0(T))return S.ZERO;let N=1,D=S.sqr(T);for(;!S.eql(D,S.ONE);)if(N++,D=S.sqr(D),N===x)throw new Error("Cannot find square root");let j=Mt<<BigInt(x-N-1),Y=S.pow(I,j);x=N,I=S.sqr(Y),T=S.mul(T,I),M=S.mul(M,Y)}return M}}function Y7(e){return e%Bx===Tx?Nx:e%Mx===Px?z7:e%kx===G7?W7(e):Cx(e)}function os(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Z7.reduce((i,n)=>(i[n]="function",i),t);if(jr(e,r),Fr(e.BYTES,"BYTES"),Fr(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=Mt)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function $7(e,t,r){let i=e;if(r<Zt)throw new Error("invalid exponent, negatives unsupported");if(r===Zt)return i.ONE;if(r===Mt)return t;let n=i.ONE,o=t;for(;r>Zt;)r&Mt&&(n=i.mul(n,o)),o=i.sqr(o),r>>=Mt;return n}function ss(e,t,r=!1){let i=e,n=new Array(t.length).fill(r?i.ZERO:void 0),o=t.reduce((f,h,m)=>i.is0(h)?f:(n[m]=f,i.mul(f,h)),i.ONE),s=i.inv(o);return t.reduceRight((f,h,m)=>i.is0(h)?f:(n[m]=i.mul(f,n[m]),i.mul(f,h)),s),n}function vg(e,t){let r=e,i=(r.ORDER-Mt)/ns,n=r.pow(t,i),o=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),f=r.eql(n,r.neg(r.ONE));if(!o&&!s&&!f)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function mg(e,t){return vg(e,t)!==-1}function X7(e,t){if(t!==void 0&&dg(t),e<=Zt)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let r=rs(e);if(t!==void 0&&t<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let i=t!==void 0?t:r,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}function ya(e,t={}){return new Jh(e,t)}function Dx(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=Mt)throw new Error("field order must be greater than 1");let t=rs(e-Mt);return Math.ceil(t/8)}function ru(e){let t=Dx(e);return t+Math.ceil(t/2)}function ma(e,t,r=!1){ct(e);let i=e.length,n=Dx(t),o=Math.max(ru(t),16);if(i<o||i>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+i);let s=r?pa(e):or(e),f=wr(s,t-Mt)+Mt;return r?pg(f,n):$h(f,n)}var Zt,Mt,ns,Tx,Bx,Px,V7,Mx,G7,kx,Z7,Rx,Jh,ba=br(()=>{y();is();Zt=BigInt(0),Mt=BigInt(1),ns=BigInt(2),Tx=BigInt(3),Bx=BigInt(4),Px=BigInt(5),V7=BigInt(7),Mx=BigInt(8),G7=BigInt(9),kx=BigInt(16);Z7=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];Rx=new WeakMap,Jh=class{constructor(t,r={}){de(this,"ORDER");de(this,"BITS");de(this,"BYTES");de(this,"isLE");de(this,"ZERO",Zt);de(this,"ONE",Mt);de(this,"_lengths");de(this,"_mod");if(t<=Mt)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(i=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:n,nByteLength:o}=X7(t,i);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=o,Object.freeze(this)}create(t){return wr(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Zt<=t&&t<this.ORDER}is0(t){return t===Zt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&Mt)===Mt}neg(t){return wr(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return wr(t*t,this.ORDER)}add(t,r){return wr(t+r,this.ORDER)}sub(t,r){return wr(t-r,this.ORDER)}mul(t,r){return wr(t*r,this.ORDER)}pow(t,r){return $7(this,t,r)}div(t,r){return wr(t*Ox(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return Ox(t,this.ORDER)}sqrt(t){let r=Rx.get(this);return r||Rx.set(this,r=Y7(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?pg(t,this.BYTES):$h(t,this.BYTES)}fromBytes(t,r=!1){ct(t);let{_lengths:i,BYTES:n,isLE:o,ORDER:s,_mod:f}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let m=new Uint8Array(n);m.set(t,o?0:m.length-t.length),t=m}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let h=o?pa(t):or(t);if(f&&(h=wr(h,s)),!r&&!this.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h}invertBatch(t){return ss(this,t)}cmov(t,r,i){return ts(i,"condition"),i?r:t}};Object.freeze(Jh.prototype)});function Fx(e){let t=e;if(typeof t!="function")throw new TypeError("Point must be a constructor");jr({Fp:t.Fp,Fn:t.Fn,fromAffine:t.fromAffine,fromBytes:t.fromBytes,fromHex:t.fromHex},{Fp:"object",Fn:"object",fromAffine:"function",fromBytes:"function",fromHex:"function"}),os(t.Fp),os(t.Fn)}function iu(e,t){let r=t.negate();return e?r:t}function Sg(e,t){let r=ss(e.Fp,t.map(i=>i.Z));return t.map((i,n)=>e.fromAffine(i.toAffine(r[n])))}function jx(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function bg(e,t){jx(e,t);let r=Math.ceil(t/e)+1,i=2**(e-1),n=2**e,o=va(e),s=BigInt(e);return{windows:r,windowSize:i,mask:o,maxNumber:n,shiftBy:s}}function qx(e,t,r){let{windowSize:i,mask:n,maxNumber:o,shiftBy:s}=r,f=Number(e&n),h=e>>s;f>i&&(f-=o,h+=as);let m=t*i,S=m+Math.abs(f)-1,x=f===0,I=f<0,T=t%2!==0;return{nextN:h,offset:S,isZero:x,isNeg:I,isNegF:T,offsetF:m}}function J7(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,i)=>{if(!(r instanceof t))throw new Error("invalid point at index "+i)})}function Q7(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,i)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+i)})}function wg(e){return Hx.get(e)||1}function Ux(e){if(e!==_a)throw new Error("invalid wNAF")}function Kx(e,t,r,i){let n=t,o=e.ZERO,s=e.ZERO;for(;r>_a||i>_a;)r&as&&(o=o.add(n)),i&as&&(s=s.add(n)),n=n.double(),r>>=as,i>>=as;return{p1:o,p2:s}}function Vx(e,t,r){let i=e.Fn;J7(t,e),Q7(r,i);let n=t.length,o=r.length;if(n!==o)throw new Error("arrays of points and scalars must have equal length");let s=e.ZERO,f=rs(BigInt(n)),h=1;f>12?h=f-3:f>4?h=f-2:f>0&&(h=2);let m=va(h),S=new Array(Number(m)+1).fill(s),x=Math.floor((i.BITS-1)/h)*h,I=s;for(let T=x;T>=0;T-=h){S.fill(s);for(let N=0;N<o;N++){let D=r[N],j=Number(D>>BigInt(T)&m);S[j]=S[j].add(t[N])}let M=s;for(let N=S.length-1,D=s;N>0;N--)D=D.add(S[N]),M=M.add(D);if(I=I.add(M),T!==0)for(let N=0;N<h;N++)I=I.double()}return I}function Lx(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return os(t),t}else return ya(e,{isLE:r})}function Gx(e,t,r={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let h of["p","n","h"]){let m=t[h];if(!(typeof m=="bigint"&&m>_a))throw new Error(`CURVE.${h} must be positive bigint`)}let n=Lx(t.p,r.Fp,i),o=Lx(t.n,r.Fn,i),f=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let h of f)if(!n.isValid(t[h]))throw new Error(`CURVE.${h} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:o}}function el(e,t){return function(i){let n=e(i);return{secretKey:n,publicKey:t(n)}}}var _a,as,_g,Hx,Qh,tl=br(()=>{y();is();ba();_a=BigInt(0),as=BigInt(1);_g=new WeakMap,Hx=new WeakMap;Qh=class{constructor(t,r){de(this,"BASE");de(this,"ZERO");de(this,"Fn");de(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,i=this.ZERO){let n=t;for(;r>_a;)r&as&&(i=i.add(n)),n=n.double(),r>>=as;return i}precomputeWindow(t,r){let{windows:i,windowSize:n}=bg(r,this.bits),o=[],s=t,f=s;for(let h=0;h<i;h++){f=s,o.push(f);for(let m=1;m<n;m++)f=f.add(s),o.push(f);s=f.double()}return o}wNAF(t,r,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let n=this.ZERO,o=this.BASE,s=bg(t,this.bits);for(let f=0;f<s.windows;f++){let{nextN:h,offset:m,isZero:S,isNeg:x,isNegF:I,offsetF:T}=qx(i,f,s);i=h,S?o=o.add(iu(I,r[T])):n=n.add(iu(x,r[m]))}return Ux(i),{p:n,f:o}}wNAFUnsafe(t,r,i,n=this.ZERO){let o=bg(t,this.bits);for(let s=0;s<o.windows&&i!==_a;s++){let{nextN:f,offset:h,isZero:m,isNeg:S}=qx(i,s,o);if(i=f,!m){let x=r[h];n=n.add(S?x.negate():x)}}return Ux(i),n}getPrecomputes(t,r,i){let n=_g.get(r);return n||(n=this.precomputeWindow(r,t),t!==1&&(typeof i=="function"&&(n=i(n)),_g.set(r,n))),n}cached(t,r,i){let n=wg(t);return this.wNAF(n,this.getPrecomputes(n,t,i),r)}unsafe(t,r,i,n){let o=wg(t);return o===1?this._unsafeLadder(t,r,n):this.wNAFUnsafe(o,this.getPrecomputes(o,t,i),r,n)}createCache(t,r){jx(r,this.bits),Hx.set(t,r),_g.delete(t)}hasCache(t){return wg(t)!==1}}});function zx(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function eD(e){if(zx(e),e<=1)return 1;if(e>2147483648)throw new Error("nextPowerOfTwo overflow: result does not fit u32");return 1<<Eg(e-1)+1>>>0}function Eg(e){return zx(e),31-Math.clz32(e)}function Wx(e,t,r,i,n){let o=e,s=r||((S,x)=>new Array(S).fill(x??o.ZERO)),f=S=>{if(Array.isArray(S))return!0;if(!ArrayBuffer.isView(S))return!1;let x=S;return typeof x.length=="number"&&typeof x.slice=="function"&&typeof x[Symbol.iterator]=="function"},h=(...S)=>{if(!S.length)return 0;for(let I of S)if(!f(I))throw new Error("poly: not polynomial: "+I);let x=S[0].length;for(let I=1;I<S.length;I++)if(S[I].length!==x)throw new Error(`poly: mismatched lengths ${x} vs ${S[I].length}`);if(n!==void 0&&x!==n)throw new Error(`poly: expected fixed length ${n}, got ${x}`);return x};function m(S,x,I=!1){let T=Eg(x),M=I?t.brp(T):t.roots(T);for(let N=0;N<x;N++)if(o.eql(S,M[N]))return N;return-1}return{roots:t,create:s,length:n,extend:(S,x)=>{h(S);let I=s(x,o.ZERO);for(let T=0;T<Math.min(S.length,x);T++)I[T]=S[T];return I},degree:S=>{h(S);for(let x=S.length-1;x>=0;x--)if(!o.is0(S[x]))return x;return-1},add:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.add(S[M],x[M]);return T},sub:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.sub(S[M],x[M]);return T},dot:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.mul(S[M],x[M]);return T},mul:(S,x)=>{if(f(x)){let I=h(S,x);if(i){let T=i.direct(S,!1,!0),M=i.direct(x,!1,!0);for(let N=0;N<T.length;N++)T[N]=o.mul(T[N],M[N]);return i.inverse(T,!0,!1)}else{let T=s(I);for(let M=0;M<I;M++)for(let N=0;N<I;N++){let D=(M+N)%I;T[D]=o.add(T[D],o.mul(S[M],x[N]))}return T}}else{let I=s(h(S));for(let T=0;T<I.length;T++)I[T]=o.mul(S[T],x);return I}},convolve(S,x){let I=eD(S.length+x.length-1);return this.mul(this.extend(S,I),this.extend(x,I))},shift(S,x){let I=s(h(S));I[0]=S[0];for(let T=1,M=o.ONE;T<S.length;T++)M=o.mul(M,x),I[T]=o.mul(S[T],M);return I},clone:S=>{h(S);let x=s(S.length);for(let I=0;I<S.length;I++)x[I]=S[I];return x},eval:(S,x)=>{h(S,x);let I=o.ZERO;for(let T=0;T<S.length;T++)I=o.add(I,o.mul(S[T],x[T]));return I},monomial:{basis:(S,x)=>{let I=s(x),T=o.ONE;for(let M=0;M<x;M++)I[M]=T,T=o.mul(T,S);return I},eval:(S,x)=>{h(S);let I=o.ZERO;for(let T=S.length-1;T>=0;T--)I=o.add(o.mul(I,x),S[T]);return I}},lagrange:{basis:(S,x,I=!1,T)=>{let M=Eg(x),N=T||(I?t.brp(M):t.roots(M)),D=s(x),j=m(S,x,I);if(j!==-1)return D[j]=o.ONE,D;let Y=o.pow(S,BigInt(x)),Q=o.mul(o.sub(Y,o.ONE),o.inv(BigInt(x))),W=s(x);for(let ne=0;ne<x;ne++)W[ne]=o.sub(S,N[ne]);let te=o.invertBatch(W);for(let ne=0;ne<x;ne++)D[ne]=o.mul(Q,o.mul(N[ne],te[ne]));return D},eval(S,x,I=!1){h(S);let T=m(x,S.length,I);if(T!==-1)return S[T];let M=this.basis(x,S.length,I),N=o.ZERO;for(let D=0;D<S.length;D++)o.is0(S[D])||(N=o.add(N,o.mul(S[D],M[D])));return N}},vanishing(S){h(S);let x=s(S.length+1,o.ZERO);x[0]=o.ONE;for(let I of S){let T=o.neg(I);for(let M=x.length-1;M>0;M--)x[M]=o.add(o.mul(x[M],T),x[M-1]);x[0]=o.mul(x[0],T)}return x}}}var Yx=br(()=>{y()});function fs(e,t){if(Fr(e),Fr(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let i=t-1;i>=0;i--)r[i]=e&255,e>>>=8;return new Uint8Array(r)}function rD(e,t){let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}function Zx(e){if(!es(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?ga(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function iD(e,t,r,i){ct(e),Fr(r),t=Zx(t),t.length>255&&(t=i(st(ga("H2C-OVERSIZE-DST-"),t)));let{outputLen:n,blockLen:o}=i,s=Math.ceil(r/n);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let f=st(t,fs(t.length,1)),h=new Uint8Array(o),m=fs(r,2),S=new Array(s),x=i(st(h,e,m,fs(0,1),f));S[0]=i(st(x,fs(1,1),f));for(let T=1;T<s;T++){let M=[rD(x,S[T-1]),fs(T+1,1),f];S[T]=i(st(...M))}return st(...S).slice(0,r)}function nD(e,t,r,i,n){if(ct(e),Fr(r),t=Zx(t),t.length>255){let o=Math.ceil(2*i/8);t=n.create({dkLen:o}).update(ga("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return n.create({dkLen:r}).update(e).update(fs(r,2)).update(t).update(fs(t.length,1)).digest()}function xg(e,t,r){jr(r,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:i,k:n,m:o,hash:s,expand:f,DST:h}=r;if(Fr(s.outputLen,"valid hash"),ct(e),Fr(t),t<1)throw new Error("hash_to_field: expected count >= 1");if(o<1)throw new Error("hash_to_field: expected m >= 1");let m=i.toString(2).length,S=Math.ceil((m+n)/8),x=t*o*S,I;if(f==="xmd")I=iD(e,h,x,s);else if(f==="xof")I=nD(e,h,x,n,s);else if(f==="_internal_pass")I=e;else throw new Error('expand must be "xmd" or "xof"');let T=new Array(t);for(let M=0;M<t;M++){let N=new Array(o);for(let D=0;D<o;D++){let j=S*(D+M*o),Y=I.subarray(j,j+S);N[D]=wr(tD(Y),i)}T[M]=N}return T}function $x(e,t){let r=t.map(i=>Array.from(i).reverse());return(i,n)=>{let[o,s,f,h]=r.map(x=>x.reduce((I,T)=>e.add(e.mul(I,i),T))),[m,S]=ss(e,[s,h],!0);return i=e.mul(o,m),n=e.mul(n,e.mul(f,S)),{x:i,y:n}}}function Xx(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");let i=f=>Object.freeze({...f,DST:es(f.DST)?Xh(f.DST):f.DST,...f.encodeDST===void 0?{}:{encodeDST:es(f.encodeDST)?Xh(f.encodeDST):f.encodeDST}}),n=i(r);function o(f){return e.fromAffine(t(f))}function s(f){let h=f.clearCofactor();return h.equals(e.ZERO)?e.ZERO:(h.assertValidity(),h)}return Object.freeze({get defaults(){return i(n)},Point:e,hashToCurve(f,h){let m=Object.assign({},n,h),S=xg(f,2,m),x=o(S[0]),I=o(S[1]);return s(x.add(I))},encodeToCurve(f,h){let m=n.encodeDST?{DST:n.encodeDST}:{},S=Object.assign({},n,m,h),x=xg(f,1,S),I=o(x[0]);return s(I)},mapToCurve(f){if(n.m===1){if(typeof f!="bigint")throw new Error("expected bigint (m=1)");return s(o([f]))}if(!Array.isArray(f))throw new Error("expected array of bigints");for(let h of f)if(typeof h!="bigint")throw new Error("expected array of bigints");return s(o(f))},hashToScalar(f,h){let m=e.Fn.ORDER,S=Object.assign({},n,{p:m,m:1,DST:oD},h);return xg(f,1,S)[0][0]}})}var tD,oD,Jx=br(()=>{y();is();ba();tD=or;oD="HashToScalar-"});function Ig(e){jr(e,{name:"string",hash:"function"},{hashToScalar:"function",validatePoint:"function",parsePublicKey:"function",adjustScalar:"function",adjustPoint:"function",challenge:"function",adjustNonces:"function",adjustSecret:"function",adjustPublic:"function",adjustGroupCommitmentShare:"function",adjustDKG:"function"}),Fx(e.Point);let{Point:t}=e,r=e.Fn===void 0?t.Fn:e.Fn,i=e.hash,n=e.hashToScalar===void 0?(k,q={DST:new Uint8Array})=>{let L=i(st(q.DST,k));return r.create(r.isLE?pa(L):or(L))}:e.hashToScalar,o=ln(e.H1!==void 0?e.H1:e.name+"rho"),s=ln(e.H2!==void 0?e.H2:e.name+"chal"),f=ln(e.H3!==void 0?e.H3:e.name+"nonce"),h=ln(e.H4!==void 0?e.H4:e.name+"msg"),m=ln(e.H5!==void 0?e.H5:e.name+"com"),S=ln(e.HDKG!==void 0?e.HDKG:e.name+"dkg"),x=ln(e.HID!==void 0?e.HID:e.name+"id"),I=k=>n(k,{DST:o}),T=k=>n(k,{DST:s}),M=k=>n(k,{DST:f}),N=k=>i(st(h,k)),D=k=>i(st(m,k)),j=k=>n(k,{DST:S}),Y=k=>n(k,{DST:x}),Q=(k=dr)=>{let q=ma(k(ru(r.ORDER)),r.ORDER,r.isLE);return r.isLE?pa(q):or(q)},W=k=>k.toBytes(),te=k=>{let q=t.fromBytes(k);return e.validatePoint&&e.validatePoint(q),q},ne=(k,q)=>({identifier:k,hiding:W(t.BASE.multiply(r.fromBytes(q.hiding))),binding:W(t.BASE.multiply(r.fromBytes(q.binding)))}),se=e.adjustPoint===void 0?k=>k:e.adjustPoint,ue=k=>{if(!r.isValid(k)||r.is0(k))throw new Error("Invalid identifier "+k);return k},be=k=>pn(r.toBytes(ue(k))),P=k=>{let q=ue(r.fromBytes(da(k)));if(be(q)!==k)throw new Error("expected canonical identifier hex");return q},l={encode:(k,q)=>{let L=st(W(k),r.toBytes(q));return e.adjustTx&&(L=e.adjustTx.encode(L)),L},decode:k=>{e.adjustTx&&(k=e.adjustTx.decode(k));let q=te(k.subarray(0,-r.BYTES)),L=r.fromBytes(k.subarray(-r.BYTES));return{R:q,z:L}}},E=(k=dr)=>{let q=Q(k);e.adjustScalar&&(q=e.adjustScalar(q));let L=t.BASE.multiply(q);return{scalar:q,point:L}},d="roots are unavailable in FROST polynomial mode",a={info:{G:r.ZERO,oddFactor:r.ZERO,powerOfTwo:0},roots(){throw new Error(d)},brp(){throw new Error(d)},inverse(){throw new Error(d)},omega(){throw new Error(d)},clear(){}},u=Wx(r,a),p=(k,q)=>Vx(t,k,q),b=(k,q)=>{if(!q.length)throw new Error("empty coefficients");return u.monomial.eval(q,k)},v=(k,q)=>{let L="invalid parameters";if(!k.some(X=>r.eql(X,q)))throw new Error(L);let V=new Set(k);if(V.size!==k.length)throw new Error(L);if(!V.has(q))throw new Error(L);let fe=r.ONE,Z=r.ONE;for(let X of k)r.eql(X,q)||(fe=r.mul(fe,X),Z=r.mul(Z,r.sub(X,q)));return r.div(fe,Z)},c=(k,q)=>{let L=u.monomial.basis(k,q.length);return p(q,L)},w=(k,q,L,V=dr)=>{rl(k);let fe=q===void 0?Q(V):r.fromBytes(q);if(!L){L=[];for(let ge=0;ge<k.min-1;ge++)L.push(Q(V))}if(L.length!==k.min-1)throw new Error("wrong coefficients length");let Z=[fe,...L],X=Z.map(ge=>t.BASE.multiply(ge));return{coefficients:Z,commitment:X,secret:fe}},A={challenge:(k,q,L)=>j(st(r.toBytes(k),W(q),W(L))),compute(k,q,L,V=dr){if(q.length<1)throw new Error("coefficients should have at least one element");let{point:fe,scalar:Z}=E(V),X=L[0],ge=this.challenge(k,X,fe),ee=r.add(Z,r.mul(q[0],ge));return l.encode(fe,ee)},validate(k,q,L){if(q.length<1)throw new Error("commitment should have at least one element");let{R:V,z:fe}=l.decode(L),Z=te(q[0]),X=this.challenge(k,Z,V);if(!V.equals(t.BASE.multiply(fe).subtract(Z.multiply(X))))throw new Error("invalid proof of knowledge")}},g={challenge:(k,q,L)=>e.challenge?e.challenge(k,q,L):T(st(W(k),W(q),L)),sign(k,q,L=dr){let{point:V,scalar:fe}=E(L),Z=t.BASE.multiply(q),X=this.challenge(V,Z,k),ge=r.add(fe,r.mul(X,q));return[V,ge]},verify(k,q,L,V){e.adjustPoint&&(V=e.adjustPoint(V)),e.adjustPoint&&(q=e.adjustPoint(q));let fe=this.challenge(q,V,k),Z=t.BASE.multiply(L),X=V.multiply(fe),ge=Z.subtract(X).subtract(q);return ge.clearCofactor&&(ge=ge.clearCofactor()),t.ZERO.equals(ge)}},R=(k,q,L)=>{if(!t.BASE.multiply(L).equals(c(k,q)))throw new Error("invalid secret share")},U={fromNumber(k){if(!Number.isSafeInteger(k))throw new Error("expected safe interger");return be(BigInt(k))},derive(k){if(typeof k!="string")throw new Error("wrong identifier string: "+k);return be(Y(ln(k)))}},H=(k,q=dr)=>M(st(q(32),r.toBytes(k))),z=(k,q,L)=>{let V=q.map(J=>[J.identifier,P(J.identifier),te(J.hiding),te(J.binding)]);V.sort((J,_e)=>J[1]<_e[1]?-1:J[1]>_e[1]?1:0);let fe=[];for(let[J,_e,he,le]of V)fe.push(r.toBytes(_e),W(he),W(le));let Z=D(st(...fe)),X=st(W(k),N(L),Z),ge={};for(let[J,_e]of V)ge[J]=I(st(X,r.toBytes(_e)));let ee=[],ae=[];for(let[J,_e,he,le]of V){if(t.ZERO.equals(he)||t.ZERO.equals(le))throw new Error("infinity commitment");ee.push(he,le),ae.push(r.ONE,ge[J])}let ht=p(ee,ae);return{identifiers:V.map(J=>J[1]),groupCommitment:ht,bindingFactors:ge}},re=(k,q,L,V)=>{let fe=se(te(k)),Z=P(V),{identifiers:X,groupCommitment:ge,bindingFactors:ee}=z(fe,q,L),ae=ee[V],ht=v(X,Z),pe=g.challenge(ge,fe,L);return{lambda:ht,challenge:pe,bindingFactor:ae,groupCommitment:ge}};Object.freeze(U);let oe={Identifier:U,DKG:Object.freeze({round1:(k,q,L,V=dr)=>{rl(q);let fe=P(k),{coefficients:Z,commitment:X}=w(q,L,void 0,V),ge=A.compute(fe,Z,X,V),ee=X.map(W),ae={identifier:be(fe),commitment:ee,proofOfKnowledge:ge},ht={identifier:fe,coefficients:Z,commitment:X.map(W),signers:{min:q.min,max:q.max},step:1};return{public:ae,secret:ht}},round2:(k,q)=>{if(q.length!==k.signers.max-1)throw new Error("wrong number of round1 packages");if(!k.coefficients||k.step===3)throw new Error("round3 package used in round2");let L={};for(let V of q){if(V.commitment.length!==k.signers.min)throw new Error("wrong number of commitments");let fe=P(V.identifier);if(fe===k.identifier)throw new Error("duplicate id="+be(fe));A.validate(fe,V.commitment,V.proofOfKnowledge);for(let X of V.commitment)te(X);if(L[V.identifier])throw new Error("Duplicate id="+fe);let Z=r.toBytes(b(fe,k.coefficients));L[V.identifier]={identifier:be(k.identifier),signingShare:Z}}return k.step=2,L},round3:(k,q,L)=>{if(q.length!==k.signers.max-1)throw new Error("wrong length of round1 packages");if(!k.coefficients||k.step!==2)throw new Error("round2 package used in round3");if(L.length!==q.length)throw new Error("wrong length of round2 packages");let V={};for(let _e of q){if(!_e.identifier||!_e.commitment)throw new Error("wrong round1 share");V[_e.identifier]={..._e}}for(let _e of L){if(!_e.identifier||!_e.signingShare)throw new Error("wrong round2 share");if(!V[_e.identifier])throw new Error("round1 share for "+_e.identifier+" is missing");V[_e.identifier].signingShare=_e.signingShare}if(Object.keys(V).length!==q.length)throw new Error("mismatch identifiers between rounds");let fe=r.ZERO;if(k.commitment.length!==k.signers.min)throw new Error("wrong commitments length");let Z=k.commitment.map(te),X=b(k.identifier,k.coefficients);R(k.identifier,Z,X);let ge=Z.map(W),ee={[be(k.identifier)]:ge};for(let _e in V){let he=V[_e];if(!he.signingShare||!he.commitment)throw new Error("mismatch identifiers");let le=P(_e),Rr=r.fromBytes(he.signingShare),xe=he.commitment.map(te);R(k.identifier,xe,Rr),fe=r.add(fe,Rr);let Se=be(le);if(ee[Se])throw new Error("duplicated id="+Se);ee[Se]=he.commitment}fe=r.add(fe,X);let ae=new Array(k.signers.min).fill(t.ZERO);for(let _e in ee){let he=ee[_e];if(he.length!==k.signers.min)throw new Error("wrong commitments length");for(let le=0;le<he.length;le++)ae[le]=ae[le].add(te(he[le]))}let ht=ae.map(W),pe={};for(let _e in ee)pe[_e]=W(c(P(_e),ae));let J={public:{signers:{min:k.signers.min,max:k.signers.max},commitments:ht,verifyingShares:Object.fromEntries(Object.entries(pe).map(([_e,he])=>[_e,he.slice()]))},secret:{identifier:be(k.identifier),signingShare:r.toBytes(fe)}};e.adjustDKG&&(J=e.adjustDKG(J));for(let _e=0;_e<k.coefficients.length;_e++)k.coefficients[_e]-=k.coefficients[_e];return delete k.coefficients,k.step=3,J},clean(k){if(k.identifier-=k.identifier,k.coefficients)for(let q=0;q<k.coefficients.length;q++)k.coefficients[q]-=k.coefficients[q];k.step=3}}),trustedDealer(k,q,L,V=dr){if(rl(k),q===void 0){q=[];for(let ae=1;ae<=k.max;ae++)q.push(U.fromNumber(ae))}else if(!Array.isArray(q)||q.length!==k.max)throw new Error("identifiers should be array of "+k.max);let fe={};for(let ae of q){let ht=P(ae);if(ae in fe)throw new Error("duplicated id="+ae);fe[ae]=ht}let Z=w(k,L,void 0,V),X=Z.commitment.map(W),ge={},ee={};for(let ae of q){let ht=b(fe[ae],Z.coefficients);ee[ae]=W(t.BASE.multiply(ht)),ge[ae]={identifier:ae,signingShare:r.toBytes(ht)}}return{public:{signers:{min:k.min,max:k.max},commitments:X,verifyingShares:ee},secretShares:ge}},validateSecret(k,q){let L=P(k.identifier),V=q.commitments.map(te),fe=r.fromBytes(k.signingShare);R(L,V,fe)},commit(k,q=dr){let L=r.fromBytes(k.signingShare),V=H(L,q),fe=H(L,q),Z={hiding:r.toBytes(V),binding:r.toBytes(fe)};return{nonces:Z,commitments:ne(k.identifier,Z)}},signShare(k,q,L,V,fe){Qx(q.signers,V.length);let Z=r.fromBytes(L.hiding),X=r.fromBytes(L.binding);if(r.is0(Z)||r.is0(X))throw new Error("signing nonces already used");let ge={identifier:k.identifier,hiding:W(t.BASE.multiply(Z)),binding:W(t.BASE.multiply(X))},ee=V.find(Ie=>Ie.identifier===k.identifier);if(!ee)throw new Error("missing signer commitment");if(pn(ee.hiding)!==pn(ge.hiding)||pn(ee.binding)!==pn(ge.binding))throw new Error("incorrect signer commitment");e.adjustSecret&&(k=e.adjustSecret(k,q)),e.adjustPublic&&(q=e.adjustPublic(q));let ae=r.fromBytes(k.signingShare),{lambda:ht,challenge:pe,bindingFactor:J,groupCommitment:_e}=re(q.commitments[0],V,fe,k.identifier),he=e.adjustNonces?e.adjustNonces(_e,L):L,le=e.adjustNonces?r.fromBytes(he.hiding):Z,Rr=e.adjustNonces?r.fromBytes(he.binding):X,xe=r.mul(r.mul(ht,ae),pe),Se=r.mul(Rr,J),no=r.toBytes(r.add(r.add(le,Se),xe));return L.hiding.fill(0),L.binding.fill(0),no},verifyShare(k,q,L,V,fe){e.adjustPublic&&(k=e.adjustPublic(k));let Z=q.find(Rr=>Rr.identifier===V);if(!Z)throw new Error("cannot find identifier commitment");let X=te(k.verifyingShares[V]),ge=te(Z.hiding),ee=te(Z.binding),{lambda:ae,challenge:ht,bindingFactor:pe,groupCommitment:J}=re(k.commitments[0],q,L,V),_e=ge.add(ee.multiply(pe));e.adjustGroupCommitmentShare&&(_e=e.adjustGroupCommitmentShare(J,_e));let he=t.BASE.multiply(r.fromBytes(fe)),le=_e.add(X.multiply(r.mul(ht,ae)));return he.equals(le)},aggregate(k,q,L,V){e.adjustPublic&&(k=e.adjustPublic(k));try{Qx(k.signers,q.length)}catch{throw new wa("aggregation failed",[])}let fe=q.map(ee=>ee.identifier);if(fe.length!==Object.keys(V).length)throw new wa("aggregation failed",[]);for(let ee of fe)if(!(ee in V)||!(ee in k.verifyingShares))throw new wa("aggregation failed",[]);let Z=te(k.commitments[0]),{groupCommitment:X}=z(Z,q,L),ge=r.ZERO;for(let ee of fe)ge=r.add(ge,r.fromBytes(V[ee]));if(!g.verify(L,X,ge,Z)){let ee=[];for(let ae of fe)this.verifyShare(k,q,L,ae,V[ae])||ee.push(ae);throw new wa("aggregation failed",ee)}return l.encode(X,ge)},sign(k,q){let L=r.fromBytes(q);e.adjustScalar&&(L=e.adjustScalar(L));let[V,fe]=g.sign(k,L);return l.encode(V,fe)},verify(k,q,L){let V=e.parsePublicKey?e.parsePublicKey(L):te(L),{R:fe,z:Z}=l.decode(k);return g.verify(q,fe,Z,V)},combineSecret(k,q){if(rl(q),!Array.isArray(k)||k.length<q.min)throw new Error("wrong secret shares array");let L=[],V={};for(let X of k){let ge=P(X.identifier),ee=be(ge);if(V[ee])throw new Error("duplicated id="+ee);V[ee]=!0,L.push([ge,r.fromBytes(X.signingShare)])}let fe=L.map(([X])=>X),Z=r.ZERO;for(let[X,ge]of L)Z=r.add(Z,r.mul(ge,v(fe,X)));return r.toBytes(Z)},utils:Object.freeze({Fn:r,randomScalar:(k=dr)=>r.toBytes(E(k).scalar),generateSecretPolynomial:(k,q,L,V)=>{let fe=w(k,q,L,V);return{...fe,commitment:fe.commitment.map(W)}}})};return Object.freeze(oe)}var rl,Qx,wa,eI=br(()=>{y();Kn();is();tl();Yx();ba();rl=e=>{if(!Number.isSafeInteger(e.min)||!Number.isSafeInteger(e.max))throw new Error("Wrong signers info: min="+e.min+" max="+e.max);if(e.min<2||e.max<2||e.min>e.max)throw new Error("Wrong signers info: min="+e.min+" max="+e.max)},Qx=(e,t)=>{if(t<e.min||t>e.max)throw new Error("Wrong number of commitments="+t)},wa=class extends Error{constructor(r,i){super(r);de(this,"cheaters");this.cheaters=i}}});var il,tI,rI=br(()=>{y();Kn();il=class{constructor(t,r){de(this,"oHash");de(this,"iHash");de(this,"blockLen");de(this,"outputLen");de(this,"canXOF",!1);de(this,"finished",!1);de(this,"destroyed",!1);if(Hh(t),ki(r,void 0,"key"),this.iHash=t.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,n=new Uint8Array(i);n.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<n.length;o++)n[o]^=54;this.iHash.update(n),this.oHash=t.create();for(let o=0;o<n.length;o++)n[o]^=106;this.oHash.update(n),Jo(n)}update(t){return la(this),this.iHash.update(t),this}digestInto(t){la(this),Kh(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:i,finished:n,destroyed:o,blockLen:s,outputLen:f}=this;return t=t,t.finished=n,t.destroyed=o,t.blockLen=s,t.outputLen=f,t.oHash=r._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},tI=(()=>{let e=((t,r,i)=>new il(t,r).update(i).digest());return e.create=(t,r)=>new il(t,r),e})()});function sD(e,t,r){gg("scalar",e,Hr,r);let[[i,n],[o,s]]=t,f=iI(s*e,r),h=iI(-n*e,r),m=e-f*i-h*o,S=-f*n-h*s,x=m<Hr,I=S<Hr;x&&(m=-m),I&&(S=-S);let T=va(Math.ceil(rs(r)/2))+Vt;if(m<Hr||m>=T||S<Hr||S>=T)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:x,k1:m,k2neg:I,k2:S}}function Og(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ag(e,t){jr(e);let r={};for(let i of Object.keys(t))r[i]=e[i]===void 0?t[i]:e[i];return ts(r.lowS,"lowS"),ts(r.prehash,"prehash"),r.format!==void 0&&Og(r.format),r}function nI(e,t={}){let r=Gx("weierstrass",e,t),i=r.Fp,n=r.Fn,o=r.CURVE,{h:s,n:f}=o;jr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:h,allowInfinityPoint:m}=t;if(h&&(!i.is0(o.a)||typeof h.beta!="bigint"||!Array.isArray(h.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let S=aI(i,n);function x(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function I(E,d,a){if(m&&d.is0())return Uint8Array.of(0);let{x:u,y:p}=d.toAffine(),b=i.toBytes(u);if(ts(a,"isCompressed"),a){x();let v=!i.isOdd(p);return st(oI(v),b)}else return st(Uint8Array.of(4),b,i.toBytes(p))}function T(E){ct(E,void 0,"Point");let{publicKey:d,publicKeyUncompressed:a}=S,u=E.length,p=E[0],b=E.subarray(1);if(m&&u===1&&p===0)return{x:i.ZERO,y:i.ZERO};if(u===d&&(p===2||p===3)){let v=i.fromBytes(b);if(!i.isValid(v))throw new Error("bad point: is not on curve, wrong x");let c=D(v),w;try{w=i.sqrt(c)}catch(R){let U=R instanceof Error?": "+R.message:"";throw new Error("bad point: is not on curve, sqrt error"+U)}x();let A=i.isOdd(w);return(p&1)===1!==A&&(w=i.neg(w)),{x:v,y:w}}else if(u===a&&p===4){let v=i.BYTES,c=i.fromBytes(b.subarray(0,v)),w=i.fromBytes(b.subarray(v,v*2));if(!j(c,w))throw new Error("bad point: is not on curve");return{x:c,y:w}}else throw new Error(`bad point: got length ${u}, expected compressed=${d} or uncompressed=${a}`)}let M=t.toBytes===void 0?I:t.toBytes,N=t.fromBytes===void 0?T:t.fromBytes;function D(E){let d=i.sqr(E),a=i.mul(d,E);return i.add(i.add(a,i.mul(E,o.a)),o.b)}function j(E,d){let a=i.sqr(d),u=D(E);return i.eql(a,u)}if(!j(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let Y=i.mul(i.pow(o.a,Sa),Tg),Q=i.mul(i.sqr(o.b),BigInt(27));if(i.is0(i.add(Y,Q)))throw new Error("bad curve params: a or b");function W(E,d,a=!1){if(!i.isValid(d)||a&&i.is0(d))throw new Error(`bad point coordinate ${E}`);return d}function te(E){if(!(E instanceof ue))throw new Error("Weierstrass Point expected")}function ne(E){if(!h||!h.basises)throw new Error("no endo");return sD(E,h.basises,n.ORDER)}function se(E,d,a,u,p){return a=new ue(i.mul(a.X,E),a.Y,a.Z),d=iu(u,d),a=iu(p,a),d.add(a)}let l=class l{constructor(d,a,u){de(this,"X");de(this,"Y");de(this,"Z");this.X=W("x",d),this.Y=W("y",a,!0),this.Z=W("z",u),Object.freeze(this)}static CURVE(){return o}static fromAffine(d){let{x:a,y:u}=d||{};if(!d||!i.isValid(a)||!i.isValid(u))throw new Error("invalid affine point");if(d instanceof l)throw new Error("projective point not allowed");return i.is0(a)&&i.is0(u)?l.ZERO:new l(a,u,i.ONE)}static fromBytes(d){let a=l.fromAffine(N(ct(d,void 0,"point")));return a.assertValidity(),a}static fromHex(d){return l.fromBytes(da(d))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(d=8,a=!0){return P.createCache(this,d),a||this.multiply(Sa),this}assertValidity(){let d=this;if(d.is0()){if(t.allowInfinityPoint&&i.is0(d.X)&&i.eql(d.Y,i.ONE)&&i.is0(d.Z))return;throw new Error("bad point: ZERO")}let{x:a,y:u}=d.toAffine();if(!i.isValid(a)||!i.isValid(u))throw new Error("bad point: x or y not field elements");if(!j(a,u))throw new Error("bad point: equation left != right");if(!d.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:d}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(d)}equals(d){te(d);let{X:a,Y:u,Z:p}=this,{X:b,Y:v,Z:c}=d,w=i.eql(i.mul(a,c),i.mul(b,p)),A=i.eql(i.mul(u,c),i.mul(v,p));return w&&A}negate(){return new l(this.X,i.neg(this.Y),this.Z)}double(){let{a:d,b:a}=o,u=i.mul(a,Sa),{X:p,Y:b,Z:v}=this,c=i.ZERO,w=i.ZERO,A=i.ZERO,g=i.mul(p,p),R=i.mul(b,b),U=i.mul(v,v),H=i.mul(p,b);return H=i.add(H,H),A=i.mul(p,v),A=i.add(A,A),c=i.mul(d,A),w=i.mul(u,U),w=i.add(c,w),c=i.sub(R,w),w=i.add(R,w),w=i.mul(c,w),c=i.mul(H,c),A=i.mul(u,A),U=i.mul(d,U),H=i.sub(g,U),H=i.mul(d,H),H=i.add(H,A),A=i.add(g,g),g=i.add(A,g),g=i.add(g,U),g=i.mul(g,H),w=i.add(w,g),U=i.mul(b,v),U=i.add(U,U),g=i.mul(U,H),c=i.sub(c,g),A=i.mul(U,R),A=i.add(A,A),A=i.add(A,A),new l(c,w,A)}add(d){te(d);let{X:a,Y:u,Z:p}=this,{X:b,Y:v,Z:c}=d,w=i.ZERO,A=i.ZERO,g=i.ZERO,R=o.a,U=i.mul(o.b,Sa),H=i.mul(a,b),z=i.mul(u,v),re=i.mul(p,c),oe=i.add(a,u),k=i.add(b,v);oe=i.mul(oe,k),k=i.add(H,z),oe=i.sub(oe,k),k=i.add(a,p);let q=i.add(b,c);return k=i.mul(k,q),q=i.add(H,re),k=i.sub(k,q),q=i.add(u,p),w=i.add(v,c),q=i.mul(q,w),w=i.add(z,re),q=i.sub(q,w),g=i.mul(R,k),w=i.mul(U,re),g=i.add(w,g),w=i.sub(z,g),g=i.add(z,g),A=i.mul(w,g),z=i.add(H,H),z=i.add(z,H),re=i.mul(R,re),k=i.mul(U,k),z=i.add(z,re),re=i.sub(H,re),re=i.mul(R,re),k=i.add(k,re),H=i.mul(z,k),A=i.add(A,H),H=i.mul(q,k),w=i.mul(oe,w),w=i.sub(w,H),H=i.mul(oe,z),g=i.mul(q,g),g=i.add(g,H),new l(w,A,g)}subtract(d){return te(d),this.add(d.negate())}is0(){return this.equals(l.ZERO)}multiply(d){let{endo:a}=t;if(!n.isValidNot0(d))throw new RangeError("invalid scalar: out of range");let u,p,b=v=>P.cached(this,v,c=>Sg(l,c));if(a){let{k1neg:v,k1:c,k2neg:w,k2:A}=ne(d),{p:g,f:R}=b(c),{p:U,f:H}=b(A);p=R.add(H),u=se(a.beta,g,U,v,w)}else{let{p:v,f:c}=b(d);u=v,p=c}return Sg(l,[u,p])[0]}multiplyUnsafe(d){let{endo:a}=t,u=this,p=d;if(!n.isValid(p))throw new RangeError("invalid scalar: out of range");if(p===Hr||u.is0())return l.ZERO;if(p===Vt)return u;if(P.hasCache(this))return this.multiply(p);if(a){let{k1neg:b,k1:v,k2neg:c,k2:w}=ne(p),{p1:A,p2:g}=Kx(l,u,v,w);return se(a.beta,A,g,b,c)}else return P.unsafe(u,p)}toAffine(d){let a=this,u=d,{X:p,Y:b,Z:v}=a;if(i.eql(v,i.ONE))return{x:p,y:b};let c=a.is0();u==null&&(u=c?i.ONE:i.inv(v));let w=i.mul(p,u),A=i.mul(b,u),g=i.mul(v,u);if(c)return{x:i.ZERO,y:i.ZERO};if(!i.eql(g,i.ONE))throw new Error("invZ was invalid");return{x:w,y:A}}isTorsionFree(){let{isTorsionFree:d}=t;return s===Vt?!0:d?d(l,this):P.unsafe(this,f).is0()}clearCofactor(){let{clearCofactor:d}=t;return s===Vt?this:d?d(l,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Vt?this.is0():this.clearCofactor().is0()}toBytes(d=!0){return ts(d,"isCompressed"),this.assertValidity(),M(l,this,d)}toHex(d=!0){return pn(this.toBytes(d))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};de(l,"BASE",new l(o.Gx,o.Gy,i.ONE)),de(l,"ZERO",new l(i.ZERO,i.ONE,i.ZERO)),de(l,"Fp",i),de(l,"Fn",n);let ue=l,be=n.BITS,P=new Qh(ue,t.endo?Math.ceil(be/2):be);return be>=8&&ue.BASE.precompute(8),Object.freeze(ue.prototype),Object.freeze(ue),ue}function oI(e){return Uint8Array.of(e?2:3)}function aD(e,t){let r=os(e),i=r.ORDER,n=Hr;for(let N=i-Vt;N%Ni===Hr;N/=Ni)n+=Vt;let o=n,s=Ni<<o-Vt-Vt,f=s*Ni,h=(i-Vt)/f,m=(h-Vt)/Ni,S=f-Vt,x=s,I=r.pow(t,h),T=r.pow(t,(h+Vt)/Ni),M=(N,D)=>{let j=I,Y=r.pow(D,S),Q=r.sqr(Y);Q=r.mul(Q,D);let W=r.mul(N,Q);W=r.pow(W,m),W=r.mul(W,Y),Y=r.mul(W,D),Q=r.mul(W,N);let te=r.mul(Q,Y);W=r.pow(te,x);let ne=r.eql(W,r.ONE);Y=r.mul(Q,T),W=r.mul(te,j),Q=r.cmov(Y,Q,ne),te=r.cmov(W,te,ne);for(let se=o;se>Vt;se--){let ue=se-Ni;ue=Ni<<ue-Vt;let be=r.pow(te,ue),P=r.eql(be,r.ONE);Y=r.mul(Q,j),j=r.mul(j,j),be=r.mul(te,j),Q=r.cmov(Y,Q,P),te=r.cmov(be,te,P)}return{isValid:!r.is0(D)&&(ne||r.is0(N)),value:Q}};if(r.ORDER%Tg===Sa){let N=(r.ORDER-Sa)/Tg,D=r.sqrt(r.neg(t));M=(j,Y)=>{let Q=r.sqr(Y),W=r.mul(j,Y);Q=r.mul(Q,W);let te=r.pow(Q,N);te=r.mul(te,W);let ne=r.mul(te,D),se=r.mul(r.sqr(te),Y),ue=r.eql(se,j),be=r.cmov(ne,te,ue);return{isValid:!r.is0(Y)&&ue,value:be}}}return M}function sI(e,t){let r=os(e),{A:i,B:n,Z:o}=t;if(!r.isValidNot0(i)||!r.isValidNot0(n)||!r.isValid(o))throw new Error("mapToCurveSimpleSWU: invalid opts");if(r.eql(o,r.neg(r.ONE))||mg(r,o))throw new Error("mapToCurveSimpleSWU: invalid opts");let s=r.mul(n,r.inv(r.mul(o,i))),f=r.add(r.add(r.mul(r.sqr(s),s),r.mul(i,s)),n);if(!mg(r,f))throw new Error("mapToCurveSimpleSWU: invalid opts");let h=aD(r,o);if(!r.isOdd)throw new Error("Field does not have .isOdd()");return m=>{let S,x,I,T,M,N,D,j;S=r.sqr(m),S=r.mul(S,o),x=r.sqr(S),x=r.add(x,S),I=r.add(x,r.ONE),I=r.mul(I,n),T=r.cmov(o,r.neg(x),!r.eql(x,r.ZERO)),T=r.mul(T,i),x=r.sqr(I),N=r.sqr(T),M=r.mul(N,i),x=r.add(x,M),x=r.mul(x,I),N=r.mul(N,T),M=r.mul(N,n),x=r.add(x,M),D=r.mul(S,I);let{isValid:Y,value:Q}=h(x,N);j=r.mul(S,m),j=r.mul(j,Q),D=r.cmov(D,I,Y),j=r.cmov(j,Q,Y);let W=r.isOdd(m)===r.isOdd(j);j=r.cmov(r.neg(j),j,W);let te=ss(r,[T],!0)[0];return D=r.mul(D,te),{x:D,y:j}}}function aI(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function fD(e,t={}){let{Fn:r}=e,i=t.randomBytes===void 0?dr:t.randomBytes,n=Object.assign(aI(e.Fp,r),{seed:Math.max(ru(r.ORDER),16)});function o(T){try{let M=r.fromBytes(T);return r.isValidNot0(M)}catch{return!1}}function s(T,M){let{publicKey:N,publicKeyUncompressed:D}=n;try{let j=T.length;return M===!0&&j!==N||M===!1&&j!==D?!1:!!e.fromBytes(T)}catch{return!1}}function f(T){return T=T===void 0?i(n.seed):T,ma(ct(T,n.seed,"seed"),r.ORDER)}function h(T,M=!0){return e.BASE.multiply(r.fromBytes(T)).toBytes(M)}function m(T){let{secretKey:M,publicKey:N,publicKeyUncompressed:D}=n,j=r._lengths;if(!es(T))return;let Y=ct(T,void 0,"key").length,Q=Y===N||Y===D,W=Y===M||!!j?.includes(Y);if(!(Q&&W))return Q}function S(T,M,N=!0){if(m(T)===!0)throw new Error("first arg must be private key");if(m(M)===!1)throw new Error("second arg must be public key");let D=r.fromBytes(T);return e.fromBytes(M).multiply(D).toBytes(N)}let x={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:f},I=el(f,h);return Object.freeze(x),Object.freeze(n),Object.freeze({getPublicKey:h,getSharedSecret:S,keygen:I,Point:e,utils:x,lengths:n})}function fI(e,t,r={}){let i=t;Hh(i),jr(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes===void 0?dr:r.randomBytes,o=r.hmac===void 0?(u,p)=>tI(i,u,p):r.hmac,{Fp:s,Fn:f}=e,{ORDER:h,BITS:m}=f,{keygen:S,getPublicKey:x,getSharedSecret:I,utils:T,lengths:M}=fD(e,r),N={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},D=h*Ni+Vt<s.ORDER;function j(u){let p=h>>Vt;return u>p}function Y(u,p){if(!f.isValidNot0(p))throw new Error(`invalid signature ${u}: out of range 1..Point.Fn.ORDER`);return p}function Q(){if(D)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function W(u,p){Og(p);let b=M.signature,v=p==="compact"?b:p==="recovered"?b+1:void 0;return ct(u,v)}class te{constructor(p,b,v){de(this,"r");de(this,"s");de(this,"recovery");if(this.r=Y("r",p),this.s=Y("s",b),v!=null){if(Q(),![0,1,2,3].includes(v))throw new Error("invalid recovery id");this.recovery=v}Object.freeze(this)}static fromBytes(p,b=N.format){W(p,b);let v;if(b==="der"){let{r:g,s:R}=si.toSig(ct(p));return new te(g,R)}b==="recovered"&&(v=p[0],b="compact",p=p.subarray(1));let c=M.signature/2,w=p.subarray(0,c),A=p.subarray(c,c*2);return new te(f.fromBytes(w),f.fromBytes(A),v)}static fromHex(p,b){return this.fromBytes(da(p),b)}assertRecovery(){let{recovery:p}=this;if(p==null)throw new Error("invalid recovery id: must be present");return p}addRecoveryBit(p){return new te(this.r,this.s,p)}recoverPublicKey(p){let{r:b,s:v}=this,c=this.assertRecovery(),w=c===2||c===3?b+h:b;if(!s.isValid(w))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let A=s.toBytes(w),g=e.fromBytes(st(oI((c&1)===0),A)),R=f.inv(w),U=se(ct(p,void 0,"msgHash")),H=f.create(-U*R),z=f.create(v*R),re=e.BASE.multiplyUnsafe(H).add(g.multiplyUnsafe(z));if(re.is0())throw new Error("invalid recovery: point at infinify");return re.assertValidity(),re}hasHighS(){return j(this.s)}toBytes(p=N.format){if(Og(p),p==="der")return da(si.hexFromSig(this));let{r:b,s:v}=this,c=f.toBytes(b),w=f.toBytes(v);return p==="recovered"?(Q(),st(Uint8Array.of(this.assertRecovery()),c,w)):st(c,w)}toHex(p){return pn(this.toBytes(p))}}Object.freeze(te.prototype),Object.freeze(te);let ne=r.bits2int===void 0?function(p){if(p.length>8192)throw new Error("input is too large");let b=or(p),v=p.length*8-m;return v>0?b>>BigInt(v):b}:r.bits2int,se=r.bits2int_modN===void 0?function(p){return f.create(ne(p))}:r.bits2int_modN,ue=va(m);function be(u){return gg("num < 2^"+m,u,Hr,ue),f.toBytes(u)}function P(u,p){return ct(u,void 0,"message"),p?ct(i(u),void 0,"prehashed message"):u}function l(u,p,b){let{lowS:v,prehash:c,extraEntropy:w}=Ag(b,N);u=P(u,c);let A=se(u),g=f.fromBytes(p);if(!f.isValidNot0(g))throw new Error("invalid private key");let R=[be(g),be(A)];if(w!=null&&w!==!1){let re=w===!0?n(M.secretKey):w;R.push(ct(re,void 0,"extraEntropy"))}let U=st(...R),H=A;function z(re){let oe=ne(re);if(!f.isValidNot0(oe))return;let k=f.inv(oe),q=e.BASE.multiply(oe).toAffine(),L=f.create(q.x);if(L===Hr)return;let V=f.create(k*f.create(H+L*g));if(V===Hr)return;let fe=(q.x===L?0:2)|Number(q.y&Vt),Z=V;return v&&j(V)&&(Z=f.neg(V),fe^=1),new te(L,Z,D?void 0:fe)}return{seed:U,k2sig:z}}function E(u,p,b={}){let{seed:v,k2sig:c}=l(u,p,b);return Ax(i.outputLen,f.BYTES,o)(v,c).toBytes(b.format)}function d(u,p,b,v={}){let{lowS:c,prehash:w,format:A}=Ag(v,N);if(b=ct(b,void 0,"publicKey"),p=P(p,w),!es(u)){let g=u instanceof te?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+g)}W(u,A);try{let g=te.fromBytes(u,A),R=e.fromBytes(b);if(c&&g.hasHighS())return!1;let{r:U,s:H}=g,z=se(p),re=f.inv(H),oe=f.create(z*re),k=f.create(U*re),q=e.BASE.multiplyUnsafe(oe).add(R.multiplyUnsafe(k));return q.is0()?!1:f.create(q.x)===U}catch{return!1}}function a(u,p,b={}){let{prehash:v}=Ag(b,N);return p=P(p,v),te.fromBytes(u,"recovered").recoverPublicKey(p).toBytes()}return Object.freeze({keygen:S,getPublicKey:x,getSharedSecret:I,utils:T,lengths:M,Point:e,sign:E,verify:d,recoverPublicKey:a,Signature:te,hash:i})}var iI,Rg,si,Hr,Vt,Ni,Sa,Tg,uI=br(()=>{y();rI();Kn();is();tl();ba();iI=(e,t)=>(e+(e>=0?t:-t)/Ni)/t;Rg=class extends Error{constructor(t=""){super(t)}},si={Err:Rg,_tlv:{encode:(e,t)=>{let{Err:r}=si;if(Fr(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=tu(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let o=i>127?tu(n.length/2|128):"";return tu(e)+o+n+t},decode(e,t){let{Err:r}=si;t=ct(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],o=!!(n&128),s=0;if(!o)s=n;else{let h=n&127;if(!h)throw new r("tlv.decode(long): indefinite length not supported");if(h>4)throw new r("tlv.decode(long): byte length is too big");let m=t.subarray(i,i+h);if(m.length!==h)throw new r("tlv.decode: length bytes not complete");if(m[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let S of m)s=s<<8|S;if(i+=h,s<128)throw new r("tlv.decode(long): not minimal encoding")}let f=t.subarray(i,i+s);if(f.length!==s)throw new r("tlv.decode: wrong value length");return{v:f,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=si;if(Zh(e),e<Hr)throw new t("integer: negative integers are not allowed");let r=tu(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=si;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return or(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=si,n=ct(e,void 0,"signature"),{v:o,l:s}=i.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:f,l:h}=i.decode(2,o),{v:m,l:S}=i.decode(2,h);if(S.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(f),s:r.decode(m)}},hexFromSig(e){let{_tlv:t,_int:r}=si,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),o=i+n;return t.encode(48,o)}};Object.freeze(si._tlv);Object.freeze(si._int);Object.freeze(si);Hr=BigInt(0),Vt=BigInt(1),Ni=BigInt(2),Sa=BigInt(3),Tg=BigInt(4)});var mI={};bR(mI,{__TEST:()=>dD,schnorr:()=>pD,schnorr_FROST:()=>wD,secp256k1:()=>hD,secp256k1_FROST:()=>yD,secp256k1_hasher:()=>Mg});function cD(e){let t=nl.p,r=BigInt(3),i=BigInt(6),n=BigInt(11),o=BigInt(22),s=BigInt(23),f=BigInt(44),h=BigInt(88),m=e*e*e%t,S=m*m*e%t,x=Sr(S,r,t)*S%t,I=Sr(x,r,t)*S%t,T=Sr(I,Bg,t)*m%t,M=Sr(T,n,t)*T%t,N=Sr(M,o,t)*M%t,D=Sr(N,f,t)*N%t,j=Sr(D,h,t)*D%t,Y=Sr(j,f,t)*N%t,Q=Sr(Y,r,t)*S%t,W=Sr(Q,s,t)*M%t,te=Sr(W,i,t)*m%t,ne=Sr(te,Bg,t);if(!gn.eql(gn.sqr(ne),e))throw new Error("Cannot find square root");return ne}function nu(e,...t){let r=cI[e];if(r===void 0){let i=Qo(ga(e));r=st(i,i),cI[e]=r}return Qo(st(r,...t))}function pI(e){let{Fn:t,BASE:r}=lt,i=t.fromBytes(e),n=r.multiply(i);return{scalar:Ci(n.y)?i:t.neg(i),bytes:us(n)}}function ol(e){let t=gn;if(!t.isValidNot0(e))throw new Error("invalid x: Fail if x \u2265 p");let r=t.create(e*e),i=t.create(r*e+BigInt(7)),n=t.sqrt(i);Ci(n)||(n=t.neg(n));let o=lt.fromAffine({x:e,y:n});return o.assertValidity(),o}function Pg(...e){return lt.Fn.create(Ea(nu("BIP0340/challenge",...e)))}function hI(e){return pI(e).bytes}function lD(e,t,r=eu(32)){let{Fn:i,BASE:n}=lt,o=ct(e,void 0,"message"),{bytes:s,scalar:f}=pI(t),h=ct(r,32,"auxRand"),m=i.toBytes(f^Ea(nu("BIP0340/aux",h))),S=nu("BIP0340/nonce",m,s,o),x=i.create(Ea(S));if(x===0n)throw new Error("sign failed: k is zero");let I=n.multiply(x),T=Ci(I.y)?x:i.neg(x),M=us(I),N=Pg(M,s,o),D=new Uint8Array(64);if(D.set(M,0),D.set(i.toBytes(i.create(T+N*f)),32),!gI(D,o,s))throw new Error("sign: Invalid signature produced");return D}function gI(e,t,r){let{Fp:i,Fn:n,BASE:o}=lt,s=ct(e,64,"signature"),f=ct(t,void 0,"message"),h=ct(r,32,"publicKey");try{let m=ol(Ea(h)),S=Ea(s.subarray(0,32));if(!i.isValidNot0(S))return!1;let x=Ea(s.subarray(32,64));if(!n.isValidNot0(x))return!1;let I=Pg(n.toBytes(S),us(m),f),T=o.multiplyUnsafe(x).add(m.multiplyUnsafe(n.neg(I))),{x:M,y:N}=T.toAffine();return!(T.is0()||!Ci(N)||M!==S)}catch{return!1}}function vI(e,t){if(t===void 0)return dI;let r=us(e),i=or(nu("TapTweak",r,t));if(!lt.Fn.isValid(i))throw new Error("invalid TapTweak hash");return i}function kg(e){let t=lt.fromBytes(e.commitments[0]);return Ci(t.y)?e:{signers:{min:e.signers.min,max:e.signers.max},commitments:e.commitments.map(r=>lt.fromBytes(r).negate().toBytes()),verifyingShares:Object.fromEntries(Object.entries(e.verifyingShares).map(([r,i])=>[r,lt.fromBytes(i).negate().toBytes()]))}}function yI(e,t){let r=lt.fromBytes(t.commitments[0]);if(Ci(r.y))return e;let i=lt.Fn;return{...e,signingShare:i.toBytes(i.neg(i.fromBytes(e.signingShare)))}}function mD(e,t){if(Ci(e.y))return t;let r=lt.Fn;return{binding:r.toBytes(r.neg(r.fromBytes(t.binding))),hiding:r.toBytes(r.neg(r.fromBytes(t.hiding)))}}function bD(e,t,r){let i=lt.Fn,n=yI(e,t),o=kg(t),s=vI(lt.fromBytes(o.commitments[0]),r),f=i.toBytes(i.add(i.fromBytes(n.signingShare),s));return{identifier:n.identifier,signingShare:f}}function _D(e,t){let r=kg(e),i=vI(lt.fromBytes(r.commitments[0]),t),n=lt.BASE.multiply(i),o=r.commitments.map((f,h)=>(h===0?lt.fromBytes(f).add(n):lt.fromBytes(f)).toBytes()),s={};for(let f in r.verifyingShares)s[f]=lt.fromBytes(r.verifyingShares[f]).add(n).toBytes();return{signers:{min:r.signers.min,max:r.signers.max},commitments:o,verifyingShares:s}}var nl,uD,dI,Bg,gn,lt,hD,cI,us,Ci,Ea,dD,pD,gD,lI,vD,Mg,yD,wD,bI=br(()=>{y();xx();Kn();tl();eI();Jx();ba();uI();is();nl={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},uD={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},dI=BigInt(0),Bg=BigInt(2);gn=ya(nl.p,{sqrt:cD}),lt=nI(nl,{Fp:gn,endo:uD}),hD=fI(lt,Qo),cI={};us=e=>e.toBytes(!0).slice(1),Ci=e=>e%Bg===dI;Ea=or;dD=Object.freeze({lift_x:ol}),pD=(()=>{let r=i=>(i=i===void 0?eu(48):i,ma(i,nl.n));return Object.freeze({keygen:el(r,hI),getPublicKey:hI,sign:lD,verify:gI,Point:lt,utils:Object.freeze({randomSecretKey:r,taggedHash:nu,lift_x:ol,pointToBytes:us}),lengths:Object.freeze({secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48})})})(),gD=$x(gn,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(t=>BigInt(t)))),vD=()=>lI||(lI=sI(gn,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:gn.create(BigInt("-11"))})),Mg=Xx(lt,e=>{let{x:t,y:r}=vD()(gn.create(e[0]));return gD(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:gn.ORDER,m:1,k:128,expand:"xmd",hash:Qo}),yD=Ig({name:"FROST-secp256k1-SHA256-v1",Point:lt,hashToScalar:Mg.hashToScalar,hash:Qo});wD=Ig({name:"FROST-secp256k1-SHA256-TR-v1",Point:lt,hashToScalar:Mg.hashToScalar,hash:Qo,parsePublicKey(e){if(e.length===32)return ol(or(e));if(e.length===33)return lt.fromBytes(e);throw new Error(`expected x-only or compressed public key, got length=${e.length}`)},adjustScalar(e){let t=lt.BASE.multiply(e);return Ci(t.y)?e:lt.Fn.neg(e)},adjustPoint:e=>Ci(e.y)?e:e.negate(),challenge(e,t,r){return Pg(us(e),us(t),r)},adjustNonces:mD,adjustGroupCommitmentShare:(e,t)=>Ci(e.y)?t:t.negate(),adjustPublic:kg,adjustSecret:yI,adjustTx:{encode:e=>e.subarray(1),decode:e=>st(Uint8Array.of(2),e)},adjustDKG:e=>{let t=new Uint8Array(0);return{public:_D(e.public,t),secret:bD(e.secret,e.public,t)}}})});var Gn=B((uZ,EI)=>{"use strict";y();var _I=Lr(),{secp256k1:SD}=(bI(),_R(mI)),su=SD.Point,sl=su.Fn.ORDER;function ED(e){return BigInt("0x"+(e.toString(16)||"0"))}function Ng(e){var t=e.toString(16);return t.length%2&&(t="0"+t),new _I(t,16)}function al(e){if(e==null)throw new Error("Invalid Point");if(typeof e=="bigint")return e;if(typeof e=="number")return BigInt(e);if(typeof e=="string")return BigInt(e.indexOf("0x")===0?e:"0x"+e);if(typeof e.toString=="function")return ED(e);throw new Error("Invalid Point")}function ou(e){var t=Object.create(dt.prototype);return t._p=e,t}function wI(e,t){var r=al(t).toString(16).padStart(64,"0");return su.fromHex((e?"03":"02")+r)}function SI(e,t){var r;try{r=wI((t&1n)===1n,e)}catch{throw new Error("Point does not lie on the curve")}if(r.toAffine().y!==t)throw new Error("Invalid y value for curve.")}function dt(e,t,r){if(!(this instanceof dt))return new dt(e,t,r);var i,n;try{i=al(e),n=al(t)}catch{throw new Error("Invalid Point")}SI(i,n);try{this._p=su.fromAffine({x:i,y:n})}catch{throw new Error("Invalid Point")}return this}dt.fromX=function(t,r){try{var i=ou(wI(t,r))}catch{throw new Error("Invalid X")}return i.validate(),i};dt.getG=function(){return ou(su.BASE)};dt.getN=function(){return Ng(sl)};dt.prototype.getX=function(){return Ng(this._p.toAffine().x)};dt.prototype.getY=function(){return Ng(this._p.toAffine().y)};Object.defineProperty(dt.prototype,"x",{configurable:!0,enumerable:!0,get:function(){return this.getX()}});Object.defineProperty(dt.prototype,"y",{configurable:!0,enumerable:!0,get:function(){return this.getY()}});dt.prototype.mul=function(t){var r=(al(t)%sl+sl)%sl;return r===0n||this._p.is0()?ou(su.ZERO):ou(this._p.multiply(r))};dt.prototype.add=function(t){return ou(this._p.add(t._p))};dt.prototype.mulAdd=function(t,r,i){return this.mul(t).add(r.mul(i))};dt.prototype.eq=function(t){return this._p.equals(t._p)};dt.prototype.isInfinity=function(){return this._p.is0()};dt.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var t=this._p.toAffine();return SI(t.x,t.y),this};dt.pointToCompressed=function(t){var r=t.getX().toBuffer({size:32}),i=t.getY().toBuffer({size:32}),n,o=i[i.length-1]%2;return o?n=_.Buffer.from([3]):n=_.Buffer.from([2]),_.Buffer.concat([n,r])};dt.pointFromCompressed=function(e){if(e.length!==33)throw new Error("invalid buffer length");var t=e[0],r;if(t===3)r=!0;else if(t===2)r=!1;else throw new Error("invalid value of compressed prefix");var i=_I.fromBuffer(e.slice(1,33));return dt.fromX(r,i)};dt.prototype.toBuffer=function(){return dt.pointToCompressed(this)};dt.prototype.toHex=function(){return this.toBuffer().toString("hex")};dt.fromBuffer=function(e){return dt.pointFromCompressed(e)};dt.fromHex=function(e){return dt.fromBuffer(_.Buffer.from(e,"hex"))};EI.exports=dt});var ai=B(pt=>{"use strict";y();var xD=Xr(),ID=we();pt.inherits=ID;function AD(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function OD(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=o&63|128):AD(e,n)?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=o&63|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=o&63|128)}else for(n=0;n<e.length;n++)r[n]=e[n]|0;return r}pt.toArray=OD;function RD(e){for(var t="",r=0;r<e.length;r++)t+=II(e[r].toString(16));return t}pt.toHex=RD;function xI(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}pt.htonl=xI;function TD(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];t==="little"&&(n=xI(n)),r+=AI(n.toString(16))}return r}pt.toHex32=TD;function II(e){return e.length===1?"0"+e:e}pt.zero2=II;function AI(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}pt.zero8=AI;function BD(e,t,r,i){var n=r-t;xD(n%4===0);for(var o=new Array(n/4),s=0,f=t;s<o.length;s++,f+=4){var h;i==="big"?h=e[f]<<24|e[f+1]<<16|e[f+2]<<8|e[f+3]:h=e[f+3]<<24|e[f+2]<<16|e[f+1]<<8|e[f],o[s]=h>>>0}return o}pt.join32=BD;function PD(e,t){for(var r=new Array(e.length*4),i=0,n=0;i<e.length;i++,n+=4){var o=e[i];t==="big"?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=o&255):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=o&255)}return r}pt.split32=PD;function MD(e,t){return e>>>t|e<<32-t}pt.rotr32=MD;function kD(e,t){return e<<t|e>>>32-t}pt.rotl32=kD;function ND(e,t){return e+t>>>0}pt.sum32=ND;function CD(e,t,r){return e+t+r>>>0}pt.sum32_3=CD;function DD(e,t,r,i){return e+t+r+i>>>0}pt.sum32_4=DD;function qD(e,t,r,i,n){return e+t+r+i+n>>>0}pt.sum32_5=qD;function UD(e,t,r,i){var n=e[t],o=e[t+1],s=i+o>>>0,f=(s<i?1:0)+r+n;e[t]=f>>>0,e[t+1]=s}pt.sum64=UD;function LD(e,t,r,i){var n=t+i>>>0,o=(n<t?1:0)+e+r;return o>>>0}pt.sum64_hi=LD;function FD(e,t,r,i){var n=t+i;return n>>>0}pt.sum64_lo=FD;function jD(e,t,r,i,n,o,s,f){var h=0,m=t;m=m+i>>>0,h+=m<t?1:0,m=m+o>>>0,h+=m<o?1:0,m=m+f>>>0,h+=m<f?1:0;var S=e+r+n+s+h;return S>>>0}pt.sum64_4_hi=jD;function HD(e,t,r,i,n,o,s,f){var h=t+i+o+f;return h>>>0}pt.sum64_4_lo=HD;function KD(e,t,r,i,n,o,s,f,h,m){var S=0,x=t;x=x+i>>>0,S+=x<t?1:0,x=x+o>>>0,S+=x<o?1:0,x=x+f>>>0,S+=x<f?1:0,x=x+m>>>0,S+=x<m?1:0;var I=e+r+n+s+h+S;return I>>>0}pt.sum64_5_hi=KD;function VD(e,t,r,i,n,o,s,f,h,m){var S=t+i+o+f+m;return S>>>0}pt.sum64_5_lo=VD;function GD(e,t,r){var i=t<<32-r|e>>>r;return i>>>0}pt.rotr64_hi=GD;function zD(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}pt.rotr64_lo=zD;function WD(e,t,r){return e>>>r}pt.shr64_hi=WD;function YD(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}pt.shr64_lo=YD});var xa=B(RI=>{"use strict";y();var OI=ai(),ZD=Xr();function fl(){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}RI.BlockHash=fl;fl.prototype.update=function(t,r){if(t=OI.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),this.pending.length===0&&(this.pending=null),t=OI.join32(t,0,t.length-i,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this};fl.prototype.digest=function(t){return this.update(this._pad()),ZD(this.pending===null),this._digest(t)};fl.prototype._pad=function(){var t=this.pendingTotal,r=this._delta8,i=r-(t+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var o=1;o<i;o++)n[o]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=t>>>24&255,n[o++]=t>>>16&255,n[o++]=t>>>8&255,n[o++]=t&255}else for(n[o++]=t&255,n[o++]=t>>>8&255,n[o++]=t>>>16&255,n[o++]=t>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,s=8;s<this.padLength;s++)n[o++]=0;return n}});var Cg=B(vn=>{"use strict";y();var $D=ai(),Di=$D.rotr32;function XD(e,t,r,i){if(e===0)return TI(t,r,i);if(e===1||e===3)return PI(t,r,i);if(e===2)return BI(t,r,i)}vn.ft_1=XD;function TI(e,t,r){return e&t^~e&r}vn.ch32=TI;function BI(e,t,r){return e&t^e&r^t&r}vn.maj32=BI;function PI(e,t,r){return e^t^r}vn.p32=PI;function JD(e){return Di(e,2)^Di(e,13)^Di(e,22)}vn.s0_256=JD;function QD(e){return Di(e,6)^Di(e,11)^Di(e,25)}vn.s1_256=QD;function eq(e){return Di(e,7)^Di(e,18)^e>>>3}vn.g0_256=eq;function tq(e){return Di(e,17)^Di(e,19)^e>>>10}vn.g1_256=tq});var NI=B((yZ,kI)=>{"use strict";y();var Ia=ai(),rq=xa(),iq=Cg(),Dg=Ia.rotl32,au=Ia.sum32,nq=Ia.sum32_5,oq=iq.ft_1,MI=rq.BlockHash,sq=[1518500249,1859775393,2400959708,3395469782];function qi(){if(!(this instanceof qi))return new qi;MI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ia.inherits(qi,MI);kI.exports=qi;qi.blockSize=512;qi.outSize=160;qi.hmacStrength=80;qi.padLength=64;qi.prototype._update=function(t,r){for(var i=this.W,n=0;n<16;n++)i[n]=t[r+n];for(;n<i.length;n++)i[n]=Dg(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var o=this.h[0],s=this.h[1],f=this.h[2],h=this.h[3],m=this.h[4];for(n=0;n<i.length;n++){var S=~~(n/20),x=nq(Dg(o,5),oq(S,s,f,h),m,i[n],sq[S]);m=h,h=f,f=Dg(s,30),s=o,o=x}this.h[0]=au(this.h[0],o),this.h[1]=au(this.h[1],s),this.h[2]=au(this.h[2],f),this.h[3]=au(this.h[3],h),this.h[4]=au(this.h[4],m)};qi.prototype._digest=function(t){return t==="hex"?Ia.toHex32(this.h,"big"):Ia.split32(this.h,"big")}});var qg=B((bZ,DI)=>{"use strict";y();var Aa=ai(),aq=xa(),Oa=Cg(),fq=Xr(),fi=Aa.sum32,uq=Aa.sum32_4,cq=Aa.sum32_5,hq=Oa.ch32,lq=Oa.maj32,dq=Oa.s0_256,pq=Oa.s1_256,gq=Oa.g0_256,vq=Oa.g1_256,CI=aq.BlockHash,yq=[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 Ui(){if(!(this instanceof Ui))return new Ui;CI.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=yq,this.W=new Array(64)}Aa.inherits(Ui,CI);DI.exports=Ui;Ui.blockSize=512;Ui.outSize=256;Ui.hmacStrength=192;Ui.padLength=64;Ui.prototype._update=function(t,r){for(var i=this.W,n=0;n<16;n++)i[n]=t[r+n];for(;n<i.length;n++)i[n]=uq(vq(i[n-2]),i[n-7],gq(i[n-15]),i[n-16]);var o=this.h[0],s=this.h[1],f=this.h[2],h=this.h[3],m=this.h[4],S=this.h[5],x=this.h[6],I=this.h[7];for(fq(this.k.length===i.length),n=0;n<i.length;n++){var T=cq(I,pq(m),hq(m,S,x),this.k[n],i[n]),M=fi(dq(o),lq(o,s,f));I=x,x=S,S=m,m=fi(h,T),h=f,f=s,s=o,o=fi(T,M)}this.h[0]=fi(this.h[0],o),this.h[1]=fi(this.h[1],s),this.h[2]=fi(this.h[2],f),this.h[3]=fi(this.h[3],h),this.h[4]=fi(this.h[4],m),this.h[5]=fi(this.h[5],S),this.h[6]=fi(this.h[6],x),this.h[7]=fi(this.h[7],I)};Ui.prototype._digest=function(t){return t==="hex"?Aa.toHex32(this.h,"big"):Aa.split32(this.h,"big")}});var LI=B((wZ,UI)=>{"use strict";y();var Ug=ai(),qI=qg();function yn(){if(!(this instanceof yn))return new yn;qI.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Ug.inherits(yn,qI);UI.exports=yn;yn.blockSize=512;yn.outSize=224;yn.hmacStrength=192;yn.padLength=64;yn.prototype._digest=function(t){return t==="hex"?Ug.toHex32(this.h.slice(0,7),"big"):Ug.split32(this.h.slice(0,7),"big")}});var jg=B((EZ,KI)=>{"use strict";y();var pr=ai(),mq=xa(),bq=Xr(),Li=pr.rotr64_hi,Fi=pr.rotr64_lo,FI=pr.shr64_hi,jI=pr.shr64_lo,zn=pr.sum64,Lg=pr.sum64_hi,Fg=pr.sum64_lo,_q=pr.sum64_4_hi,wq=pr.sum64_4_lo,Sq=pr.sum64_5_hi,Eq=pr.sum64_5_lo,HI=mq.BlockHash,xq=[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 ui(){if(!(this instanceof ui))return new ui;HI.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=xq,this.W=new Array(160)}pr.inherits(ui,HI);KI.exports=ui;ui.blockSize=1024;ui.outSize=512;ui.hmacStrength=192;ui.padLength=128;ui.prototype._prepareBlock=function(t,r){for(var i=this.W,n=0;n<32;n++)i[n]=t[r+n];for(;n<i.length;n+=2){var o=Cq(i[n-4],i[n-3]),s=Dq(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],m=kq(i[n-30],i[n-29]),S=Nq(i[n-30],i[n-29]),x=i[n-32],I=i[n-31];i[n]=_q(o,s,f,h,m,S,x,I),i[n+1]=wq(o,s,f,h,m,S,x,I)}};ui.prototype._update=function(t,r){this._prepareBlock(t,r);var i=this.W,n=this.h[0],o=this.h[1],s=this.h[2],f=this.h[3],h=this.h[4],m=this.h[5],S=this.h[6],x=this.h[7],I=this.h[8],T=this.h[9],M=this.h[10],N=this.h[11],D=this.h[12],j=this.h[13],Y=this.h[14],Q=this.h[15];bq(this.k.length===i.length);for(var W=0;W<i.length;W+=2){var te=Y,ne=Q,se=Pq(I,T),ue=Mq(I,T),be=Iq(I,T,M,N,D,j),P=Aq(I,T,M,N,D,j),l=this.k[W],E=this.k[W+1],d=i[W],a=i[W+1],u=Sq(te,ne,se,ue,be,P,l,E,d,a),p=Eq(te,ne,se,ue,be,P,l,E,d,a);te=Tq(n,o),ne=Bq(n,o),se=Oq(n,o,s,f,h,m),ue=Rq(n,o,s,f,h,m);var b=Lg(te,ne,se,ue),v=Fg(te,ne,se,ue);Y=D,Q=j,D=M,j=N,M=I,N=T,I=Lg(S,x,u,p),T=Fg(x,x,u,p),S=h,x=m,h=s,m=f,s=n,f=o,n=Lg(u,p,b,v),o=Fg(u,p,b,v)}zn(this.h,0,n,o),zn(this.h,2,s,f),zn(this.h,4,h,m),zn(this.h,6,S,x),zn(this.h,8,I,T),zn(this.h,10,M,N),zn(this.h,12,D,j),zn(this.h,14,Y,Q)};ui.prototype._digest=function(t){return t==="hex"?pr.toHex32(this.h,"big"):pr.split32(this.h,"big")};function Iq(e,t,r,i,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function Aq(e,t,r,i,n,o){var s=t&i^~t&o;return s<0&&(s+=4294967296),s}function Oq(e,t,r,i,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function Rq(e,t,r,i,n,o){var s=t&i^t&o^i&o;return s<0&&(s+=4294967296),s}function Tq(e,t){var r=Li(e,t,28),i=Li(t,e,2),n=Li(t,e,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Bq(e,t){var r=Fi(e,t,28),i=Fi(t,e,2),n=Fi(t,e,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Pq(e,t){var r=Li(e,t,14),i=Li(e,t,18),n=Li(t,e,9),o=r^i^n;return o<0&&(o+=4294967296),o}function Mq(e,t){var r=Fi(e,t,14),i=Fi(e,t,18),n=Fi(t,e,9),o=r^i^n;return o<0&&(o+=4294967296),o}function kq(e,t){var r=Li(e,t,1),i=Li(e,t,8),n=FI(e,t,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Nq(e,t){var r=Fi(e,t,1),i=Fi(e,t,8),n=jI(e,t,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Cq(e,t){var r=Li(e,t,19),i=Li(t,e,29),n=FI(e,t,6),o=r^i^n;return o<0&&(o+=4294967296),o}function Dq(e,t){var r=Fi(e,t,19),i=Fi(t,e,29),n=jI(e,t,6),o=r^i^n;return o<0&&(o+=4294967296),o}});var zI=B((IZ,GI)=>{"use strict";y();var Hg=ai(),VI=jg();function mn(){if(!(this instanceof mn))return new mn;VI.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Hg.inherits(mn,VI);GI.exports=mn;mn.blockSize=1024;mn.outSize=384;mn.hmacStrength=192;mn.padLength=128;mn.prototype._digest=function(t){return t==="hex"?Hg.toHex32(this.h.slice(0,12),"big"):Hg.split32(this.h.slice(0,12),"big")}});var WI=B(Ra=>{"use strict";y();Ra.sha1=NI();Ra.sha224=LI();Ra.sha256=qg();Ra.sha384=zI();Ra.sha512=jg()});var QI=B(JI=>{"use strict";y();var cs=ai(),qq=xa(),ul=cs.rotl32,YI=cs.sum32,fu=cs.sum32_3,ZI=cs.sum32_4,XI=qq.BlockHash;function ji(){if(!(this instanceof ji))return new ji;XI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}cs.inherits(ji,XI);JI.ripemd160=ji;ji.blockSize=512;ji.outSize=160;ji.hmacStrength=192;ji.padLength=64;ji.prototype._update=function(t,r){for(var i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],f=this.h[4],h=i,m=n,S=o,x=s,I=f,T=0;T<80;T++){var M=YI(ul(ZI(i,$I(T,n,o,s),t[Fq[T]+r],Uq(T)),Hq[T]),f);i=f,f=s,s=ul(o,10),o=n,n=M,M=YI(ul(ZI(h,$I(79-T,m,S,x),t[jq[T]+r],Lq(T)),Kq[T]),I),h=I,I=x,x=ul(S,10),S=m,m=M}M=fu(this.h[1],o,x),this.h[1]=fu(this.h[2],s,I),this.h[2]=fu(this.h[3],f,h),this.h[3]=fu(this.h[4],i,m),this.h[4]=fu(this.h[0],n,S),this.h[0]=M};ji.prototype._digest=function(t){return t==="hex"?cs.toHex32(this.h,"little"):cs.split32(this.h,"little")};function $I(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function Uq(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Lq(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var Fq=[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],jq=[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],Hq=[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],Kq=[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 tA=B((PZ,eA)=>{"use strict";y();var Vq=ai(),Gq=Xr();function Ta(e,t,r){if(!(this instanceof Ta))return new Ta(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Vq.toArray(t,r))}eA.exports=Ta;Ta.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),Gq(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=new this.Hash().update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=new this.Hash().update(t)};Ta.prototype.update=function(t,r){return this.inner.update(t,r),this};Ta.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}});var iA=B(rA=>{y();var $t=rA;$t.utils=ai();$t.common=xa();$t.sha=WI();$t.ripemd=QI();$t.hmac=tA();$t.sha1=$t.sha.sha1;$t.sha256=$t.sha.sha256;$t.sha224=$t.sha.sha224;$t.sha384=$t.sha.sha384;$t.sha512=$t.sha.sha512;$t.ripemd160=$t.ripemd.ripemd160});var oA=B((CZ,nA)=>{"use strict";y();var cl=iA(),bn=at(),kt=nA.exports;kt.sha1=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha1().update(e).digest("hex"),"hex")};kt.sha1.blocksize=512;kt.sha256=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha256().update(e).digest("hex"),"hex")};kt.sha256.blocksize=512;kt.sha256sha256=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),kt.sha256(kt.sha256(e))};kt.ripemd160=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.ripemd160().update(e).digest("hex"),"hex")};kt.sha256ripemd160=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),kt.ripemd160(kt.sha256(e))};kt.sha512=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha512().update(e).digest("hex"),"hex")};kt.sha512.blocksize=1024;kt.hmac=function(e,t,r){bn.checkArgument(_.Buffer.isBuffer(t)),bn.checkArgument(_.Buffer.isBuffer(r)),bn.checkArgument(e.blocksize);var i=e.blocksize/8;if(r.length>i)r=e(r);else if(r.length<i){var n=_.Buffer.alloc(i);n.fill(0),r.copy(n),r=n}var o=_.Buffer.alloc(i);o.fill(92);var s=_.Buffer.alloc(i);s.fill(54);for(var f=_.Buffer.alloc(i),h=_.Buffer.alloc(i),m=0;m<i;m++)f[m]=o[m]^r[m],h[m]=s[m]^r[m];return e(_.Buffer.concat([f,e(_.Buffer.concat([h,t]))]))};kt.sha256hmac=function(e,t){return kt.hmac(kt.sha256,e,t)};kt.sha512hmac=function(e,t){return kt.hmac(kt.sha512,e,t)}});var aA=B((qZ,sA)=>{"use strict";y();var hl=Ph(),_n=at(),Nt=sA.exports;Nt.sha1=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha1").update(e).digest()};Nt.sha1.blocksize=512;Nt.sha256=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha256").update(e).digest()};Nt.sha256.blocksize=512;Nt.sha256sha256=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),Nt.sha256(Nt.sha256(e))};Nt.ripemd160=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("ripemd160").update(e).digest()};Nt.sha256ripemd160=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),Nt.ripemd160(Nt.sha256(e))};Nt.sha512=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha512").update(e).digest()};Nt.sha512.blocksize=1024;Nt.hmac=function(e,t,r){_n.checkArgument(_.Buffer.isBuffer(t)),_n.checkArgument(_.Buffer.isBuffer(r)),_n.checkArgument(e.blocksize);var i=e.blocksize/8;if(r.length>i)r=e(r);else if(r.length<i){var n=_.Buffer.alloc(i);n.fill(0),r.copy(n),r=n}var o=_.Buffer.alloc(i);o.fill(92);var s=_.Buffer.alloc(i);s.fill(54);for(var f=_.Buffer.alloc(i),h=_.Buffer.alloc(i),m=0;m<i;m++)f[m]=o[m]^r[m],h[m]=s[m]^r[m];return e(_.Buffer.concat([f,e(_.Buffer.concat([h,t]))]))};Nt.sha256hmac=function(e,t){return Nt.hmac(Nt.sha256,e,t)};Nt.sha512hmac=function(e,t){return Nt.hmac(Nt.sha512,e,t)}});var ir=B((LZ,Kg)=>{y();O.default.browser?Kg.exports=oA():Kg.exports=aA()});var Er=B((jZ,cA)=>{"use strict";y();var uA=mt(),zq=at(),fA=function(t){return uA.isString(t)?/^[0-9a-fA-F]+$/.test(t):!1};cA.exports={isValidJSON:function(t){var r;if(!uA.isString(t))return!1;try{r=JSON.parse(t)}catch{return!1}return typeof r=="object"},isHexa:fA,isHexaString:fA,defineImmutable:function(t,r){return Object.keys(r).forEach(function(i){Object.defineProperty(t,i,{configurable:!1,enumerable:!0,value:r[i]})}),t},isNaturalNumber:function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t&&t>=0},integerAsBuffer:function(t){zq.checkArgumentType(t,"number","integer");let r=_.Buffer.allocUnsafe(4);return r.writeUInt32BE(t,0),r}}});var du=B((KZ,dA)=>{"use strict";y();var wn=mt(),uu=Er(),hs=[],cu={};function hA(){}hA.prototype.toString=function(){return this.name};function hu(e,t){if(~hs.indexOf(e))return e;if(t){wn.isArray(t)||(t=[t]);for(var r=0;r<hs.length;r++){var i=hs[r],n=wn.pick(i,t),o=wn.values(n);if(~o.indexOf(e))return i}return}return cu[e]}function ll(e){for(var t=[],r=0;r<e.length;r++)t.push(e.charCodeAt(r)&31);return t}function lu(e){var t=new hA;uu.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey});var r=e.indexBy||Object.keys(e);return e.cashAddrPrefix&&wn.extend(t,{cashAddrPrefix:e.cashAddrPrefix,cashAddrPrefixArray:ll(e.cashAddrPrefix)}),e.networkMagic&&wn.extend(t,{networkMagic:uu.integerAsBuffer(e.networkMagic)}),e.port&&wn.extend(t,{port:e.port}),e.dnsSeeds&&wn.extend(t,{dnsSeeds:e.dnsSeeds}),hs.push(t),Wq(t,r),t}function Wq(e,t){for(var r=0;r<t.length;r++){var i=t[r],n=e[i];!wn.isUndefined(n)&&!wn.isObject(n)&&(cu[n]=e)}}function Yq(e,t){for(var r=0;r<t.length;r++){var i=t[r];cu[i]===e&&delete cu[i]}}function Zq(e){for(var t=0;t<hs.length;t++)hs[t]===e&&hs.splice(t,1);Yq(e,Object.keys(cu))}var dl={livenet:3823236072,testnet:4108710900,regtest:3669344250,stn:4224632057},lA=["seed.bitcoinsv.org","seed.bitcoinunlimited.info"],Wn={PORT:18333,NETWORK_MAGIC:dl.testnet,DNS_SEEDS:lA,PREFIX:"testnet",CASHADDRPREFIX:"bchtest"},Sn={PORT:18444,NETWORK_MAGIC:dl.regtest,DNS_SEEDS:[],PREFIX:"regtest",CASHADDRPREFIX:"bchreg"},Yn={PORT:9333,NETWORK_MAGIC:dl.stn,DNS_SEEDS:["stn-seed.bitcoinsv.io"],PREFIX:"stn",CASHADDRPREFIX:"bsvstn"},$q={name:"livenet",alias:"mainnet",prefix:"bitcoin",cashAddrPrefix:"bitcoincash",pubkeyhash:0,privatekey:128,scripthash:5,xpubkey:76067358,xprivkey:76066276,networkMagic:dl.livenet,port:8333,dnsSeeds:lA},Xq={name:"testnet",prefix:Wn.PREFIX,cashAddrPrefix:Wn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Wn.NETWORK_MAGIC},Jq={name:"regtest",prefix:Sn.PREFIX,cashAddrPrefix:Sn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Sn.NETWORK_MAGIC,port:Sn.PORT,dnsSeeds:[],indexBy:["port","name","cashAddrPrefix","networkMagic"]},Qq={name:"stn",prefix:Yn.PREFIX,cashAddrPrefix:Yn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Yn.NETWORK_MAGIC,indexBy:["port","name","cashAddrPrefix","networkMagic"]};lu(Xq);lu(Qq);lu(Jq);lu($q);var Vg=hu("livenet"),e9=hu("regtest"),Hi=hu("testnet"),t9=hu("stn");Object.defineProperty(Hi,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.PORT:this.stnEnabled?Yn.PORT:Wn.PORT}});Object.defineProperty(Hi,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?uu.integerAsBuffer(Sn.NETWORK_MAGIC):this.stnEnabled?uu.integerAsBuffer(Yn.NETWORK_MAGIC):uu.integerAsBuffer(Wn.NETWORK_MAGIC)}});Object.defineProperty(Hi,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.DNS_SEEDS:this.stnEnabled?Yn.DNS_SEEDS:Wn.DNS_SEEDS}});Object.defineProperty(Hi,"cashAddrPrefix",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.CASHADDRPREFIX:this.stnEnabled?Yn.CASHADDRPREFIX:Wn.CASHADDRPREFIX}});Object.defineProperty(Hi,"cashAddrPrefixArray",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?ll(Sn.CASHADDRPREFIX):this.stnEnabled?ll(Yn.CASHADDRPREFIX):ll(Wn.CASHADDRPREFIX)}});function r9(){Hi.regtestEnabled=!0}function i9(){Hi.regtestEnabled=!1}function n9(){Hi.stnEnabled=!0}function o9(){Hi.stnEnabled=!1}dA.exports={add:lu,remove:Zq,defaultNetwork:Vg,livenet:Vg,mainnet:Vg,testnet:Hi,regtest:e9,stn:t9,get:hu,enableRegtest:r9,disableRegtest:i9,enableStn:n9,disableStn:o9}});var gA=B((GZ,pA)=>{"use strict";y();var pl=We().Buffer;function s9(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var n=e.charAt(i),o=n.charCodeAt(0);if(t[o]!==255)throw new TypeError(n+" is ambiguous");t[o]=i}var s=e.length,f=e.charAt(0),h=Math.log(s)/Math.log(256),m=Math.log(256)/Math.log(s);function S(T){if((Array.isArray(T)||T instanceof Uint8Array)&&(T=pl.from(T)),!pl.isBuffer(T))throw new TypeError("Expected Buffer");if(T.length===0)return"";for(var M=0,N=0,D=0,j=T.length;D!==j&&T[D]===0;)D++,M++;for(var Y=(j-D)*m+1>>>0,Q=new Uint8Array(Y);D!==j;){for(var W=T[D],te=0,ne=Y-1;(W!==0||te<N)&&ne!==-1;ne--,te++)W+=256*Q[ne]>>>0,Q[ne]=W%s>>>0,W=W/s>>>0;if(W!==0)throw new Error("Non-zero carry");N=te,D++}for(var se=Y-N;se!==Y&&Q[se]===0;)se++;for(var ue=f.repeat(M);se<Y;++se)ue+=e.charAt(Q[se]);return ue}function x(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return pl.alloc(0);for(var M=0,N=0,D=0;T[M]===f;)N++,M++;for(var j=(T.length-M)*h+1>>>0,Y=new Uint8Array(j);M<T.length;){var Q=T.charCodeAt(M);if(Q>255)return;var W=t[Q];if(W===255)return;for(var te=0,ne=j-1;(W!==0||te<D)&&ne!==-1;ne--,te++)W+=s*Y[ne]>>>0,Y[ne]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");D=te,M++}for(var se=j-D;se!==j&&Y[se]===0;)se++;var ue=pl.allocUnsafe(N+(j-se));ue.fill(0,0,N);for(var be=N;se!==j;)ue[be++]=Y[se++];return ue}function I(T){var M=x(T);if(M)return M;throw new Error("Non-base"+s+" character")}return{encode:S,decodeUnsafe:x,decode:I}}pA.exports=s9});var yA=B((WZ,vA)=>{y();var a9=gA(),f9="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";vA.exports=a9(f9)});var wA=B((ZZ,_A)=>{"use strict";y();var Gg=mt(),mA=yA(),bA=xt(),u9="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),Gt=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t)){var r=t;this.fromBuffer(r)}else if(typeof t=="string"){var i=t;this.fromString(i)}};Gt.validCharacters=function(t){return bA.Buffer.isBuffer(t)&&(t=t.toString()),Gg.every(Gg.map(t,function(r){return Gg.includes(u9,r)}))};Gt.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this};Gt.encode=function(e){if(!bA.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return mA.encode(e)};Gt.decode=function(e){if(typeof e!="string")throw new Error("Input should be a string");return _.Buffer.from(mA.decode(e))};Gt.prototype.fromBuffer=function(e){return this.buf=e,this};Gt.fromBuffer=function(e){return new Gt().fromBuffer(e)};Gt.fromHex=function(e){return Gt.fromBuffer(_.Buffer.from(e,"hex"))};Gt.prototype.fromString=function(e){var t=Gt.decode(e);return this.buf=t,this};Gt.fromString=function(e){return new Gt().fromString(e)};Gt.prototype.toBuffer=function(){return this.buf};Gt.prototype.toHex=function(){return this.toBuffer().toString("hex")};Gt.prototype.toString=function(){return Gt.encode(this.buf)};_A.exports=Gt});var zg=B((XZ,IA)=>{"use strict";y();var SA=mt(),gl=wA(),EA=xt(),xA=ir().sha256sha256,At=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t)){var r=t;this.fromBuffer(r)}else if(typeof t=="string"){var i=t;this.fromString(i)}};At.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this};At.validChecksum=function(t,r){return SA.isString(t)&&(t=EA.Buffer.from(gl.decode(t))),SA.isString(r)&&(r=EA.Buffer.from(gl.decode(r))),r||(r=t.slice(-4),t=t.slice(0,-4)),At.checksum(t).toString("hex")===r.toString("hex")};At.decode=function(e){if(typeof e!="string")throw new Error("Input must be a string");var t=_.Buffer.from(gl.decode(e));if(t.length<4)throw new Error("Input string too short");var r=t.slice(0,-4),i=t.slice(-4),n=xA(r),o=n.slice(0,4);if(i.toString("hex")!==o.toString("hex"))throw new Error("Checksum mismatch");return r};At.checksum=function(e){return xA(e).slice(0,4)};At.encode=function(e){if(!_.Buffer.isBuffer(e))throw new Error("Input must be a buffer");var t=_.Buffer.alloc(e.length+4),r=At.checksum(e);return e.copy(t),r.copy(t,e.length),gl.encode(t)};At.prototype.fromBuffer=function(e){return this.buf=e,this};At.fromBuffer=function(e){return new At().fromBuffer(e)};At.fromHex=function(e){return At.fromBuffer(_.Buffer.from(e,"hex"))};At.prototype.fromString=function(e){var t=At.decode(e);return this.buf=t,this};At.fromString=function(e){var t=At.decode(e);return new At(t)};At.prototype.toBuffer=function(){return this.buf};At.prototype.toHex=function(){return this.toBuffer().toString("hex")};At.prototype.toString=function(){return At.encode(this.buf)};IA.exports=At});var gu=B((QZ,OA)=>{"use strict";y();var pu=mt(),AA=at(),Ba=Lr(),Rt=function e(t){if(!(this instanceof e))return new e(t);if(!pu.isUndefined(t))if(_.Buffer.isBuffer(t))this.set({buf:t});else if(pu.isString(t)){var r=_.Buffer.from(t,"hex");if(r.length*2!==t.length)throw new TypeError("Invalid hex string");this.set({buf:r})}else if(pu.isObject(t)){var i=t;this.set(i)}else throw new TypeError("Unrecognized argument for BufferReader")};Rt.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this};Rt.prototype.eof=function(){return this.pos>=this.buf.length};Rt.prototype.finished=Rt.prototype.eof;Rt.prototype.read=function(e){AA.checkArgument(!pu.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t};Rt.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e};Rt.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e};Rt.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e};Rt.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e};Rt.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=Ba.fromBuffer(e);return this.pos=this.pos+8,t};Rt.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=t*4294967296+e,i;if(r<=9007199254740991)i=new Ba(r);else{var n=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);i=new Ba(n,10,"le")}return this.pos=this.pos+8,i};Rt.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return e}};Rt.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return AA.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t};Rt.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}};Rt.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new Ba(this.readUInt16LE());case 254:return new Ba(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new Ba(e)}};Rt.prototype.reverse=function(){for(var e=_.Buffer.alloc(this.buf.length),t=0;t<e.length;t++)e[t]=this.buf[this.buf.length-1-t];return this.buf=e,this};Rt.prototype.readReverse=function(e){pu.isUndefined(e)&&(e=this.buf.length);var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,_.Buffer.from(t).reverse()};OA.exports=Rt});var Zg=B((t$,PA)=>{"use strict";y();function Zn(e){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(e)}function RA(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,h9(i.key),i)}}function c9(e,t,r){return t&&RA(e.prototype,t),r&&RA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h9(e){var t=l9(e,"string");return Zn(t)==="symbol"?t:String(t)}function l9(e,t){if(Zn(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(Zn(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yg(e,t)}function Yg(e,t){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},Yg(e,t)}function g9(e){var t=m9();return function(){var i=vl(e),n;if(t){var o=vl(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return v9(this,n)}}function v9(e,t){if(t&&(Zn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y9(e)}function y9(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m9(){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 vl(e){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vl(e)}var BA={},Pa,Wg;function vu(e,t,r){r||(r=Error);function i(o,s,f){return typeof t=="string"?t:t(o,s,f)}var n=(function(o){p9(f,o);var s=g9(f);function f(h,m,S){var x;return d9(this,f),x=s.call(this,i(h,m,S)),x.code=e,x}return c9(f)})(r);BA[e]=n}function TA(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function b9(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function _9(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function w9(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}vu("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError);vu("ERR_INVALID_ARG_TYPE",function(e,t,r){Pa===void 0&&(Pa=yl()),Pa(typeof e=="string","'name' must be a string");var i;typeof t=="string"&&b9(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(_9(e," argument"))n="The ".concat(e," ").concat(i," ").concat(TA(t,"type"));else{var o=w9(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(i," ").concat(TA(t,"type"))}return n+=". Received type ".concat(Zn(r)),n},TypeError);vu("ERR_INVALID_ARG_VALUE",function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";Wg===void 0&&(Wg=Ai());var i=Wg.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(r,". Received ").concat(i)},TypeError,RangeError);vu("ERR_INVALID_RETURN_VALUE",function(e,t,r){var i;return r&&r.constructor&&r.constructor.name?i="instance of ".concat(r.constructor.name):i="type ".concat(Zn(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")},TypeError);vu("ERR_MISSING_ARGS",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];Pa===void 0&&(Pa=yl()),Pa(t.length>0,"At least one arg needs to be specified");var i="The ",n=t.length;switch(t=t.map(function(o){return'"'.concat(o,'"')}),n){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,n-1).join(", "),i+=", and ".concat(t[n-1]," arguments");break}return"".concat(i," must be specified")},TypeError);PA.exports.codes=BA});var jA=B((i$,FA)=>{"use strict";y();function MA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function kA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MA(Object(r),!0).forEach(function(i){S9(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MA(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function S9(e,t,r){return t=qA(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NA(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,qA(i.key),i)}}function x9(e,t,r){return t&&NA(e.prototype,t),r&&NA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qA(e){var t=I9(e,"string");return gr(t)==="symbol"?t:String(t)}function I9(e,t){if(gr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(gr(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_u(e,t)}function O9(e){var t=LA();return function(){var i=wu(e),n;if(t){var o=wu(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return UA(this,n)}}function UA(e,t){if(t&&(gr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $g(e)}function $g(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xg(e){var t=typeof Map=="function"?new Map:void 0;return Xg=function(i){if(i===null||!R9(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(i))return t.get(i);t.set(i,n)}function n(){return ml(i,arguments,wu(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_u(n,i)},Xg(e)}function ml(e,t,r){return LA()?ml=Reflect.construct.bind():ml=function(n,o,s){var f=[null];f.push.apply(f,o);var h=Function.bind.apply(n,f),m=new h;return s&&_u(m,s.prototype),m},ml.apply(null,arguments)}function LA(){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 R9(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function _u(e,t){return _u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},_u(e,t)}function wu(e){return wu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wu(e)}function gr(e){"@babel/helpers - typeof";return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gr(e)}var T9=Ai(),Jg=T9.inspect,B9=Zg(),P9=B9.codes.ERR_INVALID_ARG_TYPE;function CA(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function M9(e,t){if(t=Math.floor(t),e.length==0||t==0)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+=e.substring(0,r-e.length),e}var ci="",yu="",mu="",Xt="",ls={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},k9=10;function DA(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach(function(i){r[i]=e[i]}),Object.defineProperty(r,"message",{value:e.message}),r}function bu(e){return Jg(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function N9(e,t,r){var i="",n="",o=0,s="",f=!1,h=bu(e),m=h.split(`
18
+ `+new Error().stack};return r.prototype=Object.create(e.prototype),r.prototype.name=e.prototype.name+t.name,e[t.name]=r,t.errors&&lx(r,t.errors),r},lx=function(e,t){og.each(t,function(r){hx(e,r)})},L7=function(e,t){return lx(e,t),e},ha={};ha.Error=function(){this.message="Internal error",this.stack=this.message+`
19
+ `+new Error().stack};ha.Error.prototype=Object.create(Error.prototype);ha.Error.prototype.name="bsv.Error";var U7=cx();L7(ha.Error,U7);sg.exports=ha.Error;sg.exports.extend=function(e){return hx(ha.Error,e)}});var at=B((JW,dx)=>{"use strict";y();var Qf=jn(),F7=mt();dx.exports={checkState:function(e,t){if(!e)throw new Qf.InvalidState(t)},checkArgument:function(e,t,r,i){if(!e)throw new Qf.InvalidArgument(t,r,i)},checkArgumentType:function(e,t,r){if(r=r||"(unknown name)",F7.isString(t)){if(t==="Buffer"){var i=xt();if(!i.Buffer.isBuffer(e))throw new Qf.InvalidArgumentType(e,t,r)}else if(typeof e!==t)throw new Qf.InvalidArgumentType(e,t,r)}else if(!(e instanceof t))throw new Qf.InvalidArgumentType(e,t.name,r)}}});var Ur=B((eY,gx)=>{"use strict";y();var nt=$i(),ag=at(),px=mt(),jh=function(e){for(var t=_.Buffer.alloc(e.length),r=0;r<e.length;r++)t[r]=e[e.length-1-r];return t};nt.Zero=new nt(0);nt.One=new nt(1);nt.Minus1=new nt(-1);nt.fromNumber=function(e){return ag.checkArgument(px.isNumber(e)),new nt(e)};nt.fromString=function(e,t){return ag.checkArgument(px.isString(e)),new nt(e,t)};nt.fromBuffer=function(e,t){typeof t<"u"&&t.endian==="little"&&(e=jh(e));var r=e.toString("hex"),i=new nt(r,16);return i};nt.fromSM=function(e,t){var r;if(e.length===0)return nt.fromBuffer(_.Buffer.from([0]));var i="big";return t&&(i=t.endian),i==="little"&&(e=jh(e)),e[0]&128?(e[0]=e[0]&127,r=nt.fromBuffer(e),r.neg().copy(r)):r=nt.fromBuffer(e),r};nt.prototype.toNumber=function(){return parseInt(this.toString(10),10)};nt.prototype.toBuffer=function(e){var t,r;if(e&&e.size){r=this.toString(16,2);var i=r.length/2;t=_.Buffer.from(r,"hex"),i===e.size||(i>e.size?t=nt.trim(t,i):i<e.size&&(t=nt.pad(t,i,e.size)))}else r=this.toString(16,2),t=_.Buffer.from(r,"hex");return typeof e<"u"&&e.endian==="little"&&(t=jh(t)),t};nt.prototype.toSMBigEndian=function(){var e;return this.cmp(nt.Zero)===-1?(e=this.neg().toBuffer(),e[0]&128?e=_.Buffer.concat([_.Buffer.from([128]),e]):e[0]=e[0]|128):(e=this.toBuffer(),e[0]&128&&(e=_.Buffer.concat([_.Buffer.from([0]),e]))),e.length===1&&e[0]===0&&(e=_.Buffer.from([])),e};nt.prototype.toSM=function(e){var t=e?e.endian:"big",r=this.toSMBigEndian();return t==="little"&&(r=jh(r)),r};nt.fromScriptNumBuffer=function(e,t,r){var i=r||4;if(ag.checkArgument(e.length<=i,new Error("script number overflow")),t&&e.length>0&&(e[e.length-1]&127)===0&&(e.length<=1||(e[e.length-2]&128)===0))throw new Error("non-minimally encoded script number");return nt.fromSM(e,{endian:"little"})};nt.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})};nt.trim=function(e,t){return e.slice(t-e.length,e.length)};nt.pad=function(e,t,r){for(var i=_.Buffer.alloc(r),n=0;n<e.length;n++)i[i.length-1-n]=e[e.length-1-n];for(n=0;n<r-t;n++)i[n]=0;return i};nt.prototype.toHex=function(...e){return this.toBuffer(...e).toString("hex")};nt.fromHex=function(e,...t){return nt.fromBuffer(_.Buffer.from(e,"hex"),...t)};gx.exports=nt});function fg(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Hn(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(`${r}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){let r=t&&`"${t}" `;throw new RangeError(`${r}expected integer >= 0, got ${e}`)}}function ki(e,t,r=""){let i=fg(e),n=e?.length,o=t!==void 0;if(!i||o&&n!==t){let s=r&&`"${r}" `,f=o?` of length ${t}`:"",h=i?`length=${n}`:`type=${typeof e}`,m=s+"expected Uint8Array"+f+", got "+h;throw i?new RangeError(m):new TypeError(m)}return e}function Hh(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Hn(e.outputLen),Hn(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function la(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Kh(e,t){ki(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function Jo(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Vh(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function oi(e,t){return e<<32-t|e>>>t}function Gh(e){if(ki(e),yx)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=j7[e[r]];return t}function vx(e){if(e>=hn._0&&e<=hn._9)return e-hn._0;if(e>=hn.A&&e<=hn.F)return e-(hn.A-10);if(e>=hn.a&&e<=hn.f)return e-(hn.a-10)}function ug(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if(yx)try{return Uint8Array.fromHex(e)}catch(n){throw n instanceof SyntaxError?new RangeError(n.message):n}let t=e.length,r=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);let i=new Uint8Array(r);for(let n=0,o=0;n<r;n++,o+=2){let s=vx(e.charCodeAt(o)),f=vx(e.charCodeAt(o+1));if(s===void 0||f===void 0){let h=e[o]+e[o+1];throw new RangeError('hex string expected, got non-hex character "'+h+'" at index '+o)}i[n]=s*16+f}return i}function ln(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function mx(...e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];ki(n),t+=n.length}let r=new Uint8Array(t);for(let i=0,n=0;i<e.length;i++){let o=e[i];r.set(o,n),n+=o.length}return r}function bx(e,t={}){let r=(n,o)=>e(o).update(n).digest(),i=e(void 0);return r.outputLen=i.outputLen,r.blockLen=i.blockLen,r.canXOF=i.canXOF,r.create=n=>e(n),Object.assign(r,t),Object.freeze(r)}function eu(e=32){Hn(e,"bytesLength");let t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var yx,j7,hn,_x,Kn=br(()=>{y();yx=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",j7=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));hn={_0:48,_9:57,A:65,F:70,a:97,f:102};_x=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])})});function wx(e,t,r){return e&t^~e&r}function Sx(e,t,r){return e&t^e&r^t&r}var zh,dn,Ex=br(()=>{y();Kn();zh=class{constructor(t,r,i,n){de(this,"blockLen");de(this,"outputLen");de(this,"canXOF",!1);de(this,"padOffset");de(this,"isLE");de(this,"buffer");de(this,"view");de(this,"finished",!1);de(this,"length",0);de(this,"pos",0);de(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=Vh(this.buffer)}update(t){la(this),ki(t);let{view:r,buffer:i,blockLen:n}=this,o=t.length;for(let s=0;s<o;){let f=Math.min(n-this.pos,o-s);if(f===n){let h=Vh(t);for(;n<=o-s;s+=n)this.process(h,s);continue}i.set(t.subarray(s,s+f),this.pos),this.pos+=f,s+=f,this.pos===n&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){la(this),Kh(t,this),this.finished=!0;let{buffer:r,view:i,blockLen:n,isLE:o}=this,{pos:s}=this;r[s++]=128,Jo(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(i,0),s=0);for(let x=s;x<n;x++)r[x]=0;i.setBigUint64(n-8,BigInt(this.length*8),o),this.process(i,0);let f=Vh(t),h=this.outputLen;if(h%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let m=h/4,S=this.get();if(m>S.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<m;x++)f.setUint32(4*x,S[x],o)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let i=t.slice(0,r);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:i,length:n,finished:o,destroyed:s,pos:f}=this;return t.destroyed=s,t.finished=o,t.length=n,t.pos=f,n%r&&t.buffer.set(i),t}clone(){return this._cloneInto()}},dn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225])});var H7,Vn,cg,hg,Qo,xx=br(()=>{y();Ex();Kn();H7=Uint32Array.from([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]),Vn=new Uint32Array(64),cg=class extends zh{constructor(t){super(64,t,8,!1)}get(){let{A:t,B:r,C:i,D:n,E:o,F:s,G:f,H:h}=this;return[t,r,i,n,o,s,f,h]}set(t,r,i,n,o,s,f,h){this.A=t|0,this.B=r|0,this.C=i|0,this.D=n|0,this.E=o|0,this.F=s|0,this.G=f|0,this.H=h|0}process(t,r){for(let x=0;x<16;x++,r+=4)Vn[x]=t.getUint32(r,!1);for(let x=16;x<64;x++){let I=Vn[x-15],T=Vn[x-2],M=oi(I,7)^oi(I,18)^I>>>3,N=oi(T,17)^oi(T,19)^T>>>10;Vn[x]=N+Vn[x-7]+M+Vn[x-16]|0}let{A:i,B:n,C:o,D:s,E:f,F:h,G:m,H:S}=this;for(let x=0;x<64;x++){let I=oi(f,6)^oi(f,11)^oi(f,25),T=S+I+wx(f,h,m)+H7[x]+Vn[x]|0,N=(oi(i,2)^oi(i,13)^oi(i,22))+Sx(i,n,o)|0;S=m,m=h,h=f,f=s+T|0,s=o,o=n,n=i,i=T+N|0}i=i+this.A|0,n=n+this.B|0,o=o+this.C|0,s=s+this.D|0,f=f+this.E|0,h=h+this.F|0,m=m+this.G|0,S=S+this.H|0,this.set(i,n,o,s,f,h,m,S)}roundClean(){Jo(Vn)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),Jo(this.buffer)}},hg=class extends cg{constructor(){super(32);de(this,"A",dn[0]|0);de(this,"B",dn[1]|0);de(this,"C",dn[2]|0);de(this,"D",dn[3]|0);de(this,"E",dn[4]|0);de(this,"F",dn[5]|0);de(this,"G",dn[6]|0);de(this,"H",dn[7]|0)}},Qo=bx(()=>new hg,_x(1))});function ts(e,t=""){if(typeof e!="boolean"){let r=t&&`"${t}" `;throw new TypeError(r+"expected boolean, got type="+typeof e)}return e}function Zh(e){if(typeof e=="bigint"){if(!Wh(e))throw new RangeError("positive bigint expected, got "+e)}else dg(e);return e}function Fr(e,t=""){if(typeof e!="number"){let r=t&&`"${t}" `;throw new TypeError(r+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){let r=t&&`"${t}" `;throw new RangeError(r+"expected safe integer, got "+e)}}function tu(e){let t=Zh(e).toString(16);return t.length&1?"0"+t:t}function Ix(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Yh:BigInt("0x"+e)}function or(e){return Ix(Gh(e))}function pa(e){return Ix(Gh(Xh(ki(e)).reverse()))}function $h(e,t){if(Hn(t),t===0)throw new RangeError("zero length");e=Zh(e);let r=e.toString(16);if(r.length>t*2)throw new RangeError("number too large");return ug(r.padStart(t*2,"0"))}function pg(e,t){return $h(e,t).reverse()}function Xh(e){return Uint8Array.from(ct(e))}function ga(e){if(typeof e!="string")throw new TypeError("ascii string expected, got "+typeof e);return Uint8Array.from(e,(t,r)=>{let i=t.charCodeAt(0);if(t.length!==1||i>127)throw new RangeError(`string contains non-ASCII character "${e[r]}" with code ${i} at position ${r}`);return i})}function K7(e,t,r){return Wh(e)&&Wh(t)&&Wh(r)&&t<=e&&e<r}function gg(e,t,r,i){if(!K7(t,r,i))throw new RangeError("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function rs(e){if(e<Yh)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Yh;e>>=lg,t+=1);return t}function Ax(e,t,r){if(Hn(e,"hashLen"),Hn(t,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let i=D=>new Uint8Array(D),n=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),f=1e3,h=i(e),m=i(e),S=0,x=()=>{h.fill(1),m.fill(0),S=0},I=(...D)=>r(m,st(h,...D)),T=(D=n)=>{m=I(o,D),h=I(),D.length!==0&&(m=I(s,D),h=I())},M=()=>{if(S++>=f)throw new Error("drbg: tried max amount of iterations");let D=0,j=[];for(;D<t;){h=I();let Y=h.slice();j.push(Y),D+=h.length}return st(...j)};return(D,j)=>{x(),T(D);let Y;for(;(Y=j(M()))===void 0;)T();return x(),Y}}function jr(e,t={},r={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(o,s,f){if(!f&&s!=="function"&&!Object.hasOwn(e,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let h=e[o];if(f&&h===void 0)return;let m=typeof h;if(m!==s||h===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${m}`)}let n=(o,s)=>Object.entries(o).forEach(([f,h])=>i(f,h,s));n(t,!1),n(r,!0)}var ct,dg,pn,st,da,es,dr,Yh,lg,Wh,va,is=br(()=>{y();Kn();ct=(e,t,r)=>ki(e,t,r),dg=Hn,pn=Gh,st=(...e)=>mx(...e),da=e=>ug(e),es=fg,dr=e=>eu(e),Yh=BigInt(0),lg=BigInt(1);Wh=e=>typeof e=="bigint"&&Yh<=e;va=e=>(lg<<BigInt(e))-lg});function wr(e,t){if(t<=Zt)throw new Error("mod: expected positive modulus, got "+t);let r=e%t;return r>=Zt?r:t+r}function Sr(e,t,r){if(t<Zt)throw new Error("pow2: expected non-negative exponent, got "+t);let i=e;for(;t-- >Zt;)i*=i,i%=r;return i}function Ox(e,t){if(e===Zt)throw new Error("invert: expected non-zero number");if(t<=Zt)throw new Error("invert: expected positive modulus, got "+t);let r=wr(e,t),i=t,n=Zt,o=Mt,s=Mt,f=Zt;for(;r!==Zt;){let m=i/r,S=i-r*m,x=n-s*m,I=o-f*m;i=r,r=S,n=s,o=f,s=x,f=I}if(i!==Mt)throw new Error("invert: does not exist");return wr(n,t)}function yg(e,t,r){let i=e;if(!i.eql(i.sqr(t),r))throw new Error("Cannot find square root")}function Nx(e,t){let r=e,i=(r.ORDER+Mt)/Bx,n=r.pow(t,i);return yg(r,n,t),n}function z7(e,t){let r=e,i=(r.ORDER-Px)/Mx,n=r.mul(t,ns),o=r.pow(n,i),s=r.mul(t,o),f=r.mul(r.mul(s,ns),o),h=r.mul(s,r.sub(f,r.ONE));return yg(r,h,t),h}function W7(e){let t=ya(e),r=Cx(e),i=r(t,t.neg(t.ONE)),n=r(t,i),o=r(t,t.neg(i)),s=(e+V7)/kx;return((f,h)=>{let m=f,S=m.pow(h,s),x=m.mul(S,i),I=m.mul(S,n),T=m.mul(S,o),M=m.eql(m.sqr(x),h),N=m.eql(m.sqr(I),h);S=m.cmov(S,x,M),x=m.cmov(T,I,N);let D=m.eql(m.sqr(x),h),j=m.cmov(S,x,D);return yg(m,j,h),j})}function Cx(e){if(e<Tx)throw new Error("sqrt is not defined for small field");let t=e-Mt,r=0;for(;t%ns===Zt;)t/=ns,r++;let i=ns,n=ya(e);for(;vg(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Nx;let o=n.pow(i,t),s=(t+Mt)/ns;return function(h,m){let S=h;if(S.is0(m))return m;if(vg(S,m)!==1)throw new Error("Cannot find square root");let x=r,I=S.mul(S.ONE,o),T=S.pow(m,t),M=S.pow(m,s);for(;!S.eql(T,S.ONE);){if(S.is0(T))return S.ZERO;let N=1,D=S.sqr(T);for(;!S.eql(D,S.ONE);)if(N++,D=S.sqr(D),N===x)throw new Error("Cannot find square root");let j=Mt<<BigInt(x-N-1),Y=S.pow(I,j);x=N,I=S.sqr(Y),T=S.mul(T,I),M=S.mul(M,Y)}return M}}function Y7(e){return e%Bx===Tx?Nx:e%Mx===Px?z7:e%kx===G7?W7(e):Cx(e)}function os(e){let t={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Z7.reduce((i,n)=>(i[n]="function",i),t);if(jr(e,r),Fr(e.BYTES,"BYTES"),Fr(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=Mt)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function $7(e,t,r){let i=e;if(r<Zt)throw new Error("invalid exponent, negatives unsupported");if(r===Zt)return i.ONE;if(r===Mt)return t;let n=i.ONE,o=t;for(;r>Zt;)r&Mt&&(n=i.mul(n,o)),o=i.sqr(o),r>>=Mt;return n}function ss(e,t,r=!1){let i=e,n=new Array(t.length).fill(r?i.ZERO:void 0),o=t.reduce((f,h,m)=>i.is0(h)?f:(n[m]=f,i.mul(f,h)),i.ONE),s=i.inv(o);return t.reduceRight((f,h,m)=>i.is0(h)?f:(n[m]=i.mul(f,n[m]),i.mul(f,h)),s),n}function vg(e,t){let r=e,i=(r.ORDER-Mt)/ns,n=r.pow(t,i),o=r.eql(n,r.ONE),s=r.eql(n,r.ZERO),f=r.eql(n,r.neg(r.ONE));if(!o&&!s&&!f)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function mg(e,t){return vg(e,t)!==-1}function X7(e,t){if(t!==void 0&&dg(t),e<=Zt)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);let r=rs(e);if(t!==void 0&&t<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${t})`);let i=t!==void 0?t:r,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}function ya(e,t={}){return new Jh(e,t)}function Dx(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=Mt)throw new Error("field order must be greater than 1");let t=rs(e-Mt);return Math.ceil(t/8)}function ru(e){let t=Dx(e);return t+Math.ceil(t/2)}function ma(e,t,r=!1){ct(e);let i=e.length,n=Dx(t),o=Math.max(ru(t),16);if(i<o||i>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+i);let s=r?pa(e):or(e),f=wr(s,t-Mt)+Mt;return r?pg(f,n):$h(f,n)}var Zt,Mt,ns,Tx,Bx,Px,V7,Mx,G7,kx,Z7,Rx,Jh,ba=br(()=>{y();is();Zt=BigInt(0),Mt=BigInt(1),ns=BigInt(2),Tx=BigInt(3),Bx=BigInt(4),Px=BigInt(5),V7=BigInt(7),Mx=BigInt(8),G7=BigInt(9),kx=BigInt(16);Z7=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];Rx=new WeakMap,Jh=class{constructor(t,r={}){de(this,"ORDER");de(this,"BITS");de(this,"BYTES");de(this,"isLE");de(this,"ZERO",Zt);de(this,"ONE",Mt);de(this,"_lengths");de(this,"_mod");if(t<=Mt)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(i=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:n,nByteLength:o}=X7(t,i);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=o,Object.freeze(this)}create(t){return wr(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Zt<=t&&t<this.ORDER}is0(t){return t===Zt}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&Mt)===Mt}neg(t){return wr(-t,this.ORDER)}eql(t,r){return t===r}sqr(t){return wr(t*t,this.ORDER)}add(t,r){return wr(t+r,this.ORDER)}sub(t,r){return wr(t-r,this.ORDER)}mul(t,r){return wr(t*r,this.ORDER)}pow(t,r){return $7(this,t,r)}div(t,r){return wr(t*Ox(r,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,r){return t+r}subN(t,r){return t-r}mulN(t,r){return t*r}inv(t){return Ox(t,this.ORDER)}sqrt(t){let r=Rx.get(this);return r||Rx.set(this,r=Y7(this.ORDER)),r(this,t)}toBytes(t){return this.isLE?pg(t,this.BYTES):$h(t,this.BYTES)}fromBytes(t,r=!1){ct(t);let{_lengths:i,BYTES:n,isLE:o,ORDER:s,_mod:f}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);let m=new Uint8Array(n);m.set(t,o?0:m.length-t.length),t=m}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let h=o?pa(t):or(t);if(f&&(h=wr(h,s)),!r&&!this.isValid(h))throw new Error("invalid field element: outside of range 0..ORDER");return h}invertBatch(t){return ss(this,t)}cmov(t,r,i){return ts(i,"condition"),i?r:t}};Object.freeze(Jh.prototype)});function Fx(e){let t=e;if(typeof t!="function")throw new TypeError("Point must be a constructor");jr({Fp:t.Fp,Fn:t.Fn,fromAffine:t.fromAffine,fromBytes:t.fromBytes,fromHex:t.fromHex},{Fp:"object",Fn:"object",fromAffine:"function",fromBytes:"function",fromHex:"function"}),os(t.Fp),os(t.Fn)}function iu(e,t){let r=t.negate();return e?r:t}function Sg(e,t){let r=ss(e.Fp,t.map(i=>i.Z));return t.map((i,n)=>e.fromAffine(i.toAffine(r[n])))}function jx(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function bg(e,t){jx(e,t);let r=Math.ceil(t/e)+1,i=2**(e-1),n=2**e,o=va(e),s=BigInt(e);return{windows:r,windowSize:i,mask:o,maxNumber:n,shiftBy:s}}function qx(e,t,r){let{windowSize:i,mask:n,maxNumber:o,shiftBy:s}=r,f=Number(e&n),h=e>>s;f>i&&(f-=o,h+=as);let m=t*i,S=m+Math.abs(f)-1,x=f===0,I=f<0,T=t%2!==0;return{nextN:h,offset:S,isZero:x,isNeg:I,isNegF:T,offsetF:m}}function J7(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((r,i)=>{if(!(r instanceof t))throw new Error("invalid point at index "+i)})}function Q7(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((r,i)=>{if(!t.isValid(r))throw new Error("invalid scalar at index "+i)})}function wg(e){return Hx.get(e)||1}function Lx(e){if(e!==_a)throw new Error("invalid wNAF")}function Kx(e,t,r,i){let n=t,o=e.ZERO,s=e.ZERO;for(;r>_a||i>_a;)r&as&&(o=o.add(n)),i&as&&(s=s.add(n)),n=n.double(),r>>=as,i>>=as;return{p1:o,p2:s}}function Vx(e,t,r){let i=e.Fn;J7(t,e),Q7(r,i);let n=t.length,o=r.length;if(n!==o)throw new Error("arrays of points and scalars must have equal length");let s=e.ZERO,f=rs(BigInt(n)),h=1;f>12?h=f-3:f>4?h=f-2:f>0&&(h=2);let m=va(h),S=new Array(Number(m)+1).fill(s),x=Math.floor((i.BITS-1)/h)*h,I=s;for(let T=x;T>=0;T-=h){S.fill(s);for(let N=0;N<o;N++){let D=r[N],j=Number(D>>BigInt(T)&m);S[j]=S[j].add(t[N])}let M=s;for(let N=S.length-1,D=s;N>0;N--)D=D.add(S[N]),M=M.add(D);if(I=I.add(M),T!==0)for(let N=0;N<h;N++)I=I.double()}return I}function Ux(e,t,r){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return os(t),t}else return ya(e,{isLE:r})}function Gx(e,t,r={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(let h of["p","n","h"]){let m=t[h];if(!(typeof m=="bigint"&&m>_a))throw new Error(`CURVE.${h} must be positive bigint`)}let n=Ux(t.p,r.Fp,i),o=Ux(t.n,r.Fn,i),f=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(let h of f)if(!n.isValid(t[h]))throw new Error(`CURVE.${h} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:o}}function el(e,t){return function(i){let n=e(i);return{secretKey:n,publicKey:t(n)}}}var _a,as,_g,Hx,Qh,tl=br(()=>{y();is();ba();_a=BigInt(0),as=BigInt(1);_g=new WeakMap,Hx=new WeakMap;Qh=class{constructor(t,r){de(this,"BASE");de(this,"ZERO");de(this,"Fn");de(this,"bits");this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=r}_unsafeLadder(t,r,i=this.ZERO){let n=t;for(;r>_a;)r&as&&(i=i.add(n)),n=n.double(),r>>=as;return i}precomputeWindow(t,r){let{windows:i,windowSize:n}=bg(r,this.bits),o=[],s=t,f=s;for(let h=0;h<i;h++){f=s,o.push(f);for(let m=1;m<n;m++)f=f.add(s),o.push(f);s=f.double()}return o}wNAF(t,r,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let n=this.ZERO,o=this.BASE,s=bg(t,this.bits);for(let f=0;f<s.windows;f++){let{nextN:h,offset:m,isZero:S,isNeg:x,isNegF:I,offsetF:T}=qx(i,f,s);i=h,S?o=o.add(iu(I,r[T])):n=n.add(iu(x,r[m]))}return Lx(i),{p:n,f:o}}wNAFUnsafe(t,r,i,n=this.ZERO){let o=bg(t,this.bits);for(let s=0;s<o.windows&&i!==_a;s++){let{nextN:f,offset:h,isZero:m,isNeg:S}=qx(i,s,o);if(i=f,!m){let x=r[h];n=n.add(S?x.negate():x)}}return Lx(i),n}getPrecomputes(t,r,i){let n=_g.get(r);return n||(n=this.precomputeWindow(r,t),t!==1&&(typeof i=="function"&&(n=i(n)),_g.set(r,n))),n}cached(t,r,i){let n=wg(t);return this.wNAF(n,this.getPrecomputes(n,t,i),r)}unsafe(t,r,i,n){let o=wg(t);return o===1?this._unsafeLadder(t,r,n):this.wNAFUnsafe(o,this.getPrecomputes(o,t,i),r,n)}createCache(t,r){jx(r,this.bits),Hx.set(t,r),_g.delete(t)}hasCache(t){return wg(t)!==1}}});function zx(e){if(!Number.isSafeInteger(e)||e<0||e>4294967295)throw new Error("wrong u32 integer:"+e);return e}function eD(e){if(zx(e),e<=1)return 1;if(e>2147483648)throw new Error("nextPowerOfTwo overflow: result does not fit u32");return 1<<Eg(e-1)+1>>>0}function Eg(e){return zx(e),31-Math.clz32(e)}function Wx(e,t,r,i,n){let o=e,s=r||((S,x)=>new Array(S).fill(x??o.ZERO)),f=S=>{if(Array.isArray(S))return!0;if(!ArrayBuffer.isView(S))return!1;let x=S;return typeof x.length=="number"&&typeof x.slice=="function"&&typeof x[Symbol.iterator]=="function"},h=(...S)=>{if(!S.length)return 0;for(let I of S)if(!f(I))throw new Error("poly: not polynomial: "+I);let x=S[0].length;for(let I=1;I<S.length;I++)if(S[I].length!==x)throw new Error(`poly: mismatched lengths ${x} vs ${S[I].length}`);if(n!==void 0&&x!==n)throw new Error(`poly: expected fixed length ${n}, got ${x}`);return x};function m(S,x,I=!1){let T=Eg(x),M=I?t.brp(T):t.roots(T);for(let N=0;N<x;N++)if(o.eql(S,M[N]))return N;return-1}return{roots:t,create:s,length:n,extend:(S,x)=>{h(S);let I=s(x,o.ZERO);for(let T=0;T<Math.min(S.length,x);T++)I[T]=S[T];return I},degree:S=>{h(S);for(let x=S.length-1;x>=0;x--)if(!o.is0(S[x]))return x;return-1},add:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.add(S[M],x[M]);return T},sub:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.sub(S[M],x[M]);return T},dot:(S,x)=>{let I=h(S,x),T=s(I);for(let M=0;M<I;M++)T[M]=o.mul(S[M],x[M]);return T},mul:(S,x)=>{if(f(x)){let I=h(S,x);if(i){let T=i.direct(S,!1,!0),M=i.direct(x,!1,!0);for(let N=0;N<T.length;N++)T[N]=o.mul(T[N],M[N]);return i.inverse(T,!0,!1)}else{let T=s(I);for(let M=0;M<I;M++)for(let N=0;N<I;N++){let D=(M+N)%I;T[D]=o.add(T[D],o.mul(S[M],x[N]))}return T}}else{let I=s(h(S));for(let T=0;T<I.length;T++)I[T]=o.mul(S[T],x);return I}},convolve(S,x){let I=eD(S.length+x.length-1);return this.mul(this.extend(S,I),this.extend(x,I))},shift(S,x){let I=s(h(S));I[0]=S[0];for(let T=1,M=o.ONE;T<S.length;T++)M=o.mul(M,x),I[T]=o.mul(S[T],M);return I},clone:S=>{h(S);let x=s(S.length);for(let I=0;I<S.length;I++)x[I]=S[I];return x},eval:(S,x)=>{h(S,x);let I=o.ZERO;for(let T=0;T<S.length;T++)I=o.add(I,o.mul(S[T],x[T]));return I},monomial:{basis:(S,x)=>{let I=s(x),T=o.ONE;for(let M=0;M<x;M++)I[M]=T,T=o.mul(T,S);return I},eval:(S,x)=>{h(S);let I=o.ZERO;for(let T=S.length-1;T>=0;T--)I=o.add(o.mul(I,x),S[T]);return I}},lagrange:{basis:(S,x,I=!1,T)=>{let M=Eg(x),N=T||(I?t.brp(M):t.roots(M)),D=s(x),j=m(S,x,I);if(j!==-1)return D[j]=o.ONE,D;let Y=o.pow(S,BigInt(x)),Q=o.mul(o.sub(Y,o.ONE),o.inv(BigInt(x))),W=s(x);for(let ne=0;ne<x;ne++)W[ne]=o.sub(S,N[ne]);let te=o.invertBatch(W);for(let ne=0;ne<x;ne++)D[ne]=o.mul(Q,o.mul(N[ne],te[ne]));return D},eval(S,x,I=!1){h(S);let T=m(x,S.length,I);if(T!==-1)return S[T];let M=this.basis(x,S.length,I),N=o.ZERO;for(let D=0;D<S.length;D++)o.is0(S[D])||(N=o.add(N,o.mul(S[D],M[D])));return N}},vanishing(S){h(S);let x=s(S.length+1,o.ZERO);x[0]=o.ONE;for(let I of S){let T=o.neg(I);for(let M=x.length-1;M>0;M--)x[M]=o.add(o.mul(x[M],T),x[M-1]);x[0]=o.mul(x[0],T)}return x}}}var Yx=br(()=>{y()});function fs(e,t){if(Fr(e),Fr(t),t<0||t>4)throw new Error("invalid I2OSP length: "+t);if(e<0||e>2**(8*t)-1)throw new Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let i=t-1;i>=0;i--)r[i]=e&255,e>>>=8;return new Uint8Array(r)}function rD(e,t){let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}function Zx(e){if(!es(e)&&typeof e!="string")throw new Error("DST must be Uint8Array or ascii string");let t=typeof e=="string"?ga(e):e;if(t.length===0)throw new Error("DST must be non-empty");return t}function iD(e,t,r,i){ct(e),Fr(r),t=Zx(t),t.length>255&&(t=i(st(ga("H2C-OVERSIZE-DST-"),t)));let{outputLen:n,blockLen:o}=i,s=Math.ceil(r/n);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let f=st(t,fs(t.length,1)),h=new Uint8Array(o),m=fs(r,2),S=new Array(s),x=i(st(h,e,m,fs(0,1),f));S[0]=i(st(x,fs(1,1),f));for(let T=1;T<s;T++){let M=[rD(x,S[T-1]),fs(T+1,1),f];S[T]=i(st(...M))}return st(...S).slice(0,r)}function nD(e,t,r,i,n){if(ct(e),Fr(r),t=Zx(t),t.length>255){let o=Math.ceil(2*i/8);t=n.create({dkLen:o}).update(ga("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return n.create({dkLen:r}).update(e).update(fs(r,2)).update(t).update(fs(t.length,1)).digest()}function xg(e,t,r){jr(r,{p:"bigint",m:"number",k:"number",hash:"function"});let{p:i,k:n,m:o,hash:s,expand:f,DST:h}=r;if(Fr(s.outputLen,"valid hash"),ct(e),Fr(t),t<1)throw new Error("hash_to_field: expected count >= 1");if(o<1)throw new Error("hash_to_field: expected m >= 1");let m=i.toString(2).length,S=Math.ceil((m+n)/8),x=t*o*S,I;if(f==="xmd")I=iD(e,h,x,s);else if(f==="xof")I=nD(e,h,x,n,s);else if(f==="_internal_pass")I=e;else throw new Error('expand must be "xmd" or "xof"');let T=new Array(t);for(let M=0;M<t;M++){let N=new Array(o);for(let D=0;D<o;D++){let j=S*(D+M*o),Y=I.subarray(j,j+S);N[D]=wr(tD(Y),i)}T[M]=N}return T}function $x(e,t){let r=t.map(i=>Array.from(i).reverse());return(i,n)=>{let[o,s,f,h]=r.map(x=>x.reduce((I,T)=>e.add(e.mul(I,i),T))),[m,S]=ss(e,[s,h],!0);return i=e.mul(o,m),n=e.mul(n,e.mul(f,S)),{x:i,y:n}}}function Xx(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");let i=f=>Object.freeze({...f,DST:es(f.DST)?Xh(f.DST):f.DST,...f.encodeDST===void 0?{}:{encodeDST:es(f.encodeDST)?Xh(f.encodeDST):f.encodeDST}}),n=i(r);function o(f){return e.fromAffine(t(f))}function s(f){let h=f.clearCofactor();return h.equals(e.ZERO)?e.ZERO:(h.assertValidity(),h)}return Object.freeze({get defaults(){return i(n)},Point:e,hashToCurve(f,h){let m=Object.assign({},n,h),S=xg(f,2,m),x=o(S[0]),I=o(S[1]);return s(x.add(I))},encodeToCurve(f,h){let m=n.encodeDST?{DST:n.encodeDST}:{},S=Object.assign({},n,m,h),x=xg(f,1,S),I=o(x[0]);return s(I)},mapToCurve(f){if(n.m===1){if(typeof f!="bigint")throw new Error("expected bigint (m=1)");return s(o([f]))}if(!Array.isArray(f))throw new Error("expected array of bigints");for(let h of f)if(typeof h!="bigint")throw new Error("expected array of bigints");return s(o(f))},hashToScalar(f,h){let m=e.Fn.ORDER,S=Object.assign({},n,{p:m,m:1,DST:oD},h);return xg(f,1,S)[0][0]}})}var tD,oD,Jx=br(()=>{y();is();ba();tD=or;oD="HashToScalar-"});function Ig(e){jr(e,{name:"string",hash:"function"},{hashToScalar:"function",validatePoint:"function",parsePublicKey:"function",adjustScalar:"function",adjustPoint:"function",challenge:"function",adjustNonces:"function",adjustSecret:"function",adjustPublic:"function",adjustGroupCommitmentShare:"function",adjustDKG:"function"}),Fx(e.Point);let{Point:t}=e,r=e.Fn===void 0?t.Fn:e.Fn,i=e.hash,n=e.hashToScalar===void 0?(k,L={DST:new Uint8Array})=>{let F=i(st(L.DST,k));return r.create(r.isLE?pa(F):or(F))}:e.hashToScalar,o=ln(e.H1!==void 0?e.H1:e.name+"rho"),s=ln(e.H2!==void 0?e.H2:e.name+"chal"),f=ln(e.H3!==void 0?e.H3:e.name+"nonce"),h=ln(e.H4!==void 0?e.H4:e.name+"msg"),m=ln(e.H5!==void 0?e.H5:e.name+"com"),S=ln(e.HDKG!==void 0?e.HDKG:e.name+"dkg"),x=ln(e.HID!==void 0?e.HID:e.name+"id"),I=k=>n(k,{DST:o}),T=k=>n(k,{DST:s}),M=k=>n(k,{DST:f}),N=k=>i(st(h,k)),D=k=>i(st(m,k)),j=k=>n(k,{DST:S}),Y=k=>n(k,{DST:x}),Q=(k=dr)=>{let L=ma(k(ru(r.ORDER)),r.ORDER,r.isLE);return r.isLE?pa(L):or(L)},W=k=>k.toBytes(),te=k=>{let L=t.fromBytes(k);return e.validatePoint&&e.validatePoint(L),L},ne=(k,L)=>({identifier:k,hiding:W(t.BASE.multiply(r.fromBytes(L.hiding))),binding:W(t.BASE.multiply(r.fromBytes(L.binding)))}),se=e.adjustPoint===void 0?k=>k:e.adjustPoint,ue=k=>{if(!r.isValid(k)||r.is0(k))throw new Error("Invalid identifier "+k);return k},be=k=>pn(r.toBytes(ue(k))),P=k=>{let L=ue(r.fromBytes(da(k)));if(be(L)!==k)throw new Error("expected canonical identifier hex");return L},l={encode:(k,L)=>{let F=st(W(k),r.toBytes(L));return e.adjustTx&&(F=e.adjustTx.encode(F)),F},decode:k=>{e.adjustTx&&(k=e.adjustTx.decode(k));let L=te(k.subarray(0,-r.BYTES)),F=r.fromBytes(k.subarray(-r.BYTES));return{R:L,z:F}}},E=(k=dr)=>{let L=Q(k);e.adjustScalar&&(L=e.adjustScalar(L));let F=t.BASE.multiply(L);return{scalar:L,point:F}},d="roots are unavailable in FROST polynomial mode",a={info:{G:r.ZERO,oddFactor:r.ZERO,powerOfTwo:0},roots(){throw new Error(d)},brp(){throw new Error(d)},inverse(){throw new Error(d)},omega(){throw new Error(d)},clear(){}},u=Wx(r,a),p=(k,L)=>Vx(t,k,L),b=(k,L)=>{if(!L.length)throw new Error("empty coefficients");return u.monomial.eval(L,k)},v=(k,L)=>{let F="invalid parameters";if(!k.some(X=>r.eql(X,L)))throw new Error(F);let V=new Set(k);if(V.size!==k.length)throw new Error(F);if(!V.has(L))throw new Error(F);let fe=r.ONE,Z=r.ONE;for(let X of k)r.eql(X,L)||(fe=r.mul(fe,X),Z=r.mul(Z,r.sub(X,L)));return r.div(fe,Z)},c=(k,L)=>{let F=u.monomial.basis(k,L.length);return p(L,F)},w=(k,L,F,V=dr)=>{rl(k);let fe=L===void 0?Q(V):r.fromBytes(L);if(!F){F=[];for(let ge=0;ge<k.min-1;ge++)F.push(Q(V))}if(F.length!==k.min-1)throw new Error("wrong coefficients length");let Z=[fe,...F],X=Z.map(ge=>t.BASE.multiply(ge));return{coefficients:Z,commitment:X,secret:fe}},A={challenge:(k,L,F)=>j(st(r.toBytes(k),W(L),W(F))),compute(k,L,F,V=dr){if(L.length<1)throw new Error("coefficients should have at least one element");let{point:fe,scalar:Z}=E(V),X=F[0],ge=this.challenge(k,X,fe),ee=r.add(Z,r.mul(L[0],ge));return l.encode(fe,ee)},validate(k,L,F){if(L.length<1)throw new Error("commitment should have at least one element");let{R:V,z:fe}=l.decode(F),Z=te(L[0]),X=this.challenge(k,Z,V);if(!V.equals(t.BASE.multiply(fe).subtract(Z.multiply(X))))throw new Error("invalid proof of knowledge")}},g={challenge:(k,L,F)=>e.challenge?e.challenge(k,L,F):T(st(W(k),W(L),F)),sign(k,L,F=dr){let{point:V,scalar:fe}=E(F),Z=t.BASE.multiply(L),X=this.challenge(V,Z,k),ge=r.add(fe,r.mul(X,L));return[V,ge]},verify(k,L,F,V){e.adjustPoint&&(V=e.adjustPoint(V)),e.adjustPoint&&(L=e.adjustPoint(L));let fe=this.challenge(L,V,k),Z=t.BASE.multiply(F),X=V.multiply(fe),ge=Z.subtract(X).subtract(L);return ge.clearCofactor&&(ge=ge.clearCofactor()),t.ZERO.equals(ge)}},R=(k,L,F)=>{if(!t.BASE.multiply(F).equals(c(k,L)))throw new Error("invalid secret share")},U={fromNumber(k){if(!Number.isSafeInteger(k))throw new Error("expected safe interger");return be(BigInt(k))},derive(k){if(typeof k!="string")throw new Error("wrong identifier string: "+k);return be(Y(ln(k)))}},H=(k,L=dr)=>M(st(L(32),r.toBytes(k))),z=(k,L,F)=>{let V=L.map(J=>[J.identifier,P(J.identifier),te(J.hiding),te(J.binding)]);V.sort((J,_e)=>J[1]<_e[1]?-1:J[1]>_e[1]?1:0);let fe=[];for(let[J,_e,he,le]of V)fe.push(r.toBytes(_e),W(he),W(le));let Z=D(st(...fe)),X=st(W(k),N(F),Z),ge={};for(let[J,_e]of V)ge[J]=I(st(X,r.toBytes(_e)));let ee=[],ae=[];for(let[J,_e,he,le]of V){if(t.ZERO.equals(he)||t.ZERO.equals(le))throw new Error("infinity commitment");ee.push(he,le),ae.push(r.ONE,ge[J])}let ht=p(ee,ae);return{identifiers:V.map(J=>J[1]),groupCommitment:ht,bindingFactors:ge}},re=(k,L,F,V)=>{let fe=se(te(k)),Z=P(V),{identifiers:X,groupCommitment:ge,bindingFactors:ee}=z(fe,L,F),ae=ee[V],ht=v(X,Z),pe=g.challenge(ge,fe,F);return{lambda:ht,challenge:pe,bindingFactor:ae,groupCommitment:ge}};Object.freeze(U);let oe={Identifier:U,DKG:Object.freeze({round1:(k,L,F,V=dr)=>{rl(L);let fe=P(k),{coefficients:Z,commitment:X}=w(L,F,void 0,V),ge=A.compute(fe,Z,X,V),ee=X.map(W),ae={identifier:be(fe),commitment:ee,proofOfKnowledge:ge},ht={identifier:fe,coefficients:Z,commitment:X.map(W),signers:{min:L.min,max:L.max},step:1};return{public:ae,secret:ht}},round2:(k,L)=>{if(L.length!==k.signers.max-1)throw new Error("wrong number of round1 packages");if(!k.coefficients||k.step===3)throw new Error("round3 package used in round2");let F={};for(let V of L){if(V.commitment.length!==k.signers.min)throw new Error("wrong number of commitments");let fe=P(V.identifier);if(fe===k.identifier)throw new Error("duplicate id="+be(fe));A.validate(fe,V.commitment,V.proofOfKnowledge);for(let X of V.commitment)te(X);if(F[V.identifier])throw new Error("Duplicate id="+fe);let Z=r.toBytes(b(fe,k.coefficients));F[V.identifier]={identifier:be(k.identifier),signingShare:Z}}return k.step=2,F},round3:(k,L,F)=>{if(L.length!==k.signers.max-1)throw new Error("wrong length of round1 packages");if(!k.coefficients||k.step!==2)throw new Error("round2 package used in round3");if(F.length!==L.length)throw new Error("wrong length of round2 packages");let V={};for(let _e of L){if(!_e.identifier||!_e.commitment)throw new Error("wrong round1 share");V[_e.identifier]={..._e}}for(let _e of F){if(!_e.identifier||!_e.signingShare)throw new Error("wrong round2 share");if(!V[_e.identifier])throw new Error("round1 share for "+_e.identifier+" is missing");V[_e.identifier].signingShare=_e.signingShare}if(Object.keys(V).length!==L.length)throw new Error("mismatch identifiers between rounds");let fe=r.ZERO;if(k.commitment.length!==k.signers.min)throw new Error("wrong commitments length");let Z=k.commitment.map(te),X=b(k.identifier,k.coefficients);R(k.identifier,Z,X);let ge=Z.map(W),ee={[be(k.identifier)]:ge};for(let _e in V){let he=V[_e];if(!he.signingShare||!he.commitment)throw new Error("mismatch identifiers");let le=P(_e),Rr=r.fromBytes(he.signingShare),xe=he.commitment.map(te);R(k.identifier,xe,Rr),fe=r.add(fe,Rr);let Se=be(le);if(ee[Se])throw new Error("duplicated id="+Se);ee[Se]=he.commitment}fe=r.add(fe,X);let ae=new Array(k.signers.min).fill(t.ZERO);for(let _e in ee){let he=ee[_e];if(he.length!==k.signers.min)throw new Error("wrong commitments length");for(let le=0;le<he.length;le++)ae[le]=ae[le].add(te(he[le]))}let ht=ae.map(W),pe={};for(let _e in ee)pe[_e]=W(c(P(_e),ae));let J={public:{signers:{min:k.signers.min,max:k.signers.max},commitments:ht,verifyingShares:Object.fromEntries(Object.entries(pe).map(([_e,he])=>[_e,he.slice()]))},secret:{identifier:be(k.identifier),signingShare:r.toBytes(fe)}};e.adjustDKG&&(J=e.adjustDKG(J));for(let _e=0;_e<k.coefficients.length;_e++)k.coefficients[_e]-=k.coefficients[_e];return delete k.coefficients,k.step=3,J},clean(k){if(k.identifier-=k.identifier,k.coefficients)for(let L=0;L<k.coefficients.length;L++)k.coefficients[L]-=k.coefficients[L];k.step=3}}),trustedDealer(k,L,F,V=dr){if(rl(k),L===void 0){L=[];for(let ae=1;ae<=k.max;ae++)L.push(U.fromNumber(ae))}else if(!Array.isArray(L)||L.length!==k.max)throw new Error("identifiers should be array of "+k.max);let fe={};for(let ae of L){let ht=P(ae);if(ae in fe)throw new Error("duplicated id="+ae);fe[ae]=ht}let Z=w(k,F,void 0,V),X=Z.commitment.map(W),ge={},ee={};for(let ae of L){let ht=b(fe[ae],Z.coefficients);ee[ae]=W(t.BASE.multiply(ht)),ge[ae]={identifier:ae,signingShare:r.toBytes(ht)}}return{public:{signers:{min:k.min,max:k.max},commitments:X,verifyingShares:ee},secretShares:ge}},validateSecret(k,L){let F=P(k.identifier),V=L.commitments.map(te),fe=r.fromBytes(k.signingShare);R(F,V,fe)},commit(k,L=dr){let F=r.fromBytes(k.signingShare),V=H(F,L),fe=H(F,L),Z={hiding:r.toBytes(V),binding:r.toBytes(fe)};return{nonces:Z,commitments:ne(k.identifier,Z)}},signShare(k,L,F,V,fe){Qx(L.signers,V.length);let Z=r.fromBytes(F.hiding),X=r.fromBytes(F.binding);if(r.is0(Z)||r.is0(X))throw new Error("signing nonces already used");let ge={identifier:k.identifier,hiding:W(t.BASE.multiply(Z)),binding:W(t.BASE.multiply(X))},ee=V.find(Ie=>Ie.identifier===k.identifier);if(!ee)throw new Error("missing signer commitment");if(pn(ee.hiding)!==pn(ge.hiding)||pn(ee.binding)!==pn(ge.binding))throw new Error("incorrect signer commitment");e.adjustSecret&&(k=e.adjustSecret(k,L)),e.adjustPublic&&(L=e.adjustPublic(L));let ae=r.fromBytes(k.signingShare),{lambda:ht,challenge:pe,bindingFactor:J,groupCommitment:_e}=re(L.commitments[0],V,fe,k.identifier),he=e.adjustNonces?e.adjustNonces(_e,F):F,le=e.adjustNonces?r.fromBytes(he.hiding):Z,Rr=e.adjustNonces?r.fromBytes(he.binding):X,xe=r.mul(r.mul(ht,ae),pe),Se=r.mul(Rr,J),no=r.toBytes(r.add(r.add(le,Se),xe));return F.hiding.fill(0),F.binding.fill(0),no},verifyShare(k,L,F,V,fe){e.adjustPublic&&(k=e.adjustPublic(k));let Z=L.find(Rr=>Rr.identifier===V);if(!Z)throw new Error("cannot find identifier commitment");let X=te(k.verifyingShares[V]),ge=te(Z.hiding),ee=te(Z.binding),{lambda:ae,challenge:ht,bindingFactor:pe,groupCommitment:J}=re(k.commitments[0],L,F,V),_e=ge.add(ee.multiply(pe));e.adjustGroupCommitmentShare&&(_e=e.adjustGroupCommitmentShare(J,_e));let he=t.BASE.multiply(r.fromBytes(fe)),le=_e.add(X.multiply(r.mul(ht,ae)));return he.equals(le)},aggregate(k,L,F,V){e.adjustPublic&&(k=e.adjustPublic(k));try{Qx(k.signers,L.length)}catch{throw new wa("aggregation failed",[])}let fe=L.map(ee=>ee.identifier);if(fe.length!==Object.keys(V).length)throw new wa("aggregation failed",[]);for(let ee of fe)if(!(ee in V)||!(ee in k.verifyingShares))throw new wa("aggregation failed",[]);let Z=te(k.commitments[0]),{groupCommitment:X}=z(Z,L,F),ge=r.ZERO;for(let ee of fe)ge=r.add(ge,r.fromBytes(V[ee]));if(!g.verify(F,X,ge,Z)){let ee=[];for(let ae of fe)this.verifyShare(k,L,F,ae,V[ae])||ee.push(ae);throw new wa("aggregation failed",ee)}return l.encode(X,ge)},sign(k,L){let F=r.fromBytes(L);e.adjustScalar&&(F=e.adjustScalar(F));let[V,fe]=g.sign(k,F);return l.encode(V,fe)},verify(k,L,F){let V=e.parsePublicKey?e.parsePublicKey(F):te(F),{R:fe,z:Z}=l.decode(k);return g.verify(L,fe,Z,V)},combineSecret(k,L){if(rl(L),!Array.isArray(k)||k.length<L.min)throw new Error("wrong secret shares array");let F=[],V={};for(let X of k){let ge=P(X.identifier),ee=be(ge);if(V[ee])throw new Error("duplicated id="+ee);V[ee]=!0,F.push([ge,r.fromBytes(X.signingShare)])}let fe=F.map(([X])=>X),Z=r.ZERO;for(let[X,ge]of F)Z=r.add(Z,r.mul(ge,v(fe,X)));return r.toBytes(Z)},utils:Object.freeze({Fn:r,randomScalar:(k=dr)=>r.toBytes(E(k).scalar),generateSecretPolynomial:(k,L,F,V)=>{let fe=w(k,L,F,V);return{...fe,commitment:fe.commitment.map(W)}}})};return Object.freeze(oe)}var rl,Qx,wa,eI=br(()=>{y();Kn();is();tl();Yx();ba();rl=e=>{if(!Number.isSafeInteger(e.min)||!Number.isSafeInteger(e.max))throw new Error("Wrong signers info: min="+e.min+" max="+e.max);if(e.min<2||e.max<2||e.min>e.max)throw new Error("Wrong signers info: min="+e.min+" max="+e.max)},Qx=(e,t)=>{if(t<e.min||t>e.max)throw new Error("Wrong number of commitments="+t)},wa=class extends Error{constructor(r,i){super(r);de(this,"cheaters");this.cheaters=i}}});var il,tI,rI=br(()=>{y();Kn();il=class{constructor(t,r){de(this,"oHash");de(this,"iHash");de(this,"blockLen");de(this,"outputLen");de(this,"canXOF",!1);de(this,"finished",!1);de(this,"destroyed",!1);if(Hh(t),ki(r,void 0,"key"),this.iHash=t.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,n=new Uint8Array(i);n.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<n.length;o++)n[o]^=54;this.iHash.update(n),this.oHash=t.create();for(let o=0;o<n.length;o++)n[o]^=106;this.oHash.update(n),Jo(n)}update(t){return la(this),this.iHash.update(t),this}digestInto(t){la(this),Kh(t,this),this.finished=!0;let r=t.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:i,finished:n,destroyed:o,blockLen:s,outputLen:f}=this;return t=t,t.finished=n,t.destroyed=o,t.blockLen=s,t.outputLen=f,t.oHash=r._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},tI=(()=>{let e=((t,r,i)=>new il(t,r).update(i).digest());return e.create=(t,r)=>new il(t,r),e})()});function sD(e,t,r){gg("scalar",e,Hr,r);let[[i,n],[o,s]]=t,f=iI(s*e,r),h=iI(-n*e,r),m=e-f*i-h*o,S=-f*n-h*s,x=m<Hr,I=S<Hr;x&&(m=-m),I&&(S=-S);let T=va(Math.ceil(rs(r)/2))+Vt;if(m<Hr||m>=T||S<Hr||S>=T)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:x,k1:m,k2neg:I,k2:S}}function Og(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Ag(e,t){jr(e);let r={};for(let i of Object.keys(t))r[i]=e[i]===void 0?t[i]:e[i];return ts(r.lowS,"lowS"),ts(r.prehash,"prehash"),r.format!==void 0&&Og(r.format),r}function nI(e,t={}){let r=Gx("weierstrass",e,t),i=r.Fp,n=r.Fn,o=r.CURVE,{h:s,n:f}=o;jr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:h,allowInfinityPoint:m}=t;if(h&&(!i.is0(o.a)||typeof h.beta!="bigint"||!Array.isArray(h.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let S=aI(i,n);function x(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function I(E,d,a){if(m&&d.is0())return Uint8Array.of(0);let{x:u,y:p}=d.toAffine(),b=i.toBytes(u);if(ts(a,"isCompressed"),a){x();let v=!i.isOdd(p);return st(oI(v),b)}else return st(Uint8Array.of(4),b,i.toBytes(p))}function T(E){ct(E,void 0,"Point");let{publicKey:d,publicKeyUncompressed:a}=S,u=E.length,p=E[0],b=E.subarray(1);if(m&&u===1&&p===0)return{x:i.ZERO,y:i.ZERO};if(u===d&&(p===2||p===3)){let v=i.fromBytes(b);if(!i.isValid(v))throw new Error("bad point: is not on curve, wrong x");let c=D(v),w;try{w=i.sqrt(c)}catch(R){let U=R instanceof Error?": "+R.message:"";throw new Error("bad point: is not on curve, sqrt error"+U)}x();let A=i.isOdd(w);return(p&1)===1!==A&&(w=i.neg(w)),{x:v,y:w}}else if(u===a&&p===4){let v=i.BYTES,c=i.fromBytes(b.subarray(0,v)),w=i.fromBytes(b.subarray(v,v*2));if(!j(c,w))throw new Error("bad point: is not on curve");return{x:c,y:w}}else throw new Error(`bad point: got length ${u}, expected compressed=${d} or uncompressed=${a}`)}let M=t.toBytes===void 0?I:t.toBytes,N=t.fromBytes===void 0?T:t.fromBytes;function D(E){let d=i.sqr(E),a=i.mul(d,E);return i.add(i.add(a,i.mul(E,o.a)),o.b)}function j(E,d){let a=i.sqr(d),u=D(E);return i.eql(a,u)}if(!j(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let Y=i.mul(i.pow(o.a,Sa),Tg),Q=i.mul(i.sqr(o.b),BigInt(27));if(i.is0(i.add(Y,Q)))throw new Error("bad curve params: a or b");function W(E,d,a=!1){if(!i.isValid(d)||a&&i.is0(d))throw new Error(`bad point coordinate ${E}`);return d}function te(E){if(!(E instanceof ue))throw new Error("Weierstrass Point expected")}function ne(E){if(!h||!h.basises)throw new Error("no endo");return sD(E,h.basises,n.ORDER)}function se(E,d,a,u,p){return a=new ue(i.mul(a.X,E),a.Y,a.Z),d=iu(u,d),a=iu(p,a),d.add(a)}let l=class l{constructor(d,a,u){de(this,"X");de(this,"Y");de(this,"Z");this.X=W("x",d),this.Y=W("y",a,!0),this.Z=W("z",u),Object.freeze(this)}static CURVE(){return o}static fromAffine(d){let{x:a,y:u}=d||{};if(!d||!i.isValid(a)||!i.isValid(u))throw new Error("invalid affine point");if(d instanceof l)throw new Error("projective point not allowed");return i.is0(a)&&i.is0(u)?l.ZERO:new l(a,u,i.ONE)}static fromBytes(d){let a=l.fromAffine(N(ct(d,void 0,"point")));return a.assertValidity(),a}static fromHex(d){return l.fromBytes(da(d))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(d=8,a=!0){return P.createCache(this,d),a||this.multiply(Sa),this}assertValidity(){let d=this;if(d.is0()){if(t.allowInfinityPoint&&i.is0(d.X)&&i.eql(d.Y,i.ONE)&&i.is0(d.Z))return;throw new Error("bad point: ZERO")}let{x:a,y:u}=d.toAffine();if(!i.isValid(a)||!i.isValid(u))throw new Error("bad point: x or y not field elements");if(!j(a,u))throw new Error("bad point: equation left != right");if(!d.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:d}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(d)}equals(d){te(d);let{X:a,Y:u,Z:p}=this,{X:b,Y:v,Z:c}=d,w=i.eql(i.mul(a,c),i.mul(b,p)),A=i.eql(i.mul(u,c),i.mul(v,p));return w&&A}negate(){return new l(this.X,i.neg(this.Y),this.Z)}double(){let{a:d,b:a}=o,u=i.mul(a,Sa),{X:p,Y:b,Z:v}=this,c=i.ZERO,w=i.ZERO,A=i.ZERO,g=i.mul(p,p),R=i.mul(b,b),U=i.mul(v,v),H=i.mul(p,b);return H=i.add(H,H),A=i.mul(p,v),A=i.add(A,A),c=i.mul(d,A),w=i.mul(u,U),w=i.add(c,w),c=i.sub(R,w),w=i.add(R,w),w=i.mul(c,w),c=i.mul(H,c),A=i.mul(u,A),U=i.mul(d,U),H=i.sub(g,U),H=i.mul(d,H),H=i.add(H,A),A=i.add(g,g),g=i.add(A,g),g=i.add(g,U),g=i.mul(g,H),w=i.add(w,g),U=i.mul(b,v),U=i.add(U,U),g=i.mul(U,H),c=i.sub(c,g),A=i.mul(U,R),A=i.add(A,A),A=i.add(A,A),new l(c,w,A)}add(d){te(d);let{X:a,Y:u,Z:p}=this,{X:b,Y:v,Z:c}=d,w=i.ZERO,A=i.ZERO,g=i.ZERO,R=o.a,U=i.mul(o.b,Sa),H=i.mul(a,b),z=i.mul(u,v),re=i.mul(p,c),oe=i.add(a,u),k=i.add(b,v);oe=i.mul(oe,k),k=i.add(H,z),oe=i.sub(oe,k),k=i.add(a,p);let L=i.add(b,c);return k=i.mul(k,L),L=i.add(H,re),k=i.sub(k,L),L=i.add(u,p),w=i.add(v,c),L=i.mul(L,w),w=i.add(z,re),L=i.sub(L,w),g=i.mul(R,k),w=i.mul(U,re),g=i.add(w,g),w=i.sub(z,g),g=i.add(z,g),A=i.mul(w,g),z=i.add(H,H),z=i.add(z,H),re=i.mul(R,re),k=i.mul(U,k),z=i.add(z,re),re=i.sub(H,re),re=i.mul(R,re),k=i.add(k,re),H=i.mul(z,k),A=i.add(A,H),H=i.mul(L,k),w=i.mul(oe,w),w=i.sub(w,H),H=i.mul(oe,z),g=i.mul(L,g),g=i.add(g,H),new l(w,A,g)}subtract(d){return te(d),this.add(d.negate())}is0(){return this.equals(l.ZERO)}multiply(d){let{endo:a}=t;if(!n.isValidNot0(d))throw new RangeError("invalid scalar: out of range");let u,p,b=v=>P.cached(this,v,c=>Sg(l,c));if(a){let{k1neg:v,k1:c,k2neg:w,k2:A}=ne(d),{p:g,f:R}=b(c),{p:U,f:H}=b(A);p=R.add(H),u=se(a.beta,g,U,v,w)}else{let{p:v,f:c}=b(d);u=v,p=c}return Sg(l,[u,p])[0]}multiplyUnsafe(d){let{endo:a}=t,u=this,p=d;if(!n.isValid(p))throw new RangeError("invalid scalar: out of range");if(p===Hr||u.is0())return l.ZERO;if(p===Vt)return u;if(P.hasCache(this))return this.multiply(p);if(a){let{k1neg:b,k1:v,k2neg:c,k2:w}=ne(p),{p1:A,p2:g}=Kx(l,u,v,w);return se(a.beta,A,g,b,c)}else return P.unsafe(u,p)}toAffine(d){let a=this,u=d,{X:p,Y:b,Z:v}=a;if(i.eql(v,i.ONE))return{x:p,y:b};let c=a.is0();u==null&&(u=c?i.ONE:i.inv(v));let w=i.mul(p,u),A=i.mul(b,u),g=i.mul(v,u);if(c)return{x:i.ZERO,y:i.ZERO};if(!i.eql(g,i.ONE))throw new Error("invZ was invalid");return{x:w,y:A}}isTorsionFree(){let{isTorsionFree:d}=t;return s===Vt?!0:d?d(l,this):P.unsafe(this,f).is0()}clearCofactor(){let{clearCofactor:d}=t;return s===Vt?this:d?d(l,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Vt?this.is0():this.clearCofactor().is0()}toBytes(d=!0){return ts(d,"isCompressed"),this.assertValidity(),M(l,this,d)}toHex(d=!0){return pn(this.toBytes(d))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}};de(l,"BASE",new l(o.Gx,o.Gy,i.ONE)),de(l,"ZERO",new l(i.ZERO,i.ONE,i.ZERO)),de(l,"Fp",i),de(l,"Fn",n);let ue=l,be=n.BITS,P=new Qh(ue,t.endo?Math.ceil(be/2):be);return be>=8&&ue.BASE.precompute(8),Object.freeze(ue.prototype),Object.freeze(ue),ue}function oI(e){return Uint8Array.of(e?2:3)}function aD(e,t){let r=os(e),i=r.ORDER,n=Hr;for(let N=i-Vt;N%Ni===Hr;N/=Ni)n+=Vt;let o=n,s=Ni<<o-Vt-Vt,f=s*Ni,h=(i-Vt)/f,m=(h-Vt)/Ni,S=f-Vt,x=s,I=r.pow(t,h),T=r.pow(t,(h+Vt)/Ni),M=(N,D)=>{let j=I,Y=r.pow(D,S),Q=r.sqr(Y);Q=r.mul(Q,D);let W=r.mul(N,Q);W=r.pow(W,m),W=r.mul(W,Y),Y=r.mul(W,D),Q=r.mul(W,N);let te=r.mul(Q,Y);W=r.pow(te,x);let ne=r.eql(W,r.ONE);Y=r.mul(Q,T),W=r.mul(te,j),Q=r.cmov(Y,Q,ne),te=r.cmov(W,te,ne);for(let se=o;se>Vt;se--){let ue=se-Ni;ue=Ni<<ue-Vt;let be=r.pow(te,ue),P=r.eql(be,r.ONE);Y=r.mul(Q,j),j=r.mul(j,j),be=r.mul(te,j),Q=r.cmov(Y,Q,P),te=r.cmov(be,te,P)}return{isValid:!r.is0(D)&&(ne||r.is0(N)),value:Q}};if(r.ORDER%Tg===Sa){let N=(r.ORDER-Sa)/Tg,D=r.sqrt(r.neg(t));M=(j,Y)=>{let Q=r.sqr(Y),W=r.mul(j,Y);Q=r.mul(Q,W);let te=r.pow(Q,N);te=r.mul(te,W);let ne=r.mul(te,D),se=r.mul(r.sqr(te),Y),ue=r.eql(se,j),be=r.cmov(ne,te,ue);return{isValid:!r.is0(Y)&&ue,value:be}}}return M}function sI(e,t){let r=os(e),{A:i,B:n,Z:o}=t;if(!r.isValidNot0(i)||!r.isValidNot0(n)||!r.isValid(o))throw new Error("mapToCurveSimpleSWU: invalid opts");if(r.eql(o,r.neg(r.ONE))||mg(r,o))throw new Error("mapToCurveSimpleSWU: invalid opts");let s=r.mul(n,r.inv(r.mul(o,i))),f=r.add(r.add(r.mul(r.sqr(s),s),r.mul(i,s)),n);if(!mg(r,f))throw new Error("mapToCurveSimpleSWU: invalid opts");let h=aD(r,o);if(!r.isOdd)throw new Error("Field does not have .isOdd()");return m=>{let S,x,I,T,M,N,D,j;S=r.sqr(m),S=r.mul(S,o),x=r.sqr(S),x=r.add(x,S),I=r.add(x,r.ONE),I=r.mul(I,n),T=r.cmov(o,r.neg(x),!r.eql(x,r.ZERO)),T=r.mul(T,i),x=r.sqr(I),N=r.sqr(T),M=r.mul(N,i),x=r.add(x,M),x=r.mul(x,I),N=r.mul(N,T),M=r.mul(N,n),x=r.add(x,M),D=r.mul(S,I);let{isValid:Y,value:Q}=h(x,N);j=r.mul(S,m),j=r.mul(j,Q),D=r.cmov(D,I,Y),j=r.cmov(j,Q,Y);let W=r.isOdd(m)===r.isOdd(j);j=r.cmov(r.neg(j),j,W);let te=ss(r,[T],!0)[0];return D=r.mul(D,te),{x:D,y:j}}}function aI(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function fD(e,t={}){let{Fn:r}=e,i=t.randomBytes===void 0?dr:t.randomBytes,n=Object.assign(aI(e.Fp,r),{seed:Math.max(ru(r.ORDER),16)});function o(T){try{let M=r.fromBytes(T);return r.isValidNot0(M)}catch{return!1}}function s(T,M){let{publicKey:N,publicKeyUncompressed:D}=n;try{let j=T.length;return M===!0&&j!==N||M===!1&&j!==D?!1:!!e.fromBytes(T)}catch{return!1}}function f(T){return T=T===void 0?i(n.seed):T,ma(ct(T,n.seed,"seed"),r.ORDER)}function h(T,M=!0){return e.BASE.multiply(r.fromBytes(T)).toBytes(M)}function m(T){let{secretKey:M,publicKey:N,publicKeyUncompressed:D}=n,j=r._lengths;if(!es(T))return;let Y=ct(T,void 0,"key").length,Q=Y===N||Y===D,W=Y===M||!!j?.includes(Y);if(!(Q&&W))return Q}function S(T,M,N=!0){if(m(T)===!0)throw new Error("first arg must be private key");if(m(M)===!1)throw new Error("second arg must be public key");let D=r.fromBytes(T);return e.fromBytes(M).multiply(D).toBytes(N)}let x={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:f},I=el(f,h);return Object.freeze(x),Object.freeze(n),Object.freeze({getPublicKey:h,getSharedSecret:S,keygen:I,Point:e,utils:x,lengths:n})}function fI(e,t,r={}){let i=t;Hh(i),jr(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let n=r.randomBytes===void 0?dr:r.randomBytes,o=r.hmac===void 0?(u,p)=>tI(i,u,p):r.hmac,{Fp:s,Fn:f}=e,{ORDER:h,BITS:m}=f,{keygen:S,getPublicKey:x,getSharedSecret:I,utils:T,lengths:M}=fD(e,r),N={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},D=h*Ni+Vt<s.ORDER;function j(u){let p=h>>Vt;return u>p}function Y(u,p){if(!f.isValidNot0(p))throw new Error(`invalid signature ${u}: out of range 1..Point.Fn.ORDER`);return p}function Q(){if(D)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function W(u,p){Og(p);let b=M.signature,v=p==="compact"?b:p==="recovered"?b+1:void 0;return ct(u,v)}class te{constructor(p,b,v){de(this,"r");de(this,"s");de(this,"recovery");if(this.r=Y("r",p),this.s=Y("s",b),v!=null){if(Q(),![0,1,2,3].includes(v))throw new Error("invalid recovery id");this.recovery=v}Object.freeze(this)}static fromBytes(p,b=N.format){W(p,b);let v;if(b==="der"){let{r:g,s:R}=si.toSig(ct(p));return new te(g,R)}b==="recovered"&&(v=p[0],b="compact",p=p.subarray(1));let c=M.signature/2,w=p.subarray(0,c),A=p.subarray(c,c*2);return new te(f.fromBytes(w),f.fromBytes(A),v)}static fromHex(p,b){return this.fromBytes(da(p),b)}assertRecovery(){let{recovery:p}=this;if(p==null)throw new Error("invalid recovery id: must be present");return p}addRecoveryBit(p){return new te(this.r,this.s,p)}recoverPublicKey(p){let{r:b,s:v}=this,c=this.assertRecovery(),w=c===2||c===3?b+h:b;if(!s.isValid(w))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let A=s.toBytes(w),g=e.fromBytes(st(oI((c&1)===0),A)),R=f.inv(w),U=se(ct(p,void 0,"msgHash")),H=f.create(-U*R),z=f.create(v*R),re=e.BASE.multiplyUnsafe(H).add(g.multiplyUnsafe(z));if(re.is0())throw new Error("invalid recovery: point at infinify");return re.assertValidity(),re}hasHighS(){return j(this.s)}toBytes(p=N.format){if(Og(p),p==="der")return da(si.hexFromSig(this));let{r:b,s:v}=this,c=f.toBytes(b),w=f.toBytes(v);return p==="recovered"?(Q(),st(Uint8Array.of(this.assertRecovery()),c,w)):st(c,w)}toHex(p){return pn(this.toBytes(p))}}Object.freeze(te.prototype),Object.freeze(te);let ne=r.bits2int===void 0?function(p){if(p.length>8192)throw new Error("input is too large");let b=or(p),v=p.length*8-m;return v>0?b>>BigInt(v):b}:r.bits2int,se=r.bits2int_modN===void 0?function(p){return f.create(ne(p))}:r.bits2int_modN,ue=va(m);function be(u){return gg("num < 2^"+m,u,Hr,ue),f.toBytes(u)}function P(u,p){return ct(u,void 0,"message"),p?ct(i(u),void 0,"prehashed message"):u}function l(u,p,b){let{lowS:v,prehash:c,extraEntropy:w}=Ag(b,N);u=P(u,c);let A=se(u),g=f.fromBytes(p);if(!f.isValidNot0(g))throw new Error("invalid private key");let R=[be(g),be(A)];if(w!=null&&w!==!1){let re=w===!0?n(M.secretKey):w;R.push(ct(re,void 0,"extraEntropy"))}let U=st(...R),H=A;function z(re){let oe=ne(re);if(!f.isValidNot0(oe))return;let k=f.inv(oe),L=e.BASE.multiply(oe).toAffine(),F=f.create(L.x);if(F===Hr)return;let V=f.create(k*f.create(H+F*g));if(V===Hr)return;let fe=(L.x===F?0:2)|Number(L.y&Vt),Z=V;return v&&j(V)&&(Z=f.neg(V),fe^=1),new te(F,Z,D?void 0:fe)}return{seed:U,k2sig:z}}function E(u,p,b={}){let{seed:v,k2sig:c}=l(u,p,b);return Ax(i.outputLen,f.BYTES,o)(v,c).toBytes(b.format)}function d(u,p,b,v={}){let{lowS:c,prehash:w,format:A}=Ag(v,N);if(b=ct(b,void 0,"publicKey"),p=P(p,w),!es(u)){let g=u instanceof te?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+g)}W(u,A);try{let g=te.fromBytes(u,A),R=e.fromBytes(b);if(c&&g.hasHighS())return!1;let{r:U,s:H}=g,z=se(p),re=f.inv(H),oe=f.create(z*re),k=f.create(U*re),L=e.BASE.multiplyUnsafe(oe).add(R.multiplyUnsafe(k));return L.is0()?!1:f.create(L.x)===U}catch{return!1}}function a(u,p,b={}){let{prehash:v}=Ag(b,N);return p=P(p,v),te.fromBytes(u,"recovered").recoverPublicKey(p).toBytes()}return Object.freeze({keygen:S,getPublicKey:x,getSharedSecret:I,utils:T,lengths:M,Point:e,sign:E,verify:d,recoverPublicKey:a,Signature:te,hash:i})}var iI,Rg,si,Hr,Vt,Ni,Sa,Tg,uI=br(()=>{y();rI();Kn();is();tl();ba();iI=(e,t)=>(e+(e>=0?t:-t)/Ni)/t;Rg=class extends Error{constructor(t=""){super(t)}},si={Err:Rg,_tlv:{encode:(e,t)=>{let{Err:r}=si;if(Fr(e,"tag"),e<0||e>255)throw new r("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=tu(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let o=i>127?tu(n.length/2|128):"";return tu(e)+o+n+t},decode(e,t){let{Err:r}=si;t=ct(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],o=!!(n&128),s=0;if(!o)s=n;else{let h=n&127;if(!h)throw new r("tlv.decode(long): indefinite length not supported");if(h>4)throw new r("tlv.decode(long): byte length is too big");let m=t.subarray(i,i+h);if(m.length!==h)throw new r("tlv.decode: length bytes not complete");if(m[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let S of m)s=s<<8|S;if(i+=h,s<128)throw new r("tlv.decode(long): not minimal encoding")}let f=t.subarray(i,i+s);if(f.length!==s)throw new r("tlv.decode: wrong value length");return{v:f,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=si;if(Zh(e),e<Hr)throw new t("integer: negative integers are not allowed");let r=tu(e);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=si;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return or(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=si,n=ct(e,void 0,"signature"),{v:o,l:s}=i.decode(48,n);if(s.length)throw new t("invalid signature: left bytes after parsing");let{v:f,l:h}=i.decode(2,o),{v:m,l:S}=i.decode(2,h);if(S.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(f),s:r.decode(m)}},hexFromSig(e){let{_tlv:t,_int:r}=si,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),o=i+n;return t.encode(48,o)}};Object.freeze(si._tlv);Object.freeze(si._int);Object.freeze(si);Hr=BigInt(0),Vt=BigInt(1),Ni=BigInt(2),Sa=BigInt(3),Tg=BigInt(4)});var mI={};bR(mI,{__TEST:()=>dD,schnorr:()=>pD,schnorr_FROST:()=>wD,secp256k1:()=>hD,secp256k1_FROST:()=>yD,secp256k1_hasher:()=>Mg});function cD(e){let t=nl.p,r=BigInt(3),i=BigInt(6),n=BigInt(11),o=BigInt(22),s=BigInt(23),f=BigInt(44),h=BigInt(88),m=e*e*e%t,S=m*m*e%t,x=Sr(S,r,t)*S%t,I=Sr(x,r,t)*S%t,T=Sr(I,Bg,t)*m%t,M=Sr(T,n,t)*T%t,N=Sr(M,o,t)*M%t,D=Sr(N,f,t)*N%t,j=Sr(D,h,t)*D%t,Y=Sr(j,f,t)*N%t,Q=Sr(Y,r,t)*S%t,W=Sr(Q,s,t)*M%t,te=Sr(W,i,t)*m%t,ne=Sr(te,Bg,t);if(!gn.eql(gn.sqr(ne),e))throw new Error("Cannot find square root");return ne}function nu(e,...t){let r=cI[e];if(r===void 0){let i=Qo(ga(e));r=st(i,i),cI[e]=r}return Qo(st(r,...t))}function pI(e){let{Fn:t,BASE:r}=lt,i=t.fromBytes(e),n=r.multiply(i);return{scalar:Ci(n.y)?i:t.neg(i),bytes:us(n)}}function ol(e){let t=gn;if(!t.isValidNot0(e))throw new Error("invalid x: Fail if x \u2265 p");let r=t.create(e*e),i=t.create(r*e+BigInt(7)),n=t.sqrt(i);Ci(n)||(n=t.neg(n));let o=lt.fromAffine({x:e,y:n});return o.assertValidity(),o}function Pg(...e){return lt.Fn.create(Ea(nu("BIP0340/challenge",...e)))}function hI(e){return pI(e).bytes}function lD(e,t,r=eu(32)){let{Fn:i,BASE:n}=lt,o=ct(e,void 0,"message"),{bytes:s,scalar:f}=pI(t),h=ct(r,32,"auxRand"),m=i.toBytes(f^Ea(nu("BIP0340/aux",h))),S=nu("BIP0340/nonce",m,s,o),x=i.create(Ea(S));if(x===0n)throw new Error("sign failed: k is zero");let I=n.multiply(x),T=Ci(I.y)?x:i.neg(x),M=us(I),N=Pg(M,s,o),D=new Uint8Array(64);if(D.set(M,0),D.set(i.toBytes(i.create(T+N*f)),32),!gI(D,o,s))throw new Error("sign: Invalid signature produced");return D}function gI(e,t,r){let{Fp:i,Fn:n,BASE:o}=lt,s=ct(e,64,"signature"),f=ct(t,void 0,"message"),h=ct(r,32,"publicKey");try{let m=ol(Ea(h)),S=Ea(s.subarray(0,32));if(!i.isValidNot0(S))return!1;let x=Ea(s.subarray(32,64));if(!n.isValidNot0(x))return!1;let I=Pg(n.toBytes(S),us(m),f),T=o.multiplyUnsafe(x).add(m.multiplyUnsafe(n.neg(I))),{x:M,y:N}=T.toAffine();return!(T.is0()||!Ci(N)||M!==S)}catch{return!1}}function vI(e,t){if(t===void 0)return dI;let r=us(e),i=or(nu("TapTweak",r,t));if(!lt.Fn.isValid(i))throw new Error("invalid TapTweak hash");return i}function kg(e){let t=lt.fromBytes(e.commitments[0]);return Ci(t.y)?e:{signers:{min:e.signers.min,max:e.signers.max},commitments:e.commitments.map(r=>lt.fromBytes(r).negate().toBytes()),verifyingShares:Object.fromEntries(Object.entries(e.verifyingShares).map(([r,i])=>[r,lt.fromBytes(i).negate().toBytes()]))}}function yI(e,t){let r=lt.fromBytes(t.commitments[0]);if(Ci(r.y))return e;let i=lt.Fn;return{...e,signingShare:i.toBytes(i.neg(i.fromBytes(e.signingShare)))}}function mD(e,t){if(Ci(e.y))return t;let r=lt.Fn;return{binding:r.toBytes(r.neg(r.fromBytes(t.binding))),hiding:r.toBytes(r.neg(r.fromBytes(t.hiding)))}}function bD(e,t,r){let i=lt.Fn,n=yI(e,t),o=kg(t),s=vI(lt.fromBytes(o.commitments[0]),r),f=i.toBytes(i.add(i.fromBytes(n.signingShare),s));return{identifier:n.identifier,signingShare:f}}function _D(e,t){let r=kg(e),i=vI(lt.fromBytes(r.commitments[0]),t),n=lt.BASE.multiply(i),o=r.commitments.map((f,h)=>(h===0?lt.fromBytes(f).add(n):lt.fromBytes(f)).toBytes()),s={};for(let f in r.verifyingShares)s[f]=lt.fromBytes(r.verifyingShares[f]).add(n).toBytes();return{signers:{min:r.signers.min,max:r.signers.max},commitments:o,verifyingShares:s}}var nl,uD,dI,Bg,gn,lt,hD,cI,us,Ci,Ea,dD,pD,gD,lI,vD,Mg,yD,wD,bI=br(()=>{y();xx();Kn();tl();eI();Jx();ba();uI();is();nl={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},uD={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},dI=BigInt(0),Bg=BigInt(2);gn=ya(nl.p,{sqrt:cD}),lt=nI(nl,{Fp:gn,endo:uD}),hD=fI(lt,Qo),cI={};us=e=>e.toBytes(!0).slice(1),Ci=e=>e%Bg===dI;Ea=or;dD=Object.freeze({lift_x:ol}),pD=(()=>{let r=i=>(i=i===void 0?eu(48):i,ma(i,nl.n));return Object.freeze({keygen:el(r,hI),getPublicKey:hI,sign:lD,verify:gI,Point:lt,utils:Object.freeze({randomSecretKey:r,taggedHash:nu,lift_x:ol,pointToBytes:us}),lengths:Object.freeze({secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:64,seed:48})})})(),gD=$x(gn,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(e=>e.map(t=>BigInt(t)))),vD=()=>lI||(lI=sI(gn,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:gn.create(BigInt("-11"))})),Mg=Xx(lt,e=>{let{x:t,y:r}=vD()(gn.create(e[0]));return gD(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:gn.ORDER,m:1,k:128,expand:"xmd",hash:Qo}),yD=Ig({name:"FROST-secp256k1-SHA256-v1",Point:lt,hashToScalar:Mg.hashToScalar,hash:Qo});wD=Ig({name:"FROST-secp256k1-SHA256-TR-v1",Point:lt,hashToScalar:Mg.hashToScalar,hash:Qo,parsePublicKey(e){if(e.length===32)return ol(or(e));if(e.length===33)return lt.fromBytes(e);throw new Error(`expected x-only or compressed public key, got length=${e.length}`)},adjustScalar(e){let t=lt.BASE.multiply(e);return Ci(t.y)?e:lt.Fn.neg(e)},adjustPoint:e=>Ci(e.y)?e:e.negate(),challenge(e,t,r){return Pg(us(e),us(t),r)},adjustNonces:mD,adjustGroupCommitmentShare:(e,t)=>Ci(e.y)?t:t.negate(),adjustPublic:kg,adjustSecret:yI,adjustTx:{encode:e=>e.subarray(1),decode:e=>st(Uint8Array.of(2),e)},adjustDKG:e=>{let t=new Uint8Array(0);return{public:_D(e.public,t),secret:bD(e.secret,e.public,t)}}})});var Gn=B((uZ,EI)=>{"use strict";y();var _I=Ur(),{secp256k1:SD}=(bI(),_R(mI)),su=SD.Point,sl=su.Fn.ORDER;function ED(e){return BigInt("0x"+(e.toString(16)||"0"))}function Ng(e){var t=e.toString(16);return t.length%2&&(t="0"+t),new _I(t,16)}function al(e){if(e==null)throw new Error("Invalid Point");if(typeof e=="bigint")return e;if(typeof e=="number")return BigInt(e);if(typeof e=="string")return BigInt(e.indexOf("0x")===0?e:"0x"+e);if(typeof e.toString=="function")return ED(e);throw new Error("Invalid Point")}function ou(e){var t=Object.create(dt.prototype);return t._p=e,t}function wI(e,t){var r=al(t).toString(16).padStart(64,"0");return su.fromHex((e?"03":"02")+r)}function SI(e,t){var r;try{r=wI((t&1n)===1n,e)}catch{throw new Error("Point does not lie on the curve")}if(r.toAffine().y!==t)throw new Error("Invalid y value for curve.")}function dt(e,t,r){if(!(this instanceof dt))return new dt(e,t,r);var i,n;try{i=al(e),n=al(t)}catch{throw new Error("Invalid Point")}SI(i,n);try{this._p=su.fromAffine({x:i,y:n})}catch{throw new Error("Invalid Point")}return this}dt.fromX=function(t,r){try{var i=ou(wI(t,r))}catch{throw new Error("Invalid X")}return i.validate(),i};dt.getG=function(){return ou(su.BASE)};dt.getN=function(){return Ng(sl)};dt.prototype.getX=function(){return Ng(this._p.toAffine().x)};dt.prototype.getY=function(){return Ng(this._p.toAffine().y)};Object.defineProperty(dt.prototype,"x",{configurable:!0,enumerable:!0,get:function(){return this.getX()}});Object.defineProperty(dt.prototype,"y",{configurable:!0,enumerable:!0,get:function(){return this.getY()}});dt.prototype.mul=function(t){var r=(al(t)%sl+sl)%sl;return r===0n||this._p.is0()?ou(su.ZERO):ou(this._p.multiply(r))};dt.prototype.add=function(t){return ou(this._p.add(t._p))};dt.prototype.mulAdd=function(t,r,i){return this.mul(t).add(r.mul(i))};dt.prototype.eq=function(t){return this._p.equals(t._p)};dt.prototype.isInfinity=function(){return this._p.is0()};dt.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");var t=this._p.toAffine();return SI(t.x,t.y),this};dt.pointToCompressed=function(t){var r=t.getX().toBuffer({size:32}),i=t.getY().toBuffer({size:32}),n,o=i[i.length-1]%2;return o?n=_.Buffer.from([3]):n=_.Buffer.from([2]),_.Buffer.concat([n,r])};dt.pointFromCompressed=function(e){if(e.length!==33)throw new Error("invalid buffer length");var t=e[0],r;if(t===3)r=!0;else if(t===2)r=!1;else throw new Error("invalid value of compressed prefix");var i=_I.fromBuffer(e.slice(1,33));return dt.fromX(r,i)};dt.prototype.toBuffer=function(){return dt.pointToCompressed(this)};dt.prototype.toHex=function(){return this.toBuffer().toString("hex")};dt.fromBuffer=function(e){return dt.pointFromCompressed(e)};dt.fromHex=function(e){return dt.fromBuffer(_.Buffer.from(e,"hex"))};EI.exports=dt});var ai=B(pt=>{"use strict";y();var xD=Xr(),ID=we();pt.inherits=ID;function AD(e,t){return(e.charCodeAt(t)&64512)!==55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)===56320}function OD(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for(e=e.replace(/[^a-z0-9]+/ig,""),e.length%2!==0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var o=e.charCodeAt(n);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=o&63|128):AD(e,n)?(o=65536+((o&1023)<<10)+(e.charCodeAt(++n)&1023),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=o&63|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=o&63|128)}else for(n=0;n<e.length;n++)r[n]=e[n]|0;return r}pt.toArray=OD;function RD(e){for(var t="",r=0;r<e.length;r++)t+=II(e[r].toString(16));return t}pt.toHex=RD;function xI(e){var t=e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24;return t>>>0}pt.htonl=xI;function TD(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];t==="little"&&(n=xI(n)),r+=AI(n.toString(16))}return r}pt.toHex32=TD;function II(e){return e.length===1?"0"+e:e}pt.zero2=II;function AI(e){return e.length===7?"0"+e:e.length===6?"00"+e:e.length===5?"000"+e:e.length===4?"0000"+e:e.length===3?"00000"+e:e.length===2?"000000"+e:e.length===1?"0000000"+e:e}pt.zero8=AI;function BD(e,t,r,i){var n=r-t;xD(n%4===0);for(var o=new Array(n/4),s=0,f=t;s<o.length;s++,f+=4){var h;i==="big"?h=e[f]<<24|e[f+1]<<16|e[f+2]<<8|e[f+3]:h=e[f+3]<<24|e[f+2]<<16|e[f+1]<<8|e[f],o[s]=h>>>0}return o}pt.join32=BD;function PD(e,t){for(var r=new Array(e.length*4),i=0,n=0;i<e.length;i++,n+=4){var o=e[i];t==="big"?(r[n]=o>>>24,r[n+1]=o>>>16&255,r[n+2]=o>>>8&255,r[n+3]=o&255):(r[n+3]=o>>>24,r[n+2]=o>>>16&255,r[n+1]=o>>>8&255,r[n]=o&255)}return r}pt.split32=PD;function MD(e,t){return e>>>t|e<<32-t}pt.rotr32=MD;function kD(e,t){return e<<t|e>>>32-t}pt.rotl32=kD;function ND(e,t){return e+t>>>0}pt.sum32=ND;function CD(e,t,r){return e+t+r>>>0}pt.sum32_3=CD;function DD(e,t,r,i){return e+t+r+i>>>0}pt.sum32_4=DD;function qD(e,t,r,i,n){return e+t+r+i+n>>>0}pt.sum32_5=qD;function LD(e,t,r,i){var n=e[t],o=e[t+1],s=i+o>>>0,f=(s<i?1:0)+r+n;e[t]=f>>>0,e[t+1]=s}pt.sum64=LD;function UD(e,t,r,i){var n=t+i>>>0,o=(n<t?1:0)+e+r;return o>>>0}pt.sum64_hi=UD;function FD(e,t,r,i){var n=t+i;return n>>>0}pt.sum64_lo=FD;function jD(e,t,r,i,n,o,s,f){var h=0,m=t;m=m+i>>>0,h+=m<t?1:0,m=m+o>>>0,h+=m<o?1:0,m=m+f>>>0,h+=m<f?1:0;var S=e+r+n+s+h;return S>>>0}pt.sum64_4_hi=jD;function HD(e,t,r,i,n,o,s,f){var h=t+i+o+f;return h>>>0}pt.sum64_4_lo=HD;function KD(e,t,r,i,n,o,s,f,h,m){var S=0,x=t;x=x+i>>>0,S+=x<t?1:0,x=x+o>>>0,S+=x<o?1:0,x=x+f>>>0,S+=x<f?1:0,x=x+m>>>0,S+=x<m?1:0;var I=e+r+n+s+h+S;return I>>>0}pt.sum64_5_hi=KD;function VD(e,t,r,i,n,o,s,f,h,m){var S=t+i+o+f+m;return S>>>0}pt.sum64_5_lo=VD;function GD(e,t,r){var i=t<<32-r|e>>>r;return i>>>0}pt.rotr64_hi=GD;function zD(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}pt.rotr64_lo=zD;function WD(e,t,r){return e>>>r}pt.shr64_hi=WD;function YD(e,t,r){var i=e<<32-r|t>>>r;return i>>>0}pt.shr64_lo=YD});var xa=B(RI=>{"use strict";y();var OI=ai(),ZD=Xr();function fl(){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}RI.BlockHash=fl;fl.prototype.update=function(t,r){if(t=OI.toArray(t,r),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var i=t.length%this._delta8;this.pending=t.slice(t.length-i,t.length),this.pending.length===0&&(this.pending=null),t=OI.join32(t,0,t.length-i,this.endian);for(var n=0;n<t.length;n+=this._delta32)this._update(t,n,n+this._delta32)}return this};fl.prototype.digest=function(t){return this.update(this._pad()),ZD(this.pending===null),this._digest(t)};fl.prototype._pad=function(){var t=this.pendingTotal,r=this._delta8,i=r-(t+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var o=1;o<i;o++)n[o]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)n[o++]=0;n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=t>>>24&255,n[o++]=t>>>16&255,n[o++]=t>>>8&255,n[o++]=t&255}else for(n[o++]=t&255,n[o++]=t>>>8&255,n[o++]=t>>>16&255,n[o++]=t>>>24&255,n[o++]=0,n[o++]=0,n[o++]=0,n[o++]=0,s=8;s<this.padLength;s++)n[o++]=0;return n}});var Cg=B(vn=>{"use strict";y();var $D=ai(),Di=$D.rotr32;function XD(e,t,r,i){if(e===0)return TI(t,r,i);if(e===1||e===3)return PI(t,r,i);if(e===2)return BI(t,r,i)}vn.ft_1=XD;function TI(e,t,r){return e&t^~e&r}vn.ch32=TI;function BI(e,t,r){return e&t^e&r^t&r}vn.maj32=BI;function PI(e,t,r){return e^t^r}vn.p32=PI;function JD(e){return Di(e,2)^Di(e,13)^Di(e,22)}vn.s0_256=JD;function QD(e){return Di(e,6)^Di(e,11)^Di(e,25)}vn.s1_256=QD;function eq(e){return Di(e,7)^Di(e,18)^e>>>3}vn.g0_256=eq;function tq(e){return Di(e,17)^Di(e,19)^e>>>10}vn.g1_256=tq});var NI=B((yZ,kI)=>{"use strict";y();var Ia=ai(),rq=xa(),iq=Cg(),Dg=Ia.rotl32,au=Ia.sum32,nq=Ia.sum32_5,oq=iq.ft_1,MI=rq.BlockHash,sq=[1518500249,1859775393,2400959708,3395469782];function qi(){if(!(this instanceof qi))return new qi;MI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ia.inherits(qi,MI);kI.exports=qi;qi.blockSize=512;qi.outSize=160;qi.hmacStrength=80;qi.padLength=64;qi.prototype._update=function(t,r){for(var i=this.W,n=0;n<16;n++)i[n]=t[r+n];for(;n<i.length;n++)i[n]=Dg(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var o=this.h[0],s=this.h[1],f=this.h[2],h=this.h[3],m=this.h[4];for(n=0;n<i.length;n++){var S=~~(n/20),x=nq(Dg(o,5),oq(S,s,f,h),m,i[n],sq[S]);m=h,h=f,f=Dg(s,30),s=o,o=x}this.h[0]=au(this.h[0],o),this.h[1]=au(this.h[1],s),this.h[2]=au(this.h[2],f),this.h[3]=au(this.h[3],h),this.h[4]=au(this.h[4],m)};qi.prototype._digest=function(t){return t==="hex"?Ia.toHex32(this.h,"big"):Ia.split32(this.h,"big")}});var qg=B((bZ,DI)=>{"use strict";y();var Aa=ai(),aq=xa(),Oa=Cg(),fq=Xr(),fi=Aa.sum32,uq=Aa.sum32_4,cq=Aa.sum32_5,hq=Oa.ch32,lq=Oa.maj32,dq=Oa.s0_256,pq=Oa.s1_256,gq=Oa.g0_256,vq=Oa.g1_256,CI=aq.BlockHash,yq=[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 Li(){if(!(this instanceof Li))return new Li;CI.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=yq,this.W=new Array(64)}Aa.inherits(Li,CI);DI.exports=Li;Li.blockSize=512;Li.outSize=256;Li.hmacStrength=192;Li.padLength=64;Li.prototype._update=function(t,r){for(var i=this.W,n=0;n<16;n++)i[n]=t[r+n];for(;n<i.length;n++)i[n]=uq(vq(i[n-2]),i[n-7],gq(i[n-15]),i[n-16]);var o=this.h[0],s=this.h[1],f=this.h[2],h=this.h[3],m=this.h[4],S=this.h[5],x=this.h[6],I=this.h[7];for(fq(this.k.length===i.length),n=0;n<i.length;n++){var T=cq(I,pq(m),hq(m,S,x),this.k[n],i[n]),M=fi(dq(o),lq(o,s,f));I=x,x=S,S=m,m=fi(h,T),h=f,f=s,s=o,o=fi(T,M)}this.h[0]=fi(this.h[0],o),this.h[1]=fi(this.h[1],s),this.h[2]=fi(this.h[2],f),this.h[3]=fi(this.h[3],h),this.h[4]=fi(this.h[4],m),this.h[5]=fi(this.h[5],S),this.h[6]=fi(this.h[6],x),this.h[7]=fi(this.h[7],I)};Li.prototype._digest=function(t){return t==="hex"?Aa.toHex32(this.h,"big"):Aa.split32(this.h,"big")}});var UI=B((wZ,LI)=>{"use strict";y();var Lg=ai(),qI=qg();function yn(){if(!(this instanceof yn))return new yn;qI.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Lg.inherits(yn,qI);LI.exports=yn;yn.blockSize=512;yn.outSize=224;yn.hmacStrength=192;yn.padLength=64;yn.prototype._digest=function(t){return t==="hex"?Lg.toHex32(this.h.slice(0,7),"big"):Lg.split32(this.h.slice(0,7),"big")}});var jg=B((EZ,KI)=>{"use strict";y();var pr=ai(),mq=xa(),bq=Xr(),Ui=pr.rotr64_hi,Fi=pr.rotr64_lo,FI=pr.shr64_hi,jI=pr.shr64_lo,zn=pr.sum64,Ug=pr.sum64_hi,Fg=pr.sum64_lo,_q=pr.sum64_4_hi,wq=pr.sum64_4_lo,Sq=pr.sum64_5_hi,Eq=pr.sum64_5_lo,HI=mq.BlockHash,xq=[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 ui(){if(!(this instanceof ui))return new ui;HI.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=xq,this.W=new Array(160)}pr.inherits(ui,HI);KI.exports=ui;ui.blockSize=1024;ui.outSize=512;ui.hmacStrength=192;ui.padLength=128;ui.prototype._prepareBlock=function(t,r){for(var i=this.W,n=0;n<32;n++)i[n]=t[r+n];for(;n<i.length;n+=2){var o=Cq(i[n-4],i[n-3]),s=Dq(i[n-4],i[n-3]),f=i[n-14],h=i[n-13],m=kq(i[n-30],i[n-29]),S=Nq(i[n-30],i[n-29]),x=i[n-32],I=i[n-31];i[n]=_q(o,s,f,h,m,S,x,I),i[n+1]=wq(o,s,f,h,m,S,x,I)}};ui.prototype._update=function(t,r){this._prepareBlock(t,r);var i=this.W,n=this.h[0],o=this.h[1],s=this.h[2],f=this.h[3],h=this.h[4],m=this.h[5],S=this.h[6],x=this.h[7],I=this.h[8],T=this.h[9],M=this.h[10],N=this.h[11],D=this.h[12],j=this.h[13],Y=this.h[14],Q=this.h[15];bq(this.k.length===i.length);for(var W=0;W<i.length;W+=2){var te=Y,ne=Q,se=Pq(I,T),ue=Mq(I,T),be=Iq(I,T,M,N,D,j),P=Aq(I,T,M,N,D,j),l=this.k[W],E=this.k[W+1],d=i[W],a=i[W+1],u=Sq(te,ne,se,ue,be,P,l,E,d,a),p=Eq(te,ne,se,ue,be,P,l,E,d,a);te=Tq(n,o),ne=Bq(n,o),se=Oq(n,o,s,f,h,m),ue=Rq(n,o,s,f,h,m);var b=Ug(te,ne,se,ue),v=Fg(te,ne,se,ue);Y=D,Q=j,D=M,j=N,M=I,N=T,I=Ug(S,x,u,p),T=Fg(x,x,u,p),S=h,x=m,h=s,m=f,s=n,f=o,n=Ug(u,p,b,v),o=Fg(u,p,b,v)}zn(this.h,0,n,o),zn(this.h,2,s,f),zn(this.h,4,h,m),zn(this.h,6,S,x),zn(this.h,8,I,T),zn(this.h,10,M,N),zn(this.h,12,D,j),zn(this.h,14,Y,Q)};ui.prototype._digest=function(t){return t==="hex"?pr.toHex32(this.h,"big"):pr.split32(this.h,"big")};function Iq(e,t,r,i,n){var o=e&r^~e&n;return o<0&&(o+=4294967296),o}function Aq(e,t,r,i,n,o){var s=t&i^~t&o;return s<0&&(s+=4294967296),s}function Oq(e,t,r,i,n){var o=e&r^e&n^r&n;return o<0&&(o+=4294967296),o}function Rq(e,t,r,i,n,o){var s=t&i^t&o^i&o;return s<0&&(s+=4294967296),s}function Tq(e,t){var r=Ui(e,t,28),i=Ui(t,e,2),n=Ui(t,e,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Bq(e,t){var r=Fi(e,t,28),i=Fi(t,e,2),n=Fi(t,e,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Pq(e,t){var r=Ui(e,t,14),i=Ui(e,t,18),n=Ui(t,e,9),o=r^i^n;return o<0&&(o+=4294967296),o}function Mq(e,t){var r=Fi(e,t,14),i=Fi(e,t,18),n=Fi(t,e,9),o=r^i^n;return o<0&&(o+=4294967296),o}function kq(e,t){var r=Ui(e,t,1),i=Ui(e,t,8),n=FI(e,t,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Nq(e,t){var r=Fi(e,t,1),i=Fi(e,t,8),n=jI(e,t,7),o=r^i^n;return o<0&&(o+=4294967296),o}function Cq(e,t){var r=Ui(e,t,19),i=Ui(t,e,29),n=FI(e,t,6),o=r^i^n;return o<0&&(o+=4294967296),o}function Dq(e,t){var r=Fi(e,t,19),i=Fi(t,e,29),n=jI(e,t,6),o=r^i^n;return o<0&&(o+=4294967296),o}});var zI=B((IZ,GI)=>{"use strict";y();var Hg=ai(),VI=jg();function mn(){if(!(this instanceof mn))return new mn;VI.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Hg.inherits(mn,VI);GI.exports=mn;mn.blockSize=1024;mn.outSize=384;mn.hmacStrength=192;mn.padLength=128;mn.prototype._digest=function(t){return t==="hex"?Hg.toHex32(this.h.slice(0,12),"big"):Hg.split32(this.h.slice(0,12),"big")}});var WI=B(Ra=>{"use strict";y();Ra.sha1=NI();Ra.sha224=UI();Ra.sha256=qg();Ra.sha384=zI();Ra.sha512=jg()});var QI=B(JI=>{"use strict";y();var cs=ai(),qq=xa(),ul=cs.rotl32,YI=cs.sum32,fu=cs.sum32_3,ZI=cs.sum32_4,XI=qq.BlockHash;function ji(){if(!(this instanceof ji))return new ji;XI.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}cs.inherits(ji,XI);JI.ripemd160=ji;ji.blockSize=512;ji.outSize=160;ji.hmacStrength=192;ji.padLength=64;ji.prototype._update=function(t,r){for(var i=this.h[0],n=this.h[1],o=this.h[2],s=this.h[3],f=this.h[4],h=i,m=n,S=o,x=s,I=f,T=0;T<80;T++){var M=YI(ul(ZI(i,$I(T,n,o,s),t[Fq[T]+r],Lq(T)),Hq[T]),f);i=f,f=s,s=ul(o,10),o=n,n=M,M=YI(ul(ZI(h,$I(79-T,m,S,x),t[jq[T]+r],Uq(T)),Kq[T]),I),h=I,I=x,x=ul(S,10),S=m,m=M}M=fu(this.h[1],o,x),this.h[1]=fu(this.h[2],s,I),this.h[2]=fu(this.h[3],f,h),this.h[3]=fu(this.h[4],i,m),this.h[4]=fu(this.h[0],n,S),this.h[0]=M};ji.prototype._digest=function(t){return t==="hex"?cs.toHex32(this.h,"little"):cs.split32(this.h,"little")};function $I(e,t,r,i){return e<=15?t^r^i:e<=31?t&r|~t&i:e<=47?(t|~r)^i:e<=63?t&i|r&~i:t^(r|~i)}function Lq(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function Uq(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var Fq=[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],jq=[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],Hq=[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],Kq=[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 tA=B((PZ,eA)=>{"use strict";y();var Vq=ai(),Gq=Xr();function Ta(e,t,r){if(!(this instanceof Ta))return new Ta(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Vq.toArray(t,r))}eA.exports=Ta;Ta.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),Gq(t.length<=this.blockSize);for(var r=t.length;r<this.blockSize;r++)t.push(0);for(r=0;r<t.length;r++)t[r]^=54;for(this.inner=new this.Hash().update(t),r=0;r<t.length;r++)t[r]^=106;this.outer=new this.Hash().update(t)};Ta.prototype.update=function(t,r){return this.inner.update(t,r),this};Ta.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}});var iA=B(rA=>{y();var $t=rA;$t.utils=ai();$t.common=xa();$t.sha=WI();$t.ripemd=QI();$t.hmac=tA();$t.sha1=$t.sha.sha1;$t.sha256=$t.sha.sha256;$t.sha224=$t.sha.sha224;$t.sha384=$t.sha.sha384;$t.sha512=$t.sha.sha512;$t.ripemd160=$t.ripemd.ripemd160});var oA=B((CZ,nA)=>{"use strict";y();var cl=iA(),bn=at(),kt=nA.exports;kt.sha1=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha1().update(e).digest("hex"),"hex")};kt.sha1.blocksize=512;kt.sha256=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha256().update(e).digest("hex"),"hex")};kt.sha256.blocksize=512;kt.sha256sha256=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),kt.sha256(kt.sha256(e))};kt.ripemd160=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.ripemd160().update(e).digest("hex"),"hex")};kt.sha256ripemd160=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),kt.ripemd160(kt.sha256(e))};kt.sha512=function(e){return bn.checkArgument(_.Buffer.isBuffer(e)),_.Buffer.from(cl.sha512().update(e).digest("hex"),"hex")};kt.sha512.blocksize=1024;kt.hmac=function(e,t,r){bn.checkArgument(_.Buffer.isBuffer(t)),bn.checkArgument(_.Buffer.isBuffer(r)),bn.checkArgument(e.blocksize);var i=e.blocksize/8;if(r.length>i)r=e(r);else if(r.length<i){var n=_.Buffer.alloc(i);n.fill(0),r.copy(n),r=n}var o=_.Buffer.alloc(i);o.fill(92);var s=_.Buffer.alloc(i);s.fill(54);for(var f=_.Buffer.alloc(i),h=_.Buffer.alloc(i),m=0;m<i;m++)f[m]=o[m]^r[m],h[m]=s[m]^r[m];return e(_.Buffer.concat([f,e(_.Buffer.concat([h,t]))]))};kt.sha256hmac=function(e,t){return kt.hmac(kt.sha256,e,t)};kt.sha512hmac=function(e,t){return kt.hmac(kt.sha512,e,t)}});var aA=B((qZ,sA)=>{"use strict";y();var hl=Ph(),_n=at(),Nt=sA.exports;Nt.sha1=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha1").update(e).digest()};Nt.sha1.blocksize=512;Nt.sha256=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha256").update(e).digest()};Nt.sha256.blocksize=512;Nt.sha256sha256=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),Nt.sha256(Nt.sha256(e))};Nt.ripemd160=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("ripemd160").update(e).digest()};Nt.sha256ripemd160=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),Nt.ripemd160(Nt.sha256(e))};Nt.sha512=function(e){return _n.checkArgument(_.Buffer.isBuffer(e)),hl.createHash("sha512").update(e).digest()};Nt.sha512.blocksize=1024;Nt.hmac=function(e,t,r){_n.checkArgument(_.Buffer.isBuffer(t)),_n.checkArgument(_.Buffer.isBuffer(r)),_n.checkArgument(e.blocksize);var i=e.blocksize/8;if(r.length>i)r=e(r);else if(r.length<i){var n=_.Buffer.alloc(i);n.fill(0),r.copy(n),r=n}var o=_.Buffer.alloc(i);o.fill(92);var s=_.Buffer.alloc(i);s.fill(54);for(var f=_.Buffer.alloc(i),h=_.Buffer.alloc(i),m=0;m<i;m++)f[m]=o[m]^r[m],h[m]=s[m]^r[m];return e(_.Buffer.concat([f,e(_.Buffer.concat([h,t]))]))};Nt.sha256hmac=function(e,t){return Nt.hmac(Nt.sha256,e,t)};Nt.sha512hmac=function(e,t){return Nt.hmac(Nt.sha512,e,t)}});var ir=B((UZ,Kg)=>{y();O.default.browser?Kg.exports=oA():Kg.exports=aA()});var Er=B((jZ,cA)=>{"use strict";y();var uA=mt(),zq=at(),fA=function(t){return uA.isString(t)?/^[0-9a-fA-F]+$/.test(t):!1};cA.exports={isValidJSON:function(t){var r;if(!uA.isString(t))return!1;try{r=JSON.parse(t)}catch{return!1}return typeof r=="object"},isHexa:fA,isHexaString:fA,defineImmutable:function(t,r){return Object.keys(r).forEach(function(i){Object.defineProperty(t,i,{configurable:!1,enumerable:!0,value:r[i]})}),t},isNaturalNumber:function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t&&t>=0},integerAsBuffer:function(t){zq.checkArgumentType(t,"number","integer");let r=_.Buffer.allocUnsafe(4);return r.writeUInt32BE(t,0),r}}});var du=B((KZ,dA)=>{"use strict";y();var wn=mt(),uu=Er(),hs=[],cu={};function hA(){}hA.prototype.toString=function(){return this.name};function hu(e,t){if(~hs.indexOf(e))return e;if(t){wn.isArray(t)||(t=[t]);for(var r=0;r<hs.length;r++){var i=hs[r],n=wn.pick(i,t),o=wn.values(n);if(~o.indexOf(e))return i}return}return cu[e]}function ll(e){for(var t=[],r=0;r<e.length;r++)t.push(e.charCodeAt(r)&31);return t}function lu(e){var t=new hA;uu.defineImmutable(t,{name:e.name,alias:e.alias,pubkeyhash:e.pubkeyhash,privatekey:e.privatekey,scripthash:e.scripthash,xpubkey:e.xpubkey,xprivkey:e.xprivkey});var r=e.indexBy||Object.keys(e);return e.cashAddrPrefix&&wn.extend(t,{cashAddrPrefix:e.cashAddrPrefix,cashAddrPrefixArray:ll(e.cashAddrPrefix)}),e.networkMagic&&wn.extend(t,{networkMagic:uu.integerAsBuffer(e.networkMagic)}),e.port&&wn.extend(t,{port:e.port}),e.dnsSeeds&&wn.extend(t,{dnsSeeds:e.dnsSeeds}),hs.push(t),Wq(t,r),t}function Wq(e,t){for(var r=0;r<t.length;r++){var i=t[r],n=e[i];!wn.isUndefined(n)&&!wn.isObject(n)&&(cu[n]=e)}}function Yq(e,t){for(var r=0;r<t.length;r++){var i=t[r];cu[i]===e&&delete cu[i]}}function Zq(e){for(var t=0;t<hs.length;t++)hs[t]===e&&hs.splice(t,1);Yq(e,Object.keys(cu))}var dl={livenet:3823236072,testnet:4108710900,regtest:3669344250,stn:4224632057},lA=["seed.bitcoinsv.org","seed.bitcoinunlimited.info"],Wn={PORT:18333,NETWORK_MAGIC:dl.testnet,DNS_SEEDS:lA,PREFIX:"testnet",CASHADDRPREFIX:"bchtest"},Sn={PORT:18444,NETWORK_MAGIC:dl.regtest,DNS_SEEDS:[],PREFIX:"regtest",CASHADDRPREFIX:"bchreg"},Yn={PORT:9333,NETWORK_MAGIC:dl.stn,DNS_SEEDS:["stn-seed.bitcoinsv.io"],PREFIX:"stn",CASHADDRPREFIX:"bsvstn"},$q={name:"livenet",alias:"mainnet",prefix:"bitcoin",cashAddrPrefix:"bitcoincash",pubkeyhash:0,privatekey:128,scripthash:5,xpubkey:76067358,xprivkey:76066276,networkMagic:dl.livenet,port:8333,dnsSeeds:lA},Xq={name:"testnet",prefix:Wn.PREFIX,cashAddrPrefix:Wn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Wn.NETWORK_MAGIC},Jq={name:"regtest",prefix:Sn.PREFIX,cashAddrPrefix:Sn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Sn.NETWORK_MAGIC,port:Sn.PORT,dnsSeeds:[],indexBy:["port","name","cashAddrPrefix","networkMagic"]},Qq={name:"stn",prefix:Yn.PREFIX,cashAddrPrefix:Yn.CASHADDRPREFIX,pubkeyhash:111,privatekey:239,scripthash:196,xpubkey:70617039,xprivkey:70615956,networkMagic:Yn.NETWORK_MAGIC,indexBy:["port","name","cashAddrPrefix","networkMagic"]};lu(Xq);lu(Qq);lu(Jq);lu($q);var Vg=hu("livenet"),e9=hu("regtest"),Hi=hu("testnet"),t9=hu("stn");Object.defineProperty(Hi,"port",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.PORT:this.stnEnabled?Yn.PORT:Wn.PORT}});Object.defineProperty(Hi,"networkMagic",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?uu.integerAsBuffer(Sn.NETWORK_MAGIC):this.stnEnabled?uu.integerAsBuffer(Yn.NETWORK_MAGIC):uu.integerAsBuffer(Wn.NETWORK_MAGIC)}});Object.defineProperty(Hi,"dnsSeeds",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.DNS_SEEDS:this.stnEnabled?Yn.DNS_SEEDS:Wn.DNS_SEEDS}});Object.defineProperty(Hi,"cashAddrPrefix",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?Sn.CASHADDRPREFIX:this.stnEnabled?Yn.CASHADDRPREFIX:Wn.CASHADDRPREFIX}});Object.defineProperty(Hi,"cashAddrPrefixArray",{enumerable:!0,configurable:!1,get:function(){return this.regtestEnabled?ll(Sn.CASHADDRPREFIX):this.stnEnabled?ll(Yn.CASHADDRPREFIX):ll(Wn.CASHADDRPREFIX)}});function r9(){Hi.regtestEnabled=!0}function i9(){Hi.regtestEnabled=!1}function n9(){Hi.stnEnabled=!0}function o9(){Hi.stnEnabled=!1}dA.exports={add:lu,remove:Zq,defaultNetwork:Vg,livenet:Vg,mainnet:Vg,testnet:Hi,regtest:e9,stn:t9,get:hu,enableRegtest:r9,disableRegtest:i9,enableStn:n9,disableStn:o9}});var gA=B((GZ,pA)=>{"use strict";y();var pl=We().Buffer;function s9(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var n=e.charAt(i),o=n.charCodeAt(0);if(t[o]!==255)throw new TypeError(n+" is ambiguous");t[o]=i}var s=e.length,f=e.charAt(0),h=Math.log(s)/Math.log(256),m=Math.log(256)/Math.log(s);function S(T){if((Array.isArray(T)||T instanceof Uint8Array)&&(T=pl.from(T)),!pl.isBuffer(T))throw new TypeError("Expected Buffer");if(T.length===0)return"";for(var M=0,N=0,D=0,j=T.length;D!==j&&T[D]===0;)D++,M++;for(var Y=(j-D)*m+1>>>0,Q=new Uint8Array(Y);D!==j;){for(var W=T[D],te=0,ne=Y-1;(W!==0||te<N)&&ne!==-1;ne--,te++)W+=256*Q[ne]>>>0,Q[ne]=W%s>>>0,W=W/s>>>0;if(W!==0)throw new Error("Non-zero carry");N=te,D++}for(var se=Y-N;se!==Y&&Q[se]===0;)se++;for(var ue=f.repeat(M);se<Y;++se)ue+=e.charAt(Q[se]);return ue}function x(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return pl.alloc(0);for(var M=0,N=0,D=0;T[M]===f;)N++,M++;for(var j=(T.length-M)*h+1>>>0,Y=new Uint8Array(j);M<T.length;){var Q=T.charCodeAt(M);if(Q>255)return;var W=t[Q];if(W===255)return;for(var te=0,ne=j-1;(W!==0||te<D)&&ne!==-1;ne--,te++)W+=s*Y[ne]>>>0,Y[ne]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");D=te,M++}for(var se=j-D;se!==j&&Y[se]===0;)se++;var ue=pl.allocUnsafe(N+(j-se));ue.fill(0,0,N);for(var be=N;se!==j;)ue[be++]=Y[se++];return ue}function I(T){var M=x(T);if(M)return M;throw new Error("Non-base"+s+" character")}return{encode:S,decodeUnsafe:x,decode:I}}pA.exports=s9});var yA=B((WZ,vA)=>{y();var a9=gA(),f9="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";vA.exports=a9(f9)});var wA=B((ZZ,_A)=>{"use strict";y();var Gg=mt(),mA=yA(),bA=xt(),u9="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),Gt=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t)){var r=t;this.fromBuffer(r)}else if(typeof t=="string"){var i=t;this.fromString(i)}};Gt.validCharacters=function(t){return bA.Buffer.isBuffer(t)&&(t=t.toString()),Gg.every(Gg.map(t,function(r){return Gg.includes(u9,r)}))};Gt.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this};Gt.encode=function(e){if(!bA.Buffer.isBuffer(e))throw new Error("Input should be a buffer");return mA.encode(e)};Gt.decode=function(e){if(typeof e!="string")throw new Error("Input should be a string");return _.Buffer.from(mA.decode(e))};Gt.prototype.fromBuffer=function(e){return this.buf=e,this};Gt.fromBuffer=function(e){return new Gt().fromBuffer(e)};Gt.fromHex=function(e){return Gt.fromBuffer(_.Buffer.from(e,"hex"))};Gt.prototype.fromString=function(e){var t=Gt.decode(e);return this.buf=t,this};Gt.fromString=function(e){return new Gt().fromString(e)};Gt.prototype.toBuffer=function(){return this.buf};Gt.prototype.toHex=function(){return this.toBuffer().toString("hex")};Gt.prototype.toString=function(){return Gt.encode(this.buf)};_A.exports=Gt});var zg=B((XZ,IA)=>{"use strict";y();var SA=mt(),gl=wA(),EA=xt(),xA=ir().sha256sha256,At=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t)){var r=t;this.fromBuffer(r)}else if(typeof t=="string"){var i=t;this.fromString(i)}};At.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this};At.validChecksum=function(t,r){return SA.isString(t)&&(t=EA.Buffer.from(gl.decode(t))),SA.isString(r)&&(r=EA.Buffer.from(gl.decode(r))),r||(r=t.slice(-4),t=t.slice(0,-4)),At.checksum(t).toString("hex")===r.toString("hex")};At.decode=function(e){if(typeof e!="string")throw new Error("Input must be a string");var t=_.Buffer.from(gl.decode(e));if(t.length<4)throw new Error("Input string too short");var r=t.slice(0,-4),i=t.slice(-4),n=xA(r),o=n.slice(0,4);if(i.toString("hex")!==o.toString("hex"))throw new Error("Checksum mismatch");return r};At.checksum=function(e){return xA(e).slice(0,4)};At.encode=function(e){if(!_.Buffer.isBuffer(e))throw new Error("Input must be a buffer");var t=_.Buffer.alloc(e.length+4),r=At.checksum(e);return e.copy(t),r.copy(t,e.length),gl.encode(t)};At.prototype.fromBuffer=function(e){return this.buf=e,this};At.fromBuffer=function(e){return new At().fromBuffer(e)};At.fromHex=function(e){return At.fromBuffer(_.Buffer.from(e,"hex"))};At.prototype.fromString=function(e){var t=At.decode(e);return this.buf=t,this};At.fromString=function(e){var t=At.decode(e);return new At(t)};At.prototype.toBuffer=function(){return this.buf};At.prototype.toHex=function(){return this.toBuffer().toString("hex")};At.prototype.toString=function(){return At.encode(this.buf)};IA.exports=At});var gu=B((QZ,OA)=>{"use strict";y();var pu=mt(),AA=at(),Ba=Ur(),Rt=function e(t){if(!(this instanceof e))return new e(t);if(!pu.isUndefined(t))if(_.Buffer.isBuffer(t))this.set({buf:t});else if(pu.isString(t)){var r=_.Buffer.from(t,"hex");if(r.length*2!==t.length)throw new TypeError("Invalid hex string");this.set({buf:r})}else if(pu.isObject(t)){var i=t;this.set(i)}else throw new TypeError("Unrecognized argument for BufferReader")};Rt.prototype.set=function(e){return this.buf=e.buf||this.buf||void 0,this.pos=e.pos||this.pos||0,this};Rt.prototype.eof=function(){return this.pos>=this.buf.length};Rt.prototype.finished=Rt.prototype.eof;Rt.prototype.read=function(e){AA.checkArgument(!pu.isUndefined(e),"Must specify a length");var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,t};Rt.prototype.readAll=function(){var e=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,e};Rt.prototype.readUInt8=function(){var e=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,e};Rt.prototype.readUInt16BE=function(){var e=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,e};Rt.prototype.readUInt16LE=function(){var e=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,e};Rt.prototype.readUInt32BE=function(){var e=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readUInt32LE=function(){var e=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readInt32LE=function(){var e=this.buf.readInt32LE(this.pos);return this.pos=this.pos+4,e};Rt.prototype.readUInt64BEBN=function(){var e=this.buf.slice(this.pos,this.pos+8),t=Ba.fromBuffer(e);return this.pos=this.pos+8,t};Rt.prototype.readUInt64LEBN=function(){var e=this.buf.readUInt32LE(this.pos),t=this.buf.readUInt32LE(this.pos+4),r=t*4294967296+e,i;if(r<=9007199254740991)i=new Ba(r);else{var n=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);i=new Ba(n,10,"le")}return this.pos=this.pos+8,i};Rt.prototype.readVarintNum=function(){var e=this.readUInt8();switch(e){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var t=this.readUInt64LEBN(),r=t.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return e}};Rt.prototype.readVarLengthBuffer=function(){var e=this.readVarintNum(),t=this.read(e);return AA.checkState(t.length===e,"Invalid length while reading varlength buffer. Expected to read: "+e+" and read "+t.length),t};Rt.prototype.readVarintBuf=function(){var e=this.buf.readUInt8(this.pos);switch(e){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}};Rt.prototype.readVarintBN=function(){var e=this.readUInt8();switch(e){case 253:return new Ba(this.readUInt16LE());case 254:return new Ba(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new Ba(e)}};Rt.prototype.reverse=function(){for(var e=_.Buffer.alloc(this.buf.length),t=0;t<e.length;t++)e[t]=this.buf[this.buf.length-1-t];return this.buf=e,this};Rt.prototype.readReverse=function(e){pu.isUndefined(e)&&(e=this.buf.length);var t=this.buf.slice(this.pos,this.pos+e);return this.pos=this.pos+e,_.Buffer.from(t).reverse()};OA.exports=Rt});var Zg=B((t$,PA)=>{"use strict";y();function Zn(e){"@babel/helpers - typeof";return Zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(e)}function RA(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,h9(i.key),i)}}function c9(e,t,r){return t&&RA(e.prototype,t),r&&RA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h9(e){var t=l9(e,"string");return Zn(t)==="symbol"?t:String(t)}function l9(e,t){if(Zn(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(Zn(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function d9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Yg(e,t)}function Yg(e,t){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},Yg(e,t)}function g9(e){var t=m9();return function(){var i=vl(e),n;if(t){var o=vl(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return v9(this,n)}}function v9(e,t){if(t&&(Zn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y9(e)}function y9(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m9(){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 vl(e){return vl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},vl(e)}var BA={},Pa,Wg;function vu(e,t,r){r||(r=Error);function i(o,s,f){return typeof t=="string"?t:t(o,s,f)}var n=(function(o){p9(f,o);var s=g9(f);function f(h,m,S){var x;return d9(this,f),x=s.call(this,i(h,m,S)),x.code=e,x}return c9(f)})(r);BA[e]=n}function TA(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(i){return String(i)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function b9(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function _9(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function w9(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}vu("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError);vu("ERR_INVALID_ARG_TYPE",function(e,t,r){Pa===void 0&&(Pa=yl()),Pa(typeof e=="string","'name' must be a string");var i;typeof t=="string"&&b9(t,"not ")?(i="must not be",t=t.replace(/^not /,"")):i="must be";var n;if(_9(e," argument"))n="The ".concat(e," ").concat(i," ").concat(TA(t,"type"));else{var o=w9(e,".")?"property":"argument";n='The "'.concat(e,'" ').concat(o," ").concat(i," ").concat(TA(t,"type"))}return n+=". Received type ".concat(Zn(r)),n},TypeError);vu("ERR_INVALID_ARG_VALUE",function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";Wg===void 0&&(Wg=Ai());var i=Wg.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(r,". Received ").concat(i)},TypeError,RangeError);vu("ERR_INVALID_RETURN_VALUE",function(e,t,r){var i;return r&&r.constructor&&r.constructor.name?i="instance of ".concat(r.constructor.name):i="type ".concat(Zn(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")},TypeError);vu("ERR_MISSING_ARGS",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];Pa===void 0&&(Pa=yl()),Pa(t.length>0,"At least one arg needs to be specified");var i="The ",n=t.length;switch(t=t.map(function(o){return'"'.concat(o,'"')}),n){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,n-1).join(", "),i+=", and ".concat(t[n-1]," arguments");break}return"".concat(i," must be specified")},TypeError);PA.exports.codes=BA});var jA=B((i$,FA)=>{"use strict";y();function MA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function kA(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?MA(Object(r),!0).forEach(function(i){S9(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MA(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function S9(e,t,r){return t=qA(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E9(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function NA(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,qA(i.key),i)}}function x9(e,t,r){return t&&NA(e.prototype,t),r&&NA(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function qA(e){var t=I9(e,"string");return gr(t)==="symbol"?t:String(t)}function I9(e,t){if(gr(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(gr(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function A9(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_u(e,t)}function O9(e){var t=UA();return function(){var i=wu(e),n;if(t){var o=wu(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return LA(this,n)}}function LA(e,t){if(t&&(gr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $g(e)}function $g(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xg(e){var t=typeof Map=="function"?new Map:void 0;return Xg=function(i){if(i===null||!R9(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(i))return t.get(i);t.set(i,n)}function n(){return ml(i,arguments,wu(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_u(n,i)},Xg(e)}function ml(e,t,r){return UA()?ml=Reflect.construct.bind():ml=function(n,o,s){var f=[null];f.push.apply(f,o);var h=Function.bind.apply(n,f),m=new h;return s&&_u(m,s.prototype),m},ml.apply(null,arguments)}function UA(){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 R9(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function _u(e,t){return _u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},_u(e,t)}function wu(e){return wu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},wu(e)}function gr(e){"@babel/helpers - typeof";return gr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gr(e)}var T9=Ai(),Jg=T9.inspect,B9=Zg(),P9=B9.codes.ERR_INVALID_ARG_TYPE;function CA(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function M9(e,t){if(t=Math.floor(t),e.length==0||t==0)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+=e.substring(0,r-e.length),e}var ci="",yu="",mu="",Xt="",ls={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},k9=10;function DA(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach(function(i){r[i]=e[i]}),Object.defineProperty(r,"message",{value:e.message}),r}function bu(e){return Jg(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function N9(e,t,r){var i="",n="",o=0,s="",f=!1,h=bu(e),m=h.split(`
20
20
  `),S=bu(t).split(`
21
21
  `),x=0,I="";if(r==="strictEqual"&&gr(e)==="object"&&gr(t)==="object"&&e!==null&&t!==null&&(r="strictEqualObject"),m.length===1&&S.length===1&&m[0]!==S[0]){var T=m[0].length+S[0].length;if(T<=k9){if((gr(e)!=="object"||e===null)&&(gr(t)!=="object"||t===null)&&(e!==0||t!==0))return"".concat(ls[r],`
22
22
 
@@ -62,8 +62,8 @@ https://github.com/browserify/crypto-browserify`)};Ye.constants={DH_CHECK_P_NOT_
62
62
 
63
63
  should equal
64
64
 
65
- `):N=" ".concat(f," ").concat(N)),o=r.call(this,"".concat(M).concat(N))}return Error.stackTraceLimit=x,o.generatedMessage=!s,Object.defineProperty($g(o),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),o.code="ERR_ASSERTION",o.actual=m,o.expected=S,o.operator=f,Error.captureStackTrace&&Error.captureStackTrace($g(o),h),o.stack,o.name="AssertionError",UA(o)}return x9(i,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(o,s){return Jg(this,kA(kA({},s),{},{customInspect:!1,depth:0}))}}]),i})(Xg(Error),Jg.custom);FA.exports=C9});var Qg=B((o$,KA)=>{"use strict";y();var HA=Object.prototype.toString;KA.exports=function(t){var r=HA.call(t),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&HA.call(t.callee)==="[object Function]"),i}});var JA=B((a$,XA)=>{"use strict";y();var $A;Object.keys||(Su=Object.prototype.hasOwnProperty,ev=Object.prototype.toString,VA=Qg(),tv=Object.prototype.propertyIsEnumerable,GA=!tv.call({toString:null},"toString"),zA=tv.call(function(){},"prototype"),Eu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],bl=function(e){var t=e.constructor;return t&&t.prototype===e},WA={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},YA=(function(){if(typeof window>"u")return!1;for(var e in window)try{if(!WA["$"+e]&&Su.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{bl(window[e])}catch{return!0}}catch{return!0}return!1})(),ZA=function(e){if(typeof window>"u"||!YA)return bl(e);try{return bl(e)}catch{return!1}},$A=function(t){var r=t!==null&&typeof t=="object",i=ev.call(t)==="[object Function]",n=VA(t),o=r&&ev.call(t)==="[object String]",s=[];if(!r&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var f=zA&&i;if(o&&t.length>0&&!Su.call(t,0))for(var h=0;h<t.length;++h)s.push(String(h));if(n&&t.length>0)for(var m=0;m<t.length;++m)s.push(String(m));else for(var S in t)!(f&&S==="prototype")&&Su.call(t,S)&&s.push(String(S));if(GA)for(var x=ZA(t),I=0;I<Eu.length;++I)!(x&&Eu[I]==="constructor")&&Su.call(t,Eu[I])&&s.push(Eu[I]);return s});var Su,ev,VA,tv,GA,zA,Eu,bl,WA,YA,ZA;XA.exports=$A});var rv=B((u$,t6)=>{"use strict";y();var D9=Array.prototype.slice,q9=Qg(),QA=Object.keys,_l=QA?function(t){return QA(t)}:JA(),e6=Object.keys;_l.shim=function(){if(Object.keys){var t=(function(){var r=Object.keys(arguments);return r&&r.length===arguments.length})(1,2);t||(Object.keys=function(i){return q9(i)?e6(D9.call(i)):e6(i)})}else Object.keys=_l;return Object.keys||_l};t6.exports=_l});var s6=B((h$,o6)=>{"use strict";y();var U9=rv(),i6=ec()(),n6=Bn(),wl=tc(),L9=n6("Array.prototype.push"),r6=n6("Object.prototype.propertyIsEnumerable"),F9=i6?wl.getOwnPropertySymbols:null;o6.exports=function(t,r){if(t==null)throw new TypeError("target must be an object");var i=wl(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=wl(arguments[n]),s=U9(o),f=i6&&(wl.getOwnPropertySymbols||F9);if(f)for(var h=f(o),m=0;m<h.length;++m){var S=h[m];r6(o,S)&&L9(s,S)}for(var x=0;x<s.length;++x){var I=s[x];if(r6(o,I)){var T=o[I];i[I]=T}}}return i}});var f6=B((d$,a6)=>{"use strict";y();var iv=s6(),j9=function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i<t.length;++i)r[t[i]]=t[i];var n=Object.assign({},r),o="";for(var s in n)o+=s;return e!==o},H9=function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch{return e[1]==="y"}return!1};a6.exports=function(){return!Object.assign||j9()||H9()?iv:Object.assign}});var nv=B((g$,c6)=>{"use strict";y();var u6=function(e){return e!==e};c6.exports=function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||u6(t)&&u6(r))}});var Sl=B((y$,h6)=>{"use strict";y();var K9=nv();h6.exports=function(){return typeof Object.is=="function"?Object.is:K9}});var g6=B((b$,p6)=>{"use strict";y();var l6=cc(),d6=af(),V9=d6(l6("String.prototype.indexOf"));p6.exports=function(t,r){var i=l6(t,!!r);return typeof i=="function"&&V9(t,".prototype.")>-1?d6(i):i}});var xu=B((w$,b6)=>{"use strict";y();var G9=rv(),z9=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",W9=Object.prototype.toString,Y9=Array.prototype.concat,v6=Ld(),Z9=function(e){return typeof e=="function"&&W9.call(e)==="[object Function]"},y6=jd()(),$9=function(e,t,r,i){if(t in e){if(i===!0){if(e[t]===r)return}else if(!Z9(i)||!i())return}y6?v6(e,t,r,!0):v6(e,t,r)},m6=function(e,t){var r=arguments.length>2?arguments[2]:{},i=G9(t);z9&&(i=Y9.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)$9(e,i[n],t[i[n]],r[i[n]])};m6.supportsDescriptors=!!y6;b6.exports=m6});var w6=B((E$,_6)=>{"use strict";y();var X9=Sl(),J9=xu();_6.exports=function(){var t=X9();return J9(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var I6=B((I$,x6)=>{"use strict";y();var Q9=xu(),eU=af(),tU=nv(),S6=Sl(),rU=w6(),E6=eU(S6(),Object);Q9(E6,{getPolyfill:S6,implementation:tU,shim:rU});x6.exports=E6});var ov=B((O$,A6)=>{"use strict";y();A6.exports=function(t){return t!==t}});var sv=B((T$,O6)=>{"use strict";y();var iU=ov();O6.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:iU}});var T6=B((P$,R6)=>{"use strict";y();var nU=xu(),oU=sv();R6.exports=function(){var t=oU();return nU(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}});var k6=B((k$,M6)=>{"use strict";y();var sU=af(),aU=xu(),fU=ov(),B6=sv(),uU=T6(),P6=sU(B6(),Number);aU(P6,{getPolyfill:B6,implementation:fU,shim:uU});M6.exports=P6});var Q6=B((C$,J6)=>{"use strict";y();function N6(e,t){return dU(e)||lU(e,t)||hU(e,t)||cU()}function cU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
66
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hU(e,t){if(e){if(typeof e=="string")return C6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C6(e,t)}}function C6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function lU(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,n,o,s,f=[],h=!0,m=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;h=!1}else for(;!(h=(i=o.call(r)).done)&&(f.push(i.value),f.length!==t);h=!0);}catch(S){m=!0,n=S}finally{try{if(!h&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(m)throw n}}return f}}function dU(e){if(Array.isArray(e))return e}function Kr(e){"@babel/helpers - typeof";return Kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kr(e)}var pU=/a/g.flags!==void 0,Tl=function(t){var r=[];return t.forEach(function(i){return r.push(i)}),r},D6=function(t){var r=[];return t.forEach(function(i,n){return r.push([n,i])}),r},W6=Object.is?Object.is:I6(),Ol=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},av=Number.isNaN?Number.isNaN:k6();function uv(e){return e.call.bind(e)}var Au=uv(Object.prototype.hasOwnProperty),Rl=uv(Object.prototype.propertyIsEnumerable),q6=uv(Object.prototype.toString),sr=Ai().types,gU=sr.isAnyArrayBuffer,vU=sr.isArrayBufferView,U6=sr.isDate,El=sr.isMap,L6=sr.isRegExp,xl=sr.isSet,yU=sr.isNativeError,mU=sr.isBoxedPrimitive,F6=sr.isNumberObject,j6=sr.isStringObject,H6=sr.isBooleanObject,K6=sr.isBigIntObject,bU=sr.isSymbolObject,_U=sr.isFloat32Array,wU=sr.isFloat64Array;function SU(e){if(e.length===0||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return e.length===10&&e>=Math.pow(2,32)}function Il(e){return Object.keys(e).filter(SU).concat(Ol(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function Y6(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0}var Al=void 0,EU=!0,xU=!1,fv=0,cv=1,Z6=2,$6=3;function IU(e,t){return pU?e.source===t.source&&e.flags===t.flags:RegExp.prototype.toString.call(e)===RegExp.prototype.toString.call(t)}function AU(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function OU(e,t){return e.byteLength!==t.byteLength?!1:Y6(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))===0}function RU(e,t){return e.byteLength===t.byteLength&&Y6(new Uint8Array(e),new Uint8Array(t))===0}function TU(e,t){return F6(e)?F6(t)&&W6(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):j6(e)?j6(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):H6(e)?H6(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):K6(e)?K6(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):bU(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}function Vr(e,t,r,i){if(e===t)return e!==0?!0:r?W6(e,t):!0;if(r){if(Kr(e)!=="object")return typeof e=="number"&&av(e)&&av(t);if(Kr(t)!=="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(e===null||Kr(e)!=="object")return t===null||Kr(t)!=="object"?e==t:!1;if(t===null||Kr(t)!=="object")return!1}var n=q6(e),o=q6(t);if(n!==o)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var s=Il(e,Al),f=Il(t,Al);return s.length!==f.length?!1:Iu(e,t,r,i,cv,s)}if(n==="[object Object]"&&(!El(e)&&El(t)||!xl(e)&&xl(t)))return!1;if(U6(e)){if(!U6(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(L6(e)){if(!L6(t)||!IU(e,t))return!1}else if(yU(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else if(vU(e)){if(!r&&(_U(e)||wU(e))){if(!AU(e,t))return!1}else if(!OU(e,t))return!1;var h=Il(e,Al),m=Il(t,Al);return h.length!==m.length?!1:Iu(e,t,r,i,fv,h)}else{if(xl(e))return!xl(t)||e.size!==t.size?!1:Iu(e,t,r,i,Z6);if(El(e))return!El(t)||e.size!==t.size?!1:Iu(e,t,r,i,$6);if(gU(e)){if(!RU(e,t))return!1}else if(mU(e)&&!TU(e,t))return!1}return Iu(e,t,r,i,fv)}function V6(e,t){return t.filter(function(r){return Rl(e,r)})}function Iu(e,t,r,i,n,o){if(arguments.length===5){o=Object.keys(e);var s=Object.keys(t);if(o.length!==s.length)return!1}for(var f=0;f<o.length;f++)if(!Au(t,o[f]))return!1;if(r&&arguments.length===5){var h=Ol(e);if(h.length!==0){var m=0;for(f=0;f<h.length;f++){var S=h[f];if(Rl(e,S)){if(!Rl(t,S))return!1;o.push(S),m++}else if(Rl(t,S))return!1}var x=Ol(t);if(h.length!==x.length&&V6(t,x).length!==m)return!1}else{var I=Ol(t);if(I.length!==0&&V6(t,I).length!==0)return!1}}if(o.length===0&&(n===fv||n===cv&&e.length===0||e.size===0))return!0;if(i===void 0)i={val1:new Map,val2:new Map,position:0};else{var T=i.val1.get(e);if(T!==void 0){var M=i.val2.get(t);if(M!==void 0)return T===M}i.position++}i.val1.set(e,i.position),i.val2.set(t,i.position);var N=NU(e,t,r,o,i,n);return i.val1.delete(e),i.val2.delete(t),N}function G6(e,t,r,i){for(var n=Tl(e),o=0;o<n.length;o++){var s=n[o];if(Vr(t,s,r,i))return e.delete(s),!0}return!1}function X6(e){switch(Kr(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(av(e))return!1}return!0}function BU(e,t,r){var i=X6(r);return i??(t.has(i)&&!e.has(i))}function PU(e,t,r,i,n){var o=X6(r);if(o!=null)return o;var s=t.get(o);return s===void 0&&!t.has(o)||!Vr(i,s,!1,n)?!1:!e.has(o)&&Vr(i,s,!1,n)}function MU(e,t,r,i){for(var n=null,o=Tl(e),s=0;s<o.length;s++){var f=o[s];if(Kr(f)==="object"&&f!==null)n===null&&(n=new Set),n.add(f);else if(!t.has(f)){if(r||!BU(e,t,f))return!1;n===null&&(n=new Set),n.add(f)}}if(n!==null){for(var h=Tl(t),m=0;m<h.length;m++){var S=h[m];if(Kr(S)==="object"&&S!==null){if(!G6(n,S,r,i))return!1}else if(!r&&!e.has(S)&&!G6(n,S,r,i))return!1}return n.size===0}return!0}function z6(e,t,r,i,n,o){for(var s=Tl(e),f=0;f<s.length;f++){var h=s[f];if(Vr(r,h,n,o)&&Vr(i,t.get(h),n,o))return e.delete(h),!0}return!1}function kU(e,t,r,i){for(var n=null,o=D6(e),s=0;s<o.length;s++){var f=N6(o[s],2),h=f[0],m=f[1];if(Kr(h)==="object"&&h!==null)n===null&&(n=new Set),n.add(h);else{var S=t.get(h);if(S===void 0&&!t.has(h)||!Vr(m,S,r,i)){if(r||!PU(e,t,h,m,i))return!1;n===null&&(n=new Set),n.add(h)}}}if(n!==null){for(var x=D6(t),I=0;I<x.length;I++){var T=N6(x[I],2),M=T[0],N=T[1];if(Kr(M)==="object"&&M!==null){if(!z6(n,e,M,N,r,i))return!1}else if(!r&&(!e.has(M)||!Vr(e.get(M),N,!1,i))&&!z6(n,e,M,N,!1,i))return!1}return n.size===0}return!0}function NU(e,t,r,i,n,o){var s=0;if(o===Z6){if(!MU(e,t,r,n))return!1}else if(o===$6){if(!kU(e,t,r,n))return!1}else if(o===cv)for(;s<e.length;s++)if(Au(e,s)){if(!Au(t,s)||!Vr(e[s],t[s],r,n))return!1}else{if(Au(t,s))return!1;for(var f=Object.keys(e);s<f.length;s++){var h=f[s];if(!Au(t,h)||!Vr(e[h],t[h],r,n))return!1}return f.length===Object.keys(t).length}for(s=0;s<i.length;s++){var m=i[s];if(!Vr(e[m],t[m],r,n))return!1}return!0}function CU(e,t){return Vr(e,t,xU)}function DU(e,t){return Vr(e,t,EU)}J6.exports={isDeepEqual:CU,isDeepStrictEqual:DU}});var yl=B((q$,yO)=>{"use strict";y();function hi(e){"@babel/helpers - typeof";return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hi(e)}function eO(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,UU(i.key),i)}}function qU(e,t,r){return t&&eO(e.prototype,t),r&&eO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function UU(e){var t=LU(e,"string");return hi(t)==="symbol"?t:String(t)}function LU(e,t){if(hi(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(hi(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var jU=Zg(),Ou=jU.codes,tO=Ou.ERR_AMBIGUOUS_ARGUMENT,Ma=Ou.ERR_INVALID_ARG_TYPE,HU=Ou.ERR_INVALID_ARG_VALUE,KU=Ou.ERR_INVALID_RETURN_VALUE,Xn=Ou.ERR_MISSING_ARGS,Jn=jA(),VU=Ai(),Bl=VU.inspect,oO=Ai().types,GU=oO.isPromise,Pl=oO.isRegExp,zU=f6()(),sO=Sl()(),Ml=g6()("RegExp.prototype.test"),$n,kl;function Ru(){var e=Q6();$n=e.isDeepEqual,kl=e.isDeepStrictEqual}var rO=!1,bt=yO.exports=hv,Nl={};function li(e){throw e.message instanceof Error?e.message:new Jn(e)}function aO(e,t,r,i,n){var o=arguments.length,s;if(o===0)s="Failed";else if(o===1)r=e,e=void 0;else{if(rO===!1){rO=!0;var f=O.default.emitWarning?O.default.emitWarning:console.warn.bind(console);f("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}o===2&&(i="!=")}if(r instanceof Error)throw r;var h={actual:e,expected:t,operator:i===void 0?"fail":i,stackStartFn:n||aO};r!==void 0&&(h.message=r);var m=new Jn(h);throw s&&(m.message=s,m.generatedMessage=!0),m}bt.fail=aO;bt.AssertionError=Jn;function fO(e,t,r,i){if(!r){var n=!1;if(t===0)n=!0,i="No value argument passed to `assert.ok()`";else if(i instanceof Error)throw i;var o=new Jn({actual:r,expected:!0,message:i,operator:"==",stackStartFn:e});throw o.generatedMessage=n,o}}function hv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];fO.apply(void 0,[hv,t.length].concat(t))}bt.ok=hv;bt.equal=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");t!=r&&li({actual:t,expected:r,message:i,operator:"==",stackStartFn:e})};bt.notEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");t==r&&li({actual:t,expected:r,message:i,operator:"!=",stackStartFn:e})};bt.deepEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),$n(t,r)||li({actual:t,expected:r,message:i,operator:"deepEqual",stackStartFn:e})};bt.notDeepEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),$n(t,r)&&li({actual:t,expected:r,message:i,operator:"notDeepEqual",stackStartFn:e})};bt.deepStrictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),kl(t,r)||li({actual:t,expected:r,message:i,operator:"deepStrictEqual",stackStartFn:e})};bt.notDeepStrictEqual=uO;function uO(e,t,r){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),kl(e,t)&&li({actual:e,expected:t,message:r,operator:"notDeepStrictEqual",stackStartFn:uO})}bt.strictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");sO(t,r)||li({actual:t,expected:r,message:i,operator:"strictEqual",stackStartFn:e})};bt.notStrictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");sO(t,r)&&li({actual:t,expected:r,message:i,operator:"notStrictEqual",stackStartFn:e})};var iO=qU(function e(t,r,i){var n=this;FU(this,e),r.forEach(function(o){o in t&&(i!==void 0&&typeof i[o]=="string"&&Pl(t[o])&&Ml(t[o],i[o])?n[o]=i[o]:n[o]=t[o])})});function WU(e,t,r,i,n,o){if(!(r in e)||!kl(e[r],t[r])){if(!i){var s=new iO(e,n),f=new iO(t,n,e),h=new Jn({actual:s,expected:f,operator:"deepStrictEqual",stackStartFn:o});throw h.actual=e,h.expected=t,h.operator=o.name,h}li({actual:e,expected:t,message:i,operator:o.name,stackStartFn:o})}}function cO(e,t,r,i){if(typeof t!="function"){if(Pl(t))return Ml(t,e);if(arguments.length===2)throw new Ma("expected",["Function","RegExp"],t);if(hi(e)!=="object"||e===null){var n=new Jn({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:i});throw n.operator=i.name,n}var o=Object.keys(t);if(t instanceof Error)o.push("name","message");else if(o.length===0)throw new HU("error",t,"may not be an empty object");return $n===void 0&&Ru(),o.forEach(function(s){typeof e[s]=="string"&&Pl(t[s])&&Ml(t[s],e[s])||WU(e,t,s,r,o,i)}),!0}return t.prototype!==void 0&&e instanceof t?!0:Error.isPrototypeOf(t)?!1:t.call({},e)===!0}function hO(e){if(typeof e!="function")throw new Ma("fn","Function",e);try{e()}catch(t){return t}return Nl}function nO(e){return GU(e)||e!==null&&hi(e)==="object"&&typeof e.then=="function"&&typeof e.catch=="function"}function lO(e){return Promise.resolve().then(function(){var t;if(typeof e=="function"){if(t=e(),!nO(t))throw new KU("instance of Promise","promiseFn",t)}else if(nO(e))t=e;else throw new Ma("promiseFn",["Function","Promise"],e);return Promise.resolve().then(function(){return t}).then(function(){return Nl}).catch(function(r){return r})})}function dO(e,t,r,i){if(typeof r=="string"){if(arguments.length===4)throw new Ma("error",["Object","Error","Function","RegExp"],r);if(hi(t)==="object"&&t!==null){if(t.message===r)throw new tO("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new tO("error/message",'The error "'.concat(t,'" is identical to the message.'));i=r,r=void 0}else if(r!=null&&hi(r)!=="object"&&typeof r!="function")throw new Ma("error",["Object","Error","Function","RegExp"],r);if(t===Nl){var n="";r&&r.name&&(n+=" (".concat(r.name,")")),n+=i?": ".concat(i):".";var o=e.name==="rejects"?"rejection":"exception";li({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(o).concat(n),stackStartFn:e})}if(r&&!cO(t,r,i,e))throw t}function pO(e,t,r,i){if(t!==Nl){if(typeof r=="string"&&(i=r,r=void 0),!r||cO(t,r)){var n=i?": ".concat(i):".",o=e.name==="doesNotReject"?"rejection":"exception";li({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(n,`
65
+ `):N=" ".concat(f," ").concat(N)),o=r.call(this,"".concat(M).concat(N))}return Error.stackTraceLimit=x,o.generatedMessage=!s,Object.defineProperty($g(o),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),o.code="ERR_ASSERTION",o.actual=m,o.expected=S,o.operator=f,Error.captureStackTrace&&Error.captureStackTrace($g(o),h),o.stack,o.name="AssertionError",LA(o)}return x9(i,[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:t,value:function(o,s){return Jg(this,kA(kA({},s),{},{customInspect:!1,depth:0}))}}]),i})(Xg(Error),Jg.custom);FA.exports=C9});var Qg=B((o$,KA)=>{"use strict";y();var HA=Object.prototype.toString;KA.exports=function(t){var r=HA.call(t),i=r==="[object Arguments]";return i||(i=r!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&HA.call(t.callee)==="[object Function]"),i}});var JA=B((a$,XA)=>{"use strict";y();var $A;Object.keys||(Su=Object.prototype.hasOwnProperty,ev=Object.prototype.toString,VA=Qg(),tv=Object.prototype.propertyIsEnumerable,GA=!tv.call({toString:null},"toString"),zA=tv.call(function(){},"prototype"),Eu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],bl=function(e){var t=e.constructor;return t&&t.prototype===e},WA={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},YA=(function(){if(typeof window>"u")return!1;for(var e in window)try{if(!WA["$"+e]&&Su.call(window,e)&&window[e]!==null&&typeof window[e]=="object")try{bl(window[e])}catch{return!0}}catch{return!0}return!1})(),ZA=function(e){if(typeof window>"u"||!YA)return bl(e);try{return bl(e)}catch{return!1}},$A=function(t){var r=t!==null&&typeof t=="object",i=ev.call(t)==="[object Function]",n=VA(t),o=r&&ev.call(t)==="[object String]",s=[];if(!r&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var f=zA&&i;if(o&&t.length>0&&!Su.call(t,0))for(var h=0;h<t.length;++h)s.push(String(h));if(n&&t.length>0)for(var m=0;m<t.length;++m)s.push(String(m));else for(var S in t)!(f&&S==="prototype")&&Su.call(t,S)&&s.push(String(S));if(GA)for(var x=ZA(t),I=0;I<Eu.length;++I)!(x&&Eu[I]==="constructor")&&Su.call(t,Eu[I])&&s.push(Eu[I]);return s});var Su,ev,VA,tv,GA,zA,Eu,bl,WA,YA,ZA;XA.exports=$A});var rv=B((u$,t6)=>{"use strict";y();var D9=Array.prototype.slice,q9=Qg(),QA=Object.keys,_l=QA?function(t){return QA(t)}:JA(),e6=Object.keys;_l.shim=function(){if(Object.keys){var t=(function(){var r=Object.keys(arguments);return r&&r.length===arguments.length})(1,2);t||(Object.keys=function(i){return q9(i)?e6(D9.call(i)):e6(i)})}else Object.keys=_l;return Object.keys||_l};t6.exports=_l});var s6=B((h$,o6)=>{"use strict";y();var L9=rv(),i6=ec()(),n6=Bn(),wl=tc(),U9=n6("Array.prototype.push"),r6=n6("Object.prototype.propertyIsEnumerable"),F9=i6?wl.getOwnPropertySymbols:null;o6.exports=function(t,r){if(t==null)throw new TypeError("target must be an object");var i=wl(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=wl(arguments[n]),s=L9(o),f=i6&&(wl.getOwnPropertySymbols||F9);if(f)for(var h=f(o),m=0;m<h.length;++m){var S=h[m];r6(o,S)&&U9(s,S)}for(var x=0;x<s.length;++x){var I=s[x];if(r6(o,I)){var T=o[I];i[I]=T}}}return i}});var f6=B((d$,a6)=>{"use strict";y();var iv=s6(),j9=function(){if(!Object.assign)return!1;for(var e="abcdefghijklmnopqrst",t=e.split(""),r={},i=0;i<t.length;++i)r[t[i]]=t[i];var n=Object.assign({},r),o="";for(var s in n)o+=s;return e!==o},H9=function(){if(!Object.assign||!Object.preventExtensions)return!1;var e=Object.preventExtensions({1:2});try{Object.assign(e,"xy")}catch{return e[1]==="y"}return!1};a6.exports=function(){return!Object.assign||j9()||H9()?iv:Object.assign}});var nv=B((g$,c6)=>{"use strict";y();var u6=function(e){return e!==e};c6.exports=function(t,r){return t===0&&r===0?1/t===1/r:!!(t===r||u6(t)&&u6(r))}});var Sl=B((y$,h6)=>{"use strict";y();var K9=nv();h6.exports=function(){return typeof Object.is=="function"?Object.is:K9}});var g6=B((b$,p6)=>{"use strict";y();var l6=cc(),d6=af(),V9=d6(l6("String.prototype.indexOf"));p6.exports=function(t,r){var i=l6(t,!!r);return typeof i=="function"&&V9(t,".prototype.")>-1?d6(i):i}});var xu=B((w$,b6)=>{"use strict";y();var G9=rv(),z9=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",W9=Object.prototype.toString,Y9=Array.prototype.concat,v6=Ud(),Z9=function(e){return typeof e=="function"&&W9.call(e)==="[object Function]"},y6=jd()(),$9=function(e,t,r,i){if(t in e){if(i===!0){if(e[t]===r)return}else if(!Z9(i)||!i())return}y6?v6(e,t,r,!0):v6(e,t,r)},m6=function(e,t){var r=arguments.length>2?arguments[2]:{},i=G9(t);z9&&(i=Y9.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)$9(e,i[n],t[i[n]],r[i[n]])};m6.supportsDescriptors=!!y6;b6.exports=m6});var w6=B((E$,_6)=>{"use strict";y();var X9=Sl(),J9=xu();_6.exports=function(){var t=X9();return J9(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var I6=B((I$,x6)=>{"use strict";y();var Q9=xu(),eL=af(),tL=nv(),S6=Sl(),rL=w6(),E6=eL(S6(),Object);Q9(E6,{getPolyfill:S6,implementation:tL,shim:rL});x6.exports=E6});var ov=B((O$,A6)=>{"use strict";y();A6.exports=function(t){return t!==t}});var sv=B((T$,O6)=>{"use strict";y();var iL=ov();O6.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:iL}});var T6=B((P$,R6)=>{"use strict";y();var nL=xu(),oL=sv();R6.exports=function(){var t=oL();return nL(Number,{isNaN:t},{isNaN:function(){return Number.isNaN!==t}}),t}});var k6=B((k$,M6)=>{"use strict";y();var sL=af(),aL=xu(),fL=ov(),B6=sv(),uL=T6(),P6=sL(B6(),Number);aL(P6,{getPolyfill:B6,implementation:fL,shim:uL});M6.exports=P6});var Q6=B((C$,J6)=>{"use strict";y();function N6(e,t){return dL(e)||lL(e,t)||hL(e,t)||cL()}function cL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
66
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hL(e,t){if(e){if(typeof e=="string")return C6(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return C6(e,t)}}function C6(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function lL(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i,n,o,s,f=[],h=!0,m=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;h=!1}else for(;!(h=(i=o.call(r)).done)&&(f.push(i.value),f.length!==t);h=!0);}catch(S){m=!0,n=S}finally{try{if(!h&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(m)throw n}}return f}}function dL(e){if(Array.isArray(e))return e}function Kr(e){"@babel/helpers - typeof";return Kr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kr(e)}var pL=/a/g.flags!==void 0,Tl=function(t){var r=[];return t.forEach(function(i){return r.push(i)}),r},D6=function(t){var r=[];return t.forEach(function(i,n){return r.push([n,i])}),r},W6=Object.is?Object.is:I6(),Ol=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},av=Number.isNaN?Number.isNaN:k6();function uv(e){return e.call.bind(e)}var Au=uv(Object.prototype.hasOwnProperty),Rl=uv(Object.prototype.propertyIsEnumerable),q6=uv(Object.prototype.toString),sr=Ai().types,gL=sr.isAnyArrayBuffer,vL=sr.isArrayBufferView,L6=sr.isDate,El=sr.isMap,U6=sr.isRegExp,xl=sr.isSet,yL=sr.isNativeError,mL=sr.isBoxedPrimitive,F6=sr.isNumberObject,j6=sr.isStringObject,H6=sr.isBooleanObject,K6=sr.isBigIntObject,bL=sr.isSymbolObject,_L=sr.isFloat32Array,wL=sr.isFloat64Array;function SL(e){if(e.length===0||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return e.length===10&&e>=Math.pow(2,32)}function Il(e){return Object.keys(e).filter(SL).concat(Ol(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function Y6(e,t){if(e===t)return 0;for(var r=e.length,i=t.length,n=0,o=Math.min(r,i);n<o;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0}var Al=void 0,EL=!0,xL=!1,fv=0,cv=1,Z6=2,$6=3;function IL(e,t){return pL?e.source===t.source&&e.flags===t.flags:RegExp.prototype.toString.call(e)===RegExp.prototype.toString.call(t)}function AL(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function OL(e,t){return e.byteLength!==t.byteLength?!1:Y6(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))===0}function RL(e,t){return e.byteLength===t.byteLength&&Y6(new Uint8Array(e),new Uint8Array(t))===0}function TL(e,t){return F6(e)?F6(t)&&W6(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):j6(e)?j6(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):H6(e)?H6(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):K6(e)?K6(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):bL(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}function Vr(e,t,r,i){if(e===t)return e!==0?!0:r?W6(e,t):!0;if(r){if(Kr(e)!=="object")return typeof e=="number"&&av(e)&&av(t);if(Kr(t)!=="object"||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(e===null||Kr(e)!=="object")return t===null||Kr(t)!=="object"?e==t:!1;if(t===null||Kr(t)!=="object")return!1}var n=q6(e),o=q6(t);if(n!==o)return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var s=Il(e,Al),f=Il(t,Al);return s.length!==f.length?!1:Iu(e,t,r,i,cv,s)}if(n==="[object Object]"&&(!El(e)&&El(t)||!xl(e)&&xl(t)))return!1;if(L6(e)){if(!L6(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(U6(e)){if(!U6(t)||!IL(e,t))return!1}else if(yL(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else if(vL(e)){if(!r&&(_L(e)||wL(e))){if(!AL(e,t))return!1}else if(!OL(e,t))return!1;var h=Il(e,Al),m=Il(t,Al);return h.length!==m.length?!1:Iu(e,t,r,i,fv,h)}else{if(xl(e))return!xl(t)||e.size!==t.size?!1:Iu(e,t,r,i,Z6);if(El(e))return!El(t)||e.size!==t.size?!1:Iu(e,t,r,i,$6);if(gL(e)){if(!RL(e,t))return!1}else if(mL(e)&&!TL(e,t))return!1}return Iu(e,t,r,i,fv)}function V6(e,t){return t.filter(function(r){return Rl(e,r)})}function Iu(e,t,r,i,n,o){if(arguments.length===5){o=Object.keys(e);var s=Object.keys(t);if(o.length!==s.length)return!1}for(var f=0;f<o.length;f++)if(!Au(t,o[f]))return!1;if(r&&arguments.length===5){var h=Ol(e);if(h.length!==0){var m=0;for(f=0;f<h.length;f++){var S=h[f];if(Rl(e,S)){if(!Rl(t,S))return!1;o.push(S),m++}else if(Rl(t,S))return!1}var x=Ol(t);if(h.length!==x.length&&V6(t,x).length!==m)return!1}else{var I=Ol(t);if(I.length!==0&&V6(t,I).length!==0)return!1}}if(o.length===0&&(n===fv||n===cv&&e.length===0||e.size===0))return!0;if(i===void 0)i={val1:new Map,val2:new Map,position:0};else{var T=i.val1.get(e);if(T!==void 0){var M=i.val2.get(t);if(M!==void 0)return T===M}i.position++}i.val1.set(e,i.position),i.val2.set(t,i.position);var N=NL(e,t,r,o,i,n);return i.val1.delete(e),i.val2.delete(t),N}function G6(e,t,r,i){for(var n=Tl(e),o=0;o<n.length;o++){var s=n[o];if(Vr(t,s,r,i))return e.delete(s),!0}return!1}function X6(e){switch(Kr(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(av(e))return!1}return!0}function BL(e,t,r){var i=X6(r);return i??(t.has(i)&&!e.has(i))}function PL(e,t,r,i,n){var o=X6(r);if(o!=null)return o;var s=t.get(o);return s===void 0&&!t.has(o)||!Vr(i,s,!1,n)?!1:!e.has(o)&&Vr(i,s,!1,n)}function ML(e,t,r,i){for(var n=null,o=Tl(e),s=0;s<o.length;s++){var f=o[s];if(Kr(f)==="object"&&f!==null)n===null&&(n=new Set),n.add(f);else if(!t.has(f)){if(r||!BL(e,t,f))return!1;n===null&&(n=new Set),n.add(f)}}if(n!==null){for(var h=Tl(t),m=0;m<h.length;m++){var S=h[m];if(Kr(S)==="object"&&S!==null){if(!G6(n,S,r,i))return!1}else if(!r&&!e.has(S)&&!G6(n,S,r,i))return!1}return n.size===0}return!0}function z6(e,t,r,i,n,o){for(var s=Tl(e),f=0;f<s.length;f++){var h=s[f];if(Vr(r,h,n,o)&&Vr(i,t.get(h),n,o))return e.delete(h),!0}return!1}function kL(e,t,r,i){for(var n=null,o=D6(e),s=0;s<o.length;s++){var f=N6(o[s],2),h=f[0],m=f[1];if(Kr(h)==="object"&&h!==null)n===null&&(n=new Set),n.add(h);else{var S=t.get(h);if(S===void 0&&!t.has(h)||!Vr(m,S,r,i)){if(r||!PL(e,t,h,m,i))return!1;n===null&&(n=new Set),n.add(h)}}}if(n!==null){for(var x=D6(t),I=0;I<x.length;I++){var T=N6(x[I],2),M=T[0],N=T[1];if(Kr(M)==="object"&&M!==null){if(!z6(n,e,M,N,r,i))return!1}else if(!r&&(!e.has(M)||!Vr(e.get(M),N,!1,i))&&!z6(n,e,M,N,!1,i))return!1}return n.size===0}return!0}function NL(e,t,r,i,n,o){var s=0;if(o===Z6){if(!ML(e,t,r,n))return!1}else if(o===$6){if(!kL(e,t,r,n))return!1}else if(o===cv)for(;s<e.length;s++)if(Au(e,s)){if(!Au(t,s)||!Vr(e[s],t[s],r,n))return!1}else{if(Au(t,s))return!1;for(var f=Object.keys(e);s<f.length;s++){var h=f[s];if(!Au(t,h)||!Vr(e[h],t[h],r,n))return!1}return f.length===Object.keys(t).length}for(s=0;s<i.length;s++){var m=i[s];if(!Vr(e[m],t[m],r,n))return!1}return!0}function CL(e,t){return Vr(e,t,xL)}function DL(e,t){return Vr(e,t,EL)}J6.exports={isDeepEqual:CL,isDeepStrictEqual:DL}});var yl=B((q$,yO)=>{"use strict";y();function hi(e){"@babel/helpers - typeof";return hi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hi(e)}function eO(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,LL(i.key),i)}}function qL(e,t,r){return t&&eO(e.prototype,t),r&&eO(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function LL(e){var t=UL(e,"string");return hi(t)==="symbol"?t:String(t)}function UL(e,t){if(hi(e)!=="object"||e===null)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,t||"default");if(hi(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function FL(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var jL=Zg(),Ou=jL.codes,tO=Ou.ERR_AMBIGUOUS_ARGUMENT,Ma=Ou.ERR_INVALID_ARG_TYPE,HL=Ou.ERR_INVALID_ARG_VALUE,KL=Ou.ERR_INVALID_RETURN_VALUE,Xn=Ou.ERR_MISSING_ARGS,Jn=jA(),VL=Ai(),Bl=VL.inspect,oO=Ai().types,GL=oO.isPromise,Pl=oO.isRegExp,zL=f6()(),sO=Sl()(),Ml=g6()("RegExp.prototype.test"),$n,kl;function Ru(){var e=Q6();$n=e.isDeepEqual,kl=e.isDeepStrictEqual}var rO=!1,bt=yO.exports=hv,Nl={};function li(e){throw e.message instanceof Error?e.message:new Jn(e)}function aO(e,t,r,i,n){var o=arguments.length,s;if(o===0)s="Failed";else if(o===1)r=e,e=void 0;else{if(rO===!1){rO=!0;var f=O.default.emitWarning?O.default.emitWarning:console.warn.bind(console);f("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}o===2&&(i="!=")}if(r instanceof Error)throw r;var h={actual:e,expected:t,operator:i===void 0?"fail":i,stackStartFn:n||aO};r!==void 0&&(h.message=r);var m=new Jn(h);throw s&&(m.message=s,m.generatedMessage=!0),m}bt.fail=aO;bt.AssertionError=Jn;function fO(e,t,r,i){if(!r){var n=!1;if(t===0)n=!0,i="No value argument passed to `assert.ok()`";else if(i instanceof Error)throw i;var o=new Jn({actual:r,expected:!0,message:i,operator:"==",stackStartFn:e});throw o.generatedMessage=n,o}}function hv(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];fO.apply(void 0,[hv,t.length].concat(t))}bt.ok=hv;bt.equal=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");t!=r&&li({actual:t,expected:r,message:i,operator:"==",stackStartFn:e})};bt.notEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");t==r&&li({actual:t,expected:r,message:i,operator:"!=",stackStartFn:e})};bt.deepEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),$n(t,r)||li({actual:t,expected:r,message:i,operator:"deepEqual",stackStartFn:e})};bt.notDeepEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),$n(t,r)&&li({actual:t,expected:r,message:i,operator:"notDeepEqual",stackStartFn:e})};bt.deepStrictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),kl(t,r)||li({actual:t,expected:r,message:i,operator:"deepStrictEqual",stackStartFn:e})};bt.notDeepStrictEqual=uO;function uO(e,t,r){if(arguments.length<2)throw new Xn("actual","expected");$n===void 0&&Ru(),kl(e,t)&&li({actual:e,expected:t,message:r,operator:"notDeepStrictEqual",stackStartFn:uO})}bt.strictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");sO(t,r)||li({actual:t,expected:r,message:i,operator:"strictEqual",stackStartFn:e})};bt.notStrictEqual=function e(t,r,i){if(arguments.length<2)throw new Xn("actual","expected");sO(t,r)&&li({actual:t,expected:r,message:i,operator:"notStrictEqual",stackStartFn:e})};var iO=qL(function e(t,r,i){var n=this;FL(this,e),r.forEach(function(o){o in t&&(i!==void 0&&typeof i[o]=="string"&&Pl(t[o])&&Ml(t[o],i[o])?n[o]=i[o]:n[o]=t[o])})});function WL(e,t,r,i,n,o){if(!(r in e)||!kl(e[r],t[r])){if(!i){var s=new iO(e,n),f=new iO(t,n,e),h=new Jn({actual:s,expected:f,operator:"deepStrictEqual",stackStartFn:o});throw h.actual=e,h.expected=t,h.operator=o.name,h}li({actual:e,expected:t,message:i,operator:o.name,stackStartFn:o})}}function cO(e,t,r,i){if(typeof t!="function"){if(Pl(t))return Ml(t,e);if(arguments.length===2)throw new Ma("expected",["Function","RegExp"],t);if(hi(e)!=="object"||e===null){var n=new Jn({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:i});throw n.operator=i.name,n}var o=Object.keys(t);if(t instanceof Error)o.push("name","message");else if(o.length===0)throw new HL("error",t,"may not be an empty object");return $n===void 0&&Ru(),o.forEach(function(s){typeof e[s]=="string"&&Pl(t[s])&&Ml(t[s],e[s])||WL(e,t,s,r,o,i)}),!0}return t.prototype!==void 0&&e instanceof t?!0:Error.isPrototypeOf(t)?!1:t.call({},e)===!0}function hO(e){if(typeof e!="function")throw new Ma("fn","Function",e);try{e()}catch(t){return t}return Nl}function nO(e){return GL(e)||e!==null&&hi(e)==="object"&&typeof e.then=="function"&&typeof e.catch=="function"}function lO(e){return Promise.resolve().then(function(){var t;if(typeof e=="function"){if(t=e(),!nO(t))throw new KL("instance of Promise","promiseFn",t)}else if(nO(e))t=e;else throw new Ma("promiseFn",["Function","Promise"],e);return Promise.resolve().then(function(){return t}).then(function(){return Nl}).catch(function(r){return r})})}function dO(e,t,r,i){if(typeof r=="string"){if(arguments.length===4)throw new Ma("error",["Object","Error","Function","RegExp"],r);if(hi(t)==="object"&&t!==null){if(t.message===r)throw new tO("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new tO("error/message",'The error "'.concat(t,'" is identical to the message.'));i=r,r=void 0}else if(r!=null&&hi(r)!=="object"&&typeof r!="function")throw new Ma("error",["Object","Error","Function","RegExp"],r);if(t===Nl){var n="";r&&r.name&&(n+=" (".concat(r.name,")")),n+=i?": ".concat(i):".";var o=e.name==="rejects"?"rejection":"exception";li({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(o).concat(n),stackStartFn:e})}if(r&&!cO(t,r,i,e))throw t}function pO(e,t,r,i){if(t!==Nl){if(typeof r=="string"&&(i=r,r=void 0),!r||cO(t,r)){var n=i?": ".concat(i):".",o=e.name==="doesNotReject"?"rejection":"exception";li({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(n,`
67
67
  `)+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}bt.throws=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];dO.apply(void 0,[e,hO(t)].concat(i))};bt.rejects=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return lO(t).then(function(o){return dO.apply(void 0,[e,o].concat(i))})};bt.doesNotThrow=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];pO.apply(void 0,[e,hO(t)].concat(i))};bt.doesNotReject=function e(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return lO(t).then(function(o){return pO.apply(void 0,[e,o].concat(i))})};bt.ifError=function e(t){if(t!=null){var r="ifError got unwanted exception: ";hi(t)==="object"&&typeof t.message=="string"?t.message.length===0&&t.constructor?r+=t.constructor.name:r+=t.message:r+=Bl(t);var i=new Jn({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),n=t.stack;if(typeof n=="string"){var o=n.split(`
68
68
  `);o.shift();for(var s=i.stack.split(`
69
69
  `),f=0;f<o.length;f++){var h=s.indexOf(o[f]);if(h!==-1){s=s.slice(0,h);break}}i.stack="".concat(s.join(`
@@ -72,5 +72,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
72
72
  `))}throw i}};function gO(e,t,r,i,n){if(!Pl(t))throw new Ma("regexp","RegExp",t);var o=n==="match";if(typeof e!="string"||Ml(t,e)!==o){if(r instanceof Error)throw r;var s=!r;r=r||(typeof e!="string"?'The "string" argument must be of type string. Received type '+"".concat(hi(e)," (").concat(Bl(e),")"):(o?"The input did not match the regular expression ":"The input was expected to not match the regular expression ")+"".concat(Bl(t),`. Input:
73
73
 
74
74
  `).concat(Bl(e),`
75
- `));var f=new Jn({actual:e,expected:t,message:r,operator:n,stackStartFn:i});throw f.generatedMessage=s,f}}bt.match=function e(t,r,i){gO(t,r,i,e,"match")};bt.doesNotMatch=function e(t,r,i){gO(t,r,i,e,"doesNotMatch")};function vO(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];fO.apply(void 0,[vO,t.length].concat(t))}bt.strict=zU(vO,bt,{equal:bt.strictEqual,deepEqual:bt.deepStrictEqual,notEqual:bt.notStrictEqual,notDeepEqual:bt.notDeepStrictEqual});bt.strict.strict=bt.strict});var ds=B((L$,bO)=>{"use strict";y();var mO=yl(),Tt=function e(t){if(!(this instanceof e))return new e(t);this.bufLen=0,t?this.set(t):this.bufs=[]};Tt.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this.bufLen=this.bufs.reduce(function(t,r){return t+r.length},0),this};Tt.prototype.toBuffer=function(){return this.concat()};Tt.prototype.concat=function(){return _.Buffer.concat(this.bufs,this.bufLen)};Tt.prototype.write=function(e){return mO(_.Buffer.isBuffer(e)),this.bufs.push(e),this.bufLen+=e.length,this};Tt.prototype.writeReverse=function(e){return mO(_.Buffer.isBuffer(e)),this.bufs.push(_.Buffer.from(e).reverse()),this.bufLen+=e.length,this};Tt.prototype.writeUInt8=function(e){var t=_.Buffer.alloc(1);return t.writeUInt8(e,0),this.write(t),this};Tt.prototype.writeUInt16BE=function(e){var t=_.Buffer.alloc(2);return t.writeUInt16BE(e,0),this.write(t),this};Tt.prototype.writeUInt16LE=function(e){var t=_.Buffer.alloc(2);return t.writeUInt16LE(e,0),this.write(t),this};Tt.prototype.writeUInt32BE=function(e){var t=_.Buffer.alloc(4);return t.writeUInt32BE(e,0),this.write(t),this};Tt.prototype.writeInt32LE=function(e){var t=_.Buffer.alloc(4);return t.writeInt32LE(e,0),this.write(t),this};Tt.prototype.writeUInt32LE=function(e){var t=_.Buffer.alloc(4);return t.writeUInt32LE(e,0),this.write(t),this};Tt.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this};Tt.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this};Tt.prototype.writeVarintNum=function(e){var t=Tt.varintBufNum(e);return this.write(t),this};Tt.prototype.writeVarintBN=function(e){var t=Tt.varintBufBN(e);return this.write(t),this};Tt.varintBufNum=function(e){var t;return e<253?(t=_.Buffer.alloc(1),t.writeUInt8(e,0)):e<65536?(t=_.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):e<4294967296?(t=_.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=_.Buffer.alloc(9),t.writeUInt8(255,0),t.writeInt32LE(e&-1,1),t.writeUInt32LE(Math.floor(e/4294967296),5)),t};Tt.varintBufBN=function(e){var t,r=e.toNumber();if(r<253)t=_.Buffer.alloc(1),t.writeUInt8(r,0);else if(r<65536)t=_.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(r,1);else if(r<4294967296)t=_.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(r,1);else{var i=new Tt;i.writeUInt8(255),i.writeUInt64LEBN(e),t=i.concat()}return t};bO.exports=Tt});var dv=B((j$,_O)=>{"use strict";y();var ka=mt(),Tu=at(),YU=Er();function it(e){if(!(this instanceof it))return new it(e);var t;if(ka.isNumber(e))t=e;else if(ka.isString(e))t=it.map[e];else throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');return YU.defineImmutable(this,{num:t}),this}it.fromBuffer=function(e){return Tu.checkArgument(_.Buffer.isBuffer(e)),new it(+("0x"+e.toString("hex")))};it.fromNumber=function(e){return Tu.checkArgument(ka.isNumber(e)),new it(e)};it.fromString=function(e){Tu.checkArgument(ka.isString(e));var t=it.map[e];if(typeof t>"u")throw new TypeError("Invalid opcodestr");return new it(t)};it.prototype.toHex=function(){return this.num.toString(16)};it.prototype.toBuffer=function(){return _.Buffer.from(this.toHex(),"hex")};it.prototype.toNumber=function(){return this.num};it.prototype.toString=function(){var e=it.reverseMap[this.num];if(typeof e>"u")throw new Error("Opcode does not have a string representation");return e};it.smallInt=function(e){return Tu.checkArgument(ka.isNumber(e),"Invalid Argument: n should be number"),Tu.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),e===0?it("OP_0"):new it(it.map.OP_1+e-1)};it.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_SUBSTR:179,OP_LEFT:180,OP_RIGHT:181,OP_LSHIFTNUM:182,OP_RSHIFTNUM:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};it.reverseMap=[];for(lv in it.map)it.reverseMap[it.map[lv]]=lv;var lv;ka.extend(it,it.map);it.isSmallIntOp=function(e){return e instanceof it&&(e=e.toNumber()),e===it.map.OP_0||e>=it.map.OP_1&&e<=it.map.OP_16};it.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"};_O.exports=it});var fr=B((K$,SO)=>{"use strict";y();var ps=Lr(),ZU=mt(),ar=at(),$U=Er(),Qe=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof ps)this.set({r:t,s:r});else if(t){var i=t;this.set(i)}};Qe.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=typeof e.i<"u"?e.i:this.i,this.compressed=typeof e.compressed<"u"?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this};Qe.fromCompact=function(e){ar.checkArgument(_.Buffer.isBuffer(e),"Argument is expected to be a Buffer");var t=new Qe,r=!0,i=e.slice(0,1)[0]-27-4;i<0&&(r=!1,i=i+4);var n=e.slice(1,33),o=e.slice(33,65);return ar.checkArgument(i===0||i===1||i===2||i===3,new Error("i must be 0, 1, 2, or 3")),ar.checkArgument(n.length===32,new Error("r must be 32 bytes")),ar.checkArgument(o.length===32,new Error("s must be 32 bytes")),t.compressed=r,t.i=i,t.r=ps.fromBuffer(n),t.s=ps.fromBuffer(o),t};Qe.fromDER=Qe.fromBuffer=function(e,t){var r=Qe.parseDER(e,t),i=new Qe;return i.r=r.r,i.s=r.s,i};Qe.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),i=Qe.fromDER(r,!1);return i.nhashtype=t,i};Qe.fromString=function(e){var t=_.Buffer.from(e,"hex");return Qe.fromDER(t)};function wO(e,t){ar.checkArgument(t.length>0,new Error("Length of "+e+" is zero")),ar.checkArgument(!(t[0]&128),new Error("Value of "+e+" is negative")),ar.checkArgument(!(t.length>1&&t[0]===0&&!(t[1]&128)),new Error("Value of "+e+" is excessively padded"))}Qe.parseDER=function(e,t){ar.checkArgument(_.Buffer.isBuffer(e),new Error("DER formatted signature should be a buffer")),ZU.isUndefined(t)&&(t=!0);var r=e[0];ar.checkArgument(r===48,new Error("Header byte should be 0x30"));var i=e[1],n=e.slice(2).length;ar.checkArgument(!t||i===n,new Error("Length byte should length of what follows")),i=i<n?i:n;var o=e[2];ar.checkArgument(o===2,new Error("Integer byte for r should be 0x02"));var s=e[3],f=e.slice(4,4+s),h=ps.fromBuffer(f),m=e[4]===0;ar.checkArgument(s===f.length,new Error("Length of r incorrect"));var S=e[4+s+0];ar.checkArgument(S===2,new Error("Integer byte for s should be 0x02"));var x=e[4+s+1],I=e.slice(4+s+2,4+s+2+x),T=ps.fromBuffer(I),M=e[4+s+2]===0;ar.checkArgument(x===I.length,new Error("Length of s incorrect"));var N=4+s+2+x;ar.checkArgument(i===N-2,new Error("Length of signature incorrect")),t&&(wO("r",f),wO("s",I));var D={header:r,length:i,rheader:o,rlength:s,rneg:m,rbuf:f,r:h,sheader:S,slength:x,sneg:M,sbuf:I,s:T};return D};Qe.prototype.toCompact=function(e,t){if(e=typeof e=="number"?e:this.i,t=typeof t=="boolean"?t:this.compressed,!(e===0||e===1||e===2||e===3))throw new Error("i must be equal to 0, 1, 2, or 3");var r=e+27+4;t===!1&&(r=r-4);var i=_.Buffer.from([r]),n=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return _.Buffer.concat([i,n,o])};Qe.prototype.toBuffer=Qe.prototype.toDER=function(){var e=this.r.toBuffer(),t=this.s.toBuffer(),r=!!(e[0]&128),i=!!(t[0]&128),n=r?_.Buffer.concat([_.Buffer.from([0]),e]):e,o=i?_.Buffer.concat([_.Buffer.from([0]),t]):t,s=n.length,f=o.length,h=2+s+2+f,m=2,S=2,x=48,I=_.Buffer.concat([_.Buffer.from([x,h,m,s]),n,_.Buffer.from([S,f]),o]);return I};Qe.prototype.toString=function(){var e=this.toDER();return e.toString("hex")};Qe.isTxDER=function(e){if(e.length<9||e.length>73||e[0]!==48||e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var i=e.slice(4);if(e[2]!==2||t===0||i[0]&128||t>1&&i[0]===0&&!(i[1]&128))return!1;var n=e.slice(6+t);return!(e[6+t-2]!==2||r===0||n[0]&128||r>1&&n[0]===0&&!(n[1]&128))};Qe.prototype.hasLowS=function(){return!(this.s.lt(new ps(1))||this.s.gt(new ps("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))};Qe.prototype.hasDefinedHashtype=function(){if(!$U.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&31;return!(e<Qe.SIGHASH_ALL||e>Qe.SIGHASH_SINGLE)};Qe.prototype.toTxFormat=function(){var e=this.toDER(),t=_.Buffer.alloc(1);return t.writeUInt8(this.nhashtype,0),_.Buffer.concat([e,t])};Qe.SIGHASH_ALL=1;Qe.SIGHASH_NONE=2;Qe.SIGHASH_SINGLE=3;Qe.SIGHASH_CHRONICLE=32;Qe.SIGHASH_FORKID=64;Qe.SIGHASH_ANYONECANPAY=128;Qe.prototype.isCanonical=function(){var e=Gn(),t=e.getN().shrn(1);return this.s.lte(t)};Qe.prototype.toCanonical=function(){if(this.isCanonical())return new Qe({r:this.r,s:this.s,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype});var e=Gn(),t=e.getN(),r=t.sub(this.s);return new Qe({r:this.r,s:r,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype})};Qe.prototype.validate=function(){if(!this.r||!this.s)throw new Error("Signature missing r or s component");if(this.r.isZero())throw new Error("Signature r component is zero");if(this.s.isZero())throw new Error("Signature s component is zero");var e=Gn(),t=e.getN();if(this.r.gte(t))throw new Error("Signature r component >= curve order");if(this.s.gte(t))throw new Error("Signature s component >= curve order");if(this.r.isNeg())throw new Error("Signature r component is negative");if(this.s.isNeg())throw new Error("Signature s component is negative");return!0};Qe.prototype.isValid=function(){try{return this.validate(),!0}catch{return!1}};Qe.prototype.applySecurityPatches=function(){var e=Gn(),t=e.getN(),r=t.shrn(1);if(this.r.isZero()||this.s.isZero())throw new Error("Invalid signature: zero r or s");if(this.r.gte(t)||this.s.gte(t))throw new Error("Invalid signature: out of range");if(this.s.gt(r))throw new Error("Invalid signature: non-canonical (high) s");return this};SO.exports=Qe});var vv=B((G$,IO)=>{"use strict";y();var di=ys(),XU=gu(),JU=ds(),pv=ir(),ie=dv(),vs=Gr(),gs=fr(),EO=du(),Et=at(),et=mt(),gv=jn(),xO=xt(),QU=Er(),K=function e(t){if(!(this instanceof e))return new e(t);if(this.chunks=[],_.Buffer.isBuffer(t))return e.fromBuffer(t);if(t instanceof di)return e.fromAddress(t);if(t instanceof e)return e.fromBuffer(t.toBuffer());if(et.isString(t))return e.fromString(t);et.isObject(t)&&et.isArray(t.chunks)&&this.set(t)};K.prototype.set=function(e){return Et.checkArgument(et.isObject(e)),Et.checkArgument(et.isArray(e.chunks)),this.chunks=e.chunks,this};K.fromBuffer=function(e){var t=new K;t.chunks=[];for(var r=new XU(e);!r.finished();)try{var i=r.readUInt8(),n,o;i>0&&i<ie.OP_PUSHDATA1?(n=i,t.chunks.push({buf:r.read(n),len:n,opcodenum:i})):i===ie.OP_PUSHDATA1?(n=r.readUInt8(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):i===ie.OP_PUSHDATA2?(n=r.readUInt16LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):i===ie.OP_PUSHDATA4?(n=r.readUInt32LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):t.chunks.push({opcodenum:i})}catch(s){throw s instanceof RangeError?new gv.Script.InvalidBuffer(e.toString("hex")):s}return t};K.prototype.toBuffer=function(){for(var e=new JU,t=0;t<this.chunks.length;t++){var r=this.chunks[t],i=r.opcodenum;e.writeUInt8(r.opcodenum),r.buf&&(i<ie.OP_PUSHDATA1?e.write(r.buf):i===ie.OP_PUSHDATA1?(e.writeUInt8(r.len),e.write(r.buf)):i===ie.OP_PUSHDATA2?(e.writeUInt16LE(r.len),e.write(r.buf)):i===ie.OP_PUSHDATA4&&(e.writeUInt32LE(r.len),e.write(r.buf)))}return e.concat()};K.fromASM=function(e){var t=new K;t.chunks=[];for(var r=e.split(" "),i=0;i<r.length;){var n=r[i],o=ie(n),s=o.toNumber();if(n==="0")s=0,t.chunks.push({opcodenum:s}),i=i+1;else if(n==="-1")s=ie.OP_1NEGATE,t.chunks.push({opcodenum:s}),i=i+1;else if(et.isUndefined(s)){var f=_.Buffer.from(r[i],"hex");if(f.toString("hex")!==r[i])throw new Error("invalid hex string in script");var h=f.length;h>=0&&h<ie.OP_PUSHDATA1?s=h:h<Math.pow(2,8)?s=ie.OP_PUSHDATA1:h<Math.pow(2,16)?s=ie.OP_PUSHDATA2:h<Math.pow(2,32)&&(s=ie.OP_PUSHDATA4),t.chunks.push({buf:f,len:f.length,opcodenum:s}),i=i+1}else t.chunks.push({opcodenum:s}),i=i+1}return t};K.fromHex=function(e){return new K(xO.Buffer.from(e,"hex"))};K.fromString=function(e){if(QU.isHexa(e)||e.length===0)return new K(xO.Buffer.from(e,"hex"));var t=new K;t.chunks=[];for(var r=e.split(" "),i=0;i<r.length;){var n=r[i],o=ie(n),s=o.toNumber();if(et.isUndefined(s))if(s=parseInt(n),s>0&&s<ie.OP_PUSHDATA1)t.chunks.push({buf:_.Buffer.from(r[i+1].slice(2),"hex"),len:s,opcodenum:s}),i=i+2;else throw new Error("Invalid script: "+JSON.stringify(e));else if(s===ie.OP_PUSHDATA1||s===ie.OP_PUSHDATA2||s===ie.OP_PUSHDATA4){if(r[i+2].slice(0,2)!=="0x")throw new Error("Pushdata data must start with 0x");t.chunks.push({buf:_.Buffer.from(r[i+2].slice(2),"hex"),len:parseInt(r[i+1]),opcodenum:s}),i=i+3}else t.chunks.push({opcodenum:s}),i=i+1}return t};K.prototype._chunkToString=function(e,t){var r=e.opcodenum,i=t==="asm",n="";if(e.buf)!i&&(r===ie.OP_PUSHDATA1||r===ie.OP_PUSHDATA2||r===ie.OP_PUSHDATA4)&&(n=n+" "+ie(r).toString()),e.len>0&&(i?n=n+" "+e.buf.toString("hex"):n=n+" "+e.len+" 0x"+e.buf.toString("hex"));else if(typeof ie.reverseMap[r]<"u")i?r===0?n=n+" 0":r===79?n=n+" -1":n=n+" "+ie(r).toString():n=n+" "+ie(r).toString();else{var o=r.toString(16);o.length%2!==0&&(o="0"+o),i?n=n+" "+o:n=n+" 0x"+o}return n};K.prototype.toASM=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r,"asm")}return e.substr(1)};K.prototype.toString=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r)}return e.substr(1)};K.prototype.toHex=function(){return this.toBuffer().toString("hex")};K.prototype.inspect=function(){return"<Script: "+this.toString()+">"};K.prototype.isPublicKeyHashOut=function(){return!!(this.chunks.length===5&&this.chunks[0].opcodenum===ie.OP_DUP&&this.chunks[1].opcodenum===ie.OP_HASH160&&this.chunks[2].buf&&this.chunks[2].buf.length===20&&this.chunks[3].opcodenum===ie.OP_EQUALVERIFY&&this.chunks[4].opcodenum===ie.OP_CHECKSIG)};K.prototype.isPublicKeyHashOutPrefix=function(){return!!(this.chunks.length>=5&&this.chunks[0].opcodenum===ie.OP_DUP&&this.chunks[1].opcodenum===ie.OP_HASH160&&this.chunks[2].buf&&this.chunks[2].buf.length===20&&this.chunks[3].opcodenum===ie.OP_EQUALVERIFY&&this.chunks[4].opcodenum===ie.OP_CHECKSIG)};K.prototype.isPublicKeyHashIn=function(){if(this.chunks.length===2){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&e[0]===48&&t&&t.length){var r=t[0];if((r===4||r===6||r===7)&&t.length===65)return!0;if((r===3||r===2)&&t.length===33)return!0}}return!1};K.prototype.getPublicKey=function(){return Et.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf};K.prototype.getPublicKeyHash=function(){return Et.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf};K.prototype.isPublicKeyOut=function(){if(this.chunks.length===2&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===ie.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if(((t===4||t===6||t===7)&&e.length===65||(t===3||t===2)&&e.length===33)&&(r=!0),r)return vs.isValid(e)}return!1};K.prototype.isPublicKeyIn=function(){if(this.chunks.length===1){var e=this.chunks[0].buf;if(e&&e.length&&e[0]===48)return!0}return!1};K.prototype.isScriptHashOut=function(){var e=this.toBuffer();return e.length===23&&e[0]===ie.OP_HASH160&&e[1]===20&&e[e.length-1]===ie.OP_EQUAL};K.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf;if(!t)return!1;var r;try{r=K.fromBuffer(t)}catch(n){if(n instanceof gv.Script.InvalidBuffer)return!1;throw n}var i=r.classify();return i!==K.types.UNKNOWN};K.prototype.isMultisigOut=function(){return this.chunks.length>3&&ie.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&_.Buffer.isBuffer(e.buf)})&&ie.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===ie.OP_CHECKMULTISIG};K.prototype.isMultisigIn=function(){return this.chunks.length>=2&&this.chunks[0].opcodenum===0&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&_.Buffer.isBuffer(e.buf)&&gs.isTxDER(e.buf)})};K.prototype.isDataOut=function(){var e=this.chunks.length>=1&&this.chunks[0].opcodenum===ie.OP_RETURN;if(!e)return!1;var t=this.chunks.slice(1),r=new K({chunks:t});return r.isPushOnly()};K.prototype.isSafeDataOut=function(){if(this.chunks.length<2||this.chunks[0].opcodenum!==ie.OP_FALSE)return!1;var e=this.chunks.slice(1),t=new K({chunks:e});return t.isDataOut()};K.prototype.getData=function(){if(this.isSafeDataOut()){var e=this.chunks.slice(2),t=e.map(r=>r.buf);return t}if(this.isDataOut()||this.isScriptHashOut())return et.isUndefined(this.chunks[1])?_.Buffer.alloc(0):_.Buffer.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return _.Buffer.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")};K.prototype.isPushOnly=function(){return et.every(this.chunks,function(e){return e.opcodenum<=ie.OP_16||e.opcodenum===ie.OP_PUSHDATA1||e.opcodenum===ie.OP_PUSHDATA2||e.opcodenum===ie.OP_PUSHDATA4})};K.types={};K.types.UNKNOWN="Unknown";K.types.PUBKEY_OUT="Pay to public key";K.types.PUBKEY_IN="Spend from public key";K.types.PUBKEYHASH_OUT="Pay to public key hash";K.types.PUBKEYHASH_IN="Spend from public key hash";K.types.SCRIPTHASH_OUT="Pay to script hash";K.types.SCRIPTHASH_IN="Spend from script hash";K.types.MULTISIG_OUT="Pay to multisig";K.types.MULTISIG_IN="Spend from multisig";K.types.DATA_OUT="Data push";K.types.SAFE_DATA_OUT="Safe data push";K.OP_RETURN_STANDARD_SIZE=220;K.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!==K.types.UNKNOWN?e:this.classifyInput()};K.outputIdentifiers={};K.outputIdentifiers.PUBKEY_OUT=K.prototype.isPublicKeyOut;K.outputIdentifiers.PUBKEYHASH_OUT=K.prototype.isPublicKeyHashOut;K.outputIdentifiers.MULTISIG_OUT=K.prototype.isMultisigOut;K.outputIdentifiers.SCRIPTHASH_OUT=K.prototype.isScriptHashOut;K.outputIdentifiers.DATA_OUT=K.prototype.isDataOut;K.outputIdentifiers.SAFE_DATA_OUT=K.prototype.isSafeDataOut;K.prototype.classifyOutput=function(){for(var e in K.outputIdentifiers)if(K.outputIdentifiers[e].bind(this)())return K.types[e];return K.types.UNKNOWN};K.inputIdentifiers={};K.inputIdentifiers.PUBKEY_IN=K.prototype.isPublicKeyIn;K.inputIdentifiers.PUBKEYHASH_IN=K.prototype.isPublicKeyHashIn;K.inputIdentifiers.MULTISIG_IN=K.prototype.isMultisigIn;K.inputIdentifiers.SCRIPTHASH_IN=K.prototype.isScriptHashIn;K.prototype.classifyInput=function(){for(var e in K.inputIdentifiers)if(K.inputIdentifiers[e].bind(this)())return K.types[e];return K.types.UNKNOWN};K.prototype.isStandard=function(){return this.classify()!==K.types.UNKNOWN};K.prototype.prepend=function(e){return this._addByType(e,!0),this};K.prototype.equals=function(e){if(Et.checkState(e instanceof K,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t<this.chunks.length;t++){if(_.Buffer.isBuffer(this.chunks[t].buf)&&!_.Buffer.isBuffer(e.chunks[t].buf)||_.Buffer.isBuffer(this.chunks[t].buf)&&!this.chunks[t].buf.equals(e.chunks[t].buf))return!1;if(this.chunks[t].opcodenum!==e.chunks[t].opcodenum)return!1}return!0};K.prototype.add=function(e){return this._addByType(e,!1),this};K.prototype._addByType=function(e,t){if(typeof e=="string")this._addOpcode(e,t);else if(typeof e=="number")this._addOpcode(e,t);else if(e instanceof ie)this._addOpcode(e,t);else if(_.Buffer.isBuffer(e))this._addBuffer(e,t);else if(e instanceof K)this.chunks=this.chunks.concat(e.chunks);else if(typeof e=="object")this._insertAtPosition(e,t);else throw new Error("Invalid script chunk")};K.prototype._insertAtPosition=function(e,t){t?this.chunks.unshift(e):this.chunks.push(e)};K.prototype._addOpcode=function(e,t){var r;return typeof e=="number"?r=e:e instanceof ie?r=e.toNumber():r=ie(e).toNumber(),this._insertAtPosition({opcodenum:r},t),this};K.prototype._addBuffer=function(e,t){var r,i=e.length;if(i>=0&&i<ie.OP_PUSHDATA1)r=i;else if(i<Math.pow(2,8))r=ie.OP_PUSHDATA1;else if(i<Math.pow(2,16))r=ie.OP_PUSHDATA2;else if(i<Math.pow(2,32))r=ie.OP_PUSHDATA4;else throw new Error("You can't push that much data");return this._insertAtPosition({buf:e,len:i,opcodenum:r},t),this};K.prototype.removeCodeseparators=function(){for(var e=[],t=0;t<this.chunks.length;t++)this.chunks[t].opcodenum!==ie.OP_CODESEPARATOR&&e.push(this.chunks[t]);return this.chunks=e,this};K.buildMultisigOut=function(e,t,r){Et.checkArgument(t<=e.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var i=new K;i.add(ie.smallInt(t)),e=et.map(e,vs);var n=e;r.noSorting||(n=e.map(f=>f.toString("hex")).sort().map(f=>new vs(f)));for(var o=0;o<n.length;o++){var s=n[o];i.add(s.toBuffer())}return i.add(ie.smallInt(e.length)),i.add(ie.OP_CHECKMULTISIG),i};K.buildMultisigIn=function(e,t,r,i){Et.checkArgument(et.isArray(e)),Et.checkArgument(et.isNumber(t)),Et.checkArgument(et.isArray(r)),i=i||{};var n=new K;return n.add(ie.OP_0),et.each(r,function(o){Et.checkArgument(_.Buffer.isBuffer(o),"Signatures must be an array of Buffers"),n.add(o)}),n};K.buildP2SHMultisigIn=function(e,t,r,i){Et.checkArgument(et.isArray(e)),Et.checkArgument(et.isNumber(t)),Et.checkArgument(et.isArray(r)),i=i||{};var n=new K;return n.add(ie.OP_0),et.each(r,function(o){Et.checkArgument(_.Buffer.isBuffer(o),"Signatures must be an array of Buffers"),n.add(o)}),n.add((i.cachedMultisig||K.buildMultisigOut(e,t,i)).toBuffer()),n};K.buildPublicKeyHashOut=function(e){Et.checkArgument(!et.isUndefined(e)),Et.checkArgument(e instanceof vs||e instanceof di||et.isString(e)),e instanceof vs?e=e.toAddress():et.isString(e)&&(e=new di(e));var t=new K;return t.add(ie.OP_DUP).add(ie.OP_HASH160).add(e.hashBuffer).add(ie.OP_EQUALVERIFY).add(ie.OP_CHECKSIG),t._network=e.network,t};K.buildPublicKeyOut=function(e){Et.checkArgument(e instanceof vs);var t=new K;return t.add(e.toBuffer()).add(ie.OP_CHECKSIG),t};K.buildDataOut=function(e,t){Et.checkArgument(et.isUndefined(e)||et.isString(e)||et.isArray(e)||_.Buffer.isBuffer(e));var r=e;et.isArray(r)||(r=[e]);var i=new K;i.add(ie.OP_RETURN);for(let n of r)Et.checkArgument(et.isUndefined(n)||et.isString(n)||_.Buffer.isBuffer(n)),et.isString(n)&&(n=_.Buffer.from(n,t)),et.isUndefined(n)||i.add(n);return i};K.buildSafeDataOut=function(e,t){var r=K.buildDataOut(e,t),i=new K;return i.add(ie.OP_FALSE),i.add(r),i};K.buildScriptHashOut=function(e){Et.checkArgument(e instanceof K||e instanceof di&&e.isPayToScriptHash());var t=new K;return t.add(ie.OP_HASH160).add(e instanceof di?e.hashBuffer:pv.sha256ripemd160(e.toBuffer())).add(ie.OP_EQUAL),t._network=e._network||e.network,t};K.buildPublicKeyIn=function(e,t){Et.checkArgument(e instanceof gs||_.Buffer.isBuffer(e)),Et.checkArgument(et.isUndefined(t)||et.isNumber(t)),e instanceof gs&&(e=e.toBuffer());var r=new K;return r.add(_.Buffer.concat([e,_.Buffer.from([(t||gs.SIGHASH_ALL)&255])])),r};K.buildPublicKeyHashIn=function(e,t,r){Et.checkArgument(t instanceof gs||_.Buffer.isBuffer(t)),Et.checkArgument(et.isUndefined(r)||et.isNumber(r)),t instanceof gs&&(t=t.toBuffer());var i=new K().add(_.Buffer.concat([t,_.Buffer.from([(r||gs.SIGHASH_ALL)&255])])).add(new vs(e).toBuffer());return i};K.empty=function(){return new K};K.prototype.toScriptHashOut=function(){return K.buildScriptHashOut(this)};K.fromAddress=function(e){if(e=di(e),e.isPayToScriptHash())return K.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return K.buildPublicKeyHashOut(e);throw new gv.Script.UnrecognizedAddress(e)};K.prototype.getAddressInfo=function(e){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var t=this._getOutputAddressInfo();return t||this._getInputAddressInfo()};K.prototype._getOutputAddressInfo=function(){var e={};if(this.isScriptHashOut())e.hashBuffer=this.getData(),e.type=di.PayToScriptHash;else if(this.isPublicKeyHashOut())e.hashBuffer=this.getData(),e.type=di.PayToPublicKeyHash;else return!1;return e};K.prototype._getInputAddressInfo=function(){var e={};if(this.isPublicKeyHashIn())e.hashBuffer=pv.sha256ripemd160(this.chunks[1].buf),e.type=di.PayToPublicKeyHash;else if(this.isScriptHashIn())e.hashBuffer=pv.sha256ripemd160(this.chunks[this.chunks.length-1].buf),e.type=di.PayToScriptHash;else return!1;return e};K.prototype.toAddress=function(e){var t=this.getAddressInfo();return t?(t.network=EO.get(e)||this._network||EO.defaultNetwork,new di(t)):!1};K.prototype.findAndDelete=function(e){for(var t=e.toBuffer(),r=t.toString("hex"),i=0;i<this.chunks.length;i++){var n=K({chunks:[this.chunks[i]]}),o=n.toBuffer(),s=o.toString("hex");r===s&&this.chunks.splice(i,1)}return this};K.prototype.checkMinimalPush=function(e){var t=this.chunks[e],r=t.buf,i=t.opcodenum;return r?r.length===0?i===ie.OP_0:r.length===1&&r[0]>=1&&r[0]<=16?i===ie.OP_1+(r[0]-1):r.length===1&&r[0]===129?i===ie.OP_1NEGATE:r.length<=75?i===r.length:r.length<=255?i===ie.OP_PUSHDATA1:r.length<=65535?i===ie.OP_PUSHDATA2:!0:!0};K.prototype._decodeOP_N=function(e){if(e===ie.OP_0)return 0;if(e>=ie.OP_1&&e<=ie.OP_16)return e-(ie.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))};K.prototype.getSignatureOperationsCount=function(e){e=et.isUndefined(e)?!0:e;var t=this,r=0,i=ie.OP_INVALIDOPCODE;return et.each(t.chunks,function(o){var s=o.opcodenum;s===ie.OP_CHECKSIG||s===ie.OP_CHECKSIGVERIFY?r++:(s===ie.OP_CHECKMULTISIG||s===ie.OP_CHECKMULTISIGVERIFY)&&(e&&i>=ie.OP_1&&i<=ie.OP_16?r+=t._decodeOP_N(i):r+=20),i=s}),r};IO.exports=K});var yv=B((W$,OO)=>{y();var eL=Object.prototype.toString;OO.exports=function(t){if(t===void 0)return"undefined";if(t===null)return"null";var r=typeof t;if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="number")return"number";if(r==="symbol")return"symbol";if(r==="function")return oL(t)?"generatorfunction":"function";if(tL(t))return"array";if(fL(t))return"buffer";if(aL(t))return"arguments";if(iL(t))return"date";if(rL(t))return"error";if(nL(t))return"regexp";switch(AO(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(sL(t))return"generator";switch(r=eL.call(t),r){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")};function AO(e){return typeof e.constructor=="function"?e.constructor.name:null}function tL(e){return Array.isArray?Array.isArray(e):e instanceof Array}function rL(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function iL(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function nL(e){return e instanceof RegExp?!0:typeof e.flags=="string"&&typeof e.ignoreCase=="boolean"&&typeof e.multiline=="boolean"&&typeof e.global=="boolean"}function oL(e,t){return AO(e)==="GeneratorFunction"}function sL(e){return typeof e.throw=="function"&&typeof e.return=="function"&&typeof e.next=="function"}function aL(e){try{if(typeof e.length=="number"&&typeof e.callee=="function")return!0}catch(t){if(t.message.indexOf("callee")!==-1)return!0}return!1}function fL(e){return e.constructor&&typeof e.constructor.isBuffer=="function"?e.constructor.isBuffer(e):!1}});var BO=B((Z$,TO)=>{"use strict";y();var RO=Symbol.prototype.valueOf,uL=yv();function cL(e,t){switch(uL(e)){case"array":return e.slice();case"object":return Object.assign({},e);case"date":return new e.constructor(Number(e));case"map":return new Map(e);case"set":return new Set(e);case"buffer":return pL(e);case"symbol":return gL(e);case"arraybuffer":return lL(e);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return dL(e);case"regexp":return hL(e);case"error":return Object.create(e);default:return e}}function hL(e){let t=e.flags!==void 0?e.flags:/\w+$/.exec(e)||void 0,r=new e.constructor(e.source,t);return r.lastIndex=e.lastIndex,r}function lL(e){let t=new e.constructor(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}function dL(e,t){return new e.constructor(e.buffer,e.byteOffset,e.length)}function pL(e){let t=e.length,r=_.Buffer.allocUnsafe?_.Buffer.allocUnsafe(t):_.Buffer.from(t);return e.copy(r),r}function gL(e){return RO?Object(RO.call(e)):{}}TO.exports=cL});var MO=B((X$,PO)=>{"use strict";y();PO.exports=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1}});var CO=B((Q$,NO)=>{"use strict";y();var vL=MO();function kO(e){return vL(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}NO.exports=function(t){var r,i;return!(kO(t)===!1||(r=t.constructor,typeof r!="function")||(i=r.prototype,kO(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var qO=B((tX,DO)=>{"use strict";y();var yL=BO(),mL=yv(),bL=CO();function mv(e,t){switch(mL(e)){case"object":return _L(e,t);case"array":return wL(e,t);default:return yL(e)}}function _L(e,t){if(typeof t=="function")return t(e);if(t||bL(e)){let r=new e.constructor;for(let i in e)r[i]=mv(e[i],t);return r}return e}function wL(e,t){let r=new e.constructor(e.length);for(let i=0;i<e.length;i++)r[i]=mv(e[i],t);return r}DO.exports=mv});var Bu=B((iX,FO)=>{"use strict";y();var UO=ds(),LO=gu(),SL=Lr(),pi=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t))this.buf=t;else if(typeof t=="number"){var r=t;this.fromNumber(r)}else if(t instanceof SL){var i=t;this.fromBN(i)}else if(t){var n=t;this.set(n)}};pi.prototype.set=function(e){return this.buf=e.buf||this.buf,this};pi.prototype.fromString=function(e){return this.set({buf:_.Buffer.from(e,"hex")}),this};pi.prototype.toString=function(){return this.buf.toString("hex")};pi.prototype.fromBuffer=function(e){return this.buf=e,this};pi.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this};pi.prototype.fromBN=function(e){return this.buf=UO().writeVarintBN(e).concat(),this};pi.prototype.fromNumber=function(e){return this.buf=UO().writeVarintNum(e).concat(),this};pi.prototype.toBuffer=function(){return this.buf};pi.prototype.toBN=function(){return LO(this.buf).readVarintBN()};pi.prototype.toNumber=function(){return LO(this.buf).readVarintNum()};FO.exports=pi});var En=B((oX,HO)=>{"use strict";y();var Cl=mt(),bv=Lr(),jO=xt(),Dl=Er(),EL=ds(),xL=Bu(),_v=gi(),wv=at(),IL=jn(),AL=9007199254740991;function zt(e){if(!(this instanceof zt))return new zt(e);if(Cl.isObject(e))if(this.satoshis=e.satoshis,_.Buffer.isBuffer(e.script))this._scriptBuffer=e.script;else{var t;Cl.isString(e.script)&&Dl.isHexa(e.script)?t=jO.Buffer.from(e.script,"hex"):t=e.script,this.setScript(t)}else throw new TypeError("Unrecognized argument for Output")}Object.defineProperty(zt.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}});Object.defineProperty(zt.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof bv?(this._satoshisBN=e,this._satoshis=e.toNumber()):Cl.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=bv.fromNumber(this._satoshis)):(wv.checkArgument(Dl.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=bv.fromNumber(e),this._satoshis=e),wv.checkState(Dl.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}});zt.prototype.invalidSatoshis=function(){return this._satoshis>AL?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0?"transaction txout negative":!1};Object.defineProperty(zt.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),wv.checkState(Dl.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}});zt.prototype.toObject=zt.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t};zt.fromObject=function(e){return new zt(e)};zt.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=_v.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(t instanceof IL.Script.InvalidBuffer)this._script=null;else throw t}};zt.prototype.setScript=function(e){if(e instanceof _v)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(Cl.isString(e))this._script=_v.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else if(_.Buffer.isBuffer(e))this.setScriptFromBuffer(e);else throw new TypeError("Invalid argument type: script");return this};zt.prototype.inspect=function(){var e;return this.script?e=this.script.inspect():e=this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"};zt.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return r!==0?t.script=e.read(r):t.script=jO.Buffer.from([]),new zt(t)};zt.prototype.toBufferWriter=function(e){e||(e=new EL),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e};zt.prototype.getSize=function(){var e=this.script.toBuffer().length,t=xL(e).toBuffer().length;return 8+t+e};HO.exports=zt});var Pu=B((aX,KO)=>{"use strict";y();var xr=Lr(),Ki=Gn(),OL=fr(),RL=Gr(),TL=Jf(),Qn=ir(),BL=mt(),Sv=at(),gt=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};Object.defineProperty(gt.prototype,"k",{get:function(){return this._k},set:function(e){this._k=e,this._kFresh=!0},enumerable:!0,configurable:!0});gt.prototype.set=function(e){if(this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),e.sig)if(_.Buffer.isBuffer(e.sig)){var t=fr();this.sig=t.fromDER(e.sig)}else this.sig=e.sig;else this.sig=this.sig;return e.k&&(this.k=e.k),this.verified=e.verified||this.verified,this};gt.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()};gt.prototype.calci=function(){for(var e=0;e<4;e++){this.sig.i=e;var t;try{t=this.toPublicKey()}catch(r){console.error(r);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")};gt.fromString=function(e){var t=JSON.parse(e);return new gt(t)};gt.prototype.randomK=function(){var e=Ki.getN(),t;do t=xr.fromBuffer(TL.getRandomBuffer(32));while(!(t.lt(e)&&t.gt(xr.Zero)));return this.k=t,this};gt.prototype.deterministicK=function(e){BL.isUndefined(e)&&(e=0);var t=_.Buffer.alloc(32);t.fill(1);var r=_.Buffer.alloc(32);r.fill(0);var i=this.privkey.bn.toBuffer({size:32}),n=this.endian==="little"?_.Buffer.from(this.hashbuf).reverse():this.hashbuf;r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([0]),i,n]),r),t=Qn.sha256hmac(t,r),r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([1]),i,n]),r),t=Qn.sha256hmac(t,r),t=Qn.sha256hmac(t,r);for(var o=xr.fromBuffer(t),s=Ki.getN(),f=0;f<e||!(o.lt(s)&&o.gt(xr.Zero));f++)r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([0])]),r),t=Qn.sha256hmac(t,r),t=Qn.sha256hmac(t,r),o=xr.fromBuffer(t);return this.k=o,this};gt.prototype.toPublicKey=function(){var e=this.sig.i;Sv.checkArgument(e===0||e===1||e===2||e===3,new Error("i must be equal to 0, 1, 2, or 3"));var t=xr.fromBuffer(this.hashbuf),r=this.sig.r,i=this.sig.s,n=e&1,o=e>>1,s=Ki.getN(),f=Ki.getG(),h=o?r.add(s):r,m=Ki.fromX(n,h),S=m.mul(s);if(!S.isInfinity())throw new Error("nR is not a valid curve point");var x=t.neg().umod(s),I=r.invm(s),T=m.mul(i).add(f.mul(x)).mul(I),M=RL.fromPoint(T,this.sig.compressed);return M};gt.prototype.sigError=function(){if(!_.Buffer.isBuffer(this.hashbuf)||this.hashbuf.length!==32)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s,r=Ki.getN();try{if(e.lte(xr.Zero)||t.lte(xr.Zero)||e.gte(r)||t.gte(r))return"r and s not in range";var i=xr.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),n=t.invm(r),o=n.mul(i).umod(r),s=n.mul(e).umod(r),f=Ki.getG().mulAdd(o,this.pubkey.point,s);return f.isInfinity()?"p is infinity":f.getX().umod(r).cmp(e)!==0?"Invalid signature":!1}catch(h){return"Signature security validation failed: "+h.message}};gt.toLowS=function(e){return e.gt(xr.fromBuffer(_.Buffer.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=Ki.getN().sub(e)),e};gt.prototype._findSignature=function(e,t){var r=Ki.getN(),i=Ki.getG(),n=0,o,s,f,h;do(!this.k||!this._kFresh||n>0)&&this.deterministicK(n),n++,o=this.k,s=i.mul(o),f=s.x.umod(r),h=o.invm(r).mul(t.add(e.mul(f))).umod(r);while(f.cmp(xr.Zero)<=0||h.cmp(xr.Zero)<=0);return this._kFresh=!1,h=gt.toLowS(h),{s:h,r:f}};gt.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;Sv.checkState(e&&t&&r,new Error("invalid parameters")),Sv.checkState(_.Buffer.isBuffer(e)&&e.length===32,new Error("hashbuf must be a 32 byte buffer"));var i=xr.fromBuffer(e,this.endian?{endian:this.endian}:void 0),n=this._findSignature(r,i);return n.compressed=this.pubkey.compressed,this.sig=new OL(n),this};gt.prototype.signRandomK=function(){return this.randomK(),this.sign()};gt.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)};gt.prototype.verify=function(){return this.verified=!this.sigError(),this.verified};gt.prototype.verifyBool=function(){return this.verify()===!0};gt.sign=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).sign().sig};gt.signWithCalcI=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).sign().calci().sig};gt.signRandomK=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).signRandomK().sig};gt.verify=function(e,t,r,i){return gt().set({hashbuf:e,endian:i,sig:t,pubkey:r}).verify()};KO.exports=gt});var Na=B((uX,WO)=>{"use strict";y();var eo=mt(),PL=at(),Mu=jn(),ML=ds(),Ev=xt(),GO=Er(),ql=gi(),kL=to(),VO=En(),Ul=4294967295,NL=Ul-2,zO=Ul,CL=Ul-1;function vt(e){if(!(this instanceof vt))return new vt(e);if(e)return this._fromObject(e)}vt.MAXINT=Ul;vt.DEFAULT_SEQNUMBER=zO;vt.DEFAULT_LOCKTIME_SEQNUMBER=CL;vt.DEFAULT_RBF_SEQNUMBER=NL;vt.BASE_SIZE=40;Object.defineProperty(vt.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new ql(this._scriptBuffer),this._script._isInput=!0),this._script)}});vt.fromObject=function(e){PL.checkArgument(eo.isObject(e));var t=new vt;return t._fromObject(e)};vt.prototype._fromObject=function(e){var t;if(eo.isString(e.prevTxId)&&GO.isHexa(e.prevTxId)?t=Ev.Buffer.from(e.prevTxId,"hex"):t=e.prevTxId,this.output=e.output?e.output instanceof VO?e.output:new VO(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=eo.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=eo.isUndefined(e.sequenceNumber)?eo.isUndefined(e.seqnum)?zO:e.seqnum:e.sequenceNumber,eo.isUndefined(e.script)&&eo.isUndefined(e.scriptBuffer))throw new Mu.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this};vt.prototype.toObject=vt.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t};vt.fromBufferReader=function(e){var t=new vt;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t};vt.prototype.toBufferWriter=function(e){e||(e=new ML),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e};vt.prototype.setScript=function(e){if(this._script=null,e instanceof ql)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(e===null)this._script=ql.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(GO.isHexa(e))this._scriptBuffer=Ev.Buffer.from(e,"hex");else if(eo.isString(e))this._script=new ql(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(_.Buffer.isBuffer(e))this._scriptBuffer=Ev.Buffer.from(e);else throw new TypeError("Invalid argument type: script");return this};vt.prototype.getSignatures=function(){throw new Mu.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))};vt.prototype.isFullySigned=function(){throw new Mu.AbstractMethodInvoked("Input#isFullySigned")};vt.prototype.isFinal=function(){return this.sequenceNumber===vt.MAXINT};vt.prototype.addSignature=function(){throw new Mu.AbstractMethodInvoked("Input#addSignature")};vt.prototype.clearSignatures=function(){throw new Mu.AbstractMethodInvoked("Input#clearSignatures")};vt.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,kL.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)};vt.prototype.isNull=function(){return this.prevTxId.toString("hex")==="0000000000000000000000000000000000000000000000000000000000000000"&&this.outputIndex===4294967295};vt.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length};WO.exports=vt});var Da=B((hX,$O)=>{"use strict";y();var Ca=mt(),zr=at(),DL=we(),YO=Er(),ZO=Gr(),qL=jn(),ku=fr();function vi(e){if(!(this instanceof vi))return new vi(e);if(e instanceof vi)return e;if(Ca.isObject(e))return this._fromObject(e);throw new qL.InvalidArgument("TransactionSignatures must be instantiated from an object")}DL(vi,ku);vi.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new ZO(e.publicKey),this.prevTxId=_.Buffer.isBuffer(e.prevTxId)?e.prevTxId:_.Buffer.from(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof ku?e.signature:_.Buffer.isBuffer(e.signature)?ku.fromBuffer(e.signature):ku.fromString(e.signature),this.sigtype=e.sigtype,this};vi.prototype._checkObjectArgs=function(e){zr.checkArgument(ZO(e.publicKey),"publicKey"),zr.checkArgument(!Ca.isUndefined(e.inputIndex),"inputIndex"),zr.checkArgument(!Ca.isUndefined(e.outputIndex),"outputIndex"),zr.checkState(Ca.isNumber(e.inputIndex),"inputIndex must be a number"),zr.checkState(Ca.isNumber(e.outputIndex),"outputIndex must be a number"),zr.checkArgument(e.signature,"signature"),zr.checkArgument(e.prevTxId,"prevTxId"),zr.checkState(e.signature instanceof ku||_.Buffer.isBuffer(e.signature)||YO.isHexa(e.signature),"signature must be a buffer or hexa value"),zr.checkState(_.Buffer.isBuffer(e.prevTxId)||YO.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),zr.checkArgument(e.sigtype,"sigtype"),zr.checkState(Ca.isNumber(e.sigtype),"sigtype must be a number")};vi.prototype.toObject=vi.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}};vi.fromObject=function(e){return zr.checkArgument(e),new vi(e)};$O.exports=vi});var t3=B((dX,e3)=>{"use strict";y();var UL=we(),JO=at(),xv=Na(),LL=En(),FL=to(),QO=gi(),XO=fr(),jL=Da();function xn(){xv.apply(this,arguments)}UL(xn,xv);xn.prototype.getSignatures=function(e,t,r,i){JO.checkState(this.output instanceof LL),i=i||XO.SIGHASH_ALL|XO.SIGHASH_FORKID;var n=t.toPublicKey();return n.toString()===this.output.script.getPublicKey().toString("hex")?[new jL({publicKey:n,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:FL.sign(e,t,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]};xn.prototype.addSignature=function(e,t){return JO.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(QO.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this};xn.prototype.clearSignatures=function(){return this.setScript(QO.empty()),this};xn.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()};xn.SCRIPT_MAX_SIZE=74;xn.prototype._estimateSize=function(){return xv.BASE_SIZE+xn.SCRIPT_MAX_SIZE};e3.exports=xn});var s3=B((gX,o3)=>{"use strict";y();var HL=we(),i3=at(),KL=ir(),Iv=Na(),VL=En(),GL=to(),n3=gi(),r3=fr(),zL=Da();function In(){Iv.apply(this,arguments)}HL(In,Iv);In.prototype.getSignatures=function(e,t,r,i,n){i3.checkState(this.output instanceof VL),n=n||KL.sha256ripemd160(t.publicKey.toBuffer()),i=i||r3.SIGHASH_ALL|r3.SIGHASH_FORKID;var o=this.output.script.chunks[2]&&this.output.script.chunks[2].buf;return o&&n.equals(o)?[new zL({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:GL.sign(e,t,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]};In.prototype.addSignature=function(e,t){return i3.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(n3.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this};In.prototype.clearSignatures=function(){return this.setScript(n3.empty()),this};In.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()};In.SCRIPT_MAX_SIZE=108;In.prototype._estimateSize=function(){return Iv.BASE_SIZE+In.SCRIPT_MAX_SIZE};o3.exports=In});var u3=B((yX,f3)=>{"use strict";y();var yi=mt(),WL=we(),Fl=Na(),YL=En(),Nu=at(),a3=gi(),Ll=fr(),Av=to(),Ov=Da(),ZL=Gr(),$L=Bu();function Ut(e,t,r,i){Fl.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=t.map(o=>o.toString("hex")).sort().map(o=>new ZL(o)),Nu.checkState(a3.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},yi.each(this.publicKeys,function(o,s){n.publicKeyIndex[o.toString()]=s}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}WL(Ut,Fl);Ut.prototype.toObject=function(){var e=Fl.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=yi.map(this.publicKeys,function(t){return t.toString()}),e.signatures=this._serializeSignatures(),e};Ut.prototype._deserializeSignatures=function(e){return yi.map(e,function(t){if(t)return new Ov(t)})};Ut.prototype._serializeSignatures=function(){return yi.map(this.signatures,function(e){if(e)return e.toObject()})};Ut.prototype.getSignatures=function(e,t,r,i){Nu.checkState(this.output instanceof YL),i=i||Ll.SIGHASH_ALL|Ll.SIGHASH_FORKID;var n=this,o=[];return yi.each(this.publicKeys,function(s){s.toString()===t.publicKey.toString()&&o.push(new Ov({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:Av.sign(e,t,i,r,n.output.script,n.output.satoshisBN),sigtype:i}))}),o};Ut.prototype.addSignature=function(e,t){return Nu.checkState(!this.isFullySigned(),"All needed signatures have already been added"),Nu.checkArgument(!yi.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),Nu.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this};Ut.prototype._updateScript=function(){return this.setScript(a3.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this};Ut.prototype._createSignatures=function(){return yi.map(yi.filter(this.signatures,function(e){return!yi.isUndefined(e)}),function(e){return _.Buffer.concat([e.signature.toDER(),_.Buffer.from([e.sigtype&255])])})};Ut.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()};Ut.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold};Ut.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()};Ut.prototype.countSignatures=function(){return yi.reduce(this.signatures,function(e,t){return e+!!t},0)};Ut.prototype.publicKeysWithoutSignature=function(){var e=this;return yi.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})};Ut.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,Av.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)};Ut.normalizeSignatures=function(e,t,r,i,n){return n.map(function(o){var s=null;return i=i.filter(function(f){if(s)return!0;var h=new Ov({signature:Ll.fromTxFormat(f),publicKey:o,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:Ll.SIGHASH_ALL});h.signature.nhashtype=h.sigtype;var m=Av.verify(e,h.signature,h.publicKey,h.inputIndex,t.output.script);return m?(s=h,!1):!0}),s||null})};Ut.SIGNATURE_SIZE=73;Ut.prototype._estimateSize=function(){var e=1+this.threshold*Ut.SIGNATURE_SIZE;return Fl.BASE_SIZE+$L(e).toBuffer().length+e};f3.exports=Ut});var p3=B((bX,d3)=>{"use strict";y();var mi=mt(),XL=we(),jl=Na(),JL=En(),Cu=at(),Rv=gi(),c3=fr(),h3=to(),l3=Da(),QL=Gr(),eF=Bu();function Ct(e,t,r,i){jl.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=t.map(o=>o.toString("hex")).sort().map(o=>new QL(o)),this.redeemScript=Rv.buildMultisigOut(this.publicKeys,r),Cu.checkState(Rv.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},mi.each(this.publicKeys,function(o,s){n.publicKeyIndex[o.toString()]=s}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}XL(Ct,jl);Ct.prototype.toObject=function(){var e=jl.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=mi.map(this.publicKeys,function(t){return t.toString()}),e.signatures=this._serializeSignatures(),e};Ct.prototype._deserializeSignatures=function(e){return mi.map(e,function(t){if(t)return new l3(t)})};Ct.prototype._serializeSignatures=function(){return mi.map(this.signatures,function(e){if(e)return e.toObject()})};Ct.prototype.getSignatures=function(e,t,r,i){Cu.checkState(this.output instanceof JL),i=i||c3.SIGHASH_ALL|c3.SIGHASH_FORKID;var n=this,o=[];return mi.each(this.publicKeys,function(s){s.toString()===t.publicKey.toString()&&o.push(new l3({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:h3.sign(e,t,i,r,n.redeemScript,n.output.satoshisBN),sigtype:i}))}),o};Ct.prototype.addSignature=function(e,t){return Cu.checkState(!this.isFullySigned(),"All needed signatures have already been added"),Cu.checkArgument(!mi.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),Cu.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this};Ct.prototype._updateScript=function(){return this.setScript(Rv.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this};Ct.prototype._createSignatures=function(){return mi.map(mi.filter(this.signatures,function(e){return!mi.isUndefined(e)}),function(e){return _.Buffer.concat([e.signature.toDER(),_.Buffer.from([e.sigtype&255])])})};Ct.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()};Ct.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold};Ct.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()};Ct.prototype.countSignatures=function(){return mi.reduce(this.signatures,function(e,t){return e+!!t},0)};Ct.prototype.publicKeysWithoutSignature=function(){var e=this;return mi.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})};Ct.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,h3.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript,this.output.satoshisBN)};Ct.SIGNATURE_SIZE=73;Ct.PUBKEY_SIZE=34;Ct.prototype._estimateSize=function(){var e=this.publicKeys.length*Ct.PUBKEY_SIZE,t=this.threshold*Ct.SIGNATURE_SIZE,r=3+e,i=r<=75?1:r<=255?2:3,n=t+1+i+r;return jl.BASE_SIZE+eF(n).toBuffer().length+n};d3.exports=Ct});var Hl=B((wX,qa)=>{y();qa.exports=Na();qa.exports.PublicKey=t3();qa.exports.PublicKeyHash=s3();qa.exports.MultiSig=u3();qa.exports.MultiSigScriptHash=p3()});var to=B((EX,b3)=>{"use strict";y();var tF=xt(),vr=fr(),Tv=gi(),rF=En(),iF=gu(),Du=ds(),g3=Lr(),Kl=ir(),v3=Pu(),Bv=at(),Vl=Gl(),ro=mt(),y3=_.Buffer.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),nF="ffffffffffffffff",oF=Vl.SCRIPT_ENABLE_SIGHASH_FORKID,sF=function(e,t,r,i,n){var o=e.inputs[r];Bv.checkArgument(n instanceof g3,"For ForkId=0 signatures, satoshis or complete input must be provided");function s(N){var D=new Du;ro.each(N.inputs,function(Q){D.writeReverse(Q.prevTxId),D.writeUInt32LE(Q.outputIndex)});var j=D.toBuffer(),Y=Kl.sha256sha256(j);return Y}function f(N){var D=new Du;ro.each(N.inputs,function(Q){D.writeUInt32LE(Q.sequenceNumber)});var j=D.toBuffer(),Y=Kl.sha256sha256(j);return Y}function h(N,D){var j=new Du;ro.isUndefined(D)?ro.each(N.outputs,function(W){W.toBufferWriter(j)}):N.outputs[D].toBufferWriter(j);var Y=j.toBuffer(),Q=Kl.sha256sha256(Y);return Q}var m=_.Buffer.alloc(32),S=_.Buffer.alloc(32),x=_.Buffer.alloc(32);t&vr.SIGHASH_ANYONECANPAY||(m=s(e)),!(t&vr.SIGHASH_ANYONECANPAY)&&(t&31)!==vr.SIGHASH_SINGLE&&(t&31)!==vr.SIGHASH_NONE&&(S=f(e)),(t&31)!==vr.SIGHASH_SINGLE&&(t&31)!==vr.SIGHASH_NONE?x=h(e):(t&31)===vr.SIGHASH_SINGLE&&r<e.outputs.length&&(x=h(e,r));var I=new Du;I.writeInt32LE(e.version),I.write(m),I.write(S),I.writeReverse(o.prevTxId),I.writeUInt32LE(o.outputIndex),I.writeVarintNum(i.toBuffer().length),I.write(i.toBuffer()),I.writeUInt64LEBN(n);var T=o.sequenceNumber;I.writeUInt32LE(T),I.write(x),I.writeUInt32LE(e.nLockTime),I.writeUInt32LE(t>>>0);var M=I.toBuffer();return M},m3=function(t,r,i,n,o,s){var f=Mv(),h=Hl();ro.isUndefined(s)&&(s=oF);var m=f.shallowCopy(t);if(n=new Tv(n),s&Vl.SCRIPT_ENABLE_REPLAY_PROTECTION){var S=r>>8,x=16711680|S^57005;r=x<<8|r&255}if(!(r&vr.SIGHASH_CHRONICLE&&s&Vl.SCRIPT_ENABLE_CHRONICLE)){if(r&vr.SIGHASH_FORKID&&s&Vl.SCRIPT_ENABLE_SIGHASH_FORKID)return sF(m,r,i,n,o)}n.removeCodeseparators();var I;for(I=0;I<m.inputs.length;I++)m.inputs[I]=new h(m.inputs[I]).setScript(Tv.empty());if(m.inputs[i]=new h(m.inputs[i]).setScript(n),(r&31)===vr.SIGHASH_NONE||(r&31)===vr.SIGHASH_SINGLE)for(I=0;I<m.inputs.length;I++)I!==i&&(m.inputs[I].sequenceNumber=0);if((r&31)===vr.SIGHASH_NONE)m.outputs=[];else if((r&31)===vr.SIGHASH_SINGLE){if(i>=m.outputs.length)return y3;for(m.outputs.length=i+1,I=0;I<i;I++)m.outputs[I]=new rF({satoshis:g3.fromBuffer(tF.Buffer.from(nF,"hex")),script:Tv.empty()})}r&vr.SIGHASH_ANYONECANPAY&&(m.inputs=[m.inputs[i]]);var T=new Du().write(m.toBuffer()).writeInt32LE(r).toBuffer();return T},Pv=function(t,r,i,n,o,s){var f=m3(t,r,i,n,o,s);if(f.compare(y3)===0)return f;var h=Kl.sha256sha256(f);return h=new iF(h).readReverse(),h};function aF(e,t,r,i,n,o,s){var f=Pv(e,r,i,n,o,s),h=v3.sign(f,t,"little").set({nhashtype:r});return h}function fF(e,t,r,i,n,o,s){Bv.checkArgument(!ro.isUndefined(e)),Bv.checkArgument(!ro.isUndefined(t)&&!ro.isUndefined(t.nhashtype));var f=Pv(e,t.nhashtype,i,n,o,s);return v3.verify(f,t,r,"little")}b3.exports={sighashPreimage:m3,sighash:Pv,sign:aF,verify:fF}});var kv=B((IX,w3)=>{"use strict";y();var An=mt(),zl=at(),_3=Er(),uF=gi(),cF=ys();function On(e){if(!(this instanceof On))return new On(e);zl.checkArgument(An.isObject(e),"Must provide an object from where to extract data");var t=e.address?new cF(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!_3.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var i=An.isUndefined(e.vout)?e.outputIndex:e.vout;if(!An.isNumber(i))throw new Error("Invalid outputIndex, received "+i);zl.checkArgument(!An.isUndefined(e.scriptPubKey)||!An.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var n=new uF(e.scriptPubKey||e.script);zl.checkArgument(!An.isUndefined(e.amount)||!An.isUndefined(e.satoshis),"Must provide an amount for the output");var o=An.isUndefined(e.amount)?e.satoshis:Math.round(e.amount*1e8);zl.checkArgument(An.isNumber(o),"Amount must be a number"),_3.defineImmutable(this,{address:t,txId:r,outputIndex:i,script:n,satoshis:o})}On.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"};On.prototype.toString=function(){return this.txId+":"+this.outputIndex};On.fromObject=function(e){return new On(e)};On.prototype.toObject=On.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Number.parseFloat((this.satoshis/1e8).toFixed(8))}};w3.exports=On});var Mv=B((OX,T3)=>{"use strict";y();var me=mt(),Wt=at(),hF=xt(),Ft=jn(),E3=Er(),x3=gu(),lF=ds(),S3=Bu(),I3=ir(),Yl=fr(),A3=to(),dF=ys(),O3=kv(),Lt=Hl(),pF=Lt.PublicKeyHash,gF=Lt.PublicKey,vF=Lt.MultiSigScriptHash,yF=Lt.MultiSig,bi=En(),Vi=gi(),mF=ms(),Wl=Lr(),bF=Gl(),_F=bF.SCRIPT_ENABLE_SIGHASH_FORKID;function $(e){if(!(this instanceof $))return new $(e);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof $)return $.shallowCopy(e);if(E3.isHexa(e))this.fromString(e);else if(_.Buffer.isBuffer(e))this.fromBuffer(e);else if(me.isObject(e))this.fromObject(e);else throw new Ft.InvalidArgument("Must provide an object or string to deserialize a transaction")}else this._newTransaction()}var wF=1,SF=0,EF=1e6;$.DUST_AMOUNT=546;$.FEE_SECURITY_MARGIN=150;$.MAX_MONEY=21e6*1e8;$.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8;$.NLOCKTIME_MAX_VALUE=4294967295;$.FEE_PER_KB=500;$.CHANGE_OUTPUT_MAX_SIZE=62;$.shallowCopy=function(e){var t=new $(e.toBuffer());return t};var R3={configurable:!1,enumerable:!0,get:function(){return this._hash=new x3(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty($.prototype,"hash",R3);Object.defineProperty($.prototype,"id",R3);var Nv={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty($.prototype,"inputAmount",Nv);Nv.get=function(){return this._getOutputAmount()};Object.defineProperty($.prototype,"outputAmount",Nv);$.prototype._getHash=function(){return I3.sha256sha256(this.toBuffer())};$.prototype.serialize=function(e){return e===!0||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)};$.prototype.uncheckedSerialize=$.prototype.toString=function(){return this.toBuffer().toString("hex")};$.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",t;return this.uncheckedSerialize()};$.prototype.invalidSatoshis=function(){for(var e=!1,t=0;t<this.outputs.length;t++)this.outputs[t].invalidSatoshis()&&(e=!0);return e};$.prototype.getSerializationError=function(e){if(e=e||{},this.invalidSatoshis())return new Ft.Transaction.InvalidSatoshis;var t=this._getUnspentValue(),r;return t<0?e.disableMoreOutputThanInput||(r=new Ft.Transaction.InvalidOutputAmountSum):r=this._hasFeeError(e,t),r||this._hasDustOutputs(e)||this._isMissingSignatures(e)};$.prototype._hasFeeError=function(e,t){if(!me.isUndefined(this._fee)&&this._fee!==t)return new Ft.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=Math.floor($.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new Ft.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new Ft.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}};$.prototype._missingChange=function(){return!this._changeScript};$.prototype._hasDustOutputs=function(e){if(!e.disableDustOutputs){var t,r;for(t in this.outputs)if(r=this.outputs[t],r.satoshis<$.DUST_AMOUNT&&!r.script.isDataOut()&&!r.script.isSafeDataOut())return new Ft.Transaction.DustOutputs}};$.prototype._isMissingSignatures=function(e){if(!e.disableIsFullySigned&&!this.isFullySigned())return new Ft.Transaction.MissingSignatures};$.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"};$.prototype.toBuffer=function(){var e=new lF;return this.toBufferWriter(e).toBuffer()};$.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),me.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),me.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),e};$.prototype.fromBuffer=function(e){var t=new x3(e);return this.fromBufferReader(t)};$.prototype.fromBufferReader=function(e){Wt.checkArgument(!e.finished(),"No transaction data received");var t,r,i;for(this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t<r;t++){var n=Lt.fromBufferReader(e);this.inputs.push(n)}for(i=e.readVarintNum(),t=0;t<i;t++)this.outputs.push(bi.fromBufferReader(e));return this.nLockTime=e.readUInt32LE(),this};$.prototype.toObject=$.prototype.toJSON=function(){var t=[];this.inputs.forEach(function(n){t.push(n.toObject())});var r=[];this.outputs.forEach(function(n){r.push(n.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:r,nLockTime:this.nLockTime};return this._changeScript&&(i.changeScript=this._changeScript.toString()),me.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),me.isUndefined(this._fee)||(i.fee=this._fee),i};$.prototype.fromObject=function(t){Wt.checkArgument(me.isObject(t)||t instanceof $);var r=this,i;return t instanceof $?i=t.toObject():i=t,me.each(i.inputs,function(n){if(!n.output||!n.output.script){r.uncheckedAddInput(new Lt(n));return}var o=new Vi(n.output.script),s;if(o.isPublicKeyHashOut())s=new Lt.PublicKeyHash(n);else if(o.isScriptHashOut()&&n.publicKeys&&n.threshold)s=new Lt.MultiSigScriptHash(n,n.publicKeys,n.threshold,n.signatures);else if(o.isPublicKeyOut())s=new Lt.PublicKey(n);else throw new Ft.Transaction.Input.UnsupportedScript(n.output.script);r.addInput(s)}),me.each(i.outputs,function(n){r.addOutput(new bi(n))}),i.changeIndex&&(this._changeIndex=i.changeIndex),i.changeScript&&(this._changeScript=new Vi(i.changeScript)),i.fee&&(this._fee=i.fee),this.nLockTime=i.nLockTime,this.version=i.version,this._checkConsistency(t),this};$.prototype._checkConsistency=function(e){me.isUndefined(this._changeIndex)||(Wt.checkState(this._changeScript,"Change script is expected."),Wt.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),Wt.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),e&&e.hash&&Wt.checkState(e.hash===this.hash,"Hash in object does not match transaction hash.")};$.prototype.lockUntilDate=function(e){if(Wt.checkArgument(e),me.isNumber(e)&&e<$.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new Ft.Transaction.LockTimeTooEarly;me.isDate(e)&&(e=e.getTime()/1e3);for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===Lt.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=Lt.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this};$.prototype.lockUntilBlockHeight=function(e){if(Wt.checkArgument(me.isNumber(e)),e>=$.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new Ft.Transaction.BlockHeightTooHigh;if(e<0)throw new Ft.Transaction.NLockTimeOutOfRange;for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===Lt.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=Lt.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this};$.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<$.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null};$.prototype.fromString=function(e){this.fromBuffer(hF.Buffer.from(e,"hex"))};$.prototype._newTransaction=function(){this.version=wF,this.nLockTime=SF};$.prototype.from=function(e,t,r){if(me.isArray(e)){var i=this;return me.each(e,function(o){i.from(o,t,r)}),this}var n=me.some(this.inputs,function(o){return o.prevTxId.toString("hex")===e.txId&&o.outputIndex===e.outputIndex});return n?this:(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e),this)};$.prototype._fromNonP2SH=function(e){var t;e=new O3(e),e.script.isPublicKeyHashOutPrefix()?t=pF:e.script.isPublicKeyOut()?t=gF:t=Lt,this.addInput(new t({output:new bi({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:Vi.empty()}))};$.prototype._fromMultisigUtxo=function(e,t,r){Wt.checkArgument(r<=t.length,"Number of required signatures must be greater than the number of public keys");var i;if(e=new O3(e),e.script.isMultisigOut())i=yF;else if(e.script.isScriptHashOut())i=vF;else throw new Ft.Transaction.Input.UnsupportedScript(e.script.toString());this.addInput(new i({output:new bi({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:Vi.empty()},t,r))};$.prototype.addInput=function(e,t,r){if(Wt.checkArgumentType(e,Lt,"input"),!e.output&&(me.isUndefined(t)||me.isUndefined(r)))throw new Ft.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return!e.output&&t&&!me.isUndefined(r)&&(t=t instanceof Vi?t:new Vi(t),Wt.checkArgumentType(r,"number","satoshis"),e.output=new bi({script:t,satoshis:r})),this.uncheckedAddInput(e)};$.prototype.uncheckedAddInput=function(e){return Wt.checkArgumentType(e,Lt,"input"),this.inputs.push(e),this._inputAmount=void 0,this._updateChangeOutput(),this};$.prototype.hasAllUtxoInfo=function(){return me.every(this.inputs.map(function(e){return!!e.output}))};$.prototype.fee=function(e){return Wt.checkArgument(me.isNumber(e),"amount must be a number"),this._fee=e,this._updateChangeOutput(),this};$.prototype.feePerKb=function(e){return Wt.checkArgument(me.isNumber(e),"amount must be a number"),this._feePerKb=e,this._updateChangeOutput(),this};$.prototype.change=function(e){return Wt.checkArgument(e,"address is required"),this._changeScript=Vi.fromAddress(e),this._updateChangeOutput(),this};$.prototype.getChangeOutput=function(){return me.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]};$.prototype.to=function(e,t){if(me.isArray(e)){var r=this;return me.each(e,function(i){r.to(i.address,i.satoshis)}),this}return Wt.checkArgument(E3.isNaturalNumber(t),"Amount is expected to be a positive integer"),this.addOutput(new bi({script:Vi(new dF(e)),satoshis:t})),this};$.prototype.addData=function(e){return this.addOutput(new bi({script:Vi.buildDataOut(e),satoshis:0})),this};$.prototype.addSafeData=function(e){return this.addOutput(new bi({script:Vi.buildSafeDataOut(e),satoshis:0})),this};$.prototype.addOutput=function(e){return Wt.checkArgumentType(e,bi,"output"),this._addOutput(e),this._updateChangeOutput(),this};$.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this};$.prototype._addOutput=function(e){this.outputs.push(e),this._outputAmount=void 0};$.prototype._getOutputAmount=function(){if(me.isUndefined(this._outputAmount)){var e=this;this._outputAmount=0,me.each(this.outputs,function(t){e._outputAmount+=t.satoshis})}return this._outputAmount};$.prototype._getInputAmount=function(){if(me.isUndefined(this._inputAmount)){var e=this;this._inputAmount=0,me.each(this.inputs,function(t){if(me.isUndefined(t.output))throw new Ft.Transaction.Input.MissingPreviousOutput;e._inputAmount+=t.output.satoshis})}return this._inputAmount};$.prototype._updateChangeOutput=function(){if(this._changeScript){this._clearSignatures(),me.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex),this._changeIndex=this.outputs.length,this._addOutput(new bi({script:this._changeScript,satoshis:0}));var e=this._getUnspentValue(),t=this.getFee(),r=e-t;this._removeOutput(this._changeIndex),this._changeIndex=void 0,r>=$.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new bi({script:this._changeScript,satoshis:r})))}};$.prototype.getFee=function(){return this.isCoinbase()?0:me.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee};$.prototype._estimateFee=function(){var e=this._estimateSize();return Math.ceil(e/1e3*(this._feePerKb||$.FEE_PER_KB))};$.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()};$.prototype._clearSignatures=function(){me.each(this.inputs,function(e){e.clearSignatures!==Lt.prototype.clearSignatures&&e.clearSignatures()})};$.prototype._estimateSize=function(){var e=8;return e+=S3(this.inputs.length).toBuffer().length,e+=S3(this.outputs.length).toBuffer().length,me.each(this.inputs,function(t){e+=t._estimateSize()}),me.each(this.outputs,function(t){e+=t.getSize()}),e};$.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=me.without(this.outputs,t),this._outputAmount=void 0};$.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()};$.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(r,i){return r.prevTxId.compare(i.prevTxId)||r.outputIndex-i.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(r,i){return r.satoshis-i.satoshis||r.script.toBuffer().compare(i.script.toBuffer())}),t}),this};$.prototype.shuffleOutputs=function(){return this.sortOutputs(me.shuffle)};$.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)};$.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this};$.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||me.difference(this.outputs,e).length!==0;if(t)throw new Ft.Transaction.InvalidSorting;if(!me.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=e.indexOf(r)}return this.outputs=e,this};$.prototype.removeInput=function(e,t){var r;if(!t&&me.isNumber(e)?r=e:r=me.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),r<0||r>=this.inputs.length)throw new Ft.Transaction.InvalidIndex(r,this.inputs.length);var i=this.inputs[r];this.inputs=me.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()};$.prototype.sign=function(e,t){Wt.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return me.isArray(e)?(me.each(e,function(i){r.sign(i,t)}),this):(me.each(this.getSignatures(e,t),function(i){r.applySignature(i)}),this)};$.prototype.getSignatures=function(e,t){e=new mF(e),t=t||Yl.SIGHASH_ALL|Yl.SIGHASH_FORKID;var r=this,i=[],n=I3.sha256ripemd160(e.publicKey.toBuffer());return me.each(this.inputs,function(s,f){me.each(s.getSignatures(r,e,f,t,n),function(h){i.push(h)})}),i};$.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this};$.prototype.isFullySigned=function(){return me.each(this.inputs,function(e){if(e.isFullySigned===Lt.prototype.isFullySigned)throw new Ft.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),me.every(me.map(this.inputs,function(e){return e.isFullySigned()}))};$.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===Lt.prototype.isValidSignature)throw new Ft.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(t,e)};$.prototype.verifySignature=function(e,t,r,i,n,o){return A3.verify(this,e,t,r,i,n,o)};$.prototype.verify=function(){if(this.inputs.length===0)return"transaction txins empty";if(this.outputs.length===0)return"transaction txouts empty";for(var e=new Wl(0),t=0;t<this.outputs.length;t++){var r=this.outputs[t];if(r.invalidSatoshis())return"transaction txout "+t+" satoshis is invalid";if(r._satoshisBN.gt(new Wl($.MAX_MONEY,10)))return"transaction txout "+t+" greater than MAX_MONEY";if(e=e.add(r._satoshisBN),e.gt(new Wl($.MAX_MONEY)))return"transaction txout "+t+" total output greater than MAX_MONEY"}if(this.toBuffer().length>EF)return"transaction over the maximum block size";var i={};for(t=0;t<this.inputs.length;t++){var n=this.inputs[t],o=n.prevTxId+":"+n.outputIndex;if(!me.isUndefined(i[o]))return"transaction input "+t+" duplicate input";i[o]=!0}var s=this.isCoinbase();if(s){var f=this.inputs[0]._scriptBuffer;if(f.length<2||f.length>100)return"coinbase transaction script size invalid"}else for(t=0;t<this.inputs.length;t++)if(this.inputs[t].isNull())return"transaction input "+t+" has null input";return!0};$.prototype.isCoinbase=function(){return this.inputs.length===1&&this.inputs[0].isNull()};$.prototype.sighash=function(e,t,r,i,n){t=t||Yl.SIGHASH_ALL|Yl.SIGHASH_FORKID;var o=this.inputs[e];if(!o)throw new Error("Input index "+e+" does not exist");return!r&&o.output&&(r=o.output.script),!i&&o.output&&(i=new Wl(o.output.satoshis)),n=n||_F,A3.sighash(this,t,e,r,i,n)};T3.exports=$});var Cv=B((TX,bs)=>{y();bs.exports=Mv();bs.exports.Input=Hl();bs.exports.Output=En();bs.exports.UnspentOutput=kv();bs.exports.Signature=Da();bs.exports.Sighash=to()});var Gl=B((PX,M3)=>{"use strict";y();var Zl=mt(),Uu=vv(),C=dv(),ve=Lr(),qu=ir(),_s=fr(),Dv=Gr(),B3=qO(),F=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};F.prototype.verify=function(e,t,r,i,n,o){var s=Cv();if(Zl.isUndefined(r)&&(r=new s),Zl.isUndefined(i)&&(i=0),Zl.isUndefined(n)&&(n=0),n&F.SCRIPT_ENABLE_SIGHASH_FORKID&&(n|=F.SCRIPT_VERIFY_STRICTENC,!o))throw new Error("internal error - need satoshisBN to verify FORKID transactions");this.set({script:e,tx:r,nin:i,flags:n,satoshisBN:o});var f;if((n&F.SCRIPT_VERIFY_SIGPUSHONLY)!==0&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;n&F.SCRIPT_VERIFY_P2SH&&(f=this.stack.slice());var h=this.stack;if(this.initialize(),this.set({script:t,stack:h,tx:r,nin:i,flags:n,satoshisBN:o}),!this.evaluate())return!1;if(this.stack.length===0)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var m=this.stack[this.stack.length-1];if(!F.castToBool(m))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(n&F.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(f.length===0)throw new Error("internal error - stack copy empty");var S=f[f.length-1],x=Uu.fromBuffer(S);if(f.pop(),this.initialize(),this.set({script:x,stack:f,tx:r,nin:i,flags:n,satoshisBN:o}),!this.evaluate())return!1;if(f.length===0)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!F.castToBool(f[f.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if((n&F.SCRIPT_VERIFY_CLEANSTACK)!==0){if((n&F.SCRIPT_VERIFY_P2SH)===0)throw new Error("internal error - CLEANSTACK without P2SH");if(f.length!==1)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0};M3.exports=F;F.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0};F.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=typeof e.nin<"u"?e.nin:this.nin,this.satoshisBN=e.satoshisBN||this.satoshisBN,this.stack=e.stack||this.stack,this.altstack=e.altstack||this.altstack,this.pc=typeof e.pc<"u"?e.pc:this.pc,this.pbegincodehash=typeof e.pbegincodehash<"u"?e.pbegincodehash:this.pbegincodehash,this.nOpCount=typeof e.nOpCount<"u"?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=typeof e.flags<"u"?e.flags:this.flags};F.true=_.Buffer.from([1]);F.false=_.Buffer.from([]);F.MAX_SCRIPT_ELEMENT_SIZE=520;F.MAXIMUM_ELEMENT_SIZE=4;F.MAX_OPS_PER_SCRIPT=201;F.MAX_SCRIPT_SIZE=1e4;F.LOCKTIME_THRESHOLD=5e8;F.LOCKTIME_THRESHOLD_BN=new ve(F.LOCKTIME_THRESHOLD);F.useGenesisLimits=function(e){return e=e||2147483647,F.MAX_SCRIPT_ELEMENT_SIZE=e,F.MAXIMUM_ELEMENT_SIZE=e,F.MAX_OPS_PER_SCRIPT=e,F.MAX_SCRIPT_SIZE=e,F};F.getLimits=function(){return{maxScriptElementSize:F.MAX_SCRIPT_ELEMENT_SIZE,maximumElementSize:F.MAXIMUM_ELEMENT_SIZE,maxOpsPerScript:F.MAX_OPS_PER_SCRIPT,maxScriptSize:F.MAX_SCRIPT_SIZE}};F.setLimits=function(e){return e=e||{},e.maxScriptElementSize!=null&&(F.MAX_SCRIPT_ELEMENT_SIZE=e.maxScriptElementSize),e.maximumElementSize!=null&&(F.MAXIMUM_ELEMENT_SIZE=e.maximumElementSize),e.maxOpsPerScript!=null&&(F.MAX_OPS_PER_SCRIPT=e.maxOpsPerScript),e.maxScriptSize!=null&&(F.MAX_SCRIPT_SIZE=e.maxScriptSize),F};F.SCRIPT_VERIFY_NONE=0;F.SCRIPT_VERIFY_P2SH=1;F.SCRIPT_VERIFY_STRICTENC=2;F.SCRIPT_VERIFY_DERSIG=4;F.SCRIPT_VERIFY_LOW_S=8;F.SCRIPT_VERIFY_NULLDUMMY=16;F.SCRIPT_VERIFY_SIGPUSHONLY=32;F.SCRIPT_VERIFY_MINIMALDATA=64;F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128;F.SCRIPT_VERIFY_CLEANSTACK=256;F.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512;F.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024;F.SCRIPT_VERIFY_MINIMALIF=8192;F.SCRIPT_VERIFY_NULLFAIL=16384;F.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768;F.SCRIPT_ENABLE_SIGHASH_FORKID=65536;F.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17;F.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18;F.SCRIPT_ENABLE_MAGNETIC_OPCODES=1<<19;F.SCRIPT_ENABLE_CHRONICLE=1<<20;F.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31;F.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22;F.SEQUENCE_LOCKTIME_MASK=65535;F.castToBool=function(e){for(var t=0;t<e.length;t++)if(e[t]!==0)return!(t===e.length-1&&e[t]===128);return!1};F.prototype.checkSignatureEncoding=function(e){var t;if(e.length===0)return!0;if((this.flags&(F.SCRIPT_VERIFY_DERSIG|F.SCRIPT_VERIFY_LOW_S|F.SCRIPT_VERIFY_STRICTENC))!==0&&!_s.isTxDER(e))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if((this.flags&F.SCRIPT_VERIFY_LOW_S)!==0){if(t=_s.fromTxFormat(e),!t.hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if((this.flags&F.SCRIPT_VERIFY_STRICTENC)!==0){if(t=_s.fromTxFormat(e),!t.hasDefinedHashtype())return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;if(!(this.flags&F.SCRIPT_ENABLE_SIGHASH_FORKID)&&t.nhashtype&_s.SIGHASH_FORKID)return this.errstr="SCRIPT_ERR_ILLEGAL_FORKID",!1;if(this.flags&F.SCRIPT_ENABLE_SIGHASH_FORKID&&!(t.nhashtype&_s.SIGHASH_FORKID))return this.errstr="SCRIPT_ERR_MUST_USE_FORKID",!1}return!0};F.prototype.checkPubkeyEncoding=function(e){return(this.flags&F.SCRIPT_VERIFY_STRICTENC)!==0&&!Dv.isValid(e)?(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1):!0};F._isMinimallyEncoded=function(e,t){return t=t||F.MAXIMUM_ELEMENT_SIZE,!(e.length>t||e.length>0&&(e[e.length-1]&127)===0&&(e.length<=1||(e[e.length-2]&128)===0))};F._minimallyEncode=function(e){if(e.length===0)return e;var t=e[e.length-1];if(t&127)return e;if(e.length===1)return _.Buffer.from("");if(e[e.length-2]&128)return e;for(var r=e.length-1;r>0;r--)if(e[r-1]!==0)return e[r-1]&128?e[r++]=t:e[r-1]|=t,e.slice(0,r);return _.Buffer.from("")};F.prototype.evaluate=function(){if(this.script.toBuffer().length>F.MAX_SCRIPT_SIZE)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){let t={pc:this.pc,opcode:C.fromNumber(this.script.chunks[this.pc].opcodenum)};var e=this.step();if(!e)return!1;this._callbackStep(t)}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return this.vfExec.length>0?(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1):!0};F.prototype._callbackStep=function(e){if(typeof this.stepListener=="function")try{this.stepListener(e,B3(this.stack,!0),B3(this.altstack,!0))}catch(t){console.log(`Error in Step callback:${t}`)}};F.prototype.checkLockTime=function(e){return!(!(this.tx.nLockTime<F.LOCKTIME_THRESHOLD&&e.lt(F.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=F.LOCKTIME_THRESHOLD&&e.gte(F.LOCKTIME_THRESHOLD_BN))||e.gt(new ve(this.tx.nLockTime))||this.tx.inputs[this.nin].isFinal())};F.prototype.checkSequence=function(e){var t=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2||t&F.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=F.SEQUENCE_LOCKTIME_TYPE_FLAG|F.SEQUENCE_LOCKTIME_MASK,i=new ve(t&r),n=e.and(new ve(r)),o=new ve(F.SEQUENCE_LOCKTIME_TYPE_FLAG);return!(!(i.lt(o)&&n.lt(o)||i.gte(o)&&n.gte(o))||n.gt(i))};function xF(e,t){let r=e;for(;r.length<t;)r=_.Buffer.concat([_.Buffer.from([0]),r]);return r}function P3(e){var t=_.Buffer.alloc(4);return t.writeInt32LE(e|0,0),t}F.prototype.step=function(){var e=this;function t(J){return e.stack[e.stack.length+J]}function r(J){switch(J){case C.OP_2MUL:case C.OP_2DIV:if((e.flags&F.SCRIPT_ENABLE_CHRONICLE)===0)return!0;break;case C.OP_INVERT:case C.OP_MUL:case C.OP_LSHIFT:case C.OP_RSHIFT:if((e.flags&F.SCRIPT_ENABLE_MAGNETIC_OPCODES)===0)return!0;break;case C.OP_DIV:case C.OP_MOD:case C.OP_SPLIT:case C.OP_CAT:case C.OP_AND:case C.OP_OR:case C.OP_XOR:case C.OP_BIN2NUM:case C.OP_NUM2BIN:return!1;default:break}return!1}var i=(this.flags&F.SCRIPT_VERIFY_MINIMALDATA)!==0,n=this.vfExec.indexOf(!1)===-1,o,s,f,h,m,S,x,I,T,M,N,D,j,Y,Q,W,te,ne=this.script.chunks[this.pc];this.pc++;var se=ne.opcodenum;if(Zl.isUndefined(se))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(ne.buf&&ne.buf.length>F.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(se>C.OP_16&&++this.nOpCount>F.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(r(se))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(n&&se>=0&&se<=C.OP_PUSHDATA4){if(i&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(!ne.buf)this.stack.push(F.false);else{if(ne.len!==ne.buf.length)throw new Error(`Length of push value not equal to length of data (${ne.len},${ne.buf.length})`);this.stack.push(ne.buf)}}else if(n||C.OP_IF<=se&&se<=C.OP_ENDIF)switch(se){case C.OP_1NEGATE:case C.OP_1:case C.OP_2:case C.OP_3:case C.OP_4:case C.OP_5:case C.OP_6:case C.OP_7:case C.OP_8:case C.OP_9:case C.OP_10:case C.OP_11:case C.OP_12:case C.OP_13:case C.OP_14:case C.OP_15:case C.OP_16:m=se-(C.OP_1-1),o=new ve(m).toScriptNumBuffer(),this.stack.push(o);break;case C.OP_NOP:break;case C.OP_NOP2:case C.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&F.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var ue=ve.fromScriptNumBuffer(this.stack[this.stack.length-1],i,5);if(ue.lt(new ve(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(ue))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case C.OP_NOP3:case C.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&F.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var be=ve.fromScriptNumBuffer(t(-1),i,5);if(be.lt(new ve(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if((be&F.SEQUENCE_LOCKTIME_DISABLE_FLAG)!==0)break;if(!this.checkSequence(be))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case C.OP_NOP1:case C.OP_NOP9:case C.OP_NOP10:if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case C.OP_LSHIFTNUM:case C.OP_RSHIFTNUM:if((this.flags&F.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var P=F.MAXIMUM_ELEMENT_SIZE,l=ve.fromScriptNumBuffer(t(-1),i,P);if(l.isNeg())return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop();var E=ve.fromScriptNumBuffer(t(-1),i,P);this.stack.pop();var d=l.toNumber(),a=E.isNeg(),u=E.abs(),p;if(se===C.OP_LSHIFTNUM){var b=E.toScriptNumBuffer().length;if(b+Math.floor(d/8)>P)return this.errstr="SCRIPT_ERR_SCRIPTNUM_OVERFLOW",!1;p=u.shln(d)}else p=d>=u.bitLength()?new ve(0):u.shrn(d);if(a&&!p.isZero()&&(p=p.neg()),p.toScriptNumBuffer().length>P)return this.errstr="SCRIPT_ERR_SCRIPTNUM_OVERFLOW",!1;this.stack.push(p.toScriptNumBuffer());break;case C.OP_VER:if((this.flags&F.SCRIPT_ENABLE_CHRONICLE)===0)return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1;if(this.tx==null)return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR",!1;this.stack.push(P3(this.tx.version));break;case C.OP_VERIF:case C.OP_VERNOTIF:if((this.flags&F.SCRIPT_ENABLE_CHRONICLE)===0){if(!n)break;return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}if(W=!1,n){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(this.tx==null)return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR",!1;o=t(-1),W=o.length===4&&o.equals(P3(this.tx.version)),se===C.OP_VERNOTIF&&(W=!W),this.stack.pop()}this.vfExec.push(W);break;case C.OP_IF:case C.OP_NOTIF:if(W=!1,n){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(o=t(-1),this.flags&F.SCRIPT_VERIFY_MINIMALIF){if(o.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(o.length===1&&o[0]!==1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1}W=F.castToBool(o),se===C.OP_NOTIF&&(W=!W),this.stack.pop()}this.vfExec.push(W);break;case C.OP_ELSE:if(this.vfExec.length===0)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case C.OP_ENDIF:if(this.vfExec.length===0)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case C.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(o=t(-1),W=F.castToBool(o),W)this.stack.pop();else return this.errstr="SCRIPT_ERR_VERIFY",!1;break;case C.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case C.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case C.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case C.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case C.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2),f=t(-1),this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f));break;case C.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-3),f=t(-2);var v=t(-1);this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f)),this.stack.push(_.Buffer.from(v));break;case C.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-4),f=t(-3),this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f));break;case C.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-6,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case C.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-4,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case C.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-1),W=F.castToBool(o),W&&this.stack.push(_.Buffer.from(o));break;case C.OP_DEPTH:o=new ve(this.stack.length).toScriptNumBuffer(),this.stack.push(o);break;case C.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case C.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(_.Buffer.from(t(-1)));break;case C.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case C.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(_.Buffer.from(t(-2)));break;case C.OP_PICK:case C.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(o=t(-1),I=ve.fromScriptNumBuffer(o,i),m=I.toNumber(),this.stack.pop(),m<0||m>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-m-1),se===C.OP_ROLL&&this.stack.splice(this.stack.length-m-1,1),this.stack.push(_.Buffer.from(o));break;case C.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=t(-3),x=t(-2);var c=t(-1);this.stack[this.stack.length-3]=x,this.stack[this.stack.length-2]=c,this.stack[this.stack.length-1]=S;break;case C.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=t(-2),x=t(-1),this.stack[this.stack.length-2]=x,this.stack[this.stack.length-1]=S;break;case C.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,_.Buffer.from(t(-1)));break;case C.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;I=new ve(t(-1).length),this.stack.push(I.toScriptNumBuffer());break;case C.OP_AND:case C.OP_OR:case C.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),f=t(-1),s.length!==f.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(se){case C.OP_AND:for(let J=0;J<s.length;J++)s[J]&=f[J];break;case C.OP_OR:for(let J=0;J<s.length;J++)s[J]|=f[J];break;case C.OP_XOR:for(let J=0;J<s.length;J++)s[J]^=f[J];break;default:break}this.stack.pop();break;case C.OP_INVERT:this.stack.length<1&&(this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION"),o=t(-1);for(let J=0;J<o.length;J++)o[J]=~o[J];break;case C.OP_LSHIFT:case C.OP_RSHIFT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),s.length===0)this.stack.pop();else{if(T=new ve(s),M=ve.fromScriptNumBuffer(t(-1),i),m=M.toNumber(),m<0)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),this.stack.pop();let J;se===C.OP_LSHIFT&&(J=T.ushln(m)),se===C.OP_RSHIFT&&(J=T.ushrn(m));let _e=xF(_.Buffer.from(J.toArray().slice(s.length*-1)),s.length);this.stack.push(_e)}break;case C.OP_EQUAL:case C.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2),f=t(-1);var w=s.toString("hex")===f.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(w?F.true:F.false),se===C.OP_EQUALVERIFY)if(w)this.stack.pop();else return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;break;case C.OP_2MUL:case C.OP_2DIV:case C.OP_1ADD:case C.OP_1SUB:case C.OP_NEGATE:case C.OP_ABS:case C.OP_NOT:case C.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(o=t(-1),I=ve.fromScriptNumBuffer(o,i),se){case C.OP_2MUL:I=I.mul(new ve(2));break;case C.OP_2DIV:I=I.div(new ve(2));break;case C.OP_1ADD:I=I.add(ve.One);break;case C.OP_1SUB:I=I.sub(ve.One);break;case C.OP_NEGATE:I=I.neg();break;case C.OP_ABS:I.cmp(ve.Zero)<0&&(I=I.neg());break;case C.OP_NOT:I=new ve((I.cmp(ve.Zero)===0)+0);break;case C.OP_0NOTEQUAL:I=new ve((I.cmp(ve.Zero)!==0)+0);break}this.stack.pop(),this.stack.push(I.toScriptNumBuffer());break;case C.OP_ADD:case C.OP_SUB:case C.OP_MUL:case C.OP_MOD:case C.OP_DIV:case C.OP_BOOLAND:case C.OP_BOOLOR:case C.OP_NUMEQUAL:case C.OP_NUMEQUALVERIFY:case C.OP_NUMNOTEQUAL:case C.OP_LESSTHAN:case C.OP_GREATERTHAN:case C.OP_LESSTHANOREQUAL:case C.OP_GREATERTHANOREQUAL:case C.OP_MIN:case C.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(T=ve.fromScriptNumBuffer(t(-2),i,F.MAXIMUM_ELEMENT_SIZE),M=ve.fromScriptNumBuffer(t(-1),i,F.MAXIMUM_ELEMENT_SIZE),I=new ve(0),se){case C.OP_ADD:I=T.add(M);break;case C.OP_SUB:I=T.sub(M);break;case C.OP_MUL:I=T.mul(M);break;case C.OP_DIV:if(M===0)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;I=T.div(M);break;case C.OP_MOD:if(M===0)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;I=T.mod(M);break;case C.OP_BOOLAND:I=new ve((T.cmp(ve.Zero)!==0&&M.cmp(ve.Zero)!==0)+0);break;case C.OP_BOOLOR:I=new ve((T.cmp(ve.Zero)!==0||M.cmp(ve.Zero)!==0)+0);break;case C.OP_NUMEQUAL:I=new ve((T.cmp(M)===0)+0);break;case C.OP_NUMEQUALVERIFY:I=new ve((T.cmp(M)===0)+0);break;case C.OP_NUMNOTEQUAL:I=new ve((T.cmp(M)!==0)+0);break;case C.OP_LESSTHAN:I=new ve((T.cmp(M)<0)+0);break;case C.OP_GREATERTHAN:I=new ve((T.cmp(M)>0)+0);break;case C.OP_LESSTHANOREQUAL:I=new ve((T.cmp(M)<=0)+0);break;case C.OP_GREATERTHANOREQUAL:I=new ve((T.cmp(M)>=0)+0);break;case C.OP_MIN:I=T.cmp(M)<0?T:M;break;case C.OP_MAX:I=T.cmp(M)>0?T:M;break}if(this.stack.pop(),this.stack.pop(),this.stack.push(I.toScriptNumBuffer()),se===C.OP_NUMEQUALVERIFY)if(F.castToBool(t(-1)))this.stack.pop();else return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;break;case C.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=ve.fromScriptNumBuffer(t(-3),i,F.MAXIMUM_ELEMENT_SIZE),M=ve.fromScriptNumBuffer(t(-2),i,F.MAXIMUM_ELEMENT_SIZE);var A=ve.fromScriptNumBuffer(t(-1),i,F.MAXIMUM_ELEMENT_SIZE);W=M.cmp(T)<=0&&T.cmp(A)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(W?F.true:F.false);break;case C.OP_RIPEMD160:case C.OP_SHA1:case C.OP_SHA256:case C.OP_HASH160:case C.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-1);var g;se===C.OP_RIPEMD160?g=qu.ripemd160(o):se===C.OP_SHA1?g=qu.sha1(o):se===C.OP_SHA256?g=qu.sha256(o):se===C.OP_HASH160?g=qu.sha256ripemd160(o):se===C.OP_HASH256&&(g=qu.sha256sha256(o)),this.stack.pop(),this.stack.push(g);break;case C.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case C.OP_CHECKSIG:case C.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(N=t(-2),D=t(-1),!this.checkSignatureEncoding(N)||!this.checkPubkeyEncoding(D))return!1;j=new Uu().set({chunks:this.script.chunks.slice(this.pbegincodehash)});var R=new Uu().add(N);j.findAndDelete(R);try{Y=_s.fromTxFormat(N),Q=Dv.fromBuffer(D,!1),te=this.tx.verifySignature(Y,Q,this.nin,j,this.satoshisBN,this.flags)}catch{te=!1}if(!te&&this.flags&F.SCRIPT_VERIFY_NULLFAIL&&N.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(te?F.true:F.false),se===C.OP_CHECKSIGVERIFY)if(te)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;break;case C.OP_CHECKMULTISIG:case C.OP_CHECKMULTISIGVERIFY:var U=1;if(this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var H=ve.fromScriptNumBuffer(t(-U),i).toNumber();if(H<0||H>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=H,this.nOpCount>F.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var z=++U;U+=H;var re=H+2;if(this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var oe=ve.fromScriptNumBuffer(t(-U),i).toNumber();if(oe<0||oe>H)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var k=++U;if(U+=oe,this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;j=new Uu().set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var q=0;q<oe;q++)N=t(-k-q),j.findAndDelete(new Uu().add(N));for(te=!0;te&&oe>0;){if(N=t(-k),D=t(-z),!this.checkSignatureEncoding(N)||!this.checkPubkeyEncoding(D))return!1;var L;try{Y=_s.fromTxFormat(N),Q=Dv.fromBuffer(D,!1),L=this.tx.verifySignature(Y,Q,this.nin,j,this.satoshisBN,this.flags)}catch{L=!1}L&&(k++,oe--),z++,H--,oe>H&&(te=!1)}for(;U-- >1;){if(!te&&this.flags&F.SCRIPT_VERIFY_NULLFAIL&&!re&&t(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;re>0&&re--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&F.SCRIPT_VERIFY_NULLDUMMY&&t(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(te?F.true:F.false),se===C.OP_CHECKMULTISIGVERIFY)if(te)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;break;case C.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),f=t(-1),s.length+f.length>F.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=_.Buffer.concat([s,f]),this.stack.pop();break;case C.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2);var V=ve.fromScriptNumBuffer(t(-1),i).toNumber();if(V<0||V>s.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var fe=_.Buffer.from(s);this.stack[this.stack.length-2]=fe.slice(0,V),this.stack[this.stack.length-1]=fe.slice(V);break;case C.OP_LEFT:case C.OP_RIGHT:if((this.flags&F.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),m=ve.fromScriptNumBuffer(t(-1),i,F.MAXIMUM_ELEMENT_SIZE).toNumber(),m<0||m>s.length)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),se===C.OP_LEFT?this.stack[this.stack.length-1]=_.Buffer.from(s).slice(0,m):this.stack[this.stack.length-1]=_.Buffer.from(s).slice(s.length-m);break;case C.OP_SUBSTR:if((this.flags&F.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&F.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-3);var Z=ve.fromScriptNumBuffer(t(-1),i,F.MAXIMUM_ELEMENT_SIZE).toNumber(),X=ve.fromScriptNumBuffer(t(-2),i,F.MAXIMUM_ELEMENT_SIZE).toNumber();if(X<0||X>=s.length||Z<0||Z>s.length-X)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),this.stack.pop(),this.stack[this.stack.length-1]=_.Buffer.from(s).slice(X,X+Z);break;case C.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var ge=ve.fromScriptNumBuffer(t(-1),i).toNumber();if(ge>F.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var ee=t(-1);if(ee=F._minimallyEncode(ee),ee.length>ge)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(ee.length===ge){this.stack[this.stack.length-1]=ee;break}var ae=0;ee.length>0&&(ae=ee[ee.length-1]&128,ee[ee.length-1]&=127);var ht=_.Buffer.alloc(ge);ee.copy(ht,0);for(var pe=ee.length-1;pe++<ge-2;)ht[pe]=0;ht[pe]=ae,this.stack[this.stack.length-1]=ht;break;case C.OP_BIN2NUM:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-1),f=F._minimallyEncode(s),this.stack[this.stack.length-1]=f,!F._isMinimallyEncoded(f))return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}});var gi=B((kX,qv)=>{y();qv.exports=vv();qv.exports.Interpreter=Gl()});var ys=B((CX,D3)=>{"use strict";y();var Uv=mt(),Rn=at(),IF=jn(),k3=zg(),Wr=du(),N3=ir(),C3=Er(),Lv=Gr();function ce(e,t,r){if(!(this instanceof ce))return new ce(e,t,r);if(Uv.isArray(e)&&Uv.isNumber(t))return ce.createMultisig(e,t,r);if(e instanceof ce)return e;if(Rn.checkArgument(e,"First argument is required, please include address data.","guide/address.html"),t&&!Wr.get(t))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==ce.PayToPublicKeyHash&&r!==ce.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var i=this._classifyArguments(e,t,r);return i.network=i.network||Wr.get(t)||Wr.defaultNetwork,i.type=i.type||r||ce.PayToPublicKeyHash,C3.defineImmutable(this,{hashBuffer:i.hashBuffer,network:i.network,type:i.type}),this}ce.prototype._classifyArguments=function(e,t,r){if((e instanceof _.Buffer||e instanceof Uint8Array)&&e.length===20)return ce._transformHash(e);if((e instanceof _.Buffer||e instanceof Uint8Array)&&e.length===21)return ce._transformBuffer(e,t,r);if(e instanceof Lv)return ce._transformPublicKey(e);if(e instanceof Lu())return ce._transformScript(e,t);if(typeof e=="string")return ce._transformString(e,t,r);if(Uv.isObject(e))return ce._transformObject(e);throw new TypeError("First argument is an unrecognized data format.")};ce.PayToPublicKeyHash="pubkeyhash";ce.PayToScriptHash="scripthash";ce._transformHash=function(e){var t={};if(!(e instanceof _.Buffer)&&!(e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(e.length!==20)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return t.hashBuffer=e,t};ce._transformObject=function(e){return Rn.checkArgument(e.hash||e.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),Rn.checkArgument(e.type,"Must provide a `type` property"),{hashBuffer:e.hash?_.Buffer.from(e.hash,"hex"):e.hashBuffer,network:Wr.get(e.network)||Wr.defaultNetwork,type:e.type}};ce._classifyFromVersion=function(e){var t={},r=Wr.get(e[0],"pubkeyhash"),i=Wr.get(e[0],"scripthash");return r?(t.network=r,t.type=ce.PayToPublicKeyHash):i&&(t.network=i,t.type=ce.PayToScriptHash),t};ce._transformBuffer=function(e,t,r){var i={};if(!(e instanceof _.Buffer)&&!(e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(e.length!==21)throw new TypeError("Address buffers must be exactly 21 bytes.");var n=Wr.get(t),o=ce._classifyFromVersion(e);if(t&&!n)throw new TypeError("Unknown network");if(!o.network||n&&n!==o.network)throw new TypeError("Address has mismatched network type.");if(!o.type||r&&r!==o.type)throw new TypeError("Address has mismatched type.");return i.hashBuffer=e.slice(1),i.network=o.network,i.type=o.type,i};ce._transformPublicKey=function(e){var t={};if(!(e instanceof Lv))throw new TypeError("Address must be an instance of PublicKey.");return t.hashBuffer=N3.sha256ripemd160(e.toBuffer()),t.type=ce.PayToPublicKeyHash,t};ce._transformScript=function(e,t){Rn.checkArgument(e instanceof Lu(),"script must be a Script instance");var r=e.getAddressInfo(t);if(!r)throw new IF.Script.CantDeriveAddress(e);return r};ce.createMultisig=function(e,t,r){return r=r||e[0].network||Wr.defaultNetwork,ce.payingTo(Lu().buildMultisigOut(e,t),r)};ce._transformString=function(e,t,r){if(typeof e!="string")throw new TypeError("data parameter supplied is not a string.");if(e.length<27)throw new Error("Invalid Address string provided");e=e.trim();var i=Wr.get(t);if(t&&!i)throw new TypeError("Unknown network");var n=k3.decode(e);return ce._transformBuffer(n,t,r)};ce.fromPublicKey=function(e,t){var r=ce._transformPublicKey(e);return t=t||Wr.defaultNetwork,new ce(r.hashBuffer,t,r.type)};ce.fromPrivateKey=function(e,t){let r=Lv.fromPrivateKey(e);return t=t||e.network||Wr.defaultNetwork,ce.fromPublicKey(r,t)};ce.fromPublicKeyHash=function(e,t){var r=ce._transformHash(e);return new ce(r.hashBuffer,t,ce.PayToPublicKeyHash)};ce.fromScriptHash=function(e,t){Rn.checkArgument(e,"hash parameter is required");var r=ce._transformHash(e);return new ce(r.hashBuffer,t,ce.PayToScriptHash)};ce.payingTo=function(e,t){return Rn.checkArgument(e,"script is required"),Rn.checkArgument(e instanceof Lu(),"script must be instance of Script"),ce.fromScriptHash(N3.sha256ripemd160(e.toBuffer()),t)};ce.fromScript=function(e,t){Rn.checkArgument(e instanceof Lu(),"script must be a Script instance");var r=ce._transformScript(e,t);return new ce(r.hashBuffer,t,r.type)};ce.fromBuffer=function(e,t,r){var i=ce._transformBuffer(e,t,r);return new ce(i.hashBuffer,i.network,i.type)};ce.fromHex=function(e,t,r){return ce.fromBuffer(_.Buffer.from(e,"hex"),t,r)};ce.fromString=function(e,t,r){var i=ce._transformString(e,t,r);return new ce(i.hashBuffer,i.network,i.type)};ce.fromObject=function(t){Rn.checkState(C3.isHexa(t.hash),'Unexpected hash property, "'+t.hash+'", expected to be hex.');var r=_.Buffer.from(t.hash,"hex");return new ce(r,t.network,t.type)};ce.getValidationError=function(e,t,r){var i;try{new ce(e,t,r)}catch(n){i=n}return i};ce.isValid=function(e,t,r){return!ce.getValidationError(e,t,r)};ce.prototype.isPayToPublicKeyHash=function(){return this.type===ce.PayToPublicKeyHash};ce.prototype.isPayToScriptHash=function(){return this.type===ce.PayToScriptHash};ce.prototype.toBuffer=function(){var e=_.Buffer.from([this.network[this.type]]),t=_.Buffer.concat([e,this.hashBuffer]);return t};ce.prototype.toHex=function(){return this.toBuffer().toString("hex")};ce.prototype.toObject=ce.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}};ce.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"};ce.prototype.toString=function(){return k3.encode(this.toBuffer())};D3.exports=ce;function Lu(){return gi()}});var ms=B((qX,F3)=>{"use strict";y();var $l=mt(),AF=ys(),q3=zg(),io=Lr(),U3=Er(),Gi=du(),jv=Gn(),OF=Gr(),RF=Jf(),L3=at(),Fv="[REDACTED]";function Ee(e,t){if(!(this instanceof Ee))return new Ee(e,t);if(e instanceof Ee)return e;var r=this._classifyArguments(e,t);if(!r.bn||r.bn.cmp(new io(0))===0)throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(jv.getN()))throw new TypeError("Number must be less than N");if(typeof r.network>"u")throw new TypeError('Must specify the network ("livenet" or "testnet")');return U3.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}Ee.prototype._classifyArguments=function(e,t){var r={compressed:!0,network:t?Gi.get(t):Gi.defaultNetwork};if($l.isUndefined(e)||$l.isNull(e))r.bn=Ee._getRandomBN();else if(e instanceof io)r.bn=e;else if(e instanceof _.Buffer||e instanceof Uint8Array)r=Ee._transformBuffer(e,t);else if(e.bn&&e.network)r=Ee._transformObject(e);else if(!t&&Gi.get(e))r.bn=Ee._getRandomBN(),r.network=Gi.get(e);else if(typeof e=="string")U3.isHexa(e)?r.bn=new io(_.Buffer.from(e,"hex")):r=Ee._transformWIF(e,t);else throw new TypeError("First argument is an unrecognized data type.");return r};Ee._getRandomBN=function(){var e,t;do{var r=RF.getRandomBuffer(32);t=io.fromBuffer(r),e=t.lt(jv.getN())}while(!e);return t};Ee._transformBuffer=function(e,t){var r={};if(e.length===32)return Ee._transformBNBuffer(e,t);if(r.network=Gi.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==Gi.get(t))throw new TypeError("Private key network mismatch");if(e.length===34&&e[33]===1)r.compressed=!0;else if(e.length===33)r.compressed=!1;else throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");return r.bn=io.fromBuffer(e.slice(1,33)),r};Ee._transformBNBuffer=function(e,t,r){var i={};return i.network=Gi.get(t)||Gi.defaultNetwork,i.bn=io.fromBuffer(e),i.compressed=r===void 0?!0:!!r,i};Ee._transformWIF=function(e,t){return Ee._transformBuffer(q3.decode(e),t)};Ee.fromBuffer=function(e,t,r){return r!==void 0&&e&&e.length===32?new Ee(Ee._transformBNBuffer(e,t,r)):new Ee(e,t)};Ee.fromHex=function(e,t,r){return Ee.fromBuffer(_.Buffer.from(e,"hex"),t,r)};Ee._transformObject=function(e){if(e.bn instanceof io)return{bn:e.bn,network:Gi.get(e.network),compressed:e.compressed};if(typeof e.bn!="string"||!e.bn.length)throw new TypeError("Invalid private key: `bn` must be a hex string");if(e.bn===Fv)throw new TypeError('Invalid private key: `bn` is "'+Fv+'". JSON.stringify() redacts the secret on purpose \u2014 use toObject() for a round-trippable export, or toWIF().');if(!/^[0-9a-fA-F]+$/.test(e.bn))throw new TypeError("Invalid private key: `bn` is not hexadecimal");var t=new io(e.bn,"hex");if(t.isZero()||t.gte(jv.getN()))throw new TypeError("Invalid private key: outside the range of valid keys");var r=Gi.get(e.network);return{bn:t,network:r,compressed:e.compressed}};Ee.fromString=Ee.fromWIF=function(e,t){return L3.checkArgument($l.isString(e),"First argument is expected to be a string."),new Ee(e,t)};Ee.fromObject=Ee.fromJSON=function(e){return L3.checkArgument($l.isObject(e),"First argument is expected to be an object."),new Ee(e)};Ee.fromRandom=function(e){var t=Ee._getRandomBN();return new Ee(t,e)};Ee.getValidationError=function(e,t){var r;try{new Ee(e,t)}catch(i){r=i}return r};Ee.isValid=function(e,t){return e?!Ee.getValidationError(e,t):!1};Ee.prototype.toString=function(){return this.toWIF()};Ee.prototype.toWIF=function(){var e=this.network,t=this.compressed,r;return t?r=_.Buffer.concat([_.Buffer.from([e.privatekey]),this.bn.toBuffer({size:32}),_.Buffer.from([1])]):r=_.Buffer.concat([_.Buffer.from([e.privatekey]),this.bn.toBuffer({size:32})]),q3.encode(r)};Ee.prototype.toBigNumber=function(){return this.bn};Ee.prototype.toBuffer=function(){return this.bn.toBuffer({size:32})};Ee.prototype.toHex=function(){return this.toBuffer().toString("hex")};Ee.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=OF.fromPrivateKey(this)),this._pubkey};Ee.prototype.toAddress=function(e){var t=this.toPublicKey();return AF.fromPublicKey(t,e||this.network)};Ee.prototype.toObject=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}};Ee.prototype.toJSON=function(){return{bn:Fv,compressed:this.compressed,network:this.network.toString()}};Ee.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toHex()+", network: "+this.network+e+">"};F3.exports=Ee});var Gr=B((LX,H3)=>{"use strict";y();var Ua=Lr(),La=Gn(),TF=ir(),BF=Er(),j3=du(),Hv=mt(),ws=at();function ye(e,t){if(!(this instanceof ye))return new ye(e,t);if(ws.checkArgument(e,"First argument is required, please include public key data."),e instanceof ye)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),BF.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||j3.defaultNetwork}),this}ye.prototype._classifyArgs=function(e,t){var r={compressed:Hv.isUndefined(t.compressed)||t.compressed};if(e instanceof La)r.point=e;else if(e.x&&e.y)r=ye._transformObject(e);else if(typeof e=="string")r=ye._transformDER(_.Buffer.from(e,"hex"));else if(ye._isBuffer(e))r=ye._transformDER(e);else if(ye._isPrivateKey(e))r=ye._transformPrivateKey(e);else throw new TypeError("First argument is an unrecognized data format.");return r.network||(r.network=Hv.isUndefined(t.network)?void 0:j3.get(t.network)),r};ye._isPrivateKey=function(e){var t=ms();return e instanceof t};ye._isBuffer=function(e){return e instanceof _.Buffer||e instanceof Uint8Array};ye._transformPrivateKey=function(e){ws.checkArgument(ye._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=La.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t};ye._transformDER=function(e,t){ws.checkArgument(ye._isBuffer(e),"Must be a buffer of DER encoded public key");var r={};t=Hv.isUndefined(t)?!0:t;var i,n,o,s;if(e[0]===4||!t&&(e[0]===6||e[0]===7)){if(o=e.slice(1,33),s=e.slice(33,65),o.length!==32||s.length!==32||e.length!==65)throw new TypeError("Length of x and y must be 32 bytes");i=new Ua(o),n=new Ua(s),r.point=new La(i,n),r.compressed=!1}else if(e[0]===3)o=e.slice(1),i=new Ua(o),r=ye._transformX(!0,i),r.compressed=!0;else if(e[0]===2)o=e.slice(1),i=new Ua(o),r=ye._transformX(!1,i),r.compressed=!0;else throw new TypeError("Invalid DER format public key");return r};ye._transformX=function(e,t){ws.checkArgument(typeof e=="boolean","Must specify whether y is odd or not (true or false)");var r={};return r.point=La.fromX(e,t),r};ye._transformObject=function(e){var t=new Ua(e.x,"hex"),r=new Ua(e.y,"hex"),i=new La(t,r);return new ye(i,{compressed:e.compressed})};ye.fromPrivateKey=function(e){ws.checkArgument(ye._isPrivateKey(e),"Must be an instance of PrivateKey");var t=ye._transformPrivateKey(e);return new ye(t.point,{compressed:t.compressed,network:t.network})};ye.fromDER=ye.fromBuffer=function(e,t){ws.checkArgument(ye._isBuffer(e),"Must be a buffer of DER encoded public key");var r=ye._transformDER(e,t);return new ye(r.point,{compressed:r.compressed})};ye.fromPoint=function(e,t){return ws.checkArgument(e instanceof La,"First argument must be an instance of Point."),new ye(e,{compressed:t})};ye.fromHex=ye.fromString=function(e,t){var r=_.Buffer.from(e,t||"hex"),i=ye._transformDER(r);return new ye(i.point,{compressed:i.compressed})};ye.fromX=function(e,t){var r=ye._transformX(e,t);return new ye(r.point,{compressed:r.compressed})};ye.getValidationError=function(e){var t;try{new ye(e)}catch(r){t=r}return t};ye.isValid=function(e){return!ye.getValidationError(e)};ye.prototype.toObject=ye.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}};ye.prototype.toBuffer=ye.prototype.toDER=function(){var e=this.point.getX(),t=this.point.getY(),r=e.toBuffer({size:32}),i=t.toBuffer({size:32}),n;if(this.compressed){var o=i[i.length-1]%2;return o?n=_.Buffer.from([3]):n=_.Buffer.from([2]),_.Buffer.concat([n,r])}else return n=_.Buffer.from([4]),_.Buffer.concat([n,r,i])};ye.prototype._getID=function(){return TF.sha256ripemd160(this.toBuffer())};ye.prototype.toAddress=function(e){var t=ys();return t.fromPublicKey(this,e||this.network)};ye.prototype.toString=ye.prototype.toHex=function(){return this.toDER().toString("hex")};ye.prototype.inspect=function(){return"<PublicKey: "+this.toHex()+(this.compressed?"":", uncompressed")+">"};H3.exports=ye});var Fu=B((jX,V3)=>{"use strict";y();var K3=Jf();function PF(){var e=K3.getRandomBuffer(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;var t=e.toString("hex");return[t.substring(0,8),t.substring(8,12),t.substring(12,16),t.substring(16,20),t.substring(20,32)].join("-")}function MF(e){return K3.getRandomBuffer(Math.ceil(e/2)).toString("hex").substring(0,e)}V3.exports={uuid4:PF,randomHex:MF}});var Z3=B((VX,Y3)=>{"use strict";y();var ju=Gr(),Kv=ir(),Vv=Pu(),G3=fr(),Gv=ms(),Dt=at(),KX=mt(),kF=Fu();function z3(e,t){if(t=t||{},t.issuerPublicKey)return t.issuerPublicKey instanceof ju?t.issuerPublicKey:ju.fromString(t.issuerPublicKey);var r=e&&e.issuer;if(typeof r!="string")return null;try{var i=r.split("#")[0].split(":")[2];return i?ju.fromString(i):null}catch{return null}}var Fa={PROPERTY_TITLE:"PropertyTitle",VEHICLE_TITLE:"VehicleTitle",INTELLECTUAL_PROPERTY:"IntellectualProperty",MUSIC_LICENSE:"MusicLicense",SOFTWARE_LICENSE:"SoftwareLicense",FINANCIAL_INSTRUMENT:"FinancialInstrument",PROMISSORY_NOTE:"PromissoryNote",BOND:"Bond",EQUITY_SHARE:"EquityShare",PROFESSIONAL_LICENSE:"ProfessionalLicense",REGULATORY_PERMIT:"RegulatoryPermit",ACCESS_RIGHT:"AccessRight",VOTING_RIGHT:"VotingRight",ROYALTY_RIGHT:"RoyaltyRight",USAGE_RIGHT:"UsageRight"},W3={create:function(e,t,r,i,n,o){o=o||{},Dt.checkArgument(typeof e=="string","Right type must be string"),Dt.checkArgument(typeof t=="string","Issuer DID must be string"),Dt.checkArgument(typeof r=="string","Subject DID must be string"),Dt.checkArgument(i&&typeof i=="object","Claim must be object");var s=Object.values(Fa);Dt.checkArgument(s.includes(e),"Invalid right type: "+e);var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalRightToken",e],issuer:t,issuanceDate:new Date().toISOString(),credentialSubject:{id:r,rightType:e,claim:i,jurisdiction:o.jurisdiction||"US",purpose:o.purpose||"legal_right",validFrom:o.validFrom||new Date().toISOString(),validUntil:o.validUntil||null,transferable:o.transferable!==!1,revocable:o.revocable!==!1}};return o.metadata&&(f.credentialSubject.metadata=o.metadata),f},prepareRightToken:function(e,t,r,i,n,o){o=o||{},Dt.checkArgument(typeof e=="string","Right type must be string"),Dt.checkArgument(typeof t=="string","Issuer DID must be string"),Dt.checkArgument(typeof r=="string","Subject DID must be string"),Dt.checkArgument(i&&typeof i=="object","Claim must be object"),Dt.checkArgument(n instanceof Gv,"Invalid issuer private key");var s=Object.values(Fa);Dt.checkArgument(s.includes(e),"Invalid right type: "+e);try{var f=this.create(e,t,r,i,n,o),h=this._signToken(f,n);return{success:!0,rightToken:h,tokenHash:h.tokenHash,metadata:{type:e,issuer:t,subject:r,transferable:f.credentialSubject.transferable,revocable:f.credentialSubject.revocable,jurisdiction:f.credentialSubject.jurisdiction},externalOperations:{storeToken:{endpoint:"POST /rights/tokens",data:{token:h,metadata:{type:e,issuer:t,subject:r,transferable:f.credentialSubject.transferable,revocable:f.credentialSubject.revocable,jurisdiction:f.credentialSubject.jurisdiction}}},indexToken:{endpoint:"POST /rights/index",data:{tokenId:h.id,tokenHash:h.tokenHash,type:e,issuer:t,subject:r,issuedAt:h.issuanceDate}},notifyParties:{endpoint:"POST /notifications/right-issued",data:{tokenId:h.id,issuer:t,subject:r,rightType:e}}}}}catch(m){return{success:!1,error:m.message}}},prepareRightTokenVerification:function(e,t){t=t||{};try{var r=[],i=[];this._validateTokenStructure(e,r),this._verifyTokenSignature(e,r,t),this._validateTokenTemporal(e,r,i),this._validateRightType(e,r),t.requireJurisdiction&&this._validateJurisdiction(e,t.allowedJurisdictions,r);var n={valid:r.length===0,errors:r,warnings:i,issuerDID:e.issuer,subjectDID:e.credentialSubject?e.credentialSubject.id:null,rightType:e.credentialSubject?e.credentialSubject.rightType:null,transferable:e.credentialSubject?e.credentialSubject.transferable:null,revocable:e.credentialSubject?e.credentialSubject.revocable:null,verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /rights/verification-record",data:{tokenId:e.id,result:n.valid,errors:r,warnings:i,verifiedAt:n.verifiedAt}},auditVerification:{endpoint:"POST /audit/right-verification",data:{tokenId:e.id,rightType:n.rightType,issuer:n.issuerDID,subject:n.subjectDID,result:n.valid,verifiedAt:n.verifiedAt}},updateTokenStatus:n.valid?{endpoint:"PUT /rights/tokens/"+e.id+"/status",data:{status:"VERIFIED",verifiedAt:n.verifiedAt}}:null}}}catch(o){return{success:!1,error:"Verification preparation failed: "+o.message}}},prepareRightTokenTransfer:function(e,t,r,i){i=i||{},Dt.checkArgument(e&&typeof e=="object","Invalid token"),Dt.checkArgument(typeof t=="string","New owner DID must be string"),Dt.checkArgument(r instanceof Gv,"Invalid current owner key");try{var n=this.prepareRightTokenVerification(e,{});if(!n.success||!n.verification.valid)return{success:!1,error:"Cannot transfer invalid token: "+n.verification.errors.join(", ")};if(!e.credentialSubject.transferable)return{success:!1,error:"Token is not transferable"};var o=e.credentialSubject&&e.credentialSubject.id,s=z3({issuer:o},{issuerPublicKey:i.currentOwnerPublicKey});if(!s)return{success:!1,error:"Cannot resolve current owner public key from token.credentialSubject.id; pass options.currentOwnerPublicKey"};if(r.toPublicKey().toString()!==s.toString())return{success:!1,error:"Unauthorized transfer: signing key does not match the current owner"};var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalRightTransfer"],issuer:e.credentialSubject.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:t,originalToken:e.id,transferFrom:e.credentialSubject.id,transferTo:t,transferDate:new Date().toISOString(),transferReason:i.reason||"ownership_transfer",consideration:i.consideration||null}},h=this._signToken(f,r),m=JSON.parse(JSON.stringify(e));m.id="urn:uuid:"+this._generateUUID(),m.issuanceDate=new Date().toISOString(),m.credentialSubject.id=t,m.credentialSubject.transferHistory=m.credentialSubject.transferHistory||[],m.credentialSubject.transferHistory.push({transferId:h.id,transferDate:h.issuanceDate,from:e.credentialSubject.id,to:t}),delete m.proof;var S=this._signToken(m,r);return{success:!0,newToken:S,transferProof:h,transferId:h.id,externalOperations:{recordTransfer:{endpoint:"POST /rights/transfers",data:{originalTokenId:e.id,newTokenId:S.id,transferProof:h,fromOwner:e.credentialSubject.id,toOwner:t,transferDate:h.issuanceDate}},updateOwnership:{endpoint:"PUT /rights/tokens/"+e.id+"/ownership",data:{newOwner:t,transferId:h.id,transferDate:h.issuanceDate,previousOwner:e.credentialSubject.id}},notifyParties:{endpoint:"POST /notifications/right-transferred",data:{originalTokenId:e.id,newTokenId:S.id,fromOwner:e.credentialSubject.id,toOwner:t,rightType:e.credentialSubject.rightType}},auditTransfer:{endpoint:"POST /audit/right-transfer",data:{originalTokenId:e.id,newTokenId:S.id,transferId:h.id,fromOwner:e.credentialSubject.id,toOwner:t,transferredAt:h.issuanceDate}}}}}catch(x){return{success:!1,error:x.message}}},prepareObligationToken:function(e,t,r,i){Dt.checkArgument(e&&typeof e=="object","Invalid right token"),Dt.checkArgument(typeof t=="string","Obligor DID must be string"),Dt.checkArgument(r&&typeof r=="object","Obligation must be object"),Dt.checkArgument(i instanceof Gv,"Invalid issuer key");try{var n={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalObligationToken"],issuer:e.issuer,issuanceDate:new Date().toISOString(),credentialSubject:{id:t,obligationType:"correlative_obligation",correlativeRight:e.id,rightHolder:e.credentialSubject.id,obligation:r,jurisdiction:e.credentialSubject.jurisdiction,purpose:e.credentialSubject.purpose}},o=this._signToken(n,i);return{success:!0,obligationToken:o,correlativeRight:e.id,externalOperations:{storeObligation:{endpoint:"POST /obligations/tokens",data:{obligationToken:o,correlativeRightId:e.id,obligor:t,rightHolder:e.credentialSubject.id}},linkToRight:{endpoint:"POST /rights/tokens/"+e.id+"/obligations",data:{obligationId:o.id,obligor:t,obligationType:"correlative_obligation"}},notifyObligor:{endpoint:"POST /notifications/obligation-created",data:{obligationId:o.id,obligor:t,rightHolder:e.credentialSubject.id,correlativeRight:e.id}}}}}catch(s){return{success:!1,error:s.message}}},prepareRightTypeValidation:function(e){Dt.checkArgument(typeof e=="string","Right type must be string");var t=Object.values(Fa),r=t.includes(e);return{success:!0,validation:{type:e,valid:r,availableTypes:t,category:this._categorizeRightType(e),description:this._getRightTypeDescription(e)},externalOperations:{validateType:{endpoint:"POST /rights/validate-type",data:{type:e,valid:r}}}}},_categorizeRightType:function(e){var t={PropertyTitle:"PROPERTY_RIGHT",VehicleTitle:"PROPERTY_RIGHT",IntellectualProperty:"IP_RIGHT",MusicLicense:"IP_RIGHT",SoftwareLicense:"IP_RIGHT",FinancialInstrument:"FINANCIAL_RIGHT",PromissoryNote:"FINANCIAL_RIGHT",Bond:"FINANCIAL_RIGHT",EquityShare:"FINANCIAL_RIGHT",ProfessionalLicense:"LICENSE_RIGHT",RegulatoryPermit:"LICENSE_RIGHT",AccessRight:"ACCESS_RIGHT",VotingRight:"GOVERNANCE_RIGHT",RoyaltyRight:"IP_RIGHT",UsageRight:"ACCESS_RIGHT"};return t[e]||"UNKNOWN"},_getRightTypeDescription:function(e){var t={PropertyTitle:"Legal ownership of real estate property",VehicleTitle:"Legal ownership of motor vehicle",IntellectualProperty:"Rights to intellectual property assets",MusicLicense:"License for music performance and usage",SoftwareLicense:"License for software usage and distribution",FinancialInstrument:"Rights related to financial instruments",PromissoryNote:"Promise to pay a specified amount",Bond:"Debt security representing loan",EquityShare:"Ownership stake in company",ProfessionalLicense:"License for professional practice",RegulatoryPermit:"Permit for regulated activities",AccessRight:"Right to access resources or locations",VotingRight:"Right to participate in governance",RoyaltyRight:"Right to receive royalty payments",UsageRight:"Right to use specific assets or services"};return t[e]||"Unknown right type"},getRightTypes:function(){return Fa},verifyToken:function(e,t){var r=[];try{if(Dt.checkArgument(e&&typeof e=="object","Invalid token"),!e.proof||!e.proof.jws)return r.push("Missing signature proof"),{valid:!1,errors:r};var i=t instanceof ju?t:ju.fromString(t),n=this._canonicalizeToken(e),o=Kv.sha256(_.Buffer.from(n));if(e.tokenHash&&e.tokenHash!==o.toString("hex"))return r.push("Token hash mismatch"),{valid:!1,errors:r};var s=e.proof.jws.split(".");if(s.length!==3||!s[2])return r.push("Malformed JWS"),{valid:!1,errors:r};var f=G3.fromDER(_.Buffer.from(s[2],"base64url")),h=new Vv;return h.hashbuf=o,h.sig=f,h.pubkey=i,h.verify()||r.push("Signature verification failed"),{valid:r.length===0,errors:r,tokenHash:o.toString("hex"),verifiedAt:new Date().toISOString()}}catch(m){return r.push(m.message),{valid:!1,errors:r}}},_signToken:function(e,t){var r=this._canonicalizeToken(e),i=Kv.sha256(_.Buffer.from(r)),n=new Vv;n.hashbuf=i,n.privkey=t,n.pubkey=t.toPublicKey(),n.sign();var o=n.sig,s={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:"assertionMethod",jws:this._createJWS(i,o)},f=JSON.parse(JSON.stringify(e));return f.proof=s,f.tokenHash=i.toString("hex"),f},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=t.toDER().toString("base64url");return i+".."+n},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,JSON.stringify(this._sortObjectKeys(t))},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_validateTokenStructure:function(e,t){e["@context"]||t.push("Missing @context"),e.id||t.push("Missing id"),(!e.type||!Array.isArray(e.type))&&t.push("Missing or invalid type"),e.issuer||t.push("Missing issuer"),e.issuanceDate||t.push("Missing issuanceDate"),e.credentialSubject||t.push("Missing credentialSubject"),e.proof||t.push("Missing proof")},_verifyTokenSignature:function(e,t,r){try{if(!e.proof||!e.proof.jws){t.push("Missing signature proof");return}var i=this._canonicalizeToken(e),n=Kv.sha256(_.Buffer.from(i));if(e.tokenHash&&e.tokenHash!==n.toString("hex")){t.push("Token hash mismatch");return}var o=z3(e,r);if(!o){t.push("Signature not verified: issuer public key could not be resolved from token.issuer; pass options.issuerPublicKey");return}var s=e.proof.jws.split(".");if(s.length!==3||!s[2]){t.push("Malformed JWS");return}var f=G3.fromDER(_.Buffer.from(s[2],"base64url")),h=new Vv;h.hashbuf=n,h.sig=f,h.pubkey=o,h.verify()!==!0&&t.push("Signature verification failed")}catch(m){t.push("Signature verification failed: "+m.message)}},_validateTokenTemporal:function(e,t,r){var i=new Date,n=new Date(e.issuanceDate);if(n>i&&t.push("Token issued in the future"),e.credentialSubject.validFrom){var o=new Date(e.credentialSubject.validFrom);i<o&&r.push("Token not yet valid")}if(e.credentialSubject.validUntil){var s=new Date(e.credentialSubject.validUntil);i>s&&t.push("Token expired")}},_validateRightType:function(e,t){if(!e.credentialSubject.rightType){t.push("Missing rightType");return}var r=Object.values(Fa);r.includes(e.credentialSubject.rightType)||t.push("Invalid right type: "+e.credentialSubject.rightType)},_validateJurisdiction:function(e,t,r){if(!e.credentialSubject.jurisdiction){r.push("Missing jurisdiction");return}t&&Array.isArray(t)&&(t.includes(e.credentialSubject.jurisdiction)||r.push("Jurisdiction not allowed: "+e.credentialSubject.jurisdiction))},_generateUUID:function(){return kF.uuid4()}};W3.RightTypes=Fa;Y3.exports=W3});var X3=B((zX,$3)=>{"use strict";y();var Hu=ir(),Ir=at(),NF=Fu(),Ss={PropertyTitle:{title:"Property Title",description:"Real estate property ownership title",type:"object",required:["propertyId","address","ownershipType"],properties:{propertyId:{type:"string",description:"Unique property identifier"},address:{type:"object",required:["street","city","state","country"],properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"string"},postalCode:{type:"string"}}},ownershipType:{type:"string",enum:["fee_simple","leasehold","joint_tenancy","tenancy_in_common"]},titleNumber:{type:"string"},registeredDate:{type:"string",format:"date-time"},legalDescription:{type:"string"},encumbrances:{type:"array",items:{type:"object",properties:{type:{type:"string"},amount:{type:"number"},description:{type:"string"}}}}}},VehicleTitle:{title:"Vehicle Title",description:"Motor vehicle ownership title",type:"object",required:["vin","make","model","year"],properties:{vin:{type:"string",pattern:"^[A-HJ-NPR-Z0-9]{17}$",description:"Vehicle Identification Number"},make:{type:"string"},model:{type:"string"},year:{type:"integer",minimum:1900,maximum:2030},titleNumber:{type:"string"},registeredState:{type:"string"},mileage:{type:"integer",minimum:0},color:{type:"string"},fuelType:{type:"string",enum:["gasoline","diesel","electric","hybrid","other"]},liens:{type:"array",items:{type:"object",properties:{lienholderName:{type:"string"},lienAmount:{type:"number"},lienDate:{type:"string",format:"date"}}}}}},PromissoryNote:{title:"Promissory Note",description:"Legal promise to pay a specified amount",type:"object",required:["principal","interestRate","maturityDate","borrower","lender"],properties:{principalAmount:{type:"number",minimum:0,description:"Principal amount in base currency units"},currency:{type:"string",default:"USD"},interestRate:{type:"number",minimum:0,maximum:100,description:"Annual interest rate percentage"},maturityDate:{type:"string",format:"date",description:"Date when principal and interest are due"},payee:{type:"string",description:"DID of the payee (creditor)"},payor:{type:"string",description:"DID of the payor (debtor)"},paymentSchedule:{type:"string",enum:["lump_sum","monthly","quarterly","annually"]},collateral:{type:"array",items:{type:"object",properties:{description:{type:"string"},value:{type:"number"},type:{type:"string"}}}},defaultProvisions:{type:"string"},governingLaw:{type:"string"}}},IntellectualProperty:{title:"Intellectual Property",description:"Intellectual property rights and licensing",type:"object",required:["ipType","title","registrationNumber"],properties:{ipType:{type:"string",enum:["patent","trademark","copyright","trade_secret"]},title:{type:"string"},creator:{type:"string",description:"Creator DID"},registrationNumber:{type:"string"},registrationDate:{type:"string",format:"date"},expirationDate:{type:"string",format:"date"},jurisdiction:{type:"string"},description:{type:"string"},claims:{type:"array",items:{type:"string"}},priorArt:{type:"array",items:{type:"object",properties:{reference:{type:"string"},date:{type:"string",format:"date"},relevance:{type:"string"}}}}}},ProfessionalLicense:{title:"Professional License",description:"Professional practice license or certification",type:"object",required:["licenseType","licenseNumber","issuingAuthority","expirationDate"],properties:{licenseType:{type:"string"},licenseNumber:{type:"string"},issuingAuthority:{type:"string"},licensee:{type:"string",description:"Licensee DID"},issueDate:{type:"string",format:"date"},expirationDate:{type:"string",format:"date"},renewalDate:{type:"string",format:"date"},jurisdiction:{type:"string"},scope:{type:"string"},restrictions:{type:"array",items:{type:"string"}},continuing_education:{type:"object",properties:{hours_required:{type:"integer"},deadline:{type:"string",format:"date"},completed_hours:{type:"integer"}}}}},MusicLicense:{title:"Music License",description:"Music performance and usage licensing",type:"object",required:["songTitle","artist","licenseType","royaltyRate"],properties:{workTitle:{type:"string"},composer:{type:"string",description:"Composer DID"},performer:{type:"string",description:"Performer DID"},licenseType:{type:"string",enum:["mechanical","performance","synchronization","master_use"]},territory:{type:"string"},duration:{type:"string"},royaltyRate:{type:"number",minimum:0,maximum:100},advancePayment:{type:"number",minimum:0},exclusivity:{type:"boolean"},mediaTypes:{type:"array",items:{type:"string",enum:["cd","vinyl","digital","streaming","broadcast","film","tv"]}},usage_restrictions:{type:"string"},copyrightNotice:{type:"string"}}}},CF={prepareClaimValidation:function(e,t){try{Ir.checkArgument(e&&typeof e=="object","Invalid claim"),Ir.checkArgument(typeof t=="string","Schema name must be string");var r=Ss[t];if(!r)return{success:!1,error:"Unknown schema: "+t};var i=[],n=[];this._validateObject(e,r,"",i,n);var o={valid:i.length===0,errors:i,warnings:n,schema:t,claimHash:this.hash(e),canonical:this.canonicalize(e)};return{success:!0,validation:o,claim:e,schema:r,externalOperations:{store:{endpoint:"POST /claims/validate",data:{claim:e,validation:o,schema:t}},index:{endpoint:"POST /claims/index",data:{claimHash:o.claimHash,schemaName:t,valid:o.valid}}}}}catch(s){return{success:!1,error:"Validation preparation failed: "+s.message}}},prepareClaimAttestation:function(e,t,r){try{Ir.checkArgument(e&&typeof e=="object","Invalid claim"),Ir.checkArgument(typeof t=="string","Schema name must be string"),Ir.checkArgument(r&&typeof r=="object","Invalid attestor");var i=this.prepareClaimValidation(e,t);if(!i.success||!i.validation.valid)return{success:!1,error:"Cannot attest invalid claim",validation:i};var n={type:"LTP_CLAIM_ATTESTATION",claimHash:i.validation.claimHash,schemaName:t,attestor:{did:r.did||r.id,name:r.name||"Unknown",authority:r.authority||null,jurisdiction:r.jurisdiction||null},attestedAt:new Date().toISOString(),confidence:r.confidence||100,evidence:r.evidence||null,notes:r.notes||null},o=Hu.sha256(_.Buffer.from(this.canonicalize(n))).toString("hex");return n.attestationHash=o,{success:!0,attestation:n,claim:e,validation:i.validation,externalOperations:{storeAttestation:{endpoint:"POST /claims/"+i.validation.claimHash+"/attestations",data:n},notifyStakeholders:{endpoint:"POST /notifications/claim-attested",data:{claimHash:i.validation.claimHash,attestorDid:n.attestor.did,attestationHash:o}}}}}catch(s){return{success:!1,error:"Attestation preparation failed: "+s.message}}},prepareClaimDispute:function(e,t,r){try{Ir.checkArgument(typeof e=="string","Claim hash must be string"),Ir.checkArgument(t&&typeof t=="object","Invalid disputant"),Ir.checkArgument(r&&typeof r=="object","Invalid dispute");var i={type:"LTP_CLAIM_DISPUTE",claimHash:e,disputant:{did:t.did||t.id,name:t.name||"Unknown",jurisdiction:t.jurisdiction||null},dispute:{reason:r.reason||"UNSPECIFIED",category:r.category||"ACCURACY",description:r.description||"",evidence:r.evidence||null,requestedAction:r.requestedAction||"REVIEW"},disputedAt:new Date().toISOString(),status:"FILED",priority:r.priority||"NORMAL"},n=Hu.sha256(_.Buffer.from(this.canonicalize(i))).toString("hex");return i.disputeHash=n,{success:!0,dispute:i,disputeId:this._generateDisputeId(e),externalOperations:{fileDispute:{endpoint:"POST /claims/"+e+"/disputes",data:i},notifyStakeholders:{endpoint:"POST /notifications/claim-disputed",data:{claimHash:e,disputantDid:i.disputant.did,disputeHash:n}},escalate:{endpoint:"POST /disputes/escalate",data:{disputeHash:n,priority:i.priority}}}}}catch(o){return{success:!1,error:"Dispute preparation failed: "+o.message}}},prepareBulkClaimValidation:function(e,t){try{Ir.checkArgument(Array.isArray(e),"Claims must be array"),Ir.checkArgument(typeof t=="string","Schema name must be string");var r=[],i=[],n=0;e.forEach(function(f,h){try{var m=this.prepareClaimValidation(f,t);m.success&&m.validation.valid&&n++,r.push({index:h,result:m})}catch(S){i.push({index:h,error:S.message})}}.bind(this));var o=this._generateBatchId(),s=Hu.sha256(_.Buffer.from(JSON.stringify(r.map(f=>f.result.validation.claimHash)))).toString("hex");return{success:!0,batchId:o,batchHash:s,totalClaims:e.length,validClaims:n,invalidClaims:e.length-n,validations:r,errors:i,externalOperations:{storeBatch:{endpoint:"POST /claims/batch-validate",data:{batchId:o,batchHash:s,schemaName:t,validations:r}},generateReport:{endpoint:"POST /reports/bulk-validation",data:{batchId:o,summary:{total:e.length,valid:n,invalid:e.length-n}}}}}}catch(f){return{success:!1,error:"Bulk validation preparation failed: "+f.message}}},canonicalize:function(e){Ir.checkArgument(e&&typeof e=="object","Invalid claim");var t=this._sortObjectKeys(e);return JSON.stringify(t)},hash:function(e){var t=this.canonicalize(e);return Hu.sha256(_.Buffer.from(t)).toString("hex")},prepareClaimTemplate:function(e,t){t=t||{};try{var r=Ss[e];if(!r)return{success:!1,error:"Unknown schema: "+e};var i=this._createTemplateFromSchema(r),n=this._generateFormStructure(r);return{success:!0,schemaName:e,template:i,schema:r,formStructure:n,validation:{required:r.required||[],patterns:this._extractPatterns(r),enums:this._extractEnums(r)},externalOperations:{generateForm:{endpoint:"POST /forms/generate",data:{schemaName:e,formStructure:n,template:i}},saveTemplate:{endpoint:"POST /templates/claim",data:{schemaName:e,template:i,customizations:t.customizations||{}}}}}}catch(o){return{success:!1,error:"Template preparation failed: "+o.message}}},getSchemas:function(){return Ss},getSchemaNames:function(){return Object.keys(Ss)},getSchema:function(e){return Ss[e]||null},addSchema:function(e,t){Ir.checkArgument(typeof e=="string","Schema name must be string"),Ir.checkArgument(t&&typeof t=="object","Invalid schema"),Ss[e]=t},createTemplate:function(e){var t=Ss[e];if(!t)throw new Error("Unknown schema: "+e);return this._createTemplateFromSchema(t)},_generateDisputeId:function(e){var t="dispute_"+e+"_"+Date.now();return Hu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_generateBatchId:function(){return NF.randomHex(16)},_generateFormStructure:function(e){var t={type:"form",title:e.title||"Legal Claim Form",description:e.description||"",fields:[]};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r],n={name:r,label:this._humanizeFieldName(r),type:this._mapSchemaTypeToFormType(i),required:e.required&&e.required.includes(r),validation:this._extractFieldValidation(i)};i.enum&&(n.options=i.enum.map(function(o){return{value:o,label:this._humanizeValue(o)}}.bind(this))),t.fields.push(n)}.bind(this)),t},_extractPatterns:function(e){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];i.pattern&&(t[r]=i.pattern)}),t},_extractEnums:function(e){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];i.enum&&(t[r]=i.enum)}),t},_mapSchemaTypeToFormType:function(e){switch(e.type){case"string":return e.enum?"select":e.format==="date"?"date":e.format==="date-time"?"datetime":"text";case"number":case"integer":return"number";case"boolean":return"checkbox";case"array":return"list";case"object":return"fieldset";default:return"text"}},_extractFieldValidation:function(e){var t={};return e.pattern&&(t.pattern=e.pattern),e.minimum!==void 0&&(t.min=e.minimum),e.maximum!==void 0&&(t.max=e.maximum),e.format&&(t.format=e.format),t},_humanizeFieldName:function(e){return e.replace(/([A-Z])/g," $1").replace(/^./,function(t){return t.toUpperCase()}).replace(/_/g," ")},_humanizeValue:function(e){return e.replace(/_/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})},_validateObject:function(e,t,r,i,n){t.type==="object"?(t.required&&Array.isArray(t.required)&&t.required.forEach(function(o){e.hasOwnProperty(o)||i.push("Missing required field: "+this._getFieldPath(r,o))}.bind(this)),t.properties&&Object.keys(e).forEach(function(o){var s=this._getFieldPath(r,o),f=t.properties[o];f?this._validateValue(e[o],f,s,i,n):n.push("Unknown field: "+s)}.bind(this))):this._validateValue(e,t,r,i,n)},_validateValue:function(e,t,r,i,n){if(t.type){var o=Array.isArray(e)?"array":typeof e;if(o!==t.type){i.push("Invalid type for "+r+": expected "+t.type+", got "+o);return}}if(t.type==="string"&&(t.pattern&&!new RegExp(t.pattern).test(e)&&i.push("Value does not match pattern for "+r),t.enum&&!t.enum.includes(e)&&i.push("Invalid enum value for "+r+": "+e),t.format==="date"&&!this._isValidDate(e)&&i.push("Invalid date format for "+r),t.format==="date-time"&&!this._isValidDateTime(e)&&i.push("Invalid date-time format for "+r)),(t.type==="number"||t.type==="integer")&&(t.minimum!==void 0&&e<t.minimum&&i.push("Value below minimum for "+r+": "+e+" < "+t.minimum),t.maximum!==void 0&&e>t.maximum&&i.push("Value above maximum for "+r+": "+e+" > "+t.maximum),t.type==="integer"&&!Number.isInteger(e)&&i.push("Value must be integer for "+r)),t.type==="array"&&t.items)for(var s=0;s<e.length;s++)this._validateValue(e[s],t.items,r+"["+s+"]",i,n);t.type==="object"&&this._validateObject(e,t,r,i,n)},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_createTemplateFromSchema:function(e){if(e.type==="object"){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];t[r]=this._getDefaultValue(i)}.bind(this)),t}return this._getDefaultValue(e)},_getDefaultValue:function(e){if(e.default!==void 0)return e.default;switch(e.type){case"string":return e.enum?e.enum[0]:e.format==="date"?"2023-01-01":e.format==="date-time"?new Date().toISOString():"PLACEHOLDER_STRING";case"number":case"integer":return e.minimum||0;case"boolean":return!1;case"array":return[];case"object":return this._createTemplateFromSchema(e);default:return null}},_getFieldPath:function(e,t){return e?e+"."+t:t},_isValidDate:function(e){var t=new Date(e);return!isNaN(t.getTime())&&e.match(/^\d{4}-\d{2}-\d{2}$/)},_isValidDateTime:function(e){var t=new Date(e);return!isNaN(t.getTime())}};$3.exports=CF});var Q3=B((YX,J3)=>{"use strict";y();var Ku=ir(),ja=at(),DF={prepareTokenCommitment:function(e,t){t=t||{},ja.checkArgument(e&&typeof e=="object","Invalid token");try{var r=this._createCommitment(e,t),i=this._formatOpReturn(r,t),n=this._createTxTemplate(i,t);return{success:!0,commitment:r,opReturnData:i,txTemplate:n,preparedAt:new Date().toISOString(),metadata:{tokenId:e.id,purpose:t.purpose||"legal_token_anchor",version:"LTP.v1"}}}catch(o){return{success:!1,error:o.message}}},prepareBatchCommitment:function(e,t){t=t||{},ja.checkArgument(Array.isArray(e),"Tokens must be array");try{var r=this._createBatchCommitment(e,t),i=this._formatOpReturn(r,t),n=this._createTxTemplate(i,t);return{success:!0,batchCommitment:r,opReturnData:i,txTemplate:n,tokenCount:e.length,preparedAt:new Date().toISOString(),metadata:{purpose:t.purpose||"legal_token_batch_anchor",version:"LTP.v1"}}}catch(o){return{success:!1,error:o.message}}},verifyTokenAnchor:function(e,t,r){ja.checkArgument(e&&typeof e=="object","Invalid token"),ja.checkArgument(typeof t=="string","Transaction ID must be string");try{var i=this._createCommitment(e,{}),n=this._extractOpReturn(r);if(!n)return{valid:!1,error:"No OP_RETURN data found in transaction"};var o=this._verifyCommitment(i,n);return{valid:o,chainVerified:!1,txid:t,commitment:i,anchorData:n,verifiedAt:new Date().toISOString()}}catch(s){return{valid:!1,error:s.message}}},formatRevocation:function(e,t){ja.checkArgument(typeof e=="string","Token ID must be string"),ja.checkArgument(t&&typeof t=="object","Invalid revocation data");try{var r={type:"LTP_REVOCATION",tokenId:e,reason:t.reason||"UNSPECIFIED",revokedBy:t.revokedBy||"UNKNOWN",revokedAt:new Date().toISOString(),effectiveDate:t.effectiveDate||new Date().toISOString(),legalBasis:t.legalBasis||null,evidence:t.evidence||null},i=Ku.sha256(_.Buffer.from(JSON.stringify(r))).toString("hex");return{success:!0,revocation:r,revocationHash:i,opReturnData:this._formatOpReturn({hash:i,type:"REVOCATION"},{})}}catch(n){return{success:!1,error:n.message}}},_createCommitment:function(e,t){var r=this._canonicalizeToken(e),i={type:"LTP_TOKEN",tokenHash:Ku.sha256(_.Buffer.from(r)).toString("hex"),tokenId:e.id,timestamp:new Date().toISOString(),purpose:t.purpose||"legal_token"},n=Ku.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex");return{hash:n,data:i,canonical:r}},_createBatchCommitment:function(e,t){var r=[],i=[];e.forEach(function(f){var h=this._createCommitment(f,t);r.push(h.hash),i.push(f.id)}.bind(this));var n=this._createMerkleRoot(r),o={type:"LTP_BATCH",merkleRoot:n,tokenCount:e.length,tokenIds:i,timestamp:new Date().toISOString(),purpose:t.purpose||"batch_anchor"},s=Ku.sha256(_.Buffer.from(JSON.stringify(o))).toString("hex");return{hash:s,data:o,merkleRoot:n,tokenHashes:r}},_formatOpReturn:function(e,t){var r=t.prefix||"LTP.v1",i=e.hash;return{prefix:r,data:i,full:r+"."+i,bytes:_.Buffer.from(r+"."+i,"utf8"),size:_.Buffer.from(r+"."+i,"utf8").length}},_createTxTemplate:function(e,t){try{var r={version:1,inputs:[],outputs:[{satoshis:0,script:"OP_RETURN "+e.data}],locktime:0};return t.feeOutput&&r.outputs.push(t.feeOutput),{template:r,opReturn:e,estimatedSize:this._estimateSize(r),instructions:{step1:"Add input UTXOs to cover fees",step2:"Add change output if needed",step3:"Sign transaction with appropriate keys",step4:"Broadcast to BSV network"}}}catch(i){throw new Error("Failed to create transaction template: "+i.message)}},_extractOpReturn:function(e){try{if(!e||!e.outputs)return null;for(var t=0;t<e.outputs.length;t++){var r=e.outputs[t];if(r.script&&r.script.startsWith("OP_RETURN")){var i=r.script.replace("OP_RETURN ","");return{raw:i,decoded:_.Buffer.from(i,"hex").toString("utf8")}}}return null}catch{return null}},_verifyCommitment:function(e,t){try{return!t||!t.decoded?!1:t.decoded.includes(e.hash)}catch{return!1}},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,delete t.anchorTx,delete t.anchorBlock,JSON.stringify(this._sortObjectKeys(t))},_createMerkleRoot:function(e){if(e.length===0)return null;if(e.length===1)return e[0];for(var t=e.slice();t.length>1;){for(var r=[],i=0;i<t.length;i+=2){var n=t[i],o=t[i+1]||n,s=_.Buffer.concat([_.Buffer.from(n,"hex"),_.Buffer.from(o,"hex")]),f=Ku.sha256(s).toString("hex");r.push(f)}t=r}return t[0]},_estimateSize:function(e){var t=10,r=e.outputs.length*34,i=148;return{base:t+r,withOneInput:t+r+i,bytesPerInput:i}},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e}};J3.exports=DF});var rR=B(($X,tR)=>{"use strict";y();var qF=Gr(),_i=ir(),eR=Pu(),UF=fr(),LF=ms(),ur=at(),FF={prepareSignatureProof:function(e,t,r){r=r||{},ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t instanceof LF,"Invalid private key");try{var i=this._canonicalizeForSigning(e),n=_i.sha256(_.Buffer.from(i)),o=new eR;o.hashbuf=n,o.privkey=t,o.pubkey=t.toPublicKey(),o.sign();var s=o.sig,f={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:r.purpose||"assertionMethod",jws:this._createJWS(n,s),proofValue:s.toDER().toString("hex")};return{success:!0,proof:f,tokenHash:n.toString("hex"),canonical:i,signingKey:{publicKey:t.toPublicKey().toString(),keyId:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1"},externalOperations:{storeProof:{endpoint:"POST /proofs/signature",data:{tokenHash:n.toString("hex"),proof:f,signingKey:t.toPublicKey().toString()}},verifyProof:{endpoint:"POST /proofs/verify-signature",data:{tokenHash:n.toString("hex"),signature:s.toDER().toString("hex"),publicKey:t.toPublicKey().toString()}}}}}catch(h){return{success:!1,error:h.message}}},prepareSignatureVerification:function(e,t){try{if(ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(typeof t=="string","Public key must be string"),!e.proof)return{success:!1,error:"No proof found in token"};var r=this._canonicalizeForSigning(e),i=_i.sha256(_.Buffer.from(r)),n=UF.fromDER(_.Buffer.from(e.proof.proofValue,"hex")),o={tokenHash:i.toString("hex"),signature:n.toDER().toString("hex"),publicKey:t,proof:e.proof,canonical:r},s=new eR;s.hashbuf=i,s.sig=n,s.pubkey=qF.fromString(t);var f=s.verify()===!0;return{success:!0,verification:{valid:f,tokenHash:i.toString("hex"),signatureValid:f,publicKey:t,verifiedAt:new Date().toISOString()},verificationData:o,externalOperations:{recordVerification:{endpoint:"POST /proofs/verification-record",data:{tokenHash:i.toString("hex"),result:f,publicKey:t,verifiedAt:new Date().toISOString()}},auditVerification:{endpoint:"POST /audit/proof-verification",data:{tokenId:e.id,proofType:e.proof.type,result:f,verifier:t}}}}}catch(h){return{success:!1,error:h.message}}},prepareSelectiveDisclosure:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(Array.isArray(t),"Revealed fields must be array"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=this._createFieldCommitments(e,r),n=this._createMerkleTree(i),o=[],s=[];t.forEach(function(h){var m=this._getNestedValue(e,h),S=this._findFieldCommitment(i,h);if(S){o.push({path:h,value:m,commitment:S.hash,salt:S.salt});var x=this._generateMerkleProof(n,S.index);s.push({path:h,leafIndex:S.index,proof:x})}}.bind(this));var f={type:"LegalTokenSelectiveDisclosure",created:new Date().toISOString(),proofPurpose:"selectiveDisclosure",verificationMethod:e.proof?e.proof.verificationMethod:null,nonce:r,merkleRoot:n.root,disclosures:o,merkleProofs:s,totalFields:i.length};return{success:!0,proof:f,hiddenFieldCount:i.length-o.length,revealedFieldCount:o.length,externalOperations:{storeDisclosure:{endpoint:"POST /proofs/selective-disclosure",data:{tokenId:e.id,proof:f,merkleRoot:n.root}},verifyDisclosure:{endpoint:"POST /proofs/verify-disclosure",data:{proof:f,expectedNonce:r}},auditDisclosure:{endpoint:"POST /audit/selective-disclosure",data:{tokenId:e.id,revealedFields:t,totalFields:i.length,disclosedAt:new Date().toISOString()}}}}}catch(h){return{success:!1,error:h.message}}},prepareSelectiveDisclosureVerification:function(e,t){try{if(ur.checkArgument(e&&typeof e=="object","Invalid proof"),ur.checkArgument(typeof t=="string","Expected nonce must be string"),e.nonce!==t)return{success:!1,error:"Nonce mismatch"};var r=[],i=[];e.disclosures.forEach(function(o,s){var f=e.merkleProofs[s],h=this._hashField(o.path,o.value,o.salt);if(h!==o.commitment){i.push("Invalid commitment for field: "+o.path);return}var m=this._verifyMerkleProof(o.commitment,f.leafIndex,f.proof,e.merkleRoot);m?r.push({path:o.path,value:o.value,verified:!0}):i.push("Invalid Merkle proof for field: "+o.path)}.bind(this));var n={valid:i.length===0,errors:i,disclosures:r,merkleRoot:e.merkleRoot,totalFields:e.totalFields,verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /proofs/disclosure-verification",data:{proofId:e.id||"unknown",result:n.valid,verifiedFields:r.length,totalFields:e.totalFields,verifiedAt:n.verifiedAt}},auditVerification:{endpoint:"POST /audit/disclosure-verification",data:{merkleRoot:e.merkleRoot,disclosuresVerified:r.length,errors:i.length,result:n.valid}}}}}catch(o){return{success:!1,error:o.message}}},prepareLegalValidityProof:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t&&typeof t=="object","Invalid jurisdiction"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=t.requirements||[],n=[],o=!0;i.forEach(function(f){var h=this._checkLegalRequirement(e,f);n.push(h),h.satisfied||(o=!1)}.bind(this));var s={type:"LegalValidityProof",created:new Date().toISOString(),proofPurpose:"legalValidity",jurisdiction:t.code,nonce:r,valid:o,checks:n,complianceHash:this._hashCompliance(e,t,r)};return{success:!0,proof:s,valid:o,complianceReport:{jurisdiction:t.code,totalRequirements:i.length,satisfiedRequirements:n.filter(f=>f.satisfied).length,failedRequirements:n.filter(f=>!f.satisfied).length,overallCompliance:o},externalOperations:{submitCompliance:{endpoint:"POST /compliance/legal-validity",data:{tokenId:e.id,jurisdiction:t.code,proof:s,complianceReport:{jurisdiction:t.code,totalRequirements:i.length,satisfiedRequirements:n.filter(f=>f.satisfied).length,failedRequirements:n.filter(f=>!f.satisfied).length,overallCompliance:o}}},auditCompliance:{endpoint:"POST /audit/compliance-check",data:{tokenId:e.id,jurisdiction:t.code,result:o,checkedAt:new Date().toISOString(),requirements:n}},notifyRegulator:o?null:{endpoint:"POST /notifications/compliance-failure",data:{tokenId:e.id,jurisdiction:t.code,failedRequirements:n.filter(f=>!f.satisfied)}}}}}catch(f){return{success:!1,error:f.message}}},prepareZeroKnowledgeProof:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t&&typeof t=="object","Invalid statement"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=_i.sha256(_.Buffer.from(this._canonicalizeForSigning(e)+r)).toString("hex"),n={type:"LegalTokenZKProof",created:new Date().toISOString(),proofPurpose:"zeroKnowledge",statement:{claim:t.claim||"UNSPECIFIED",predicate:t.predicate||"SATISFIES",threshold:t.threshold||null},commitment:i,nonce:r,proofData:this._generateZKProofData(e,t,r)};return{success:!0,proof:n,commitment:i,externalOperations:{storeZKProof:{endpoint:"POST /proofs/zero-knowledge",data:{tokenId:e.id,proof:n,statement:t}},verifyZKProof:{endpoint:"POST /proofs/verify-zk",data:{proof:n,expectedNonce:r}},auditZKProof:{endpoint:"POST /audit/zk-proof",data:{tokenId:e.id,statement:t.claim,proofGenerated:new Date().toISOString()}}}}}catch(o){return{success:!1,error:o.message}}},_generateZKProofData:function(e,t,r){var i={challenge:_i.sha256(_.Buffer.from(t.claim+r)).toString("hex"),response:_i.sha256(_.Buffer.from(this._canonicalizeForSigning(e)+t.claim)).toString("hex"),witness:_i.sha256(_.Buffer.from(r+e.id+t.predicate)).toString("hex")};return i},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=e.toString("base64url"),o=t.toDER().toString("base64url");return i+".."+o},_canonicalizeForSigning:function(e){var t=JSON.parse(JSON.stringify(e));delete t.proof,delete t.tokenHash;var r=this._sortObjectKeys(t);return JSON.stringify(r)},_createFieldCommitments:function(e,t){var r=[],i=0;return this._traverseObject(e,"",function(n,o){if(n!=="proof"&&n!=="tokenHash"){var s=_i.sha256(_.Buffer.from(t+n+i)).toString("hex"),f=this._hashField(n,o,s);r.push({path:n,value:o,salt:s,hash:f,index:i}),i++}}.bind(this)),r},_hashField:function(e,t,r){var i=e+":"+JSON.stringify(t)+":"+r;return _i.sha256(_.Buffer.from(i)).toString("hex")},_createMerkleTree:function(e){var t=e.map(function(S){return S.hash});if(t.length===0)return{root:null,levels:[]};for(var r=[t],i=t;i.length>1;){for(var n=[],o=0;o<i.length;o+=2){var s=i[o],f=i[o+1]||s,h=_.Buffer.concat([_.Buffer.from(s,"hex"),_.Buffer.from(f,"hex")]),m=_i.sha256(h).toString("hex");n.push(m)}r.push(n),i=n}return{root:i[0],levels:r}},_generateMerkleProof:function(e,t){for(var r=[],i=t,n=0;n<e.levels.length-1;n++){var o=e.levels[n],s=i%2===0,f=s?i+1:i-1;f<o.length&&r.push({hash:o[f],isLeft:!s}),i=Math.floor(i/2)}return r},_verifyMerkleProof:function(e,t,r,i){for(var n=e,o=t,s=0;s<r.length;s++){var f=r[s],h=o%2===0,m;f.isLeft?m=_.Buffer.concat([_.Buffer.from(f.hash,"hex"),_.Buffer.from(n,"hex")]):m=_.Buffer.concat([_.Buffer.from(n,"hex"),_.Buffer.from(f.hash,"hex")]),n=_i.sha256(m).toString("hex"),o=Math.floor(o/2)}return n===i},_traverseObject:function(e,t,r){Array.isArray(e)?e.forEach(function(i,n){var o=t+"["+n+"]";this._traverseObject(i,o,r)}.bind(this)):e!==null&&typeof e=="object"?Object.keys(e).forEach(function(i){var n=t?t+"."+i:i;this._traverseObject(e[i],n,r)}.bind(this)):r(t,e)},_getNestedValue:function(e,t){return t.split(".").reduce(function(r,i){return r&&r[i]},e)},_findFieldCommitment:function(e,t){return e.find(function(r){return r.path===t})},_checkLegalRequirement:function(e,t){switch(t.type){case"field_present":var r=this._getNestedValue(e,t.field);return{requirement:t.type,field:t.field,satisfied:r!=null};case"field_value":var r=this._getNestedValue(e,t.field);return{requirement:t.type,field:t.field,satisfied:r===t.expectedValue};case"temporal_validity":var i=new Date,n=new Date(e.issuanceDate);return{requirement:t.type,satisfied:n<=i};default:return{requirement:t.type,satisfied:!1,error:"Unknown requirement type"}}},_hashCompliance:function(e,t,r){var i={tokenId:e.id,jurisdiction:t.code,nonce:r,timestamp:new Date().toISOString()};return _i.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex")},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e}};tR.exports=FF});var oR=B((eJ,nR)=>{"use strict";y();var Vu=ir(),JX=ys(),QX=Cv(),yr=at(),iR=Fu(),jF={prepareRegistry:function(e){e=e||{},yr.checkArgument(typeof e=="object","Config must be object");var t={id:e.id||this._generateRegistryId(),name:e.name||"Legal Token Registry",jurisdiction:e.jurisdiction||"GLOBAL",authority:e.authority||null,created:new Date().toISOString(),version:"1.0.0",config:{allowPublicRegistration:e.allowPublicRegistration||!1,requireApproval:e.requireApproval||!0,enableRevocation:e.enableRevocation!==!1,enableAuditTrail:e.enableAuditTrail!==!1,retentionPeriod:e.retentionPeriod||"7Y",complianceLevel:e.complianceLevel||"STANDARD"},dataStructure:{tokens:"Map<tokenId, registrationRecord>",revocations:"Map<tokenId, revocationRecord>",auditLog:"Array<auditEntry>",statistics:{totalTokens:0,activeTokens:0,revokedTokens:0,registrations:0}},externalStorage:{required:!0,type:"database_or_blockchain",endpoints:{store:"POST /registry/{id}/tokens",retrieve:"GET /registry/{id}/tokens/{tokenId}",search:"GET /registry/{id}/search",revoke:"POST /registry/{id}/revocations"}}},r=this._prepareAuditEntry({action:"REGISTRY_CREATED",actor:e.authority,timestamp:t.created,metadata:{jurisdiction:t.jurisdiction,config:t.config}});return{success:!0,registry:t,initialAudit:r,instructions:{step1:"Store registry configuration in external system",step2:"Initialize token storage with provided data structure",step3:"Set up audit logging with provided templates",step4:"Configure external endpoints for registry operations"}}},prepareTokenRegistration:function(e,t,r){r=r||{},yr.checkArgument(e&&typeof e=="object","Invalid token"),yr.checkArgument(t&&typeof t=="object","Invalid registry config");try{var i=this._validateTokenForRegistration(e,t);if(!i.valid)return{success:!1,error:"Token validation failed: "+i.error};var n={tokenId:e.id,tokenHash:this._hashToken(e),token:e,status:t.requireApproval?"PENDING":"ACTIVE",registeredBy:r.registeredBy||"UNKNOWN",registeredAt:new Date().toISOString(),approvedBy:null,approvedAt:null,metadata:r.metadata||{},compliance:{jurisdiction:e.jurisdiction||t.jurisdiction,level:this._calculateComplianceLevel(e),checks:i.checks||[]}},o=this._prepareAuditEntry({action:"TOKEN_REGISTERED",actor:r.registeredBy,tokenId:e.id,timestamp:n.registeredAt,metadata:{status:n.status,tokenType:e.type,compliance:n.compliance}});return{success:!0,registrationRecord:n,auditEntry:o,registrationId:this._generateRegistrationId(e.id),validation:i,externalOperations:{store:{endpoint:"POST /registry/"+t.id+"/tokens",data:n},audit:{endpoint:"POST /registry/"+t.id+"/audit",data:o}}}}catch(s){return{success:!1,error:s.message}}},prepareTokenApproval:function(e,t,r){try{yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(typeof t=="string","Approver must be string"),yr.checkArgument(r&&typeof r=="object","Invalid registry config");var i={tokenId:e,status:"ACTIVE",approvedBy:t,approvedAt:new Date().toISOString()},n=this._prepareAuditEntry({action:"TOKEN_APPROVED",actor:t,tokenId:e,timestamp:i.approvedAt});return{success:!0,approvalData:i,auditEntry:n,externalOperations:{update:{endpoint:"PUT /registry/"+r.id+"/tokens/"+e+"/status",data:i},audit:{endpoint:"POST /registry/"+r.id+"/audit",data:n}}}}catch(o){return{success:!1,error:o.message}}},prepareTokenRevocation:function(e,t,r){try{if(yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(t&&typeof t=="object","Invalid revocation"),yr.checkArgument(r&&typeof r=="object","Invalid registry config"),!r.enableRevocation)return{success:!1,error:"Revocation is disabled for this registry"};var i={tokenId:e,reason:t.reason||"UNSPECIFIED",revokedBy:t.revokedBy||"UNKNOWN",revokedAt:new Date().toISOString(),effectiveDate:t.effectiveDate||new Date().toISOString(),legalBasis:t.legalBasis||null,evidence:t.evidence||null,revocationHash:this._generateRevocationHash(e,t)},n={tokenId:e,status:"REVOKED",revokedAt:i.revokedAt,revocationReason:i.reason},o=this._prepareAuditEntry({action:"TOKEN_REVOKED",actor:t.revokedBy,tokenId:e,timestamp:i.revokedAt,metadata:{reason:i.reason,legalBasis:i.legalBasis}});return{success:!0,revocationRecord:i,statusUpdate:n,auditEntry:o,revocationId:this._generateRevocationId(e),externalOperations:{storeRevocation:{endpoint:"POST /registry/"+r.id+"/revocations",data:i},updateStatus:{endpoint:"PUT /registry/"+r.id+"/tokens/"+e+"/status",data:n},audit:{endpoint:"POST /registry/"+r.id+"/audit",data:o}}}}catch(s){return{success:!1,error:s.message}}},prepareTokenStatusQuery:function(e,t){try{return yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(t&&typeof t=="object","Invalid registry config"),{success:!0,query:{tokenId:e,registryId:t.id},externalOperations:{retrieve:{endpoint:"GET /registry/"+t.id+"/tokens/"+e,method:"GET"},checkRevocation:{endpoint:"GET /registry/"+t.id+"/revocations/"+e,method:"GET"}},expectedResponse:{found:"boolean",status:"string (PENDING|ACTIVE|REVOKED)",registeredAt:"ISO datetime",registeredBy:"string",approvedAt:"ISO datetime or null",approvedBy:"string or null",revokedAt:"ISO datetime or null",revocationReason:"string or null",compliance:"object",revocation:"object or null"}}}catch(r){return{success:!1,error:r.message}}},prepareTokenSearch:function(e,t){e=e||{};try{yr.checkArgument(t&&typeof t=="object","Invalid registry config");var r=[];e.status&&r.push("status="+encodeURIComponent(e.status)),e.type&&r.push("type="+encodeURIComponent(e.type)),e.registeredBy&&r.push("registeredBy="+encodeURIComponent(e.registeredBy)),e.jurisdiction&&r.push("jurisdiction="+encodeURIComponent(e.jurisdiction)),e.dateFrom&&r.push("dateFrom="+encodeURIComponent(e.dateFrom)),e.dateTo&&r.push("dateTo="+encodeURIComponent(e.dateTo)),e.includeTokens&&r.push("includeTokens=true"),e.sortBy&&r.push("sortBy="+encodeURIComponent(e.sortBy)),e.sortOrder&&r.push("sortOrder="+encodeURIComponent(e.sortOrder));var i=e.offset||0,n=e.limit||100;r.push("offset="+i),r.push("limit="+n);var o=r.length>0?"?"+r.join("&"):"";return{success:!0,searchCriteria:e,externalOperations:{search:{endpoint:"GET /registry/"+t.id+"/search"+o,method:"GET"}},expectedResponse:{success:"boolean",results:"Array<tokenRecord>",totalCount:"number",totalRegistrations:"number",offset:"number",limit:"number",hasMore:"boolean"}}}catch(s){return{success:!1,error:s.message}}},prepareStatisticsQuery:function(e){return yr.checkArgument(e&&typeof e=="object","Invalid registry config"),{success:!0,query:{registryId:e.id},externalOperations:{getStatistics:{endpoint:"GET /registry/"+e.id+"/statistics",method:"GET"}},expectedResponse:{id:"string",name:"string",jurisdiction:"string",created:"ISO datetime",statistics:{totalTokens:"number",activeTokens:"number",revokedTokens:"number",registrations:"number"},auditEntries:"number",lastActivity:"ISO datetime"}}},prepareAuditLogQuery:function(e,t){if(t=t||{},yr.checkArgument(e&&typeof e=="object","Invalid registry config"),!e.enableAuditTrail)return{success:!1,error:"Audit trail is disabled"};var r=[];t.action&&r.push("action="+encodeURIComponent(t.action)),t.actor&&r.push("actor="+encodeURIComponent(t.actor)),t.tokenId&&r.push("tokenId="+encodeURIComponent(t.tokenId)),t.dateFrom&&r.push("dateFrom="+encodeURIComponent(t.dateFrom)),t.dateTo&&r.push("dateTo="+encodeURIComponent(t.dateTo));var i=t.offset||0,n=t.limit||100;r.push("offset="+i),r.push("limit="+n);var o=r.length>0?"?"+r.join("&"):"";return{success:!0,auditOptions:t,externalOperations:{getAuditLog:{endpoint:"GET /registry/"+e.id+"/audit"+o,method:"GET"}},expectedResponse:{success:"boolean",entries:"Array<auditEntry>",totalEntries:"number",offset:"number",limit:"number",hasMore:"boolean"}}},_generateRegistryId:function(){return"reg_"+iR.randomHex(16)},_generateRegistrationId:function(e){var t="reg_"+e+"_"+Date.now();return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_generateRevocationId:function(e){var t="rev_"+e+"_"+Date.now();return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_hashToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,Vu.sha256(_.Buffer.from(JSON.stringify(t))).toString("hex")},_generateRevocationHash:function(e,t){var r=e+(t.reason||"")+(t.revokedBy||"")+Date.now();return Vu.sha256(_.Buffer.from(r)).toString("hex")},_validateTokenForRegistration:function(e,t){var r=[],i=!0;return e.id?r.push({field:"id",valid:!0}):(r.push({field:"id",valid:!1,error:"Missing token ID"}),i=!1),e.type?r.push({field:"type",valid:!0}):(r.push({field:"type",valid:!1,error:"Missing token type"}),i=!1),e.issuanceDate?r.push({field:"issuanceDate",valid:!0}):(r.push({field:"issuanceDate",valid:!1,error:"Missing issuance date"}),i=!1),e.proof?r.push({field:"proof",valid:!0}):(r.push({field:"proof",valid:!1,error:"Missing cryptographic proof"}),i=!1),{valid:i,checks:r}},_calculateComplianceLevel:function(e){var t="BASIC";return e.proof&&e.proof.type&&(t="STANDARD"),e.jurisdiction&&e.legalBasis&&(t="ENHANCED"),e.attestations&&e.attestations.length>0&&(t="PREMIUM"),t},_prepareAuditEntry:function(e){var t={id:this._generateAuditId(),action:e.action,actor:e.actor||"SYSTEM",tokenId:e.tokenId||null,timestamp:e.timestamp||new Date().toISOString(),metadata:e.metadata||{},hash:this._generateAuditHash(e)};return t},_generateAuditId:function(){return"audit_"+iR.randomHex(32)},_generateAuditHash:function(e){var t=(e.action||"")+(e.actor||"")+(e.tokenId||"")+(e.timestamp||"");return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)}};nR.exports=jF});var uR=B((rJ,fR)=>{"use strict";y();var zv=Gr(),Wv=ir(),sR=Pu(),HF=fr(),aR=ms(),Ar=at(),KF=Fu();function VF(e,t){if(t=t||{},t.issuerPublicKey)return t.issuerPublicKey instanceof zv?t.issuerPublicKey:zv.fromString(t.issuerPublicKey);var r=e&&e.issuer;if(typeof r!="string")return null;try{var i=r.split("#")[0].split(":")[2];return i?zv.fromString(i):null}catch{return null}}var Xl={CORRELATIVE_OBLIGATION:"CorrelativeObligation",CONTRACTUAL_OBLIGATION:"ContractualObligation",PAYMENT_OBLIGATION:"PaymentObligation",DELIVERY_OBLIGATION:"DeliveryObligation",PERFORMANCE_OBLIGATION:"PerformanceObligation",MAINTENANCE_OBLIGATION:"MaintenanceObligation",COMPLIANCE_OBLIGATION:"ComplianceObligation",REPORTING_OBLIGATION:"ReportingObligation",CONFIDENTIALITY_OBLIGATION:"ConfidentialityObligation",NON_COMPETE_OBLIGATION:"NonCompeteObligation",INDEMNIFICATION_OBLIGATION:"IndemnificationObligation",WARRANTY_OBLIGATION:"WarrantyObligation",SUPPORT_OBLIGATION:"SupportObligation",REGULATORY_OBLIGATION:"RegulatoryObligation",FIDUCIARY_OBLIGATION:"FiduciaryObligation"},Ha={CRITICAL:"CRITICAL",HIGH:"HIGH",MEDIUM:"MEDIUM",LOW:"LOW",DEFERRED:"DEFERRED"},mr={PENDING:"PENDING",ACTIVE:"ACTIVE",IN_PROGRESS:"IN_PROGRESS",COMPLETED:"COMPLETED",OVERDUE:"OVERDUE",BREACHED:"BREACHED",WAIVED:"WAIVED",TERMINATED:"TERMINATED"},Jl={prepareObligationToken:function(e,t,r,i,n,o){o=o||{},Ar.checkArgument(typeof e=="string","Obligation type must be string"),Ar.checkArgument(typeof t=="string","Issuer DID must be string"),Ar.checkArgument(typeof r=="string","Obligor DID must be string"),Ar.checkArgument(i&&typeof i=="object","Obligation must be object"),Ar.checkArgument(n instanceof aR,"Invalid issuer private key");var s=Object.values(Xl);Ar.checkArgument(s.includes(e),"Invalid obligation type: "+e);try{var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalObligationToken",e],issuer:t,issuanceDate:new Date().toISOString(),credentialSubject:{id:r,obligationType:e,obligation:i,jurisdiction:o.jurisdiction||"US",priority:o.priority||Ha.MEDIUM,status:mr.PENDING,dueDate:o.dueDate||null,effectiveDate:o.effectiveDate||new Date().toISOString(),expirationDate:o.expirationDate||null,correlativeRight:o.correlativeRight||null,rightHolder:o.rightHolder||null,enforceable:o.enforceable!==!1,penalties:o.penalties||null,remedies:o.remedies||null}};o.metadata&&(f.credentialSubject.metadata=o.metadata);var h=this._signToken(f,n);return{success:!0,obligationToken:h,tokenHash:h.tokenHash,metadata:{type:e,issuer:t,obligor:r,priority:f.credentialSubject.priority,status:f.credentialSubject.status,jurisdiction:f.credentialSubject.jurisdiction,dueDate:f.credentialSubject.dueDate,correlativeRight:f.credentialSubject.correlativeRight},externalOperations:{storeToken:{endpoint:"POST /obligations/tokens",data:{token:h,metadata:{type:e,issuer:t,obligor:r,priority:f.credentialSubject.priority,status:f.credentialSubject.status,jurisdiction:f.credentialSubject.jurisdiction,dueDate:f.credentialSubject.dueDate,correlativeRight:f.credentialSubject.correlativeRight}}},indexToken:{endpoint:"POST /obligations/index",data:{tokenId:h.id,tokenHash:h.tokenHash,type:e,issuer:t,obligor:r,issuedAt:h.issuanceDate,dueDate:f.credentialSubject.dueDate,priority:f.credentialSubject.priority}},notifyObligor:{endpoint:"POST /notifications/obligation-issued",data:{tokenId:h.id,issuer:t,obligor:r,obligationType:e,dueDate:f.credentialSubject.dueDate,priority:f.credentialSubject.priority}},scheduleReminders:f.credentialSubject.dueDate?{endpoint:"POST /obligations/schedule-reminders",data:{tokenId:h.id,obligor:r,dueDate:f.credentialSubject.dueDate,reminderSchedule:o.reminderSchedule||["7d","3d","1d"]}}:null}}}catch(m){return{success:!1,error:m.message}}},prepareObligationVerification:function(e,t){t=t||{};try{var r=[],i=[];this._validateTokenStructure(e,r),this._verifyTokenSignature(e,r,t),this._validateTokenTemporal(e,r,i),this._validateObligationType(e,r),this._validateObligationStatus(e,r,i),this._validateObligationPriority(e,i);var n={valid:r.length===0,errors:r,warnings:i,issuerDID:e.issuer,obligorDID:e.credentialSubject?e.credentialSubject.id:null,obligationType:e.credentialSubject?e.credentialSubject.obligationType:null,status:e.credentialSubject?e.credentialSubject.status:null,priority:e.credentialSubject?e.credentialSubject.priority:null,isOverdue:this._checkIfOverdue(e),verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /obligations/verification-record",data:{tokenId:e.id,result:n.valid,errors:r,warnings:i,verifiedAt:n.verifiedAt,isOverdue:n.isOverdue}},auditVerification:{endpoint:"POST /audit/obligation-verification",data:{tokenId:e.id,obligationType:n.obligationType,issuer:n.issuerDID,obligor:n.obligorDID,result:n.valid,verifiedAt:n.verifiedAt}},updateStatus:n.isOverdue&&e.credentialSubject.status===mr.ACTIVE?{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:mr.OVERDUE,updatedAt:n.verifiedAt,reason:"Due date passed"}}:null}}}catch(o){return{success:!1,error:"Verification preparation failed: "+o.message}}},prepareObligationFulfillment:function(e,t,r,i){i=i||{},Ar.checkArgument(e&&typeof e=="object","Invalid token"),Ar.checkArgument(t&&typeof t=="object","Invalid fulfillment"),Ar.checkArgument(r instanceof aR,"Invalid obligor key");try{var n=this.prepareObligationVerification(e,{});if(!n.success||!n.verification.valid)return{success:!1,error:"Cannot fulfill invalid obligation: "+n.verification.errors.join(", ")};if(e.credentialSubject.status===mr.COMPLETED)return{success:!1,error:"Obligation already fulfilled"};if(e.credentialSubject.status===mr.TERMINATED)return{success:!1,error:"Obligation has been terminated"};var o={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","ObligationFulfillment"],issuer:e.credentialSubject.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:e.id,fulfillmentType:t.type||"FULL_FULFILLMENT",fulfillmentDate:new Date().toISOString(),evidence:t.evidence||null,description:t.description||"",completionPercentage:t.completionPercentage||100,attestations:t.attestations||[],notes:t.notes||null}},s=this._signToken(o,r),f=o.credentialSubject.completionPercentage>=100?mr.COMPLETED:mr.IN_PROGRESS;return{success:!0,fulfillmentRecord:s,newStatus:f,fulfillmentId:s.id,externalOperations:{recordFulfillment:{endpoint:"POST /obligations/fulfillments",data:{obligationId:e.id,fulfillmentRecord:s,obligor:e.credentialSubject.id,fulfillmentDate:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}},updateStatus:{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:f,fulfillmentId:s.id,updatedAt:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}},notifyRightHolder:e.credentialSubject.rightHolder?{endpoint:"POST /notifications/obligation-fulfilled",data:{obligationId:e.id,fulfillmentId:s.id,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,completionPercentage:o.credentialSubject.completionPercentage,newStatus:f}}:null,auditFulfillment:{endpoint:"POST /audit/obligation-fulfillment",data:{obligationId:e.id,fulfillmentId:s.id,obligor:e.credentialSubject.id,fulfilledAt:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}}}}}catch(h){return{success:!1,error:h.message}}},prepareObligationBreachAssessment:function(e,t,r){Ar.checkArgument(e&&typeof e=="object","Invalid token"),Ar.checkArgument(t&&typeof t=="object","Invalid breach details"),Ar.checkArgument(r&&typeof r=="object","Invalid assessor");try{var i={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","ObligationBreachAssessment"],issuer:r.did||r.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:e.id,breachType:t.type||"MATERIAL_BREACH",breachDate:t.date||new Date().toISOString(),description:t.description||"",severity:t.severity||"MODERATE",evidence:t.evidence||[],assessor:{did:r.did||r.id,name:r.name||"Unknown",authority:r.authority||null,jurisdiction:r.jurisdiction||null},damages:t.damages||null,recommendedRemedies:t.recommendedRemedies||[],assessmentDate:new Date().toISOString()}},n=Wv.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex");return i.credentialSubject.assessmentHash=n,{success:!0,breachAssessment:i,breachId:i.id,severity:t.severity||"MODERATE",externalOperations:{recordBreach:{endpoint:"POST /obligations/breaches",data:{obligationId:e.id,breachAssessment:i,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,breachDate:t.date||new Date().toISOString(),severity:t.severity||"MODERATE"}},updateStatus:{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:mr.BREACHED,breachId:i.id,breachDate:t.date||new Date().toISOString(),updatedAt:new Date().toISOString()}},notifyParties:{endpoint:"POST /notifications/obligation-breached",data:{obligationId:e.id,breachId:i.id,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,breachType:t.type||"MATERIAL_BREACH",severity:t.severity||"MODERATE"}},escalateBreach:t.severity==="CRITICAL"?{endpoint:"POST /legal/escalate-breach",data:{obligationId:e.id,breachId:i.id,severity:t.severity,jurisdiction:e.credentialSubject.jurisdiction}}:null,auditBreach:{endpoint:"POST /audit/obligation-breach",data:{obligationId:e.id,breachId:i.id,obligor:e.credentialSubject.id,assessedAt:i.credentialSubject.assessmentDate,severity:t.severity||"MODERATE"}}}}}catch(o){return{success:!1,error:o.message}}},prepareObligationMonitoringReport:function(e,t){t=t||{},Ar.checkArgument(Array.isArray(e),"Obligations must be array");try{var r={reportId:"rpt_"+this._generateUUID(),generatedAt:new Date().toISOString(),criteria:t,summary:{totalObligations:e.length,byStatus:{},byPriority:{},byType:{},overdue:0,dueSoon:0,completed:0},obligations:[],alerts:[],recommendations:[]},i=new Date,n=new Date(i.getTime()+10080*60*1e3);return e.forEach(function(o){var s={id:o.id,type:o.credentialSubject.obligationType,status:o.credentialSubject.status,priority:o.credentialSubject.priority,obligor:o.credentialSubject.id,dueDate:o.credentialSubject.dueDate,isOverdue:this._checkIfOverdue(o),isDueSoon:!1};if(o.credentialSubject.dueDate){var f=new Date(o.credentialSubject.dueDate);s.isDueSoon=f<=n&&f>i}r.summary.byStatus[s.status]=(r.summary.byStatus[s.status]||0)+1,r.summary.byPriority[s.priority]=(r.summary.byPriority[s.priority]||0)+1,r.summary.byType[s.type]=(r.summary.byType[s.type]||0)+1,s.isOverdue&&r.summary.overdue++,s.isDueSoon&&r.summary.dueSoon++,s.status===mr.COMPLETED&&r.summary.completed++,s.isOverdue&&s.priority===Ha.CRITICAL&&r.alerts.push({type:"CRITICAL_OVERDUE",obligationId:o.id,message:"Critical obligation is overdue",priority:"HIGH"}),s.isDueSoon&&s.priority===Ha.HIGH&&r.alerts.push({type:"HIGH_PRIORITY_DUE_SOON",obligationId:o.id,message:"High priority obligation due soon",priority:"MEDIUM"}),r.obligations.push(s)}.bind(this)),r.summary.overdue>0&&r.recommendations.push({type:"OVERDUE_MANAGEMENT",message:"Consider prioritizing overdue obligations",count:r.summary.overdue}),r.summary.dueSoon>5&&r.recommendations.push({type:"WORKLOAD_MANAGEMENT",message:"High number of obligations due soon - consider workload distribution",count:r.summary.dueSoon}),{success:!0,report:r,externalOperations:{storeReport:{endpoint:"POST /obligations/monitoring-reports",data:{report:r,generatedAt:r.generatedAt}},sendAlerts:r.alerts.length>0?{endpoint:"POST /notifications/obligation-alerts",data:{reportId:r.reportId,alerts:r.alerts,summary:r.summary}}:null,updateDashboard:{endpoint:"PUT /dashboard/obligation-metrics",data:{summary:r.summary,lastUpdated:r.generatedAt}}}}}catch(o){return{success:!1,error:o.message}}},getObligationTypes:function(){return Xl},getObligationPriority:function(){return Ha},getObligationStatus:function(){return mr},_signToken:function(e,t){var r=this._canonicalizeToken(e),i=Wv.sha256(_.Buffer.from(r)),n=new sR;n.hashbuf=i,n.privkey=t,n.pubkey=t.toPublicKey(),n.sign();var o=n.sig,s={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:"assertionMethod",jws:this._createJWS(i,o)},f=JSON.parse(JSON.stringify(e));return f.proof=s,f.tokenHash=i.toString("hex"),f},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=e.toString("base64url"),o=t.toDER().toString("base64url");return i+".."+o},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,JSON.stringify(this._sortObjectKeys(t))},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_validateTokenStructure:function(e,t){e["@context"]||t.push("Missing @context"),e.id||t.push("Missing id"),(!e.type||!Array.isArray(e.type))&&t.push("Missing or invalid type"),e.issuer||t.push("Missing issuer"),e.issuanceDate||t.push("Missing issuanceDate"),e.credentialSubject||t.push("Missing credentialSubject"),e.proof||t.push("Missing proof")},_verifyTokenSignature:function(e,t,r){try{if(!e.proof||!e.proof.jws){t.push("Missing signature proof");return}var i=this._canonicalizeToken(e),n=Wv.sha256(_.Buffer.from(i));if(e.tokenHash&&e.tokenHash!==n.toString("hex")){t.push("Token hash mismatch");return}var o=VF(e,r);if(!o){t.push("Signature not verified: issuer public key could not be resolved from token.issuer; pass options.issuerPublicKey");return}var s=e.proof.jws.split(".");if(s.length!==3||!s[2]){t.push("Malformed JWS");return}var f=HF.fromDER(_.Buffer.from(s[2],"base64url")),h=new sR;h.hashbuf=n,h.sig=f,h.pubkey=o,h.verify()!==!0&&t.push("Signature verification failed")}catch(m){t.push("Signature verification failed: "+m.message)}},_validateTokenTemporal:function(e,t,r){var i=new Date,n=new Date(e.issuanceDate);if(n>i&&t.push("Token issued in the future"),e.credentialSubject.effectiveDate){var o=new Date(e.credentialSubject.effectiveDate);i<o&&r.push("Obligation not yet effective")}if(e.credentialSubject.expirationDate){var s=new Date(e.credentialSubject.expirationDate);i>s&&t.push("Obligation expired")}},_validateObligationType:function(e,t){if(!e.credentialSubject.obligationType){t.push("Missing obligationType");return}var r=Object.values(Xl);r.includes(e.credentialSubject.obligationType)||t.push("Invalid obligation type: "+e.credentialSubject.obligationType)},_validateObligationStatus:function(e,t,r){if(!e.credentialSubject.status){t.push("Missing status");return}var i=Object.values(mr);i.includes(e.credentialSubject.status)||t.push("Invalid obligation status: "+e.credentialSubject.status),this._checkIfOverdue(e)&&e.credentialSubject.status===mr.ACTIVE&&r.push("Obligation is overdue but status is still ACTIVE")},_validateObligationPriority:function(e,t){if(e.credentialSubject.priority){var r=Object.values(Ha);r.includes(e.credentialSubject.priority)||t.push("Invalid obligation priority: "+e.credentialSubject.priority)}},_checkIfOverdue:function(e){if(!e.credentialSubject.dueDate)return!1;var t=new Date,r=new Date(e.credentialSubject.dueDate);return t>r&&e.credentialSubject.status!==mr.COMPLETED},_generateUUID:function(){return KF.uuid4()}};Jl.ObligationTypes=Xl;Jl.ObligationPriority=Ha;Jl.ObligationStatus=mr;fR.exports=Jl});var hR=B((nJ,cR)=>{"use strict";y();var Es=Z3(),Ql=X3(),Gu=Q3(),Yv=rR(),zi=oR(),GF=uR(),Zv=ms(),Or=at(),tt=function(e){return this instanceof tt?(this.config=e||{},this.registry=null,this.config.registry&&(this.registry=zi.createRegistry(this.config.registry)),this):new tt(e)};tt.prototype.createRightToken=function(e,t,r){Or.checkArgument(e&&typeof e=="object","Invalid right data"),Or.checkArgument(t instanceof Zv,"Invalid private key"),r=r||{};try{var i=Es.create(e.type,e.owner,e.owner,e,t,r);if(!i)return{success:!1,error:"Failed to create token"};if(r.addProof!==!1&&(i=Es._signToken(i,t)),r.anchor){var n=Gu.anchorToken(i,r.anchor);n.success&&(i.anchorTx=n.txid,i.anchorBlock=n.blockHeight)}if(this.registry&&r.register!==!1){var o=zi.registerToken(this.registry,i,{registeredBy:r.registeredBy||"SYSTEM"});o.success&&(i.registrationId=o.registrationId,i.registrationStatus=o.status)}return{success:!0,token:i,type:"LegalRightToken"}}catch(s){return{success:!1,error:s.message}}};tt.prototype.validateClaim=function(e,t){return Ql.validate(e,t)};tt.prototype.createSelectiveDisclosure=function(e,t,r){return Yv.prepareSelectiveDisclosure(e,t,r)};tt.prototype.verifyToken=function(e,t){return!e||!e.proof?{valid:!1,error:"No proof found in token"}:Es.verifyToken(e,t)};tt.prototype.transferRight=function(e,t,r,i){Or.checkArgument(e&&typeof e=="object","Invalid token"),Or.checkArgument(typeof t=="string","New owner must be string"),Or.checkArgument(r instanceof Zv,"Invalid owner key"),i=i||{};try{var n=this.verifyToken(e,r.toPublicKey().toString());if(!n.valid)return{success:!1,error:"Invalid token or ownership proof"};var o=Es.prepareRightTokenTransfer(e,t,r,i);if(!o.success)return{success:!1,error:o.error};var s=o.newToken,f=o.transferProof;if(i.anchor){var h=Gu.anchorToken(s,i.anchor);h.success&&(s.transferAnchorTx=h.txid)}if(this.registry){var m=zi.registerToken(this.registry,s,{registeredBy:i.registeredBy||t,metadata:{transferFrom:e.owner,transferTo:t,originalTokenId:e.id}});m.success&&(s.registrationId=m.registrationId)}return{success:!0,token:s,transferId:f.id,transferredAt:f.issuanceDate,transferProof:f}}catch(S){return{success:!1,error:S.message}}};tt.prototype.createObligation=function(e,t,r){Or.checkArgument(e&&typeof e=="object","Invalid right token"),Or.checkArgument(t&&typeof t=="object","Invalid obligation data"),Or.checkArgument(r instanceof Zv,"Invalid private key");try{var i=Es.prepareObligationToken(e,t.obligor,t,r);return i.success?{success:!0,obligation:i.obligationToken,rightTokenId:e.id}:{success:!1,error:i.error}}catch(n){return{success:!1,error:n.message}}};tt.prototype.revokeToken=function(e,t,r){return Or.checkArgument(typeof e=="string","Token ID must be string"),Or.checkArgument(t&&typeof t=="object","Invalid revocation data"),Or.checkArgument(typeof r=="string","Authority must be string"),this.registry?zi.revokeToken(this.registry,e,{reason:t.reason,revokedBy:r,legalBasis:t.legalBasis,evidence:t.evidence}):{success:!1,error:"No registry available for revocation"}};tt.prototype.checkTokenStatus=function(e){return Or.checkArgument(typeof e=="string","Token ID must be string"),this.registry?zi.checkTokenStatus(this.registry,e):{found:!1,error:"No registry available"}};tt.prototype.searchTokens=function(e){return this.registry?zi.searchTokens(this.registry,e):{success:!1,error:"No registry available"}};tt.prototype.getRegistryStats=function(){return this.registry?zi.getStatistics(this.registry):{error:"No registry available"}};tt.prototype.createLegalValidityProof=function(e,t,r){return Yv.prepareLegalValidityProof(e,t,r)};tt.prototype.anchorTokenBatch=function(e,t){return Gu.anchorBatch(e,t)};tt.prototype.verifyAnchor=function(e,t){return Gu.verifyAnchor(e,t)};tt.prototype.getRightTypes=function(){return Es.getRightTypes()};tt.prototype.getClaimSchemas=function(){return Ql.getSchemas()};tt.prototype.createRegistry=function(e){return this.registry=zi.createRegistry(e),this.registry};tt.prototype.setRegistry=function(e){Or.checkArgument(e&&typeof e=="object","Invalid registry"),this.registry=e};tt.create=function(e){return new tt(e)};tt.createRightToken=function(e,t,r){var i=new tt;return i.createRightToken(e,t,r)};tt.validateClaim=function(e,t){return Ql.validate(e,t)};tt.verifyToken=function(e,t){var r=new tt;return r.verifyToken(e,t)};tt.createRegistry=function(e){return zi.createRegistry(e)};tt.Right=Es;tt.Claim=Ql;tt.Anchor=Gu;tt.Proof=Yv;tt.Registry=zi;tt.Obligation=GF;cR.exports=tt});var zF=B((sJ,lR)=>{y();lR.exports=hR()});return zF();})();
75
+ `));var f=new Jn({actual:e,expected:t,message:r,operator:n,stackStartFn:i});throw f.generatedMessage=s,f}}bt.match=function e(t,r,i){gO(t,r,i,e,"match")};bt.doesNotMatch=function e(t,r,i){gO(t,r,i,e,"doesNotMatch")};function vO(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];fO.apply(void 0,[vO,t.length].concat(t))}bt.strict=zL(vO,bt,{equal:bt.strictEqual,deepEqual:bt.deepStrictEqual,notEqual:bt.notStrictEqual,notDeepEqual:bt.notDeepStrictEqual});bt.strict.strict=bt.strict});var ds=B((U$,bO)=>{"use strict";y();var mO=yl(),Tt=function e(t){if(!(this instanceof e))return new e(t);this.bufLen=0,t?this.set(t):this.bufs=[]};Tt.prototype.set=function(e){return this.bufs=e.bufs||this.bufs||[],this.bufLen=this.bufs.reduce(function(t,r){return t+r.length},0),this};Tt.prototype.toBuffer=function(){return this.concat()};Tt.prototype.concat=function(){return _.Buffer.concat(this.bufs,this.bufLen)};Tt.prototype.write=function(e){return mO(_.Buffer.isBuffer(e)),this.bufs.push(e),this.bufLen+=e.length,this};Tt.prototype.writeReverse=function(e){return mO(_.Buffer.isBuffer(e)),this.bufs.push(_.Buffer.from(e).reverse()),this.bufLen+=e.length,this};Tt.prototype.writeUInt8=function(e){var t=_.Buffer.alloc(1);return t.writeUInt8(e,0),this.write(t),this};Tt.prototype.writeUInt16BE=function(e){var t=_.Buffer.alloc(2);return t.writeUInt16BE(e,0),this.write(t),this};Tt.prototype.writeUInt16LE=function(e){var t=_.Buffer.alloc(2);return t.writeUInt16LE(e,0),this.write(t),this};Tt.prototype.writeUInt32BE=function(e){var t=_.Buffer.alloc(4);return t.writeUInt32BE(e,0),this.write(t),this};Tt.prototype.writeInt32LE=function(e){var t=_.Buffer.alloc(4);return t.writeInt32LE(e,0),this.write(t),this};Tt.prototype.writeUInt32LE=function(e){var t=_.Buffer.alloc(4);return t.writeUInt32LE(e,0),this.write(t),this};Tt.prototype.writeUInt64BEBN=function(e){var t=e.toBuffer({size:8});return this.write(t),this};Tt.prototype.writeUInt64LEBN=function(e){var t=e.toBuffer({size:8});return this.writeReverse(t),this};Tt.prototype.writeVarintNum=function(e){var t=Tt.varintBufNum(e);return this.write(t),this};Tt.prototype.writeVarintBN=function(e){var t=Tt.varintBufBN(e);return this.write(t),this};Tt.varintBufNum=function(e){var t;return e<253?(t=_.Buffer.alloc(1),t.writeUInt8(e,0)):e<65536?(t=_.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):e<4294967296?(t=_.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=_.Buffer.alloc(9),t.writeUInt8(255,0),t.writeInt32LE(e&-1,1),t.writeUInt32LE(Math.floor(e/4294967296),5)),t};Tt.varintBufBN=function(e){var t,r=e.toNumber();if(r<253)t=_.Buffer.alloc(1),t.writeUInt8(r,0);else if(r<65536)t=_.Buffer.alloc(3),t.writeUInt8(253,0),t.writeUInt16LE(r,1);else if(r<4294967296)t=_.Buffer.alloc(5),t.writeUInt8(254,0),t.writeUInt32LE(r,1);else{var i=new Tt;i.writeUInt8(255),i.writeUInt64LEBN(e),t=i.concat()}return t};bO.exports=Tt});var dv=B((j$,_O)=>{"use strict";y();var ka=mt(),Tu=at(),YL=Er();function it(e){if(!(this instanceof it))return new it(e);var t;if(ka.isNumber(e))t=e;else if(ka.isString(e))t=it.map[e];else throw new TypeError('Unrecognized num type: "'+typeof e+'" for Opcode');return YL.defineImmutable(this,{num:t}),this}it.fromBuffer=function(e){return Tu.checkArgument(_.Buffer.isBuffer(e)),new it(+("0x"+e.toString("hex")))};it.fromNumber=function(e){return Tu.checkArgument(ka.isNumber(e)),new it(e)};it.fromString=function(e){Tu.checkArgument(ka.isString(e));var t=it.map[e];if(typeof t>"u")throw new TypeError("Invalid opcodestr");return new it(t)};it.prototype.toHex=function(){return this.num.toString(16)};it.prototype.toBuffer=function(){return _.Buffer.from(this.toHex(),"hex")};it.prototype.toNumber=function(){return this.num};it.prototype.toString=function(){var e=it.reverseMap[this.num];if(typeof e>"u")throw new Error("Opcode does not have a string representation");return e};it.smallInt=function(e){return Tu.checkArgument(ka.isNumber(e),"Invalid Argument: n should be number"),Tu.checkArgument(e>=0&&e<=16,"Invalid Argument: n must be between 0 and 16"),e===0?it("OP_0"):new it(it.map.OP_1+e-1)};it.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SPLIT:127,OP_NUM2BIN:128,OP_BIN2NUM:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_CHECKSEQUENCEVERIFY:178,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_SUBSTR:179,OP_LEFT:180,OP_RIGHT:181,OP_LSHIFTNUM:182,OP_RSHIFTNUM:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};it.reverseMap=[];for(lv in it.map)it.reverseMap[it.map[lv]]=lv;var lv;ka.extend(it,it.map);it.isSmallIntOp=function(e){return e instanceof it&&(e=e.toNumber()),e===it.map.OP_0||e>=it.map.OP_1&&e<=it.map.OP_16};it.prototype.inspect=function(){return"<Opcode: "+this.toString()+", hex: "+this.toHex()+", decimal: "+this.num+">"};_O.exports=it});var fr=B((K$,SO)=>{"use strict";y();var ps=Ur(),ZL=mt(),ar=at(),$L=Er(),Qe=function e(t,r){if(!(this instanceof e))return new e(t,r);if(t instanceof ps)this.set({r:t,s:r});else if(t){var i=t;this.set(i)}};Qe.prototype.set=function(e){return this.r=e.r||this.r||void 0,this.s=e.s||this.s||void 0,this.i=typeof e.i<"u"?e.i:this.i,this.compressed=typeof e.compressed<"u"?e.compressed:this.compressed,this.nhashtype=e.nhashtype||this.nhashtype||void 0,this};Qe.fromCompact=function(e){ar.checkArgument(_.Buffer.isBuffer(e),"Argument is expected to be a Buffer");var t=new Qe,r=!0,i=e.slice(0,1)[0]-27-4;i<0&&(r=!1,i=i+4);var n=e.slice(1,33),o=e.slice(33,65);return ar.checkArgument(i===0||i===1||i===2||i===3,new Error("i must be 0, 1, 2, or 3")),ar.checkArgument(n.length===32,new Error("r must be 32 bytes")),ar.checkArgument(o.length===32,new Error("s must be 32 bytes")),t.compressed=r,t.i=i,t.r=ps.fromBuffer(n),t.s=ps.fromBuffer(o),t};Qe.fromDER=Qe.fromBuffer=function(e,t){var r=Qe.parseDER(e,t),i=new Qe;return i.r=r.r,i.s=r.s,i};Qe.fromTxFormat=function(e){var t=e.readUInt8(e.length-1),r=e.slice(0,e.length-1),i=Qe.fromDER(r,!1);return i.nhashtype=t,i};Qe.fromString=function(e){var t=_.Buffer.from(e,"hex");return Qe.fromDER(t)};function wO(e,t){ar.checkArgument(t.length>0,new Error("Length of "+e+" is zero")),ar.checkArgument(!(t[0]&128),new Error("Value of "+e+" is negative")),ar.checkArgument(!(t.length>1&&t[0]===0&&!(t[1]&128)),new Error("Value of "+e+" is excessively padded"))}Qe.parseDER=function(e,t){ar.checkArgument(_.Buffer.isBuffer(e),new Error("DER formatted signature should be a buffer")),ZL.isUndefined(t)&&(t=!0);var r=e[0];ar.checkArgument(r===48,new Error("Header byte should be 0x30"));var i=e[1],n=e.slice(2).length;ar.checkArgument(!t||i===n,new Error("Length byte should length of what follows")),i=i<n?i:n;var o=e[2];ar.checkArgument(o===2,new Error("Integer byte for r should be 0x02"));var s=e[3],f=e.slice(4,4+s),h=ps.fromBuffer(f),m=e[4]===0;ar.checkArgument(s===f.length,new Error("Length of r incorrect"));var S=e[4+s+0];ar.checkArgument(S===2,new Error("Integer byte for s should be 0x02"));var x=e[4+s+1],I=e.slice(4+s+2,4+s+2+x),T=ps.fromBuffer(I),M=e[4+s+2]===0;ar.checkArgument(x===I.length,new Error("Length of s incorrect"));var N=4+s+2+x;ar.checkArgument(i===N-2,new Error("Length of signature incorrect")),t&&(wO("r",f),wO("s",I));var D={header:r,length:i,rheader:o,rlength:s,rneg:m,rbuf:f,r:h,sheader:S,slength:x,sneg:M,sbuf:I,s:T};return D};Qe.prototype.toCompact=function(e,t){if(e=typeof e=="number"?e:this.i,t=typeof t=="boolean"?t:this.compressed,!(e===0||e===1||e===2||e===3))throw new Error("i must be equal to 0, 1, 2, or 3");var r=e+27+4;t===!1&&(r=r-4);var i=_.Buffer.from([r]),n=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return _.Buffer.concat([i,n,o])};Qe.prototype.toBuffer=Qe.prototype.toDER=function(){var e=this.r.toBuffer(),t=this.s.toBuffer(),r=!!(e[0]&128),i=!!(t[0]&128),n=r?_.Buffer.concat([_.Buffer.from([0]),e]):e,o=i?_.Buffer.concat([_.Buffer.from([0]),t]):t,s=n.length,f=o.length,h=2+s+2+f,m=2,S=2,x=48,I=_.Buffer.concat([_.Buffer.from([x,h,m,s]),n,_.Buffer.from([S,f]),o]);return I};Qe.prototype.toString=function(){var e=this.toDER();return e.toString("hex")};Qe.isTxDER=function(e){if(e.length<9||e.length>73||e[0]!==48||e[1]!==e.length-3)return!1;var t=e[3];if(5+t>=e.length)return!1;var r=e[5+t];if(t+r+7!==e.length)return!1;var i=e.slice(4);if(e[2]!==2||t===0||i[0]&128||t>1&&i[0]===0&&!(i[1]&128))return!1;var n=e.slice(6+t);return!(e[6+t-2]!==2||r===0||n[0]&128||r>1&&n[0]===0&&!(n[1]&128))};Qe.prototype.hasLowS=function(){return!(this.s.lt(new ps(1))||this.s.gt(new ps("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))};Qe.prototype.hasDefinedHashtype=function(){if(!$L.isNaturalNumber(this.nhashtype))return!1;var e=this.nhashtype&31;return!(e<Qe.SIGHASH_ALL||e>Qe.SIGHASH_SINGLE)};Qe.prototype.toTxFormat=function(){var e=this.toDER(),t=_.Buffer.alloc(1);return t.writeUInt8(this.nhashtype,0),_.Buffer.concat([e,t])};Qe.SIGHASH_ALL=1;Qe.SIGHASH_NONE=2;Qe.SIGHASH_SINGLE=3;Qe.SIGHASH_CHRONICLE=32;Qe.SIGHASH_FORKID=64;Qe.SIGHASH_ANYONECANPAY=128;Qe.prototype.isCanonical=function(){var e=Gn(),t=e.getN().shrn(1);return this.s.lte(t)};Qe.prototype.toCanonical=function(){if(this.isCanonical())return new Qe({r:this.r,s:this.s,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype});var e=Gn(),t=e.getN(),r=t.sub(this.s);return new Qe({r:this.r,s:r,i:this.i,compressed:this.compressed,nhashtype:this.nhashtype})};Qe.prototype.validate=function(){if(!this.r||!this.s)throw new Error("Signature missing r or s component");if(this.r.isZero())throw new Error("Signature r component is zero");if(this.s.isZero())throw new Error("Signature s component is zero");var e=Gn(),t=e.getN();if(this.r.gte(t))throw new Error("Signature r component >= curve order");if(this.s.gte(t))throw new Error("Signature s component >= curve order");if(this.r.isNeg())throw new Error("Signature r component is negative");if(this.s.isNeg())throw new Error("Signature s component is negative");return!0};Qe.prototype.isValid=function(){try{return this.validate(),!0}catch{return!1}};Qe.prototype.applySecurityPatches=function(){var e=Gn(),t=e.getN(),r=t.shrn(1);if(this.r.isZero()||this.s.isZero())throw new Error("Invalid signature: zero r or s");if(this.r.gte(t)||this.s.gte(t))throw new Error("Invalid signature: out of range");if(this.s.gt(r))throw new Error("Invalid signature: non-canonical (high) s");return this};SO.exports=Qe});var vv=B((G$,IO)=>{"use strict";y();var di=ys(),XL=gu(),JL=ds(),pv=ir(),ie=dv(),vs=Gr(),gs=fr(),EO=du(),Et=at(),et=mt(),gv=jn(),xO=xt(),QL=Er(),K=function e(t){if(!(this instanceof e))return new e(t);if(this.chunks=[],_.Buffer.isBuffer(t))return e.fromBuffer(t);if(t instanceof di)return e.fromAddress(t);if(t instanceof e)return e.fromBuffer(t.toBuffer());if(et.isString(t))return e.fromString(t);et.isObject(t)&&et.isArray(t.chunks)&&this.set(t)};K.prototype.set=function(e){return Et.checkArgument(et.isObject(e)),Et.checkArgument(et.isArray(e.chunks)),this.chunks=e.chunks,this};K.fromBuffer=function(e){var t=new K;t.chunks=[];for(var r=new XL(e);!r.finished();)try{var i=r.readUInt8(),n,o;i>0&&i<ie.OP_PUSHDATA1?(n=i,t.chunks.push({buf:r.read(n),len:n,opcodenum:i})):i===ie.OP_PUSHDATA1?(n=r.readUInt8(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):i===ie.OP_PUSHDATA2?(n=r.readUInt16LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):i===ie.OP_PUSHDATA4?(n=r.readUInt32LE(),o=r.read(n),t.chunks.push({buf:o,len:n,opcodenum:i})):t.chunks.push({opcodenum:i})}catch(s){throw s instanceof RangeError?new gv.Script.InvalidBuffer(e.toString("hex")):s}return t};K.prototype.toBuffer=function(){for(var e=new JL,t=0;t<this.chunks.length;t++){var r=this.chunks[t],i=r.opcodenum;e.writeUInt8(r.opcodenum),r.buf&&(i<ie.OP_PUSHDATA1?e.write(r.buf):i===ie.OP_PUSHDATA1?(e.writeUInt8(r.len),e.write(r.buf)):i===ie.OP_PUSHDATA2?(e.writeUInt16LE(r.len),e.write(r.buf)):i===ie.OP_PUSHDATA4&&(e.writeUInt32LE(r.len),e.write(r.buf)))}return e.concat()};K.fromASM=function(e){var t=new K;t.chunks=[];for(var r=e.split(" "),i=0;i<r.length;){var n=r[i],o=ie(n),s=o.toNumber();if(n==="0")s=0,t.chunks.push({opcodenum:s}),i=i+1;else if(n==="-1")s=ie.OP_1NEGATE,t.chunks.push({opcodenum:s}),i=i+1;else if(et.isUndefined(s)){var f=_.Buffer.from(r[i],"hex");if(f.toString("hex")!==r[i])throw new Error("invalid hex string in script");var h=f.length;h>=0&&h<ie.OP_PUSHDATA1?s=h:h<Math.pow(2,8)?s=ie.OP_PUSHDATA1:h<Math.pow(2,16)?s=ie.OP_PUSHDATA2:h<Math.pow(2,32)&&(s=ie.OP_PUSHDATA4),t.chunks.push({buf:f,len:f.length,opcodenum:s}),i=i+1}else t.chunks.push({opcodenum:s}),i=i+1}return t};K.fromHex=function(e){return new K(xO.Buffer.from(e,"hex"))};K.fromString=function(e){if(QL.isHexa(e)||e.length===0)return new K(xO.Buffer.from(e,"hex"));var t=new K;t.chunks=[];for(var r=e.split(" "),i=0;i<r.length;){var n=r[i],o=ie(n),s=o.toNumber();if(et.isUndefined(s))if(s=parseInt(n),s>0&&s<ie.OP_PUSHDATA1)t.chunks.push({buf:_.Buffer.from(r[i+1].slice(2),"hex"),len:s,opcodenum:s}),i=i+2;else throw new Error("Invalid script: "+JSON.stringify(e));else if(s===ie.OP_PUSHDATA1||s===ie.OP_PUSHDATA2||s===ie.OP_PUSHDATA4){if(r[i+2].slice(0,2)!=="0x")throw new Error("Pushdata data must start with 0x");t.chunks.push({buf:_.Buffer.from(r[i+2].slice(2),"hex"),len:parseInt(r[i+1]),opcodenum:s}),i=i+3}else t.chunks.push({opcodenum:s}),i=i+1}return t};K.prototype._chunkToString=function(e,t){var r=e.opcodenum,i=t==="asm",n="";if(e.buf)!i&&(r===ie.OP_PUSHDATA1||r===ie.OP_PUSHDATA2||r===ie.OP_PUSHDATA4)&&(n=n+" "+ie(r).toString()),e.len>0&&(i?n=n+" "+e.buf.toString("hex"):n=n+" "+e.len+" 0x"+e.buf.toString("hex"));else if(typeof ie.reverseMap[r]<"u")i?r===0?n=n+" 0":r===79?n=n+" -1":n=n+" "+ie(r).toString():n=n+" "+ie(r).toString();else{var o=r.toString(16);o.length%2!==0&&(o="0"+o),i?n=n+" "+o:n=n+" 0x"+o}return n};K.prototype.toASM=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r,"asm")}return e.substr(1)};K.prototype.toString=function(){for(var e="",t=0;t<this.chunks.length;t++){var r=this.chunks[t];e+=this._chunkToString(r)}return e.substr(1)};K.prototype.toHex=function(){return this.toBuffer().toString("hex")};K.prototype.inspect=function(){return"<Script: "+this.toString()+">"};K.prototype.isPublicKeyHashOut=function(){return!!(this.chunks.length===5&&this.chunks[0].opcodenum===ie.OP_DUP&&this.chunks[1].opcodenum===ie.OP_HASH160&&this.chunks[2].buf&&this.chunks[2].buf.length===20&&this.chunks[3].opcodenum===ie.OP_EQUALVERIFY&&this.chunks[4].opcodenum===ie.OP_CHECKSIG)};K.prototype.isPublicKeyHashOutPrefix=function(){return!!(this.chunks.length>=5&&this.chunks[0].opcodenum===ie.OP_DUP&&this.chunks[1].opcodenum===ie.OP_HASH160&&this.chunks[2].buf&&this.chunks[2].buf.length===20&&this.chunks[3].opcodenum===ie.OP_EQUALVERIFY&&this.chunks[4].opcodenum===ie.OP_CHECKSIG)};K.prototype.isPublicKeyHashIn=function(){if(this.chunks.length===2){var e=this.chunks[0].buf,t=this.chunks[1].buf;if(e&&e.length&&e[0]===48&&t&&t.length){var r=t[0];if((r===4||r===6||r===7)&&t.length===65)return!0;if((r===3||r===2)&&t.length===33)return!0}}return!1};K.prototype.getPublicKey=function(){return Et.checkState(this.isPublicKeyOut(),"Can't retrieve PublicKey from a non-PK output"),this.chunks[0].buf};K.prototype.getPublicKeyHash=function(){return Et.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf};K.prototype.isPublicKeyOut=function(){if(this.chunks.length===2&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===ie.OP_CHECKSIG){var e=this.chunks[0].buf,t=e[0],r=!1;if(((t===4||t===6||t===7)&&e.length===65||(t===3||t===2)&&e.length===33)&&(r=!0),r)return vs.isValid(e)}return!1};K.prototype.isPublicKeyIn=function(){if(this.chunks.length===1){var e=this.chunks[0].buf;if(e&&e.length&&e[0]===48)return!0}return!1};K.prototype.isScriptHashOut=function(){var e=this.toBuffer();return e.length===23&&e[0]===ie.OP_HASH160&&e[1]===20&&e[e.length-1]===ie.OP_EQUAL};K.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var e=this.chunks[this.chunks.length-1],t=e.buf;if(!t)return!1;var r;try{r=K.fromBuffer(t)}catch(n){if(n instanceof gv.Script.InvalidBuffer)return!1;throw n}var i=r.classify();return i!==K.types.UNKNOWN};K.prototype.isMultisigOut=function(){return this.chunks.length>3&&ie.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return e.buf&&_.Buffer.isBuffer(e.buf)})&&ie.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===ie.OP_CHECKMULTISIG};K.prototype.isMultisigIn=function(){return this.chunks.length>=2&&this.chunks[0].opcodenum===0&&this.chunks.slice(1,this.chunks.length).every(function(e){return e.buf&&_.Buffer.isBuffer(e.buf)&&gs.isTxDER(e.buf)})};K.prototype.isDataOut=function(){var e=this.chunks.length>=1&&this.chunks[0].opcodenum===ie.OP_RETURN;if(!e)return!1;var t=this.chunks.slice(1),r=new K({chunks:t});return r.isPushOnly()};K.prototype.isSafeDataOut=function(){if(this.chunks.length<2||this.chunks[0].opcodenum!==ie.OP_FALSE)return!1;var e=this.chunks.slice(1),t=new K({chunks:e});return t.isDataOut()};K.prototype.getData=function(){if(this.isSafeDataOut()){var e=this.chunks.slice(2),t=e.map(r=>r.buf);return t}if(this.isDataOut()||this.isScriptHashOut())return et.isUndefined(this.chunks[1])?_.Buffer.alloc(0):_.Buffer.from(this.chunks[1].buf);if(this.isPublicKeyHashOut())return _.Buffer.from(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")};K.prototype.isPushOnly=function(){return et.every(this.chunks,function(e){return e.opcodenum<=ie.OP_16||e.opcodenum===ie.OP_PUSHDATA1||e.opcodenum===ie.OP_PUSHDATA2||e.opcodenum===ie.OP_PUSHDATA4})};K.types={};K.types.UNKNOWN="Unknown";K.types.PUBKEY_OUT="Pay to public key";K.types.PUBKEY_IN="Spend from public key";K.types.PUBKEYHASH_OUT="Pay to public key hash";K.types.PUBKEYHASH_IN="Spend from public key hash";K.types.SCRIPTHASH_OUT="Pay to script hash";K.types.SCRIPTHASH_IN="Spend from script hash";K.types.MULTISIG_OUT="Pay to multisig";K.types.MULTISIG_IN="Spend from multisig";K.types.DATA_OUT="Data push";K.types.SAFE_DATA_OUT="Safe data push";K.OP_RETURN_STANDARD_SIZE=220;K.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var e=this.classifyOutput();return e!==K.types.UNKNOWN?e:this.classifyInput()};K.outputIdentifiers={};K.outputIdentifiers.PUBKEY_OUT=K.prototype.isPublicKeyOut;K.outputIdentifiers.PUBKEYHASH_OUT=K.prototype.isPublicKeyHashOut;K.outputIdentifiers.MULTISIG_OUT=K.prototype.isMultisigOut;K.outputIdentifiers.SCRIPTHASH_OUT=K.prototype.isScriptHashOut;K.outputIdentifiers.DATA_OUT=K.prototype.isDataOut;K.outputIdentifiers.SAFE_DATA_OUT=K.prototype.isSafeDataOut;K.prototype.classifyOutput=function(){for(var e in K.outputIdentifiers)if(K.outputIdentifiers[e].bind(this)())return K.types[e];return K.types.UNKNOWN};K.inputIdentifiers={};K.inputIdentifiers.PUBKEY_IN=K.prototype.isPublicKeyIn;K.inputIdentifiers.PUBKEYHASH_IN=K.prototype.isPublicKeyHashIn;K.inputIdentifiers.MULTISIG_IN=K.prototype.isMultisigIn;K.inputIdentifiers.SCRIPTHASH_IN=K.prototype.isScriptHashIn;K.prototype.classifyInput=function(){for(var e in K.inputIdentifiers)if(K.inputIdentifiers[e].bind(this)())return K.types[e];return K.types.UNKNOWN};K.prototype.isStandard=function(){return this.classify()!==K.types.UNKNOWN};K.prototype.prepend=function(e){return this._addByType(e,!0),this};K.prototype.equals=function(e){if(Et.checkState(e instanceof K,"Must provide another script"),this.chunks.length!==e.chunks.length)return!1;var t;for(t=0;t<this.chunks.length;t++){if(_.Buffer.isBuffer(this.chunks[t].buf)&&!_.Buffer.isBuffer(e.chunks[t].buf)||_.Buffer.isBuffer(this.chunks[t].buf)&&!this.chunks[t].buf.equals(e.chunks[t].buf))return!1;if(this.chunks[t].opcodenum!==e.chunks[t].opcodenum)return!1}return!0};K.prototype.add=function(e){return this._addByType(e,!1),this};K.prototype._addByType=function(e,t){if(typeof e=="string")this._addOpcode(e,t);else if(typeof e=="number")this._addOpcode(e,t);else if(e instanceof ie)this._addOpcode(e,t);else if(_.Buffer.isBuffer(e))this._addBuffer(e,t);else if(e instanceof K)this.chunks=this.chunks.concat(e.chunks);else if(typeof e=="object")this._insertAtPosition(e,t);else throw new Error("Invalid script chunk")};K.prototype._insertAtPosition=function(e,t){t?this.chunks.unshift(e):this.chunks.push(e)};K.prototype._addOpcode=function(e,t){var r;return typeof e=="number"?r=e:e instanceof ie?r=e.toNumber():r=ie(e).toNumber(),this._insertAtPosition({opcodenum:r},t),this};K.prototype._addBuffer=function(e,t){var r,i=e.length;if(i>=0&&i<ie.OP_PUSHDATA1)r=i;else if(i<Math.pow(2,8))r=ie.OP_PUSHDATA1;else if(i<Math.pow(2,16))r=ie.OP_PUSHDATA2;else if(i<Math.pow(2,32))r=ie.OP_PUSHDATA4;else throw new Error("You can't push that much data");return this._insertAtPosition({buf:e,len:i,opcodenum:r},t),this};K.prototype.removeCodeseparators=function(){for(var e=[],t=0;t<this.chunks.length;t++)this.chunks[t].opcodenum!==ie.OP_CODESEPARATOR&&e.push(this.chunks[t]);return this.chunks=e,this};K.buildMultisigOut=function(e,t,r){Et.checkArgument(t<=e.length,"Number of required signatures must be less than or equal to the number of public keys"),r=r||{};var i=new K;i.add(ie.smallInt(t)),e=et.map(e,vs);var n=e;r.noSorting||(n=e.map(f=>f.toString("hex")).sort().map(f=>new vs(f)));for(var o=0;o<n.length;o++){var s=n[o];i.add(s.toBuffer())}return i.add(ie.smallInt(e.length)),i.add(ie.OP_CHECKMULTISIG),i};K.buildMultisigIn=function(e,t,r,i){Et.checkArgument(et.isArray(e)),Et.checkArgument(et.isNumber(t)),Et.checkArgument(et.isArray(r)),i=i||{};var n=new K;return n.add(ie.OP_0),et.each(r,function(o){Et.checkArgument(_.Buffer.isBuffer(o),"Signatures must be an array of Buffers"),n.add(o)}),n};K.buildP2SHMultisigIn=function(e,t,r,i){Et.checkArgument(et.isArray(e)),Et.checkArgument(et.isNumber(t)),Et.checkArgument(et.isArray(r)),i=i||{};var n=new K;return n.add(ie.OP_0),et.each(r,function(o){Et.checkArgument(_.Buffer.isBuffer(o),"Signatures must be an array of Buffers"),n.add(o)}),n.add((i.cachedMultisig||K.buildMultisigOut(e,t,i)).toBuffer()),n};K.buildPublicKeyHashOut=function(e){Et.checkArgument(!et.isUndefined(e)),Et.checkArgument(e instanceof vs||e instanceof di||et.isString(e)),e instanceof vs?e=e.toAddress():et.isString(e)&&(e=new di(e));var t=new K;return t.add(ie.OP_DUP).add(ie.OP_HASH160).add(e.hashBuffer).add(ie.OP_EQUALVERIFY).add(ie.OP_CHECKSIG),t._network=e.network,t};K.buildPublicKeyOut=function(e){Et.checkArgument(e instanceof vs);var t=new K;return t.add(e.toBuffer()).add(ie.OP_CHECKSIG),t};K.buildDataOut=function(e,t){Et.checkArgument(et.isUndefined(e)||et.isString(e)||et.isArray(e)||_.Buffer.isBuffer(e));var r=e;et.isArray(r)||(r=[e]);var i=new K;i.add(ie.OP_RETURN);for(let n of r)Et.checkArgument(et.isUndefined(n)||et.isString(n)||_.Buffer.isBuffer(n)),et.isString(n)&&(n=_.Buffer.from(n,t)),et.isUndefined(n)||i.add(n);return i};K.buildSafeDataOut=function(e,t){var r=K.buildDataOut(e,t),i=new K;return i.add(ie.OP_FALSE),i.add(r),i};K.buildScriptHashOut=function(e){Et.checkArgument(e instanceof K||e instanceof di&&e.isPayToScriptHash());var t=new K;return t.add(ie.OP_HASH160).add(e instanceof di?e.hashBuffer:pv.sha256ripemd160(e.toBuffer())).add(ie.OP_EQUAL),t._network=e._network||e.network,t};K.buildPublicKeyIn=function(e,t){Et.checkArgument(e instanceof gs||_.Buffer.isBuffer(e)),Et.checkArgument(et.isUndefined(t)||et.isNumber(t)),e instanceof gs&&(e=e.toBuffer());var r=new K;return r.add(_.Buffer.concat([e,_.Buffer.from([(t||gs.SIGHASH_ALL)&255])])),r};K.buildPublicKeyHashIn=function(e,t,r){Et.checkArgument(t instanceof gs||_.Buffer.isBuffer(t)),Et.checkArgument(et.isUndefined(r)||et.isNumber(r)),t instanceof gs&&(t=t.toBuffer());var i=new K().add(_.Buffer.concat([t,_.Buffer.from([(r||gs.SIGHASH_ALL)&255])])).add(new vs(e).toBuffer());return i};K.empty=function(){return new K};K.prototype.toScriptHashOut=function(){return K.buildScriptHashOut(this)};K.fromAddress=function(e){if(e=di(e),e.isPayToScriptHash())return K.buildScriptHashOut(e);if(e.isPayToPublicKeyHash())return K.buildPublicKeyHashOut(e);throw new gv.Script.UnrecognizedAddress(e)};K.prototype.getAddressInfo=function(e){if(this._isInput)return this._getInputAddressInfo();if(this._isOutput)return this._getOutputAddressInfo();var t=this._getOutputAddressInfo();return t||this._getInputAddressInfo()};K.prototype._getOutputAddressInfo=function(){var e={};if(this.isScriptHashOut())e.hashBuffer=this.getData(),e.type=di.PayToScriptHash;else if(this.isPublicKeyHashOut())e.hashBuffer=this.getData(),e.type=di.PayToPublicKeyHash;else return!1;return e};K.prototype._getInputAddressInfo=function(){var e={};if(this.isPublicKeyHashIn())e.hashBuffer=pv.sha256ripemd160(this.chunks[1].buf),e.type=di.PayToPublicKeyHash;else if(this.isScriptHashIn())e.hashBuffer=pv.sha256ripemd160(this.chunks[this.chunks.length-1].buf),e.type=di.PayToScriptHash;else return!1;return e};K.prototype.toAddress=function(e){var t=this.getAddressInfo();return t?(t.network=EO.get(e)||this._network||EO.defaultNetwork,new di(t)):!1};K.prototype.findAndDelete=function(e){for(var t=e.toBuffer(),r=t.toString("hex"),i=0;i<this.chunks.length;i++){var n=K({chunks:[this.chunks[i]]}),o=n.toBuffer(),s=o.toString("hex");r===s&&this.chunks.splice(i,1)}return this};K.prototype.checkMinimalPush=function(e){var t=this.chunks[e],r=t.buf,i=t.opcodenum;return r?r.length===0?i===ie.OP_0:r.length===1&&r[0]>=1&&r[0]<=16?i===ie.OP_1+(r[0]-1):r.length===1&&r[0]===129?i===ie.OP_1NEGATE:r.length<=75?i===r.length:r.length<=255?i===ie.OP_PUSHDATA1:r.length<=65535?i===ie.OP_PUSHDATA2:!0:!0};K.prototype._decodeOP_N=function(e){if(e===ie.OP_0)return 0;if(e>=ie.OP_1&&e<=ie.OP_16)return e-(ie.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(e))};K.prototype.getSignatureOperationsCount=function(e){e=et.isUndefined(e)?!0:e;var t=this,r=0,i=ie.OP_INVALIDOPCODE;return et.each(t.chunks,function(o){var s=o.opcodenum;s===ie.OP_CHECKSIG||s===ie.OP_CHECKSIGVERIFY?r++:(s===ie.OP_CHECKMULTISIG||s===ie.OP_CHECKMULTISIGVERIFY)&&(e&&i>=ie.OP_1&&i<=ie.OP_16?r+=t._decodeOP_N(i):r+=20),i=s}),r};IO.exports=K});var yv=B((W$,OO)=>{y();var eU=Object.prototype.toString;OO.exports=function(t){if(t===void 0)return"undefined";if(t===null)return"null";var r=typeof t;if(r==="boolean")return"boolean";if(r==="string")return"string";if(r==="number")return"number";if(r==="symbol")return"symbol";if(r==="function")return oU(t)?"generatorfunction":"function";if(tU(t))return"array";if(fU(t))return"buffer";if(aU(t))return"arguments";if(iU(t))return"date";if(rU(t))return"error";if(nU(t))return"regexp";switch(AO(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(sU(t))return"generator";switch(r=eU.call(t),r){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")};function AO(e){return typeof e.constructor=="function"?e.constructor.name:null}function tU(e){return Array.isArray?Array.isArray(e):e instanceof Array}function rU(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function iU(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function nU(e){return e instanceof RegExp?!0:typeof e.flags=="string"&&typeof e.ignoreCase=="boolean"&&typeof e.multiline=="boolean"&&typeof e.global=="boolean"}function oU(e,t){return AO(e)==="GeneratorFunction"}function sU(e){return typeof e.throw=="function"&&typeof e.return=="function"&&typeof e.next=="function"}function aU(e){try{if(typeof e.length=="number"&&typeof e.callee=="function")return!0}catch(t){if(t.message.indexOf("callee")!==-1)return!0}return!1}function fU(e){return e.constructor&&typeof e.constructor.isBuffer=="function"?e.constructor.isBuffer(e):!1}});var BO=B((Z$,TO)=>{"use strict";y();var RO=Symbol.prototype.valueOf,uU=yv();function cU(e,t){switch(uU(e)){case"array":return e.slice();case"object":return Object.assign({},e);case"date":return new e.constructor(Number(e));case"map":return new Map(e);case"set":return new Set(e);case"buffer":return pU(e);case"symbol":return gU(e);case"arraybuffer":return lU(e);case"float32array":case"float64array":case"int16array":case"int32array":case"int8array":case"uint16array":case"uint32array":case"uint8clampedarray":case"uint8array":return dU(e);case"regexp":return hU(e);case"error":return Object.create(e);default:return e}}function hU(e){let t=e.flags!==void 0?e.flags:/\w+$/.exec(e)||void 0,r=new e.constructor(e.source,t);return r.lastIndex=e.lastIndex,r}function lU(e){let t=new e.constructor(e.byteLength);return new Uint8Array(t).set(new Uint8Array(e)),t}function dU(e,t){return new e.constructor(e.buffer,e.byteOffset,e.length)}function pU(e){let t=e.length,r=_.Buffer.allocUnsafe?_.Buffer.allocUnsafe(t):_.Buffer.from(t);return e.copy(r),r}function gU(e){return RO?Object(RO.call(e)):{}}TO.exports=cU});var MO=B((X$,PO)=>{"use strict";y();PO.exports=function(t){return t!=null&&typeof t=="object"&&Array.isArray(t)===!1}});var CO=B((Q$,NO)=>{"use strict";y();var vU=MO();function kO(e){return vU(e)===!0&&Object.prototype.toString.call(e)==="[object Object]"}NO.exports=function(t){var r,i;return!(kO(t)===!1||(r=t.constructor,typeof r!="function")||(i=r.prototype,kO(i)===!1)||i.hasOwnProperty("isPrototypeOf")===!1)}});var qO=B((tX,DO)=>{"use strict";y();var yU=BO(),mU=yv(),bU=CO();function mv(e,t){switch(mU(e)){case"object":return _U(e,t);case"array":return wU(e,t);default:return yU(e)}}function _U(e,t){if(typeof t=="function")return t(e);if(t||bU(e)){let r=new e.constructor;for(let i in e)r[i]=mv(e[i],t);return r}return e}function wU(e,t){let r=new e.constructor(e.length);for(let i=0;i<e.length;i++)r[i]=mv(e[i],t);return r}DO.exports=mv});var Bu=B((iX,FO)=>{"use strict";y();var LO=ds(),UO=gu(),SU=Ur(),pi=function e(t){if(!(this instanceof e))return new e(t);if(_.Buffer.isBuffer(t))this.buf=t;else if(typeof t=="number"){var r=t;this.fromNumber(r)}else if(t instanceof SU){var i=t;this.fromBN(i)}else if(t){var n=t;this.set(n)}};pi.prototype.set=function(e){return this.buf=e.buf||this.buf,this};pi.prototype.fromString=function(e){return this.set({buf:_.Buffer.from(e,"hex")}),this};pi.prototype.toString=function(){return this.buf.toString("hex")};pi.prototype.fromBuffer=function(e){return this.buf=e,this};pi.prototype.fromBufferReader=function(e){return this.buf=e.readVarintBuf(),this};pi.prototype.fromBN=function(e){return this.buf=LO().writeVarintBN(e).concat(),this};pi.prototype.fromNumber=function(e){return this.buf=LO().writeVarintNum(e).concat(),this};pi.prototype.toBuffer=function(){return this.buf};pi.prototype.toBN=function(){return UO(this.buf).readVarintBN()};pi.prototype.toNumber=function(){return UO(this.buf).readVarintNum()};FO.exports=pi});var En=B((oX,HO)=>{"use strict";y();var Cl=mt(),bv=Ur(),jO=xt(),Dl=Er(),EU=ds(),xU=Bu(),_v=gi(),wv=at(),IU=jn(),AU=9007199254740991;function zt(e){if(!(this instanceof zt))return new zt(e);if(Cl.isObject(e))if(this.satoshis=e.satoshis,_.Buffer.isBuffer(e.script))this._scriptBuffer=e.script;else{var t;Cl.isString(e.script)&&Dl.isHexa(e.script)?t=jO.Buffer.from(e.script,"hex"):t=e.script,this.setScript(t)}else throw new TypeError("Unrecognized argument for Output")}Object.defineProperty(zt.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}});Object.defineProperty(zt.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(e){e instanceof bv?(this._satoshisBN=e,this._satoshis=e.toNumber()):Cl.isString(e)?(this._satoshis=parseInt(e),this._satoshisBN=bv.fromNumber(this._satoshis)):(wv.checkArgument(Dl.isNaturalNumber(e),"Output satoshis is not a natural number"),this._satoshisBN=bv.fromNumber(e),this._satoshis=e),wv.checkState(Dl.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}});zt.prototype.invalidSatoshis=function(){return this._satoshis>AU?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0?"transaction txout negative":!1};Object.defineProperty(zt.prototype,"satoshisBN",{configurable:!1,enumerable:!0,get:function(){return this._satoshisBN},set:function(e){this._satoshisBN=e,this._satoshis=e.toNumber(),wv.checkState(Dl.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}});zt.prototype.toObject=zt.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t};zt.fromObject=function(e){return new zt(e)};zt.prototype.setScriptFromBuffer=function(e){this._scriptBuffer=e;try{this._script=_v.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(t){if(t instanceof IU.Script.InvalidBuffer)this._script=null;else throw t}};zt.prototype.setScript=function(e){if(e instanceof _v)this._scriptBuffer=e.toBuffer(),this._script=e,this._script._isOutput=!0;else if(Cl.isString(e))this._script=_v.fromString(e),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else if(_.Buffer.isBuffer(e))this.setScriptFromBuffer(e);else throw new TypeError("Invalid argument type: script");return this};zt.prototype.inspect=function(){var e;return this.script?e=this.script.inspect():e=this._scriptBuffer.toString("hex"),"<Output ("+this.satoshis+" sats) "+e+">"};zt.fromBufferReader=function(e){var t={};t.satoshis=e.readUInt64LEBN();var r=e.readVarintNum();return r!==0?t.script=e.read(r):t.script=jO.Buffer.from([]),new zt(t)};zt.prototype.toBufferWriter=function(e){e||(e=new EU),e.writeUInt64LEBN(this._satoshisBN);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e};zt.prototype.getSize=function(){var e=this.script.toBuffer().length,t=xU(e).toBuffer().length;return 8+t+e};HO.exports=zt});var Pu=B((aX,KO)=>{"use strict";y();var xr=Ur(),Ki=Gn(),OU=fr(),RU=Gr(),TU=Jf(),Qn=ir(),BU=mt(),Sv=at(),gt=function e(t){if(!(this instanceof e))return new e(t);t&&this.set(t)};Object.defineProperty(gt.prototype,"k",{get:function(){return this._k},set:function(e){this._k=e,this._kFresh=!0},enumerable:!0,configurable:!0});gt.prototype.set=function(e){if(this.hashbuf=e.hashbuf||this.hashbuf,this.endian=e.endian||this.endian,this.privkey=e.privkey||this.privkey,this.pubkey=e.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),e.sig)if(_.Buffer.isBuffer(e.sig)){var t=fr();this.sig=t.fromDER(e.sig)}else this.sig=e.sig;else this.sig=this.sig;return e.k&&(this.k=e.k),this.verified=e.verified||this.verified,this};gt.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()};gt.prototype.calci=function(){for(var e=0;e<4;e++){this.sig.i=e;var t;try{t=this.toPublicKey()}catch(r){console.error(r);continue}if(t.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")};gt.fromString=function(e){var t=JSON.parse(e);return new gt(t)};gt.prototype.randomK=function(){var e=Ki.getN(),t;do t=xr.fromBuffer(TU.getRandomBuffer(32));while(!(t.lt(e)&&t.gt(xr.Zero)));return this.k=t,this};gt.prototype.deterministicK=function(e){BU.isUndefined(e)&&(e=0);var t=_.Buffer.alloc(32);t.fill(1);var r=_.Buffer.alloc(32);r.fill(0);var i=this.privkey.bn.toBuffer({size:32}),n=this.endian==="little"?_.Buffer.from(this.hashbuf).reverse():this.hashbuf;r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([0]),i,n]),r),t=Qn.sha256hmac(t,r),r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([1]),i,n]),r),t=Qn.sha256hmac(t,r),t=Qn.sha256hmac(t,r);for(var o=xr.fromBuffer(t),s=Ki.getN(),f=0;f<e||!(o.lt(s)&&o.gt(xr.Zero));f++)r=Qn.sha256hmac(_.Buffer.concat([t,_.Buffer.from([0])]),r),t=Qn.sha256hmac(t,r),t=Qn.sha256hmac(t,r),o=xr.fromBuffer(t);return this.k=o,this};gt.prototype.toPublicKey=function(){var e=this.sig.i;Sv.checkArgument(e===0||e===1||e===2||e===3,new Error("i must be equal to 0, 1, 2, or 3"));var t=xr.fromBuffer(this.hashbuf),r=this.sig.r,i=this.sig.s,n=e&1,o=e>>1,s=Ki.getN(),f=Ki.getG(),h=o?r.add(s):r,m=Ki.fromX(n,h),S=m.mul(s);if(!S.isInfinity())throw new Error("nR is not a valid curve point");var x=t.neg().umod(s),I=r.invm(s),T=m.mul(i).add(f.mul(x)).mul(I),M=RU.fromPoint(T,this.sig.compressed);return M};gt.prototype.sigError=function(){if(!_.Buffer.isBuffer(this.hashbuf)||this.hashbuf.length!==32)return"hashbuf must be a 32 byte buffer";var e=this.sig.r,t=this.sig.s,r=Ki.getN();try{if(e.lte(xr.Zero)||t.lte(xr.Zero)||e.gte(r)||t.gte(r))return"r and s not in range";var i=xr.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),n=t.invm(r),o=n.mul(i).umod(r),s=n.mul(e).umod(r),f=Ki.getG().mulAdd(o,this.pubkey.point,s);return f.isInfinity()?"p is infinity":f.getX().umod(r).cmp(e)!==0?"Invalid signature":!1}catch(h){return"Signature security validation failed: "+h.message}};gt.toLowS=function(e){return e.gt(xr.fromBuffer(_.Buffer.from("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(e=Ki.getN().sub(e)),e};gt.prototype._findSignature=function(e,t){var r=Ki.getN(),i=Ki.getG(),n=0,o,s,f,h;do(!this.k||!this._kFresh||n>0)&&this.deterministicK(n),n++,o=this.k,s=i.mul(o),f=s.x.umod(r),h=o.invm(r).mul(t.add(e.mul(f))).umod(r);while(f.cmp(xr.Zero)<=0||h.cmp(xr.Zero)<=0);return this._kFresh=!1,h=gt.toLowS(h),{s:h,r:f}};gt.prototype.sign=function(){var e=this.hashbuf,t=this.privkey,r=t.bn;Sv.checkState(e&&t&&r,new Error("invalid parameters")),Sv.checkState(_.Buffer.isBuffer(e)&&e.length===32,new Error("hashbuf must be a 32 byte buffer"));var i=xr.fromBuffer(e,this.endian?{endian:this.endian}:void 0),n=this._findSignature(r,i);return n.compressed=this.pubkey.compressed,this.sig=new OU(n),this};gt.prototype.signRandomK=function(){return this.randomK(),this.sign()};gt.prototype.toString=function(){var e={};return this.hashbuf&&(e.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(e.privkey=this.privkey.toString()),this.pubkey&&(e.pubkey=this.pubkey.toString()),this.sig&&(e.sig=this.sig.toString()),this.k&&(e.k=this.k.toString()),JSON.stringify(e)};gt.prototype.verify=function(){return this.verified=!this.sigError(),this.verified};gt.prototype.verifyBool=function(){return this.verify()===!0};gt.sign=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).sign().sig};gt.signWithCalcI=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).sign().calci().sig};gt.signRandomK=function(e,t,r){return gt().set({hashbuf:e,endian:r,privkey:t}).signRandomK().sig};gt.verify=function(e,t,r,i){return gt().set({hashbuf:e,endian:i,sig:t,pubkey:r}).verify()};KO.exports=gt});var Na=B((uX,WO)=>{"use strict";y();var eo=mt(),PU=at(),Mu=jn(),MU=ds(),Ev=xt(),GO=Er(),ql=gi(),kU=to(),VO=En(),Ll=4294967295,NU=Ll-2,zO=Ll,CU=Ll-1;function vt(e){if(!(this instanceof vt))return new vt(e);if(e)return this._fromObject(e)}vt.MAXINT=Ll;vt.DEFAULT_SEQNUMBER=zO;vt.DEFAULT_LOCKTIME_SEQNUMBER=CU;vt.DEFAULT_RBF_SEQNUMBER=NU;vt.BASE_SIZE=40;Object.defineProperty(vt.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new ql(this._scriptBuffer),this._script._isInput=!0),this._script)}});vt.fromObject=function(e){PU.checkArgument(eo.isObject(e));var t=new vt;return t._fromObject(e)};vt.prototype._fromObject=function(e){var t;if(eo.isString(e.prevTxId)&&GO.isHexa(e.prevTxId)?t=Ev.Buffer.from(e.prevTxId,"hex"):t=e.prevTxId,this.output=e.output?e.output instanceof VO?e.output:new VO(e.output):void 0,this.prevTxId=t||e.txidbuf,this.outputIndex=eo.isUndefined(e.outputIndex)?e.txoutnum:e.outputIndex,this.sequenceNumber=eo.isUndefined(e.sequenceNumber)?eo.isUndefined(e.seqnum)?zO:e.seqnum:e.sequenceNumber,eo.isUndefined(e.script)&&eo.isUndefined(e.scriptBuffer))throw new Mu.Transaction.Input.MissingScript;return this.setScript(e.scriptBuffer||e.script),this};vt.prototype.toObject=vt.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t};vt.fromBufferReader=function(e){var t=new vt;return t.prevTxId=e.readReverse(32),t.outputIndex=e.readUInt32LE(),t._scriptBuffer=e.readVarLengthBuffer(),t.sequenceNumber=e.readUInt32LE(),t};vt.prototype.toBufferWriter=function(e){e||(e=new MU),e.writeReverse(this.prevTxId),e.writeUInt32LE(this.outputIndex);var t=this._scriptBuffer;return e.writeVarintNum(t.length),e.write(t),e.writeUInt32LE(this.sequenceNumber),e};vt.prototype.setScript=function(e){if(this._script=null,e instanceof ql)this._script=e,this._script._isInput=!0,this._scriptBuffer=e.toBuffer();else if(e===null)this._script=ql.empty(),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(GO.isHexa(e))this._scriptBuffer=Ev.Buffer.from(e,"hex");else if(eo.isString(e))this._script=new ql(e),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else if(_.Buffer.isBuffer(e))this._scriptBuffer=Ev.Buffer.from(e);else throw new TypeError("Invalid argument type: script");return this};vt.prototype.getSignatures=function(){throw new Mu.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))};vt.prototype.isFullySigned=function(){throw new Mu.AbstractMethodInvoked("Input#isFullySigned")};vt.prototype.isFinal=function(){return this.sequenceNumber===vt.MAXINT};vt.prototype.addSignature=function(){throw new Mu.AbstractMethodInvoked("Input#addSignature")};vt.prototype.clearSignatures=function(){throw new Mu.AbstractMethodInvoked("Input#clearSignatures")};vt.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,kU.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)};vt.prototype.isNull=function(){return this.prevTxId.toString("hex")==="0000000000000000000000000000000000000000000000000000000000000000"&&this.outputIndex===4294967295};vt.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length};WO.exports=vt});var Da=B((hX,$O)=>{"use strict";y();var Ca=mt(),zr=at(),DU=we(),YO=Er(),ZO=Gr(),qU=jn(),ku=fr();function vi(e){if(!(this instanceof vi))return new vi(e);if(e instanceof vi)return e;if(Ca.isObject(e))return this._fromObject(e);throw new qU.InvalidArgument("TransactionSignatures must be instantiated from an object")}DU(vi,ku);vi.prototype._fromObject=function(e){return this._checkObjectArgs(e),this.publicKey=new ZO(e.publicKey),this.prevTxId=_.Buffer.isBuffer(e.prevTxId)?e.prevTxId:_.Buffer.from(e.prevTxId,"hex"),this.outputIndex=e.outputIndex,this.inputIndex=e.inputIndex,this.signature=e.signature instanceof ku?e.signature:_.Buffer.isBuffer(e.signature)?ku.fromBuffer(e.signature):ku.fromString(e.signature),this.sigtype=e.sigtype,this};vi.prototype._checkObjectArgs=function(e){zr.checkArgument(ZO(e.publicKey),"publicKey"),zr.checkArgument(!Ca.isUndefined(e.inputIndex),"inputIndex"),zr.checkArgument(!Ca.isUndefined(e.outputIndex),"outputIndex"),zr.checkState(Ca.isNumber(e.inputIndex),"inputIndex must be a number"),zr.checkState(Ca.isNumber(e.outputIndex),"outputIndex must be a number"),zr.checkArgument(e.signature,"signature"),zr.checkArgument(e.prevTxId,"prevTxId"),zr.checkState(e.signature instanceof ku||_.Buffer.isBuffer(e.signature)||YO.isHexa(e.signature),"signature must be a buffer or hexa value"),zr.checkState(_.Buffer.isBuffer(e.prevTxId)||YO.isHexa(e.prevTxId),"prevTxId must be a buffer or hexa value"),zr.checkArgument(e.sigtype,"sigtype"),zr.checkState(Ca.isNumber(e.sigtype),"sigtype must be a number")};vi.prototype.toObject=vi.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}};vi.fromObject=function(e){return zr.checkArgument(e),new vi(e)};$O.exports=vi});var t3=B((dX,e3)=>{"use strict";y();var LU=we(),JO=at(),xv=Na(),UU=En(),FU=to(),QO=gi(),XO=fr(),jU=Da();function xn(){xv.apply(this,arguments)}LU(xn,xv);xn.prototype.getSignatures=function(e,t,r,i){JO.checkState(this.output instanceof UU),i=i||XO.SIGHASH_ALL|XO.SIGHASH_FORKID;var n=t.toPublicKey();return n.toString()===this.output.script.getPublicKey().toString("hex")?[new jU({publicKey:n,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:FU.sign(e,t,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]};xn.prototype.addSignature=function(e,t){return JO.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(QO.buildPublicKeyIn(t.signature.toDER(),t.sigtype)),this};xn.prototype.clearSignatures=function(){return this.setScript(QO.empty()),this};xn.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()};xn.SCRIPT_MAX_SIZE=74;xn.prototype._estimateSize=function(){return xv.BASE_SIZE+xn.SCRIPT_MAX_SIZE};e3.exports=xn});var s3=B((gX,o3)=>{"use strict";y();var HU=we(),i3=at(),KU=ir(),Iv=Na(),VU=En(),GU=to(),n3=gi(),r3=fr(),zU=Da();function In(){Iv.apply(this,arguments)}HU(In,Iv);In.prototype.getSignatures=function(e,t,r,i,n){i3.checkState(this.output instanceof VU),n=n||KU.sha256ripemd160(t.publicKey.toBuffer()),i=i||r3.SIGHASH_ALL|r3.SIGHASH_FORKID;var o=this.output.script.chunks[2]&&this.output.script.chunks[2].buf;return o&&n.equals(o)?[new zU({publicKey:t.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:GU.sign(e,t,i,r,this.output.script,this.output.satoshisBN),sigtype:i})]:[]};In.prototype.addSignature=function(e,t){return i3.checkState(this.isValidSignature(e,t),"Signature is invalid"),this.setScript(n3.buildPublicKeyHashIn(t.publicKey,t.signature.toDER(),t.sigtype)),this};In.prototype.clearSignatures=function(){return this.setScript(n3.empty()),this};In.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()};In.SCRIPT_MAX_SIZE=108;In.prototype._estimateSize=function(){return Iv.BASE_SIZE+In.SCRIPT_MAX_SIZE};o3.exports=In});var u3=B((yX,f3)=>{"use strict";y();var yi=mt(),WU=we(),Fl=Na(),YU=En(),Nu=at(),a3=gi(),Ul=fr(),Av=to(),Ov=Da(),ZU=Gr(),$U=Bu();function Lt(e,t,r,i){Fl.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=t.map(o=>o.toString("hex")).sort().map(o=>new ZU(o)),Nu.checkState(a3.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},yi.each(this.publicKeys,function(o,s){n.publicKeyIndex[o.toString()]=s}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}WU(Lt,Fl);Lt.prototype.toObject=function(){var e=Fl.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=yi.map(this.publicKeys,function(t){return t.toString()}),e.signatures=this._serializeSignatures(),e};Lt.prototype._deserializeSignatures=function(e){return yi.map(e,function(t){if(t)return new Ov(t)})};Lt.prototype._serializeSignatures=function(){return yi.map(this.signatures,function(e){if(e)return e.toObject()})};Lt.prototype.getSignatures=function(e,t,r,i){Nu.checkState(this.output instanceof YU),i=i||Ul.SIGHASH_ALL|Ul.SIGHASH_FORKID;var n=this,o=[];return yi.each(this.publicKeys,function(s){s.toString()===t.publicKey.toString()&&o.push(new Ov({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:Av.sign(e,t,i,r,n.output.script,n.output.satoshisBN),sigtype:i}))}),o};Lt.prototype.addSignature=function(e,t){return Nu.checkState(!this.isFullySigned(),"All needed signatures have already been added"),Nu.checkArgument(!yi.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),Nu.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this};Lt.prototype._updateScript=function(){return this.setScript(a3.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this};Lt.prototype._createSignatures=function(){return yi.map(yi.filter(this.signatures,function(e){return!yi.isUndefined(e)}),function(e){return _.Buffer.concat([e.signature.toDER(),_.Buffer.from([e.sigtype&255])])})};Lt.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()};Lt.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold};Lt.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()};Lt.prototype.countSignatures=function(){return yi.reduce(this.signatures,function(e,t){return e+!!t},0)};Lt.prototype.publicKeysWithoutSignature=function(){var e=this;return yi.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})};Lt.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,Av.verify(e,t.signature,t.publicKey,t.inputIndex,this.output.script,this.output.satoshisBN)};Lt.normalizeSignatures=function(e,t,r,i,n){return n.map(function(o){var s=null;return i=i.filter(function(f){if(s)return!0;var h=new Ov({signature:Ul.fromTxFormat(f),publicKey:o,prevTxId:t.prevTxId,outputIndex:t.outputIndex,inputIndex:r,sigtype:Ul.SIGHASH_ALL});h.signature.nhashtype=h.sigtype;var m=Av.verify(e,h.signature,h.publicKey,h.inputIndex,t.output.script);return m?(s=h,!1):!0}),s||null})};Lt.SIGNATURE_SIZE=73;Lt.prototype._estimateSize=function(){var e=1+this.threshold*Lt.SIGNATURE_SIZE;return Fl.BASE_SIZE+$U(e).toBuffer().length+e};f3.exports=Lt});var p3=B((bX,d3)=>{"use strict";y();var mi=mt(),XU=we(),jl=Na(),JU=En(),Cu=at(),Rv=gi(),c3=fr(),h3=to(),l3=Da(),QU=Gr(),eF=Bu();function Ct(e,t,r,i){jl.apply(this,arguments);var n=this;t=t||e.publicKeys,r=r||e.threshold,i=i||e.signatures,this.publicKeys=t.map(o=>o.toString("hex")).sort().map(o=>new QU(o)),this.redeemScript=Rv.buildMultisigOut(this.publicKeys,r),Cu.checkState(Rv.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},mi.each(this.publicKeys,function(o,s){n.publicKeyIndex[o.toString()]=s}),this.threshold=r,this.signatures=i?this._deserializeSignatures(i):new Array(this.publicKeys.length)}XU(Ct,jl);Ct.prototype.toObject=function(){var e=jl.prototype.toObject.apply(this,arguments);return e.threshold=this.threshold,e.publicKeys=mi.map(this.publicKeys,function(t){return t.toString()}),e.signatures=this._serializeSignatures(),e};Ct.prototype._deserializeSignatures=function(e){return mi.map(e,function(t){if(t)return new l3(t)})};Ct.prototype._serializeSignatures=function(){return mi.map(this.signatures,function(e){if(e)return e.toObject()})};Ct.prototype.getSignatures=function(e,t,r,i){Cu.checkState(this.output instanceof JU),i=i||c3.SIGHASH_ALL|c3.SIGHASH_FORKID;var n=this,o=[];return mi.each(this.publicKeys,function(s){s.toString()===t.publicKey.toString()&&o.push(new l3({publicKey:t.publicKey,prevTxId:n.prevTxId,outputIndex:n.outputIndex,inputIndex:r,signature:h3.sign(e,t,i,r,n.redeemScript,n.output.satoshisBN),sigtype:i}))}),o};Ct.prototype.addSignature=function(e,t){return Cu.checkState(!this.isFullySigned(),"All needed signatures have already been added"),Cu.checkArgument(!mi.isUndefined(this.publicKeyIndex[t.publicKey.toString()]),"Signature has no matching public key"),Cu.checkState(this.isValidSignature(e,t)),this.signatures[this.publicKeyIndex[t.publicKey.toString()]]=t,this._updateScript(),this};Ct.prototype._updateScript=function(){return this.setScript(Rv.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this};Ct.prototype._createSignatures=function(){return mi.map(mi.filter(this.signatures,function(e){return!mi.isUndefined(e)}),function(e){return _.Buffer.concat([e.signature.toDER(),_.Buffer.from([e.sigtype&255])])})};Ct.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()};Ct.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold};Ct.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()};Ct.prototype.countSignatures=function(){return mi.reduce(this.signatures,function(e,t){return e+!!t},0)};Ct.prototype.publicKeysWithoutSignature=function(){var e=this;return mi.filter(this.publicKeys,function(t){return!e.signatures[e.publicKeyIndex[t.toString()]]})};Ct.prototype.isValidSignature=function(e,t){return t.signature.nhashtype=t.sigtype,h3.verify(e,t.signature,t.publicKey,t.inputIndex,this.redeemScript,this.output.satoshisBN)};Ct.SIGNATURE_SIZE=73;Ct.PUBKEY_SIZE=34;Ct.prototype._estimateSize=function(){var e=this.publicKeys.length*Ct.PUBKEY_SIZE,t=this.threshold*Ct.SIGNATURE_SIZE,r=3+e,i=r<=75?1:r<=255?2:3,n=t+1+i+r;return jl.BASE_SIZE+eF(n).toBuffer().length+n};d3.exports=Ct});var Hl=B((wX,qa)=>{y();qa.exports=Na();qa.exports.PublicKey=t3();qa.exports.PublicKeyHash=s3();qa.exports.MultiSig=u3();qa.exports.MultiSigScriptHash=p3()});var to=B((EX,b3)=>{"use strict";y();var tF=xt(),vr=fr(),Tv=gi(),rF=En(),iF=gu(),Du=ds(),g3=Ur(),Kl=ir(),v3=Pu(),Bv=at(),Vl=Gl(),ro=mt(),y3=_.Buffer.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),nF="ffffffffffffffff",oF=Vl.SCRIPT_ENABLE_SIGHASH_FORKID,sF=function(e,t,r,i,n){var o=e.inputs[r];Bv.checkArgument(n instanceof g3,"For ForkId=0 signatures, satoshis or complete input must be provided");function s(N){var D=new Du;ro.each(N.inputs,function(Q){D.writeReverse(Q.prevTxId),D.writeUInt32LE(Q.outputIndex)});var j=D.toBuffer(),Y=Kl.sha256sha256(j);return Y}function f(N){var D=new Du;ro.each(N.inputs,function(Q){D.writeUInt32LE(Q.sequenceNumber)});var j=D.toBuffer(),Y=Kl.sha256sha256(j);return Y}function h(N,D){var j=new Du;ro.isUndefined(D)?ro.each(N.outputs,function(W){W.toBufferWriter(j)}):N.outputs[D].toBufferWriter(j);var Y=j.toBuffer(),Q=Kl.sha256sha256(Y);return Q}var m=_.Buffer.alloc(32),S=_.Buffer.alloc(32),x=_.Buffer.alloc(32);t&vr.SIGHASH_ANYONECANPAY||(m=s(e)),!(t&vr.SIGHASH_ANYONECANPAY)&&(t&31)!==vr.SIGHASH_SINGLE&&(t&31)!==vr.SIGHASH_NONE&&(S=f(e)),(t&31)!==vr.SIGHASH_SINGLE&&(t&31)!==vr.SIGHASH_NONE?x=h(e):(t&31)===vr.SIGHASH_SINGLE&&r<e.outputs.length&&(x=h(e,r));var I=new Du;I.writeInt32LE(e.version),I.write(m),I.write(S),I.writeReverse(o.prevTxId),I.writeUInt32LE(o.outputIndex),I.writeVarintNum(i.toBuffer().length),I.write(i.toBuffer()),I.writeUInt64LEBN(n);var T=o.sequenceNumber;I.writeUInt32LE(T),I.write(x),I.writeUInt32LE(e.nLockTime),I.writeUInt32LE(t>>>0);var M=I.toBuffer();return M},m3=function(t,r,i,n,o,s){var f=Mv(),h=Hl();ro.isUndefined(s)&&(s=oF);var m=f.shallowCopy(t);if(n=new Tv(n),s&Vl.SCRIPT_ENABLE_REPLAY_PROTECTION){var S=r>>8,x=16711680|S^57005;r=x<<8|r&255}if(!(r&vr.SIGHASH_CHRONICLE&&s&Vl.SCRIPT_ENABLE_CHRONICLE)){if(r&vr.SIGHASH_FORKID&&s&Vl.SCRIPT_ENABLE_SIGHASH_FORKID)return sF(m,r,i,n,o)}n.removeCodeseparators();var I;for(I=0;I<m.inputs.length;I++)m.inputs[I]=new h(m.inputs[I]).setScript(Tv.empty());if(m.inputs[i]=new h(m.inputs[i]).setScript(n),(r&31)===vr.SIGHASH_NONE||(r&31)===vr.SIGHASH_SINGLE)for(I=0;I<m.inputs.length;I++)I!==i&&(m.inputs[I].sequenceNumber=0);if((r&31)===vr.SIGHASH_NONE)m.outputs=[];else if((r&31)===vr.SIGHASH_SINGLE){if(i>=m.outputs.length)return y3;for(m.outputs.length=i+1,I=0;I<i;I++)m.outputs[I]=new rF({satoshis:g3.fromBuffer(tF.Buffer.from(nF,"hex")),script:Tv.empty()})}r&vr.SIGHASH_ANYONECANPAY&&(m.inputs=[m.inputs[i]]);var T=new Du().write(m.toBuffer()).writeInt32LE(r).toBuffer();return T},Pv=function(t,r,i,n,o,s){var f=m3(t,r,i,n,o,s);if(f.compare(y3)===0)return f;var h=Kl.sha256sha256(f);return h=new iF(h).readReverse(),h};function aF(e,t,r,i,n,o,s){var f=Pv(e,r,i,n,o,s),h=v3.sign(f,t,"little").set({nhashtype:r});return h}function fF(e,t,r,i,n,o,s){Bv.checkArgument(!ro.isUndefined(e)),Bv.checkArgument(!ro.isUndefined(t)&&!ro.isUndefined(t.nhashtype));var f=Pv(e,t.nhashtype,i,n,o,s);return v3.verify(f,t,r,"little")}b3.exports={sighashPreimage:m3,sighash:Pv,sign:aF,verify:fF}});var kv=B((IX,w3)=>{"use strict";y();var An=mt(),zl=at(),_3=Er(),uF=gi(),cF=ys();function On(e){if(!(this instanceof On))return new On(e);zl.checkArgument(An.isObject(e),"Must provide an object from where to extract data");var t=e.address?new cF(e.address):void 0,r=e.txid?e.txid:e.txId;if(!r||!_3.isHexaString(r)||r.length>64)throw new Error("Invalid TXID in object",e);var i=An.isUndefined(e.vout)?e.outputIndex:e.vout;if(!An.isNumber(i))throw new Error("Invalid outputIndex, received "+i);zl.checkArgument(!An.isUndefined(e.scriptPubKey)||!An.isUndefined(e.script),"Must provide the scriptPubKey for that output!");var n=new uF(e.scriptPubKey||e.script);zl.checkArgument(!An.isUndefined(e.amount)||!An.isUndefined(e.satoshis),"Must provide an amount for the output");var o=An.isUndefined(e.amount)?e.satoshis:Math.round(e.amount*1e8);zl.checkArgument(An.isNumber(o),"Amount must be a number"),_3.defineImmutable(this,{address:t,txId:r,outputIndex:i,script:n,satoshis:o})}On.prototype.inspect=function(){return"<UnspentOutput: "+this.txId+":"+this.outputIndex+", satoshis: "+this.satoshis+", address: "+this.address+">"};On.prototype.toString=function(){return this.txId+":"+this.outputIndex};On.fromObject=function(e){return new On(e)};On.prototype.toObject=On.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:Number.parseFloat((this.satoshis/1e8).toFixed(8))}};w3.exports=On});var Mv=B((OX,T3)=>{"use strict";y();var me=mt(),Wt=at(),hF=xt(),Ft=jn(),E3=Er(),x3=gu(),lF=ds(),S3=Bu(),I3=ir(),Yl=fr(),A3=to(),dF=ys(),O3=kv(),Ut=Hl(),pF=Ut.PublicKeyHash,gF=Ut.PublicKey,vF=Ut.MultiSigScriptHash,yF=Ut.MultiSig,bi=En(),Vi=gi(),mF=ms(),Wl=Ur(),bF=Gl(),_F=bF.SCRIPT_ENABLE_SIGHASH_FORKID;function $(e){if(!(this instanceof $))return new $(e);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,e){if(e instanceof $)return $.shallowCopy(e);if(E3.isHexa(e))this.fromString(e);else if(_.Buffer.isBuffer(e))this.fromBuffer(e);else if(me.isObject(e))this.fromObject(e);else throw new Ft.InvalidArgument("Must provide an object or string to deserialize a transaction")}else this._newTransaction()}var wF=1,SF=0,EF=1e6;$.DUST_AMOUNT=546;$.FEE_SECURITY_MARGIN=150;$.MAX_MONEY=21e6*1e8;$.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8;$.NLOCKTIME_MAX_VALUE=4294967295;$.FEE_PER_KB=500;$.CHANGE_OUTPUT_MAX_SIZE=62;$.shallowCopy=function(e){var t=new $(e.toBuffer());return t};var R3={configurable:!1,enumerable:!0,get:function(){return this._hash=new x3(this._getHash()).readReverse().toString("hex"),this._hash}};Object.defineProperty($.prototype,"hash",R3);Object.defineProperty($.prototype,"id",R3);var Nv={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty($.prototype,"inputAmount",Nv);Nv.get=function(){return this._getOutputAmount()};Object.defineProperty($.prototype,"outputAmount",Nv);$.prototype._getHash=function(){return I3.sha256sha256(this.toBuffer())};$.prototype.serialize=function(e){return e===!0||e&&e.disableAll?this.uncheckedSerialize():this.checkedSerialize(e)};$.prototype.uncheckedSerialize=$.prototype.toString=function(){return this.toBuffer().toString("hex")};$.prototype.checkedSerialize=function(e){var t=this.getSerializationError(e);if(t)throw t.message+=" - For more information please see: https://bsv.io/api/lib/transaction#serialization-checks",t;return this.uncheckedSerialize()};$.prototype.invalidSatoshis=function(){for(var e=!1,t=0;t<this.outputs.length;t++)this.outputs[t].invalidSatoshis()&&(e=!0);return e};$.prototype.getSerializationError=function(e){if(e=e||{},this.invalidSatoshis())return new Ft.Transaction.InvalidSatoshis;var t=this._getUnspentValue(),r;return t<0?e.disableMoreOutputThanInput||(r=new Ft.Transaction.InvalidOutputAmountSum):r=this._hasFeeError(e,t),r||this._hasDustOutputs(e)||this._isMissingSignatures(e)};$.prototype._hasFeeError=function(e,t){if(!me.isUndefined(this._fee)&&this._fee!==t)return new Ft.Transaction.FeeError.Different("Unspent value is "+t+" but specified fee is "+this._fee);if(!e.disableLargeFees){var r=Math.floor($.FEE_SECURITY_MARGIN*this._estimateFee());if(t>r)return this._missingChange()?new Ft.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new Ft.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+t)}};$.prototype._missingChange=function(){return!this._changeScript};$.prototype._hasDustOutputs=function(e){if(!e.disableDustOutputs){var t,r;for(t in this.outputs)if(r=this.outputs[t],r.satoshis<$.DUST_AMOUNT&&!r.script.isDataOut()&&!r.script.isSafeDataOut())return new Ft.Transaction.DustOutputs}};$.prototype._isMissingSignatures=function(e){if(!e.disableIsFullySigned&&!this.isFullySigned())return new Ft.Transaction.MissingSignatures};$.prototype.inspect=function(){return"<Transaction: "+this.uncheckedSerialize()+">"};$.prototype.toBuffer=function(){var e=new lF;return this.toBufferWriter(e).toBuffer()};$.prototype.toBufferWriter=function(e){return e.writeInt32LE(this.version),e.writeVarintNum(this.inputs.length),me.each(this.inputs,function(t){t.toBufferWriter(e)}),e.writeVarintNum(this.outputs.length),me.each(this.outputs,function(t){t.toBufferWriter(e)}),e.writeUInt32LE(this.nLockTime),e};$.prototype.fromBuffer=function(e){var t=new x3(e);return this.fromBufferReader(t)};$.prototype.fromBufferReader=function(e){Wt.checkArgument(!e.finished(),"No transaction data received");var t,r,i;for(this.version=e.readInt32LE(),r=e.readVarintNum(),t=0;t<r;t++){var n=Ut.fromBufferReader(e);this.inputs.push(n)}for(i=e.readVarintNum(),t=0;t<i;t++)this.outputs.push(bi.fromBufferReader(e));return this.nLockTime=e.readUInt32LE(),this};$.prototype.toObject=$.prototype.toJSON=function(){var t=[];this.inputs.forEach(function(n){t.push(n.toObject())});var r=[];this.outputs.forEach(function(n){r.push(n.toObject())});var i={hash:this.hash,version:this.version,inputs:t,outputs:r,nLockTime:this.nLockTime};return this._changeScript&&(i.changeScript=this._changeScript.toString()),me.isUndefined(this._changeIndex)||(i.changeIndex=this._changeIndex),me.isUndefined(this._fee)||(i.fee=this._fee),i};$.prototype.fromObject=function(t){Wt.checkArgument(me.isObject(t)||t instanceof $);var r=this,i;return t instanceof $?i=t.toObject():i=t,me.each(i.inputs,function(n){if(!n.output||!n.output.script){r.uncheckedAddInput(new Ut(n));return}var o=new Vi(n.output.script),s;if(o.isPublicKeyHashOut())s=new Ut.PublicKeyHash(n);else if(o.isScriptHashOut()&&n.publicKeys&&n.threshold)s=new Ut.MultiSigScriptHash(n,n.publicKeys,n.threshold,n.signatures);else if(o.isPublicKeyOut())s=new Ut.PublicKey(n);else throw new Ft.Transaction.Input.UnsupportedScript(n.output.script);r.addInput(s)}),me.each(i.outputs,function(n){r.addOutput(new bi(n))}),i.changeIndex&&(this._changeIndex=i.changeIndex),i.changeScript&&(this._changeScript=new Vi(i.changeScript)),i.fee&&(this._fee=i.fee),this.nLockTime=i.nLockTime,this.version=i.version,this._checkConsistency(t),this};$.prototype._checkConsistency=function(e){me.isUndefined(this._changeIndex)||(Wt.checkState(this._changeScript,"Change script is expected."),Wt.checkState(this.outputs[this._changeIndex],"Change index points to undefined output."),Wt.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString(),"Change output has an unexpected script.")),e&&e.hash&&Wt.checkState(e.hash===this.hash,"Hash in object does not match transaction hash.")};$.prototype.lockUntilDate=function(e){if(Wt.checkArgument(e),me.isNumber(e)&&e<$.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new Ft.Transaction.LockTimeTooEarly;me.isDate(e)&&(e=e.getTime()/1e3);for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===Ut.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=Ut.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this};$.prototype.lockUntilBlockHeight=function(e){if(Wt.checkArgument(me.isNumber(e)),e>=$.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new Ft.Transaction.BlockHeightTooHigh;if(e<0)throw new Ft.Transaction.NLockTimeOutOfRange;for(var t=0;t<this.inputs.length;t++)this.inputs[t].sequenceNumber===Ut.DEFAULT_SEQNUMBER&&(this.inputs[t].sequenceNumber=Ut.DEFAULT_LOCKTIME_SEQNUMBER);return this.nLockTime=e,this};$.prototype.getLockTime=function(){return this.nLockTime?this.nLockTime<$.NLOCKTIME_BLOCKHEIGHT_LIMIT?this.nLockTime:new Date(1e3*this.nLockTime):null};$.prototype.fromString=function(e){this.fromBuffer(hF.Buffer.from(e,"hex"))};$.prototype._newTransaction=function(){this.version=wF,this.nLockTime=SF};$.prototype.from=function(e,t,r){if(me.isArray(e)){var i=this;return me.each(e,function(o){i.from(o,t,r)}),this}var n=me.some(this.inputs,function(o){return o.prevTxId.toString("hex")===e.txId&&o.outputIndex===e.outputIndex});return n?this:(t&&r?this._fromMultisigUtxo(e,t,r):this._fromNonP2SH(e),this)};$.prototype._fromNonP2SH=function(e){var t;e=new O3(e),e.script.isPublicKeyHashOutPrefix()?t=pF:e.script.isPublicKeyOut()?t=gF:t=Ut,this.addInput(new t({output:new bi({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:Vi.empty()}))};$.prototype._fromMultisigUtxo=function(e,t,r){Wt.checkArgument(r<=t.length,"Number of required signatures must be greater than the number of public keys");var i;if(e=new O3(e),e.script.isMultisigOut())i=yF;else if(e.script.isScriptHashOut())i=vF;else throw new Ft.Transaction.Input.UnsupportedScript(e.script.toString());this.addInput(new i({output:new bi({script:e.script,satoshis:e.satoshis}),prevTxId:e.txId,outputIndex:e.outputIndex,script:Vi.empty()},t,r))};$.prototype.addInput=function(e,t,r){if(Wt.checkArgumentType(e,Ut,"input"),!e.output&&(me.isUndefined(t)||me.isUndefined(r)))throw new Ft.Transaction.NeedMoreInfo("Need information about the UTXO script and satoshis");return!e.output&&t&&!me.isUndefined(r)&&(t=t instanceof Vi?t:new Vi(t),Wt.checkArgumentType(r,"number","satoshis"),e.output=new bi({script:t,satoshis:r})),this.uncheckedAddInput(e)};$.prototype.uncheckedAddInput=function(e){return Wt.checkArgumentType(e,Ut,"input"),this.inputs.push(e),this._inputAmount=void 0,this._updateChangeOutput(),this};$.prototype.hasAllUtxoInfo=function(){return me.every(this.inputs.map(function(e){return!!e.output}))};$.prototype.fee=function(e){return Wt.checkArgument(me.isNumber(e),"amount must be a number"),this._fee=e,this._updateChangeOutput(),this};$.prototype.feePerKb=function(e){return Wt.checkArgument(me.isNumber(e),"amount must be a number"),this._feePerKb=e,this._updateChangeOutput(),this};$.prototype.change=function(e){return Wt.checkArgument(e,"address is required"),this._changeScript=Vi.fromAddress(e),this._updateChangeOutput(),this};$.prototype.getChangeOutput=function(){return me.isUndefined(this._changeIndex)?null:this.outputs[this._changeIndex]};$.prototype.to=function(e,t){if(me.isArray(e)){var r=this;return me.each(e,function(i){r.to(i.address,i.satoshis)}),this}return Wt.checkArgument(E3.isNaturalNumber(t),"Amount is expected to be a positive integer"),this.addOutput(new bi({script:Vi(new dF(e)),satoshis:t})),this};$.prototype.addData=function(e){return this.addOutput(new bi({script:Vi.buildDataOut(e),satoshis:0})),this};$.prototype.addSafeData=function(e){return this.addOutput(new bi({script:Vi.buildSafeDataOut(e),satoshis:0})),this};$.prototype.addOutput=function(e){return Wt.checkArgumentType(e,bi,"output"),this._addOutput(e),this._updateChangeOutput(),this};$.prototype.clearOutputs=function(){return this.outputs=[],this._clearSignatures(),this._outputAmount=void 0,this._changeIndex=void 0,this._updateChangeOutput(),this};$.prototype._addOutput=function(e){this.outputs.push(e),this._outputAmount=void 0};$.prototype._getOutputAmount=function(){if(me.isUndefined(this._outputAmount)){var e=this;this._outputAmount=0,me.each(this.outputs,function(t){e._outputAmount+=t.satoshis})}return this._outputAmount};$.prototype._getInputAmount=function(){if(me.isUndefined(this._inputAmount)){var e=this;this._inputAmount=0,me.each(this.inputs,function(t){if(me.isUndefined(t.output))throw new Ft.Transaction.Input.MissingPreviousOutput;e._inputAmount+=t.output.satoshis})}return this._inputAmount};$.prototype._updateChangeOutput=function(){if(this._changeScript){this._clearSignatures(),me.isUndefined(this._changeIndex)||this._removeOutput(this._changeIndex),this._changeIndex=this.outputs.length,this._addOutput(new bi({script:this._changeScript,satoshis:0}));var e=this._getUnspentValue(),t=this.getFee(),r=e-t;this._removeOutput(this._changeIndex),this._changeIndex=void 0,r>=$.DUST_AMOUNT&&(this._changeIndex=this.outputs.length,this._addOutput(new bi({script:this._changeScript,satoshis:r})))}};$.prototype.getFee=function(){return this.isCoinbase()?0:me.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee};$.prototype._estimateFee=function(){var e=this._estimateSize();return Math.ceil(e/1e3*(this._feePerKb||$.FEE_PER_KB))};$.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()};$.prototype._clearSignatures=function(){me.each(this.inputs,function(e){e.clearSignatures!==Ut.prototype.clearSignatures&&e.clearSignatures()})};$.prototype._estimateSize=function(){var e=8;return e+=S3(this.inputs.length).toBuffer().length,e+=S3(this.outputs.length).toBuffer().length,me.each(this.inputs,function(t){e+=t._estimateSize()}),me.each(this.outputs,function(t){e+=t.getSize()}),e};$.prototype._removeOutput=function(e){var t=this.outputs[e];this.outputs=me.without(this.outputs,t),this._outputAmount=void 0};$.prototype.removeOutput=function(e){this._removeOutput(e),this._updateChangeOutput()};$.prototype.sort=function(){return this.sortInputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(r,i){return r.prevTxId.compare(i.prevTxId)||r.outputIndex-i.outputIndex}),t}),this.sortOutputs(function(e){var t=Array.prototype.concat.apply([],e);return t.sort(function(r,i){return r.satoshis-i.satoshis||r.script.toBuffer().compare(i.script.toBuffer())}),t}),this};$.prototype.shuffleOutputs=function(){return this.sortOutputs(me.shuffle)};$.prototype.sortOutputs=function(e){var t=e(this.outputs);return this._newOutputOrder(t)};$.prototype.sortInputs=function(e){return this.inputs=e(this.inputs),this._clearSignatures(),this};$.prototype._newOutputOrder=function(e){var t=this.outputs.length!==e.length||me.difference(this.outputs,e).length!==0;if(t)throw new Ft.Transaction.InvalidSorting;if(!me.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=e.indexOf(r)}return this.outputs=e,this};$.prototype.removeInput=function(e,t){var r;if(!t&&me.isNumber(e)?r=e:r=me.findIndex(this.inputs,function(n){return n.prevTxId.toString("hex")===e&&n.outputIndex===t}),r<0||r>=this.inputs.length)throw new Ft.Transaction.InvalidIndex(r,this.inputs.length);var i=this.inputs[r];this.inputs=me.without(this.inputs,i),this._inputAmount=void 0,this._updateChangeOutput()};$.prototype.sign=function(e,t){Wt.checkState(this.hasAllUtxoInfo(),"Not all utxo information is available to sign the transaction.");var r=this;return me.isArray(e)?(me.each(e,function(i){r.sign(i,t)}),this):(me.each(this.getSignatures(e,t),function(i){r.applySignature(i)}),this)};$.prototype.getSignatures=function(e,t){e=new mF(e),t=t||Yl.SIGHASH_ALL|Yl.SIGHASH_FORKID;var r=this,i=[],n=I3.sha256ripemd160(e.publicKey.toBuffer());return me.each(this.inputs,function(s,f){me.each(s.getSignatures(r,e,f,t,n),function(h){i.push(h)})}),i};$.prototype.applySignature=function(e){return this.inputs[e.inputIndex].addSignature(this,e),this};$.prototype.isFullySigned=function(){return me.each(this.inputs,function(e){if(e.isFullySigned===Ut.prototype.isFullySigned)throw new Ft.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),me.every(me.map(this.inputs,function(e){return e.isFullySigned()}))};$.prototype.isValidSignature=function(e){var t=this;if(this.inputs[e.inputIndex].isValidSignature===Ut.prototype.isValidSignature)throw new Ft.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[e.inputIndex].isValidSignature(t,e)};$.prototype.verifySignature=function(e,t,r,i,n,o){return A3.verify(this,e,t,r,i,n,o)};$.prototype.verify=function(){if(this.inputs.length===0)return"transaction txins empty";if(this.outputs.length===0)return"transaction txouts empty";for(var e=new Wl(0),t=0;t<this.outputs.length;t++){var r=this.outputs[t];if(r.invalidSatoshis())return"transaction txout "+t+" satoshis is invalid";if(r._satoshisBN.gt(new Wl($.MAX_MONEY,10)))return"transaction txout "+t+" greater than MAX_MONEY";if(e=e.add(r._satoshisBN),e.gt(new Wl($.MAX_MONEY)))return"transaction txout "+t+" total output greater than MAX_MONEY"}if(this.toBuffer().length>EF)return"transaction over the maximum block size";var i={};for(t=0;t<this.inputs.length;t++){var n=this.inputs[t],o=n.prevTxId+":"+n.outputIndex;if(!me.isUndefined(i[o]))return"transaction input "+t+" duplicate input";i[o]=!0}var s=this.isCoinbase();if(s){var f=this.inputs[0]._scriptBuffer;if(f.length<2||f.length>100)return"coinbase transaction script size invalid"}else for(t=0;t<this.inputs.length;t++)if(this.inputs[t].isNull())return"transaction input "+t+" has null input";return!0};$.prototype.isCoinbase=function(){return this.inputs.length===1&&this.inputs[0].isNull()};$.prototype.sighash=function(e,t,r,i,n){t=t||Yl.SIGHASH_ALL|Yl.SIGHASH_FORKID;var o=this.inputs[e];if(!o)throw new Error("Input index "+e+" does not exist");return!r&&o.output&&(r=o.output.script),!i&&o.output&&(i=new Wl(o.output.satoshis)),n=n||_F,A3.sighash(this,t,e,r,i,n)};T3.exports=$});var Cv=B((TX,bs)=>{y();bs.exports=Mv();bs.exports.Input=Hl();bs.exports.Output=En();bs.exports.UnspentOutput=kv();bs.exports.Signature=Da();bs.exports.Sighash=to()});var Gl=B((PX,M3)=>{"use strict";y();var Zl=mt(),Lu=vv(),C=dv(),ve=Ur(),qu=ir(),_s=fr(),Dv=Gr(),B3=qO(),q=function e(t){if(!(this instanceof e))return new e(t);t?(this.initialize(),this.set(t)):this.initialize()};q.prototype.verify=function(e,t,r,i,n,o){var s=Cv();if(Zl.isUndefined(r)&&(r=new s),Zl.isUndefined(i)&&(i=0),Zl.isUndefined(n)&&(n=0),n&q.SCRIPT_ENABLE_SIGHASH_FORKID&&(n|=q.SCRIPT_VERIFY_STRICTENC,!o))throw new Error("internal error - need satoshisBN to verify FORKID transactions");this.set({script:e,tx:r,nin:i,flags:n,satoshisBN:o});var f;if((n&q.SCRIPT_VERIFY_SIGPUSHONLY)!==0&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;n&q.SCRIPT_VERIFY_P2SH&&(f=this.stack.slice());var h=this.stack;if(this.initialize(),this.set({script:t,stack:h,tx:r,nin:i,flags:n,satoshisBN:o}),!this.evaluate())return!1;if(this.stack.length===0)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var m=this.stack[this.stack.length-1];if(!q.castToBool(m))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(n&q.SCRIPT_VERIFY_P2SH&&t.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(f.length===0)throw new Error("internal error - stack copy empty");var S=f[f.length-1],x=Lu.fromBuffer(S);if(f.pop(),this.initialize(),this.set({script:x,stack:f,tx:r,nin:i,flags:n,satoshisBN:o}),!this.evaluate())return!1;if(f.length===0)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1;if(!q.castToBool(f[f.length-1]))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1}if((n&q.SCRIPT_VERIFY_CLEANSTACK)!==0){if((n&q.SCRIPT_VERIFY_P2SH)===0)throw new Error("internal error - CLEANSTACK without P2SH");if(f.length!==1)return this.errstr="SCRIPT_ERR_CLEANSTACK",!1}return!0};M3.exports=q;q.prototype.initialize=function(e){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0};q.prototype.set=function(e){this.script=e.script||this.script,this.tx=e.tx||this.tx,this.nin=typeof e.nin<"u"?e.nin:this.nin,this.satoshisBN=e.satoshisBN||this.satoshisBN,this.stack=e.stack||this.stack,this.altstack=e.altstack||this.altstack,this.pc=typeof e.pc<"u"?e.pc:this.pc,this.pbegincodehash=typeof e.pbegincodehash<"u"?e.pbegincodehash:this.pbegincodehash,this.nOpCount=typeof e.nOpCount<"u"?e.nOpCount:this.nOpCount,this.vfExec=e.vfExec||this.vfExec,this.errstr=e.errstr||this.errstr,this.flags=typeof e.flags<"u"?e.flags:this.flags};q.true=_.Buffer.from([1]);q.false=_.Buffer.from([]);q.MAX_SCRIPT_ELEMENT_SIZE=520;q.MAXIMUM_ELEMENT_SIZE=4;q.MAX_OPS_PER_SCRIPT=201;q.MAX_SCRIPT_SIZE=1e4;q.LOCKTIME_THRESHOLD=5e8;q.LOCKTIME_THRESHOLD_BN=new ve(q.LOCKTIME_THRESHOLD);q.useGenesisLimits=function(e){return e=e||2147483647,q.MAX_SCRIPT_ELEMENT_SIZE=e,q.MAXIMUM_ELEMENT_SIZE=e,q.MAX_OPS_PER_SCRIPT=e,q.MAX_SCRIPT_SIZE=e,q};q.getLimits=function(){return{maxScriptElementSize:q.MAX_SCRIPT_ELEMENT_SIZE,maximumElementSize:q.MAXIMUM_ELEMENT_SIZE,maxOpsPerScript:q.MAX_OPS_PER_SCRIPT,maxScriptSize:q.MAX_SCRIPT_SIZE}};q.setLimits=function(e){return e=e||{},e.maxScriptElementSize!=null&&(q.MAX_SCRIPT_ELEMENT_SIZE=e.maxScriptElementSize),e.maximumElementSize!=null&&(q.MAXIMUM_ELEMENT_SIZE=e.maximumElementSize),e.maxOpsPerScript!=null&&(q.MAX_OPS_PER_SCRIPT=e.maxOpsPerScript),e.maxScriptSize!=null&&(q.MAX_SCRIPT_SIZE=e.maxScriptSize),q};q.SCRIPT_VERIFY_NONE=0;q.SCRIPT_VERIFY_P2SH=1;q.SCRIPT_VERIFY_STRICTENC=2;q.SCRIPT_VERIFY_DERSIG=4;q.SCRIPT_VERIFY_LOW_S=8;q.SCRIPT_VERIFY_NULLDUMMY=16;q.SCRIPT_VERIFY_SIGPUSHONLY=32;q.SCRIPT_VERIFY_MINIMALDATA=64;q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128;q.SCRIPT_VERIFY_CLEANSTACK=256;q.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512;q.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY=1024;q.SCRIPT_VERIFY_MINIMALIF=8192;q.SCRIPT_VERIFY_NULLFAIL=16384;q.SCRIPT_VERIFY_COMPRESSED_PUBKEYTYPE=32768;q.SCRIPT_ENABLE_SIGHASH_FORKID=65536;q.SCRIPT_ENABLE_REPLAY_PROTECTION=1<<17;q.SCRIPT_ENABLE_MONOLITH_OPCODES=1<<18;q.SCRIPT_ENABLE_MAGNETIC_OPCODES=1<<19;q.SCRIPT_ENABLE_CHRONICLE=1<<20;q.CHRONICLE_ACTIVATION_HEIGHT=943816;q.mainnetFlags=function(e){e=e||{};var t=q.SCRIPT_VERIFY_P2SH|q.SCRIPT_VERIFY_STRICTENC|q.SCRIPT_VERIFY_DERSIG|q.SCRIPT_VERIFY_LOW_S|q.SCRIPT_VERIFY_NULLFAIL|q.SCRIPT_VERIFY_MINIMALDATA|q.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY|q.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY|q.SCRIPT_ENABLE_SIGHASH_FORKID|q.SCRIPT_ENABLE_MAGNETIC_OPCODES|q.SCRIPT_ENABLE_MONOLITH_OPCODES;return e.afterChronicle!==!1&&(t|=q.SCRIPT_ENABLE_CHRONICLE),t};q.SEQUENCE_LOCKTIME_DISABLE_FLAG=1<<31;q.SEQUENCE_LOCKTIME_TYPE_FLAG=1<<22;q.SEQUENCE_LOCKTIME_MASK=65535;q.castToBool=function(e){for(var t=0;t<e.length;t++)if(e[t]!==0)return!(t===e.length-1&&e[t]===128);return!1};q.prototype.checkSignatureEncoding=function(e){var t;if(e.length===0)return!0;if((this.flags&(q.SCRIPT_VERIFY_DERSIG|q.SCRIPT_VERIFY_LOW_S|q.SCRIPT_VERIFY_STRICTENC))!==0&&!_s.isTxDER(e))return this.errstr="SCRIPT_ERR_SIG_DER_INVALID_FORMAT",!1;if((this.flags&q.SCRIPT_VERIFY_LOW_S)!==0){if(t=_s.fromTxFormat(e),!t.hasLowS())return this.errstr="SCRIPT_ERR_SIG_DER_HIGH_S",!1}else if((this.flags&q.SCRIPT_VERIFY_STRICTENC)!==0){if(t=_s.fromTxFormat(e),!t.hasDefinedHashtype())return this.errstr="SCRIPT_ERR_SIG_HASHTYPE",!1;if(!(this.flags&q.SCRIPT_ENABLE_SIGHASH_FORKID)&&t.nhashtype&_s.SIGHASH_FORKID)return this.errstr="SCRIPT_ERR_ILLEGAL_FORKID",!1;if(this.flags&q.SCRIPT_ENABLE_SIGHASH_FORKID&&!(t.nhashtype&_s.SIGHASH_FORKID))return this.errstr="SCRIPT_ERR_MUST_USE_FORKID",!1}return!0};q.prototype.checkPubkeyEncoding=function(e){return(this.flags&q.SCRIPT_VERIFY_STRICTENC)!==0&&!Dv.isValid(e)?(this.errstr="SCRIPT_ERR_PUBKEYTYPE",!1):!0};q._isMinimallyEncoded=function(e,t){return t=t||q.MAXIMUM_ELEMENT_SIZE,!(e.length>t||e.length>0&&(e[e.length-1]&127)===0&&(e.length<=1||(e[e.length-2]&128)===0))};q._minimallyEncode=function(e){if(e.length===0)return e;var t=e[e.length-1];if(t&127)return e;if(e.length===1)return _.Buffer.from("");if(e[e.length-2]&128)return e;for(var r=e.length-1;r>0;r--)if(e[r-1]!==0)return e[r-1]&128?e[r++]=t:e[r-1]|=t,e.slice(0,r);return _.Buffer.from("")};q.prototype.evaluate=function(){if(this.script.toBuffer().length>q.MAX_SCRIPT_SIZE)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc<this.script.chunks.length;){let t={pc:this.pc,opcode:C.fromNumber(this.script.chunks[this.pc].opcodenum)};var e=this.step();if(!e)return!1;this._callbackStep(t)}if(this.stack.length+this.altstack.length>1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(t){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+t,!1}return this.vfExec.length>0?(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1):!0};q.prototype._callbackStep=function(e){if(typeof this.stepListener=="function")try{this.stepListener(e,B3(this.stack,!0),B3(this.altstack,!0))}catch(t){console.log(`Error in Step callback:${t}`)}};q.prototype.checkLockTime=function(e){return!(!(this.tx.nLockTime<q.LOCKTIME_THRESHOLD&&e.lt(q.LOCKTIME_THRESHOLD_BN)||this.tx.nLockTime>=q.LOCKTIME_THRESHOLD&&e.gte(q.LOCKTIME_THRESHOLD_BN))||e.gt(new ve(this.tx.nLockTime))||this.tx.inputs[this.nin].isFinal())};q.prototype.checkSequence=function(e){var t=this.tx.inputs[this.nin].sequenceNumber;if(this.tx.version<2||t&q.SEQUENCE_LOCKTIME_DISABLE_FLAG)return!1;var r=q.SEQUENCE_LOCKTIME_TYPE_FLAG|q.SEQUENCE_LOCKTIME_MASK,i=new ve(t&r),n=e.and(new ve(r)),o=new ve(q.SEQUENCE_LOCKTIME_TYPE_FLAG);return!(!(i.lt(o)&&n.lt(o)||i.gte(o)&&n.gte(o))||n.gt(i))};function xF(e,t){let r=e;for(;r.length<t;)r=_.Buffer.concat([_.Buffer.from([0]),r]);return r}function P3(e){var t=_.Buffer.alloc(4);return t.writeInt32LE(e|0,0),t}q.prototype.step=function(){var e=this;function t(J){return e.stack[e.stack.length+J]}function r(J){switch(J){case C.OP_2MUL:case C.OP_2DIV:if((e.flags&q.SCRIPT_ENABLE_CHRONICLE)===0)return!0;break;case C.OP_INVERT:case C.OP_MUL:case C.OP_LSHIFT:case C.OP_RSHIFT:if((e.flags&q.SCRIPT_ENABLE_MAGNETIC_OPCODES)===0)return!0;break;case C.OP_DIV:case C.OP_MOD:case C.OP_SPLIT:case C.OP_CAT:case C.OP_AND:case C.OP_OR:case C.OP_XOR:case C.OP_BIN2NUM:case C.OP_NUM2BIN:return!1;default:break}return!1}var i=(this.flags&q.SCRIPT_VERIFY_MINIMALDATA)!==0,n=this.vfExec.indexOf(!1)===-1,o,s,f,h,m,S,x,I,T,M,N,D,j,Y,Q,W,te,ne=this.script.chunks[this.pc];this.pc++;var se=ne.opcodenum;if(Zl.isUndefined(se))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(ne.buf&&ne.buf.length>q.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(se>C.OP_16&&++this.nOpCount>q.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(r(se))return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(n&&se>=0&&se<=C.OP_PUSHDATA4){if(i&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(!ne.buf)this.stack.push(q.false);else{if(ne.len!==ne.buf.length)throw new Error(`Length of push value not equal to length of data (${ne.len},${ne.buf.length})`);this.stack.push(ne.buf)}}else if(n||C.OP_IF<=se&&se<=C.OP_ENDIF)switch(se){case C.OP_1NEGATE:case C.OP_1:case C.OP_2:case C.OP_3:case C.OP_4:case C.OP_5:case C.OP_6:case C.OP_7:case C.OP_8:case C.OP_9:case C.OP_10:case C.OP_11:case C.OP_12:case C.OP_13:case C.OP_14:case C.OP_15:case C.OP_16:m=se-(C.OP_1-1),o=new ve(m).toScriptNumBuffer(),this.stack.push(o);break;case C.OP_NOP:break;case C.OP_NOP2:case C.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&q.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var ue=ve.fromScriptNumBuffer(this.stack[this.stack.length-1],i,5);if(ue.lt(new ve(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(ue))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case C.OP_NOP3:case C.OP_CHECKSEQUENCEVERIFY:if(!(this.flags&q.SCRIPT_VERIFY_CHECKSEQUENCEVERIFY)){if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var be=ve.fromScriptNumBuffer(t(-1),i,5);if(be.lt(new ve(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if((be&q.SEQUENCE_LOCKTIME_DISABLE_FLAG)!==0)break;if(!this.checkSequence(be))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case C.OP_NOP1:case C.OP_NOP9:case C.OP_NOP10:if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case C.OP_LSHIFTNUM:case C.OP_RSHIFTNUM:if((this.flags&q.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var P=q.MAXIMUM_ELEMENT_SIZE,l=ve.fromScriptNumBuffer(t(-1),i,P);if(l.isNeg())return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop();var E=ve.fromScriptNumBuffer(t(-1),i,P);this.stack.pop();var d=l.toNumber(),a=E.isNeg(),u=E.abs(),p;if(se===C.OP_LSHIFTNUM){var b=E.toScriptNumBuffer().length;if(b+Math.floor(d/8)>P)return this.errstr="SCRIPT_ERR_SCRIPTNUM_OVERFLOW",!1;p=u.shln(d)}else p=d>=u.bitLength()?new ve(0):u.shrn(d);if(a&&!p.isZero()&&(p=p.neg()),p.toScriptNumBuffer().length>P)return this.errstr="SCRIPT_ERR_SCRIPTNUM_OVERFLOW",!1;this.stack.push(p.toScriptNumBuffer());break;case C.OP_VER:if((this.flags&q.SCRIPT_ENABLE_CHRONICLE)===0)return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1;if(this.tx==null)return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR",!1;this.stack.push(P3(this.tx.version));break;case C.OP_VERIF:case C.OP_VERNOTIF:if((this.flags&q.SCRIPT_ENABLE_CHRONICLE)===0){if(!n)break;return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}if(W=!1,n){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(this.tx==null)return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR",!1;o=t(-1),W=o.length===4&&o.equals(P3(this.tx.version)),se===C.OP_VERNOTIF&&(W=!W),this.stack.pop()}this.vfExec.push(W);break;case C.OP_IF:case C.OP_NOTIF:if(W=!1,n){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;if(o=t(-1),this.flags&q.SCRIPT_VERIFY_MINIMALIF){if(o.length>1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1;if(o.length===1&&o[0]!==1)return this.errstr="SCRIPT_ERR_MINIMALIF",!1}W=q.castToBool(o),se===C.OP_NOTIF&&(W=!W),this.stack.pop()}this.vfExec.push(W);break;case C.OP_ELSE:if(this.vfExec.length===0)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case C.OP_ENDIF:if(this.vfExec.length===0)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case C.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(o=t(-1),W=q.castToBool(o),W)this.stack.pop();else return this.errstr="SCRIPT_ERR_VERIFY",!1;break;case C.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case C.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case C.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case C.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case C.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2),f=t(-1),this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f));break;case C.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-3),f=t(-2);var v=t(-1);this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f)),this.stack.push(_.Buffer.from(v));break;case C.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-4),f=t(-3),this.stack.push(_.Buffer.from(s)),this.stack.push(_.Buffer.from(f));break;case C.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-6,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case C.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-4,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case C.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-1),W=q.castToBool(o),W&&this.stack.push(_.Buffer.from(o));break;case C.OP_DEPTH:o=new ve(this.stack.length).toScriptNumBuffer(),this.stack.push(o);break;case C.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case C.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(_.Buffer.from(t(-1)));break;case C.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case C.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(_.Buffer.from(t(-2)));break;case C.OP_PICK:case C.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(o=t(-1),I=ve.fromScriptNumBuffer(o,i),m=I.toNumber(),this.stack.pop(),m<0||m>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-m-1),se===C.OP_ROLL&&this.stack.splice(this.stack.length-m-1,1),this.stack.push(_.Buffer.from(o));break;case C.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=t(-3),x=t(-2);var c=t(-1);this.stack[this.stack.length-3]=x,this.stack[this.stack.length-2]=c,this.stack[this.stack.length-1]=S;break;case C.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;S=t(-2),x=t(-1),this.stack[this.stack.length-2]=x,this.stack[this.stack.length-1]=S;break;case C.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,_.Buffer.from(t(-1)));break;case C.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;I=new ve(t(-1).length),this.stack.push(I.toScriptNumBuffer());break;case C.OP_AND:case C.OP_OR:case C.OP_XOR:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),f=t(-1),s.length!==f.length)return this.errstr="SCRIPT_ERR_INVALID_OPERAND_SIZE",!1;switch(se){case C.OP_AND:for(let J=0;J<s.length;J++)s[J]&=f[J];break;case C.OP_OR:for(let J=0;J<s.length;J++)s[J]|=f[J];break;case C.OP_XOR:for(let J=0;J<s.length;J++)s[J]^=f[J];break;default:break}this.stack.pop();break;case C.OP_INVERT:this.stack.length<1&&(this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION"),o=t(-1);for(let J=0;J<o.length;J++)o[J]=~o[J];break;case C.OP_LSHIFT:case C.OP_RSHIFT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),s.length===0)this.stack.pop();else{if(T=new ve(s),M=ve.fromScriptNumBuffer(t(-1),i),m=M.toNumber(),m<0)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),this.stack.pop();let J;se===C.OP_LSHIFT&&(J=T.ushln(m)),se===C.OP_RSHIFT&&(J=T.ushrn(m));let _e=xF(_.Buffer.from(J.toArray().slice(s.length*-1)),s.length);this.stack.push(_e)}break;case C.OP_EQUAL:case C.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2),f=t(-1);var w=s.toString("hex")===f.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(w?q.true:q.false),se===C.OP_EQUALVERIFY)if(w)this.stack.pop();else return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;break;case C.OP_2MUL:case C.OP_2DIV:case C.OP_1ADD:case C.OP_1SUB:case C.OP_NEGATE:case C.OP_ABS:case C.OP_NOT:case C.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(o=t(-1),I=ve.fromScriptNumBuffer(o,i),se){case C.OP_2MUL:I=I.mul(new ve(2));break;case C.OP_2DIV:I=I.div(new ve(2));break;case C.OP_1ADD:I=I.add(ve.One);break;case C.OP_1SUB:I=I.sub(ve.One);break;case C.OP_NEGATE:I=I.neg();break;case C.OP_ABS:I.cmp(ve.Zero)<0&&(I=I.neg());break;case C.OP_NOT:I=new ve((I.cmp(ve.Zero)===0)+0);break;case C.OP_0NOTEQUAL:I=new ve((I.cmp(ve.Zero)!==0)+0);break}this.stack.pop(),this.stack.push(I.toScriptNumBuffer());break;case C.OP_ADD:case C.OP_SUB:case C.OP_MUL:case C.OP_MOD:case C.OP_DIV:case C.OP_BOOLAND:case C.OP_BOOLOR:case C.OP_NUMEQUAL:case C.OP_NUMEQUALVERIFY:case C.OP_NUMNOTEQUAL:case C.OP_LESSTHAN:case C.OP_GREATERTHAN:case C.OP_LESSTHANOREQUAL:case C.OP_GREATERTHANOREQUAL:case C.OP_MIN:case C.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(T=ve.fromScriptNumBuffer(t(-2),i,q.MAXIMUM_ELEMENT_SIZE),M=ve.fromScriptNumBuffer(t(-1),i,q.MAXIMUM_ELEMENT_SIZE),I=new ve(0),se){case C.OP_ADD:I=T.add(M);break;case C.OP_SUB:I=T.sub(M);break;case C.OP_MUL:I=T.mul(M);break;case C.OP_DIV:if(M===0)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;I=T.div(M);break;case C.OP_MOD:if(M===0)return this.errstr="SCRIPT_ERR_DIV_BY_ZERO",!1;I=T.mod(M);break;case C.OP_BOOLAND:I=new ve((T.cmp(ve.Zero)!==0&&M.cmp(ve.Zero)!==0)+0);break;case C.OP_BOOLOR:I=new ve((T.cmp(ve.Zero)!==0||M.cmp(ve.Zero)!==0)+0);break;case C.OP_NUMEQUAL:I=new ve((T.cmp(M)===0)+0);break;case C.OP_NUMEQUALVERIFY:I=new ve((T.cmp(M)===0)+0);break;case C.OP_NUMNOTEQUAL:I=new ve((T.cmp(M)!==0)+0);break;case C.OP_LESSTHAN:I=new ve((T.cmp(M)<0)+0);break;case C.OP_GREATERTHAN:I=new ve((T.cmp(M)>0)+0);break;case C.OP_LESSTHANOREQUAL:I=new ve((T.cmp(M)<=0)+0);break;case C.OP_GREATERTHANOREQUAL:I=new ve((T.cmp(M)>=0)+0);break;case C.OP_MIN:I=T.cmp(M)<0?T:M;break;case C.OP_MAX:I=T.cmp(M)>0?T:M;break}if(this.stack.pop(),this.stack.pop(),this.stack.push(I.toScriptNumBuffer()),se===C.OP_NUMEQUALVERIFY)if(q.castToBool(t(-1)))this.stack.pop();else return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;break;case C.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;T=ve.fromScriptNumBuffer(t(-3),i,q.MAXIMUM_ELEMENT_SIZE),M=ve.fromScriptNumBuffer(t(-2),i,q.MAXIMUM_ELEMENT_SIZE);var A=ve.fromScriptNumBuffer(t(-1),i,q.MAXIMUM_ELEMENT_SIZE);W=M.cmp(T)<=0&&T.cmp(A)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(W?q.true:q.false);break;case C.OP_RIPEMD160:case C.OP_SHA1:case C.OP_SHA256:case C.OP_HASH160:case C.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;o=t(-1);var g;se===C.OP_RIPEMD160?g=qu.ripemd160(o):se===C.OP_SHA1?g=qu.sha1(o):se===C.OP_SHA256?g=qu.sha256(o):se===C.OP_HASH160?g=qu.sha256ripemd160(o):se===C.OP_HASH256&&(g=qu.sha256sha256(o)),this.stack.pop(),this.stack.push(g);break;case C.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case C.OP_CHECKSIG:case C.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(N=t(-2),D=t(-1),!this.checkSignatureEncoding(N)||!this.checkPubkeyEncoding(D))return!1;j=new Lu().set({chunks:this.script.chunks.slice(this.pbegincodehash)});var R=new Lu().add(N);j.findAndDelete(R);try{Y=_s.fromTxFormat(N),Q=Dv.fromBuffer(D,!1),te=this.tx.verifySignature(Y,Q,this.nin,j,this.satoshisBN,this.flags)}catch{te=!1}if(!te&&this.flags&q.SCRIPT_VERIFY_NULLFAIL&&N.length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;if(this.stack.pop(),this.stack.pop(),this.stack.push(te?q.true:q.false),se===C.OP_CHECKSIGVERIFY)if(te)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;break;case C.OP_CHECKMULTISIG:case C.OP_CHECKMULTISIGVERIFY:var U=1;if(this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var H=ve.fromScriptNumBuffer(t(-U),i).toNumber();if(H<0||H>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=H,this.nOpCount>q.MAX_OPS_PER_SCRIPT)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var z=++U;U+=H;var re=H+2;if(this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var oe=ve.fromScriptNumBuffer(t(-U),i).toNumber();if(oe<0||oe>H)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var k=++U;if(U+=oe,this.stack.length<U)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;j=new Lu().set({chunks:this.script.chunks.slice(this.pbegincodehash)});for(var L=0;L<oe;L++)N=t(-k-L),j.findAndDelete(new Lu().add(N));for(te=!0;te&&oe>0;){if(N=t(-k),D=t(-z),!this.checkSignatureEncoding(N)||!this.checkPubkeyEncoding(D))return!1;var F;try{Y=_s.fromTxFormat(N),Q=Dv.fromBuffer(D,!1),F=this.tx.verifySignature(Y,Q,this.nin,j,this.satoshisBN,this.flags)}catch{F=!1}F&&(k++,oe--),z++,H--,oe>H&&(te=!1)}for(;U-- >1;){if(!te&&this.flags&q.SCRIPT_VERIFY_NULLFAIL&&!re&&t(-1).length)return this.errstr="SCRIPT_ERR_NULLFAIL",!1;re>0&&re--,this.stack.pop()}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&q.SCRIPT_VERIFY_NULLDUMMY&&t(-1).length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(te?q.true:q.false),se===C.OP_CHECKMULTISIGVERIFY)if(te)this.stack.pop();else return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;break;case C.OP_CAT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),f=t(-1),s.length+f.length>q.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack[this.stack.length-2]=_.Buffer.concat([s,f]),this.stack.pop();break;case C.OP_SPLIT:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-2);var V=ve.fromScriptNumBuffer(t(-1),i).toNumber();if(V<0||V>s.length)return this.errstr="SCRIPT_ERR_INVALID_SPLIT_RANGE",!1;var fe=_.Buffer.from(s);this.stack[this.stack.length-2]=fe.slice(0,V),this.stack[this.stack.length-1]=fe.slice(V);break;case C.OP_LEFT:case C.OP_RIGHT:if((this.flags&q.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-2),m=ve.fromScriptNumBuffer(t(-1),i,q.MAXIMUM_ELEMENT_SIZE).toNumber(),m<0||m>s.length)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),se===C.OP_LEFT?this.stack[this.stack.length-1]=_.Buffer.from(s).slice(0,m):this.stack[this.stack.length-1]=_.Buffer.from(s).slice(s.length-m);break;case C.OP_SUBSTR:if((this.flags&q.SCRIPT_ENABLE_CHRONICLE)===0){if(this.flags&q.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;s=t(-3);var Z=ve.fromScriptNumBuffer(t(-1),i,q.MAXIMUM_ELEMENT_SIZE).toNumber(),X=ve.fromScriptNumBuffer(t(-2),i,q.MAXIMUM_ELEMENT_SIZE).toNumber();if(X<0||X>=s.length||Z<0||Z>s.length-X)return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;this.stack.pop(),this.stack.pop(),this.stack[this.stack.length-1]=_.Buffer.from(s).slice(X,X+Z);break;case C.OP_NUM2BIN:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var ge=ve.fromScriptNumBuffer(t(-1),i).toNumber();if(ge>q.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;this.stack.pop();var ee=t(-1);if(ee=q._minimallyEncode(ee),ee.length>ge)return this.errstr="SCRIPT_ERR_IMPOSSIBLE_ENCODING",!1;if(ee.length===ge){this.stack[this.stack.length-1]=ee;break}var ae=0;ee.length>0&&(ae=ee[ee.length-1]&128,ee[ee.length-1]&=127);var ht=_.Buffer.alloc(ge);ee.copy(ht,0);for(var pe=ee.length-1;pe++<ge-2;)ht[pe]=0;ht[pe]=ae,this.stack[this.stack.length-1]=ht;break;case C.OP_BIN2NUM:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(s=t(-1),f=q._minimallyEncode(s),this.stack[this.stack.length-1]=f,!q._isMinimallyEncoded(f))return this.errstr="SCRIPT_ERR_INVALID_NUMBER_RANGE",!1;break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}});var gi=B((kX,qv)=>{y();qv.exports=vv();qv.exports.Interpreter=Gl()});var ys=B((CX,D3)=>{"use strict";y();var Lv=mt(),Rn=at(),IF=jn(),k3=zg(),Wr=du(),N3=ir(),C3=Er(),Uv=Gr();function ce(e,t,r){if(!(this instanceof ce))return new ce(e,t,r);if(Lv.isArray(e)&&Lv.isNumber(t))return ce.createMultisig(e,t,r);if(e instanceof ce)return e;if(Rn.checkArgument(e,"First argument is required, please include address data.","guide/address.html"),t&&!Wr.get(t))throw new TypeError('Second argument must be "livenet", "testnet", or "regtest".');if(r&&r!==ce.PayToPublicKeyHash&&r!==ce.PayToScriptHash)throw new TypeError('Third argument must be "pubkeyhash" or "scripthash".');var i=this._classifyArguments(e,t,r);return i.network=i.network||Wr.get(t)||Wr.defaultNetwork,i.type=i.type||r||ce.PayToPublicKeyHash,C3.defineImmutable(this,{hashBuffer:i.hashBuffer,network:i.network,type:i.type}),this}ce.prototype._classifyArguments=function(e,t,r){if((e instanceof _.Buffer||e instanceof Uint8Array)&&e.length===20)return ce._transformHash(e);if((e instanceof _.Buffer||e instanceof Uint8Array)&&e.length===21)return ce._transformBuffer(e,t,r);if(e instanceof Uv)return ce._transformPublicKey(e);if(e instanceof Uu())return ce._transformScript(e,t);if(typeof e=="string")return ce._transformString(e,t,r);if(Lv.isObject(e))return ce._transformObject(e);throw new TypeError("First argument is an unrecognized data format.")};ce.PayToPublicKeyHash="pubkeyhash";ce.PayToScriptHash="scripthash";ce._transformHash=function(e){var t={};if(!(e instanceof _.Buffer)&&!(e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(e.length!==20)throw new TypeError("Address hashbuffers must be exactly 20 bytes.");return t.hashBuffer=e,t};ce._transformObject=function(e){return Rn.checkArgument(e.hash||e.hashBuffer,"Must provide a `hash` or `hashBuffer` property"),Rn.checkArgument(e.type,"Must provide a `type` property"),{hashBuffer:e.hash?_.Buffer.from(e.hash,"hex"):e.hashBuffer,network:Wr.get(e.network)||Wr.defaultNetwork,type:e.type}};ce._classifyFromVersion=function(e){var t={},r=Wr.get(e[0],"pubkeyhash"),i=Wr.get(e[0],"scripthash");return r?(t.network=r,t.type=ce.PayToPublicKeyHash):i&&(t.network=i,t.type=ce.PayToScriptHash),t};ce._transformBuffer=function(e,t,r){var i={};if(!(e instanceof _.Buffer)&&!(e instanceof Uint8Array))throw new TypeError("Address supplied is not a buffer.");if(e.length!==21)throw new TypeError("Address buffers must be exactly 21 bytes.");var n=Wr.get(t),o=ce._classifyFromVersion(e);if(t&&!n)throw new TypeError("Unknown network");if(!o.network||n&&n!==o.network)throw new TypeError("Address has mismatched network type.");if(!o.type||r&&r!==o.type)throw new TypeError("Address has mismatched type.");return i.hashBuffer=e.slice(1),i.network=o.network,i.type=o.type,i};ce._transformPublicKey=function(e){var t={};if(!(e instanceof Uv))throw new TypeError("Address must be an instance of PublicKey.");return t.hashBuffer=N3.sha256ripemd160(e.toBuffer()),t.type=ce.PayToPublicKeyHash,t};ce._transformScript=function(e,t){Rn.checkArgument(e instanceof Uu(),"script must be a Script instance");var r=e.getAddressInfo(t);if(!r)throw new IF.Script.CantDeriveAddress(e);return r};ce.createMultisig=function(e,t,r){return r=r||e[0].network||Wr.defaultNetwork,ce.payingTo(Uu().buildMultisigOut(e,t),r)};ce._transformString=function(e,t,r){if(typeof e!="string")throw new TypeError("data parameter supplied is not a string.");if(e.length<27)throw new Error("Invalid Address string provided");e=e.trim();var i=Wr.get(t);if(t&&!i)throw new TypeError("Unknown network");var n=k3.decode(e);return ce._transformBuffer(n,t,r)};ce.fromPublicKey=function(e,t){var r=ce._transformPublicKey(e);return t=t||Wr.defaultNetwork,new ce(r.hashBuffer,t,r.type)};ce.fromPrivateKey=function(e,t){let r=Uv.fromPrivateKey(e);return t=t||e.network||Wr.defaultNetwork,ce.fromPublicKey(r,t)};ce.fromPublicKeyHash=function(e,t){var r=ce._transformHash(e);return new ce(r.hashBuffer,t,ce.PayToPublicKeyHash)};ce.fromScriptHash=function(e,t){Rn.checkArgument(e,"hash parameter is required");var r=ce._transformHash(e);return new ce(r.hashBuffer,t,ce.PayToScriptHash)};ce.payingTo=function(e,t){return Rn.checkArgument(e,"script is required"),Rn.checkArgument(e instanceof Uu(),"script must be instance of Script"),ce.fromScriptHash(N3.sha256ripemd160(e.toBuffer()),t)};ce.fromScript=function(e,t){Rn.checkArgument(e instanceof Uu(),"script must be a Script instance");var r=ce._transformScript(e,t);return new ce(r.hashBuffer,t,r.type)};ce.fromBuffer=function(e,t,r){var i=ce._transformBuffer(e,t,r);return new ce(i.hashBuffer,i.network,i.type)};ce.fromHex=function(e,t,r){return ce.fromBuffer(_.Buffer.from(e,"hex"),t,r)};ce.fromString=function(e,t,r){var i=ce._transformString(e,t,r);return new ce(i.hashBuffer,i.network,i.type)};ce.fromObject=function(t){Rn.checkState(C3.isHexa(t.hash),'Unexpected hash property, "'+t.hash+'", expected to be hex.');var r=_.Buffer.from(t.hash,"hex");return new ce(r,t.network,t.type)};ce.getValidationError=function(e,t,r){var i;try{new ce(e,t,r)}catch(n){i=n}return i};ce.isValid=function(e,t,r){return!ce.getValidationError(e,t,r)};ce.prototype.isPayToPublicKeyHash=function(){return this.type===ce.PayToPublicKeyHash};ce.prototype.isPayToScriptHash=function(){return this.type===ce.PayToScriptHash};ce.prototype.toBuffer=function(){var e=_.Buffer.from([this.network[this.type]]),t=_.Buffer.concat([e,this.hashBuffer]);return t};ce.prototype.toHex=function(){return this.toBuffer().toString("hex")};ce.prototype.toObject=ce.prototype.toJSON=function(){return{hash:this.hashBuffer.toString("hex"),type:this.type,network:this.network.toString()}};ce.prototype.inspect=function(){return"<Address: "+this.toString()+", type: "+this.type+", network: "+this.network+">"};ce.prototype.toString=function(){return k3.encode(this.toBuffer())};D3.exports=ce;function Uu(){return gi()}});var ms=B((qX,F3)=>{"use strict";y();var $l=mt(),AF=ys(),q3=zg(),io=Ur(),L3=Er(),Gi=du(),jv=Gn(),OF=Gr(),RF=Jf(),U3=at(),Fv="[REDACTED]";function Ee(e,t){if(!(this instanceof Ee))return new Ee(e,t);if(e instanceof Ee)return e;var r=this._classifyArguments(e,t);if(!r.bn||r.bn.cmp(new io(0))===0)throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(jv.getN()))throw new TypeError("Number must be less than N");if(typeof r.network>"u")throw new TypeError('Must specify the network ("livenet" or "testnet")');return L3.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}Ee.prototype._classifyArguments=function(e,t){var r={compressed:!0,network:t?Gi.get(t):Gi.defaultNetwork};if($l.isUndefined(e)||$l.isNull(e))r.bn=Ee._getRandomBN();else if(e instanceof io)r.bn=e;else if(e instanceof _.Buffer||e instanceof Uint8Array)r=Ee._transformBuffer(e,t);else if(e.bn&&e.network)r=Ee._transformObject(e);else if(!t&&Gi.get(e))r.bn=Ee._getRandomBN(),r.network=Gi.get(e);else if(typeof e=="string")L3.isHexa(e)?r.bn=new io(_.Buffer.from(e,"hex")):r=Ee._transformWIF(e,t);else throw new TypeError("First argument is an unrecognized data type.");return r};Ee._getRandomBN=function(){var e,t;do{var r=RF.getRandomBuffer(32);t=io.fromBuffer(r),e=t.lt(jv.getN())}while(!e);return t};Ee._transformBuffer=function(e,t){var r={};if(e.length===32)return Ee._transformBNBuffer(e,t);if(r.network=Gi.get(e[0],"privatekey"),!r.network)throw new Error("Invalid network");if(t&&r.network!==Gi.get(t))throw new TypeError("Private key network mismatch");if(e.length===34&&e[33]===1)r.compressed=!0;else if(e.length===33)r.compressed=!1;else throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");return r.bn=io.fromBuffer(e.slice(1,33)),r};Ee._transformBNBuffer=function(e,t,r){var i={};return i.network=Gi.get(t)||Gi.defaultNetwork,i.bn=io.fromBuffer(e),i.compressed=r===void 0?!0:!!r,i};Ee._transformWIF=function(e,t){return Ee._transformBuffer(q3.decode(e),t)};Ee.fromBuffer=function(e,t,r){return r!==void 0&&e&&e.length===32?new Ee(Ee._transformBNBuffer(e,t,r)):new Ee(e,t)};Ee.fromHex=function(e,t,r){return Ee.fromBuffer(_.Buffer.from(e,"hex"),t,r)};Ee._transformObject=function(e){if(e.bn instanceof io)return{bn:e.bn,network:Gi.get(e.network),compressed:e.compressed};if(typeof e.bn!="string"||!e.bn.length)throw new TypeError("Invalid private key: `bn` must be a hex string");if(e.bn===Fv)throw new TypeError('Invalid private key: `bn` is "'+Fv+'". JSON.stringify() redacts the secret on purpose \u2014 use toObject() for a round-trippable export, or toWIF().');if(!/^[0-9a-fA-F]+$/.test(e.bn))throw new TypeError("Invalid private key: `bn` is not hexadecimal");var t=new io(e.bn,"hex");if(t.isZero()||t.gte(jv.getN()))throw new TypeError("Invalid private key: outside the range of valid keys");var r=Gi.get(e.network);return{bn:t,network:r,compressed:e.compressed}};Ee.fromString=Ee.fromWIF=function(e,t){return U3.checkArgument($l.isString(e),"First argument is expected to be a string."),new Ee(e,t)};Ee.fromObject=Ee.fromJSON=function(e){return U3.checkArgument($l.isObject(e),"First argument is expected to be an object."),new Ee(e)};Ee.fromRandom=function(e){var t=Ee._getRandomBN();return new Ee(t,e)};Ee.getValidationError=function(e,t){var r;try{new Ee(e,t)}catch(i){r=i}return r};Ee.isValid=function(e,t){return e?!Ee.getValidationError(e,t):!1};Ee.prototype.toString=function(){return this.toWIF()};Ee.prototype.toWIF=function(){var e=this.network,t=this.compressed,r;return t?r=_.Buffer.concat([_.Buffer.from([e.privatekey]),this.bn.toBuffer({size:32}),_.Buffer.from([1])]):r=_.Buffer.concat([_.Buffer.from([e.privatekey]),this.bn.toBuffer({size:32})]),q3.encode(r)};Ee.prototype.toBigNumber=function(){return this.bn};Ee.prototype.toBuffer=function(){return this.bn.toBuffer({size:32})};Ee.prototype.toHex=function(){return this.toBuffer().toString("hex")};Ee.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=OF.fromPrivateKey(this)),this._pubkey};Ee.prototype.toAddress=function(e){var t=this.toPublicKey();return AF.fromPublicKey(t,e||this.network)};Ee.prototype.toObject=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}};Ee.prototype.toJSON=function(){return{bn:Fv,compressed:this.compressed,network:this.network.toString()}};Ee.prototype.inspect=function(){var e=this.compressed?"":", uncompressed";return"<PrivateKey: "+this.toHex()+", network: "+this.network+e+">"};F3.exports=Ee});var Gr=B((UX,H3)=>{"use strict";y();var La=Ur(),Ua=Gn(),TF=ir(),BF=Er(),j3=du(),Hv=mt(),ws=at();function ye(e,t){if(!(this instanceof ye))return new ye(e,t);if(ws.checkArgument(e,"First argument is required, please include public key data."),e instanceof ye)return e;t=t||{};var r=this._classifyArgs(e,t);return r.point.validate(),BF.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||j3.defaultNetwork}),this}ye.prototype._classifyArgs=function(e,t){var r={compressed:Hv.isUndefined(t.compressed)||t.compressed};if(e instanceof Ua)r.point=e;else if(e.x&&e.y)r=ye._transformObject(e);else if(typeof e=="string")r=ye._transformDER(_.Buffer.from(e,"hex"));else if(ye._isBuffer(e))r=ye._transformDER(e);else if(ye._isPrivateKey(e))r=ye._transformPrivateKey(e);else throw new TypeError("First argument is an unrecognized data format.");return r.network||(r.network=Hv.isUndefined(t.network)?void 0:j3.get(t.network)),r};ye._isPrivateKey=function(e){var t=ms();return e instanceof t};ye._isBuffer=function(e){return e instanceof _.Buffer||e instanceof Uint8Array};ye._transformPrivateKey=function(e){ws.checkArgument(ye._isPrivateKey(e),"Must be an instance of PrivateKey");var t={};return t.point=Ua.getG().mul(e.bn),t.compressed=e.compressed,t.network=e.network,t};ye._transformDER=function(e,t){ws.checkArgument(ye._isBuffer(e),"Must be a buffer of DER encoded public key");var r={};t=Hv.isUndefined(t)?!0:t;var i,n,o,s;if(e[0]===4||!t&&(e[0]===6||e[0]===7)){if(o=e.slice(1,33),s=e.slice(33,65),o.length!==32||s.length!==32||e.length!==65)throw new TypeError("Length of x and y must be 32 bytes");i=new La(o),n=new La(s),r.point=new Ua(i,n),r.compressed=!1}else if(e[0]===3)o=e.slice(1),i=new La(o),r=ye._transformX(!0,i),r.compressed=!0;else if(e[0]===2)o=e.slice(1),i=new La(o),r=ye._transformX(!1,i),r.compressed=!0;else throw new TypeError("Invalid DER format public key");return r};ye._transformX=function(e,t){ws.checkArgument(typeof e=="boolean","Must specify whether y is odd or not (true or false)");var r={};return r.point=Ua.fromX(e,t),r};ye._transformObject=function(e){var t=new La(e.x,"hex"),r=new La(e.y,"hex"),i=new Ua(t,r);return new ye(i,{compressed:e.compressed})};ye.fromPrivateKey=function(e){ws.checkArgument(ye._isPrivateKey(e),"Must be an instance of PrivateKey");var t=ye._transformPrivateKey(e);return new ye(t.point,{compressed:t.compressed,network:t.network})};ye.fromDER=ye.fromBuffer=function(e,t){ws.checkArgument(ye._isBuffer(e),"Must be a buffer of DER encoded public key");var r=ye._transformDER(e,t);return new ye(r.point,{compressed:r.compressed})};ye.fromPoint=function(e,t){return ws.checkArgument(e instanceof Ua,"First argument must be an instance of Point."),new ye(e,{compressed:t})};ye.fromHex=ye.fromString=function(e,t){var r=_.Buffer.from(e,t||"hex"),i=ye._transformDER(r);return new ye(i.point,{compressed:i.compressed})};ye.fromX=function(e,t){var r=ye._transformX(e,t);return new ye(r.point,{compressed:r.compressed})};ye.getValidationError=function(e){var t;try{new ye(e)}catch(r){t=r}return t};ye.isValid=function(e){return!ye.getValidationError(e)};ye.prototype.toObject=ye.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}};ye.prototype.toBuffer=ye.prototype.toDER=function(){var e=this.point.getX(),t=this.point.getY(),r=e.toBuffer({size:32}),i=t.toBuffer({size:32}),n;if(this.compressed){var o=i[i.length-1]%2;return o?n=_.Buffer.from([3]):n=_.Buffer.from([2]),_.Buffer.concat([n,r])}else return n=_.Buffer.from([4]),_.Buffer.concat([n,r,i])};ye.prototype._getID=function(){return TF.sha256ripemd160(this.toBuffer())};ye.prototype.toAddress=function(e){var t=ys();return t.fromPublicKey(this,e||this.network)};ye.prototype.toString=ye.prototype.toHex=function(){return this.toDER().toString("hex")};ye.prototype.inspect=function(){return"<PublicKey: "+this.toHex()+(this.compressed?"":", uncompressed")+">"};H3.exports=ye});var Fu=B((jX,V3)=>{"use strict";y();var K3=Jf();function PF(){var e=K3.getRandomBuffer(16);e[6]=e[6]&15|64,e[8]=e[8]&63|128;var t=e.toString("hex");return[t.substring(0,8),t.substring(8,12),t.substring(12,16),t.substring(16,20),t.substring(20,32)].join("-")}function MF(e){return K3.getRandomBuffer(Math.ceil(e/2)).toString("hex").substring(0,e)}V3.exports={uuid4:PF,randomHex:MF}});var Z3=B((VX,Y3)=>{"use strict";y();var ju=Gr(),Kv=ir(),Vv=Pu(),G3=fr(),Gv=ms(),Dt=at(),KX=mt(),kF=Fu();function z3(e,t){if(t=t||{},t.issuerPublicKey)return t.issuerPublicKey instanceof ju?t.issuerPublicKey:ju.fromString(t.issuerPublicKey);var r=e&&e.issuer;if(typeof r!="string")return null;try{var i=r.split("#")[0].split(":")[2];return i?ju.fromString(i):null}catch{return null}}var Fa={PROPERTY_TITLE:"PropertyTitle",VEHICLE_TITLE:"VehicleTitle",INTELLECTUAL_PROPERTY:"IntellectualProperty",MUSIC_LICENSE:"MusicLicense",SOFTWARE_LICENSE:"SoftwareLicense",FINANCIAL_INSTRUMENT:"FinancialInstrument",PROMISSORY_NOTE:"PromissoryNote",BOND:"Bond",EQUITY_SHARE:"EquityShare",PROFESSIONAL_LICENSE:"ProfessionalLicense",REGULATORY_PERMIT:"RegulatoryPermit",ACCESS_RIGHT:"AccessRight",VOTING_RIGHT:"VotingRight",ROYALTY_RIGHT:"RoyaltyRight",USAGE_RIGHT:"UsageRight"},W3={create:function(e,t,r,i,n,o){o=o||{},Dt.checkArgument(typeof e=="string","Right type must be string"),Dt.checkArgument(typeof t=="string","Issuer DID must be string"),Dt.checkArgument(typeof r=="string","Subject DID must be string"),Dt.checkArgument(i&&typeof i=="object","Claim must be object");var s=Object.values(Fa);Dt.checkArgument(s.includes(e),"Invalid right type: "+e);var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalRightToken",e],issuer:t,issuanceDate:new Date().toISOString(),credentialSubject:{id:r,rightType:e,claim:i,jurisdiction:o.jurisdiction||"US",purpose:o.purpose||"legal_right",validFrom:o.validFrom||new Date().toISOString(),validUntil:o.validUntil||null,transferable:o.transferable!==!1,revocable:o.revocable!==!1}};return o.metadata&&(f.credentialSubject.metadata=o.metadata),f},prepareRightToken:function(e,t,r,i,n,o){o=o||{},Dt.checkArgument(typeof e=="string","Right type must be string"),Dt.checkArgument(typeof t=="string","Issuer DID must be string"),Dt.checkArgument(typeof r=="string","Subject DID must be string"),Dt.checkArgument(i&&typeof i=="object","Claim must be object"),Dt.checkArgument(n instanceof Gv,"Invalid issuer private key");var s=Object.values(Fa);Dt.checkArgument(s.includes(e),"Invalid right type: "+e);try{var f=this.create(e,t,r,i,n,o),h=this._signToken(f,n);return{success:!0,rightToken:h,tokenHash:h.tokenHash,metadata:{type:e,issuer:t,subject:r,transferable:f.credentialSubject.transferable,revocable:f.credentialSubject.revocable,jurisdiction:f.credentialSubject.jurisdiction},externalOperations:{storeToken:{endpoint:"POST /rights/tokens",data:{token:h,metadata:{type:e,issuer:t,subject:r,transferable:f.credentialSubject.transferable,revocable:f.credentialSubject.revocable,jurisdiction:f.credentialSubject.jurisdiction}}},indexToken:{endpoint:"POST /rights/index",data:{tokenId:h.id,tokenHash:h.tokenHash,type:e,issuer:t,subject:r,issuedAt:h.issuanceDate}},notifyParties:{endpoint:"POST /notifications/right-issued",data:{tokenId:h.id,issuer:t,subject:r,rightType:e}}}}}catch(m){return{success:!1,error:m.message}}},prepareRightTokenVerification:function(e,t){t=t||{};try{var r=[],i=[];this._validateTokenStructure(e,r),this._verifyTokenSignature(e,r,t),this._validateTokenTemporal(e,r,i),this._validateRightType(e,r),t.requireJurisdiction&&this._validateJurisdiction(e,t.allowedJurisdictions,r);var n={valid:r.length===0,errors:r,warnings:i,issuerDID:e.issuer,subjectDID:e.credentialSubject?e.credentialSubject.id:null,rightType:e.credentialSubject?e.credentialSubject.rightType:null,transferable:e.credentialSubject?e.credentialSubject.transferable:null,revocable:e.credentialSubject?e.credentialSubject.revocable:null,verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /rights/verification-record",data:{tokenId:e.id,result:n.valid,errors:r,warnings:i,verifiedAt:n.verifiedAt}},auditVerification:{endpoint:"POST /audit/right-verification",data:{tokenId:e.id,rightType:n.rightType,issuer:n.issuerDID,subject:n.subjectDID,result:n.valid,verifiedAt:n.verifiedAt}},updateTokenStatus:n.valid?{endpoint:"PUT /rights/tokens/"+e.id+"/status",data:{status:"VERIFIED",verifiedAt:n.verifiedAt}}:null}}}catch(o){return{success:!1,error:"Verification preparation failed: "+o.message}}},prepareRightTokenTransfer:function(e,t,r,i){i=i||{},Dt.checkArgument(e&&typeof e=="object","Invalid token"),Dt.checkArgument(typeof t=="string","New owner DID must be string"),Dt.checkArgument(r instanceof Gv,"Invalid current owner key");try{var n=this.prepareRightTokenVerification(e,{});if(!n.success||!n.verification.valid)return{success:!1,error:"Cannot transfer invalid token: "+n.verification.errors.join(", ")};if(!e.credentialSubject.transferable)return{success:!1,error:"Token is not transferable"};var o=e.credentialSubject&&e.credentialSubject.id,s=z3({issuer:o},{issuerPublicKey:i.currentOwnerPublicKey});if(!s)return{success:!1,error:"Cannot resolve current owner public key from token.credentialSubject.id; pass options.currentOwnerPublicKey"};if(r.toPublicKey().toString()!==s.toString())return{success:!1,error:"Unauthorized transfer: signing key does not match the current owner"};var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalRightTransfer"],issuer:e.credentialSubject.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:t,originalToken:e.id,transferFrom:e.credentialSubject.id,transferTo:t,transferDate:new Date().toISOString(),transferReason:i.reason||"ownership_transfer",consideration:i.consideration||null}},h=this._signToken(f,r),m=JSON.parse(JSON.stringify(e));m.id="urn:uuid:"+this._generateUUID(),m.issuanceDate=new Date().toISOString(),m.credentialSubject.id=t,m.credentialSubject.transferHistory=m.credentialSubject.transferHistory||[],m.credentialSubject.transferHistory.push({transferId:h.id,transferDate:h.issuanceDate,from:e.credentialSubject.id,to:t}),delete m.proof;var S=this._signToken(m,r);return{success:!0,newToken:S,transferProof:h,transferId:h.id,externalOperations:{recordTransfer:{endpoint:"POST /rights/transfers",data:{originalTokenId:e.id,newTokenId:S.id,transferProof:h,fromOwner:e.credentialSubject.id,toOwner:t,transferDate:h.issuanceDate}},updateOwnership:{endpoint:"PUT /rights/tokens/"+e.id+"/ownership",data:{newOwner:t,transferId:h.id,transferDate:h.issuanceDate,previousOwner:e.credentialSubject.id}},notifyParties:{endpoint:"POST /notifications/right-transferred",data:{originalTokenId:e.id,newTokenId:S.id,fromOwner:e.credentialSubject.id,toOwner:t,rightType:e.credentialSubject.rightType}},auditTransfer:{endpoint:"POST /audit/right-transfer",data:{originalTokenId:e.id,newTokenId:S.id,transferId:h.id,fromOwner:e.credentialSubject.id,toOwner:t,transferredAt:h.issuanceDate}}}}}catch(x){return{success:!1,error:x.message}}},prepareObligationToken:function(e,t,r,i){Dt.checkArgument(e&&typeof e=="object","Invalid right token"),Dt.checkArgument(typeof t=="string","Obligor DID must be string"),Dt.checkArgument(r&&typeof r=="object","Obligation must be object"),Dt.checkArgument(i instanceof Gv,"Invalid issuer key");try{var n={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalObligationToken"],issuer:e.issuer,issuanceDate:new Date().toISOString(),credentialSubject:{id:t,obligationType:"correlative_obligation",correlativeRight:e.id,rightHolder:e.credentialSubject.id,obligation:r,jurisdiction:e.credentialSubject.jurisdiction,purpose:e.credentialSubject.purpose}},o=this._signToken(n,i);return{success:!0,obligationToken:o,correlativeRight:e.id,externalOperations:{storeObligation:{endpoint:"POST /obligations/tokens",data:{obligationToken:o,correlativeRightId:e.id,obligor:t,rightHolder:e.credentialSubject.id}},linkToRight:{endpoint:"POST /rights/tokens/"+e.id+"/obligations",data:{obligationId:o.id,obligor:t,obligationType:"correlative_obligation"}},notifyObligor:{endpoint:"POST /notifications/obligation-created",data:{obligationId:o.id,obligor:t,rightHolder:e.credentialSubject.id,correlativeRight:e.id}}}}}catch(s){return{success:!1,error:s.message}}},prepareRightTypeValidation:function(e){Dt.checkArgument(typeof e=="string","Right type must be string");var t=Object.values(Fa),r=t.includes(e);return{success:!0,validation:{type:e,valid:r,availableTypes:t,category:this._categorizeRightType(e),description:this._getRightTypeDescription(e)},externalOperations:{validateType:{endpoint:"POST /rights/validate-type",data:{type:e,valid:r}}}}},_categorizeRightType:function(e){var t={PropertyTitle:"PROPERTY_RIGHT",VehicleTitle:"PROPERTY_RIGHT",IntellectualProperty:"IP_RIGHT",MusicLicense:"IP_RIGHT",SoftwareLicense:"IP_RIGHT",FinancialInstrument:"FINANCIAL_RIGHT",PromissoryNote:"FINANCIAL_RIGHT",Bond:"FINANCIAL_RIGHT",EquityShare:"FINANCIAL_RIGHT",ProfessionalLicense:"LICENSE_RIGHT",RegulatoryPermit:"LICENSE_RIGHT",AccessRight:"ACCESS_RIGHT",VotingRight:"GOVERNANCE_RIGHT",RoyaltyRight:"IP_RIGHT",UsageRight:"ACCESS_RIGHT"};return t[e]||"UNKNOWN"},_getRightTypeDescription:function(e){var t={PropertyTitle:"Legal ownership of real estate property",VehicleTitle:"Legal ownership of motor vehicle",IntellectualProperty:"Rights to intellectual property assets",MusicLicense:"License for music performance and usage",SoftwareLicense:"License for software usage and distribution",FinancialInstrument:"Rights related to financial instruments",PromissoryNote:"Promise to pay a specified amount",Bond:"Debt security representing loan",EquityShare:"Ownership stake in company",ProfessionalLicense:"License for professional practice",RegulatoryPermit:"Permit for regulated activities",AccessRight:"Right to access resources or locations",VotingRight:"Right to participate in governance",RoyaltyRight:"Right to receive royalty payments",UsageRight:"Right to use specific assets or services"};return t[e]||"Unknown right type"},getRightTypes:function(){return Fa},verifyToken:function(e,t){var r=[];try{if(Dt.checkArgument(e&&typeof e=="object","Invalid token"),!e.proof||!e.proof.jws)return r.push("Missing signature proof"),{valid:!1,errors:r};var i=t instanceof ju?t:ju.fromString(t),n=this._canonicalizeToken(e),o=Kv.sha256(_.Buffer.from(n));if(e.tokenHash&&e.tokenHash!==o.toString("hex"))return r.push("Token hash mismatch"),{valid:!1,errors:r};var s=e.proof.jws.split(".");if(s.length!==3||!s[2])return r.push("Malformed JWS"),{valid:!1,errors:r};var f=G3.fromDER(_.Buffer.from(s[2],"base64url")),h=new Vv;return h.hashbuf=o,h.sig=f,h.pubkey=i,h.verify()||r.push("Signature verification failed"),{valid:r.length===0,errors:r,tokenHash:o.toString("hex"),verifiedAt:new Date().toISOString()}}catch(m){return r.push(m.message),{valid:!1,errors:r}}},_signToken:function(e,t){var r=this._canonicalizeToken(e),i=Kv.sha256(_.Buffer.from(r)),n=new Vv;n.hashbuf=i,n.privkey=t,n.pubkey=t.toPublicKey(),n.sign();var o=n.sig,s={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:"assertionMethod",jws:this._createJWS(i,o)},f=JSON.parse(JSON.stringify(e));return f.proof=s,f.tokenHash=i.toString("hex"),f},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=t.toDER().toString("base64url");return i+".."+n},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,JSON.stringify(this._sortObjectKeys(t))},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_validateTokenStructure:function(e,t){e["@context"]||t.push("Missing @context"),e.id||t.push("Missing id"),(!e.type||!Array.isArray(e.type))&&t.push("Missing or invalid type"),e.issuer||t.push("Missing issuer"),e.issuanceDate||t.push("Missing issuanceDate"),e.credentialSubject||t.push("Missing credentialSubject"),e.proof||t.push("Missing proof")},_verifyTokenSignature:function(e,t,r){try{if(!e.proof||!e.proof.jws){t.push("Missing signature proof");return}var i=this._canonicalizeToken(e),n=Kv.sha256(_.Buffer.from(i));if(e.tokenHash&&e.tokenHash!==n.toString("hex")){t.push("Token hash mismatch");return}var o=z3(e,r);if(!o){t.push("Signature not verified: issuer public key could not be resolved from token.issuer; pass options.issuerPublicKey");return}var s=e.proof.jws.split(".");if(s.length!==3||!s[2]){t.push("Malformed JWS");return}var f=G3.fromDER(_.Buffer.from(s[2],"base64url")),h=new Vv;h.hashbuf=n,h.sig=f,h.pubkey=o,h.verify()!==!0&&t.push("Signature verification failed")}catch(m){t.push("Signature verification failed: "+m.message)}},_validateTokenTemporal:function(e,t,r){var i=new Date,n=new Date(e.issuanceDate);if(n>i&&t.push("Token issued in the future"),e.credentialSubject.validFrom){var o=new Date(e.credentialSubject.validFrom);i<o&&r.push("Token not yet valid")}if(e.credentialSubject.validUntil){var s=new Date(e.credentialSubject.validUntil);i>s&&t.push("Token expired")}},_validateRightType:function(e,t){if(!e.credentialSubject.rightType){t.push("Missing rightType");return}var r=Object.values(Fa);r.includes(e.credentialSubject.rightType)||t.push("Invalid right type: "+e.credentialSubject.rightType)},_validateJurisdiction:function(e,t,r){if(!e.credentialSubject.jurisdiction){r.push("Missing jurisdiction");return}t&&Array.isArray(t)&&(t.includes(e.credentialSubject.jurisdiction)||r.push("Jurisdiction not allowed: "+e.credentialSubject.jurisdiction))},_generateUUID:function(){return kF.uuid4()}};W3.RightTypes=Fa;Y3.exports=W3});var X3=B((zX,$3)=>{"use strict";y();var Hu=ir(),Ir=at(),NF=Fu(),Ss={PropertyTitle:{title:"Property Title",description:"Real estate property ownership title",type:"object",required:["propertyId","address","ownershipType"],properties:{propertyId:{type:"string",description:"Unique property identifier"},address:{type:"object",required:["street","city","state","country"],properties:{street:{type:"string"},city:{type:"string"},state:{type:"string"},country:{type:"string"},postalCode:{type:"string"}}},ownershipType:{type:"string",enum:["fee_simple","leasehold","joint_tenancy","tenancy_in_common"]},titleNumber:{type:"string"},registeredDate:{type:"string",format:"date-time"},legalDescription:{type:"string"},encumbrances:{type:"array",items:{type:"object",properties:{type:{type:"string"},amount:{type:"number"},description:{type:"string"}}}}}},VehicleTitle:{title:"Vehicle Title",description:"Motor vehicle ownership title",type:"object",required:["vin","make","model","year"],properties:{vin:{type:"string",pattern:"^[A-HJ-NPR-Z0-9]{17}$",description:"Vehicle Identification Number"},make:{type:"string"},model:{type:"string"},year:{type:"integer",minimum:1900,maximum:2030},titleNumber:{type:"string"},registeredState:{type:"string"},mileage:{type:"integer",minimum:0},color:{type:"string"},fuelType:{type:"string",enum:["gasoline","diesel","electric","hybrid","other"]},liens:{type:"array",items:{type:"object",properties:{lienholderName:{type:"string"},lienAmount:{type:"number"},lienDate:{type:"string",format:"date"}}}}}},PromissoryNote:{title:"Promissory Note",description:"Legal promise to pay a specified amount",type:"object",required:["principal","interestRate","maturityDate","borrower","lender"],properties:{principalAmount:{type:"number",minimum:0,description:"Principal amount in base currency units"},currency:{type:"string",default:"USD"},interestRate:{type:"number",minimum:0,maximum:100,description:"Annual interest rate percentage"},maturityDate:{type:"string",format:"date",description:"Date when principal and interest are due"},payee:{type:"string",description:"DID of the payee (creditor)"},payor:{type:"string",description:"DID of the payor (debtor)"},paymentSchedule:{type:"string",enum:["lump_sum","monthly","quarterly","annually"]},collateral:{type:"array",items:{type:"object",properties:{description:{type:"string"},value:{type:"number"},type:{type:"string"}}}},defaultProvisions:{type:"string"},governingLaw:{type:"string"}}},IntellectualProperty:{title:"Intellectual Property",description:"Intellectual property rights and licensing",type:"object",required:["ipType","title","registrationNumber"],properties:{ipType:{type:"string",enum:["patent","trademark","copyright","trade_secret"]},title:{type:"string"},creator:{type:"string",description:"Creator DID"},registrationNumber:{type:"string"},registrationDate:{type:"string",format:"date"},expirationDate:{type:"string",format:"date"},jurisdiction:{type:"string"},description:{type:"string"},claims:{type:"array",items:{type:"string"}},priorArt:{type:"array",items:{type:"object",properties:{reference:{type:"string"},date:{type:"string",format:"date"},relevance:{type:"string"}}}}}},ProfessionalLicense:{title:"Professional License",description:"Professional practice license or certification",type:"object",required:["licenseType","licenseNumber","issuingAuthority","expirationDate"],properties:{licenseType:{type:"string"},licenseNumber:{type:"string"},issuingAuthority:{type:"string"},licensee:{type:"string",description:"Licensee DID"},issueDate:{type:"string",format:"date"},expirationDate:{type:"string",format:"date"},renewalDate:{type:"string",format:"date"},jurisdiction:{type:"string"},scope:{type:"string"},restrictions:{type:"array",items:{type:"string"}},continuing_education:{type:"object",properties:{hours_required:{type:"integer"},deadline:{type:"string",format:"date"},completed_hours:{type:"integer"}}}}},MusicLicense:{title:"Music License",description:"Music performance and usage licensing",type:"object",required:["songTitle","artist","licenseType","royaltyRate"],properties:{workTitle:{type:"string"},composer:{type:"string",description:"Composer DID"},performer:{type:"string",description:"Performer DID"},licenseType:{type:"string",enum:["mechanical","performance","synchronization","master_use"]},territory:{type:"string"},duration:{type:"string"},royaltyRate:{type:"number",minimum:0,maximum:100},advancePayment:{type:"number",minimum:0},exclusivity:{type:"boolean"},mediaTypes:{type:"array",items:{type:"string",enum:["cd","vinyl","digital","streaming","broadcast","film","tv"]}},usage_restrictions:{type:"string"},copyrightNotice:{type:"string"}}}},CF={prepareClaimValidation:function(e,t){try{Ir.checkArgument(e&&typeof e=="object","Invalid claim"),Ir.checkArgument(typeof t=="string","Schema name must be string");var r=Ss[t];if(!r)return{success:!1,error:"Unknown schema: "+t};var i=[],n=[];this._validateObject(e,r,"",i,n);var o={valid:i.length===0,errors:i,warnings:n,schema:t,claimHash:this.hash(e),canonical:this.canonicalize(e)};return{success:!0,validation:o,claim:e,schema:r,externalOperations:{store:{endpoint:"POST /claims/validate",data:{claim:e,validation:o,schema:t}},index:{endpoint:"POST /claims/index",data:{claimHash:o.claimHash,schemaName:t,valid:o.valid}}}}}catch(s){return{success:!1,error:"Validation preparation failed: "+s.message}}},prepareClaimAttestation:function(e,t,r){try{Ir.checkArgument(e&&typeof e=="object","Invalid claim"),Ir.checkArgument(typeof t=="string","Schema name must be string"),Ir.checkArgument(r&&typeof r=="object","Invalid attestor");var i=this.prepareClaimValidation(e,t);if(!i.success||!i.validation.valid)return{success:!1,error:"Cannot attest invalid claim",validation:i};var n={type:"LTP_CLAIM_ATTESTATION",claimHash:i.validation.claimHash,schemaName:t,attestor:{did:r.did||r.id,name:r.name||"Unknown",authority:r.authority||null,jurisdiction:r.jurisdiction||null},attestedAt:new Date().toISOString(),confidence:r.confidence||100,evidence:r.evidence||null,notes:r.notes||null},o=Hu.sha256(_.Buffer.from(this.canonicalize(n))).toString("hex");return n.attestationHash=o,{success:!0,attestation:n,claim:e,validation:i.validation,externalOperations:{storeAttestation:{endpoint:"POST /claims/"+i.validation.claimHash+"/attestations",data:n},notifyStakeholders:{endpoint:"POST /notifications/claim-attested",data:{claimHash:i.validation.claimHash,attestorDid:n.attestor.did,attestationHash:o}}}}}catch(s){return{success:!1,error:"Attestation preparation failed: "+s.message}}},prepareClaimDispute:function(e,t,r){try{Ir.checkArgument(typeof e=="string","Claim hash must be string"),Ir.checkArgument(t&&typeof t=="object","Invalid disputant"),Ir.checkArgument(r&&typeof r=="object","Invalid dispute");var i={type:"LTP_CLAIM_DISPUTE",claimHash:e,disputant:{did:t.did||t.id,name:t.name||"Unknown",jurisdiction:t.jurisdiction||null},dispute:{reason:r.reason||"UNSPECIFIED",category:r.category||"ACCURACY",description:r.description||"",evidence:r.evidence||null,requestedAction:r.requestedAction||"REVIEW"},disputedAt:new Date().toISOString(),status:"FILED",priority:r.priority||"NORMAL"},n=Hu.sha256(_.Buffer.from(this.canonicalize(i))).toString("hex");return i.disputeHash=n,{success:!0,dispute:i,disputeId:this._generateDisputeId(e),externalOperations:{fileDispute:{endpoint:"POST /claims/"+e+"/disputes",data:i},notifyStakeholders:{endpoint:"POST /notifications/claim-disputed",data:{claimHash:e,disputantDid:i.disputant.did,disputeHash:n}},escalate:{endpoint:"POST /disputes/escalate",data:{disputeHash:n,priority:i.priority}}}}}catch(o){return{success:!1,error:"Dispute preparation failed: "+o.message}}},prepareBulkClaimValidation:function(e,t){try{Ir.checkArgument(Array.isArray(e),"Claims must be array"),Ir.checkArgument(typeof t=="string","Schema name must be string");var r=[],i=[],n=0;e.forEach(function(f,h){try{var m=this.prepareClaimValidation(f,t);m.success&&m.validation.valid&&n++,r.push({index:h,result:m})}catch(S){i.push({index:h,error:S.message})}}.bind(this));var o=this._generateBatchId(),s=Hu.sha256(_.Buffer.from(JSON.stringify(r.map(f=>f.result.validation.claimHash)))).toString("hex");return{success:!0,batchId:o,batchHash:s,totalClaims:e.length,validClaims:n,invalidClaims:e.length-n,validations:r,errors:i,externalOperations:{storeBatch:{endpoint:"POST /claims/batch-validate",data:{batchId:o,batchHash:s,schemaName:t,validations:r}},generateReport:{endpoint:"POST /reports/bulk-validation",data:{batchId:o,summary:{total:e.length,valid:n,invalid:e.length-n}}}}}}catch(f){return{success:!1,error:"Bulk validation preparation failed: "+f.message}}},canonicalize:function(e){Ir.checkArgument(e&&typeof e=="object","Invalid claim");var t=this._sortObjectKeys(e);return JSON.stringify(t)},hash:function(e){var t=this.canonicalize(e);return Hu.sha256(_.Buffer.from(t)).toString("hex")},prepareClaimTemplate:function(e,t){t=t||{};try{var r=Ss[e];if(!r)return{success:!1,error:"Unknown schema: "+e};var i=this._createTemplateFromSchema(r),n=this._generateFormStructure(r);return{success:!0,schemaName:e,template:i,schema:r,formStructure:n,validation:{required:r.required||[],patterns:this._extractPatterns(r),enums:this._extractEnums(r)},externalOperations:{generateForm:{endpoint:"POST /forms/generate",data:{schemaName:e,formStructure:n,template:i}},saveTemplate:{endpoint:"POST /templates/claim",data:{schemaName:e,template:i,customizations:t.customizations||{}}}}}}catch(o){return{success:!1,error:"Template preparation failed: "+o.message}}},getSchemas:function(){return Ss},getSchemaNames:function(){return Object.keys(Ss)},getSchema:function(e){return Ss[e]||null},addSchema:function(e,t){Ir.checkArgument(typeof e=="string","Schema name must be string"),Ir.checkArgument(t&&typeof t=="object","Invalid schema"),Ss[e]=t},createTemplate:function(e){var t=Ss[e];if(!t)throw new Error("Unknown schema: "+e);return this._createTemplateFromSchema(t)},_generateDisputeId:function(e){var t="dispute_"+e+"_"+Date.now();return Hu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_generateBatchId:function(){return NF.randomHex(16)},_generateFormStructure:function(e){var t={type:"form",title:e.title||"Legal Claim Form",description:e.description||"",fields:[]};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r],n={name:r,label:this._humanizeFieldName(r),type:this._mapSchemaTypeToFormType(i),required:e.required&&e.required.includes(r),validation:this._extractFieldValidation(i)};i.enum&&(n.options=i.enum.map(function(o){return{value:o,label:this._humanizeValue(o)}}.bind(this))),t.fields.push(n)}.bind(this)),t},_extractPatterns:function(e){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];i.pattern&&(t[r]=i.pattern)}),t},_extractEnums:function(e){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];i.enum&&(t[r]=i.enum)}),t},_mapSchemaTypeToFormType:function(e){switch(e.type){case"string":return e.enum?"select":e.format==="date"?"date":e.format==="date-time"?"datetime":"text";case"number":case"integer":return"number";case"boolean":return"checkbox";case"array":return"list";case"object":return"fieldset";default:return"text"}},_extractFieldValidation:function(e){var t={};return e.pattern&&(t.pattern=e.pattern),e.minimum!==void 0&&(t.min=e.minimum),e.maximum!==void 0&&(t.max=e.maximum),e.format&&(t.format=e.format),t},_humanizeFieldName:function(e){return e.replace(/([A-Z])/g," $1").replace(/^./,function(t){return t.toUpperCase()}).replace(/_/g," ")},_humanizeValue:function(e){return e.replace(/_/g," ").replace(/\b\w/g,function(t){return t.toUpperCase()})},_validateObject:function(e,t,r,i,n){t.type==="object"?(t.required&&Array.isArray(t.required)&&t.required.forEach(function(o){e.hasOwnProperty(o)||i.push("Missing required field: "+this._getFieldPath(r,o))}.bind(this)),t.properties&&Object.keys(e).forEach(function(o){var s=this._getFieldPath(r,o),f=t.properties[o];f?this._validateValue(e[o],f,s,i,n):n.push("Unknown field: "+s)}.bind(this))):this._validateValue(e,t,r,i,n)},_validateValue:function(e,t,r,i,n){if(t.type){var o=Array.isArray(e)?"array":typeof e;if(o!==t.type){i.push("Invalid type for "+r+": expected "+t.type+", got "+o);return}}if(t.type==="string"&&(t.pattern&&!new RegExp(t.pattern).test(e)&&i.push("Value does not match pattern for "+r),t.enum&&!t.enum.includes(e)&&i.push("Invalid enum value for "+r+": "+e),t.format==="date"&&!this._isValidDate(e)&&i.push("Invalid date format for "+r),t.format==="date-time"&&!this._isValidDateTime(e)&&i.push("Invalid date-time format for "+r)),(t.type==="number"||t.type==="integer")&&(t.minimum!==void 0&&e<t.minimum&&i.push("Value below minimum for "+r+": "+e+" < "+t.minimum),t.maximum!==void 0&&e>t.maximum&&i.push("Value above maximum for "+r+": "+e+" > "+t.maximum),t.type==="integer"&&!Number.isInteger(e)&&i.push("Value must be integer for "+r)),t.type==="array"&&t.items)for(var s=0;s<e.length;s++)this._validateValue(e[s],t.items,r+"["+s+"]",i,n);t.type==="object"&&this._validateObject(e,t,r,i,n)},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_createTemplateFromSchema:function(e){if(e.type==="object"){var t={};return e.properties&&Object.keys(e.properties).forEach(function(r){var i=e.properties[r];t[r]=this._getDefaultValue(i)}.bind(this)),t}return this._getDefaultValue(e)},_getDefaultValue:function(e){if(e.default!==void 0)return e.default;switch(e.type){case"string":return e.enum?e.enum[0]:e.format==="date"?"2023-01-01":e.format==="date-time"?new Date().toISOString():"PLACEHOLDER_STRING";case"number":case"integer":return e.minimum||0;case"boolean":return!1;case"array":return[];case"object":return this._createTemplateFromSchema(e);default:return null}},_getFieldPath:function(e,t){return e?e+"."+t:t},_isValidDate:function(e){var t=new Date(e);return!isNaN(t.getTime())&&e.match(/^\d{4}-\d{2}-\d{2}$/)},_isValidDateTime:function(e){var t=new Date(e);return!isNaN(t.getTime())}};$3.exports=CF});var Q3=B((YX,J3)=>{"use strict";y();var Ku=ir(),ja=at(),DF={prepareTokenCommitment:function(e,t){t=t||{},ja.checkArgument(e&&typeof e=="object","Invalid token");try{var r=this._createCommitment(e,t),i=this._formatOpReturn(r,t),n=this._createTxTemplate(i,t);return{success:!0,commitment:r,opReturnData:i,txTemplate:n,preparedAt:new Date().toISOString(),metadata:{tokenId:e.id,purpose:t.purpose||"legal_token_anchor",version:"LTP.v1"}}}catch(o){return{success:!1,error:o.message}}},prepareBatchCommitment:function(e,t){t=t||{},ja.checkArgument(Array.isArray(e),"Tokens must be array");try{var r=this._createBatchCommitment(e,t),i=this._formatOpReturn(r,t),n=this._createTxTemplate(i,t);return{success:!0,batchCommitment:r,opReturnData:i,txTemplate:n,tokenCount:e.length,preparedAt:new Date().toISOString(),metadata:{purpose:t.purpose||"legal_token_batch_anchor",version:"LTP.v1"}}}catch(o){return{success:!1,error:o.message}}},verifyTokenAnchor:function(e,t,r){ja.checkArgument(e&&typeof e=="object","Invalid token"),ja.checkArgument(typeof t=="string","Transaction ID must be string");try{var i=this._createCommitment(e,{}),n=this._extractOpReturn(r);if(!n)return{valid:!1,error:"No OP_RETURN data found in transaction"};var o=this._verifyCommitment(i,n);return{valid:o,chainVerified:!1,txid:t,commitment:i,anchorData:n,verifiedAt:new Date().toISOString()}}catch(s){return{valid:!1,error:s.message}}},formatRevocation:function(e,t){ja.checkArgument(typeof e=="string","Token ID must be string"),ja.checkArgument(t&&typeof t=="object","Invalid revocation data");try{var r={type:"LTP_REVOCATION",tokenId:e,reason:t.reason||"UNSPECIFIED",revokedBy:t.revokedBy||"UNKNOWN",revokedAt:new Date().toISOString(),effectiveDate:t.effectiveDate||new Date().toISOString(),legalBasis:t.legalBasis||null,evidence:t.evidence||null},i=Ku.sha256(_.Buffer.from(JSON.stringify(r))).toString("hex");return{success:!0,revocation:r,revocationHash:i,opReturnData:this._formatOpReturn({hash:i,type:"REVOCATION"},{})}}catch(n){return{success:!1,error:n.message}}},_createCommitment:function(e,t){var r=this._canonicalizeToken(e),i={type:"LTP_TOKEN",tokenHash:Ku.sha256(_.Buffer.from(r)).toString("hex"),tokenId:e.id,timestamp:new Date().toISOString(),purpose:t.purpose||"legal_token"},n=Ku.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex");return{hash:n,data:i,canonical:r}},_createBatchCommitment:function(e,t){var r=[],i=[];e.forEach(function(f){var h=this._createCommitment(f,t);r.push(h.hash),i.push(f.id)}.bind(this));var n=this._createMerkleRoot(r),o={type:"LTP_BATCH",merkleRoot:n,tokenCount:e.length,tokenIds:i,timestamp:new Date().toISOString(),purpose:t.purpose||"batch_anchor"},s=Ku.sha256(_.Buffer.from(JSON.stringify(o))).toString("hex");return{hash:s,data:o,merkleRoot:n,tokenHashes:r}},_formatOpReturn:function(e,t){var r=t.prefix||"LTP.v1",i=e.hash;return{prefix:r,data:i,full:r+"."+i,bytes:_.Buffer.from(r+"."+i,"utf8"),size:_.Buffer.from(r+"."+i,"utf8").length}},_createTxTemplate:function(e,t){try{var r={version:1,inputs:[],outputs:[{satoshis:0,script:"OP_RETURN "+e.data}],locktime:0};return t.feeOutput&&r.outputs.push(t.feeOutput),{template:r,opReturn:e,estimatedSize:this._estimateSize(r),instructions:{step1:"Add input UTXOs to cover fees",step2:"Add change output if needed",step3:"Sign transaction with appropriate keys",step4:"Broadcast to BSV network"}}}catch(i){throw new Error("Failed to create transaction template: "+i.message)}},_extractOpReturn:function(e){try{if(!e||!e.outputs)return null;for(var t=0;t<e.outputs.length;t++){var r=e.outputs[t];if(r.script&&r.script.startsWith("OP_RETURN")){var i=r.script.replace("OP_RETURN ","");return{raw:i,decoded:_.Buffer.from(i,"hex").toString("utf8")}}}return null}catch{return null}},_verifyCommitment:function(e,t){try{return!t||!t.decoded?!1:t.decoded.includes(e.hash)}catch{return!1}},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,delete t.anchorTx,delete t.anchorBlock,JSON.stringify(this._sortObjectKeys(t))},_createMerkleRoot:function(e){if(e.length===0)return null;if(e.length===1)return e[0];for(var t=e.slice();t.length>1;){for(var r=[],i=0;i<t.length;i+=2){var n=t[i],o=t[i+1]||n,s=_.Buffer.concat([_.Buffer.from(n,"hex"),_.Buffer.from(o,"hex")]),f=Ku.sha256(s).toString("hex");r.push(f)}t=r}return t[0]},_estimateSize:function(e){var t=10,r=e.outputs.length*34,i=148;return{base:t+r,withOneInput:t+r+i,bytesPerInput:i}},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e}};J3.exports=DF});var rR=B(($X,tR)=>{"use strict";y();var qF=Gr(),_i=ir(),eR=Pu(),LF=fr(),UF=ms(),ur=at(),FF={prepareSignatureProof:function(e,t,r){r=r||{},ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t instanceof UF,"Invalid private key");try{var i=this._canonicalizeForSigning(e),n=_i.sha256(_.Buffer.from(i)),o=new eR;o.hashbuf=n,o.privkey=t,o.pubkey=t.toPublicKey(),o.sign();var s=o.sig,f={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:r.purpose||"assertionMethod",jws:this._createJWS(n,s),proofValue:s.toDER().toString("hex")};return{success:!0,proof:f,tokenHash:n.toString("hex"),canonical:i,signingKey:{publicKey:t.toPublicKey().toString(),keyId:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1"},externalOperations:{storeProof:{endpoint:"POST /proofs/signature",data:{tokenHash:n.toString("hex"),proof:f,signingKey:t.toPublicKey().toString()}},verifyProof:{endpoint:"POST /proofs/verify-signature",data:{tokenHash:n.toString("hex"),signature:s.toDER().toString("hex"),publicKey:t.toPublicKey().toString()}}}}}catch(h){return{success:!1,error:h.message}}},prepareSignatureVerification:function(e,t){try{if(ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(typeof t=="string","Public key must be string"),!e.proof)return{success:!1,error:"No proof found in token"};var r=this._canonicalizeForSigning(e),i=_i.sha256(_.Buffer.from(r)),n=LF.fromDER(_.Buffer.from(e.proof.proofValue,"hex")),o={tokenHash:i.toString("hex"),signature:n.toDER().toString("hex"),publicKey:t,proof:e.proof,canonical:r},s=new eR;s.hashbuf=i,s.sig=n,s.pubkey=qF.fromString(t);var f=s.verify()===!0;return{success:!0,verification:{valid:f,tokenHash:i.toString("hex"),signatureValid:f,publicKey:t,verifiedAt:new Date().toISOString()},verificationData:o,externalOperations:{recordVerification:{endpoint:"POST /proofs/verification-record",data:{tokenHash:i.toString("hex"),result:f,publicKey:t,verifiedAt:new Date().toISOString()}},auditVerification:{endpoint:"POST /audit/proof-verification",data:{tokenId:e.id,proofType:e.proof.type,result:f,verifier:t}}}}}catch(h){return{success:!1,error:h.message}}},prepareSelectiveDisclosure:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(Array.isArray(t),"Revealed fields must be array"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=this._createFieldCommitments(e,r),n=this._createMerkleTree(i),o=[],s=[];t.forEach(function(h){var m=this._getNestedValue(e,h),S=this._findFieldCommitment(i,h);if(S){o.push({path:h,value:m,commitment:S.hash,salt:S.salt});var x=this._generateMerkleProof(n,S.index);s.push({path:h,leafIndex:S.index,proof:x})}}.bind(this));var f={type:"LegalTokenSelectiveDisclosure",created:new Date().toISOString(),proofPurpose:"selectiveDisclosure",verificationMethod:e.proof?e.proof.verificationMethod:null,nonce:r,merkleRoot:n.root,disclosures:o,merkleProofs:s,totalFields:i.length};return{success:!0,proof:f,hiddenFieldCount:i.length-o.length,revealedFieldCount:o.length,externalOperations:{storeDisclosure:{endpoint:"POST /proofs/selective-disclosure",data:{tokenId:e.id,proof:f,merkleRoot:n.root}},verifyDisclosure:{endpoint:"POST /proofs/verify-disclosure",data:{proof:f,expectedNonce:r}},auditDisclosure:{endpoint:"POST /audit/selective-disclosure",data:{tokenId:e.id,revealedFields:t,totalFields:i.length,disclosedAt:new Date().toISOString()}}}}}catch(h){return{success:!1,error:h.message}}},prepareSelectiveDisclosureVerification:function(e,t){try{if(ur.checkArgument(e&&typeof e=="object","Invalid proof"),ur.checkArgument(typeof t=="string","Expected nonce must be string"),e.nonce!==t)return{success:!1,error:"Nonce mismatch"};var r=[],i=[];e.disclosures.forEach(function(o,s){var f=e.merkleProofs[s],h=this._hashField(o.path,o.value,o.salt);if(h!==o.commitment){i.push("Invalid commitment for field: "+o.path);return}var m=this._verifyMerkleProof(o.commitment,f.leafIndex,f.proof,e.merkleRoot);m?r.push({path:o.path,value:o.value,verified:!0}):i.push("Invalid Merkle proof for field: "+o.path)}.bind(this));var n={valid:i.length===0,errors:i,disclosures:r,merkleRoot:e.merkleRoot,totalFields:e.totalFields,verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /proofs/disclosure-verification",data:{proofId:e.id||"unknown",result:n.valid,verifiedFields:r.length,totalFields:e.totalFields,verifiedAt:n.verifiedAt}},auditVerification:{endpoint:"POST /audit/disclosure-verification",data:{merkleRoot:e.merkleRoot,disclosuresVerified:r.length,errors:i.length,result:n.valid}}}}}catch(o){return{success:!1,error:o.message}}},prepareLegalValidityProof:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t&&typeof t=="object","Invalid jurisdiction"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=t.requirements||[],n=[],o=!0;i.forEach(function(f){var h=this._checkLegalRequirement(e,f);n.push(h),h.satisfied||(o=!1)}.bind(this));var s={type:"LegalValidityProof",created:new Date().toISOString(),proofPurpose:"legalValidity",jurisdiction:t.code,nonce:r,valid:o,checks:n,complianceHash:this._hashCompliance(e,t,r)};return{success:!0,proof:s,valid:o,complianceReport:{jurisdiction:t.code,totalRequirements:i.length,satisfiedRequirements:n.filter(f=>f.satisfied).length,failedRequirements:n.filter(f=>!f.satisfied).length,overallCompliance:o},externalOperations:{submitCompliance:{endpoint:"POST /compliance/legal-validity",data:{tokenId:e.id,jurisdiction:t.code,proof:s,complianceReport:{jurisdiction:t.code,totalRequirements:i.length,satisfiedRequirements:n.filter(f=>f.satisfied).length,failedRequirements:n.filter(f=>!f.satisfied).length,overallCompliance:o}}},auditCompliance:{endpoint:"POST /audit/compliance-check",data:{tokenId:e.id,jurisdiction:t.code,result:o,checkedAt:new Date().toISOString(),requirements:n}},notifyRegulator:o?null:{endpoint:"POST /notifications/compliance-failure",data:{tokenId:e.id,jurisdiction:t.code,failedRequirements:n.filter(f=>!f.satisfied)}}}}}catch(f){return{success:!1,error:f.message}}},prepareZeroKnowledgeProof:function(e,t,r){ur.checkArgument(e&&typeof e=="object","Invalid token"),ur.checkArgument(t&&typeof t=="object","Invalid statement"),ur.checkArgument(typeof r=="string","Nonce must be string");try{var i=_i.sha256(_.Buffer.from(this._canonicalizeForSigning(e)+r)).toString("hex"),n={type:"LegalTokenZKProof",created:new Date().toISOString(),proofPurpose:"zeroKnowledge",statement:{claim:t.claim||"UNSPECIFIED",predicate:t.predicate||"SATISFIES",threshold:t.threshold||null},commitment:i,nonce:r,proofData:this._generateZKProofData(e,t,r)};return{success:!0,proof:n,commitment:i,externalOperations:{storeZKProof:{endpoint:"POST /proofs/zero-knowledge",data:{tokenId:e.id,proof:n,statement:t}},verifyZKProof:{endpoint:"POST /proofs/verify-zk",data:{proof:n,expectedNonce:r}},auditZKProof:{endpoint:"POST /audit/zk-proof",data:{tokenId:e.id,statement:t.claim,proofGenerated:new Date().toISOString()}}}}}catch(o){return{success:!1,error:o.message}}},_generateZKProofData:function(e,t,r){var i={challenge:_i.sha256(_.Buffer.from(t.claim+r)).toString("hex"),response:_i.sha256(_.Buffer.from(this._canonicalizeForSigning(e)+t.claim)).toString("hex"),witness:_i.sha256(_.Buffer.from(r+e.id+t.predicate)).toString("hex")};return i},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=e.toString("base64url"),o=t.toDER().toString("base64url");return i+".."+o},_canonicalizeForSigning:function(e){var t=JSON.parse(JSON.stringify(e));delete t.proof,delete t.tokenHash;var r=this._sortObjectKeys(t);return JSON.stringify(r)},_createFieldCommitments:function(e,t){var r=[],i=0;return this._traverseObject(e,"",function(n,o){if(n!=="proof"&&n!=="tokenHash"){var s=_i.sha256(_.Buffer.from(t+n+i)).toString("hex"),f=this._hashField(n,o,s);r.push({path:n,value:o,salt:s,hash:f,index:i}),i++}}.bind(this)),r},_hashField:function(e,t,r){var i=e+":"+JSON.stringify(t)+":"+r;return _i.sha256(_.Buffer.from(i)).toString("hex")},_createMerkleTree:function(e){var t=e.map(function(S){return S.hash});if(t.length===0)return{root:null,levels:[]};for(var r=[t],i=t;i.length>1;){for(var n=[],o=0;o<i.length;o+=2){var s=i[o],f=i[o+1]||s,h=_.Buffer.concat([_.Buffer.from(s,"hex"),_.Buffer.from(f,"hex")]),m=_i.sha256(h).toString("hex");n.push(m)}r.push(n),i=n}return{root:i[0],levels:r}},_generateMerkleProof:function(e,t){for(var r=[],i=t,n=0;n<e.levels.length-1;n++){var o=e.levels[n],s=i%2===0,f=s?i+1:i-1;f<o.length&&r.push({hash:o[f],isLeft:!s}),i=Math.floor(i/2)}return r},_verifyMerkleProof:function(e,t,r,i){for(var n=e,o=t,s=0;s<r.length;s++){var f=r[s],h=o%2===0,m;f.isLeft?m=_.Buffer.concat([_.Buffer.from(f.hash,"hex"),_.Buffer.from(n,"hex")]):m=_.Buffer.concat([_.Buffer.from(n,"hex"),_.Buffer.from(f.hash,"hex")]),n=_i.sha256(m).toString("hex"),o=Math.floor(o/2)}return n===i},_traverseObject:function(e,t,r){Array.isArray(e)?e.forEach(function(i,n){var o=t+"["+n+"]";this._traverseObject(i,o,r)}.bind(this)):e!==null&&typeof e=="object"?Object.keys(e).forEach(function(i){var n=t?t+"."+i:i;this._traverseObject(e[i],n,r)}.bind(this)):r(t,e)},_getNestedValue:function(e,t){return t.split(".").reduce(function(r,i){return r&&r[i]},e)},_findFieldCommitment:function(e,t){return e.find(function(r){return r.path===t})},_checkLegalRequirement:function(e,t){switch(t.type){case"field_present":var r=this._getNestedValue(e,t.field);return{requirement:t.type,field:t.field,satisfied:r!=null};case"field_value":var r=this._getNestedValue(e,t.field);return{requirement:t.type,field:t.field,satisfied:r===t.expectedValue};case"temporal_validity":var i=new Date,n=new Date(e.issuanceDate);return{requirement:t.type,satisfied:n<=i};default:return{requirement:t.type,satisfied:!1,error:"Unknown requirement type"}}},_hashCompliance:function(e,t,r){var i={tokenId:e.id,jurisdiction:t.code,nonce:r,timestamp:new Date().toISOString()};return _i.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex")},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e}};tR.exports=FF});var oR=B((eJ,nR)=>{"use strict";y();var Vu=ir(),JX=ys(),QX=Cv(),yr=at(),iR=Fu(),jF={prepareRegistry:function(e){e=e||{},yr.checkArgument(typeof e=="object","Config must be object");var t={id:e.id||this._generateRegistryId(),name:e.name||"Legal Token Registry",jurisdiction:e.jurisdiction||"GLOBAL",authority:e.authority||null,created:new Date().toISOString(),version:"1.0.0",config:{allowPublicRegistration:e.allowPublicRegistration||!1,requireApproval:e.requireApproval||!0,enableRevocation:e.enableRevocation!==!1,enableAuditTrail:e.enableAuditTrail!==!1,retentionPeriod:e.retentionPeriod||"7Y",complianceLevel:e.complianceLevel||"STANDARD"},dataStructure:{tokens:"Map<tokenId, registrationRecord>",revocations:"Map<tokenId, revocationRecord>",auditLog:"Array<auditEntry>",statistics:{totalTokens:0,activeTokens:0,revokedTokens:0,registrations:0}},externalStorage:{required:!0,type:"database_or_blockchain",endpoints:{store:"POST /registry/{id}/tokens",retrieve:"GET /registry/{id}/tokens/{tokenId}",search:"GET /registry/{id}/search",revoke:"POST /registry/{id}/revocations"}}},r=this._prepareAuditEntry({action:"REGISTRY_CREATED",actor:e.authority,timestamp:t.created,metadata:{jurisdiction:t.jurisdiction,config:t.config}});return{success:!0,registry:t,initialAudit:r,instructions:{step1:"Store registry configuration in external system",step2:"Initialize token storage with provided data structure",step3:"Set up audit logging with provided templates",step4:"Configure external endpoints for registry operations"}}},prepareTokenRegistration:function(e,t,r){r=r||{},yr.checkArgument(e&&typeof e=="object","Invalid token"),yr.checkArgument(t&&typeof t=="object","Invalid registry config");try{var i=this._validateTokenForRegistration(e,t);if(!i.valid)return{success:!1,error:"Token validation failed: "+i.error};var n={tokenId:e.id,tokenHash:this._hashToken(e),token:e,status:t.requireApproval?"PENDING":"ACTIVE",registeredBy:r.registeredBy||"UNKNOWN",registeredAt:new Date().toISOString(),approvedBy:null,approvedAt:null,metadata:r.metadata||{},compliance:{jurisdiction:e.jurisdiction||t.jurisdiction,level:this._calculateComplianceLevel(e),checks:i.checks||[]}},o=this._prepareAuditEntry({action:"TOKEN_REGISTERED",actor:r.registeredBy,tokenId:e.id,timestamp:n.registeredAt,metadata:{status:n.status,tokenType:e.type,compliance:n.compliance}});return{success:!0,registrationRecord:n,auditEntry:o,registrationId:this._generateRegistrationId(e.id),validation:i,externalOperations:{store:{endpoint:"POST /registry/"+t.id+"/tokens",data:n},audit:{endpoint:"POST /registry/"+t.id+"/audit",data:o}}}}catch(s){return{success:!1,error:s.message}}},prepareTokenApproval:function(e,t,r){try{yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(typeof t=="string","Approver must be string"),yr.checkArgument(r&&typeof r=="object","Invalid registry config");var i={tokenId:e,status:"ACTIVE",approvedBy:t,approvedAt:new Date().toISOString()},n=this._prepareAuditEntry({action:"TOKEN_APPROVED",actor:t,tokenId:e,timestamp:i.approvedAt});return{success:!0,approvalData:i,auditEntry:n,externalOperations:{update:{endpoint:"PUT /registry/"+r.id+"/tokens/"+e+"/status",data:i},audit:{endpoint:"POST /registry/"+r.id+"/audit",data:n}}}}catch(o){return{success:!1,error:o.message}}},prepareTokenRevocation:function(e,t,r){try{if(yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(t&&typeof t=="object","Invalid revocation"),yr.checkArgument(r&&typeof r=="object","Invalid registry config"),!r.enableRevocation)return{success:!1,error:"Revocation is disabled for this registry"};var i={tokenId:e,reason:t.reason||"UNSPECIFIED",revokedBy:t.revokedBy||"UNKNOWN",revokedAt:new Date().toISOString(),effectiveDate:t.effectiveDate||new Date().toISOString(),legalBasis:t.legalBasis||null,evidence:t.evidence||null,revocationHash:this._generateRevocationHash(e,t)},n={tokenId:e,status:"REVOKED",revokedAt:i.revokedAt,revocationReason:i.reason},o=this._prepareAuditEntry({action:"TOKEN_REVOKED",actor:t.revokedBy,tokenId:e,timestamp:i.revokedAt,metadata:{reason:i.reason,legalBasis:i.legalBasis}});return{success:!0,revocationRecord:i,statusUpdate:n,auditEntry:o,revocationId:this._generateRevocationId(e),externalOperations:{storeRevocation:{endpoint:"POST /registry/"+r.id+"/revocations",data:i},updateStatus:{endpoint:"PUT /registry/"+r.id+"/tokens/"+e+"/status",data:n},audit:{endpoint:"POST /registry/"+r.id+"/audit",data:o}}}}catch(s){return{success:!1,error:s.message}}},prepareTokenStatusQuery:function(e,t){try{return yr.checkArgument(typeof e=="string","Token ID must be string"),yr.checkArgument(t&&typeof t=="object","Invalid registry config"),{success:!0,query:{tokenId:e,registryId:t.id},externalOperations:{retrieve:{endpoint:"GET /registry/"+t.id+"/tokens/"+e,method:"GET"},checkRevocation:{endpoint:"GET /registry/"+t.id+"/revocations/"+e,method:"GET"}},expectedResponse:{found:"boolean",status:"string (PENDING|ACTIVE|REVOKED)",registeredAt:"ISO datetime",registeredBy:"string",approvedAt:"ISO datetime or null",approvedBy:"string or null",revokedAt:"ISO datetime or null",revocationReason:"string or null",compliance:"object",revocation:"object or null"}}}catch(r){return{success:!1,error:r.message}}},prepareTokenSearch:function(e,t){e=e||{};try{yr.checkArgument(t&&typeof t=="object","Invalid registry config");var r=[];e.status&&r.push("status="+encodeURIComponent(e.status)),e.type&&r.push("type="+encodeURIComponent(e.type)),e.registeredBy&&r.push("registeredBy="+encodeURIComponent(e.registeredBy)),e.jurisdiction&&r.push("jurisdiction="+encodeURIComponent(e.jurisdiction)),e.dateFrom&&r.push("dateFrom="+encodeURIComponent(e.dateFrom)),e.dateTo&&r.push("dateTo="+encodeURIComponent(e.dateTo)),e.includeTokens&&r.push("includeTokens=true"),e.sortBy&&r.push("sortBy="+encodeURIComponent(e.sortBy)),e.sortOrder&&r.push("sortOrder="+encodeURIComponent(e.sortOrder));var i=e.offset||0,n=e.limit||100;r.push("offset="+i),r.push("limit="+n);var o=r.length>0?"?"+r.join("&"):"";return{success:!0,searchCriteria:e,externalOperations:{search:{endpoint:"GET /registry/"+t.id+"/search"+o,method:"GET"}},expectedResponse:{success:"boolean",results:"Array<tokenRecord>",totalCount:"number",totalRegistrations:"number",offset:"number",limit:"number",hasMore:"boolean"}}}catch(s){return{success:!1,error:s.message}}},prepareStatisticsQuery:function(e){return yr.checkArgument(e&&typeof e=="object","Invalid registry config"),{success:!0,query:{registryId:e.id},externalOperations:{getStatistics:{endpoint:"GET /registry/"+e.id+"/statistics",method:"GET"}},expectedResponse:{id:"string",name:"string",jurisdiction:"string",created:"ISO datetime",statistics:{totalTokens:"number",activeTokens:"number",revokedTokens:"number",registrations:"number"},auditEntries:"number",lastActivity:"ISO datetime"}}},prepareAuditLogQuery:function(e,t){if(t=t||{},yr.checkArgument(e&&typeof e=="object","Invalid registry config"),!e.enableAuditTrail)return{success:!1,error:"Audit trail is disabled"};var r=[];t.action&&r.push("action="+encodeURIComponent(t.action)),t.actor&&r.push("actor="+encodeURIComponent(t.actor)),t.tokenId&&r.push("tokenId="+encodeURIComponent(t.tokenId)),t.dateFrom&&r.push("dateFrom="+encodeURIComponent(t.dateFrom)),t.dateTo&&r.push("dateTo="+encodeURIComponent(t.dateTo));var i=t.offset||0,n=t.limit||100;r.push("offset="+i),r.push("limit="+n);var o=r.length>0?"?"+r.join("&"):"";return{success:!0,auditOptions:t,externalOperations:{getAuditLog:{endpoint:"GET /registry/"+e.id+"/audit"+o,method:"GET"}},expectedResponse:{success:"boolean",entries:"Array<auditEntry>",totalEntries:"number",offset:"number",limit:"number",hasMore:"boolean"}}},_generateRegistryId:function(){return"reg_"+iR.randomHex(16)},_generateRegistrationId:function(e){var t="reg_"+e+"_"+Date.now();return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_generateRevocationId:function(e){var t="rev_"+e+"_"+Date.now();return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)},_hashToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,Vu.sha256(_.Buffer.from(JSON.stringify(t))).toString("hex")},_generateRevocationHash:function(e,t){var r=e+(t.reason||"")+(t.revokedBy||"")+Date.now();return Vu.sha256(_.Buffer.from(r)).toString("hex")},_validateTokenForRegistration:function(e,t){var r=[],i=!0;return e.id?r.push({field:"id",valid:!0}):(r.push({field:"id",valid:!1,error:"Missing token ID"}),i=!1),e.type?r.push({field:"type",valid:!0}):(r.push({field:"type",valid:!1,error:"Missing token type"}),i=!1),e.issuanceDate?r.push({field:"issuanceDate",valid:!0}):(r.push({field:"issuanceDate",valid:!1,error:"Missing issuance date"}),i=!1),e.proof?r.push({field:"proof",valid:!0}):(r.push({field:"proof",valid:!1,error:"Missing cryptographic proof"}),i=!1),{valid:i,checks:r}},_calculateComplianceLevel:function(e){var t="BASIC";return e.proof&&e.proof.type&&(t="STANDARD"),e.jurisdiction&&e.legalBasis&&(t="ENHANCED"),e.attestations&&e.attestations.length>0&&(t="PREMIUM"),t},_prepareAuditEntry:function(e){var t={id:this._generateAuditId(),action:e.action,actor:e.actor||"SYSTEM",tokenId:e.tokenId||null,timestamp:e.timestamp||new Date().toISOString(),metadata:e.metadata||{},hash:this._generateAuditHash(e)};return t},_generateAuditId:function(){return"audit_"+iR.randomHex(32)},_generateAuditHash:function(e){var t=(e.action||"")+(e.actor||"")+(e.tokenId||"")+(e.timestamp||"");return Vu.sha256(_.Buffer.from(t)).toString("hex").substring(0,16)}};nR.exports=jF});var uR=B((rJ,fR)=>{"use strict";y();var zv=Gr(),Wv=ir(),sR=Pu(),HF=fr(),aR=ms(),Ar=at(),KF=Fu();function VF(e,t){if(t=t||{},t.issuerPublicKey)return t.issuerPublicKey instanceof zv?t.issuerPublicKey:zv.fromString(t.issuerPublicKey);var r=e&&e.issuer;if(typeof r!="string")return null;try{var i=r.split("#")[0].split(":")[2];return i?zv.fromString(i):null}catch{return null}}var Xl={CORRELATIVE_OBLIGATION:"CorrelativeObligation",CONTRACTUAL_OBLIGATION:"ContractualObligation",PAYMENT_OBLIGATION:"PaymentObligation",DELIVERY_OBLIGATION:"DeliveryObligation",PERFORMANCE_OBLIGATION:"PerformanceObligation",MAINTENANCE_OBLIGATION:"MaintenanceObligation",COMPLIANCE_OBLIGATION:"ComplianceObligation",REPORTING_OBLIGATION:"ReportingObligation",CONFIDENTIALITY_OBLIGATION:"ConfidentialityObligation",NON_COMPETE_OBLIGATION:"NonCompeteObligation",INDEMNIFICATION_OBLIGATION:"IndemnificationObligation",WARRANTY_OBLIGATION:"WarrantyObligation",SUPPORT_OBLIGATION:"SupportObligation",REGULATORY_OBLIGATION:"RegulatoryObligation",FIDUCIARY_OBLIGATION:"FiduciaryObligation"},Ha={CRITICAL:"CRITICAL",HIGH:"HIGH",MEDIUM:"MEDIUM",LOW:"LOW",DEFERRED:"DEFERRED"},mr={PENDING:"PENDING",ACTIVE:"ACTIVE",IN_PROGRESS:"IN_PROGRESS",COMPLETED:"COMPLETED",OVERDUE:"OVERDUE",BREACHED:"BREACHED",WAIVED:"WAIVED",TERMINATED:"TERMINATED"},Jl={prepareObligationToken:function(e,t,r,i,n,o){o=o||{},Ar.checkArgument(typeof e=="string","Obligation type must be string"),Ar.checkArgument(typeof t=="string","Issuer DID must be string"),Ar.checkArgument(typeof r=="string","Obligor DID must be string"),Ar.checkArgument(i&&typeof i=="object","Obligation must be object"),Ar.checkArgument(n instanceof aR,"Invalid issuer private key");var s=Object.values(Xl);Ar.checkArgument(s.includes(e),"Invalid obligation type: "+e);try{var f={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","LegalObligationToken",e],issuer:t,issuanceDate:new Date().toISOString(),credentialSubject:{id:r,obligationType:e,obligation:i,jurisdiction:o.jurisdiction||"US",priority:o.priority||Ha.MEDIUM,status:mr.PENDING,dueDate:o.dueDate||null,effectiveDate:o.effectiveDate||new Date().toISOString(),expirationDate:o.expirationDate||null,correlativeRight:o.correlativeRight||null,rightHolder:o.rightHolder||null,enforceable:o.enforceable!==!1,penalties:o.penalties||null,remedies:o.remedies||null}};o.metadata&&(f.credentialSubject.metadata=o.metadata);var h=this._signToken(f,n);return{success:!0,obligationToken:h,tokenHash:h.tokenHash,metadata:{type:e,issuer:t,obligor:r,priority:f.credentialSubject.priority,status:f.credentialSubject.status,jurisdiction:f.credentialSubject.jurisdiction,dueDate:f.credentialSubject.dueDate,correlativeRight:f.credentialSubject.correlativeRight},externalOperations:{storeToken:{endpoint:"POST /obligations/tokens",data:{token:h,metadata:{type:e,issuer:t,obligor:r,priority:f.credentialSubject.priority,status:f.credentialSubject.status,jurisdiction:f.credentialSubject.jurisdiction,dueDate:f.credentialSubject.dueDate,correlativeRight:f.credentialSubject.correlativeRight}}},indexToken:{endpoint:"POST /obligations/index",data:{tokenId:h.id,tokenHash:h.tokenHash,type:e,issuer:t,obligor:r,issuedAt:h.issuanceDate,dueDate:f.credentialSubject.dueDate,priority:f.credentialSubject.priority}},notifyObligor:{endpoint:"POST /notifications/obligation-issued",data:{tokenId:h.id,issuer:t,obligor:r,obligationType:e,dueDate:f.credentialSubject.dueDate,priority:f.credentialSubject.priority}},scheduleReminders:f.credentialSubject.dueDate?{endpoint:"POST /obligations/schedule-reminders",data:{tokenId:h.id,obligor:r,dueDate:f.credentialSubject.dueDate,reminderSchedule:o.reminderSchedule||["7d","3d","1d"]}}:null}}}catch(m){return{success:!1,error:m.message}}},prepareObligationVerification:function(e,t){t=t||{};try{var r=[],i=[];this._validateTokenStructure(e,r),this._verifyTokenSignature(e,r,t),this._validateTokenTemporal(e,r,i),this._validateObligationType(e,r),this._validateObligationStatus(e,r,i),this._validateObligationPriority(e,i);var n={valid:r.length===0,errors:r,warnings:i,issuerDID:e.issuer,obligorDID:e.credentialSubject?e.credentialSubject.id:null,obligationType:e.credentialSubject?e.credentialSubject.obligationType:null,status:e.credentialSubject?e.credentialSubject.status:null,priority:e.credentialSubject?e.credentialSubject.priority:null,isOverdue:this._checkIfOverdue(e),verifiedAt:new Date().toISOString()};return{success:!0,verification:n,externalOperations:{recordVerification:{endpoint:"POST /obligations/verification-record",data:{tokenId:e.id,result:n.valid,errors:r,warnings:i,verifiedAt:n.verifiedAt,isOverdue:n.isOverdue}},auditVerification:{endpoint:"POST /audit/obligation-verification",data:{tokenId:e.id,obligationType:n.obligationType,issuer:n.issuerDID,obligor:n.obligorDID,result:n.valid,verifiedAt:n.verifiedAt}},updateStatus:n.isOverdue&&e.credentialSubject.status===mr.ACTIVE?{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:mr.OVERDUE,updatedAt:n.verifiedAt,reason:"Due date passed"}}:null}}}catch(o){return{success:!1,error:"Verification preparation failed: "+o.message}}},prepareObligationFulfillment:function(e,t,r,i){i=i||{},Ar.checkArgument(e&&typeof e=="object","Invalid token"),Ar.checkArgument(t&&typeof t=="object","Invalid fulfillment"),Ar.checkArgument(r instanceof aR,"Invalid obligor key");try{var n=this.prepareObligationVerification(e,{});if(!n.success||!n.verification.valid)return{success:!1,error:"Cannot fulfill invalid obligation: "+n.verification.errors.join(", ")};if(e.credentialSubject.status===mr.COMPLETED)return{success:!1,error:"Obligation already fulfilled"};if(e.credentialSubject.status===mr.TERMINATED)return{success:!1,error:"Obligation has been terminated"};var o={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","ObligationFulfillment"],issuer:e.credentialSubject.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:e.id,fulfillmentType:t.type||"FULL_FULFILLMENT",fulfillmentDate:new Date().toISOString(),evidence:t.evidence||null,description:t.description||"",completionPercentage:t.completionPercentage||100,attestations:t.attestations||[],notes:t.notes||null}},s=this._signToken(o,r),f=o.credentialSubject.completionPercentage>=100?mr.COMPLETED:mr.IN_PROGRESS;return{success:!0,fulfillmentRecord:s,newStatus:f,fulfillmentId:s.id,externalOperations:{recordFulfillment:{endpoint:"POST /obligations/fulfillments",data:{obligationId:e.id,fulfillmentRecord:s,obligor:e.credentialSubject.id,fulfillmentDate:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}},updateStatus:{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:f,fulfillmentId:s.id,updatedAt:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}},notifyRightHolder:e.credentialSubject.rightHolder?{endpoint:"POST /notifications/obligation-fulfilled",data:{obligationId:e.id,fulfillmentId:s.id,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,completionPercentage:o.credentialSubject.completionPercentage,newStatus:f}}:null,auditFulfillment:{endpoint:"POST /audit/obligation-fulfillment",data:{obligationId:e.id,fulfillmentId:s.id,obligor:e.credentialSubject.id,fulfilledAt:o.credentialSubject.fulfillmentDate,completionPercentage:o.credentialSubject.completionPercentage}}}}}catch(h){return{success:!1,error:h.message}}},prepareObligationBreachAssessment:function(e,t,r){Ar.checkArgument(e&&typeof e=="object","Invalid token"),Ar.checkArgument(t&&typeof t=="object","Invalid breach details"),Ar.checkArgument(r&&typeof r=="object","Invalid assessor");try{var i={"@context":["https://www.w3.org/2018/credentials/v1","https://smartledger.technology/contexts/ltp/v1"],id:"urn:uuid:"+this._generateUUID(),type:["VerifiableCredential","ObligationBreachAssessment"],issuer:r.did||r.id,issuanceDate:new Date().toISOString(),credentialSubject:{id:e.id,breachType:t.type||"MATERIAL_BREACH",breachDate:t.date||new Date().toISOString(),description:t.description||"",severity:t.severity||"MODERATE",evidence:t.evidence||[],assessor:{did:r.did||r.id,name:r.name||"Unknown",authority:r.authority||null,jurisdiction:r.jurisdiction||null},damages:t.damages||null,recommendedRemedies:t.recommendedRemedies||[],assessmentDate:new Date().toISOString()}},n=Wv.sha256(_.Buffer.from(JSON.stringify(i))).toString("hex");return i.credentialSubject.assessmentHash=n,{success:!0,breachAssessment:i,breachId:i.id,severity:t.severity||"MODERATE",externalOperations:{recordBreach:{endpoint:"POST /obligations/breaches",data:{obligationId:e.id,breachAssessment:i,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,breachDate:t.date||new Date().toISOString(),severity:t.severity||"MODERATE"}},updateStatus:{endpoint:"PUT /obligations/tokens/"+e.id+"/status",data:{status:mr.BREACHED,breachId:i.id,breachDate:t.date||new Date().toISOString(),updatedAt:new Date().toISOString()}},notifyParties:{endpoint:"POST /notifications/obligation-breached",data:{obligationId:e.id,breachId:i.id,obligor:e.credentialSubject.id,rightHolder:e.credentialSubject.rightHolder,breachType:t.type||"MATERIAL_BREACH",severity:t.severity||"MODERATE"}},escalateBreach:t.severity==="CRITICAL"?{endpoint:"POST /legal/escalate-breach",data:{obligationId:e.id,breachId:i.id,severity:t.severity,jurisdiction:e.credentialSubject.jurisdiction}}:null,auditBreach:{endpoint:"POST /audit/obligation-breach",data:{obligationId:e.id,breachId:i.id,obligor:e.credentialSubject.id,assessedAt:i.credentialSubject.assessmentDate,severity:t.severity||"MODERATE"}}}}}catch(o){return{success:!1,error:o.message}}},prepareObligationMonitoringReport:function(e,t){t=t||{},Ar.checkArgument(Array.isArray(e),"Obligations must be array");try{var r={reportId:"rpt_"+this._generateUUID(),generatedAt:new Date().toISOString(),criteria:t,summary:{totalObligations:e.length,byStatus:{},byPriority:{},byType:{},overdue:0,dueSoon:0,completed:0},obligations:[],alerts:[],recommendations:[]},i=new Date,n=new Date(i.getTime()+10080*60*1e3);return e.forEach(function(o){var s={id:o.id,type:o.credentialSubject.obligationType,status:o.credentialSubject.status,priority:o.credentialSubject.priority,obligor:o.credentialSubject.id,dueDate:o.credentialSubject.dueDate,isOverdue:this._checkIfOverdue(o),isDueSoon:!1};if(o.credentialSubject.dueDate){var f=new Date(o.credentialSubject.dueDate);s.isDueSoon=f<=n&&f>i}r.summary.byStatus[s.status]=(r.summary.byStatus[s.status]||0)+1,r.summary.byPriority[s.priority]=(r.summary.byPriority[s.priority]||0)+1,r.summary.byType[s.type]=(r.summary.byType[s.type]||0)+1,s.isOverdue&&r.summary.overdue++,s.isDueSoon&&r.summary.dueSoon++,s.status===mr.COMPLETED&&r.summary.completed++,s.isOverdue&&s.priority===Ha.CRITICAL&&r.alerts.push({type:"CRITICAL_OVERDUE",obligationId:o.id,message:"Critical obligation is overdue",priority:"HIGH"}),s.isDueSoon&&s.priority===Ha.HIGH&&r.alerts.push({type:"HIGH_PRIORITY_DUE_SOON",obligationId:o.id,message:"High priority obligation due soon",priority:"MEDIUM"}),r.obligations.push(s)}.bind(this)),r.summary.overdue>0&&r.recommendations.push({type:"OVERDUE_MANAGEMENT",message:"Consider prioritizing overdue obligations",count:r.summary.overdue}),r.summary.dueSoon>5&&r.recommendations.push({type:"WORKLOAD_MANAGEMENT",message:"High number of obligations due soon - consider workload distribution",count:r.summary.dueSoon}),{success:!0,report:r,externalOperations:{storeReport:{endpoint:"POST /obligations/monitoring-reports",data:{report:r,generatedAt:r.generatedAt}},sendAlerts:r.alerts.length>0?{endpoint:"POST /notifications/obligation-alerts",data:{reportId:r.reportId,alerts:r.alerts,summary:r.summary}}:null,updateDashboard:{endpoint:"PUT /dashboard/obligation-metrics",data:{summary:r.summary,lastUpdated:r.generatedAt}}}}}catch(o){return{success:!1,error:o.message}}},getObligationTypes:function(){return Xl},getObligationPriority:function(){return Ha},getObligationStatus:function(){return mr},_signToken:function(e,t){var r=this._canonicalizeToken(e),i=Wv.sha256(_.Buffer.from(r)),n=new sR;n.hashbuf=i,n.privkey=t,n.pubkey=t.toPublicKey(),n.sign();var o=n.sig,s={type:"EcdsaSecp256k1Signature2019",created:new Date().toISOString(),verificationMethod:"did:smartledger:"+t.toPublicKey().toString()+"#keys-1",proofPurpose:"assertionMethod",jws:this._createJWS(i,o)},f=JSON.parse(JSON.stringify(e));return f.proof=s,f.tokenHash=i.toString("hex"),f},_createJWS:function(e,t){var r={alg:"ES256K",typ:"JWT"},i=_.Buffer.from(JSON.stringify(r)).toString("base64url"),n=e.toString("base64url"),o=t.toDER().toString("base64url");return i+".."+o},_canonicalizeToken:function(e){var t=JSON.parse(JSON.stringify(e));return delete t.proof,delete t.tokenHash,JSON.stringify(this._sortObjectKeys(t))},_sortObjectKeys:function(e){if(Array.isArray(e))return e.map(this._sortObjectKeys.bind(this));if(e!==null&&typeof e=="object"){var t={};return Object.keys(e).sort().forEach(function(r){t[r]=this._sortObjectKeys(e[r])}.bind(this)),t}return e},_validateTokenStructure:function(e,t){e["@context"]||t.push("Missing @context"),e.id||t.push("Missing id"),(!e.type||!Array.isArray(e.type))&&t.push("Missing or invalid type"),e.issuer||t.push("Missing issuer"),e.issuanceDate||t.push("Missing issuanceDate"),e.credentialSubject||t.push("Missing credentialSubject"),e.proof||t.push("Missing proof")},_verifyTokenSignature:function(e,t,r){try{if(!e.proof||!e.proof.jws){t.push("Missing signature proof");return}var i=this._canonicalizeToken(e),n=Wv.sha256(_.Buffer.from(i));if(e.tokenHash&&e.tokenHash!==n.toString("hex")){t.push("Token hash mismatch");return}var o=VF(e,r);if(!o){t.push("Signature not verified: issuer public key could not be resolved from token.issuer; pass options.issuerPublicKey");return}var s=e.proof.jws.split(".");if(s.length!==3||!s[2]){t.push("Malformed JWS");return}var f=HF.fromDER(_.Buffer.from(s[2],"base64url")),h=new sR;h.hashbuf=n,h.sig=f,h.pubkey=o,h.verify()!==!0&&t.push("Signature verification failed")}catch(m){t.push("Signature verification failed: "+m.message)}},_validateTokenTemporal:function(e,t,r){var i=new Date,n=new Date(e.issuanceDate);if(n>i&&t.push("Token issued in the future"),e.credentialSubject.effectiveDate){var o=new Date(e.credentialSubject.effectiveDate);i<o&&r.push("Obligation not yet effective")}if(e.credentialSubject.expirationDate){var s=new Date(e.credentialSubject.expirationDate);i>s&&t.push("Obligation expired")}},_validateObligationType:function(e,t){if(!e.credentialSubject.obligationType){t.push("Missing obligationType");return}var r=Object.values(Xl);r.includes(e.credentialSubject.obligationType)||t.push("Invalid obligation type: "+e.credentialSubject.obligationType)},_validateObligationStatus:function(e,t,r){if(!e.credentialSubject.status){t.push("Missing status");return}var i=Object.values(mr);i.includes(e.credentialSubject.status)||t.push("Invalid obligation status: "+e.credentialSubject.status),this._checkIfOverdue(e)&&e.credentialSubject.status===mr.ACTIVE&&r.push("Obligation is overdue but status is still ACTIVE")},_validateObligationPriority:function(e,t){if(e.credentialSubject.priority){var r=Object.values(Ha);r.includes(e.credentialSubject.priority)||t.push("Invalid obligation priority: "+e.credentialSubject.priority)}},_checkIfOverdue:function(e){if(!e.credentialSubject.dueDate)return!1;var t=new Date,r=new Date(e.credentialSubject.dueDate);return t>r&&e.credentialSubject.status!==mr.COMPLETED},_generateUUID:function(){return KF.uuid4()}};Jl.ObligationTypes=Xl;Jl.ObligationPriority=Ha;Jl.ObligationStatus=mr;fR.exports=Jl});var hR=B((nJ,cR)=>{"use strict";y();var Es=Z3(),Ql=X3(),Gu=Q3(),Yv=rR(),zi=oR(),GF=uR(),Zv=ms(),Or=at(),tt=function(e){return this instanceof tt?(this.config=e||{},this.registry=null,this.config.registry&&(this.registry=zi.createRegistry(this.config.registry)),this):new tt(e)};tt.prototype.createRightToken=function(e,t,r){Or.checkArgument(e&&typeof e=="object","Invalid right data"),Or.checkArgument(t instanceof Zv,"Invalid private key"),r=r||{};try{var i=Es.create(e.type,e.owner,e.owner,e,t,r);if(!i)return{success:!1,error:"Failed to create token"};if(r.addProof!==!1&&(i=Es._signToken(i,t)),r.anchor){var n=Gu.anchorToken(i,r.anchor);n.success&&(i.anchorTx=n.txid,i.anchorBlock=n.blockHeight)}if(this.registry&&r.register!==!1){var o=zi.registerToken(this.registry,i,{registeredBy:r.registeredBy||"SYSTEM"});o.success&&(i.registrationId=o.registrationId,i.registrationStatus=o.status)}return{success:!0,token:i,type:"LegalRightToken"}}catch(s){return{success:!1,error:s.message}}};tt.prototype.validateClaim=function(e,t){return Ql.validate(e,t)};tt.prototype.createSelectiveDisclosure=function(e,t,r){return Yv.prepareSelectiveDisclosure(e,t,r)};tt.prototype.verifyToken=function(e,t){return!e||!e.proof?{valid:!1,error:"No proof found in token"}:Es.verifyToken(e,t)};tt.prototype.transferRight=function(e,t,r,i){Or.checkArgument(e&&typeof e=="object","Invalid token"),Or.checkArgument(typeof t=="string","New owner must be string"),Or.checkArgument(r instanceof Zv,"Invalid owner key"),i=i||{};try{var n=this.verifyToken(e,r.toPublicKey().toString());if(!n.valid)return{success:!1,error:"Invalid token or ownership proof"};var o=Es.prepareRightTokenTransfer(e,t,r,i);if(!o.success)return{success:!1,error:o.error};var s=o.newToken,f=o.transferProof;if(i.anchor){var h=Gu.anchorToken(s,i.anchor);h.success&&(s.transferAnchorTx=h.txid)}if(this.registry){var m=zi.registerToken(this.registry,s,{registeredBy:i.registeredBy||t,metadata:{transferFrom:e.owner,transferTo:t,originalTokenId:e.id}});m.success&&(s.registrationId=m.registrationId)}return{success:!0,token:s,transferId:f.id,transferredAt:f.issuanceDate,transferProof:f}}catch(S){return{success:!1,error:S.message}}};tt.prototype.createObligation=function(e,t,r){Or.checkArgument(e&&typeof e=="object","Invalid right token"),Or.checkArgument(t&&typeof t=="object","Invalid obligation data"),Or.checkArgument(r instanceof Zv,"Invalid private key");try{var i=Es.prepareObligationToken(e,t.obligor,t,r);return i.success?{success:!0,obligation:i.obligationToken,rightTokenId:e.id}:{success:!1,error:i.error}}catch(n){return{success:!1,error:n.message}}};tt.prototype.revokeToken=function(e,t,r){return Or.checkArgument(typeof e=="string","Token ID must be string"),Or.checkArgument(t&&typeof t=="object","Invalid revocation data"),Or.checkArgument(typeof r=="string","Authority must be string"),this.registry?zi.revokeToken(this.registry,e,{reason:t.reason,revokedBy:r,legalBasis:t.legalBasis,evidence:t.evidence}):{success:!1,error:"No registry available for revocation"}};tt.prototype.checkTokenStatus=function(e){return Or.checkArgument(typeof e=="string","Token ID must be string"),this.registry?zi.checkTokenStatus(this.registry,e):{found:!1,error:"No registry available"}};tt.prototype.searchTokens=function(e){return this.registry?zi.searchTokens(this.registry,e):{success:!1,error:"No registry available"}};tt.prototype.getRegistryStats=function(){return this.registry?zi.getStatistics(this.registry):{error:"No registry available"}};tt.prototype.createLegalValidityProof=function(e,t,r){return Yv.prepareLegalValidityProof(e,t,r)};tt.prototype.anchorTokenBatch=function(e,t){return Gu.anchorBatch(e,t)};tt.prototype.verifyAnchor=function(e,t){return Gu.verifyAnchor(e,t)};tt.prototype.getRightTypes=function(){return Es.getRightTypes()};tt.prototype.getClaimSchemas=function(){return Ql.getSchemas()};tt.prototype.createRegistry=function(e){return this.registry=zi.createRegistry(e),this.registry};tt.prototype.setRegistry=function(e){Or.checkArgument(e&&typeof e=="object","Invalid registry"),this.registry=e};tt.create=function(e){return new tt(e)};tt.createRightToken=function(e,t,r){var i=new tt;return i.createRightToken(e,t,r)};tt.validateClaim=function(e,t){return Ql.validate(e,t)};tt.verifyToken=function(e,t){var r=new tt;return r.verifyToken(e,t)};tt.createRegistry=function(e){return zi.createRegistry(e)};tt.Right=Es;tt.Claim=Ql;tt.Anchor=Gu;tt.Proof=Yv;tt.Registry=zi;tt.Obligation=GF;cR.exports=tt});var zF=B((sJ,lR)=>{y();lR.exports=hR()});return zF();})();
76
76
  if(typeof module!=="undefined"&&module.exports){module.exports=bsvLTP}else if(typeof define==="function"&&define.amd){define([],function(){return bsvLTP})}