PageSourceSearch

https://xtz.news/assets/taquito.es6-D4B0w67H.js

js xtz.news collected 2026-09-25 18:56:31 UTC 966,523 bytes, 35 lines download raw bytes

1import{p as ke,g as Q0,c as ft,a as f_}from"./index-BRtgLFmh.js";var Se;(function(t){t[t.NO_PREFIX_MATCHED=0]="NO_PREFIX_MATCHED",t[t.INVALID_CHECKSUM=1]="INVALID_CHECKSUM",t[t.INVALID_LENGTH=2]="INVALID_LENGTH",t[t.VALID=3]="VALID",t[t.PREFIX_NOT_ALLOWED=4]="PREFIX_NOT_ALLOWED",t[t.INVALID_ENCODING=5]="INVALID_ENCODING",t[t.OTHER=6]="OTHER"})(Se||(Se={}));const Op={[Se.NO_PREFIX_MATCHED]:"unsupported Base58 prefix",[Se.INVALID_CHECKSUM]:"invalid checksum",[Se.INVALID_LENGTH]:"invalid length",[Se.PREFIX_NOT_ALLOWED]:"Base58 prefix not allowed in this context",[Se.INVALID_ENCODING]:"invalid Base58 encoding"};class pt extends Error{}class Ce extends pt{constructor(e,r,n){let a,i,s;e!==void 0&&(typeof e=="string"?(s=e,r!==void 0&&(typeof r=="string"?a=r:(i=r,n!==void 0?a=n:a=Op[r]))):(i=e,a=Op[e],s=a)),super(s),this.name=this.constructor.name,this.result=i,this.errorDetail=a}}class df extends pt{}class ed extends pt{}class Pv extends pt{}class Ds extends pt{}class aI extends pt{}class st extends Ce{constructor(e,r){super(`Invalid address "${e}"`,r),this.address=e,this.name=this.constructor.name}}class vi extends Ce{constructor(e,r){super(`Invalid proof "${e}"`,r),this.proof=e,this.name=this.constructor.name}}class Ka extends Ce{constructor(e,r){super(`Invalid staking address "${e}", you can only set destination as your own address`,r),this.address=e,this.name=this.constructor.name}}class Mv extends Ce{constructor(e,r){super("The amount can only be 0 when finalizing an unstake",r),this.address=e,this.name=this.constructor.name}}class c_ extends Ce{constructor(e,r){super(`Invalid block hash "${e}"`,r),this.blockHash=e,this.name=this.constructor.name}}class kn extends Ce{constructor(e,r){super(`Invalid amount "${e}"`,r),this.amount=e,this.name=this.constructor.name}}class Es extends Ce{constructor(e,r){super(`Invalid hex string "${e}"`,r),this.hexString=e,this.name=this.constructor.name}}class u_ extends Ce{constructor(e,r){super(`Invalid message "${e}"`,r),this.msg=e,this.name=this.constructor.name}}class Ov extends Ce{constructor(e,r,n,a,i){const s=`Invalid view arguments ${JSON.stringify(n)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(r)}.`;super(s,i),this.viewName=e,this.sigs=r,this.args=n,this.cause=a,this.name=this.constructor.name}}class h_ extends Ce{constructor(e){super("Invalid private key",e),this.name=this.constructor.name}}class Hs extends Ce{constructor(e,r){const n=e!==void 0?`Invalid public key "${e}"`:"Invalid public key";super(n,r),this.publicKey=e,this.name=this.constructor.name}}class l_ extends Ce{constructor(e,r){super(`Invalid signature "${e}"`,r),this.signature=e,this.name=this.constructor.name}}class ha extends Ce{constructor(e,r){super(`Invalid contract address "${e}"`,r),this.contractAddress=e,this.name=this.constructor.name}}class d_ extends Ce{constructor(e,r){super(`Invalid chain id "${e}"`,r),this.chainId=e,this.name=this.constructor.name}}class td extends Ce{constructor(e,r){super(`Invalid public key hash "${e}"`,r),this.keyHash=e,this.name=this.constructor.name}}class Lv extends Ce{constructor(e,r){super(`Invalid operation hash "${e}"`,r),this.operationHash=e,this.name=this.constructor.name}}class wi extends Ce{constructor(e,r){super(`Invalid operation kind "${e}"`,r),this.operationKind=e,this.name=this.constructor.name}}class Nv extends Pv{constructor(e){super(e),this.name=this.constructor.name}}class sr extends Pv{constructor(e){super(e),this.name=this.constructor.name}}class tc extends pt{constructor(e,r){super(`Public key not found of this address "${e}" in either wallet or contract API.`),this.pkh=e,this.cause=r,this.name=this.constructor.name}}var p_={};const g_=10;function b_(t){let e=t,r=0;for(;!(r>=g_);){const n=e.cause;if(n instanceof Error){e=n,r++;continue}if(typeof n=="object"&&n!==null&&typeof n.message=="string"){const a=n;e={message:a.message,code:typeof a.code=="string"?a.code:void 0};break}break}return e}class m_ extends Ds{constructor(e,r,n,a){super(),this.method=e,this.url=r,this.cause=n,this.name="HttpRequestFailed";const i=b_(n),s=i.code,o=i!==n?`${i.message}${s?` [${s}]`:""}`:n.message,c=a?` (${a.kind})`:"";this.message=`${e} ${r}${c}: ${o}`,this.transportError=a}}class qn extends Ds{constructor(e,r,n,a,i){super(),this.message=e,this.status=r,this.statusText=n,this.body=a,this.url=i,this.name="HttpResponseError"}}class y_ extends Ds{constructor(e,r){super(),this.timeout=e,this.url=r,this.name="HttpTimeoutError",this.message=`HTTP request timeout of ${e}ms exceeded`}}const v_={abort:!1,dns:!1,connect:!1,socket:!0,tls:!1,timeout:!0,network:!0};function kv(t){if(typeof t!="object"||t===null)return;const e=t.code;return typeof e=="string"?e:void 0}function Cv(t){if(!(typeof t!="object"||t===null))return t.cause}function w_(t){return kv(Cv(t))}function __(t){const e=Cv(t);if(typeof e=="object"&&e!==null){const r=e.message;if(typeof r=="string")return r.toLowerCase()}return""}function hn(t,e){return{kind:t,mayHaveReachedServer:v_[t],original:e}}function E_(t){if(!(t instanceof Error))return;const e=kv(t),r=w_(t),n=t.message.toLowerCase(),a=__(t);if(t.name==="AbortError")return hn("abort",t);if(e==="ENOTFOUND"||e==="EAI_AGAIN"||r==="ENOTFOUND"||r==="EAI_AGAIN"||n.includes("enotfound")||n.includes("eai_again"))return hn("dns",t);if(e==="ECONNREFUSED"||r==="ECONNREFUSED"||r==="UND_ERR_CONNECT_TIMEOUT"||n.includes("econnrefused"))return hn("connect",t);if(n.includes("certificate")||n.includes("self signed")||n.includes("ssl")||n.includes("handshake")||a.includes("certificate")||a.includes("self signed")||a.includes("ssl")||a.includes("handshake"))return hn("tls",t);if(e==="ETIMEDOUT"||r==="ETIMEDOUT"||r==="UND_ERR_HEADERS_TIMEOUT"||r==="UND_ERR_BODY_TIMEOUT"||n.includes("etimedout")||n.includes("timed out"))return hn("timeout",t);if(e==="ECONNRESET"||r==="ECONNRESET"||r==="UND_ERR_SOCKET"||n.includes("econnreset")||n.includes("socket hang up")||n.includes("other side closed")||n.includes("closed unexpectedly")||n.includes("connection reset"))return hn("socket",t);if(t instanceof TypeError&&(n.includes("fetch failed")||n.includes("failed to fetch")||n.includes("network error")||n.includes("error sending request")||n==="terminated"))return hn("network",t);if(t.name==="FetchError"){const i=t.type;return i==="request-timeout"||i==="body-timeout"?hn("timeout",t):i==="system"?hn("network",t):void 0}}var Ga;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.ALREADY_REPORTED=208]="ALREADY_REPORTED",t[t.IM_USED=226]="IM_USED",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PE
1RMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.SWITCH_PROXY=306]="SWITCH_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.URI_TOO_LONG=414]="URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.LOOP_DETECTED=508]="LOOP_DETECTED",t[t.NOT_EXTENDED=510]="NOT_EXTENDED",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Ga||(Ga={}));if(typeof globalThis.fetch!="function")throw new Error("No fetch implementation available. Requires Node.js >= 22 or a browser environment.");const $o=typeof ke<"u"?p_:void 0,S_=/^(1|true)$/i.test($o?.TAQUITO_HTTP_TRACE??"")||$o?.RUNNER_DEBUG==="1",rc=Number($o?.TAQUITO_HTTP_RETRY_COUNT??"1"),nc=Number.isFinite(rc)&&rc>=0?Math.floor(rc):1,ic=Number($o?.TAQUITO_HTTP_RETRY_BASE_MS??"100"),Lp=Number.isFinite(ic)&&ic>=0?ic:100,Ji=t=>{try{const e=new URL(t);return`${e.origin}${e.pathname}`}catch{return t.split("?")[0]}},Aa=t=>{S_&&console.log(`[taquito:http-trace] ${JSON.stringify(t)}`)},Np=t=>t.cause,x_=t=>{const e=t.code;return typeof e=="string"?e:void 0},A_=10,kp=t=>{if(!(t instanceof Error))return String(t);const e=[`${t.name}: ${t.message}`];let r=Np(t),n=0;for(;n<A_;){if(r instanceof Error){const a=x_(r),i=a?` [${a}]`:"";e.push(`${r.name}: ${r.message}${i}`),r=Np(r),n++;continue}if(typeof r=="object"&&r!==null&&typeof r.message=="string"){const a=r,i=typeof a.code=="string"?a.code:void 0,s=i?` [${i}]`:"";e.push(`${a.message}${s}`)}break}return e.join(" → ")},R_=(t,e)=>{const r=t.toUpperCase();if(r==="GET")return!0;if(r!=="POST")return!1;const n=Ji(e);return n.endsWith("/helpers/forge/operations")||n.endsWith("/helpers/preapply/operations")||n.endsWith("/helpers/scripts/simulate_operation")||n.endsWith("/helpers/scripts/run_operation")||n.endsWith("/injection/operation")},I_=t=>new Promise(e=>setTimeout(e,t));class B_{constructor(e=3e4){this.timeout=e}serialize(e){if(!e)return"";const r=[];for(const a in e)if(e.hasOwnProperty(a)&&typeof e[a]<"u"){const i=e[a];if(i===null){r.push(encodeURIComponent(a));continue}const s=typeof i.toJSON=="function"?i.toJSON():i;if(s===null){r.push(encodeURIComponent(a));continue}if(Array.isArray(s)){s.forEach(o=>{r.push(encodeURIComponent(a)+"="+encodeURIComponent(o))});continue}r.push(encodeURIComponent(a)+"="+encodeURIComponent(s))}const n=r.join("&");return n?`?${n}`:""}async createRequest({url:e,method:r,timeout:n=this.timeout,query:a,headers:i={},json:s=!0},o){const c=e+this.serialize(a),u=String(r??"GET");i["Content-Type"]||(i["Content-Type"]="application/json");let f,l=!1;for(let p=0;p<=nc;p++){const b=new AbortController,v=setTimeout(()=>b.abort(),n),w=Date.now();try{l||(f=JSON.stringify(o),l=!0);const I=await globalThis.fetch(c,{method:r,headers:i,body:f,signal:b.signal});if(typeof I>"u")throw new Error("Response is undefined");if(I.status>=400){const S=await I.text();throw Aa({stage:"response-error",method:u,url:Ji(c),status:I.status,elapsedMs:Date.now()-w}),new qn(`Http error response: (${I.status}) ${S}`,I.status,I.statusText,S,c)}return Aa({stage:"response-ok",method:u,url:Ji(c),status:I.status,elapsedMs:Date.now()-w}),s?I.json():I.text()}
1catch(I){if(I instanceof qn)throw Aa({stage:"http-response-error",method:u,url:Ji(c),elapsedMs:Date.now()-w,status:I.status}),I;const S=I instanceof Error?E_(I):void 0,T=S!==void 0&&S.kind!=="abort"&&S.kind!=="tls";if(p<nc&&R_(u,c)&&T){const k=Lp*Math.pow(2,p),$=Math.floor(Math.random()*Lp),G=k+$;Aa({stage:"request-retry",method:u,url:Ji(c),elapsedMs:Date.now()-w,attempt:p+1,maxAttempts:nc+1,retryDelayMs:G,error:kp(I),transportKind:S?.kind}),await I_(G);continue}if(S?.kind==="abort")throw Aa({stage:"timeout",method:u,url:Ji(c),elapsedMs:Date.now()-w,timeoutMs:n}),new y_(n,c);{Aa({stage:"request-failed",method:u,url:Ji(c),elapsedMs:Date.now()-w,error:kp(I),transportKind:S?.kind});const k=I instanceof Error?I:new Error(String(I));throw new m_(u,c,k,S)}}finally{clearTimeout(v)}}throw new Error("Unexpected request retry flow")}}var tt=Uv(),T_=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ac=Math.ceil,Dr=Math.floor,ur="[BigNumber Error] ",kr=1e14,Qe=14,Cp=9007199254740991,sc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Gn=1e7,Wt=1e9;function Uv(t){var e,r,n,a=S.prototype={constructor:S,toString:null,valueOf:null},i=new S(1),s=20,o=4,c=-7,u=21,f=-1e7,l=1e7,p=!1,b=1,v=0,w={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz";function S(M,N){var P,x,d,m,h,g,y,_,R=this;if(!(R instanceof S))return new S(M,N);if(_=typeof M,N==null){if(C(M)){R.s=M.s,!M.c||M.e>l?R.c=R.e=null:M.e<f?R.c=[R.e=0]:(R.e=M.e,R.c=M.c.slice());return}if(_=="number"){if(M*0!=0){R.s=isNaN(M)?null:M<0?-1:1,R.c=R.e=null;return}if(R.s=1/M<0?(M=-M,-1):1,M===~~M){for(m=0,h=M;h>=10;h/=10,m++);m>l?R.c=R.e=null:(R.e=m,R.c=[M]);return}y=String(M)}else{if(_=="string"){if(y=M,!T_.test(y))return n(R,y)}else if(_=="bigint")y=String(M);else throw Error(ur+"Invalid argument: "+M);R.s=y.charCodeAt(0)==45?(y=y.slice(1),-1):1}(m=y.indexOf("."))>-1&&(y=y.replace(".","")),(h=y.search(/e/i))>0?(m<0&&(m=h),m+=+y.slice(h+1),y=y.substring(0,h)):m<0&&(m=y.length)}else{if(_!="string")throw Error(ur+"String expected: "+M);for(Ot(N,2,I.length,"Base"),y=M,R.s=y.charCodeAt(0)===45?(y=y.slice(1),-1):1,P=I.slice(0,N),m=h=0,g=y.length;h<g;h++)if(P.indexOf(x=y.charAt(h))<0){if(x=="."){if(h>m){m=g;continue}}else if(!d&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){d=!0,h=-1,m=0;continue}return n(R,M,N)}y=r(y,N,10,R.s),(m=y.indexOf("."))>-1?y=y.replace(".",""):m=y.length}for(h=0;y.charCodeAt(h)===48;h++);for(g=y.length;y.charCodeAt(--g)===48;);if(y=y.slice(h,++g))if(g-=h,m=m-h-1,m>l)R.c=R.e=null;else if(m<f)R.c=[R.e=0];else{if(R.e=m,R.c=[],h=(m+1)%Qe,m<0&&(h+=Qe),h<g){for(h&&R.c.push(+y.slice(0,h)),g-=Qe;h<g;)R.c.push(+y.slice(h,h+=Qe));h=Qe-(y=y.slice(h)).length}else h-=g;for(;h--;y+="0");R.c.push(+y)}else R.c=[R.e=0]}S.clone=Uv,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(M){var N,P;if(M!=null)if(typeof M=="object"){if(M.hasOwnProperty(N="DECIMAL_PLACES")&&(P=M[N],Ot(P,0,Wt,N),s=P),M.hasOwnProperty(N="ROUNDING_MODE")&&(P=M[N],Ot(P,0,8,N),o=P),M.hasOwnProperty(N="EXPONENTIAL_AT")&&(P=M[N],P&&P.pop?(Ot(P[0],-Wt,0,N),Ot(P[1],0,Wt,N),c=P[0],u=P[1]):(Ot(P,-Wt,Wt,N),c=-(u=P<0?-P:P))),M.hasOwnProperty(N="RANGE"))if(P=M[N],P&&P.pop)Ot(P[0],-Wt,-1,N),Ot(P[1],1,Wt,N),f=P[0],l=P[1];else if(Ot(P,-Wt,Wt,N),P)f=-(l=P<0?-P:P);else throw Error(ur+N+" cannot be zero: "+P);if(M.hasOwnProperty(N="CRYPTO"))if(P=M[N],P===!!P)if(P)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))p=P;else throw p=!P,Error(ur+"crypto unavailable");else p=P;else throw Error(ur+N+" not true or false: "+P);if(M.hasOwnProperty(N="MODULO_MODE")&&(P=M[N],Ot(P,0,9,N),b=P),M.hasOwnProperty(N="POW_PRECISION")&&(P=M[N],Ot(P,0,Wt,N),v=P),M.hasOwnProperty(N="FORMAT"))if(P=M[N],typeof P=="object")w=P;else throw Error(ur+N+" not an object: "+P);if(M.hasOwnProperty(N="ALPHABET"))if(P=M[N],typeof P=="string"&&!/^.?$|[+\-.\
vendor: 6,571 bytes, line 1
1s]|(.).*\1/.test(P))I=P;else throw Error(ur+N+" invalid: "+P)}else throw Error(ur+"Object expected: "+M);return{DECIMAL_PLACES:s,ROUNDING_MODE:o,EXPONENTIAL_AT:[c,u],RANGE:[f,l],CRYPTO:p,MODULO_MODE:b,POW_PRECISION:v,FORMAT:w,ALPHABET:I}},S.isBigNumber=function(M){if(!C(M))return!1;var N,P,x=M.c,d=M.e,m=M.s;if({}.toString.call(x)!="[object Array]")return x===null&&d===null&&(m===null||m===1||m===-1);if(m!==1&&m!==-1||d<-Wt||d>Wt||d!==Dr(d))return!1;if(x[0]===0)return d===0&&x.length===1;if(N=(d+1)%Qe,N<1&&(N+=Qe),String(x[0]).length!==N)return!1;for(N=0;N<x.length;N++)if(P=x[N],P<0||P>=kr||P!==Dr(P))return!1;return P!==0},S.maximum=S.max=function(){return k(arguments,-1)},S.minimum=S.min=function(){return k(arguments,1)},S.random=(function(){var M=9007199254740992,N=Math.random()*M&2097151?function(){return Dr(Math.random()*M)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(P){var x,d,m,h,g,y=0,_=[],R=new S(i);if(P==null?P=s:Ot(P,0,Wt),h=ac(P/Qe),p)if(crypto.getRandomValues){for(x=crypto.getRandomValues(new Uint32Array(h*=2));y<h;)g=x[y]*131072+(x[y+1]>>>11),g>=9e15?(d=crypto.getRandomValues(new Uint32Array(2)),x[y]=d[0],x[y+1]=d[1]):(_.push(g%1e14),y+=2);y=h/2}else if(crypto.randomBytes){for(x=crypto.randomBytes(h*=7);y<h;)g=(x[y]&31)*281474976710656+x[y+1]*1099511627776+x[y+2]*4294967296+x[y+3]*16777216+(x[y+4]<<16)+(x[y+5]<<8)+x[y+6],g>=9e15?crypto.randomBytes(7).copy(x,y):(_.push(g%1e14),y+=7);y=h/7}else throw p=!1,Error(ur+"crypto unavailable");if(!p)for(;y<h;)g=N(),g<9e15&&(_[y++]=g%1e14);for(h=_[--y],P%=Qe,h&&P&&(g=sc[Qe-P],_[y]=Dr(h/g)*g);_[y]===0;_.pop(),y--);if(y<0)_=[m=0];else{for(m=-1;_[0]===0;_.splice(0,1),m-=Qe);for(y=1,g=_[0];g>=10;g/=10,y++);y<Qe&&(m-=Qe-y)}return R.e=m,R.c=_,R}})(),S.sum=function(){for(var M=1,N=arguments,P=new S(N[0]);M<N.length;)P=P.plus(N[M++]);return P},r=(function(){var M="0123456789";function N(P,x,d,m){for(var h,g=[0],y,_=0,R=P.length;_<R;){for(y=g.length;y--;g[y]*=x);for(g[0]+=m.indexOf(P.charAt(_++)),h=0;h<g.length;h++)g[h]>d-1&&(g[h+1]==null&&(g[h+1]=0),g[h+1]+=g[h]/d|0,g[h]%=d)}return g.reverse()}return function(P,x,d,m,h){var g,y,_,R,A,E,L,O,U=P.indexOf("."),X=s,J=o;for(U>=0&&(R=v,v=0,P=P.replace(".",""),O=new S(x),E=O.pow(P.length-U),v=R,O.c=N(jn(Cr(E.c),E.e,"0"),10,d,M),O.e=O.c.length),L=N(P,x,d,h?(g=I,M):(g=M,I)),_=R=L.length;L[--R]==0;L.pop());if(!L[0])return g.charAt(0);if(U<0?--_:(E.c=L,E.e=_,E.s=m,E=e(E,O,X,J,d),L=E.c,A=E.r,_=E.e),y=_+X+1,U=L[y],R=d/2,A=A||y<0||L[y+1]!=null,A=J<4?(U!=null||A)&&(J==0||J==(E.s<0?3:2)):U>R||U==R&&(J==4||A||J==6&&L[y-1]&1||J==(E.s<0?8:7)),y<1||!L[0])P=A?jn(g.charAt(1),-X,g.charAt(0)):g.charAt(0);else{if(L.length=y,A)for(--d;++L[--y]>d;)L[y]=0,y||(++_,L=[1].concat(L));for(R=L.length;!L[--R];);for(U=0,P="";U<=R;P+=g.charAt(L[U++]));P=jn(P,_,g.charAt(0))}return P}})(),e=(function(){function M(x,d,m){var h,g,y,_,R=0,A=x.length,E=d%Gn,L=d/Gn|0;for(x=x.slice();A--;)y=x[A]%Gn,_=x[A]/Gn|0,h=L*y+_*E,g=E*y+h%Gn*Gn+R,R=(g/m|0)+(h/Gn|0)+L*_,x[A]=g%m;return R&&(x=[R].concat(x)),x}function N(x,d,m,h){var g,y;if(m!=h)y=m>h?1:-1;else for(g=y=0;g<m;g++)if(x[g]!=d[g]){y=x[g]>d[g]?1:-1;break}return y}function P(x,d,m,h){for(var g=0;m--;)x[m]-=g,g=x[m]<d[m]?1:0,x[m]=g*h+x[m]-d[m];for(;!x[0]&&x.length>1;x.splice(0,1));}return function(x,d,m,h,g){var y,_,R,A,E,L,O,U,X,J,j,q,V,ee,ne,W,z,ae=x.s==d.s?1:-1,pe=x.c,ge=d.c;if(!pe||!pe[0]||!ge||!ge[0])return new S(!x.s||!d.s||(pe?ge&&pe[0]==ge[0]:!ge)?NaN:pe&&pe[0]==0||!ge?ae*0:ae/0);for(U=new S(ae),X=U.c=[],_=x.e-d.e,ae=m+_+1,g||(g=kr,_=Rr(x.e/Qe)-Rr(d.e/Qe),ae=ae/Qe|0),R=0;ge[R]==(pe[R]||0);R++);if(ge[R]>(pe[R]||0)&&_--,ae<0)X.push(1),A=!0;else{for(ee=pe.length,W=ge.length,R=0,ae+=2,E=Dr(g/(ge[0]+1)),E>1&&(ge=M(ge,E,g),pe=M(pe,E,g),W=ge.length,ee=pe.length),V=W,J=pe.slice(0,W),j=J.length;j<W;J[j++]=0);z=ge.slice(),z=[0].concat(z),ne=ge[0],ge[1]>=g/2&&ne++;do{if(E=0,y=N(ge,J,W,j),y<0){if(q=J[0],W!=j&&(q=q*g+(J[1]||0)),E=Dr(q/ne),E>1)for(E>=g&&(E=g-1),L=M(ge,E,g),O=L.length,j=J.length;N(L,J,O,j)==1;)E--,P(L,W<O?z:ge,O,g),O=L.length,y=1;else E==0&&(y=E=1),L=ge.slice(),O=L.length;if(O<j&&(L=[0].concat(L)),P(J,L,j,g),j=J.length,y==-1)for(;N(ge,J,W,j)<1;)E++,P(J,W<j?z:ge,j,g),j=J.length}else y===0&&(E++,J=[0]);X[R++]=E,J[0]?J[j++]=pe[V]||0:(J=[pe[V]],j=1)}while((V++<ee||J[0]!=null)&&ae--);A=J[0]!=null,X[0]||X.splice(0,1)}if(g==kr){for(R=1,ae=X[0];ae>=10;ae/=10,R++);G(U,m+(U.e=R+_*Qe-1)+1,h,A)}else U.e=_,U.r=+A;return U}})();function T(M,N,P,x){var d,m,h,g,y;if(P==null?P=o:Ot(P,0,8),!M.c)return M.toString();if(d=M.c[0],h=M.e,N==null)y=Cr(M.c),y=x==1||x==2&&(h<=c||h>=u)?to(y,h):jn(y,h,"0");else if(M=G(new S(M),N,P),m=M.e,y=Cr(M.c),g=y.length,x==1||x==2&&(N<=m||m<=c)){for(;g<N;y+="0",g++);y=to(y,m)}else if(N-=h+(x===2&&m>h),y=jn(y,m,"0"),m+1>g){if(--N>0)for(y+=".";N--;y+="0");}else if(N+=m-g,N>0)for(m+1==g&&(y+=".");N--;y+="0");return M.s<0&&d?"-"+y:y}function C(M){return M instanceof S||!!M&&M._isBigNumber===!0}function k(M,N){for(var P,x,d=1,m=new S(M[0]);d<M.length;d++)x=new S(M[d]),(!x.s||(P=ji(m,x))===N||P===0&&m.s===N)&&(m=x);return m}function $(M,N,P){for(var x=1,d=N.length;!N[--d];N.pop());for(d=N[0];d>=10;d/=10,x++);return(P=x+P*Qe-1)>l?M.c=M.e=null:P<f?M.c=[M.e=0]:(M.e=P,M.c=N),M}n=(function(){var M=/^(-?)0([xbo])(?=\w[\w.]*$)/i,N=/^([^.]+)\.$/,P=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,d=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(m,h,g){var y,_=h.replace(d,"");if(x.test(_)){m.s=isNaN(_)?null:_<0?-1:1,m.c=m.e=null;return}if(_=_.replace(M,function(R,A,E){return y=(E=E.toLowerCase())=="x"?16:E=="b"?2:8,!g||g==y?A:R}),g&&(y=g,_=_.replace(N,"$1").replace(P,"0.$1")),h!=_)return new S(_,y);throw Error(ur+"Not a"+(g?" base "+g:"")+" number: "+h)}})();function G(M,N,P,x){var d,m,h,g,y,_,R,A=M.c,E=sc;if(A){e:{for(d=1,g=A[0];g>=10;g/=10,d++);if(m=N-d,m<0)m+=Qe,h=N,y=A[_=0],R=Dr(y/E[d-h-1]%10);else if(_=ac((m+1)/Qe),_>=A.length)if(x){for(;A.length<=_;A.push(0));y=R=0,d=1,m%=Qe,h=m-Qe+1}else break e;else{for(y=g=A[_],d=1;g>=10;g/=10,d++);m%=Qe,h=m-Qe+d,R=h<0?0:Dr(y/E[d-h-1]%10)}if(x=x||N<0||A[_+1]!=null||(h<0?y:y%E[d-h-1]),x=P<4?(R||x)&&(P==0||P==(M.s<0?3:2)):R>5||R==5&&(P==4||x||P==6&&(m>0?h>0?y/E[d-h]:0:A[_-1])%10&1||P==(M.s<0?8:7)),N<1||!A[0])return A.length=0,x?(N-=M.e+1,A[0]=E[(Qe-N%Qe)%Qe],M.e=-N||0):A[0]=M.e=0,M;if(m==0?(A.length=_,g=1,_--):(A.length=_+1,g=E[Qe-m],A[_]=h>0?Dr(y/E[d-h]%E[h])*g:0),x)for(;;)if(_==0){for(m=1,h=A[0];h>=10;h/=10,m++);for(h=A[0]+=g,g=1;h>=10;h/=10,g++);m!=g&&(M.e++,A[0]==kr&&(A[0]=1));break}else{if(A[_]+=g,A[_]!=kr)break;A[_--]=0,g=1}for(m=A.length;A[--m]===0;A.pop());}M.e>
vendor: 4,133 bytes, line 1
1l?M.c=M.e=null:M.e<f&&(M.c=[M.e=0])}return M}function B(M){var N,P=M.e;return P===null?M.toString():(N=Cr(M.c),N=P<=c||P>=u?to(N,P):jn(N,P,"0"),M.s<0?"-"+N:N)}return a.absoluteValue=a.abs=function(){var M=new S(this);return M.s<0&&(M.s=1),M},a.comparedTo=function(M,N){return ji(this,new S(M,N))},a.decimalPlaces=a.dp=function(M,N){var P,x,d,m=this;if(M!=null)return Ot(M,0,Wt),N==null?N=o:Ot(N,0,8),G(new S(m),M+m.e+1,N);if(!(P=m.c))return null;if(x=((d=P.length-1)-Rr(this.e/Qe))*Qe,d=P[d])for(;d%10==0;d/=10,x--);return x<0&&(x=0),x},a.dividedBy=a.div=function(M,N){return e(this,new S(M,N),s,o)},a.dividedToIntegerBy=a.idiv=function(M,N){return e(this,new S(M,N),0,1)},a.exponentiatedBy=a.pow=function(M,N){var P,x,d,m,h,g,y,_,R,A=this;if(M=new S(M),M.c&&!M.isInteger())throw Error(ur+"Exponent not an integer: "+B(M));if(N!=null&&(N=new S(N)),g=M.e>14,!A.c||!A.c[0]||A.c[0]==1&&!A.e&&A.c.length==1||!M.c||!M.c[0])return R=new S(Math.pow(+B(A),g?M.s*(2-eo(M)):+B(M))),N?R.mod(N):R;if(y=M.s<0,N){if(N.c?!N.c[0]:!N.s)return new S(NaN);x=!y&&A.isInteger()&&N.isInteger(),x&&(A=A.mod(N))}else{if(M.e>9&&(A.e>0||A.e<-1||(A.e==0?A.c[0]>1||g&&A.c[1]>=24e7:A.c[0]<8e13||g&&A.c[0]<=9999975e7)))return m=A.s<0&&eo(M)?-0:0,A.e>-1&&(m=1/m),new S(y?1/m:m);v&&(m=ac(v/Qe+2))}for(g?(P=new S(.5),y&&(M.s=1),_=eo(M)):(d=Math.abs(+B(M)),_=d%2),R=new S(i);;){if(_){if(R=R.times(A),!R.c)break;m?R.c.length>m&&(R.c.length=m):x&&(R=R.mod(N))}if(d){if(d=Dr(d/2),d===0)break;_=d%2}else if(M=M.times(P),G(M,M.e+1,1),M.e>14)_=eo(M);else{if(d=+B(M),d===0)break;_=d%2}A=A.times(A),m?A.c&&A.c.length>m&&(A.c.length=m):x&&(A=A.mod(N))}return x?R:(y&&(R=i.div(R)),N?R.mod(N):m?G(R,v,o,h):R)},a.integerValue=function(M){var N=new S(this);return M==null?M=o:Ot(M,0,8),G(N,N.e+1,M)},a.isEqualTo=a.eq=function(M,N){return ji(this,new S(M,N))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(M,N){return ji(this,new S(M,N))>0},a.isGreaterThanOrEqualTo=a.gte=function(M,N){return(N=ji(this,new S(M,N)))===1||N===0},a.isInteger=function(){return!!this.c&&Rr(this.e/Qe)>this.c.length-2},a.isLessThan=a.lt=function(M,N){return ji(this,new S(M,N))<0},a.isLessThanOrEqualTo=a.lte=function(M,N){return(N=ji(this,new S(M,N)))===-1||N===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(M,N){var P,x,d,m,h=this,g=h.s;if(M=new S(M,N),N=M.s,!g||!N)return new S(NaN);if(g!=N)return M.s=-N,h.plus(M);var y=h.e/Qe,_=M.e/Qe,R=h.c,A=M.c;if(!y||!_){if(!R||!A)return R?(M.s=-N,M):new S(A?h:NaN);if(!R[0]||!A[0])return A[0]?(M.s=-N,M):new S(R[0]?h:o==3?-0:0)}if(y=Rr(y),_=Rr(_),R=R.slice(),g=y-_){for((m=g<0)?(g=-g,d=R):(_=y,d=A),d.reverse(),N=g;N--;d.push(0));d.reverse()}else for(x=(m=(g=R.length)<(N=A.length))?g:N,g=N=0;N<x;N++)if(R[N]!=A[N]){m=R[N]<A[N];break}if(m&&(d=R,R=A,A=d,M.s=-M.s),N=(x=A.length)-(P=R.length),N>0)for(;N--;R[P++]=0);for(N=kr-1;x>g;){if(R[--x]<A[x]){for(P=x;P&&!R[--P];R[P]=N);--R[P],R[x]+=kr}R[x]-=A[x]}for(;R[0]==0;R.splice(0,1),--_);return R[0]?$(M,R,_):(M.s=o==3?-1:1,M.c=[M.e=0],M)},a.modulo=a.mod=function(M,N){var P,x,d=this;return M=new S(M,N),!d.c||!M.s||M.c&&!M.c[0]?new S(NaN):!M.c||d.c&&!d.c[0]?new S(d):(b==9?(x=M.s,M.s=1,P=e(d,M,0,3),M.s=x,P.s*=x):P=e(d,M,0,b),M=d.minus(P.times(M)),!M.c[0]&&b==1&&(M.s=d.s),M)},a.multipliedBy=a.times=function(M,N){var P,x,d,m,h,g,y,_,R,A,E,L,O,U,X,J=this,j=J.c,q=(M=new S(M,N)).c;if(!j||!q||!j[0]||!q[0])return!J.s||!M.s||j&&!j[0]&&!q||q&&!q[0]&&!j?M.c=M.e=M.s=null:(M.s*=J.s,!j||!q?M.c=M.e=null:(M.c=[0],M.e=0)),M;for(x=Rr(J.e/Qe)+Rr(M.e/Qe),M.s*=J.s,y=j.length,A=q.length,y<A&&(O=j,j=q,q=O,d=y,y=A,A=d),d=y+A,O=[];d--;O.push(0));for(U=kr,X=Gn,d=A;--d>=0;){for(P=0,E=q[d]%X,L=q[d]/X|0,h=y,m=d+h;m>d;)_=j[--h]%X,R=j[h]/X|0,g=L*_+R*E,_=E*_+g%X*X+O[m]+P,P=(_/U|0)+(g/X|0)+L*R,O[m--]=_%U;O[m]=P}return P?++x:O.splice(0,1),$(M,O,x)},a.negated=function(){var M=new S(this);return M.s=-M.s||null,M},a.plus=function(M,N){var P,x=this,d=x.s;if(M=new S(M,N),N=M.s,!d||!N)return new S(NaN);if(d!=N)return M.s=-N,x.minus(M);var m=x.e/Qe,h=M.e/Qe,g=x.c,y=M.c;
vendor: 3,787 bytes, line 1
1if(!m||!h){if(!g||!y)return new S(d/0);if(!g[0]||!y[0])return y[0]?M:new S(g[0]?x:d*0)}if(m=Rr(m),h=Rr(h),g=g.slice(),d=m-h){for(d>0?(h=m,P=y):(d=-d,P=g),P.reverse();d--;P.push(0));P.reverse()}for(d=g.length,N=y.length,d-N<0&&(P=y,y=g,g=P,N=d),d=0;N;)d=(g[--N]=g[N]+y[N]+d)/kr|0,g[N]=kr===g[N]?0:g[N]%kr;return d&&(g=[d].concat(g),++h),$(M,g,h)},a.precision=a.sd=function(M,N){var P,x,d,m=this;if(M!=null&&M!==!!M)return Ot(M,1,Wt),N==null?N=o:Ot(N,0,8),G(new S(m),M,N);if(!(P=m.c))return null;if(d=P.length-1,x=d*Qe+1,d=P[d]){for(;d%10==0;d/=10,x--);for(d=P[0];d>=10;d/=10,x++);}return M&&m.e+1>x&&(x=m.e+1),x},a.shiftedBy=function(M){return Ot(M,-Cp,Cp),this.times("1e"+M)},a.squareRoot=a.sqrt=function(){var M,N,P,x,d,m=this,h=m.c,g=m.s,y=m.e,_=s+4,R=new S("0.5");if(g!==1||!h||!h[0])return new S(!g||g<0&&(!h||h[0])?NaN:h?m:1/0);if(g=Math.sqrt(+B(m)),g==0||g==1/0?(N=Cr(h),(N.length+y)%2==0&&(N+="0"),g=Math.sqrt(+N),y=Rr((y+1)/2)-(y<0||y%2),g==1/0?N="5e"+y:(N=g.toExponential(),N=N.slice(0,N.indexOf("e")+1)+y),P=new S(N)):P=new S(g+""),P.c[0]){for(y=P.e,g=y+_,g<3&&(g=0);;)if(d=P,P=R.times(d.plus(e(m,d,_,1))),Cr(d.c).slice(0,g)===(N=Cr(P.c)).slice(0,g))if(P.e<y&&--g,N=N.slice(g-3,g+1),N=="9999"||!x&&N=="4999"){if(!x&&(G(d,d.e+s+2,0),d.times(d).eq(m))){P=d;break}_+=4,g+=4,x=1}else{(!+N||!+N.slice(1)&&N.charAt(0)=="5")&&(G(P,P.e+s+2,1),M=!P.times(P).eq(m));break}}return G(P,P.e+s+1,o,M)},a.toExponential=function(M,N){return M!=null&&(Ot(M,0,Wt),M++),T(this,M,N,1)},a.toFixed=function(M,N){return M!=null&&(Ot(M,0,Wt),M=M+this.e+1),T(this,M,N)},a.toFormat=function(M,N,P){var x,d=this;if(P==null)M!=null&&N&&typeof N=="object"?(P=N,N=null):M&&typeof M=="object"?(P=M,M=N=null):P=w;else if(typeof P!="object")throw Error(ur+"Argument not an object: "+P);if(x=d.toFixed(M,N),d.c){var m,h=x.split("."),g=+P.groupSize,y=+P.secondaryGroupSize,_=P.groupSeparator||"",R=h[0],A=h[1],E=d.s<0,L=E?R.slice(1):R,O=L.length;if(y&&(m=g,g=y,y=m,O-=m),g>0&&O>0){for(m=O%g||g,R=L.substr(0,m);m<O;m+=g)R+=_+L.substr(m,g);y>0&&(R+=_+L.slice(m)),E&&(R="-"+R)}x=A?R+(P.decimalSeparator||"")+((y=+P.fractionGroupSize)?A.replace(new RegExp("\\d{"+y+"}\\B","g"),"$&"+(P.fractionGroupSeparator||"")):A):R}return(P.prefix||"")+x+(P.suffix||"")},a.toFraction=function(M){var N,P,x,d,m,h,g,y,_,R,A,E,L=this,O=L.c;if(M!=null&&(g=new S(M),!g.isInteger()&&(g.c||g.s!==1)||g.lt(i)))throw Error(ur+"Argument "+(g.isInteger()?"out of range: ":"not an integer: ")+B(g));if(!O)return new S(L);for(N=new S(i),_=P=new S(i),x=y=new S(i),E=Cr(O),m=N.e=E.length-L.e-1,N.c[0]=sc[(h=m%Qe)<0?Qe+h:h],M=!M||g.comparedTo(N)>0?m>0?N:_:g,h=l,l=1/0,g=new S(E),y.c[0]=0;R=e(g,N,0,1),d=P.plus(R.times(x)),d.comparedTo(M)!=1;)P=x,x=d,_=y.plus(R.times(d=_)),y=d,N=g.minus(R.times(d=N)),g=d;return d=e(M.minus(P),x,0,1),y=y.plus(d.times(_)),P=P.plus(d.times(x)),y.s=_.s=L.s,m=m*2,A=e(_,x,m,o).minus(L).abs().comparedTo(e(y,P,m,o).minus(L).abs())<1?[_,x]:[y,P],l=h,A},a.toNumber=function(){return+B(this)},a.toObject=function(){var M=this;return{c:M.c?M.c.slice():null,e:M.e,s:M.s}},a.toPrecision=function(M,N){return M!=null&&Ot(M,1,Wt),T(this,M,N,2)},a.toString=function(M){var N,P=this,x=P.s,d=P.e;return d===null?x?(N="Infinity",x<0&&(N="-"+N)):N="NaN":(M==null?N=d<=c||d>=u?to(Cr(P.c),d):jn(Cr(P.c),d,"0"):(Ot(M,2,I.length,"Base"),N=r(jn(Cr(P.c),d,"0"),10,M,x,!0)),x<0&&P.c[0]&&(N="-"+N)),N},a.valueOf=a.toJSON=function(){return B(this)},a._isBigNumber=!0,t!=null&&S.set(t),S}function Rr(t){var e=t|0;return t>0||t===e?e:e-1}function Cr(t){for(var e,r,n=1,a=t.length,i=t[0]+"";n<a;){for(e=t[n++]+"",r=Qe-e.length;r--;e="0"+e);i+=e}for(a=i.length;i.charCodeAt(--a)===48;);return i.slice(0,a+1||1)}function ji(t,e){var r,n,a=t.c,i=e.c,s=t.s,o=e.s,c=t.e,u=e.e;if(!s||!o)return null;if(r=a&&!a[0],n=i&&!i[0],r||n)return r?n?0:-o:s;
1if(s!=o)return s;if(r=s<0,n=c==u,!a||!i)return n?0:!a^r?1:-1;if(!n)return c>u^r?1:-1;for(o=(c=a.length)<(u=i.length)?c:u,s=0;s<o;s++)if(a[s]!=i[s])return a[s]>i[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function Ot(t,e,r,n){if(t<e||t>r||t!==Dr(t))throw Error(ur+(n||"Argument")+(typeof t=="number"?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function eo(t){var e=t.c.length-1;return Rr(t.e/Qe)==e&&t.c[e]%2!=0}function to(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function jn(t,e,r){var n,a;if(e<0){for(a=r+".";++e;a+=r);t=a+t}else if(n=t.length,++e>n){for(a=r,e-=n;--e;a+=r);t+=a}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}const Up=globalThis||void 0||self;var Ur={},xt={},tr={},oc={},cs={},Dp;function P_(){return Dp||(Dp=1,Object.defineProperty(cs,"__esModule",{value:!0}),cs.crypto=void 0,cs.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0),cs}var Hp;function Dv(){return Hp||(Hp=1,(function(t){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=r,t.anumber=n,t.abytes=a,t.ahash=i,t.aexists=s,t.aoutput=o,t.u8=c,t.u32=u,t.clean=f,t.createView=l,t.rotr=p,t.rotl=b,t.byteSwap=v,t.byteSwap32=w,t.bytesToHex=T,t.hexToBytes=$,t.asyncLoop=B,t.utf8ToBytes=M,t.bytesToUtf8=N,t.toBytes=P,t.kdfInputToBytes=x,t.concatBytes=d,t.checkOpts=m,t.createHasher=g,t.createOptHasher=y,t.createXOFer=_,t.randomBytes=R;const e=P_();function r(A){return A instanceof Uint8Array||ArrayBuffer.isView(A)&&A.constructor.name==="Uint8Array"}function n(A){if(!Number.isSafeInteger(A)||A<0)throw new Error("positive integer expected, got "+A)}function a(A,...E){if(!r(A))throw new Error("Uint8Array expected");if(E.length>0&&!E.includes(A.length))throw new Error("Uint8Array expected of length "+E+", got length="+A.length)}function i(A){if(typeof A!="function"||typeof A.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");n(A.outputLen),n(A.blockLen)}function s(A,E=!0){if(A.destroyed)throw new Error("Hash instance has been destroyed");if(E&&A.finished)throw new Error("Hash#digest() has already been called")}function o(A,E){a(A);const L=E.outputLen;if(A.length<L)throw new Error("digestInto() expects output buffer of length at least "+L)}function c(A){return new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}function u(A){return new Uint32Array(A.buffer,A.byteOffset,Math.floor(A.byteLength/4))}function f(...A){for(let E=0;E<A.length;E++)A[E].fill(0)}function l(A){return new DataView(A.buffer,A.byteOffset,A.byteLength)}function p(A,E){return A<<32-E|A>>>E}function b(A,E){return A<<E|A>>>32-E>>>0}t.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function v(A){return A<<24&4278190080|A<<8&16711680|A>>>8&65280|A>>>24&255}t.swap8IfBE=t.isLE?A=>A:A=>v(A),t.byteSwapIfBE=t.swap8IfBE;function w(A){for(let E=0;E<A.length;E++)A[E]=v(A[E]);return A}t.swap32IfBE=t.isLE?A=>A:w;const I=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",S=Array.from({length:256},(A,E)=>E.toString(16).padStart(2,"0"));function T(A){if(a(A),I)return A.toHex();let E="";for(let L=0;L<A.length;L++)E+=S[A[L]];return E}const C={_0:48,_9:57,A:65,F:70,a:97,f:102};function k(A){if(A>=C._0&&A<=C._9)return A-C._0;if(A>=C.A&&A<=C.F)return A-(C.A-10);if(A>=C.a&&A<=C.f)return A-(C.a-10)}function $(A){if(typeof A!="string")throw new Error("hex string expected, got "+typeof A);if(I)return Uint8Array.fromHex(A);const E=A.length,L=E/2;if(E%2)throw new Error("hex string expected, got unpadded hex of length "+E);const O=new Uint8Array(L);for(let U=0,X=0;U<L;U++,X+=2){const J=k(A.charCodeAt(X)),j=k(A.charCodeAt(X+1));if(J===void 0||j===void 0){const q=A[X]+A[X+1];throw new Error('hex string expected, got non-hex character "'+q+'" at index '+X)}O[U]=J*16+j}return O}const G=async()=>{};t.nextTick=G;async function B(A,E,L){let O=Date.now();for(let U=0;U<A;U++){L(U);const X=Date.now()-O;X>=0&&X<E||(await(0,t.nextTick)(),O+=X)}}function M(A){if(typeof A!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(A))}function N(A){return new TextDecoder().decode(A)}function P(A){return typeof A=="string"&&(A=M(A)),a(A),A}function x(A){return typeof A=="string"&&(A=M(A)),a(A),A}function d(...A){let E=0;for(let O=0;O<A.length;O++){const U=A[O];a(U),E+=U.length}const L=new Uint8Array(E);for(let O=0,U=0;O<A.length;O++){const X=A[O];L.set(X,U),U+=X.length}return L}function m(A,E){if(E!==void 0&&{}.toString.call(E)!=="[object Object]")throw new Error("options should be object or undefined");return Object.assign(A,E)}class h{}t.Hash=h;function g(A){const E=O=>A().update(P(O)).digest(),L=A();return E.outputLen=L.outputLen,E.blockLen=L.blockLen,E.create=()=>A(),E}function y(A){const E=(O,U)=>A(U).update(P(O)).digest(),L=A({});return E.outputLen=L.outputLen,E.blockLen=L.blockLen,E.create=O=>A(O),E}function _(A){const E=(O,U)=>A(U).update(P(O)).digest(),L=A({});return E.outputLen=L.outputLen,E.blockLen=L.blockLen,E.create=O=>A(O),E}t.wrapConstructor=g,t.wrapConstructorWithOpts=y,t.wrapXOFConstructorWithOpts=_;function R(A=32){if(e.crypto&&typeof e.crypto.getRandomValues=="function")return e.crypto.getRandomValues(new Uint8Array(A));if(e.crypto&&typeof e.crypto.randomBytes=="function")return Uint8Array.from(e.crypto.randomBytes(A));throw new Error("crypto.getRandomValues must be defined")}})(oc)),oc}var Fp;function M_(){if(Fp)return tr;
1Fp=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SHA512_IV=tr.SHA384_IV=tr.SHA224_IV=tr.SHA256_IV=tr.HashMD=void 0,tr.setBigUint64=e,tr.Chi=r,tr.Maj=n;const t=Dv();function e(i,s,o,c){if(typeof i.setBigUint64=="function")return i.setBigUint64(s,o,c);const u=BigInt(32),f=BigInt(4294967295),l=Number(o>>u&f),p=Number(o&f),b=c?4:0,v=c?0:4;i.setUint32(s+b,l,c),i.setUint32(s+v,p,c)}function r(i,s,o){return i&s^~i&o}function n(i,s,o){return i&s^i&o^s&o}class a extends t.Hash{constructor(s,o,c,u){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=s,this.outputLen=o,this.padOffset=c,this.isLE=u,this.buffer=new Uint8Array(s),this.view=(0,t.createView)(this.buffer)}update(s){(0,t.aexists)(this),s=(0,t.toBytes)(s),(0,t.abytes)(s);const{view:o,buffer:c,blockLen:u}=this,f=s.length;for(let l=0;l<f;){const p=Math.min(u-this.pos,f-l);if(p===u){const b=(0,t.createView)(s);for(;u<=f-l;l+=u)this.process(b,l);continue}c.set(s.subarray(l,l+p),this.pos),this.pos+=p,l+=p,this.pos===u&&(this.process(o,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){(0,t.aexists)(this),(0,t.aoutput)(s,this),this.finished=!0;const{buffer:o,view:c,blockLen:u,isLE:f}=this;let{pos:l}=this;o[l++]=128,(0,t.clean)(this.buffer.subarray(l)),this.padOffset>u-l&&(this.process(c,0),l=0);for(let I=l;I<u;I++)o[I]=0;e(c,u-8,BigInt(this.length*8),f),this.process(c,0);const p=(0,t.createView)(s),b=this.outputLen;if(b%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const v=b/4,w=this.get();if(v>w.length)throw new Error("_sha2: outputLen bigger than state");for(let I=0;I<v;I++)p.setUint32(4*I,w[I],f)}
1digest(){const{buffer:s,outputLen:o}=this;this.digestInto(s);const c=s.slice(0,o);return this.destroy(),c}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());const{blockLen:o,buffer:c,length:u,finished:f,destroyed:l,pos:p}=this;return s.destroyed=l,s.finished=f,s.length=u,s.pos=p,u%o&&s.buffer.set(c),s}clone(){return this._cloneInto()}}return tr.HashMD=a,tr.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),tr.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),tr.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),tr.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),tr}var Xe={},qp;function O_(){if(qp)return Xe;qp=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.toBig=Xe.shrSL=Xe.shrSH=Xe.rotrSL=Xe.rotrSH=Xe.rotrBL=Xe.rotrBH=Xe.rotr32L=Xe.rotr32H=Xe.rotlSL=Xe.rotlSH=Xe.rotlBL=Xe.rotlBH=Xe.add5L=Xe.add5H=Xe.add4L=Xe.add4H=Xe.add3L=Xe.add3H=void 0,Xe.add=S,Xe.fromBig=r,Xe.split=n;const t=BigInt(2**32-1),e=BigInt(32);function r(N,P=!1){return P?{h:Number(N&t),l:Number(N>>e&t)}:{h:Number(N>>e&t)|0,l:Number(N&t)|0}}function n(N,P=!1){const x=N.length;let d=new Uint32Array(x),m=new Uint32Array(x);for(let h=0;h<x;h++){const{h:g,l:y}=r(N[h],P);[d[h],m[h]]=[g,y]}return[d,m]}const a=(N,P)=>BigInt(N>>>0)<<e|BigInt(P>>>0);Xe.toBig=a;const i=(N,P,x)=>N>>>x;Xe.shrSH=i;const s=(N,P,x)=>N<<32-x|P>>>x;Xe.shrSL=s;const o=(N,P,x)=>N>>>x|P<<32-x;Xe.rotrSH=o;const c=(N,P,x)=>N<<32-x|P>>>x;Xe.rotrSL=c;const u=(N,P,x)=>N<<64-x|P>>>x-32;Xe.rotrBH=u;const f=(N,P,x)=>N>>>x-32|P<<64-x;Xe.rotrBL=f;const l=(N,P)=>P;Xe.rotr32H=l;const p=(N,P)=>N;Xe.rotr32L=p;const b=(N,P,x)=>N<<x|P>>>32-x;Xe.rotlSH=b;const v=(N,P,x)=>P<<x|N>>>32-x;Xe.rotlSL=v;const w=(N,P,x)=>P<<x-32|N>>>64-x;Xe.rotlBH=w;const I=(N,P,x)=>N<<x-32|P>>>64-x;Xe.rotlBL=I;function S(N,P,x,d){const m=(P>>>0)+(d>>>0);return{h:N+x+(m/2**32|0)|0,l:m|0}}const T=(N,P,x)=>(N>>>0)+(P>>>0)+(x>>>0);Xe.add3L=T;const C=(N,P,x,d)=>P+x+d+(N/2**32|0)|0;Xe.add3H=C;const k=(N,P,x,d)=>(N>>>0)+(P>>>0)+(x>>>0)+(d>>>0);Xe.add4L=k;const $=(N,P,x,d,m)=>P+x+d+m+(N/2**32|0)|0;Xe.add4H=$;const G=(N,P,x,d,m)=>(N>>>0)+(P>>>0)+(x>>>0)+(d>>>0)+(m>>>0);Xe.add5L=G;const B=(N,P,x,d,m,h)=>P+x+d+m+h+(N/2**32|0)|0;Xe.add5H=B;const M={fromBig:r,split:n,toBig:a,shrSH:i,shrSL:s,rotrSH:o,rotrSL:c,rotrBH:u,rotrBL:f,rotr32H:l,rotr32L:p,rotlSH:b,rotlSL:v,rotlBH:w,rotlBL:I,add:S,add3L:T,add3H:C,add4L:k,add4H:$,add5H:B,add5L:G};return Xe.default=M,Xe}var $p;function L_(){if($p)return xt;$p=1,Object.defineProperty(xt,"__esModule",{value:!0}),xt.sha512_224=xt.sha512_256=xt.sha384=xt.sha512=xt.sha224=xt.sha256=xt.SHA512_256=xt.SHA512_224=xt.SHA384=xt.SHA512=xt.SHA224=xt.SHA256=void 0;const t=M_(),e=O_(),r=Dv(),n=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]),a=new Uint32Array(64);class i extends t.HashMD{constructor(C=32){super(64,C,8,!1),this.A=t.SHA256_IV[0]|0,this.B=t.SHA256_IV[1]|0,this.C=t.SHA256_IV[2]|0,this.D=t.SHA256_IV[3]|0,this.E=t.SHA256_IV[4]|0,this.F=t.SHA256_IV[5]|0,this.G=t.SHA256_IV[6]|0,this.H=t.SHA256_IV[7]|0}get(){const{A:C,B:k,C:$,D:G,E:B,F:M,G:N,H:P}=this;return[C,k,$,G,B,M,N,P]}set(C,k,$,G,B,M,N,P){this.A=C|0,this.B=k|0,this.C=$|0,this.D=G|0,this.E=B|0,this.F=M|0,this.G=N|0,this.H=P|0}process(C,k){for(let m=0;m<16;m++,k+=4)a[m]=C.getUint32(k,!1);for(let m=16;m<64;m++){const h=a[m-15],g=a[m-2],y=(0,r.rotr)(h,7)^(0,r.rotr)(h,18)^h>>>3,_=(0,r.rotr)(g,17)^(0,r.rotr)(g,19)^g>>>10;a[m]=_+a[m-7]+y+a[m-16]|0}let{A:$,B:G,C:B,D:M,E:N,F:P,G:x,H:d}=this;for(let m=0;m<64;m++){const h=(0,r.rotr)(N,6)^(0,r.rotr)(N,11)^(0,r.rotr)(N,25),g=d+h+(0,t.Chi)(N,P,x)+n[m]+a[m]|0,_=((0,r.rotr)($,2)^(0,r.rotr)($,13)^(0,r.rotr)($,22))+(0,t.Maj)($,G,B)|0;d=x,x=P,P=N,N=M+g|0,M=B,B=G,G=$,$=g+_|0}$=$+this.A|0,G=G+this.B|0,B=B+this.C|0,M=M+this.D|0,N=N+this.E|0,P=P+this.F|0,x=x+this.G|0,d=d+this.H|0,this.set($,G,B,M,N,P,x,d)}roundClean(){(0,r.clean)(a)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,r.clean)(this.buffer)}}xt.SHA256=i;class s extends i{constructor(){super(28),this.A=t.SHA224_IV[0]|0,this.B=t.SHA224_IV[1]|0,this.C=t.SHA224_IV[2]|0,this.D=t.SHA224_IV[3]|0,this.E=t.SHA224_IV[4]|0,this.F=t.SHA224_IV[5]|0,this.G=t.SHA224_IV[6]|0,this.H=t.SHA224_IV[7]|0}}xt.SHA224=s;const o=e.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b89
16f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(T=>BigInt(T))),c=o[0],u=o[1],f=new Uint32Array(80),l=new Uint32Array(80);class p extends t.HashMD{constructor(C=64){super(128,C,16,!1),this.Ah=t.SHA512_IV[0]|0,this.Al=t.SHA512_IV[1]|0,this.Bh=t.SHA512_IV[2]|0,this.Bl=t.SHA512_IV[3]|0,this.Ch=t.SHA512_IV[4]|0,this.Cl=t.SHA512_IV[5]|0,this.Dh=t.SHA512_IV[6]|0,this.Dl=t.SHA512_IV[7]|0,this.Eh=t.SHA512_IV[8]|0,this.El=t.SHA512_IV[9]|0,this.Fh=t.SHA512_IV[10]|0,this.Fl=t.SHA512_IV[11]|0,this.Gh=t.SHA512_IV[12]|0,this.Gl=t.SHA512_IV[13]|0,this.Hh=t.SHA512_IV[14]|0,this.Hl=t.SHA512_IV[15]|0}get(){const{Ah:C,Al:k,Bh:$,Bl:G,Ch:B,Cl:M,Dh:N,Dl:P,Eh:x,El:d,Fh:m,Fl:h,Gh:g,Gl:y,Hh:_,Hl:R}=this;return[C,k,$,G,B,M,N,P,x,d,m,h,g,y,_,R]}set(C,k,$,G,B,M,N,P,x,d,m,h,g,y,_,R){this.Ah=C|0,this.Al=k|0,this.Bh=$|0,this.Bl=G|0,this.Ch=B|0,this.Cl=M|0,this.Dh=N|0,this.Dl=P|0,this.Eh=x|0,this.El=d|0,this.Fh=m|0,this.Fl=h|0,this.Gh=g|0,this.Gl=y|0,this.Hh=_|0,this.Hl=R|0}process(C,k){for(let L=0;L<16;L++,k+=4)f[L]=C.getUint32(k),l[L]=C.getUint32(k+=4);for(let L=16;L<80;L++){const O=f[L-15]|0,U=l[L-15]|0,X=e.rotrSH(O,U,1)^e.rotrSH(O,U,8)^e.shrSH(O,U,7),J=e.rotrSL(O,U,1)^e.rotrSL(O,U,8)^e.shrSL(O,U,7),j=f[L-2]|0,q=l[L-2]|0,V=e.rotrSH(j,q,19)^e.rotrBH(j,q,61)^e.shrSH(j,q,6),ee=e.rotrSL(j,q,19)^e.rotrBL(j,q,61)^e.shrSL(j,q,6),ne=e.add4L(J,ee,l[L-7],l[L-16]),W=e.add4H(ne,X,V,f[L-7],f[L-16]);f[L]=W|0,l[L]=ne|0}let{Ah:$,Al:G,Bh:B,Bl:M,Ch:N,Cl:P,Dh:x,Dl:d,Eh:m,El:h,Fh:g,Fl:y,Gh:_,Gl:R,Hh:A,Hl:E}=this;for(let L=0;L<80;L++){const O=e.rotrSH(m,h,14)^e.rotrSH(m,h,18)^e.rotrBH(m,h,41),U=e.rotrSL(m,h,14)^e.rotrSL(m,h,18)^e.rotrBL(m,h,41),X=m&g^~m&_,J=h&y^~h&R,j=e.add5L(E,U,J,u[L],l[L]),q=e.add5H(j,A,O,X,c[L],f[L]),V=j|0,ee=e.rotrSH($,G,28)^e.rotrBH($,G,34)^e.rotrBH($,G,39),ne=e.rotrSL($,G,28)^e.rotrBL($,G,34)^e.rotrBL($,G,39),W=$&B^$&N^B&N,z=G&M^G&P^M&P;A=_|0,E=R|0,_=g|0,R=y|0,g=m|0,y=h|0,{h:m,l:h}=e.add(x|0,d|0,q|0,V|0),x=N|0,d=P|0,N=B|0,P=M|0,B=$|0,M=G|0;const ae=e.add3L(V,ne,z);$=e.add3H(ae,q,ee,W),G=ae|0}({h:$,l:G}=e.add(this.Ah|0,this.Al|0,$|0,G|0)),{h:B,l:M}=e.add(this.Bh|0,this.Bl|0,B|0,M|0),{h:N,l:P}=e.add(this.Ch|0,this.Cl|0,N|0,P|0),{h:x,l:d}=e.add(this.Dh|0,this.Dl|0,x|0,d|0),{h:m,l:h}=e.add(this.Eh|0,this.El|0,m|0,h|0),{h:g,l:y}=e.add(this.Fh|0,this.Fl|0,g|0,y|0),{h:_,l:R}=e.add(this.Gh|0,this.Gl|0,_|0,R|0),{h:A,l:E}=e.add(this.Hh|0,this.Hl|0,A|0,E|0),this.set($,G,B,M,N,P,x,d,m,h,g,y,_,R,A,E)}roundClean(){(0,r.clean)(f,l)}destroy(){(0,r.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}xt.SHA512=p;class b extends p{constructor(){super(48),this.Ah=t.SHA384_IV[0]|0,this.Al=t.SHA384_IV[1]|0,this.Bh=t.SHA384_IV[2]|0,this.Bl=t.SHA384_IV[3]|0,this.Ch=t.SHA384_IV[4]|0,this.Cl=t.SHA384_IV[5]|0,this.Dh=t.SHA384_IV[6]|0,this.Dl=t.SHA384_IV[7]|0,this.Eh=t.SHA384_IV[8]|0,this.El=t.SHA384_IV[9]|0,this.Fh=t.SHA384_IV[10]|0,this.Fl=t.SHA384_IV[11]|0,this.Gh=t.SHA384_IV[12]|0,this.Gl=t.SHA384_IV[13]|0,this.Hh=t.SHA384_IV[14]|0,this.Hl=t.SHA384_IV[15]|0}}xt.SHA384=b;const v=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),w=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,28279439
107,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class I extends p{constructor(){super(28),this.Ah=v[0]|0,this.Al=v[1]|0,this.Bh=v[2]|0,this.Bl=v[3]|0,this.Ch=v[4]|0,this.Cl=v[5]|0,this.Dh=v[6]|0,this.Dl=v[7]|0,this.Eh=v[8]|0,this.El=v[9]|0,this.Fh=v[10]|0,this.Fl=v[11]|0,this.Gh=v[12]|0,this.Gl=v[13]|0,this.Hh=v[14]|0,this.Hl=v[15]|0}}xt.SHA512_224=I;class S extends p{constructor(){super(32),this.Ah=w[0]|0,this.Al=w[1]|0,this.Bh=w[2]|0,this.Bl=w[3]|0,this.Ch=w[4]|0,this.Cl=w[5]|0,this.Dh=w[6]|0,this.Dl=w[7]|0,this.Eh=w[8]|0,this.El=w[9]|0,this.Fh=w[10]|0,this.Fl=w[11]|0,this.Gh=w[12]|0,this.Gl=w[13]|0,this.Hh=w[14]|0,this.Hl=w[15]|0}}return xt.SHA512_256=S,xt.sha256=(0,r.createHasher)(()=>new i),xt.sha224=(0,r.createHasher)(()=>new s),xt.sha512=(0,r.createHasher)(()=>new p),xt.sha384=(0,r.createHasher)(()=>new b),xt.sha512_256=(0,r.createHasher)(()=>new S),xt.sha512_224=(0,r.createHasher)(()=>new I),xt}var Kp;function N_(){if(Kp)return Ur;Kp=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.sha224=Ur.SHA224=Ur.sha256=Ur.SHA256=void 0;const t=L_();return Ur.SHA256=t.SHA256,Ur.sha256=t.sha256,Ur.SHA224=t.SHA224,Ur.sha224=t.sha224,Ur}var fc,Gp;function k_(){if(Gp)return fc;Gp=1;function t(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var a=0;a<e.length;a++){var i=e.charAt(a),s=i.charCodeAt(0);if(r[s]!==255)throw new TypeError(i+" is ambiguous");r[s]=a}var o=e.length,c=e.charAt(0),u=Math.log(o)/Math.log(256),f=Math.log(256)/Math.log(o);function l(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var w=0,I=0,S=0,T=v.length;S!==T&&v[S]===0;)S++,w++;for(var C=(T-S)*f+1>>>0,k=new Uint8Array(C);S!==T;){for(var $=v[S],G=0,B=C-1;($!==0||G<I)&&B!==-1;B--,G++)$+=256*k[B]>>>0,k[B]=$%o>>>0,$=$/o>>>0;if($!==0)throw new Error("Non-zero carry");I=G,S++}for(var M=C-I;M!==C&&k[M]===0;)M++;for(var N=c.repeat(w);M<C;++M)N+=e.charAt(k[M]);return N}function p(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;for(var w=0,I=0,S=0;v[w]===c;)I++,w++;for(var T=(v.length-w)*u+1>>>0,C=new Uint8Array(T);v[w];){var k=v.charCodeAt(w);if(k>255)return;var $=r[k];if($===255)return;for(var G=0,B=T-1;($!==0||G<S)&&B!==-1;B--,G++)$+=o*C[B]>>>0,C[B]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");S=G,w++}for(var M=T-S;M!==T&&C[M]===0;)M++;for(var N=new Uint8Array(I+(T-M)),P=I;M!==T;)N[P++]=C[M++];return N}function b(v){var w=p(v);if(w)return w;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:p,decode:b}}return fc=t,fc}var cc,jp;function C_(){return jp||(jp=1,cc=k_()("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")),cc}var uc,Vp;function U_(){if(Vp)return uc;Vp=1;var t=C_();return uc=function(e){function r(s){var o=Uint8Array.from(s),c=e(o),u=o.length+4,f=new Uint8Array(u);return f.set(o,0),f.set(c.subarray(0,4),o.length),t.encode(f,u)}function n(s){var o=s.slice(0,-4),c=s.slice(-4),u=e(o);if(!(c[0]^u[0]|c[1]^u[1]|c[2]^u[2]|c[3]^u[3]))return o}function a(s){var o=t.decodeUnsafe(s);if(o)return n(o)}function i(s){var o=t.decode(s),c=n(o);if(!c)throw new Error("Invalid checksum");return c}return{encode:r,decode:i,decodeUnsafe:a}},uc}var hc,zp;function D_(){if(zp)return hc;zp=1;var{sha256:t}=N_(),e=U_();function r(n){return t(t(n))}return hc=e(r),hc}var H_=D_();const Hv=Q0(H_),Ra=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function pf(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function w0(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function _a(t,...e){if(!pf(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Fv(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");w0(t.outputLen),w0(t.blockLen)}function Ko(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function F_(t,e){_a(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function sI(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function ja(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function lc(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function zr(t,e){return t<<32-e|t>>>e}const qv=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function $v(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const oI=qv?t=>t:t=>$v(t);function q_(t){for(let e=0;e<t.length;e++)t[e]=$v(t[e]);return t}const fI=qv?t=>t:q_,Kv=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",$_=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ha(t){if(_a(t),Kv)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=$_[t[r]];return e}const ln={_0:48,_9:57,A:65,F:70,a:97,f:102};function Wp(t){if(t>=ln._0&&t<=ln._9)return t-ln._0;if(t>=ln.A&&t<=ln.F)return t-(ln.A-10);if(t>=ln.a&&t<=ln.f)return t-(ln.a-10)}function Go(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);
vendor: 7,146 bytes, line 1
1if(Kv)return Uint8Array.fromHex(t);const e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(r);for(let a=0,i=0;a<r;a++,i+=2){const s=Wp(t.charCodeAt(i)),o=Wp(t.charCodeAt(i+1));if(s===void 0||o===void 0){const c=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+i)}n[a]=s*16+o}return n}function K_(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function gf(t){return typeof t=="string"&&(t=K_(t)),_a(t),t}function ii(...t){let e=0;for(let n=0;n<t.length;n++){const a=t[n];_a(a),e+=a.length}const r=new Uint8Array(e);for(let n=0,a=0;n<t.length;n++){const i=t[n];r.set(i,a),a+=i.length}return r}class Gv{}function bf(t){const e=n=>t().update(gf(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function cI(t){const e=(n,a)=>t(a).update(gf(n)).digest(),r=t({});return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=n=>t(n),e}function jv(t=32){if(Ra&&typeof Ra.getRandomValues=="function")return Ra.getRandomValues(new Uint8Array(t));if(Ra&&typeof Ra.randomBytes=="function")return Uint8Array.from(Ra.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function G_(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);const a=BigInt(32),i=BigInt(4294967295),s=Number(r>>a&i),o=Number(r&i),c=n?4:0,u=n?0:4;t.setUint32(e+c,s,n),t.setUint32(e+u,o,n)}function j_(t,e,r){return t&e^~t&r}function V_(t,e,r){return t&e^t&r^e&r}class Vv extends Gv{constructor(e,r,n,a){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=a,this.buffer=new Uint8Array(e),this.view=lc(this.buffer)}update(e){Ko(this),e=gf(e),_a(e);const{view:r,buffer:n,blockLen:a}=this,i=e.length;for(let s=0;s<i;){const o=Math.min(a-this.pos,i-s);if(o===a){const c=lc(e);for(;a<=i-s;s+=a)this.process(c,s);continue}n.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===a&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ko(this),F_(e,this),this.finished=!0;const{buffer:r,view:n,blockLen:a,isLE:i}=this;let{pos:s}=this;r[s++]=128,ja(this.buffer.subarray(s)),this.padOffset>a-s&&(this.process(n,0),s=0);for(let l=s;l<a;l++)r[l]=0;G_(n,a-8,BigInt(this.length*8),i),this.process(n,0);const o=lc(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)o.setUint32(4*l,f[l],i)}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:r,buffer:n,length:a,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=a,e.pos=o,a%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const Vn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),rr=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),nr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ro=BigInt(2**32-1),Zp=BigInt(32);function z_(t,e=!1){return e?{h:Number(t&ro),l:Number(t>>Zp&ro)}:{h:Number(t>>Zp&ro)|0,l:Number(t&ro)|0}}function W_(t,e=!1){const r=t.length;let n=new Uint32Array(r),a=new Uint32Array(r);for(let i=0;i<r;i++){const{h:s,l:o}=z_(t[i],e);[n[i],a[i]]=[s,o]}return[n,a]}const Yp=(t,e,r)=>t>>>r,Xp=(t,e,r)=>t<<32-r|e>>>r,Ia=(t,e,r)=>t>>>r|e<<32-r,Ba=(t,e,r)=>t<<32-r|e>>>r,no=(t,e,r)=>t<<64-r|e>>>r-32,io=(t,e,r)=>t>>>r-32|e<<64-r,uI=(t,e)=>e,hI=(t,e)=>t,lI=(t,e,r)=>t<<r|e>>>32-r,dI=(t,e,r)=>e<<r|t>>>32-r,pI=(t,e,r)=>e<<r-32|t>>>64-r,gI=(t,e,r)=>t<<r-32|e>>>64-r;function dn(t,e,r,n){const a=(e>>>0)+(n>>>0);return{h:t+r+(a/2**32|0)|0,l:a|0}}const Z_=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Y_=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,X_=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),J_=(t,e,r,n,a)=>e+r+n+a+(t/2**32|0)|0,Q_=(t,e,r,n,a)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(a>>>0),e8=(t,e,r,n,a,i)=>e+r+n+a+i+(t/2**32|0)|0,t8=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]),zn=new Uint32Array(64);class r8 extends Vv{constructor(e=32){super(64,e,8,!1),this.A=Vn[0]|0,this.B=Vn[1]|0,this.C=Vn[2]|0,this.D=Vn[3]|0,this.E=Vn[4]|0,this.F=Vn[5]|0,this.G=Vn[6]|0,this.H=Vn[7]|0}get(){const{A:e,B:r,C:n,D:a,E:i,F:s,G:o,H:c}=this;return[e,r,n,a,i,s,o,c]}set(e,r,n,a,i,s,o,c){this.A=e|0,this.B=r|0,this.C=n|0,this.D=a|0,this.E=i|0,this.F=s|0,this.G=o|0,this.H=c|0}process(e,r){for(let l=0;l<16;l++,r+=4)zn[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){const p=zn[l-15],b=zn[l-2],v=zr(p,7)^zr(p,18)^p>>>3,w=zr(b,17)^zr(b,19)^b>>>10;zn[l]=w+zn[l-7]+v+zn[l-16]|0}let{A:n,B:a,C:i,D:s,E:o,F:c,G:u,H:f}=this;for(let l=0;l<64;l++){const p=zr(o,6)^zr(o,11)^zr(o,25),b=f+p+j_(o,c,u)+t8[l]+zn[l]|0,w=(zr(n,2)^zr(n,13)^zr(n,22))+V_(n,a,i)|0;f=u,u=c,c=o,o=s+b|0,s=i,i=a,a=n,n=b+w|0}n=n+this.A|0,a=a+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,a,i,s,o,c,u,f)}roundClean(){ja(zn)}destroy(){this.set(0,0,0,0,0,0,0,0),ja(this.buffer)}}const zv=W_(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
15771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),n8=zv[0],i8=zv[1],Wn=new Uint32Array(80),Zn=new Uint32Array(80);class rd extends Vv{constructor(e=64){super(128,e,16,!1),this.Ah=nr[0]|0,this.Al=nr[1]|0,this.Bh=nr[2]|0,this.Bl=nr[3]|0,this.Ch=nr[4]|0,this.Cl=nr[5]|0,this.Dh=nr[6]|0,this.Dl=nr[7]|0,this.Eh=nr[8]|0,this.El=nr[9]|0,this.Fh=nr[10]|0,this.Fl=nr[11]|0,this.Gh=nr[12]|0,this.Gl=nr[13]|0,this.Hh=nr[14]|0,this.Hl=nr[15]|0}get(){const{Ah:e,Al:r,Bh:n,Bl:a,Ch:i,Cl:s,Dh:o,Dl:c,Eh:u,El:f,Fh:l,Fl:p,Gh:b,Gl:v,Hh:w,Hl:I}=this;return[e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I]}set(e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=a|0,this.Ch=i|0,this.Cl=s|0,this.Dh=o|0,this.Dl=c|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=p|0,this.Gh=b|0,this.Gl=v|0,this.Hh=w|0,this.Hl=I|0}process(e,r){for(let C=0;C<16;C++,r+=4)Wn[C]=e.getUint32(r),Zn[C]=e.getUint32(r+=4);for(let C=16;C<80;C++){const k=Wn[C-15]|0,$=Zn[C-15]|0,G=Ia(k,$,1)^Ia(k,$,8)^Yp(k,$,7),B=Ba(k,$,1)^Ba(k,$,8)^Xp(k,$,7),M=Wn[C-2]|0,N=Zn[C-2]|0,P=Ia(M,N,19)^no(M,N,61)^Yp(M,N,6),x=Ba(M,N,19)^io(M,N,61)^Xp(M,N,6),d=X_(B,x,Zn[C-7],Zn[C-16]),m=J_(d,G,P,Wn[C-7],Wn[C-16]);Wn[C]=m|0,Zn[C]=d|0}let{Ah:n,Al:a,Bh:i,Bl:s,Ch:o,Cl:c,Dh:u,Dl:f,Eh:l,El:p,Fh:b,Fl:v,Gh:w,Gl:I,Hh:S,Hl:T}=this;for(let C=0;C<80;C++){const k=Ia(l,p,14)^Ia(l,p,18)^no(l,p,41),$=Ba(l,p,14)^Ba(l,p,18)^io(l,p,41),G=l&b^~l&w,B=p&v^~p&I,M=Q_(T,$,B,i8[C],Zn[C]),N=e8(M,S,k,G,n8[C],Wn[C]),P=M|0,x=Ia(n,a,28)^no(n,a,34)^no(n,a,39),d=Ba(n,a,28)^io(n,a,34)^io(n,a,39),m=n&i^n&o^i&o,h=a&s^a&c^s&c;S=w|0,T=I|0,w=b|0,I=v|0,b=l|0,v=p|0,{h:l,l:p}=dn(u|0,f|0,N|0,P|0),u=o|0,f=c|0,o=i|0,c=s|0,i=n|0,s=a|0;const g=Z_(P,d,h);n=Y_(g,N,x,m),a=g|0}({h:n,l:a}=dn(this.Ah|0,this.Al|0,n|0,a|0)),{h:i,l:s}=dn(this.Bh|0,this.Bl|0,i|0,s|0),{h:o,l:c}=dn(this.Ch|0,this.Cl|0,o|0,c|0),{h:u,l:f}=dn(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:p}=dn(this.Eh|0,this.El|0,l|0,p|0),{h:b,l:v}=dn(this.Fh|0,this.Fl|0,b|0,v|0),{h:w,l:I}=dn(this.Gh|0,this.Gl|0,w|0,I|0),{h:S,l:T}=dn(this.Hh|0,this.Hl|0,S|0,T|0),this.set(n,a,i,s,o,c,u,f,l,p,b,v,w,I,S,T)}roundClean(){ja(Wn,Zn)}destroy(){ja(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class a8 extends rd{constructor(){super(48),this.Ah=rr[0]|0,this.Al=rr[1]|0,this.Bh=rr[2]|0,this.Bl=rr[3]|0,this.Ch=rr[4]|0,this.Cl=rr[5]|0,this.Dh=rr[6]|0,this.Dl=rr[7]|0,this.Eh=rr[8]|0,this.El=rr[9]|0,this.Fh=rr[10]|0,this.Fl=rr[11]|0,this.Gh=rr[12]|0,this.Gl=rr[13]|0,this.Hh=rr[14]|0,this.Hl=rr[15]|0}}const ir=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class s8 extends rd{constructor(){super(32),this.Ah=ir[0]|0,this.Al=ir[1]|0,this.Bh=ir[2]|0,this.Bl=ir[3]|0,this.Ch=ir[4]|0,this.Cl=ir[5]|0,this.Dh=ir[6]|0,this.Dl=ir[7]|0,this.Eh=ir[8]|0,this.El=ir[9]|0,this.Fh=ir[10]|0,this.Fl=ir[11]|0,this.Gh=ir[12]|0,this.Gl=ir[13]|0,this.Hh=ir[14]|0,this.Hl=ir[15]|0}}const Wv=bf(()=>new r8),o8=bf(()=>new rd),f8=bf(()=>new a8),bI=bf(()=>new s8);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nd=BigInt(0),_0=BigInt(1);function jo(t,e=""){if(typeof t!="boolean"){const r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function ea(t,e,r=""){const n=pf(t),a=t?.length,i=e!==void 0;if(!n||i&&a!==e){const s=r&&`"${r}" `,o=i?` of length ${e}`:"",c=n?`length=${a}`:`type=${typeof t}`;throw new Error(s+"expected Uint8Array"+o+", got "+c)}return t}function ao(t){const e=t.toString(16);return e.length&1?"0"+e:e}function Zv(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?nd:BigInt("0x"+t)}function mf(t){return Zv(Ha(t))}function Yv(t){return _a(t),Zv(Ha(Uint8Array.from(t).reverse()))}function id(t,e){return Go(t.toString(16).padStart(e*2,"0"))}function Xv(t,e){return id(t,e).reverse()}function lr(t,e,r){let n;if(typeof e=="string")try{n=Go(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else if(pf(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");const a=n.length;if(typeof r=="number"&&a!==r)throw new Error(t+" of length "+r+" expected, got "+a);return n}const dc=t=>typeof t=="bigint"&&nd<=t;function c8(t,e,r){return dc(t)&&dc(e)&&dc(r)&&e<=t&&t<r}function u8(t,e,r,n){if(!c8(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Jv(t){let e;for(e=0;t>nd;t>>=_0,e+=1);return e}const Fs=t=>(_0<<BigInt(t))-_0;function h8(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");const n=b=>new Uint8Array(b),a=b=>Uint8Array.of(b);let i=n(t),s=n(t),o=0;const c=()=>{i.fill(1),s.fill(0),o=0},u=(...b)=>r(s,i,...b),f=(b=n(0))=>{s=u(a(0),b),i=u(),b.length!==0&&(s=u(a(1),b),i=u())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let b=0;const v=[];for(;b<e;){i=u();const w=i.slice();v.push(w),b+=i.length}return ii(...v)};return(b,v)=>{c(),f(b);let w;for(;!(w=v(l()));)f();return c(),w}}function ad(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(a,i,s){const o=t[a];if(s&&o===void 0)return;const c=typeof o;if(c!==i||o===null)throw new Error(`param "${a}
1" is invalid: expected ${i}, got ${c}`)}Object.entries(e).forEach(([a,i])=>n(a,i,!1)),Object.entries(r).forEach(([a,i])=>n(a,i,!0))}function Jp(t){const e=new WeakMap;return(r,...n)=>{const a=e.get(r);if(a!==void 0)return a;const i=t(r,...n);return e.set(r,i),i}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pr=BigInt(0),cr=BigInt(1),ta=BigInt(2),Qv=BigInt(3),e2=BigInt(4),t2=BigInt(5),l8=BigInt(7),r2=BigInt(8),d8=BigInt(9),n2=BigInt(16);function Hr(t,e){const r=t%e;return r>=pr?r:e+r}function Er(t,e,r){let n=t;for(;e-- >pr;)n*=n,n%=r;return n}function Qp(t,e){if(t===pr)throw new Error("invert: expected non-zero number");if(e<=pr)throw new Error("invert: expected positive modulus, got "+e);let r=Hr(t,e),n=e,a=pr,i=cr;for(;r!==pr;){const o=n/r,c=n%r,u=a-i*o;n=r,r=c,a=i,i=u}if(n!==cr)throw new Error("invert: does not exist");return Hr(a,e)}function sd(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function i2(t,e){const r=(t.ORDER+cr)/e2,n=t.pow(e,r);return sd(t,n,e),n}function p8(t,e){const r=(t.ORDER-t2)/r2,n=t.mul(e,ta),a=t.pow(n,r),i=t.mul(e,a),s=t.mul(t.mul(i,ta),a),o=t.mul(i,t.sub(s,t.ONE));return sd(t,o,e),o}function g8(t){const e=Si(t),r=a2(t),n=r(e,e.neg(e.ONE)),a=r(e,n),i=r(e,e.neg(n)),s=(t+l8)/n2;return(o,c)=>{let u=o.pow(c,s),f=o.mul(u,n);const l=o.mul(u,a),p=o.mul(u,i),b=o.eql(o.sqr(f),c),v=o.eql(o.sqr(l),c);u=o.cmov(u,f,b),f=o.cmov(p,l,v);const w=o.eql(o.sqr(f),c),I=o.cmov(u,f,w);return sd(o,I,c),I}}function a2(t){if(t<Qv)throw new Error("sqrt is not defined for small field");let e=t-cr,r=0;for(;e%ta===pr;)e/=ta,r++;let n=ta;const a=Si(t);for(;e1(a,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return i2;let i=a.pow(n,e);const s=(e+cr)/ta;return function(c,u){if(c.is0(u))return u;if(e1(c,u)!==1)throw new Error("Cannot find square root");let f=r,l=c.mul(c.ONE,i),p=c.pow(u,e),b=c.pow(u,s);for(;!c.eql(p,c.ONE);){if(c.is0(p))return c.ZERO;let v=1,w=c.sqr(p);for(;!c.eql(w,c.ONE);)if(v++,w=c.sqr(w),v===f)throw new Error("Cannot find square root");const I=cr<<BigInt(f-v-1),S=c.pow(l,I);f=v,l=c.sqr(S),p=c.mul(p,l),b=c.mul(b,S)}return b}}function b8(t){return t%e2===Qv?i2:t%r2===t2?p8:t%n2===d8?g8(t):a2(t)}const m8=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function y8(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=m8.reduce((n,a)=>(n[a]="function",n),e);return ad(t,r),t}function v8(t,e,r){if(r<pr)throw new Error("invalid exponent, negatives unsupported");if(r===pr)return t.ONE;if(r===cr)return e;let n=t.ONE,a=e;for(;r>pr;)r&cr&&(n=t.mul(n,a)),a=t.sqr(a),r>>=cr;return n}function s2(t,e,r=!1){const n=new Array(e.length).fill(r?t.ZERO:void 0),a=e.reduce((s,o,c)=>t.is0(o)?s:(n[c]=s,t.mul(s,o)),t.ONE),i=t.inv(a);return e.reduceRight((s,o,c)=>t.is0(o)?s:(n[c]=t.mul(s,n[c]),t.mul(s,o)),i),n}function e1(t,e){const r=(t.ORDER-cr)/ta,n=t.pow(e,r),a=t.eql(n,t.ONE),i=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!a&&!i&&!s)throw new Error("invalid Legendre symbol result");return a?1:i?0:-1}function o2(t,e){e!==void 0&&w0(e);const r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Si(t,e,r=!1,n={}){if(t<=pr)throw new Error("invalid field: expected ORDER > 0, got "+t);let a,i,s=!1,o;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");const p=e;p.BITS&&(a=p.BITS),p.sqrt&&(i=p.sqrt),typeof p.isLE=="boolean"&&(r=p.isLE),typeof p.modFromBytes=="boolean"&&(s=p.modFromBytes),o=p.allowedLengths}else typeof e=="number"&&(a=e),n.sqrt&&(i=n.sqrt);const{nBitLength:c,nByteLength:u}=o2(t,a);if(u>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const l=Object.freeze({ORDER:t,isLE:r,BITS:c,BYTES:u,MASK:Fs(c),ZERO:pr,ONE:cr,allowedLengths:o,create:p=>Hr(p,t),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return pr<=p&&p<t},is0:p=>p===pr,isValidNot0:p=>!l.is0(p)&&l.isValid(p),isOdd:p=>(p&cr)===cr,neg:p=>Hr(-p,t),eql:(p,b)=>p===b,sqr:p=>Hr(p*p,t),add:(p,b)=>Hr(p+b,t),sub:(p,b)=>Hr(p-b,t),mul:(p,b)=>
vendor: 24,632 bytes, line 1
1Hr(p*b,t),pow:(p,b)=>v8(l,p,b),div:(p,b)=>Hr(p*Qp(b,t),t),sqrN:p=>p*p,addN:(p,b)=>p+b,subN:(p,b)=>p-b,mulN:(p,b)=>p*b,inv:p=>Qp(p,t),sqrt:i||(p=>(f||(f=b8(t)),f(l,p))),toBytes:p=>r?Xv(p,u):id(p,u),fromBytes:(p,b=!0)=>{if(o){if(!o.includes(p.length)||p.length>u)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+p.length);const w=new Uint8Array(u);w.set(p,r?0:w.length-p.length),p=w}if(p.length!==u)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+p.length);let v=r?Yv(p):mf(p);if(s&&(v=Hr(v,t)),!b&&!l.isValid(v))throw new Error("invalid field element: outside of range 0..ORDER");return v},invertBatch:p=>s2(l,p),cmov:(p,b,v)=>v?b:p});return Object.freeze(l)}function f2(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function c2(t){const e=f2(t);return e+Math.ceil(e/2)}function w8(t,e,r=!1){const n=t.length,a=f2(e),i=c2(e);if(n<16||n<i||n>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+n);const s=r?Yv(t):mf(t),o=Hr(s,e-cr)+cr;return r?Xv(o,a):id(o,a)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Va=BigInt(0),ra=BigInt(1);function Vo(t,e){const r=e.negate();return t?r:e}function pc(t,e){const r=s2(t.Fp,e.map(n=>n.Z));return e.map((n,a)=>t.fromAffine(n.toAffine(r[a])))}function u2(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function gc(t,e){u2(t,e);const r=Math.ceil(e/t)+1,n=2**(t-1),a=2**t,i=Fs(t),s=BigInt(t);return{windows:r,windowSize:n,mask:i,maxNumber:a,shiftBy:s}}function t1(t,e,r){const{windowSize:n,mask:a,maxNumber:i,shiftBy:s}=r;let o=Number(t&a),c=t>>s;o>n&&(o-=i,c+=ra);const u=e*n,f=u+Math.abs(o)-1,l=o===0,p=o<0,b=e%2!==0;return{nextN:c,offset:f,isZero:l,isNeg:p,isNegF:b,offsetF:u}}function _8(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function E8(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}const bc=new WeakMap,h2=new WeakMap;function mc(t){return h2.get(t)||1}function r1(t){if(t!==Va)throw new Error("invalid wNAF")}class S8{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let a=e;for(;r>Va;)r&ra&&(n=n.add(a)),a=a.double(),r>>=ra;return n}precomputeWindow(e,r){const{windows:n,windowSize:a}=gc(r,this.bits),i=[];let s=e,o=s;for(let c=0;c<n;c++){o=s,i.push(o);for(let u=1;u<a;u++)o=o.add(s),i.push(o);s=o.double()}return i}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let a=this.ZERO,i=this.BASE;const s=gc(e,this.bits);for(let o=0;o<s.windows;o++){const{nextN:c,offset:u,isZero:f,isNeg:l,isNegF:p,offsetF:b}=t1(n,o,s);n=c,f?i=i.add(Vo(p,r[b])):a=a.add(Vo(l,r[u]))}return r1(n),{p:a,f:i}}wNAFUnsafe(e,r,n,a=this.ZERO){const i=gc(e,this.bits);for(let s=0;s<i.windows&&n!==Va;s++){const{nextN:o,offset:c,isZero:u,isNeg:f}=t1(n,s,i);if(n=o,!u){const l=r[c];a=a.add(f?l.negate():l)}}return r1(n),a}getPrecomputes(e,r,n){let a=bc.get(r);return a||(a=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(a=n(a)),bc.set(r,a))),a}cached(e,r,n){const a=mc(e);return this.wNAF(a,this.getPrecomputes(a,e,n),r)}unsafe(e,r,n,a){const i=mc(e);return i===1?this._unsafeLadder(e,r,a):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),r,a)}createCache(e,r){u2(r,this.bits),h2.set(e,r),bc.delete(e)}hasCache(e){return mc(e)!==1}}function x8(t,e,r,n){let a=e,i=t.ZERO,s=t.ZERO;for(;r>Va||n>Va;)r&ra&&(i=i.add(a)),n&ra&&(s=s.add(a)),a=a.double(),r>>=ra,n>>=ra;return{p1:i,p2:s}}function A8(t,e,r,n){_8(r,t),E8(n,e);const a=r.length,i=n.length;if(a!==i)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,o=Jv(BigInt(a));let c=1;o>12?c=o-3:o>4?c=o-2:o>0&&(c=2);const u=Fs(c),f=new Array(Number(u)+1).fill(s),l=Math.floor((e.BITS-1)/c)*c;let p=s;for(let b=l;b>=0;b-=c){f.fill(s);for(let w=0;w<i;w++){const I=n[w],S=Number(I>>BigInt(b)&u);f[S]=f[S].add(r[w])}let v=s;for(let w=f.length-1,I=s;w>0;w--)I=I.add(f[w]),v=v.add(I);if(p=p.add(v),b!==0)for(let w=0;w<c;w++)p=p.double()}return p}function n1(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return y8(e),e}else return Si(t,{isLE:r})}function R8(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(const c of["p","n","h"]){const u=e[c];if(!(typeof u=="bigint"&&u>Va))throw new Error(`CURVE.${c} must be positive bigint`)}const a=n1(e.p,r.Fp,n),i=n1(e.n,r.Fn,n),o=["Gx","Gy","a","b"];for(const c of o)if(!a.isValid(e[c]))throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:a,Fn:i}}class l2 extends Gv{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Fv(e);const n=gf(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,i=new Uint8Array(a);i.set(n.length>a?e.create().update(n).digest():n);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),ja(i)}update(e){return Ko(this),this.iHash.update(e),this}digestInto(e){Ko(this),_a(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:r,iHash:n,finished:a,destroyed:i,blockLen:s,outputLen:o}=this;return e=e,e.finished=a,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const d2=(t,e,r)=>new l2(t,e).update(r).digest();d2.create=(t,e)=>new l2(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const i1=(t,e)=>(t+(t>=0?e:-e)/p2)/e;function I8(t,e,r){const[[n,a],[i,s]]=e,o=i1(s*t,r),c=i1(-a*t,r);let u=t-o*n-c*i,f=-o*a-c*s;const l=u<Cn,p=f<Cn;l&&(u=-u),p&&(f=-f);const b=Fs(Math.ceil(Jv(r)/2))+Fa;if(u<Cn||u>=b||f<Cn||f>=b)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:l,k1:u,k2neg:p,k2:f}}function E0(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function yc(t,e){const r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return jo(r.lowS,"lowS"),jo(r.prehash,"prehash"),r.format!==void 0&&E0(r.format),r}class B8 extends Error{constructor(e=""){super(e)}}const wn={Err:B8,_tlv:{encode:(t,e)=>{const{Err:r}=wn;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");const n=e.length/2,a=ao(n);if(a.length/2&128)throw new r("tlv.encode: long form length too big");const i=n>127?ao(a.length/2|128):"";return ao(t)+i+a+e},decode(t,e){const{Err:r}=wn;let n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");const a=e[n++],i=!!(a&128);let s=0;if(!i)s=a;else{const c=a&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");const u=e.subarray(n,n+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(const f of u)s=s<<8|f;if(n+=c,s<128)throw new r("tlv.decode(long): not minimal encoding")}const o=e.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:e.subarray(n+s)}}},_int:{encode(t){const{Err:e}=wn;if(t<Cn)throw new e("integer: negative integers are not allowed");let r=ao(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){const{Err:e}=wn;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return mf(t)}},toSig(t){const{Err:e,_int:r,_tlv:n}=wn,a=lr("signature",t),{v:i,l:s}=n.decode(48,a);if(s.length)throw new e("invalid signature: left bytes after parsing");const{v:o,l:c}=n.decode(2,i),{v:u,l:f}=n.decode(2,c);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(o),s:r.decode(u)}},hexFromSig(t){const{_tlv:e,_int:r}=wn,n=e.encode(2,r.encode(t.r)),a=e.encode(2,r.encode(t.s)),i=n+a;return e.encode(48,i)}},Cn=BigInt(0),Fa=BigInt(1),p2=BigInt(2),so=BigInt(3),T8=BigInt(4);function Na(t,e){const{BYTES:r}=t;let n;if(typeof e=="bigint")n=e;else{let a=lr("private key",e);try{n=t.fromBytes(a)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function P8(t,e={}){const r=R8("weierstrass",t,e),{Fp:n,Fn:a}=r;let i=r.CURVE;const{h:s,n:o}=i;ad(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=e;if(c&&(!n.is0(i.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const u=b2(n,a);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(d,m,h){const{x:g,y}=m.toAffine(),_=n.toBytes(g);if(jo(h,"isCompressed"),h){f();const R=!n.isOdd(y);return ii(g2(R),_)}else return ii(Uint8Array.of(4),_,n.toBytes(y))}function p(d){ea(d,void 0,"Point");const{publicKey:m,publicKeyUncompressed:h}=u,g=d.length,y=d[0],_=d.subarray(1);if(g===m&&(y===2||y===3)){const R=n.fromBytes(_);if(!n.isValid(R))throw new Error("bad point: is not on curve, wrong x");const A=w(R);let E;try{E=n.sqrt(A)}catch(U){const X=U instanceof Error?": "+U.message:"";throw new Error("bad point: is not on curve, sqrt error"+X)}f();const L=n.isOdd(E);return(y&1)===1!==L&&(E=n.neg(E)),{x:R,y:E}}else if(g===h&&y===4){const R=n.BYTES,A=n.fromBytes(_.subarray(0,R)),E=n.fromBytes(_.subarray(R,R*2));if(!I(A,E))throw new Error("bad point: is not on curve");return{x:A,y:E}}else throw new Error(`bad point: got length ${g}, expected compressed=${m} or uncompressed=${h}`)}const b=e.toBytes||l,v=e.fromBytes||p;function w(d){const m=n.sqr(d),h=n.mul(m,d);return n.add(n.add(h,n.mul(d,i.a)),i.b)}function I(d,m){const h=n.sqr(m),g=w(d);return n.eql(h,g)}if(!I(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const S=n.mul(n.pow(i.a,so),T8),T=n.mul(n.sqr(i.b),BigInt(27));if(n.is0(n.add(S,T)))throw new Error("bad curve params: a or b");function C(d,m,h=!1){if(!n.isValid(m)||h&&n.is0(m))throw new Error(`bad point coordinate ${d}`);return m}function k(d){if(!(d instanceof N))throw new Error("ProjectivePoint expected")}function $(d){if(!c||!c.basises)throw new Error("no endo");return I8(d,c.basises,a.ORDER)}const G=Jp((d,m)=>{const{X:h,Y:g,Z:y}=d;if(n.eql(y,n.ONE))return{x:h,y:g};const _=d.is0();m==null&&(m=_?n.ONE:n.inv(y));const R=n.mul(h,m),A=n.mul(g,m),E=n.mul(y,m);if(_)return{x:n.ZERO,y:n.ZERO};if(!n.eql(E,n.ONE))throw new Error("invZ was invalid");return{x:R,y:A}}),B=Jp(d=>{if(d.is0()){if(e.allowInfinityPoint&&!n.is0(d.Y))return;throw new Error("bad point: ZERO")}const{x:m,y:h}=d.toAffine();if(!n.isValid(m)||!n.isValid(h))throw new Error("bad point: x or y not field elements");if(!I(m,h))throw new Error("bad point: equation left != right");if(!d.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function M(d,m,h,g,y){return h=new N(n.mul(h.X,d),h.Y,h.Z),m=Vo(g,m),h=Vo(y,h),m.add(h)}class N{constructor(m,h,g){this.X=C("x",m),this.Y=C("y",h,!0),this.Z=C("z",g),Object.freeze(this)}static CURVE(){return i}static fromAffine(m){const{x:h,y:g}=m||{};if(!m||!n.isValid(h)||!n.isValid(g))throw new Error("invalid affine point");if(m instanceof N)throw new Error("projective point not allowed");return n.is0(h)&&n.is0(g)?N.ZERO:new N(h,g,n.ONE)}static fromBytes(m){const h=N.fromAffine(v(ea(m,void 0,"point")));return h.assertValidity(),h}static fromHex(m){return N.fromBytes(lr("pointHex",m))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,h=!0){return x.createCache(this,m),h||this.multiply(so),this}assertValidity(){B(this)}hasEvenY(){const{y:m}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(m)}equals(m){k(m);const{X:h,Y:g,Z:y}=this,{X:_,Y:R,Z:A}=m,E=n.eql(n.mul(h,A),n.mul(_,y)),L=n.eql(n.mul(g,A),n.mul(R,y));return E&&L}negate(){return new N(this.X,n.neg(this.Y),this.Z)}double(){const{a:m,b:h}=i,g=n.mul(h,so),{X:y,Y:_,Z:R}=this;let A=n.ZERO,E=n.ZERO,L=n.ZERO,O=n.mul(y,y),U=n.mul(_,_),X=n.mul(R,R),J=n.mul(y,_);return J=n.add(J,J),L=n.mul(y,R),L=n.add(L,L),A=n.mul(m,L),E=n.mul(g,X),E=n.add(A,E),A=n.sub(U,E),E=n.add(U,E),E=n.mul(A,E),A=n.mul(J,A),L=n.mul(g,L),X=n.mul(m,X),J=n.sub(O,X),J=n.mul(m,J),J=n.add(J,L),L=n.add(O,O),O=n.add(L,O),O=n.add(O,X),O=n.mul(O,J),E=n.add(E,O),X=n.mul(_,R),X=n.add(X,X),O=n.mul(X,J),A=n.sub(A,O),L=n.mul(X,U),L=n.add(L,L),L=n.add(L,L),new N(A,E,L)}add(m){k(m);const{X:h,Y:g,Z:y}=this,{X:_,Y:R,Z:A}=m;let E=n.ZERO,L=n.ZERO,O=n.ZERO;const U=i.a,X=n.mul(i.b,so);let J=n.mul(h,_),j=n.mul(g,R),q=n.mul(y,A),V=n.add(h,g),ee=n.add(_,R);V=n.mul(V,ee),ee=n.add(J,j),V=n.sub(V,ee),ee=n.add(h,y);let ne=n.add(_,A);return ee=n.mul(ee,ne),ne=n.add(J,q),ee=n.sub(ee,ne),ne=n.add(g,y),E=n.add(R,A),ne=n.mul(ne,E),E=n.add(j,q),ne=n.sub(ne,E),O=n.mul(U,ee),E=n.mul(X,q),O=n.add(E,O),E=n.sub(j,O),O=n.add(j,O),L=n.mul(E,O),j=n.add(J,J),j=n.add(j,J),q=n.mul(U,q),ee=n.mul(X,ee),j=n.add(j,q),q=n.sub(J,q),q=n.mul(U,q),ee=n.add(ee,q),J=n.mul(j,ee),L=n.add(L,J),J=n.mul(ne,ee),E=n.mul(V,E),E=n.sub(E,J),J=n.mul(V,j),O=n.mul(ne,O),O=n.add(O,J),new N(E,L,O)}subtract(m){return this.add(m.negate())}is0(){return this.equals(N.ZERO)}multiply(m){const{endo:h}=e;if(!a.isValidNot0(m))throw new Error("invalid scalar: out of range");let g,y;const _=R=>x.cached(this,R,A=>pc(N,A));if(h){const{k1neg:R,k1:A,k2neg:E,k2:L}=$(m),{p:O,f:U}=_(A),{p:X,f:J}=_(L);y=U.add(J),g=M(h.beta,O,X,R,E)}else{const{p:R,f:A}=_(m);g=R,y=A}return pc(N,[g,y])[0]}multiplyUnsafe(m){const{endo:h}=e,g=this;if(!a.isValid(m))throw new Error("invalid scalar: out of range");if(m===Cn||g.is0())return N.ZERO;if(m===Fa)return g;if(x.hasCache(this))return this.multiply(m);if(h){const{k1neg:y,k1:_,k2neg:R,k2:A}=$(m),{p1:E,p2:L}=x8(N,g,_,A);return M(h.beta,E,L,y,R)}else return x.unsafe(g,m)}multiplyAndAddUnsafe(m,h,g){const y=this.multiplyUnsafe(h).add(m.multiplyUnsafe(g));return y.is0()?void 0:y}toAffine(m){return G(this,m)}isTorsionFree(){const{isTorsionFree:m}=e;return s===Fa?!0:m?m(N,this):x.unsafe(this,o).is0()}clearCofactor(){const{clearCofactor:m}=e;return s===Fa?this:m?m(N,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(m=!0){return jo(m,"isCompressed"),this.assertValidity(),b(N,this,m)}toHex(m=!0){return Ha(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(m=!0){return this.toBytes(m)}_setWindowSize(m){this.precompute(m)}static normalizeZ(m){return pc(N,m)}static msm(m,h){return A8(N,a,m,h)}static fromPrivateKey(m){return N.BASE.multiply(Na(a,m))}}N.BASE=new N(i.Gx,i.Gy,n.ONE),N.ZERO=new N(n.ZERO,n.ONE,n.ZERO),N.Fp=n,N.Fn=a;const P=a.BITS,x=new S8(N,e.endo?Math.ceil(P/2):P);return N.BASE.precompute(8),N}function g2(t){return Uint8Array.of(t?2:3)}function b2(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function M8(t,e={}){const{Fn:r}=t,n=e.randomBytes||jv,a=Object.assign(b2(t.Fp,r),{seed:c2(r.ORDER)});function i(b){try{return!!Na(r,b)}catch{return!1}}function s(b,v){const{publicKey:w,publicKeyUncompressed:I}=a;try{const S=b.length;return v===!0&&S!==w||v===!1&&S!==I?!1:!!t.fromBytes(b)}catch{return!1}}function o(b=n(a.seed)){return w8(ea(b,a.seed,"seed"),r.ORDER)}function c(b,v=!0){return t.BASE.multiply(Na(r,b)).toBytes(v)}function u(b){const v=o(b);return{secretKey:v,publicKey:c(v)}}function f(b){if(typeof b=="bigint")return!1;if(b instanceof t)return!0;const{secretKey:v,publicKey:w,publicKeyUncompressed:I}=a;if(r.allowedLengths||v===w)return;const S=lr("key",b).length;return S===w||S===I}function l(b,v,w=!0){if(f(b)===!0)throw new Error("first arg must be private key");if(f(v)===!1)throw new Error("second arg must be public key");const I=Na(r,b);return t.fromHex(v).multiply(I).toBytes(w)}return Object.freeze({getPublicKey:c,getSharedSecret:l,keygen:u,Point:t,utils:{isValidSecretKey:i,isValidPublicKey:s,randomSecretKey:o,isValidPrivateKey:i,randomPrivateKey:o,normPrivateKeyToScalar:b=>Na(r,b),precompute(b=8,v=t.BASE){return v.precompute(b,!1)}},lengths:a})}function O8(t,e,r={}){Fv(e),ad(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=r.randomBytes||jv,a=r.hmac||((h,...g)=>d2(e,h,ii(...g))),{Fp:i,Fn:s}=t,{ORDER:o,BITS:c}=s,{keygen:u,getPublicKey:f,getSharedSecret:l,utils:p,lengths:b}=M8(t,r),v={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},w="compact";function I(h){const g=o>>Fa;return h>g}function S(h,g){if(!s.isValidNot0(g))throw new Error(`invalid signature ${h}: out of range 1..Point.Fn.ORDER`);return g}function T(h,g){E0(g);const y=b.signature,_=g==="compact"?y:g==="recovered"?y+1:void 0;return ea(h,_,`${g} signature`)}class C{constructor(g,y,_){this.r=S("r",g),this.s=S("s",y),_!=null&&(this.recovery=_),Object.freeze(this)}static fromBytes(g,y=w){T(g,y);let _;if(y==="der"){const{r:L,s:O}=wn.toSig(ea(g));return new C(L,O)}y==="recovered"&&(_=g[0],y="compact",g=g.subarray(1));const R=s.BYTES,A=g.subarray(0,R),E=g.subarray(R,R*2);return new C(s.fromBytes(A),s.fromBytes(E),_)}static fromHex(g,y){return this.fromBytes(Go(g),y)}addRecoveryBit(g){return new C(this.r,this.s,g)}recoverPublicKey(g){const y=i.ORDER,{r:_,s:R,recovery:A}=this;if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");if(o*p2<y&&A>1)throw new Error("recovery id is ambiguous for h>1 curve");const L=A===2||A===3?_+o:_;if(!i.isValid(L))throw new Error("recovery id 2 or 3 invalid");const O=i.toBytes(L),U=t.fromBytes(ii(g2((A&1)===0),O)),X=s.inv(L),J=$(lr("msgHash",g)),j=s.create(-J*X),q=s.create(R*X),V=t.BASE.multiplyUnsafe(j).add(U.multiplyUnsafe(q));if(V.is0())throw new Error("point at infinify");return V.assertValidity(),V}hasHighS(){return I(this.s)}toBytes(g=w){if(E0(g),g==="der")return Go(wn.hexFromSig(this));const y=s.toBytes(this.r),_=s.toBytes(this.s);if(g==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return ii(Uint8Array.of(this.recovery),y,_)}return ii(y,_)}toHex(g){return Ha(this.toBytes(g))}assertValidity(){}static fromCompact(g){return C.fromBytes(lr("sig",g),"compact")}static fromDER(g){return C.fromBytes(lr("sig",g),"der")}normalizeS(){return this.hasHighS()?new C(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Ha(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Ha(this.toBytes("compact"))}}const k=r.bits2int||function(g){if(g.length>8192)throw new Error("input is too large");const y=mf(g),_=g.length*8-c;return _>0?y>>BigInt(_):y},$=r.bits2int_modN||function(g){return s.create(k(g))},G=Fs(c);function B(h){return u8("num < 2^"+c,h,Cn,G),s.toBytes(h)}function M(h,g){return ea(h,void 0,"message"),g?ea(e(h),void 0,"prehashed message"):h}function N(h,g,y){if(["recovered","canonical"].some(j=>j in y))throw new Error("sign() legacy options not supported");const{lowS:_,prehash:R,extraEntropy:A}=yc(y,v);h=M(h,R);const E=$(h),L=Na(s,g),O=[B(L),B(E)];if(A!=null&&A!==!1){const j=A===!0?n(b.secretKey):A;O.push(lr("extraEntropy",j))}const U=ii(...O),X=E;function J(j){const q=k(j);if(!s.isValidNot0(q))return;const V=s.inv(q),ee=t.BASE.multiply(q).toAffine(),ne=s.create(ee.x);if(ne===Cn)return;const W=s.create(V*s.create(X+ne*L));if(W===Cn)return;let z=(ee.x===ne?0:2)|Number(ee.y&Fa),ae=W;return _&&I(W)&&(ae=s.neg(W),z^=1),new C(ne,ae,z)}return{seed:U,k2sig:J}}function P(h,g,y={}){h=lr("message",h);const{seed:_,k2sig:R}=N(h,g,y);return h8(e.outputLen,s.BYTES,a)(_,R)}function x(h){let g;const y=typeof h=="string"||pf(h),_=!y&&h!==null&&typeof h=="object"&&typeof h.r=="bigint"&&typeof h.s=="bigint";if(!y&&!_)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(_)g=new C(h.r,h.s);else if(y){try{g=C.fromBytes(lr("sig",h),"der")}catch(R){if(!(R instanceof wn.Err))throw R}if(!g)try{g=C.fromBytes(lr("sig",h),"compact")}catch{return!1}}return g||!1}function d(h,g,y,_={}){const{lowS:R,prehash:A,format:E}=yc(_,v);if(y=lr("publicKey",y),g=M(lr("message",g),A),"strict"in _)throw new Error("options.strict was renamed to lowS");const L=E===void 0?x(h):C.fromBytes(lr("sig",h),E);if(L===!1)return!1;try{const O=t.fromBytes(y);if(R&&L.hasHighS())return!1;const{r:U,s:X}=L,J=$(g),j=s.inv(X),q=s.create(J*j),V=s.create(U*j),ee=t.BASE.multiplyUnsafe(q).add(O.multiplyUnsafe(V));return ee.is0()?!1:s.create(ee.x)===U}catch{return!1}}function m(h,g,y={}){const{prehash:_}=yc(y,v);return g=M(g,_),C.fromBytes(h,"recovered").recoverPublicKey(g).toBytes()}return Object.freeze({keygen:u,getPublicKey:f,getSharedSecret:l,utils:p,lengths:b,Point:t,sign:P,verify:d,recoverPublicKey:m,Signature:C,hash:e})}function L8(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp;let n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(s=>Math.ceil(s/2)))):void 0;const a=Si(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),i={Fp:r,Fn:a,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function N8(t){const{CURVE:e,curveOpts:r}=L8(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function k8(t,e){const r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,o2(r.Fn.ORDER,r.Fn.BITS))})}function C8(t){const{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:a}=N8(t),i=P8(e,r),s=O8(i,n,a);return k8(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function yf(t,e){const r=n=>C8({...t,hash:n});return{...r(e),create:r}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const od={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},U8={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},a1=BigInt(2);function D8(t){const e=od.p,r=BigInt(3),n=BigInt(6),a=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),c=BigInt(88),u=t*t*t%e,f=u*u*t%e,l=Er(f,r,e)*f%e,p=Er(l,r,e)*f%e,b=Er(p,a1,e)*u%e,v=Er(b,a,e)*b%e,w=Er(v,i,e)*v%e,I=Er(w,o,e)*w%e,S=Er(I,c,e)*I%e,T=Er(S,o,e)*w%e,C=Er(T,r,e)*f%e,k=Er(C,s,e)*v%e,$=Er(k,n,e)*u%e,G=Er($,a1,e);if(!S0.eql(S0.sqr(G),t))throw new Error("Cannot find square root");return G}const S0=Si(od.p,{sqrt:D8}),H8=yf({...od,Fp:S0,lowS:!0,endo:U8},Wv);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const m2={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),G
vendor: 23,266 bytes, lines 1-6
1y:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},y2={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},v2={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},F8=Si(m2.p),q8=Si(y2.p),$8=Si(v2.p),K8=yf({...m2,Fp:F8,lowS:!1},Wv);yf({...y2,Fp:q8,lowS:!1},f8);yf({...v2,Fp:$8,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},o8);var s1=typeof Up<"u"?Up:typeof self<"u"?self:typeof window<"u"?window:{},Qr=[],Ir=[],G8=typeof Uint8Array<"u"?Uint8Array:Array,fd=!1;function w2(){fd=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,r=t.length;e<r;++e)Qr[e]=t[e],Ir[t.charCodeAt(e)]=e;Ir[45]=62,Ir[95]=63}function j8(t){fd||w2();var e,r,n,a,i,s,o=t.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i=t[o-2]==="="?2:t[o-1]==="="?1:0,s=new G8(o*3/4-i),n=i>0?o-4:o;var c=0;for(e=0,r=0;e<n;e+=4,r+=3)a=Ir[t.charCodeAt(e)]<<18|Ir[t.charCodeAt(e+1)]<<12|Ir[t.charCodeAt(e+2)]<<6|Ir[t.charCodeAt(e+3)],s[c++]=a>>16&255,s[c++]=a>>8&255,s[c++]=a&255;return i===2?(a=Ir[t.charCodeAt(e)]<<2|Ir[t.charCodeAt(e+1)]>>4,s[c++]=a&255):i===1&&(a=Ir[t.charCodeAt(e)]<<10|Ir[t.charCodeAt(e+1)]<<4|Ir[t.charCodeAt(e+2)]>>2,s[c++]=a>>8&255,s[c++]=a&255),s}function V8(t){return Qr[t>>18&63]+Qr[t>>12&63]+Qr[t>>6&63]+Qr[t&63]}function z8(t,e,r){for(var n,a=[],i=e;i<r;i+=3)n=(t[i]<<16)+(t[i+1]<<8)+t[i+2],a.push(V8(n));return a.join("")}function o1(t){fd||w2();for(var e,r=t.length,n=r%3,a="",i=[],s=16383,o=0,c=r-n;o<c;o+=s)i.push(z8(t,o,o+s>c?c:o+s));return n===1?(e=t[r-1],a+=Qr[e>>2],a+=Qr[e<<4&63],a+="=="):n===2&&(e=(t[r-2]<<8)+t[r-1],a+=Qr[e>>10],a+=Qr[e>>4&63],a+=Qr[e<<2&63],a+="="),i.push(a),i.join("")}function vf(t,e,r,n,a){var i,s,o=a*8-n-1,c=(1<<o)-1,u=c>>1,f=-7,l=r?a-1:0,p=r?-1:1,b=t[e+l];for(l+=p,i=b&(1<<-f)-1,b>>=-f,f+=o;f>0;i=i*256+t[e+l],l+=p,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=s*256+t[e+l],l+=p,f-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(b?-1:1)*s*Math.pow(2,i-n)}function _2(t,e,r,n,a,i){var s,o,c,u=i*8-a-1,f=(1<<u)-1,l=f>>1,p=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:i-1,v=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+l>=1?e+=p/c:e+=p*Math.pow(2,1-l),e*c>=2&&(s++,c/=2),s+l>=f?(o=0,s=f):s+l>=1?(o=(e*c-1)*Math.pow(2,a),s=s+l):(o=e*Math.pow(2,l-1)*Math.pow(2,a),s=0));a>=8;t[r+b]=o&255,b+=v,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;t[r+b]=s&255,b+=v,s/=256,u-=8);t[r+b-v]|=w*128}var W8={}.toString,E2=Array.isArray||function(t){return W8.call(t)=="[object Array]"};/*!
2 * The buffer module from node.js, for the browser.
3 *
4 * @author   Feross Aboukhadijeh <[email protected]> <http://feross.org>
5 * @license  MIT
6 */var Z8=50;me.TYPED_ARRAY_SUPPORT=s1.TYPED_ARRAY_SUPPORT!==void 0?s1.TYPED_ARRAY_SUPPORT:!0;zo();function zo(){return me.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Un(t,e){if(zo()<e)throw new RangeError("Invalid typed array length");return me.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=me.prototype):(t===null&&(t=new me(e)),t.length=e),t}function me(t,e,r){if(!me.TYPED_ARRAY_SUPPORT&&!(this instanceof me))return new me(t,e,r);if(typeof t=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return cd(this,t)}return S2(this,t,e,r)}me.poolSize=8192;me._augment=function(t){return t.__proto__=me.prototype,t};function S2(t,e,r,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?J8(t,e,r,n):typeof e=="string"?X8(t,e,r):Q8(t,e)}me.from=function(t,e,r){return S2(null,t,e,r)};me.TYPED_ARRAY_SUPPORT&&(me.prototype.__proto__=Uint8Array.prototype,me.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&me[Symbol.species]);function x2(t){if(typeof t!="number")throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Y8(t,e,r,n){return x2(e),e<=0?Un(t,e):r!==void 0?typeof n=="string"?Un(t,e).fill(r,n):Un(t,e).fill(r):Un(t,e)}me.alloc=function(t,e,r){return Y8(null,t,e,r)};function cd(t,e){if(x2(e),t=Un(t,e<0?0:ud(e)|0),!me.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}me.allocUnsafe=function(t){return cd(null,t)};me.allocUnsafeSlow=function(t){return cd(null,t)};function X8(t,e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!me.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=A2(e,r)|0;t=Un(t,n);var a=t.write(e,r);return a!==n&&(t=t.slice(0,a)),t}function x0(t,e){var r=e.length<0?0:ud(e.length)|0;t=Un(t,r);for(var n=0;n<r;n+=1)t[n]=e[n]&255;return t}function J8(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return r===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,r):e=new Uint8Array(e,r,n),me.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=me.prototype):t=x0(t,e),t}function Q8(t,e){if(sn(e)){var r=ud(e.length)|0;return t=Un(t,r),t.length===0||e.copy(t,0,0,r),t}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||y4(e.length)?Un(t,0):x0(t,e);if(e.type==="Buffer"&&E2(e.data))return x0(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ud(t){if(t>=zo())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zo().toString(16)+" bytes");return t|0}me.isBuffer=v4;function sn(t){return!!(t!=null&&t._isBuffer)}me.compare=function(e,r){if(!sn(e)||!sn(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,a=r.length,i=0,s=Math.min(n,a);i<s;++i)if(e[i]!==r[i]){n=e[i],a=r[i];break}return n<a?-1:a<n?1:0};me.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};me.concat=function(e,r){if(!E2(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return me.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var a=me.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){var s=e[n];if(!sn(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(a,i),i+=s.length}return a};function A2(t,e){if(sn(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var r=t.length;if(r===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Wo(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return O2(t).length;default:if(n)return Wo(t).length;e=(""+e).toLowerCase(),n=!0}}me.byteLength=A2;function e4(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return u4(this,e,r);case"utf8":case"utf-8":return B2(this,e,r);case"ascii":return f4(this,e,r);case"latin1":case"binary":return c4(this,e,r);case"base64":return s4(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h4(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}me.prototype._isBuffer=!0;function na(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}me.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)na(this,r,r+1);return this};me.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)na(this,r,r+3),na(this,r+1,r+2);return this};me.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)na(this,r,r+7),na(this,r+1,r+6),na(this,r+2,r+5),na(this,r+3,r+4);return this};me.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?B2(this,0,e):e4.apply(this,arguments)};me.prototype.equals=function(e){if(!sn(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:me.compare(this,e)===0};me.prototype.inspect=function(){var e="",r=Z8;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"};me.prototype.compare=function(e,r,n,a,i){if(!sn(e))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),a===void 0&&(a=0),i===void 0&&(i=this.length),r<0||n>e.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&r>=n)return 0;if(a>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,a>>>=0,i>>>=0,this===e)return 0;for(var s=i-a,o=n-r,c=Math.min(s,o),u=this.slice(a,i),f=e.slice(r,n),l=0;l<c;++l)if(u[l]!==f[l]){s=u[l],o=f[l];break}return s<o?-1:o<s?1:0};function R2(t,e,r,n,a){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof e=="string"&&(e=me.from(e,n)),sn(e))return e.length===0?-1:f1(t,e,r,n,a);if(typeof e=="number")return e=e&255,me.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):f1(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function f1(t,e,r,n,a){var i=1,s=t.length,o=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,s/=2,o/=2,r/=2}function c(b,v){return i===1?b[v]:b.readUInt16BE(v*i)}var u;if(a){var f=-1;for(u=r;u<s;u++)if(c(t,u)===c(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===o)return f*i}else f!==-1&&(u-=u-f),f=-1}else for(r+o>s&&(r=s-o),u=r;u>=0;u--){for(var l=!0,p=0;p<o;p++)if(c(t,u+p)!==c(e,p)){l=!1;break}if(l)return u}return-1}me.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};me.prototype.indexOf=function(e,r,n){return R2(this,e,r,n,!0)};me.prototype.lastIndexOf=function(e,r,n){return R2(this,e,r,n,!1)};function t4(t,e,r,n){r=Number(r)||0;var a=t.length-r;n?(n=Number(n),n>a&&(n=a)):n=a;var i=e.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var o=parseInt(e.substr(s*2,2),16);if(isNaN(o))return s;t[r+s]=o}return s}function r4(t,e,r,n){return Ef(Wo(e,t.length-r),t,r,n)}function I2(t,e,r,n){return Ef(b4(e),t,r,n)}function n4(t,e,r,n){return I2(t,e,r,n)}function i4(t,e,r,n){return Ef(O2(e),t,r,n)}function a4(t,e,r,n){return Ef(m4(e,t.length-r),t,r,n)}me.prototype.write=function(e,r,n,a){if(r===void 0)a="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")a=r,n=this.length,r=0;else if(isFinite(r))r=r|0,isFinite(n)?(n=n|0,a===void 0&&(a="utf8")):(a=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var s=!1;;)switch(a){case"hex":return t4(this,e,r,n);case"utf8":case"utf-8":return r4(this,e,r,n);case"ascii":return I2(this,e,r,n);case"latin1":case"binary":return n4(this,e,r,n);case"base64":return i4(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a4(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),s=!0}};me.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function s4(t,e,r){return e===0&&r===t.length?o1(t):o1(t.slice(e,r))}function B2(t,e,r){r=Math.min(t.length,r);for(var n=[],a=e;a<r;){var i=t[a],s=null,o=i>239?4:i>223?3:i>191?2:1;if(a+o<=r){var c,u,f,l;switch(o){case 1:i<128&&(s=i);break;case 2:c=t[a+1],(c&192)===128&&(l=(i&31)<<6|c&63,l>127&&(s=l));break;case 3:c=t[a+1],u=t[a+2],(c&192)===128&&(u&192)===128&&(l=(i&15)<<12|(c&63)<<6|u&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:c=t[a+1],u=t[a+2],f=t[a+3],(c&192)===128&&(u&192)===128&&(f&192)===128&&(l=(i&15)<<18|(c&63)<<12|(u&63)<<6|f&63,l>65535&&l<1114112&&(s=l))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),a+=o}return o4(n)}var c1=4096;function o4(t){var e=t.length;if(e<=c1)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=c1));return r}function f4(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]&127);return n}function c4(t,e,r){var n="";r=Math.min(t.length,r);for(var a=e;a<r;++a)n+=String.fromCharCode(t[a]);return n}function u4(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var a="",i=e;i<r;++i)a+=g4(t[i]);return a}function h4(t,e,r){for(var n=t.slice(e,r),a="",i=0;i<n.length;i+=2)a+=String.fromCharCode(n[i]+n[i+1]*256);return a}me.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var a;if(me.TYPED_ARRAY_SUPPORT)a=this.subarray(e,r),a.__proto__=me.prototype;else{var i=r-e;a=new me(i,void 0);for(var s=0;s<i;++s)a[s]=this[s+e]}return a};function Xt(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}me.prototype.readUIntLE=function(e,r,n){e=e|0,r=r|0,n||Xt(e,r,this.length);for(var a=this[e],i=1,s=0;++s<r&&(i*=256);)a+=this[e+s]*i;return a};me.prototype.readUIntBE=function(e,r,n){e=e|0,r=r|0,n||Xt(e,r,this.length);for(var a=this[e+--r],i=1;r>0&&(i*=256);)a+=this[e+--r]*i;return a};me.prototype.readUInt8=function(e,r){return r||Xt(e,1,this.length),this[e]};me.prototype.readUInt16LE=function(e,r){return r||Xt(e,2,this.length),this[e]|this[e+1]<<8};me.prototype.readUInt16BE=function(e,r){return r||Xt(e,2,this.length),this[e]<<8|this[e+1]};me.prototype.readUInt32LE=function(e,r){return r||Xt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};me.prototype.readUInt32BE=function(e,r){return r||Xt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};me.prototype.readIntLE=function(e,r,n){e=e|0,r=r|0,n||Xt(e,r,this.length);for(var a=this[e],i=1,s=0;++s<r&&(i*=256);)a+=this[e+s]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};me.prototype.readIntBE=function(e,r,n){e=e|0,r=r|0,n||Xt(e,r,this.length);for(var a=r,i=1,s=this[e+--a];a>0&&(i*=256);)s+=this[e+--a]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*r)),s};me.prototype.readInt8=function(e,r){return r||Xt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};me.prototype.readInt16LE=function(e,r){r||Xt(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};me.prototype.readInt16BE=function(e,r){r||Xt(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};me.prototype.readInt32LE=function(e,r){return r||Xt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};me.prototype.readInt32BE=function(e,r){return r||Xt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};me.prototype.readFloatLE=function(e,r){return r||Xt(e,4,this.length),vf(this,e,!0,23,4)};me.prototype.readFloatBE=function(e,r){return r||Xt(e,4,this.length),vf(this,e,!1,23,4)};me.prototype.readDoubleLE=function(e,r){return r||Xt(e,8,this.length),vf(this,e,!0,52,8)};me.prototype.readDoubleBE=function(e,r){return r||Xt(e,8,this.length),vf(this,e,!1,52,8)};function gr(t,e,r,n,a,i){if(!sn(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}me.prototype.writeUIntLE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var i=Math.pow(2,8*n)-1;gr(this,e,r,n,i,0)}var s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};me.prototype.writeUIntBE=function(e,r,n,a){if(e=+e,r=r|0,n=n|0,!a){var i=Math.pow(2,8*n)-1;gr(this,e,r,n,i,0)}var s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};me.prototype.writeUInt8=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,1,255,0),me.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=e&255,r+1};function wf(t,e,r,n){e<0&&(e=65535+e+1);for(var a=0,i=Math.min(t.length-r,2);a<i;++a)t[r+a]=(e&255<<8*(n?a:1-a))>>>(n?a:1-a)*8}me.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,2,65535,0),me.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):wf(this,e,r,!0),r+2};me.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,2,65535,0),me.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):wf(this,e,r,!1),r+2};function _f(t,e,r,n){e<0&&(e=4294967295+e+1);for(var a=0,i=Math.min(t.length-r,4);a<i;++a)t[r+a]=e>>>(n?a:3-a)*8&255}me.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,4,4294967295,0),me.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255):_f(this,e,r,!0),r+4};me.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,4,4294967295,0),me.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):_f(this,e,r,!1),r+4};me.prototype.writeIntLE=function(e,r,n,a){if(e=+e,r=r|0,!a){var i=Math.pow(2,8*n-1);gr(this,e,r,n,i-1,-i)}var s=0,o=1,c=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&c===0&&this[r+s-1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};me.prototype.writeIntBE=function(e,r,n,a){if(e=+e,r=r|0,!a){var i=Math.pow(2,8*n-1);gr(this,e,r,n,i-1,-i)}var s=n-1,o=1,c=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&c===0&&this[r+s+1]!==0&&(c=1),this[r+s]=(e/o>>0)-c&255;return r+n};me.prototype.writeInt8=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,1,127,-128),me.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=e&255,r+1};me.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,2,32767,-32768),me.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8):wf(this,e,r,!0),r+2};me.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,2,32767,-32768),me.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=e&255):wf(this,e,r,!1),r+2};me.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,4,2147483647,-2147483648),me.TYPED_ARRAY_SUPPORT?(this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):_f(this,e,r,!0),r+4};me.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r|0,n||gr(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),me.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255):_f(this,e,r,!1),r+4};function T2(t,e,r,n,a,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function P2(t,e,r,n,a){return a||T2(t,e,r,4),_2(t,e,r,n,23,4),r+4}me.prototype.writeFloatLE=function(e,r,n){return P2(this,e,r,!0,n)};me.prototype.writeFloatBE=function(e,r,n){return P2(this,e,r,!1,n)};function M2(t,e,r,n,a){return a||T2(t,e,r,8),_2(t,e,r,n,52,8),r+8}me.prototype.writeDoubleLE=function(e,r,n){return M2(this,e,r,!0,n)};me.prototype.writeDoubleBE=function(e,r,n){return M2(this,e,r,!1,n)};me.prototype.copy=function(e,r,n,a){if(n||(n=0),!a&&a!==0&&(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<n&&(a=n),a===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-n&&(a=e.length-r+n);var i=a-n,s;if(this===e&&n<r&&r<a)for(s=i-1;s>=0;--s)e[s+r]=this[s+n];else if(i<1e3||!me.TYPED_ARRAY_SUPPORT)for(s=0;s<i;++s)e[s+r]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),r);return i};me.prototype.fill=function(e,r,n,a){if(typeof e=="string"){if(typeof r=="string"?(a=r,r=0,n=this.length):typeof n=="string"&&(a=n,n=this.length),e.length===1){var i=e.charCodeAt(0);i<256&&(e=i)}if(a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!me.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{var o=sn(e)?e:Wo(new me(e,a).toString()),c=o.length;for(s=0;s<n-r;++s)this[s+r]=o[s%c]}return this};var l4=/[^+\/0-9A-Za-z-_]/g;function d4(t){if(t=p4(t).replace(l4,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function p4(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function g4(t){return t<16?"0"+t.toString(16):t.toString(16)}function Wo(t,e){e=e||1/0;for(var r,n=t.length,a=null,i=[],s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>
66&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function b4(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function m4(t,e){for(var r,n,a,i=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,a=r%256,i.push(a),i.push(n);return i}function O2(t){return j8(d4(t))}function Ef(t,e,r,n){for(var a=0;a<n&&!(a+r>=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function y4(t){return t!==t}function v4(t){return t!=null&&(!!t._isBuffer||L2(t)||w4(t))}function L2(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function w4(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&L2(t.slice(0,0))}var re;(function(t){t.BlockHash="B",t.OperationHash="o",t.OperationListHash="Lo",t.OperationListListHash="LLo",t.ProtocolHash="P",t.ContextHash="Co",t.BlockMetadataHash="bm",t.OperationMetadataHash="r",t.OperationMetadataListHash="Lr",t.OperationMetadataListListHash="LLr",t.Ed25519PublicKeyHash="tz1",t.Secp256k1PublicKeyHash="tz2",t.P256PublicKeyHash="tz3",t.ContractHash="KT1",t.BlindedPublicKeyHash="btz1",t.BLS12_381PublicKeyHash="tz4",t.TXRollupAddress="txr1",t.ZkRollupHash="epx1",t.ScRollupHash="scr1",t.SmartRollupHash="sr1",t.CryptoboxPublicKeyHash="id",t.Ed25519Seed="edsk",t.Ed25519PublicKey="edpk",t.Secp256k1SecretKey="spsk",t.P256SecretKey="p2sk",t.BLS12_381SecretKey="BLsk",t.ValueHash="vh",t.CycleNonce="nce",t.ScriptExpr="expr",t.InboxHash="txi",t.MessageHash="txm",t.CommitmentHash="txc",t.MessageResultHash="txmr",t.MessageResultListHash="txM",t.WithdrawListHash="txw",t.ScRollupStateHash="scs1",t.ScRollupCommitmentHash="scc1",t.SmartRollupStateHash="srs1",t.SmartRollupCommitmentHash="src1",t.Ed25519EncryptedSeed="edesk",t.Secp256k1EncryptedSecretKey="spesk",t.P256EncryptedSecretKey="p2esk",t.BLS12_381EncryptedSecretKey="BLesk",t.Secp256k1EncryptedScalar="seesk",t.Secp256k1PublicKey="sppk",t.P256PublicKey="p2pk",t.Secp256k1Scalar="SSp",t.Secp256k1Element="GSp",t.Ed25519SecretKey="_edsk",t.Ed25519Signature="edsig",t.Secp256k1Signature="spsig1",t.P256Signature="p2sig",t.GenericSignature="sig",t.ChainID="Net",t.SaplingSpendingKey="sask",t.EncryptedSaplingSpendingKey="_sask",t.SaplingAddress="zet1",t.GenericAggregateSignature="asig",t.BLS12_381Signature="BLsig",t.BLS12_381PublicKey="BLpk",t.SlotHeader="sh"})(re||(re={}));const N2={[re.BlockHash]:new Uint8Array([1,52]),[re.OperationHash]:new Uint8Array([5,116]),[re.OperationListHash]:new Uint8Array([133,233]),[re.OperationListListHash]:new Uint8Array([29,159,109]),[re.ProtocolHash]:new Uint8Array([2,170]),[re.ContextHash]:new Uint8Array([79,199]),[re.BlockMetadataHash]:new Uint8Array([234,249]),[re.OperationMetadataHash]:new Uint8Array([5,183]),[re.OperationMetadataListHash]:new Uint8Array([134,39]),[re.OperationMetadataListListHash]:new Uint8Array([29,159,182]),[re.Ed25519PublicKeyHash]:new Uint8Array([6,161,159]),[re.Secp256k1PublicKeyHash]:new Uint8Array([6,161,161]),[re.P256PublicKeyHash]:new Uint8Array([6,161,164]),[re.ContractHash]:new Uint8Array([2,90,121]),[re.BlindedPublicKeyHash]:new Uint8Array([1,2,49,223]),[re.BLS12_381PublicKeyHash]:new Uint8Array([6,161,166]),[re.TXRollupAddress]:new Uint8Array([1,128,120,31]),[re.ZkRollupHash]:new Uint8Array([1,23,224,125]),[re.ScRollupHash]:new Uint8Array([1,118,132,217]),[re.SmartRollupHash]:new Uint8Array([6,124,117]),[re.CryptoboxPublicKeyHash]:new Uint8Array([153,103]),[re.Ed25519Seed]:new Uint8Array([13,15,58,7]),[re.Ed25519PublicKey]:new Uint8Array([13,15,37,217]),[re.Secp256k1SecretKey]:new Uint8Array([17,162,224,201]),[re.P256SecretKey]:new Uint8Array([16,81,238,189]),[re.BLS12_381SecretKey]:new Uint8Array([3,150,192,40]),[re.ValueHash]:new Uint8Array([1,106,242]),[re.CycleNonce]:new Uint8Array([69,220,169]),[re.ScriptExpr]:new Uint8Array([13,44,64,27]),[re.InboxHash]:new Uint8Array([79,148,196]),[re.MessageHash]:new Uint8Array([79,149,30]),[re.CommitmentHash]:new Uint8Array([79,148,17]),[re.MessageResultHash]:new Uint8Array([18,7,206,87]),[re.MessageResultListHash]:new Uint8Array([79,146,82]),[re.WithdrawListHash]:new Uint8Array([79,150,72]),[re.ScRollupStateHash]:new Uint8Array([17,144,122,202]),[re.ScRollupCommitmentHash]:new Uint8Array([17,144,21,100]),[re.SmartRollupStateHash]:new Uint8Array([17,165,235,240]),[re.SmartRollupCommitmentHash]:new Uint8Array([17,165,134,138]),[re.Ed25519EncryptedSeed]:new Uint8Array([7,90,60,179,41]),[re.Secp256k1EncryptedSecretKey]:new Uint8Array([9,237,241,174,150]),[re.P256EncryptedSecretKey]:new Uint8Array([9,48,57,115,171]),[re.BLS12_381EncryptedSecretKey]:new Uint8Array([2,5,30,53,25]),[re.Secp256k1EncryptedScalar]:new Uint8Array([1,131,36,86,248]),[re.Secp256k1PublicKey]:new Uint8Array([3,254,226,86]),[re.P256PublicKey]:new Uint8Array([3,178,139,127]),[re.Secp256k1Scalar]:new Uint8Array([38,248,136]),[re.Secp256k1Element]:new Uint8Array([5,92,0]),[re.Ed25519SecretKey]:new Uint8Array([43,246,78,7]),[re.Ed25519Signature]:new Uint8Array([9,245,205,134,18]),[re.Secp256k1Signature]:new Uint8Array([13,115,101,19,63]),[re.P256Signature]:new Uint8Array([54,240,44,52]),[re.GenericSignature]:new Uint8Array([4,130,43]),[re.ChainID]:new Uint8Array([87,82,0]),[re.SaplingSpendingKey]:new Uint8Array([11,237,20,92]),[re.EncryptedSaplingSpendingKey]:new Uint8Array([11,237,20,92]),[re.SaplingAddress]:new Uint8Array([18,71,40,223]),[re.GenericAggregateSignature]:new Uint8Array([2,75,234,101]),[re.BLS12_381Signature]:new Uint8Array([40,171,64,207]),[re.BLS12_381PublicKey]:new Uint8Array([6,149,135,204]),[re.SlotHeader]:new Uint8Array([2,116,180])}
6,Zo={[re.BlockHash]:32,[re.OperationHash]:32,[re.OperationListHash]:32,[re.OperationListListHash]:32,[re.ProtocolHash]:32,[re.ContextHash]:32,[re.BlockMetadataHash]:32,[re.OperationMetadataHash]:32,[re.OperationMetadataListHash]:32,[re.OperationMetadataListListHash]:32,[re.Ed25519PublicKeyHash]:20,[re.Secp256k1PublicKeyHash]:20,[re.P256PublicKeyHash]:20,[re.ContractHash]:20,[re.BlindedPublicKeyHash]:20,[re.BLS12_381PublicKeyHash]:20,[re.TXRollupAddress]:20,[re.ZkRollupHash]:20,[re.ScRollupHash]:20,[re.SmartRollupHash]:20,[re.CryptoboxPublicKeyHash]:16,[re.Ed25519Seed]:32,[re.Ed25519PublicKey]:32,[re.Secp256k1SecretKey]:32,[re.P256SecretKey]:32,[re.BLS12_381SecretKey]:32,[re.ValueHash]:32,[re.CycleNonce]:32,[re.ScriptExpr]:32,[re.InboxHash]:32,[re.MessageHash]:32,[re.CommitmentHash]:32,[re.MessageResultHash]:32,[re.MessageResultListHash]:32,[re.WithdrawListHash]:32,[re.ScRollupStateHash]:32,[re.ScRollupCommitmentHash]:32,[re.SmartRollupStateHash]:32,[re.SmartRollupCommitmentHash]:32,[re.Ed25519EncryptedSeed]:56,[re.Secp256k1EncryptedSecretKey]:56,[re.P256EncryptedSecretKey]:56,[re.BLS12_381EncryptedSecretKey]:56,[re.Secp256k1EncryptedScalar]:60,[re.Secp256k1PublicKey]:33,[re.P256PublicKey]:33,[re.Secp256k1Scalar]:33,[re.Secp256k1Element]:33,[re.Ed25519SecretKey]:64,[re.Ed25519Signature]:64,[re.Secp256k1Signature]:64,[re.P256Signature]:64,[re.GenericSignature]:64,[re.ChainID]:4,[re.SaplingSpendingKey]:169,[re.EncryptedSaplingSpendingKey]:193,[re.SaplingAddress]:43,[re.GenericAggregateSignature]:96,[re.BLS12_381Signature]:96,[re.BLS12_381PublicKey]:48,[re.SlotHeader]:48};/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _4(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function A0(t,e=""){if(!Number.isSafeInteger(t)||t<0){const r=e&&`"${e}" `;throw new Error(`${r}expected integer >= 0, got ${t}`)}}function la(t,e,r=""){const n=_4(t),a=t?.length,i=e!==void 0;if(!n||i&&a!==e){const s=r&&`"${r}" `,o=i?` of length ${e}`:"",c=n?`length=${a}`:`type=${typeof t}`;throw new Error(s+"expected Uint8Array"+o+", got "+c)}return t}function u1(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function E4(t,e){la(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function Yo(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function R0(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const k2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function C2(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const bn=k2?t=>t:t=>C2(t);function S4(t){for(let e=0;e<t.length;e++)t[e]=C2(t[e]);return t}const Ta=k2?t=>t:S4;function x4(t,e={}){const r=(a,i)=>t(i).update(a).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=a=>t(a),Object.assign(r,e),Object.freeze(r)}const A4=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),oo=BigInt(2**32-1),h1=BigInt(32);function R4(t,e=!1){return e?{h:Number(t&oo),l:Number(t>>h1&oo)}:{h:Number(t>>h1&oo)|0,l:Number(t&oo)|0}}const U2=(t,e,r)=>t>>>r|e<<32-r,D2=(t,e,r)=>t<<32-r|e>>>r,I4=(t,e,r)=>t<<64-r|e>>>r-32,B4=(t,e,r)=>t>>>r-32|e<<64-r,T4=(t,e)=>e,P4=(t,e)=>t;function H2(t,e,r,n){const a=(e>>>0)+(n>>>0);return{h:t+r+(a/2**32|0)|0,l:a|0}}const F2=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),q2=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,$t=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Ae=new Uint32Array(32);function Yn(t,e,r,n,a,i){const s=a[i],o=a[i+1];let c=Ae[2*t],u=Ae[2*t+1],f=Ae[2*e],l=Ae[2*e+1],p=Ae[2*r],b=Ae[2*r+1],v=Ae[2*n],w=Ae[2*n+1],I=F2(c,f,s);u=q2(I,u,l,o),c=I|0,{Dh:w,Dl:v}={Dh:w^u,Dl:v^c},{Dh:w,Dl:v}={Dh:T4(w,v),Dl:P4(w)},{h:b,l:p}=H2(b,p,w,v),{Bh:l,Bl:f}
6={Bh:l^b,Bl:f^p},{Bh:l,Bl:f}={Bh:U2(l,f,24),Bl:D2(l,f,24)},Ae[2*t]=c,Ae[2*t+1]=u,Ae[2*e]=f,Ae[2*e+1]=l,Ae[2*r]=p,Ae[2*r+1]=b,Ae[2*n]=v,Ae[2*n+1]=w}function Xn(t,e,r,n,a,i){const s=a[i],o=a[i+1];let c=Ae[2*t],u=Ae[2*t+1],f=Ae[2*e],l=Ae[2*e+1],p=Ae[2*r],b=Ae[2*r+1],v=Ae[2*n],w=Ae[2*n+1],I=F2(c,f,s);u=q2(I,u,l,o),c=I|0,{Dh:w,Dl:v}={Dh:w^u,Dl:v^c},{Dh:w,Dl:v}={Dh:U2(w,v,16),Dl:D2(w,v,16)},{h:b,l:p}=H2(b,p,w,v),{Bh:l,Bl:f}={Bh:l^b,Bl:f^p},{Bh:l,Bl:f}={Bh:I4(l,f,63),Bl:B4(l,f,63)},Ae[2*t]=c,Ae[2*t+1]=u,Ae[2*e]=f,Ae[2*e+1]=l,Ae[2*r]=p,Ae[2*r+1]=b,Ae[2*n]=v,Ae[2*n+1]=w}function M4(t,e={},r,n,a){if(A0(r),t<0||t>r)throw new Error("outputLen bigger than keyLen");const{key:i,salt:s,personalization:o}=e;if(i!==void 0&&(i.length<1||i.length>r))throw new Error('"key" expected to be undefined or of length=1..'+r);s!==void 0&&la(s,n,"salt"),o!==void 0&&la(o,a,"personalization")}let O4=class{buffer;buffer32;finished=!1;destroyed=!1;length=0;pos=0;blockLen;outputLen;constructor(e,r){A0(e),A0(r),this.blockLen=e,this.outputLen=r,this.buffer=new Uint8Array(e),this.buffer32=Yo(this.buffer)}update(e){u1(this),la(e);const{blockLen:r,buffer:n,buffer32:a}=this,i=e.length,s=e.byteOffset,o=e.buffer;for(let c=0;c<i;){this.pos===r&&(Ta(a),this.compress(a,0,!1),Ta(a),this.pos=0);const u=Math.min(r-this.pos,i-c),f=s+c;if(u===r&&!(f%4)&&c+u<i){const l=new Uint32Array(o,f,Math.floor((i-c)/4));Ta(l);for(let p=0;c+r<i;p+=a.length,c+=r)this.length+=r,this.compress(l,p,!1);Ta(l);continue}n.set(e.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(e){u1(this),E4(e,this);const{pos:r,buffer32:n}=this;this.finished=!0,R0(this.buffer.subarray(r)),Ta(n),this.compress(n,0,!0),Ta(n);const a=Yo(e);this.get().forEach((i,s)=>a[s]=bn(i))}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){const{buffer:r,length:n,finished:a,destroyed:i,outputLen:s,pos:o}=this;return e||=new this.constructor({dkLen:s}),e.set(...this.get()),e.buffer.set(r),e.destroyed=i,e.finished=a,e.length=n,e.pos=o,e.outputLen=s,e}clone(){return this._cloneInto()}},L4=class extends O4{v0l=$t[0]|0;v0h=$t[1]|0;v1l=$t[2]|0;v1h=$t[3]|0;v2l=$t[4]|0;v2h=$t[5]|0;v3l=$t[6]|0;v3h=$t[7]|0;v4l=$t[8]|0;v4h=$t[9]|0;v5l=$t[10]|0;v5h=$t[11]|0;v6l=$t[12]|0;v6h=$t[13]|0;v7l=$t[14]|0;v7h=$t[15]|0;constructor(e={}){const r=e.dkLen===void 0?64:e.dkLen;super(128,r),M4(r,e,64,16,16);let{key:n,personalization:a,salt:i}=e,s=0;if(n!==void 0&&(la(n,void 0,"key"),s=n.length),this.v0l^=this.outputLen|s<<8|65536|1<<24,i!==void 0){la(i,void 0,"salt");const o=Yo(i);this.v4l^=bn(o[0]),this.v4h^=bn(o[1]),this.v5l^=bn(o[2]),this.v5h^=bn(o[3])}if(a!==void 0){la(a,void 0,"personalization");const o=Yo(a);this.v6l^=bn(o[0]),this.v6h^=bn(o[1]),this.v7l^=bn(o[2]),this.v7h^=bn(o[3])}if(n!==void 0){const o=new Uint8Array(this.blockLen);o.set(n),this.update(o)}}get(){let{v0l:e,v0h:r,v1l:n,v1h:a,v2l:i,v2h:s,v3l:o,v3h:c,v4l:u,v4h:f,v5l:l,v5h:p,v6l:b,v6h:v,v7l:w,v7h:I}=this;return[e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I]}set(e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I){this.v0l=e|0,this.v0h=r|0,this.v1l=n|0,this.v1h=a|0,this.v2l=i|0,this.v2h=s|0,this.v3l=o|0,this.v3h=c|0,this.v4l=u|0,this.v4h=f|0,this.v5l=l|0,this.v5h=p|0,this.v6l=b|0,this.v6h=v|0,this.v7l=w|0,this.v7h=I|0}compress(e,r,n){this.get().forEach((c,u)=>Ae[u]=c),Ae.set($t,16);let{h:a,l:i}=R4(BigInt(this.length));Ae[24]=$t[8]^i,Ae[25]=$t[9]^a,n&&(Ae[28]=~Ae[28],Ae[29]=~Ae[29]);let s=0;const o=A4;for(let c=0;c<12;c++)Yn(0,4,8,12,e,r+2*o[s++]),Xn(0,4,8,12,e,r+2*o[s++]),Yn(1,5,9,13,e,r+2*o[s++]),Xn(1,5,9,13,e,r+2*o[s++]),Yn(2,6,10,14,e,r+2*o[s++]),Xn(2,6,10,14,e,r+2*o[s++]),Yn(3,7,11,15,e,r+2*o[s++]),Xn(3,7,11,15,e,r+2*o[s++]),Yn(0,5,10,15,e,r+2*o[s++]),Xn(0,5,10,15,e,r+2*o[s++]),Yn(1,6,11,12,e,r+2*o[s++]),Xn(1,6,11,12,e,r+2*o[s++]),Yn(2,7,8,13,e,r+2*o[s++]),Xn(2,7,8,13,e,r+2*o[s++]),Yn(3,4,9,14,e,r+2*o[s++]),Xn(3,4,9,14,e,r+2*o[s++]);this.v0l^=Ae[0]^Ae[16],this.v0h^=Ae[1]^Ae[17],this.v1l^=Ae[2]^Ae[18],this.v1h^=Ae[3]^Ae[19],this.v2l^=Ae[4]^Ae[20],this.v2h^=Ae[5]^Ae[21],this.v3l^=Ae[6]^Ae[22],this.v3h^=Ae[7]^Ae[23],this.v4l^=Ae[8]^Ae[24],this.v4h^=Ae[9]^Ae[25],this.v5l^=Ae[10]^Ae[26],this.v5h^=Ae[11]^Ae[27],this.v6l^=Ae[12]^Ae[28],this.v6h^=Ae[13]^Ae[29],this.v7l^=Ae[14]^Ae[30],this.v7h^=Ae[15]^Ae[31],R0(Ae)}destroy(){this.destroyed=!0,R0(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const N4=x4(t=>new L4(t)),$2=[re.P256PublicKeyHash,re.Secp256k1PublicKeyHash,re.Ed25519PublicKeyHash,re.BLS12_381PublicKeyHash,re.ContractHash,re.SmartRollupHash],on=[re.P256PublicKey,re.Secp256k1PublicKey,re.Ed25519PublicKey,re.BLS12_381PublicKey],da=[re.P256PublicKeyHash,re.Secp256k1PublicKeyHash,re.Ed25519PublicKeyHash,re.BLS12_381PublicKeyHash],K2=[re.P256Signature,re.Secp256k1Signature,re.Ed25519Signature,re.BLS12_381Signature,re.GenericSignature];function At(t,e,r){const n=(()=>{try{return Hv.decode(t)}catch(i){throw i instanceof Error?i.message.includes("checksum")?new Ce(Se.INVALID_CHECKSUM):new Ce(Se.INVALID_ENCODING):i}})();let a;for(a in re){const i=re[a],s=N2[i];if(n.length===s.length+Zo[i]&&n.slice(0,s.length).every((o,c)=>o==s[c])){if(e!==void 0&&e.indexOf(i)<0)throw new Ce(Se.PREFIX_NOT_ALLOWED);return[n.slice(s.length),i]}}throw new Ce(Se.NO_PREFIX_MATCHED)}function k4(t,e){const[r,n]=At(t,on);let a;switch(n){case re.Ed25519PublicKey:a=0;break;case re.Secp256k1PublicKey:a=1;break;case re.P256PublicKey:a=2;break;case re.BLS12_381PublicKey:a=3;break;default:throw new h_(Se.NO_PREFIX_MATCHED)}const i=new Uint8Array(r.length+1);return i[0]=a,i.set(r,1),_r(i)}function I0(t,e){const[r,n]=At(t,da),a=new Uint8Array(21);let i;switch(n){case re.Ed25519PublicKeyHash:i=0;break;case re.Secp256k1PublicKeyHash:i=1;break;case re.P256PublicKeyHash:i=2;break;case re.BLS12_381PublicKeyHash:i=3;break;default:throw new st(t,Se.NO_PREFIX_MATCHED)}return a[0]=i,a.set(r,1),e!==void 0&&e==="array"?a:_r(a)}function Ss(t,e){const r=t.indexOf("%");r>
6=0&&(t=t.slice(0,r));const[n,a]=At(t,$2),i=new Uint8Array(22);if(a===re.ContractHash||a===re.SmartRollupHash||a===re.ZkRollupHash){let s;switch(a){case re.ContractHash:s=1;break;case re.SmartRollupHash:s=3;break;case re.ZkRollupHash:s=4;break}i[0]=s,i.set(n,1)}else{let s;switch(a){case re.Ed25519PublicKeyHash:s=0;break;case re.Secp256k1PublicKeyHash:s=1;break;case re.P256PublicKeyHash:s=2;break;case re.BLS12_381PublicKeyHash:s=3;break;default:throw new st(t,Se.NO_PREFIX_MATCHED)}i[0]=0,i[1]=s,i.set(n,2)}return e!==void 0&&e==="array"?i:_r(i)}function wr(t,e){const r=typeof t=="string"?qs(t):t,n=N2[e],a=new Uint8Array(n.length+r.length);return a.set(n),a.set(r,n.length),Hv.encode(me.from(a.buffer,a.byteOffset,a.byteLength))}function C4(t){let e;typeof t=="string"?e=qs(t):e=t;let r;switch(e[0]){case 0:r=re.Ed25519PublicKey;break;case 1:r=re.Secp256k1PublicKey;break;case 2:r=re.P256PublicKey;break;case 3:r=re.BLS12_381PublicKey;break;default:throw new Error("invalid address format")}return wr(e.slice(1),r)}function B0(t){let e;typeof t=="string"?e=qs(t):e=t;let r;switch(e[0]){case 0:r=re.Ed25519PublicKeyHash;break;case 1:r=re.Secp256k1PublicKeyHash;break;case 2:r=re.P256PublicKeyHash;break;case 3:r=re.BLS12_381PublicKeyHash;break;default:throw new Error("invalid address format")}return wr(e.slice(1,21),r)}function T0(t){let e;switch(typeof t=="string"?e=qs(t):e=t,e[0]){case 0:return B0(e.slice(1));case 1:return wr(e.slice(1,21),re.ContractHash);case 3:return wr(e.slice(1,21),re.SmartRollupHash);case 4:return wr(e.slice(1,21),re.ZkRollupHash);default:throw new Error("invalid address format")}}function U4(t){const e=N4(qs(t),{dkLen:32});return wr(e,re.ScriptExpr)}function qs(t){if(t=t.startsWith("0x")?t.slice(2):t,t.length%2!==0)throw new Es(t,"Expecting even number of characters");if(!t.match(/^([\da-f]{2})*$/gi))throw new Es(t,"Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const e=new Uint8Array(t.length/2);let r=0;for(let n=0;n<t.length;n+=2){const a=t.slice(n,n+2),i=parseInt(a,16);if(Number.isNaN(i))throw new Es(t,"Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");e[r++]=i}return e}function vI(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function _r(t){return Array.from(t).map(e=>(e>>4&15).toString(16)+(e&15).toString(16)).join("")}function l1(t){return t.startsWith("0x")?t.slice(2):t}function P0(t){const e=t.indexOf("%");return e>=0?[t.slice(0,e),t.slice(e)]:[t,null]}function $s(t,e){let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;const n=r<t.length?t[r]:0,a=r<e.length?e[r]:0;return n<a?-1:n>a?1:0}function $n(t,e){try{At(t,e)}catch(r){return r instanceof Ce&&r.result!==void 0?r.result:Se.OTHER}return Se.VALID}function it(t){const[e]=P0(t??"");return $n(e,$2)}function G2(t){return $n(t,[re.ChainID])}function pa(t){return $n(t,[re.ContractHash])}function hd(t){return $n(t,da)}function D4(t){return $n(t,K2)}function H4(t){return $n(t,on)}function j2(t){return $n(t,[re.OperationHash])}function F4(t){return $n(t,[re.ProtocolHash])}function V2(t){return $n(t,[re.BlockHash])}class q4 extends Ce{constructor(e,r){super(`The protocol hash '${e}' is invalid`,r),this.protocolHash=e,this.name="InvalidProtocolHashError",this.name=this.constructor.name}}const $4=6,K4=3;function d1(t){switch(t){case"tz":return $4;case"mtz":return K4;case"mutez":default:return 0}}function ld(t="mutez",e="mutez",r){let n;try{n=new tt(r)}catch{return r}return n.isNaN()?r:n.multipliedBy(Math.pow(10,d1(t))).dividedBy(Math.pow(10,d1(e)))}const G4="main",He={block:"head"};var p1;(function(t){t.GET_BAKING_RIGHTS="getBakingRights",t.GET_BALLOTS="getBallots",t.GET_BALLOT_LIST="getBallotList",t.GET_BIG_MAP_EXPR="getBigMapExpr",t.GET_BLOCK_HASH="getBlockHash",t.GET_BLOCK="getBlock",t.GET_BLOCK_HEADER="getBlockHeader",t.GET_BLOCK_METADATA="getBlockMetadata",t.GET_BALANCE="getBalance",t.GET_SPENDABLE="getSpendable",t.GET_BALANCE_AND_FROZEN_BONDS="getBalanceAndFrozenBonds",t.GET_SPENDABLE_AND_FROZEN_BONDS="getSpendableAndFrozenBonds",t.GET_FULL_BALANCE="getFullBalance",t.GET_STAKED_BALANCE="getStakedBalance",t.GET_UNSTAKED_FINALIZABLE_BALANCE="getUnstakedFinalizableBalance",t.GET_UNSTAKED_FROZEN_BALANCE="getUnstakedFrozenBalance",t.GET_UNSTAKE_REQUESTS="getUnstakeRequests",t.GET_CHAIN_ID="getChainId",t.GET_CONSTANTS="getConstants",t.GET_CONTRACT="getContract",t.GET_CURRENT_PERIOD="getCurrentPeriod",t.GET_CURRENT_PROPOSAL="getCurrentProposal",t.GET_CURRENT_QUORUM="getCurrentQuorum",t.GET_DELEGATE="getDelegate",t.GET_ALL_DELEGATES="getAllDelegates",t.GET_DELEGATES="getDelegates",t.GET_VOTING_INFO="getVotingInfo",t.GET_ACTIVE_STAKING_PARAMETERS="getActiveStakingParameters",t.GET_PENDING_STAKING_PARAMETERS="getPendingStakingParameters",t.GET_ATTESTATION_RIGHTS="getAttestationRights",t.GET_ENTRYPOINTS="getEntrypoints",t.GET_LIVE_BLOCKS="getLiveBlocks",t.GET_MANAGER_KEY="getManagerKey",t.GET_NORMALIZED_
6SCRIPT="getNormalizedScript",t.GET_PROPOSALS="getProposals",t.GET_PROTOCOLS="getProtocols",t.GET_SAPLING_DIFF_BY_CONTRACT="getSaplingDiffByContract",t.GET_PROTOCOL_ACTIVATIONS="getProtocolActivations",t.GET_SAPLING_DIFF_BY_ID="getSaplingDiffById",t.GET_SCRIPT="getScript",t.GET_STORAGE="getStorage",t.GET_SUCCESSOR_PERIOD="getSuccessorPeriod",t.GET_VOTES_LISTINGS="getVotesListings",t.PACK_DATA="packData",t.GET_STORAGE_USED_SPACE="getStorageUsedSpace",t.GET_STORAGE_PAID_SPACE="getStoragePaidSpace",t.GET_TICKET_BALANCE="getTicketBalance",t.GET_ALL_TICKET_BALANCES="getAllTicketBalances",t.GET_ADAPTIVE_ISSUANCE_LAUNCH_CYCLE="getAdaptiveIssuanceLaunchCycle",t.GET_PENDING_OPERATIONS="getPendingOperations",t.GET_MEMPOOL_FILTER="getMempoolFilter",t.GET_DESTINATION_INDEX="getDestinationIndex"})(p1||(p1={}));function Qi(t,e){const r=Array.isArray(t);typeof e>"u"&&(e=Object.keys(t));const n=r?[]:{};return e.forEach(a=>{const i=t[a];let s;if(!(typeof i>"u")){if(Array.isArray(i)){s=Qi(i),n[a]=s;return}s=new tt(i),n[a]=s}}),n}var g1;(function(t){t.TOO_LARGE="too large"})(g1||(g1={}));var b1;(function(t){t.ACTIVATION="activation",t.ATTESTATION="attestation",t.ATTESTATIONS_AGGREGATE="attestations_aggregate",t.ATTESTATION_WITH_DAL="attestation_with_dal",t.ATTESTING_REWARDS="attesting rewards",t.BAKING_BONUSES="baking bonuses",t.BAKING_REWARDS="baking rewards",t.BALLOT="ballot",t.BLOCK_FEES="block fees",t.BONDS="bonds",t.BOOTSTRAP="bootstrap",t.BURNED="burned",t.COMMITMENT="commitment",t.DAL_ATTESTING_REWARDS="dal attesting rewards",t.DAL_ENTRAPMENT_EVIDENCE="dal_entrapment_evidence",t.DAL_PUBLISH_COMMITMENT="dal_publish_commitment",t.DELEGATE_DENOMINATOR="delegate_denominator",t.DELEGATION="delegation",t.DELEGATOR_NUMERATOR="delegator_numerator",t.DEPOSITS="deposits",t.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",t.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",t.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",t.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",t.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",t.DRAIN_DELEGATE="drain_delegate",t.ENDORSEMENT="endorsement",t.ENDORSEMENT_WITH_DAL="endorsement_with_dal",t.EVENT="event",t.FAILING_NOOP="failing_noop",t.INCREASE_PAID_STORAGE="increase_paid_storage",t.INVOICE="invoice",t.LOST_ATTESTING_REWARDS="lost attesting rewards",t.LOST_DAL_ATTESTING_REWARDS="lost dal attesting rewards",t.MINTED="minted",t.NONCE_REVELATION_REWARDS="nonce revelation rewards",t.ORIGINATION="origination",t.PREATTESTATION="preattestation",t.PREATTESTATIONS_AGGREGATE="preattestations_aggregate",t.PREENDORSEMENT="preendorsement",t.PROPOSALS="proposals",t.PUNISHMENTS="punishments",t.REGISTER_GLOBAL_CONSTANT="register_global_constant",t.REVEAL="reveal",t.SEED_NONCE_REVELATION="seed_nonce_revelation",t.SET_DEPOSITS_LIMIT="set_deposits_limit",t.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",t.SMART_ROLLUP_CEMENT="smart_rollup_cement",t.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",t.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",t.SMART_ROLLUP_PUBLISH="smart_rollup_publish",t.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",t.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",t.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",t.SMART_ROLLUP_REFUTE="smart_rollup_refute",t.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout",t.STORAGE_FEES="storage fees",t.SUBSIDY="subsidy",t.TICKET_UPDATES="ticket_updates",t.TRANSACTION="transaction",t.TRANSFER_TICKET="transfer_ticket",t.UNSTAKED_DEPOSITS="unstaked_deposits",t.UPDATE_COMPANION_KEY="update_companion_key",t.UPDATE_CONSENSUS_KEY="update_consensus_key",t.VDF_REVELATION="vdf_revelation"})(b1||(b1={}));var m1;(function(t){t.WASM2="wasm_2_0_0",t.ARITH="arith",t.RISCV="riscv"})(m1||(m1={}));var y1;(function(t){t.START="start",t.MOVE="move"})(y1||(y1={}));var v1;(function(t){t.INBOX_PROOF="inbox_proof",t.REVEAL_PROOF="reveal_proof",t.FIRST_INPUT="first_input"})(v1||(v1={}));var w1;(function(t){t.RAW_DATA_PROOF="raw_data_proof",t.METADATA_PROOF="metadata_proof",t.DAL_PAGE_PROOF="dal_page_proof",t.DAL_PARAMETERS_PROOF="dal_parameters_proof"})(w1||(w1={}));var _1;(function(t){t.ONGOING="ongoing",t.ENDED="ended"})(_1||(_1={}));var E1;(function(t){t.LOSER="loser",t.DRAW="draw"})(E1||(E1={}));var S1;(function(t){t.CONFLICT_RESOLVED="conflict_resolved",t.TIMEOUT="timeout"})(S1||(S1={}));var fe;(function(t){t.ORIGINATION="origination",t.DELEGATION="delegation",t.REVEAL="reveal",t.TRANSACTION="transaction",t.ACTIVATION="activate_account",t.ATTESTATION="attestation",t.ENDORSEMENT="endorsement",t.PREATTESTATION="preattestation",t.PREENDORSEMENT="preendorsement",t.SET_DEPOSITS_LIMIT="set_deposits_limit",t.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",t.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",t.ATTESTATION_WITH_DAL="attestation_with_dal",t.ENDORSEMENT_WITH_DAL="endorsement_with_dal",t.SEED_NONCE_REVELATION="seed_nonce_revelation",t.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",t.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",t.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",t.PROPOSALS="proposals",t.BALLOT="ballot",t.FAILING_NOOP="failing_noop",t.REGISTER_GLOBAL_CONSTANT="register_global_constant",t.TRANSFER_TICKET="transfer_ticket",t.INCREASE_PAID_STORAGE="increase_paid_storage",t.UPDATE_CONSENSUS_KEY="update_consensus_key",t.DRAIN_DELEGATE="drain_delegate",t.VDF_REVELATION="vdf_revelation",t.EVENT="event",t.TICKET_UPDATES="ticket_updates",t.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",t.
6SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",t.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",t.SMART_ROLLUP_PUBLISH="smart_rollup_publish",t.SMART_ROLLUP_CEMENT="smart_rollup_cement",t.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",t.SMART_ROLLUP_REFUTE="smart_rollup_refute",t.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout",t.DAL_PUBLISH_COMMITMENT="dal_publish_commitment",t.DAL_ENTRAPMENT_EVIDENCE="dal_entrapment_evidence",t.PREATTESTATIONS_AGGREGATE="preattestations_aggregate",t.ATTESTATIONS_AGGREGATE="attestations_aggregate",t.UPDATE_COMPANION_KEY="update_companion_key",t.DOUBLE_CONSENSUS_OPERATION_EVIDENCE="double_consensus_operation_evidence"})(fe||(fe={}));class ko{constructor(e,r=G4,n=new B_){this.url=e,this.chain=r,this.httpBackend=n}createURL(e){let r=this.url;for(;r.endsWith("/");)r=r.slice(0,-1);return`${r}${e}`}validateAddress(e){const r=it(e);if(r!==Se.VALID)throw new st(e,r)}validateContract(e){const r=pa(e);if(r!==Se.VALID)throw new ha(e,r)}async getBlockHash({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/hash`),method:"GET"})}async getLiveBlocks({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/live_blocks`),method:"GET"})}async getBalance(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/balance`),method:"GET"});return new tt(n)}async getSpendable(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/spendable`),method:"GET"});return new tt(n)}async getBalanceAndFrozenBonds(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/balance_and_frozen_bonds`),method:"GET"});return new tt(n)}async getSpendableAndFrozenBonds(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/spendable_and_frozen_bonds`),method:"GET"});return new tt(n)}async getFullBalance(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/full_balance`),method:"GET"});return new tt(n)}async getStakedBalance(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/staked_balance`),method:"GET"});return new tt(n)}async getUnstakedFinalizableBalance(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/unstaked_finalizable_balance`),method:"GET"});return new tt(n)}async getUnstakedFrozenBalance(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/unstaked_frozen_balance`),method:"GET"});return new tt(n)}async getUnstakeRequests(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/unstake_requests`),method:"GET"});return n===null?null:{finalizable:n.finalizable.map(({amount:a,...i})=>{const s=Qi({amount:a},["amount"]);return{...i,amount:s.amount}}),unfinalizable:{delegate:n.unfinalizable.delegate,requests:n.unfinalizable.requests.map(({amount:a,cycle:i})=>{const s=Qi({amount:a},["amount"]);return{cycle:i,amount:s.amount}})}}}async getStorage(e,{block:r}=He){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/storage`),method:"GET"})}async getScript(e,{block:r}=He){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/script`),method:"GET"})}async getNormalizedScript(e,r={unparsing_mode:"Readable"},{block:n}=He){return this.validateContract(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${n}/context/contracts/${e}/script/normalized`),method:"POST"},r)}async getContract(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}`),method:"GET"});return{...n,balance:new tt(n.balance)}}async getManagerKey(e,{block:r}=He){return this.validateAddress(e),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/manager_key`),method:"GET"})}async getDelegate(e,{block:r}=He){this.validateAddress(e);let n;try{n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/delegate`),method:"GET"})}catch(a){if(a instanceof qn&&a.status===Ga.NOT_FOUND)n=null;else throw a}return n}async getBigMapExpr(e,r,{block:n}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${n}/context/big_maps/${e}/${r}`),method:"GET"})}async getAllDelegates(e={},{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/delegates`),method:"GET",query:e})}async getDelegates(e,{block:r}=He){this.validateAddress(e);const n=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/delegates/${e}`),method:"GET"}),a=Qi(n,["balance","full_balance","current_frozen_deposits","frozen_deposits","frozen_balance","frozen_deposits_limit","staking_balance","delegated_balance","voting_power","total_delegated_stake","staking_denominator"]);return n.frozen_balance_by_cycle?{...n,...a,frozen_balance_by_cycle:n.frozen_balance_by_cycle.map(({deposit:i,deposits:s,fees:o,rewards:c,...u})=>{const f=Qi({deposit:i,deposits:s,fees:o,rewards:c},["deposit","deposits","fees","rewards"]);return{...u,deposit:f.deposit,deposits:f.deposits,fees:f.fees,rewards:f.rewards}})}:{...n,...a}}async getVotingInfo(e,{block:r}=He){return this.validateAddress(e),await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/delegates/${e}/voting_info`),method:"GET"})}async getConstants({block:e}=He){const r=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/constants`),method:"GET"}),n=Qi(r,["time_between_blocks","hard_gas_limit_per_operation","hard_gas_limit_per_block","proof_of_work_threshold","tokens_per_roll","seed_nonce_revelation_tip","block_security_deposit","endorsement_security_deposit","block_reward","endorsement_reward","cost_per_byte","hard_storage_limit_per_operation","test_chain_duration","baking_reward_per_end
6orsement","delay_per_missing_endorsement","minimal_block_delay","liquidity_baking_subsidy","cache_layout","baking_reward_fixed_portion","baking_reward_bonus_per_slot","endorsing_reward_per_slot","double_baking_punishment","delay_increment_per_round","tx_rollup_commitment_bond","vdf_difficulty","sc_rollup_stake_amount","minimal_stake"]);return{...r,...n}}async getBlock({block:e,version:r}=He){const n={url:this.createURL(`/chains/${this.chain}/blocks/${e}`),method:"GET"};return r!==void 0&&(n.query={version:r}),await this.httpBackend.createRequest(n)}async getBlockHeader({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/header`),method:"GET"})}async getBlockMetadata({block:e,version:r}=He){const n={url:this.createURL(`/chains/${this.chain}/blocks/${e}/metadata`),method:"GET"};return r!==void 0&&(n.query={version:r}),await this.httpBackend.createRequest(n)}async getBakingRights(e={},{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/baking_rights`),method:"GET",query:e})}async getAttestationRights(e={},{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/attestation_rights`),method:"GET",query:e})}async getBallotList({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballot_list`),method:"GET"})}async getBallots({block:e}=He){const r=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/ballots`),method:"GET"});return Qi(r,["yay","nay","pass"])}async getCurrentProposal({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_proposal`),method:"GET"})}async getCurrentQuorum({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_quorum`),method:"GET"})}async getVotesListings({block:e}=He){const r=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/listings`),method:"GET"});return r.map(n=>(n.voting_power&&(n.voting_power=new tt(n.voting_power)),n)),r}async getProposals({block:e}=He){const r=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/proposals`),method:"GET"});return r.map(n=>n[1]=new tt(n[1])),r}async forgeOperations(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/forge/operations`),method:"POST"},e)}async injectOperation(e){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},e)}async preapplyOperations(e,{block:r,version:n}=He){const a={url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/preapply/operations`),method:"POST"};return n!==void 0&&(a.query={version:n}),await this.httpBackend.createRequest(a,e)}async getEntrypoints(e,{block:r}=He){return this.validateContract(e),await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/entrypoints`),method:"GET"})}async simulateOperation(e,{block:r,version:n}=He){const a={url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/scripts/simulate_operation`),method:"POST"};return n!==void 0&&(a.query={version:n}),await this.httpBackend.createRequest(a,e)}async runCode(e,{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/scripts/run_code`),method:"POST"},e)}async runScriptView({unparsing_mode:e="Readable",...r},{block:n}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${n}/helpers/scripts/run_script_view`),method:"POST"},{unparsing_mode:e,...r})}async runView({unparsing_mode:e="Readable",...r},{block:n}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${n}/helpers/scripts/run_view`),method:"POST"},{unparsing_mode:e,...r})}async getChainId(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/chain_id`),method:"GET"})}async packData(e,{block:r}=He){const{gas:n,...a}=await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/helpers/scripts/pack_data`),method:"POST"},e);let i=n;if(typeof n=="string")try{i=new tt(n)}catch{i=n}return{gas:i,...a}}getRpcUrl(){return this.url}async getCurrentPeriod({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/current_period`),method:"GET"})}
vendor: 7,823 bytes, lines 6-8
6async getSuccessorPeriod({block:e}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/votes/successor_period`),method:"GET"})}async getSaplingDiffById(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/sapling/${e}/get_diff`),method:"GET"})}async getSaplingDiffByContract(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/single_sapling_get_diff`),method:"GET"})}async getProtocols({block:e}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/protocols`),method:"GET"})}async getProtocolActivations(e=""){if(e){const r=F4(e);if(r!==Se.VALID)throw new q4(e,r)}return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/protocols/${e}`),method:"GET"})}async getStorageUsedSpace(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/storage/used_space`),method:"GET"})}async getStoragePaidSpace(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/storage/paid_space`),method:"GET"})}async getTicketBalance(e,r,{block:n}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${n}/context/contracts/${e}/ticket_balance`),method:"POST"},r)}async getAllTicketBalances(e,{block:r}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/contracts/${e}/all_ticket_balances`),method:"GET"})}async getAdaptiveIssuanceLaunchCycle({block:e}=He){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${e}/context/adaptive_issuance_launch_cycle`),method:"GET"})}async getPendingOperations(e={}){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/pending_operations`),method:"GET",query:e})}async getMempoolFilter(e={}){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/mempool/filter`),method:"GET",query:e})}async getActiveStakingParameters(e,{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/delegates/${e}/active_staking_parameters`),method:"GET"})}async getPendingStakingParameters(e,{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/delegates/${e}/pending_staking_parameters`),method:"GET"})}async getDestinationIndex(e,{block:r}=He){return await this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${r}/context/destination/${e}/index`),method:"GET"})}}var M0=function(t,e){return M0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},M0(t,e)};function cn(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");M0(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function j4(t,e,r,n){function a(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function o(f){try{u(n.next(f))}catch(l){s(l)}}function c(f){try{u(n.throw(f))}catch(l){s(l)}}function u(f){f.done?i(f.value):a(f.value).then(o,c)}u((n=n.apply(t,e||[])).next())})}function z2(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,a,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(u){return function(f){return c([u,f])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(r=0)),r;)try{if(n=1,a&&(i=u[0]&2?a.return:u[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,u[1])).done)return i;switch(a=0,i&&(u=[u[0]&2,i.value]),u[0]){case 0:case 1:i=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,a=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!i||u[1]>i[0]&&u[1]<i[3])){r.label=u[1];break}if(u[0]===6&&r.label<i[1]){r.label=i[1],i=u;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(u);break}i[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(f){u=[6,f],a=0}finally{n=i=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function za(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ya(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),a,i=[],s;try{for(;(e===void 0||e-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(o){s={error:o}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function va(t,e,r){if(r||arguments.length===2)for(var n=0,a=e.length,i;n<a;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function qa(t){return this instanceof qa?(this.v=t,this):new qa(t)}function V4(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),a,i=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",s),a[Symbol.asyncIterator]=function(){return this},a;function s(b){return function(v){return Promise.resolve(v).then(b,l)}}function o(b,v){n[b]&&(a[b]=function(w){return new Promise(function(I,S){i.push([b,w,I,S])>1||c(b,w)})},v&&(a[b]=v(a[b])))}function c(b,v){try{u(n[b](v))}catch(w){p(i[0][3],w)}}function u(b){b.value instanceof qa?Promise.resolve(b.value.v).then(f,l):p(i[0][2],b)}function f(b){c("next",b)}function l(b){c("throw",b)}function p(b,v){b(v),i.shift(),i.length&&c(i[0][0],i[0][1])}}function z4(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof za=="function"?za(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(s){return new Promise(function(o,c){s=t[i](s),a(o,c,s.done,s.value)})}}function a(i,s,o,c){Promise.resolve(c).then(function(u){i({value:u,done:o})},s)}}function Nt(t){return typeof t=="function"}function Sf(t){var e=function(n){Error.call(n),n.stack=new Error().stack},r=t(e);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var vc=Sf(function(t){return function(r){t(this),this.message=r?r.length+` errors occurred during unsubscription:
7`+r.map(function(n,a){return a+1+") "+n.toString()}).join(`
8  `):"",this.name="UnsubscriptionError",this.errors=r}});function Xo(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var Ks=(function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,r,n,a,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=za(s),c=o.next();!c.done;c=o.next()){var u=c.value;u.remove(this)}}catch(w){e={error:w}}finally{try{c&&!c.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}else s.remove(this);var f=this.initialTeardown;
vendor: 4,868 bytes, line 8
8if(Nt(f))try{f()}catch(w){i=w instanceof vc?w.errors:[w]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var p=za(l),b=p.next();!b.done;b=p.next()){var v=b.value;try{x1(v)}catch(w){i=i??[],w instanceof vc?i=va(va([],ya(i)),ya(w.errors)):i.push(w)}}}catch(w){n={error:w}}finally{try{b&&!b.done&&(a=p.return)&&a.call(p)}finally{if(n)throw n.error}}}if(i)throw new vc(i)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)x1(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(e)}},t.prototype._hasParent=function(e){var r=this._parentage;return r===e||Array.isArray(r)&&r.includes(e)},t.prototype._addParent=function(e){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(e),r):r?[r,e]:e},t.prototype._removeParent=function(e){var r=this._parentage;r===e?this._parentage=null:Array.isArray(r)&&Xo(r,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&Xo(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=(function(){var e=new t;return e.closed=!0,e})(),t})(),W2=Ks.EMPTY;function Z2(t){return t instanceof Ks||t&&"closed"in t&&Nt(t.remove)&&Nt(t.add)&&Nt(t.unsubscribe)}function x1(t){Nt(t)?t():t.unsubscribe()}var W4={Promise:void 0},Z4={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,va([t,e],ya(r)))},clearTimeout:function(t){return clearTimeout(t)},delegate:void 0};function Y2(t){Z4.setTimeout(function(){throw t})}function Jo(){}function Co(t){t()}var dd=(function(t){cn(e,t);function e(r){var n=t.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Z2(r)&&r.add(n)):n.destination=J4,n}return e.create=function(r,n,a){return new Ts(r,n,a)},e.prototype.next=function(r){this.isStopped||this._next(r)},e.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(r){this.destination.next(r)},e.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Ks),Y4=(function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var r=this.partialObserver;if(r.next)try{r.next(e)}catch(n){fo(n)}},t.prototype.error=function(e){var r=this.partialObserver;if(r.error)try{r.error(e)}catch(n){fo(n)}else fo(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(r){fo(r)}},t})(),Ts=(function(t){cn(e,t);function e(r,n,a){var i=t.call(this)||this,s;return Nt(r)||!r?s={next:r??void 0,error:n??void 0,complete:a??void 0}:s=r,i.destination=new Y4(s),i}return e})(dd);function fo(t){Y2(t)}function X4(t){throw t}var J4={closed:!0,next:Jo,error:X4,complete:Jo},pd=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function xi(t){return t}function Q4(t){return t.length===0?xi:t.length===1?t[0]:function(r){return t.reduce(function(n,a){return a(n)},r)}}var Ht=(function(){function t(e){e&&(this._subscribe=e)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(e,r,n){var a=this,i=tE(e)?e:new Ts(e,r,n);return Co(function(){var s=a,o=s.operator,c=s.source;i.add(o?o.call(i,c):c?a._subscribe(i):a._trySubscribe(i))}),i},t.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(r){e.error(r)}},t.prototype.forEach=function(e,r){var n=this;return r=A1(r),new r(function(a,i){var s=new Ts({next:function(o){try{e(o)}catch(c){i(c),s.unsubscribe()}},error:i,complete:a});n.subscribe(s)})},t.prototype._subscribe=function(e){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(e)},t.prototype[pd]=function(){return this},t.prototype.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return Q4(e)(this)},t.prototype.toPromise=function(e){var r=this;return e=A1(e),new e(function(n,a){var i;r.subscribe(function(s){return i=s},function(s){return a(s)},function(){return n(i)})})},t.create=function(e){return new t(e)},t})();function A1(t){var e;return(e=t??W4.Promise)!==null&&e!==void 0?e:Promise}function eE(t){return t&&Nt(t.next)&&Nt(t.error)&&Nt(t.complete)}function tE(t){return t&&t instanceof dd||eE(t)&&Z2(t)}function rE(t){return Nt(t?.lift)}function zt(t){return function(e){if(rE(e))return e.lift(function(r){try{return t(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function Ft(t,e,r,n,a){return new nE(t,e,r,n,a)}var nE=(function(t){cn(e,t);function e(r,n,a,i,s,o){var c=t.call(this,r)||this;
8return c.onFinalize=s,c.shouldUnsubscribe=o,c._next=n?function(u){try{n(u)}catch(f){r.error(f)}}:t.prototype._next,c._error=i?function(u){try{i(u)}catch(f){r.error(f)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=a?function(){try{a()}catch(u){r.error(u)}finally{this.unsubscribe()}}:t.prototype._complete,c}return e.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},e})(dd),iE=Sf(function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Gs=(function(t){cn(e,t);function e(){var r=t.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return e.prototype.lift=function(r){var n=new R1(this,this);return n.operator=r,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new iE},e.prototype.next=function(r){var n=this;Co(function(){var a,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=za(n.currentObservers),o=s.next();!o.done;o=s.next()){var c=o.value;c.next(r)}}catch(u){a={error:u}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(a)throw a.error}}}})},e.prototype.error=function(r){var n=this;Co(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var a=n.observers;a.length;)a.shift().error(r)}})},e.prototype.complete=function(){var r=this;Co(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(r){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,r)},e.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},e.prototype._innerSubscribe=function(r){var n=this,a=this,i=a.hasError,s=a.isStopped,o=a.observers;return i||s?W2:(this.currentObservers=null,o.push(r),new Ks(function(){n.currentObservers=null,Xo(o,r)}))},e.prototype._checkFinalizedStatuses=function(r){var n=this,a=n.hasError,i=n.thrownError,s=n.isStopped;a?r.error(i):s&&r.complete()},e.prototype.asObservable=function(){var r=new Ht;return r.source=this,r},e.create=function(r,n){return new R1(r,n)},e})(Ht),R1=(function(t){cn(e,t);function e(r,n){var a=t.call(this)||this;return a.destination=r,a.source=n,a}return e.prototype.next=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.next)===null||a===void 0||a.call(n,r)},e.prototype.error=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.error)===null||a===void 0||a.call(n,r)},e.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},e.prototype._subscribe=function(r){var n,a;return(a=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&a!==void 0?a:W2},e})(Gs),xf=(function(t){cn(e,t);function e(r){var n=t.call(this)||this;return n._value=r,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(r){var n=t.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},e.prototype.getValue=function(){var r=this,n=r.hasError,a=r.thrownError,i=r._value;if(n)throw a;return this._throwIfClosed(),i},e.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},e})(Gs),gd={now:function(){return(gd.delegate||Date).now()},delegate:void 0},gi=(function(t){cn(e,t);function e(r,n,a){r===void 0&&(r=1/0),n===void 0&&(n=1/0),a===void 0&&(a=gd);var i=t.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=a,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(r){var n=this,a=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,o=n._timestampProvider,c=n._windowTime;a||(i.push(r),!s&&i.push(o.now()+c)),this._trimBuffer(),t.prototype.next.call(this,r)},e.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),a=this,i=a._infiniteTimeWindow,s=a._buffer,o=s.slice(),c=0;c<o.length&&!r.closed;c+=i?1:2)r.next(o[c]);return this._checkFinalizedStatuses(r),n},e.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,a=r._timestampProvider,i=r._buffer,s=r._infiniteTimeWindow,o=(s?1:2)*n;if(n<1/0&&o<i.length&&i.splice(0,i.length-o),!s){for(var c=a.now(),u=0,f=1;f<i.length&&i[f]<=c;f+=2)u=f;u&&i.splice(0,u+1)}},e})(Gs),aE=(function(t){cn(e,t);function e(r,n){return t.call(this)||this}return e.prototype.schedule=function(r,n){return this},e})(Ks),I1={setInterval:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,va([t,e],ya(r)))},clearInterval:function(t){return clearInterval(t)},delegate:void 0},sE=(function(t){cn(e,t);function e(r,n){var a=t.call(this,r,n)||this;
vendor: 4,725 bytes, line 8
8return a.scheduler=r,a.work=n,a.pending=!1,a}return e.prototype.schedule=function(r,n){var a;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(r,n,a){return a===void 0&&(a=0),I1.setInterval(r.flush.bind(r,this),a)},e.prototype.recycleAsyncId=function(r,n,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return n;n!=null&&I1.clearInterval(n)},e.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(r,n);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(r,n){var a=!1,i;try{this.work(r)}catch(s){a=!0,i=s||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,a=r.scheduler,i=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Xo(i,this),n!=null&&(this.id=this.recycleAsyncId(a,n,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e})(aE),B1=(function(){function t(e,r){r===void 0&&(r=t.now),this.schedulerActionCtor=e,this.now=r}return t.prototype.schedule=function(e,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,e).schedule(n,r)},t.now=gd.now,t})(),oE=(function(t){cn(e,t);function e(r,n){n===void 0&&(n=B1.now);var a=t.call(this,r,n)||this;return a.actions=[],a._active=!1,a}return e.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var a;this._active=!0;do if(a=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,a){for(;r=n.shift();)r.unsubscribe();throw a}},e})(B1),X2=new oE(sE),fE=X2,bd=new Ht(function(t){return t.complete()});function J2(t){return t&&Nt(t.schedule)}function Q2(t){return t[t.length-1]}function cE(t){return Nt(Q2(t))?t.pop():void 0}function Af(t){return J2(Q2(t))?t.pop():void 0}var ew=(function(t){return t&&typeof t.length=="number"&&typeof t!="function"});function tw(t){return Nt(t?.then)}function rw(t){return Nt(t[pd])}function nw(t){return Symbol.asyncIterator&&Nt(t?.[Symbol.asyncIterator])}function iw(t){return new TypeError("You provided "+(t!==null&&typeof t=="object"?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function uE(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var aw=uE();function sw(t){return Nt(t?.[aw])}function ow(t){return V4(this,arguments,function(){var r,n,a,i;return z2(this,function(s){switch(s.label){case 0:r=t.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,qa(r.read())];case 3:return n=s.sent(),a=n.value,i=n.done,i?[4,qa(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,qa(a)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function fw(t){return Nt(t?.getReader)}function br(t){if(t instanceof Ht)return t;if(t!=null){if(rw(t))return hE(t);if(ew(t))return lE(t);if(tw(t))return dE(t);if(nw(t))return cw(t);if(sw(t))return pE(t);if(fw(t))return gE(t)}throw iw(t)}function hE(t){return new Ht(function(e){var r=t[pd]();if(Nt(r.subscribe))return r.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function lE(t){return new Ht(function(e){for(var r=0;r<t.length&&!e.closed;r++)e.next(t[r]);e.complete()})}function dE(t){return new Ht(function(e){t.then(function(r){e.closed||(e.next(r),e.complete())},function(r){return e.error(r)}).then(null,Y2)})}function pE(t){return new Ht(function(e){var r,n;try{for(var a=za(t),i=a.next();!i.done;i=a.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(o){r={error:o}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}e.complete()})}function cw(t){return new Ht(function(e){bE(t,e).catch(function(r){return e.error(r)})})}function gE(t){return cw(ow(t))}function bE(t,e){var r,n,a,i;return j4(this,void 0,void 0,function(){var s,o;return z2(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=z4(t),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=c.sent(),a={error:o},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(i=r.return)?[4,i.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];
8case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Fn(t,e,r,n,a){n===void 0&&(n=0),a===void 0&&(a=!1);var i=e.schedule(function(){r(),a?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(i),!a)return i}function uw(t,e){return e===void 0&&(e=0),zt(function(r,n){r.subscribe(Ft(n,function(a){return Fn(n,t,function(){return n.next(a)},e)},function(){return Fn(n,t,function(){return n.complete()},e)},function(a){return Fn(n,t,function(){return n.error(a)},e)}))})}function hw(t,e){return e===void 0&&(e=0),zt(function(r,n){n.add(t.schedule(function(){return r.subscribe(n)},e))})}function mE(t,e){return br(t).pipe(hw(e),uw(e))}function yE(t,e){return br(t).pipe(hw(e),uw(e))}function vE(t,e){return new Ht(function(r){var n=0;return e.schedule(function(){n===t.length?r.complete():(r.next(t[n++]),r.closed||this.schedule())})})}function wE(t,e){return new Ht(function(r){var n;return Fn(r,e,function(){n=t[aw](),Fn(r,e,function(){var a,i,s;try{a=n.next(),i=a.value,s=a.done}catch(o){r.error(o);return}s?r.complete():r.next(i)},0,!0)}),function(){return Nt(n?.return)&&n.return()}})}function lw(t,e){if(!t)throw new Error("Iterable cannot be null");return new Ht(function(r){Fn(r,e,function(){var n=t[Symbol.asyncIterator]();Fn(r,e,function(){n.next().then(function(a){a.done?r.complete():r.next(a.value)})},0,!0)})})}function _E(t,e){return lw(ow(t),e)}function EE(t,e){if(t!=null){if(rw(t))return mE(t,e);if(ew(t))return vE(t,e);if(tw(t))return yE(t,e);if(nw(t))return lw(t,e);if(sw(t))return wE(t,e);if(fw(t))return _E(t,e)}throw iw(t)}function Ai(t,e){return e?EE(t,e):br(t)}function Rf(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Af(t);return Ai(t,r)}function dw(t,e){var r=Nt(t)?t:function(){return t},n=function(a){return a.error(r())};return new Ht(n)}var pw=Sf(function(t){return function(){t(this),this.name="EmptyError",this.message="no elements in sequence"}});function gw(t){return t instanceof Date&&!isNaN(t)}var SE=Sf(function(t){return function(r){r===void 0&&(r=null),t(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r}});function bw(t,e){var r=gw(t)?{first:t}:typeof t=="number"?{each:t}:t,n=r.first,a=r.each,i=r.with,s=i===void 0?xE:i,o=r.scheduler,c=o===void 0?X2:o,u=r.meta,f=u===void 0?null:u;if(n==null&&a==null)throw new TypeError("No timeout provided.");return zt(function(l,p){var b,v,w=null,I=0,S=function(T){v=Fn(p,c,function(){try{b.unsubscribe(),br(s({meta:f,lastValue:w,seen:I})).subscribe(p)}catch(C){p.error(C)}},T)};b=l.subscribe(Ft(p,function(T){v?.unsubscribe(),I++,p.next(w=T),a>0&&S(a)},void 0,void 0,function(){v?.closed||v?.unsubscribe(),w=null})),!I&&S(n!=null?typeof n=="number"?n:+n-c.now():a)})}function xE(t){throw new SE(t)}function yi(t,e){return zt(function(r,n){var a=0;r.subscribe(Ft(n,function(i){n.next(t.call(e,i,a++))}))})}var AE=Array.isArray;function RE(t,e){return AE(e)?t.apply(void 0,va([],ya(e))):t(e)}function IE(t){return yi(function(e){return RE(t,e)})}var BE=Array.isArray,TE=Object.getPrototypeOf,PE=Object.prototype,ME=Object.keys;function OE(t){if(t.length===1){var e=t[0];if(BE(e))return{args:e,keys:null};if(LE(e)){var r=ME(e);return{args:r.map(function(n){return e[n]}),keys:r}}}return{args:t,keys:null}}function LE(t){return t&&typeof t=="object"&&TE(t)===PE}function NE(t,e){return t.reduce(function(r,n,a){return r[n]=e[a],r},{})}function T1(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Af(t),n=cE(t),a=OE(t),i=a.args,s=a.keys;if(i.length===0)return Ai([],r);var o=new Ht(kE(i,r,s?function(c){return NE(s,c)}:xi));return n?o.pipe(IE(n)):o}function kE(t,e,r){return r===void 0&&(r=xi),function(n){P1(e,function(){for(var a=t.length,i=new Array(a),s=a,o=a,c=function(f){P1(e,function(){var l=Ai(t[f],e),p=!1;l.subscribe(Ft(n,function(b){i[f]=b,p||(p=!0,o--),o||n.next(r(i.slice()))},function(){--s||n.complete()}))},n)},u=0;u<a;u++)c(u)},n)}}function P1(t,e,r){t?Fn(r,t,e):e()}function CE(t,e,r,n,a,i,s,o){var c=[],u=0,f=0,l=!1,p=function(){l&&!c.length&&!u&&e.complete()},b=function(w){return u<n?v(w):c.push(w)},v=function(w){u++;var I=!1;br(r(w,f++)).subscribe(Ft(e,function(S){e.next(S)},function(){I=!0},void 0,function(){if(I)try{u--;for(var S=function(){var T=c.shift();s||v(T)};c.length&&u<n;)S();p()}catch(T){e.error(T)}}))};return t.subscribe(Ft(e,b,function(){l=!0,p()})),function(){}}function Ps(t,e,r){return r===void 0&&(r=1/0),Nt(e)?Ps(function(n,a){return yi(function(i,s){return e(n,i,a,s)})(br(t(n,a)))},r):(typeof e=="number"&&(r=e),zt(function(n,a){return CE(n,a,t,r)}))}function UE(t){return Ps(xi,t)}function DE(){return UE(1)}function Qo(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return DE()(Ai(t,Af(t)))}function mw(t){return new Ht(function(e){br(t()).subscribe(e)})}function O0(t,e,r){t===void 0&&(t=0),r===void 0&&(r=fE);var n=-1;return e!=null&&(J2(e)?r=e:n=e),new Ht(function(a){var i=gw(t)?+t-r.now():t;i<0&&(i=0);var s=0;return r.schedule(function(){a.closed||(a.next(s++),0<=n?this.schedule(void 0,n):a.c
8omplete())},i)})}var HE=new Ht(Jo);function L0(t,e){return zt(function(r,n){var a=0;r.subscribe(Ft(n,function(i){return t.call(e,i,a++)&&n.next(i)}))})}function md(t,e,r){if(e==null&&(e=t,t=0),e<=0)return bd;var n=e+t;return new Ht(function(a){for(var i=t;i<n&&!a.closed;)a.next(i++);a.complete()})}function If(t){return zt(function(e,r){var n=null,a=!1,i;n=e.subscribe(Ft(r,void 0,void 0,function(s){i=br(t(s,If(t)(e))),n?(n.unsubscribe(),n=null,i.subscribe(r)):a=!0})),a&&(n.unsubscribe(),n=null,i.subscribe(r))})}function js(t,e){return Nt(e)?Ps(t,e,1):Ps(t,1)}function FE(t){return zt(function(e,r){var n=!1;e.subscribe(Ft(r,function(a){n=!0,r.next(a)},function(){n||r.next(t),r.complete()}))})}function qE(t){return t<=0?function(){return bd}:zt(function(e,r){var n=0;e.subscribe(Ft(r,function(a){++n<=t&&(r.next(a),t<=n&&r.complete())}))})}function yw(t,e){return e===void 0&&(e=xi),t=t??$E,zt(function(r,n){var a,i=!0;r.subscribe(Ft(n,function(s){var o=e(s);(i||!t(a,o))&&(i=!1,a=o,n.next(s))}))})}function $E(t,e){return t===e}function KE(t,e){return yw(function(r,n){return r[t]===n[t]})}function GE(t){return t===void 0&&(t=jE),zt(function(e,r){var n=!1;e.subscribe(Ft(r,function(a){n=!0,r.next(a)},function(){return n?r.complete():r.error(t())}))})}function jE(){return new pw}function vw(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(r){return Qo(r,Rf.apply(void 0,va([],ya(t))))}}function VE(t,e){return zt(function(r,n){var a=0,i=null,s=!1;r.subscribe(Ft(n,function(o){i||(i=Ft(n,void 0,function(){i=null,s&&n.complete()}),br(t(o,a++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function en(t,e){var r=arguments.length>=2;return function(n){return n.pipe(xi,qE(1),r?FE(e):GE(function(){return new pw}))}}function ww(t){t===void 0&&(t=1/0);var e;t&&typeof t=="object"?e=t:e={count:t};var r=e.count,n=r===void 0?1/0:r,a=e.delay,i=e.resetOnSuccess,s=i===void 0?!1:i;return n<=0?xi:zt(function(o,c){var u=0,f,l=function(){var p=!1;f=o.subscribe(Ft(c,function(b){s&&(u=0),c.next(b)},void 0,function(b){if(u++<n){var v=function(){f?(f.unsubscribe(),f=null,l()):p=!0};if(a!=null){var w=typeof a=="number"?O0(a):br(a(b,u)),I=Ft(c,function(){I.unsubscribe(),v()},function(){c.complete()});w.subscribe(I)}else v()}else c.error(b)})),p&&(f.unsubscribe(),f=null,l())};l()})}function Ms(t){t===void 0&&(t={});var e=t.connector,r=e===void 0?function(){return new Gs}:e,n=t.resetOnError,a=n===void 0?!0:n,i=t.resetOnComplete,s=i===void 0?!0:i,o=t.resetOnRefCountZero,c=o===void 0?!0:o;return function(u){var f,l,p,b=0,v=!1,w=!1,I=function(){l?.unsubscribe(),l=void 0},S=function(){I(),f=p=void 0,v=w=!1},T=function(){var C=f;S(),C?.unsubscribe()};return zt(function(C,k){b++,!w&&!v&&I();var $=p=p??r();k.add(function(){b--,b===0&&!w&&!v&&(l=wc(T,c))}),$.subscribe(k),!f&&b>0&&(f=new Ts({next:function(G){return $.next(G)},error:function(G){w=!0,I(),l=wc(S,a,G),$.error(G)},complete:function(){v=!0,I(),l=wc(S,s),$.complete()}}),br(C).subscribe(f))})(u)}}function wc(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(e===!0){t();return}if(e!==!1){var a=new Ts({next:function(){a.unsubscribe(),t()}});return br(e.apply(void 0,va([],ya(r)))).subscribe(a)}}function M1(t,e,r){var n,a,i,s,o=!1;return t&&typeof t=="object"?(n=t.bufferSize,s=n===void 0?1/0:n,a=t.windowTime,e=a===void 0?1/0:a,i=t.refCount,o=i===void 0?!1:i,r=t.scheduler):s=t??1/0,Ms({connector:function(){return new gi(s,e,r)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:o})}function zE(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Af(t);return zt(function(n,a){(r?Qo(t,n,r):Qo(t,n)).subscribe(a)})}function bi(t,e){return zt(function(r,n){var a=null,i=0,s=!1,o=function(){return s&&!a&&n.complete()};r.subscribe(Ft(n,function(c){a?.unsubscribe();var u=0,f=i++;br(t(c,f)).subscribe(a=Ft(n,function(l){return n.next(e?e(c,l,f,u++):l)},function(){a=null,o()}))},function(){s=!0,o()}))})}function WE(t){return zt(function(e,r){br(t).subscribe(Ft(r,function(){return r.complete()},Jo)),!r.closed&&e.subscribe(r)})}function ZE(t,e){return zt(function(r,n){var a=0;r.subscribe(Ft(n,function(i){var s=t(i,a++);
8(s||e)&&n.next(i),!s&&n.complete()}))})}function ef(t,e,r){var n=Nt(t)||e||r?{next:t,error:e,complete:r}:t;return n?zt(function(a,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var o=!0;a.subscribe(Ft(i,function(c){var u;(u=n.next)===null||u===void 0||u.call(n,c),i.next(c)},function(){var c;o=!1,(c=n.complete)===null||c===void 0||c.call(n),i.complete()},function(c){var u;o=!1,(u=n.error)===null||u===void 0||u.call(n,c),i.error(c)},function(){var c,u;o&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(u=n.finalize)===null||u===void 0||u.call(n)}))}):xi}var _c,O1;function YE(){return O1||(O1=1,_c=function(t,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var r=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&(function(i){return function(s){return function(o,c){var u={key:o,value:s[o]},f={key:c,value:s[c]};return i(u,f)}}})(e.cmp),a=[];return(function i(s){if(s&&s.toJSON&&typeof s.toJSON=="function"&&(s=s.toJSON()),s!==void 0){if(typeof s=="number")return isFinite(s)?""+s:"null";if(typeof s!="object")return JSON.stringify(s);var o,c;if(Array.isArray(s)){for(c="[",o=0;o<s.length;o++)o&&(c+=","),c+=i(s[o])||"null";return c+"]"}if(s===null)return"null";if(a.indexOf(s)!==-1){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var u=a.push(s)-1,f=Object.keys(s).sort(n&&n(s));for(c="",o=0;o<f.length;o++){var l=f[o],p=i(s[l]);p&&(c&&(c+=","),c+=JSON.stringify(l)+":"+p)}return a.splice(u,1),"{"+c+"}"}})(t)}),_c}var XE=YE();const JE=Q0(XE);var Vi={},Ec={},Sc={},xc={},us={},hs={},L1;function QE(){if(L1)return hs;L1=1,Object.defineProperty(hs,"__esModule",{value:!0}),hs.BrowserRandomSource=void 0;const t=65536;class e{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const n=typeof self<"u"?self.crypto||self.msCrypto:null;n&&n.getRandomValues!==void 0&&(this._crypto=n,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(n){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const a=new Uint8Array(n);for(let i=0;i<a.length;i+=t)this._crypto.getRandomValues(a.subarray(i,i+Math.min(a.length-i,t)));return a}}return hs.BrowserRandomSource=e,hs}function e5(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ls={},co={},N1;function Ri(){if(N1)return co;N1=1,Object.defineProperty(co,"__esModule",{value:!0});function t(e){for(var r=0;r<e.length;r++)e[r]=0;return e}return co.wipe=t,co}var nt={},uo={exports:{}}
vendor: 4,985 bytes, lines 8-13
8,ho={exports:{}},Ac={},k1;function Or(){return k1||(k1=1,(function(t){Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e={},r={};r.byteLength=f,r.toByteArray=p,r.fromByteArray=w;for(var n=[],a=[],i=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,c=s.length;o<c;++o)n[o]=s[o],a[s.charCodeAt(o)]=o;a[45]=62,a[95]=63;function u(T){var C=T.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=T.indexOf("=");k===-1&&(k=C);var $=k===C?0:4-k%4;return[k,$]}function f(T){var C=u(T),k=C[0],$=C[1];return(k+$)*3/4-$}function l(T,C,k){return(C+k)*3/4-k}function p(T){var C,k=u(T),$=k[0],G=k[1],B=new i(l(T,$,G)),M=0,N=G>0?$-4:$,P;for(P=0;P<N;P+=4)C=a[T.charCodeAt(P)]<<18|a[T.charCodeAt(P+1)]<<12|a[T.charCodeAt(P+2)]<<6|a[T.charCodeAt(P+3)],B[M++]=C>>16&255,B[M++]=C>>8&255,B[M++]=C&255;return G===2&&(C=a[T.charCodeAt(P)]<<2|a[T.charCodeAt(P+1)]>>4,B[M++]=C&255),G===1&&(C=a[T.charCodeAt(P)]<<10|a[T.charCodeAt(P+1)]<<4|a[T.charCodeAt(P+2)]>>2,B[M++]=C>>8&255,B[M++]=C&255),B}function b(T){return n[T>>18&63]+n[T>>12&63]+n[T>>6&63]+n[T&63]}function v(T,C,k){for(var $,G=[],B=C;B<k;B+=3)$=(T[B]<<16&16711680)+(T[B+1]<<8&65280)+(T[B+2]&255),G.push(b($));return G.join("")}function w(T){for(var C,k=T.length,$=k%3,G=[],B=16383,M=0,N=k-$;M<N;M+=B)G.push(v(T,M,M+B>N?N:M+B));return $===1?(C=T[k-1],G.push(n[C>>2]+n[C<<4&63]+"==")):$===2&&(C=(T[k-2]<<8)+T[k-1],G.push(n[C>>10]+n[C>>4&63]+n[C<<2&63]+"=")),G.join("")}var I={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */I.read=function(T,C,k,$,G){var B,M,N=G*8-$-1,P=(1<<N)-1,x=P>>1,d=-7,m=k?G-1:0,h=k?-1:1,g=T[C+m];for(m+=h,B=g&(1<<-d)-1,g>>=-d,d+=N;d>0;B=B*256+T[C+m],m+=h,d-=8);for(M=B&(1<<-d)-1,B>>=-d,d+=$;d>0;M=M*256+T[C+m],m+=h,d-=8);if(B===0)B=1-x;else{if(B===P)return M?NaN:(g?-1:1)*(1/0);M=M+Math.pow(2,$),B=B-x}return(g?-1:1)*M*Math.pow(2,B-$)},I.write=function(T,C,k,$,G,B){var M,N,P,x=B*8-G-1,d=(1<<x)-1,m=d>>1,h=G===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=$?0:B-1,y=$?1:-1,_=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(N=isNaN(C)?1:0,M=d):(M=Math.floor(Math.log(C)/Math.LN2),C*(P=Math.pow(2,-M))<1&&(M--,P*=2),M+m>=1?C+=h/P:C+=h*Math.pow(2,1-m),C*P>=2&&(M++,P/=2),M+m>=d?(N=0,M=d):M+m>=1?(N=(C*P-1)*Math.pow(2,G),M=M+m):(N=C*Math.pow(2,m-1)*Math.pow(2,G),M=0));G>=8;T[k+g]=N&255,g+=y,N/=256,G-=8);for(M=M<<G|N,x+=G;x>0;T[k+g]=M&255,g+=y,M/=256,x-=8);T[k+g-y]|=_*128};/*!
9 * The buffer module from node.js, for the browser.
10 *
11 * @author   Feross Aboukhadijeh <https://feross.org>
12 * @license  MIT
13 */(function(T){const C=r,k=I,$=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;T.Buffer=d,T.SlowBuffer=U,T.INSPECT_MAX_BYTES=50;const G=2147483647;T.kMaxLength=G;const{Uint8Array:B,ArrayBuffer:M,SharedArrayBuffer:N}=globalThis;d.TYPED_ARRAY_SUPPORT=P(),!d.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 P(){try{const Y=new B(1),H={foo:function(){return 42}};return Object.setPrototypeOf(H,B.prototype),Object.setPrototypeOf(Y,H),Y.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function x(Y){if(Y>G)throw new RangeError('The value "'+Y+'" is invalid for option "size"');const H=new B(Y);return Object.setPrototypeOf(H,d.prototype),H}function d(Y,H,K){if(typeof Y=="number"){if(typeof H=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(Y)}return m(Y,H,K)}d.poolSize=8192;function m(Y,H,K){if(typeof Y=="string")return _(Y,H);if(M.isView(Y))return A(Y);if(Y==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y);if(ut(Y,M)||Y&&ut(Y.buffer,M)||typeof N<"u"&&(ut(Y,N)||Y&&ut(Y.buffer,N)))return E(Y,H,K);if(typeof Y=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const te=Y.valueOf&&Y.valueOf();if(te!=null&&te!==Y)return d.from(te,H,K);const oe=L(Y);if(oe)return oe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Y[Symbol.toPrimitive]=="function")return d.from(Y[Symbol.toPrimitive]("string"),H,K);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Y)}d.from=function(Y,H,K){return m(Y,H,K)},Object.setPrototypeOf(d.prototype,B.prototype),Object.setPrototypeOf(d,B);function h(Y){if(typeof Y!="number")throw new TypeError('"size" argument must be of type number');
vendor: 24,872 bytes, line 13
13if(Y<0)throw new RangeError('The value "'+Y+'" is invalid for option "size"')}function g(Y,H,K){return h(Y),Y<=0?x(Y):H!==void 0?typeof K=="string"?x(Y).fill(H,K):x(Y).fill(H):x(Y)}d.alloc=function(Y,H,K){return g(Y,H,K)};function y(Y){return h(Y),x(Y<0?0:O(Y)|0)}d.allocUnsafe=function(Y){return y(Y)},d.allocUnsafeSlow=function(Y){return y(Y)};function _(Y,H){if((typeof H!="string"||H==="")&&(H="utf8"),!d.isEncoding(H))throw new TypeError("Unknown encoding: "+H);const K=X(Y,H)|0;let te=x(K);const oe=te.write(Y,H);return oe!==K&&(te=te.slice(0,oe)),te}function R(Y){const H=Y.length<0?0:O(Y.length)|0,K=x(H);for(let te=0;te<H;te+=1)K[te]=Y[te]&255;return K}function A(Y){if(ut(Y,B)){const H=new B(Y);return E(H.buffer,H.byteOffset,H.byteLength)}return R(Y)}function E(Y,H,K){if(H<0||Y.byteLength<H)throw new RangeError('"offset" is outside of buffer bounds');if(Y.byteLength<H+(K||0))throw new RangeError('"length" is outside of buffer bounds');let te;return H===void 0&&K===void 0?te=new B(Y):K===void 0?te=new B(Y,H):te=new B(Y,H,K),Object.setPrototypeOf(te,d.prototype),te}function L(Y){if(d.isBuffer(Y)){const H=O(Y.length)|0,K=x(H);return K.length===0||Y.copy(K,0,0,H),K}if(Y.length!==void 0)return typeof Y.length!="number"||St(Y.length)?x(0):R(Y);if(Y.type==="Buffer"&&Array.isArray(Y.data))return R(Y.data)}function O(Y){if(Y>=G)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+G.toString(16)+" bytes");return Y|0}function U(Y){return+Y!=Y&&(Y=0),d.alloc(+Y)}d.isBuffer=function(H){return H!=null&&H._isBuffer===!0&&H!==d.prototype},d.compare=function(H,K){if(ut(H,B)&&(H=d.from(H,H.offset,H.byteLength)),ut(K,B)&&(K=d.from(K,K.offset,K.byteLength)),!d.isBuffer(H)||!d.isBuffer(K))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(H===K)return 0;let te=H.length,oe=K.length;for(let ue=0,le=Math.min(te,oe);ue<le;++ue)if(H[ue]!==K[ue]){te=H[ue],oe=K[ue];break}return te<oe?-1:oe<te?1:0},d.isEncoding=function(H){switch(String(H).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}},d.concat=function(H,K){if(!Array.isArray(H))throw new TypeError('"list" argument must be an Array of Buffers');if(H.length===0)return d.alloc(0);let te;if(K===void 0)for(K=0,te=0;te<H.length;++te)K+=H[te].length;const oe=d.allocUnsafe(K);let ue=0;for(te=0;te<H.length;++te){let le=H[te];if(ut(le,B))ue+le.length>oe.length?(d.isBuffer(le)||(le=d.from(le)),le.copy(oe,ue)):B.prototype.set.call(oe,le,ue);else if(d.isBuffer(le))le.copy(oe,ue);else throw new TypeError('"list" argument must be an Array of Buffers');ue+=le.length}return oe};function X(Y,H){if(d.isBuffer(Y))return Y.length;if(M.isView(Y)||ut(Y,M))return Y.byteLength;if(typeof Y!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Y);const K=Y.length,te=arguments.length>2&&arguments[2]===!0;if(!te&&K===0)return 0;let oe=!1;for(;;)switch(H){case"ascii":case"latin1":case"binary":return K;case"utf8":case"utf-8":return $e(Y).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K*2;case"hex":return K>>>1;case"base64":return De(Y).length;default:if(oe)return te?-1:$e(Y).length;H=(""+H).toLowerCase(),oe=!0}}d.byteLength=X;function J(Y,H,K){let te=!1;if((H===void 0||H<0)&&(H=0),H>this.length||((K===void 0||K>this.length)&&(K=this.length),K<=0)||(K>>>=0,H>>>=0,K<=H))return"";for(Y||(Y="utf8");;)switch(Y){case"hex":return Pe(this,H,K);case"utf8":case"utf-8":return ge(this,H,K);case"ascii":return Ie(this,H,K);case"latin1":case"binary":return de(this,H,K);case"base64":return pe(this,H,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ye(this,H,K);default:if(te)throw new TypeError("Unknown encoding: "+Y);Y=(Y+"").toLowerCase(),te=!0}}d.prototype._isBuffer=!0;function j(Y,H,K){const te=Y[H];Y[H]=Y[K],Y[K]=te}d.prototype.swap16=function(){const H=this.length;if(H%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let K=0;K<H;K+=2)j(this,K,K+1);return this},d.prototype.swap32=function(){const H=this.length;if(H%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let K=0;K<H;K+=4)j(this,K,K+3),j(this,K+1,K+2);return this},d.prototype.swap64=function(){const H=this.length;if(H%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let K=0;K<H;K+=8)j(this,K,K+7),j(this,K+1,K+6),j(this,K+2,K+5),j(this,K+3,K+4);return this},d.prototype.toString=function(){const H=this.length;return H===0?"":arguments.length===0?ge(this,0,H):J.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(H){if(!d.isBuffer(H))throw new TypeError("Argument must be a Buffer");return this===H?!0:d.compare(this,H)===0},d.prototype.inspect=function(){let H="";const K=T.INSPECT_MAX_BYTES;return H=this.toString("hex",0,K).replace(/(.{2})/g,"$1 ").trim(),this.length>K&&(H+=" ... "),"<Buffer "+H+">"},$&&(d.prototype[$]=d.prototype.inspect),d.prototype.compare=function(H,K,te,oe,ue){if(ut(H,B)&&(H=d.from(H,H.offset,H.byteLength)),!d.isBuffer(H))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof H);if(K===void 0&&(K=0),te===void 0&&(te=H?H.length:0),oe===void 0&&(oe=0),ue===void 0&&(ue=this.length),K<0||te>H.length||oe<0||ue>this.length)throw new RangeError("out of range index");if(oe>=ue&&K>=te)return 0;if(oe>=ue)return-1;if(K>=te)return 1;if(K>>>=0,te>>>=0,oe>>>=0,ue>>>=0,this===H)return 0;let le=ue-oe,Le=te-K;const We=Math.min(le,Le),Me=this.slice(oe,ue),Ze=H.slice(K,te);for(let qe=0;qe<We;++qe)if(Me[qe]!==Ze[qe]){le=Me[qe],Le=Ze[qe];break}return le<Le?-1:Le<le?1:0};function q(Y,H,K,te,oe){if(Y.length===0)return-1;if(typeof K=="string"?(te=K,K=0):K>2147483647?K=2147483647:K<-2147483648&&(K=-2147483648),K=+K,St(K)&&(K=oe?0:Y.length-1),K<0&&(K=Y.length+K),K>=Y.length){if(oe)return-1;K=Y.length-1}else if(K<0)if(oe)K=0;else return-1;if(typeof H=="string"&&(H=d.from(H,te)),d.isBuffer(H))return H.length===0?-1:V(Y,H,K,te,oe);if(typeof H=="number")return H=H&255,typeof B.prototype.indexOf=="function"?oe?B.prototype.indexOf.call(Y,H,K):B.prototype.lastIndexOf.call(Y,H,K):V(Y,[H],K,te,oe);throw new TypeError("val must be string, number or Buffer")}function V(Y,H,K,te,oe){let ue=1,le=Y.length,Le=H.length;if(te!==void 0&&(te=String(te).toLowerCase(),te==="ucs2"||te==="ucs-2"||te==="utf16le"||te==="utf-16le")){if(Y.length<2||H.length<2)return-1;ue=2,le/=2,Le/=2,K/=2}function We(Ze,qe){return ue===1?Ze[qe]:Ze.readUInt16BE(qe*ue)}let Me;if(oe){let Ze=-1;for(Me=K;Me<le;Me++)if(We(Y,Me)===We(H,Ze===-1?0:Me-Ze)){if(Ze===-1&&(Ze=Me),Me-Ze+1===Le)return Ze*ue}else Ze!==-1&&(Me-=Me-Ze),Ze=-1}else for(K+Le>le&&(K=le-Le),Me=K;Me>=0;Me--){let Ze=!0;for(let qe=0;qe<Le;qe++)if(We(Y,Me+qe)!==We(H,qe)){Ze=!1;break}if(Ze)return Me}return-1}d.prototype.includes=function(H,K,te){return this.indexOf(H,K,te)!==-1},d.prototype.indexOf=function(H,K,te){return q(this,H,K,te,!0)},d.prototype.lastIndexOf=function(H,K,te){return q(this,H,K,te,!1)};function ee(Y,H,K,te){K=Number(K)||0;const oe=Y.length-K;te?(te=Number(te),te>oe&&(te=oe)):te=oe;const ue=H.length;te>ue/2&&(te=ue/2);let le;for(le=0;le<te;++le){const Le=parseInt(H.substr(le*2,2),16);if(St(Le))return le;Y[K+le]=Le}return le}function ne(Y,H,K,te){return ze($e(H,Y.length-K),Y,K,te)}function W(Y,H,K,te){return ze(Te(H),Y,K,te)}function z(Y,H,K,te){return ze(De(H),Y,K,te)}function ae(Y,H,K,te){return ze(Ve(H,Y.length-K),Y,K,te)}d.prototype.write=function(H,K,te,oe){if(K===void 0)oe="utf8",te=this.length,K=0;else if(te===void 0&&typeof K=="string")oe=K,te=this.length,K=0;else if(isFinite(K))K=K>>>0,isFinite(te)?(te=te>>>0,oe===void 0&&(oe="utf8")):(oe=te,te=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ue=this.length-K;if((te===void 0||te>ue)&&(te=ue),H.length>0&&(te<0||K<0)||K>this.length)throw new RangeError("Attempt to write outside buffer bounds");oe||(oe="utf8");let le=!1;for(;;)switch(oe){case"hex":return ee(this,H,K,te);case"utf8":case"utf-8":return ne(this,H,K,te);case"ascii":case"latin1":case"binary":return W(this,H,K,te);case"base64":return z(this,H,K,te);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,H,K,te);default:if(le)throw new TypeError("Unknown encoding: "+oe);oe=(""+oe).toLowerCase(),le=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pe(Y,H,K){return H===0&&K===Y.length?C.fromByteArray(Y):C.fromByteArray(Y.slice(H,K))}function ge(Y,H,K){K=Math.min(Y.length,K);const te=[];let oe=H;for(;oe<K;){const ue=Y[oe];let le=null,Le=ue>239?4:ue>223?3:ue>191?2:1;if(oe+Le<=K){let We,Me,Ze,qe;switch(Le){case 1:ue<128&&(le=ue);break;case 2:We=Y[oe+1],(We&192)===128&&(qe=(ue&31)<<6|We&63,qe>127&&(le=qe));break;case 3:We=Y[oe+1],Me=Y[oe+2],(We&192)===128&&(Me&192)===128&&(qe=(ue&15)<<12|(We&63)<<6|Me&63,qe>2047&&(qe<55296||qe>57343)&&(le=qe));break;case 4:We=Y[oe+1],Me=Y[oe+2],Ze=Y[oe+3],(We&192)===128&&(Me&192)===128&&(Ze&192)===128&&(qe=(ue&15)<<18|(We&63)<<12|(Me&63)<<6|Ze&63,qe>65535&&qe<1114112&&(le=qe))}}le===null?(le=65533,Le=1):le>65535&&(le-=65536,te.push(le>>>10&1023|55296),le=56320|le&1023),te.push(le),oe+=Le}return _e(te)}const be=4096;function _e(Y){const H=Y.length;if(H<=be)return String.fromCharCode.apply(String,Y);let K="",te=0;for(;te<H;)K+=String.fromCharCode.apply(String,Y.slice(te,te+=be));return K}function Ie(Y,H,K){let te="";K=Math.min(Y.length,K);for(let oe=H;oe<K;++oe)te+=String.fromCharCode(Y[oe]&127);return te}function de(Y,H,K){let te="";K=Math.min(Y.length,K);for(let oe=H;oe<K;++oe)te+=String.fromCharCode(Y[oe]);return te}function Pe(Y,H,K){const te=Y.length;(!H||H<0)&&(H=0),(!K||K<0||K>te)&&(K=te);let oe="";for(let ue=H;ue<K;++ue)oe+=Je[Y[ue]];return oe}function ye(Y,H,K){const te=Y.slice(H,K);let oe="";for(let ue=0;ue<te.length-1;ue+=2)oe+=String.fromCharCode(te[ue]+te[ue+1]*256);return oe}d.prototype.slice=function(H,K){const te=this.length;H=~~H,K=K===void 0?te:~~K,H<0?(H+=te,H<0&&(H=0)):H>te&&(H=te),K<0?(K+=te,K<0&&(K=0)):K>te&&(K=te),K<H&&(K=H);const oe=this.subarray(H,K);return Object.setPrototypeOf(oe,d.prototype),oe};function we(Y,H,K){if(Y%1!==0||Y<0)throw new RangeError("offset is not uint");if(Y+H>K)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(H,K,te){H=H>>>0,K=K>>>0,te||we(H,K,this.length);let oe=this[H],ue=1,le=0;for(;++le<K&&(ue*=256);)oe+=this[H+le]*ue;return oe},d.prototype.readUintBE=d.prototype.readUIntBE=function(H,K,te){H=H>>>0,K=K>>>0,te||we(H,K,this.length);let oe=this[H+--K],ue=1;for(;K>0&&(ue*=256);)oe+=this[H+--K]*ue;return oe},d.prototype.readUint8=d.prototype.readUInt8=function(H,K){return H=H>>>0,K||we(H,1,this.length),this[H]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(H,K){return H=H>>>0,K||we(H,2,this.length),this[H]|this[H+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(H,K){return H=H>>>0,K||we(H,2,this.length),this[H]<<8|this[H+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(H,K){return H=H>>>0,K||we(H,4,this.length),(this[H]|this[H+1]<<8|this[H+2]<<16)+this[H+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(H,K){return H=H>>>0,K||we(H,4,this.length),this[H]*16777216+(this[H+1]<<16|this[H+2]<<8|this[H+3])},d.prototype.readBigUInt64LE=dt(function(H){H=H>>>0,se(H,"offset");const K=this[H],te=this[H+7];(K===void 0||te===void 0)&&ce(H,this.length-8);const oe=K+this[++H]*2**8+this[++H]*2**16+this[++H]*2**24,ue=this[++H]+this[++H]*2**8+this[++H]*2**16+te*2**24;return BigInt(oe)+(BigInt(ue)<<BigInt(32))}),d.prototype.readBigUInt64BE=dt(function(H){H=H>>>0,se(H,"offset");const K=this[H],te=this[H+7];(K===void 0||te===void 0)&&ce(H,this.length-8);const oe=K*2**24+this[++H]*2**16+this[++H]*2**8+this[++H],ue=this[++H]*2**24+this[++H]*2**16+this[++H]*2**8+te;return(BigInt(oe)<<BigInt(32))+BigInt(ue)}),d.prototype.readIntLE=function(H,K,te){H=H>>>0,K=K>>>0,te||we(H,K,this.length);let oe=this[H],ue=1,le=0;for(;++le<K&&(ue*=256);)oe+=this[H+le]*ue;return ue*=128,oe>=ue&&(oe-=Math.pow(2,8*K)),oe},d.prototype.readIntBE=function(H,K,te){H=H>>>0,K=K>>>0,te||we(H,K,this.length);let oe=K,ue=1,le=this[H+--oe];for(;oe>0&&(ue*=256);)le+=this[H+--oe]*ue;return ue*=128,le>=ue&&(le-=Math.pow(2,8*K)),le},d.prototype.readInt8=function(H,K){return H=H>>>0,K||we(H,1,this.length),this[H]&128?(255-this[H]+1)*-1:this[H]},d.prototype.readInt16LE=function(H,K){H=H>>>0,K||we(H,2,this.length);const te=this[H]|this[H+1]<<8;return te&32768?te|4294901760:te},d.prototype.readInt16BE=function(H,K){H=H>>>0,K||we(H,2,this.length);const te=this[H+1]|this[H]<<8;return te&32768?te|4294901760:te},d.prototype.readInt32LE=function(H,K){return H=H>>>0,K||we(H,4,this.length),this[H]|this[H+1]<<8|this[H+2]<<16|this[H+3]<<24},d.prototype.readInt32BE=function(H,K){return H=H>>>0,K||we(H,4,this.length),this[H]<<24|this[H+1]<<16|this[H+2]<<8|this[H+3]},d.prototype.readBigInt64LE=dt(function(H){H=H>>>0,se(H,"offset");const K=this[H],te=this[H+7];(K===void 0||te===void 0)&&ce(H,this.length-8);const oe=this[H+4]+this[H+5]*2**8+this[H+6]*2**16+(te<<24);return(BigInt(oe)<<BigInt(32))+BigInt(K+this[++H]*2**8+this[++H]*2**16+this[++H]*2**24)}),d.prototype.readBigInt64BE=dt(function(H){H=H>>>0,se(H,"offset");const K=this[H],te=this[H+7];(K===void 0||te===void 0)&&ce(H,this.length-8);const oe=(K<<24)+this[++H]*2**16+this[++H]*2**8+this[++H];return(BigInt(oe)<<BigInt(32))+BigInt(this[++H]*2**24+this[++H]*2**16+this[++H]*2**8+te)}),d.prototype.readFloatLE=function(H,K){return H=H>>>0,K||we(H,4,this.length),k.read(this,H,!0,23,4)},d.prototype.readFloatBE=function(H,K){return H=H>>>0,K||we(H,4,this.length),k.read(this,H,!1,23,4)},d.prototype.readDoubleLE=function(H,K){return H=H>>>0,K||we(H,8,this.length),k.read(this,H,!0,52,8)},d.prototype.readDoubleBE=function(H,K){return H=H>>>0,K||we(H,8,this.length),k.read(this,H,!1,52,8)};function Ee(Y,H,K,te,oe,ue){if(!d.isBuffer(Y))throw new TypeError('"buffer" argument must be a Buffer instance');if(H>oe||H<ue)throw new RangeError('"value" argument is out of bounds');if(K+te>Y.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(H,K,te,oe){if(H=+H,K=K>>>0,te=te>>>0,!oe){const Le=Math.pow(2,8*te)-1;Ee(this,H,K,te,Le,0)}let ue=1,le=0;for(this[K]=H&255;++le<te&&(ue*=256);)this[K+le]=H/ue&255;return K+te},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(H,K,te,oe){if(H=+H,K=K>>>0,te=te>>>0,!oe){const Le=Math.pow(2,8*te)-1;Ee(this,H,K,te,Le,0)}let ue=te-1,le=1;for(this[K+ue]=H&255;--ue>=0&&(le*=256);)this[K+ue]=H/le&255;return K+te},d.prototype.writeUint8=d.prototype.writeUInt8=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,1,255,0),this[K]=H&255,K+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,2,65535,0),this[K]=H&255,this[K+1]=H>>>8,K+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,2,65535,0),this[K]=H>>>8,this[K+1]=H&255,K+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,4,4294967295,0),this[K+3]=H>>>24,this[K+2]=H>>>16,this[K+1]=H>>>8,this[K]=H&255,K+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,4,4294967295,0),this[K]=H>>>24,this[K+1]=H>>>16,this[K+2]=H>>>8,this[K+3]=H&255,K+4};function ve(Y,H,K,te,oe){Q(H,te,oe,Y,K,7);let ue=Number(H&BigInt(4294967295));Y[K++]=ue,ue=ue>>8,Y[K++]=ue,ue=ue>>8,Y[K++]=ue,ue=ue>>8,Y[K++]=ue;let le=Number(H>>BigInt(32)&BigInt(4294967295));return Y[K++]=le,le=le>>8,Y[K++]=le,le=le>>8,Y[K++]=le,le=le>>8,Y[K++]=le,K}function Be(Y,H,K,te,oe){Q(H,te,oe,Y,K,7);let ue=Number(H&BigInt(4294967295));Y[K+7]=ue,ue=ue>>8,Y[K+6]=ue,ue=ue>>8,Y[K+5]=ue,ue=ue>>8,Y[K+4]=ue;let le=Number(H>>BigInt(32)&BigInt(4294967295));return Y[K+3]=le,le=le>>8,Y[K+2]=le,le=le>>8,Y[K+1]=le,le=le>>8,Y[K]=le,K+8}d.prototype.writeBigUInt64LE=dt(function(H,K=0){return ve(this,H,K,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=dt(function(H,K=0){return Be(this,H,K,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(H,K,te,oe){if(H=+H,K=K>>>0,!oe){const We=Math.pow(2,8*te-1);Ee(this,H,K,te,We-1,-We)}let ue=0,le=1,Le=0;for(this[K]=H&255;++ue<te&&(le*=256);)H<0&&Le===0&&this[K+ue-1]!==0&&(Le=1),this[K+ue]=(H/le>>0)-Le&255;return K+te},d.prototype.writeIntBE=function(H,K,te,oe){if(H=+H,K=K>>>0,!oe){const We=Math.pow(2,8*te-1);Ee(this,H,K,te,We-1,-We)}let ue=te-1,le=1,Le=0;for(this[K+ue]=H&255;--ue>=0&&(le*=256);)H<0&&Le===0&&this[K+ue+1]!==0&&(Le=1),this[K+ue]=(H/le>>0)-Le&255;return K+te},d.prototype.writeInt8=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,1,127,-128),H<0&&(H=255+H+1),this[K]=H&255,K+1},d.prototype.writeInt16LE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,2,32767,-32768),this[K]=H&255,this[K+1]=H>>>8,K+2},d.prototype.writeInt16BE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,2,32767,-32768),this[K]=H>>>8,this[K+1]=H&255,K+2},d.prototype.writeInt32LE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,4,2147483647,-2147483648),this[K]=H&255,this[K+1]=H>>>8,this[K+2]=H>>>16,this[K+3]=H>>>24,K+4},d.prototype.writeInt32BE=function(H,K,te){return H=+H,K=K>>>0,te||Ee(this,H,K,4,2147483647,-2147483648),H<0&&(H=4294967295+H+1),this[K]=H>>>24,this[K+1]=H>>>16,this[K+2]=H>>>8,this[K+3]=H&255,K+4},d.prototype.writeBigInt64LE=dt(function(H,K=0){return ve(this,H,K,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=dt(function(H,K=0){return Be(this,H,K,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ue(Y,H,K,te,oe,ue){if(K+te>Y.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("Index out of range")}function xe(Y,H,K,te,oe){return H=+H,K=K>>>0,oe||Ue(Y,H,K,4),k.write(Y,H,K,te,23,4),K+4}d.prototype.writeFloatLE=function(H,K,te){return xe(this,H,K,!0,te)},d.prototype.writeFloatBE=function(H,K,te){return xe(this,H,K,!1,te)};function Ne(Y,H,K,te,oe){return H=+H,K=K>>>0,oe||Ue(Y,H,K,8),k.write(Y,H,K,te,52,8),K+8}d.prototype.writeDoubleLE=function(H,K,te){return Ne(this,H,K,!0,te)},d.prototype.writeDoubleBE=function(H,K,te){return Ne(this,H,K,!1,te)},d.prototype.copy=function(H,K,te,oe){if(!d.isBuffer(H))throw new TypeError("argument should be a Buffer");if(te||(te=0),!oe&&oe!==0&&(oe=this.length),K>=H.length&&(K=H.length),K||(K=0),oe>0&&oe<te&&(oe=te),oe===te||H.length===0||this.length===0)return 0;if(K<0)throw new RangeError("targetStart out of bounds");if(te<0||te>=this.length)throw new RangeError("Index out of range");if(oe<0)throw new RangeError("sourceEnd out of bounds");oe>this.length&&(oe=this.length),H.length-K<oe-te&&(oe=H.length-K+te);const ue=oe-te;return this===H&&typeof B.prototype.copyWithin=="function"?this.copyWithin(K,te,oe):B.prototype.set.call(H,this.subarray(te,oe),K),ue},d.prototype.fill=function(H,K,te,oe){if(typeof H=="string"){if(typeof K=="string"?(oe=K,K=0,te=this.length):typeof te=="string"&&(oe=te,te=this.length),oe!==void 0&&typeof oe!="string")throw new TypeError("encoding must be a string");if(typeof oe=="string"&&!d.isEncoding(oe))throw new TypeError("Unknown encoding: "+oe);if(H.length===1){const le=H.charCodeAt(0);(oe==="utf8"&&le<128||oe==="latin1")&&(H=le)}}else typeof H=="number"?H=H&255:typeof H=="boolean"&&(H=Number(H));if(K<0||this.length<K||this.length<te)throw new RangeError("Out of range index");if(te<=K)return this;K=K>>>0,te=te===void 0?this.length:te>>>0,H||(H=0);let ue;if(typeof H=="number")for(ue=K;ue<te;++ue)this[ue]=H;else{const le=d.isBuffer(H)?H:d.from(H,oe),Le=le.length;if(Le===0)throw new TypeError('The value "'+H+'" is invalid for argument "value"');for(ue=0;ue<te-K;++ue)this[ue+K]=le[ue%Le]}return this};const Ke={};function Z(Y,H,K){Ke[Y]=class extends K{constructor(){super(),Object.defineProperty(this,"message",{value:H.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Y}]`,this.stack,delete this.name}get code(){return Y}set code(oe){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:oe,writable:!0})}toString(){return`${this.name} [${Y}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(Y){return Y?`${Y} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(Y,H){return`The "${Y}" argument must be of type number. Received type ${typeof H}`},TypeError),Z("ERR_OUT_OF_RANGE",function(Y,H,K){let te=`The value of "${Y}" is out of range.`,oe=K;return Number.isInteger(K)&&Math.abs(K)>2**32?oe=D(String(K)):typeof K=="bigint"&&(oe=String(K),(K>BigInt(2)**BigInt(32)||K<-(BigInt(2)**BigInt(32)))&&(oe=D(oe)),oe+="n"),te+=` It must be ${H}. Received ${oe}`,te},RangeError);function D(Y){let H="",K=Y.length;const te=Y[0]==="-"?1:0;for(;K>=te+4;K-=3)H=`_${Y.slice(K-3,K)}${H}`;return`${Y.slice(0,K)}${H}`}function F(Y,H,K){se(H,"offset"),(Y[H]===void 0||Y[H+K]===void 0)&&ce(H,Y.length-(K+1))}function Q(Y,H,K,te,oe,ue){if(Y>K||Y<H){const le=typeof H=="bigint"?"n":"";let Le;throw H===0||H===BigInt(0)?Le=`>= 0${le} and < 2${le} ** ${(ue+1)*8}${le}`:Le=`>= -(2${le} ** ${(ue+1)*8-1}${le}) and < 2 ** ${(ue+1)*8-1}${le}`,new Ke.ERR_OUT_OF_RANGE("value",Le,Y)}F(te,oe,ue)}function se(Y,H){if(typeof Y!="number")throw new Ke.ERR_INVALID_ARG_TYPE(H,"number",Y)}function ce(Y,H,K){throw Math.floor(Y)!==Y?(se(Y,K),new Ke.ERR_OUT_OF_RANGE("offset","an integer",Y)):H<0?new Ke.ERR_BUFFER_OUT_OF_BOUNDS:new Ke.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${H}`,Y)}const he=/[^+/0-9A-Za-z-_]/g;function Oe(Y){if(Y=Y.split("=")[0],Y=Y.trim().replace(he,""),Y.length<2)return"";for(;Y.length%4!==0;)Y=Y+"=";return Y}function $e(Y,H){H=H||1/0;let K;const te=Y.length;let oe=null;const ue=[];for(let le=0;le<te;++le){if(K=Y.charCodeAt(le),K>55295&&K<57344){if(!oe){if(K>56319){(H-=3)>-1&&ue.push(239,191,189);continue}else if(le+1===te){(H-=3)>-1&&ue.push(239,191,189);continue}oe=K;continue}if(K<56320){(H-=3)>-1&&ue.push(239,191,189),oe=K;continue}K=(oe-55296<<10|K-56320)+65536}else oe&&(H-=3)>-1&&ue.push(239,191,189);if(oe=null,K<128){if((H-=1)<0)break;ue.push(K)}else if(K<2048){if((H-=2)<0)break;ue.push(K>>6|192,K&63|128)}else if(K<65536){if((H-=3)<0)break;ue.push(K>>12|224,K>>6&63|128,K&63|128)}else if(K<1114112){if((H-=4)<0)break;ue.push(K>>18|240,K>>12&63|128,K>>6&63|128,K&63|128)}else throw new Error("Invalid code point")}return ue}function Te(Y){const H=[];for(let K=0;K<Y.length;++K)H.push(Y.charCodeAt(K)&255);return H}function Ve(Y,H){let K,te,oe;const ue=[];for(let le=0;le<Y.length&&!((H-=2)<0);++le)K=Y.charCodeAt(le),te=K>>8,oe=K%256,ue.push(oe),ue.push(te);return ue}function De(Y){return C.toByteArray(Oe(Y))}function ze(Y,H,K,te){let oe;for(oe=0;oe<te&&!(oe+K>=H.length||oe>=Y.length);++oe)H[oe+K]=Y[oe];return oe}function ut(Y,H){return Y instanceof H||Y!=null&&Y.constructor!=null&&Y.constructor.name!=null&&Y.constructor.name===H.name}function St(Y){return Y!==Y}const Je=(function(){const Y="0123456789abcdef",H=new Array(256);for(let K=0;K<16;++K){const te=K*16;for(let oe=0;oe<16;++oe)H[te+oe]=Y[K]+Y[oe]}return H})();function dt(Y){return typeof BigInt>"u"?Rt:Y}function Rt(){throw new Error("BigInt not supported")}})(e);const S=e.Buffer;t.Blob=e.Blob,t.BlobOptions=e.BlobOptions,t.Buffer=e.Buffer,t.File=e.File,t.FileOptions=e.FileOptions,t.INSPECT_MAX_BYTES=e.INSPECT_MAX_BYTES,t.SlowBuffer=e.SlowBuffer,t.TranscodeEncoding=e.TranscodeEncoding,t.atob=e.atob,t.btoa=e.btoa,t.constants=e.constants,t.default=S,t.isAscii=e.isAscii,t.isUtf8=e.isUtf8,t.kMaxLength=e.kMaxLength,t.kStringMaxLength=e.kStringMaxLength,t.resolveObjectURL=e.resolveObjectURL,t.transcode=e.transcode})(Ac)),Ac}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var C1;function et(){return C1||(C1=1,(function(t,e){var r=Or(),n=r.Buffer;function a(s,o){for(var c in s)o[c]=s[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(a(r,e),e.Buffer=i);function i(s,o,c){return n(s,o,c)}i.prototype=Object.create(n.prototype),a(n,i),i.from=function(s,o,c){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,o,c)},i.alloc=function(s,o,c){if(typeof s!="number")throw new TypeError("Argument must be a number");var u=n(s);return o!==void 0?typeof c=="string"?u.fill(o,c):u.fill(o):u.fill(0),u},i.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},i.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}}
13)(ho,ho.exports)),ho.exports}var U1;function ts(){if(U1)return uo.exports;U1=1;var t=65536,e=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
14Use Chrome, Firefox or Internet Explorer 11`)}var n=et().Buffer,a=ft.crypto||ft.msCrypto;a&&a.getRandomValues?uo.exports=i:uo.exports=r;function i(s,o){if(s>e)throw new RangeError("requested too many random bytes");var c=n.allocUnsafe(s);if(s>0)if(s>t)for(var u=0;u<s;u+=t)a.getRandomValues(c.slice(u,u+t));else a.getRandomValues(c);return typeof o=="function"?ke.nextTick(function(){o(null,c)}):c}return uo.exports}var lo={exports:{}},D1;function Ye(){return D1||(D1=1,typeof Object.create=="function"?lo.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:lo.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}}),lo.exports}var po={exports:{}},H1;function Vs(){if(H1)return po.exports;H1=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function($,G,B){return Function.prototype.apply.call($,G,B)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function($){return Object.getOwnPropertyNames($).concat(Object.getOwnPropertySymbols($))}:r=function($){return Object.getOwnPropertyNames($)};function n(k){console&&console.warn&&console.warn(k)}var a=Number.isNaN||function($){return $!==$};function i(){i.init.call(this)}po.exports=i,po.exports.once=S,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function o(k){if(typeof k!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof k)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(k){if(typeof k!="number"||k<0||a(k))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+k+".");s=k}}),i.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},i.prototype.setMaxListeners=function($){if(typeof $!="number"||$<0||a($))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+$+".");return this._maxListeners=$,this};function c(k){return k._maxListeners===void 0?i.defaultMaxListeners:k._maxListeners}i.prototype.getMaxListeners=function(){return c(this)},i.prototype.emit=function($){for(var G=[],B=1;B<arguments.length;B++)G.push(arguments[B]);var M=$==="error",N=this._events;if(N!==void 0)M=M&&N.error===void 0;else if(!M)return!1;if(M){var P;if(G.length>0&&(P=G[0]),P instanceof Error)throw P;var x=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw x.context=P,x}var d=N[$];if(d===void 0)return!1;if(typeof d=="function")e(d,this,G);else for(var m=d.length,h=v(d,m),B=0;B<m;++B)e(h[B],this,G);return!0};function u(k,$,G,B){var M,N,P;if(o(G),N=k._events,N===void 0?(N=k._events=Object.create(null),k._eventsCount=0):(N.newListener!==void 0&&(k.emit("newListener",$,G.listener?G.listener:G),N=k._events),P=N[$]),P===void 0)P=N[$]=G,++k._eventsCount;else if(typeof P=="function"?P=N[$]=B?[G,P]:[P,G]:B?P.unshift(G):P.push(G),M=c(k),M>0&&P.length>M&&!P.warned){P.warned=!0;var x=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String($)+" listeners added. Use emitter.setMaxListeners() to increase limit");x.name="MaxListenersExceededWarning",x.emitter=k,x.type=$,x.count=P.length,n(x)}return k}i.prototype.addListener=function($,G){return u(this,$,G,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function($,G){return u(this,$,G,!0)};function f(){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 l(k,$,G){var B={fired:!1,wrapFn:void 0,target:k,type:$,listener:G},M=f.bind(B);return M.listener=G,B.wrapFn=M,M}i.prototype.once=function($,G){return o(G),this.on($,l(this,$,G)),this},i.prototype.prependOnceListener=function($,G){return o(G),this.prependListener($,l(this,$,G)),this},i.prototype.removeListener=function($,G){var B,M,N,P,x;if(o(G),M=this._events,M===void 0)return this;if(B=M[$],B===void 0)return this;if(B===G||B.listener===G)--this._eventsCount===0?this._events=Object.create(null):(delete M[$],M.removeListener&&this.emit
14("removeListener",$,B.listener||G));else if(typeof B!="function"){for(N=-1,P=B.length-1;P>=0;P--)if(B[P]===G||B[P].listener===G){x=B[P].listener,N=P;break}if(N<0)return this;N===0?B.shift():w(B,N),B.length===1&&(M[$]=B[0]),M.removeListener!==void 0&&this.emit("removeListener",$,x||G)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function($){var G,B,M;if(B=this._events,B===void 0)return this;if(B.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):B[$]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete B[$]),this;if(arguments.length===0){var N=Object.keys(B),P;for(M=0;M<N.length;++M)P=N[M],P!=="removeListener"&&this.removeAllListeners(P);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(G=B[$],typeof G=="function")this.removeListener($,G);else if(G!==void 0)for(M=G.length-1;M>=0;M--)this.removeListener($,G[M]);return this};function p(k,$,G){var B=k._events;if(B===void 0)return[];var M=B[$];return M===void 0?[]:typeof M=="function"?G?[M.listener||M]:[M]:G?I(M):v(M,M.length)}i.prototype.listeners=function($){return p(this,$,!0)},i.prototype.rawListeners=function($){return p(this,$,!1)},i.listenerCount=function(k,$){return typeof k.listenerCount=="function"?k.listenerCount($):b.call(k,$)},i.prototype.listenerCount=b;function b(k){var $=this._events;if($!==void 0){var G=$[k];if(typeof G=="function")return 1;if(G!==void 0)return G.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function v(k,$){for(var G=new Array($),B=0;B<$;++B)G[B]=k[B];return G}function w(k,$){for(;$+1<k.length;$++)k[$]=k[$+1];k.pop()}function I(k){for(var $=new Array(k.length),G=0;G<$.length;++G)$[G]=k[G].listener||k[G];return $}function S(k,$){return new Promise(function(G,B){function M(P){k.removeListener($,N),B(P)}function N(){typeof k.removeListener=="function"&&k.removeListener("error",M),G([].slice.call(arguments))}C(k,$,N,{once:!0}),$!=="error"&&T(k,M,{once:!0})})}function T(k,$,G){typeof k.on=="function"&&C(k,"error",$,G)}function C(k,$,G,B){if(typeof k.on=="function")B.once?k.once($,G):k.on($,G);else if(typeof k.addEventListener=="function")k.addEventListener($,function M(N){B.once&&k.removeEventListener($,M),G(N)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof k)}return po.exports}var Rc,F1;function _w(){return F1||(F1=1,Rc=Vs().EventEmitter),Rc}var Ic={},Bc={},Tc,q1;function Ew(){return q1||(q1=1,Tc=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[r]=a;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var s=Object.getOwnPropertySymbols(e);if(s.length!==1||s[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==a||o.enumerable!==!0)return!1}return!0}),Tc}var Pc,$1;function Bf(){if($1)return Pc;$1=1;var t=Ew();return Pc=function(){return t()&&!!Symbol.toStringTag},Pc}var Mc,K1;function Sw(){return K1||(K1=1,Mc=Object),Mc}var Oc,G1;function t5(){return G1||(G1=1,Oc=Error),Oc}var Lc,j1;function r5(){return j1||(j1=1,Lc=EvalError),Lc}var Nc,V1;function n5(){return V1||(V1=1,Nc=RangeError),Nc}var kc,z1;function i5(){return z1||(z1=1,kc=ReferenceError),kc}var Cc,W1;function xw(){return W1||(W1=1,Cc=SyntaxError),Cc}var Uc,Z1;function rs(){return Z1||(Z1=1,Uc=TypeError),Uc}var Dc,Y1;function a5(){return Y1||(Y1=1,Dc=URIError),Dc}var Hc,X1;function s5(){return X1||(X1=1,Hc=Math.abs),Hc}var Fc,J1;function o5(){return J1||(J1=1,Fc=Math.floor),Fc}var qc,Q1;function f5(){return Q1||(Q1=1,qc=Math.max),qc}var $c,eg;function c5(){return eg||(eg=1,$c=Math.min),$c}var Kc,tg;function u5(){return tg||(tg=1,Kc=Math.pow),Kc}var Gc,rg;function h5(){return rg||(rg=1,Gc=Math.round),Gc}var jc,ng;function l5(){return ng||(ng=1,jc=Number.isNaN||function(e){return e!==e}),jc}var Vc,ig;function d5(){if(ig)return Vc;ig=1;var t=l5();return Vc=function(r){return t(r)||r===0?r:r<0?-1:1},Vc}var zc,ag;function p5(){return ag||(ag=1,zc=Object.getOwnPropertyDescriptor),zc}var Wc,sg;function ns(){if(sg)return Wc;sg=1;var t=p5();if(t)try{t([],"length")}catch{t=null}return Wc=t,Wc}var Zc,og;function Tf(){if(og)return Zc;og=1;var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return Zc=t,Zc}var Yc,fg;function g5(){if(fg)return Yc;fg=1;var t=typeof Symbol<"u"&&Symbol,e=Ew();return Yc=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Yc}var Xc,cg;function Aw(){return cg||(cg=1,Xc=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Xc}var Jc,ug;function Rw(){if(ug)return Jc;ug=1;var t=Sw();return Jc=t.getPrototypeOf||null,Jc}var Qc,hg;function b5(){if(hg)return Qc;hg=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",a=function(c,u){for(var f=[],l=0;l<c.length;l+=1)f[l]=c[l];for(var p=0;p<u.length;p+=1)f[p+c.length]=u[p];return f},i=function(c,u){for(var f=[],l=u,p=0;l<c.length;l+=1,p+=1)f[p]=c[l];return f},s=function(o,c){for(var u="",f=0;f<o.length;f+=1)u+=o[f],f+1<o.length&&(u+=c);return u};return Qc=function(c){var u=this;if(typeof u!="function"||e.apply(u)!==n)throw new TypeError(t+u);
vendor: 3,541 bytes, line 14
14for(var f=i(arguments,1),l,p=function(){if(this instanceof l){var S=u.apply(this,a(f,arguments));return Object(S)===S?S:this}return u.apply(c,a(f,arguments))},b=r(0,u.length-f.length),v=[],w=0;w<b;w++)v[w]="$"+w;if(l=Function("binder","return function ("+s(v,",")+"){ return binder.apply(this,arguments); }")(p),u.prototype){var I=function(){};I.prototype=u.prototype,l.prototype=new I,I.prototype=null}return l},Qc}var eu,lg;function zs(){if(lg)return eu;lg=1;var t=b5();return eu=Function.prototype.bind||t,eu}var tu,dg;function yd(){return dg||(dg=1,tu=Function.prototype.call),tu}var ru,pg;function vd(){return pg||(pg=1,ru=Function.prototype.apply),ru}var nu,gg;function m5(){return gg||(gg=1,nu=typeof Reflect<"u"&&Reflect&&Reflect.apply),nu}var iu,bg;function Iw(){if(bg)return iu;bg=1;var t=zs(),e=vd(),r=yd(),n=m5();return iu=n||t.call(r,e),iu}var au,mg;function wd(){if(mg)return au;mg=1;var t=zs(),e=rs(),r=yd(),n=Iw();return au=function(i){if(i.length<1||typeof i[0]!="function")throw new e("a function is required");return n(t,r,i)},au}var su,yg;function y5(){if(yg)return su;yg=1;var t=wd(),e=ns(),r;try{r=[].__proto__===Array.prototype}catch(s){if(!s||typeof s!="object"||!("code"in s)||s.code!=="ERR_PROTO_ACCESS")throw s}var n=!!r&&e&&e(Object.prototype,"__proto__"),a=Object,i=a.getPrototypeOf;return su=n&&typeof n.get=="function"?t([n.get]):typeof i=="function"?function(o){return i(o==null?o:a(o))}:!1,su}var ou,vg;function _d(){if(vg)return ou;vg=1;var t=Aw(),e=Rw(),r=y5();return ou=t?function(a){return t(a)}:e?function(a){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("getProto: not an object");return e(a)}:r?function(a){return r(a)}:null,ou}var fu,wg;function Bw(){if(wg)return fu;wg=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=zs();return fu=r.call(t,e),fu}var cu,_g;function Tw(){if(_g)return cu;_g=1;var t,e=Sw(),r=t5(),n=r5(),a=n5(),i=i5(),s=xw(),o=rs(),c=a5(),u=s5(),f=o5(),l=f5(),p=c5(),b=u5(),v=h5(),w=d5(),I=Function,S=function(ee){try{return I('"use strict"; return ('+ee+").constructor;")()}catch{}},T=ns(),C=Tf(),k=function(){throw new o},$=T?(function(){try{return arguments.callee,k}catch{try{return T(arguments,"callee").get}catch{return k}}})():k,G=g5()(),B=_d(),M=Rw(),N=Aw(),P=vd(),x=yd(),d={},m=typeof Uint8Array>"u"||!B?t:B(Uint8Array),h={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?t:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?t:ArrayBuffer,"%ArrayIteratorPrototype%":G&&B?B([][Symbol.iterator]()):t,"%AsyncFromSyncIteratorPrototype%":t,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":typeof Atomics>"u"?t:Atomics,"%BigInt%":typeof BigInt>"u"?t:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?t:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?t:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?t:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":n,"%Float16Array%":typeof Float16Array>"u"?t:Float16Array,"%Float32Array%":typeof Float32Array>"u"?t:Float32Array,"%Float64Array%":typeof Float64Array>"u"?t:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?t:FinalizationRegistry,"%Function%":I,"%GeneratorFunction%":d,"%Int8Array%":typeof Int8Array>"u"?t:Int8Array,"%Int16Array%":typeof Int16Array>"u"?t:Int16Array,"%Int32Array%":typeof Int32Array>
14"u"?t:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":G&&B?B(B([][Symbol.iterator]())):t,"%JSON%":typeof JSON=="object"?JSON:t,"%Map%":typeof Map>"u"?t:Map,"%MapIteratorPrototype%":typeof Map>"u"||!G||!B?t:B(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":T,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?t:Promise,"%Proxy%":typeof Proxy>"u"?t:Proxy,"%RangeError%":a,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?t:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?t:Set,"%SetIteratorPrototype%":typeof Set>"u"||!G||!B?t:B(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?t:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":G&&B?B(""[Symbol.iterator]()):t,"%Symbol%":G?Symbol:t,"%SyntaxError%":s,"%ThrowTypeError%":$,"%TypedArray%":m,"%TypeError%":o,"%Uint8Array%":typeof Uint8Array>"u"?t:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?t:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?t:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?t:Uint32Array,"%URIError%":c,"%WeakMap%":typeof WeakMap>"u"?t:WeakMap,"%WeakRef%":typeof WeakRef>"u"?t:WeakRef,"%WeakSet%":typeof WeakSet>"u"?t:WeakSet,"%Function.prototype.call%":x,"%Function.prototype.apply%":P,"%Object.defineProperty%":C,"%Object.getPrototypeOf%":M,"%Math.abs%":u,"%Math.floor%":f,"%Math.max%":l,"%Math.min%":p,"%Math.pow%":b,"%Math.round%":v,"%Math.sign%":w,"%Reflect.getPrototypeOf%":N};if(B)try{null.error}catch(ee){var g=B(B(ee));h["%Error.prototype%"]=g}var y=function ee(ne){var W;if(ne==="%AsyncFunction%")W=S("async function () {}");else if(ne==="%GeneratorFunction%")W=S("function* () {}");else if(ne==="%AsyncGeneratorFunction%")W=S("async function* () {}");else if(ne==="%AsyncGenerator%"){var z=ee("%AsyncGeneratorFunction%");z&&(W=z.prototype)}else if(ne==="%AsyncIteratorPrototype%"){var ae=ee("%AsyncGenerator%");ae&&B&&(W=B(ae.prototype))}return h[ne]=W,W},_={__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"]},R=zs(),A=Bw(),E=R.call(x,Array.prototype.concat),L=R.call(P,Array.prototype.splice),O=R.call(x,String.prototype.replace),U=R.call(x,String.prototype.slice),X=R.call(x,RegExp.prototype.exec),J=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,j=/\\(\\)?/g,q=function(ne){var W=U(ne,0,1),z=U(ne,-1);if(W==="%"&&z!=="%")throw new s("invalid intrinsic syntax, expected closing `%`");if(z==="%"&&W!=="%")throw new s("invalid intrinsic syntax, expected opening `%`");var ae=[];return O(ne,J,function(pe,ge,be,_e){ae[ae.length]=be?O(_e,j,"$1"):ge||pe}),ae},V=function(ne,W){var z=ne,ae;if(A(_,z)&&(ae=_[z],z="%"+ae[0]+"%"),A(h,z)){var pe=h[z];if(pe===d&&(pe=y(z)),typeof pe>"u"&&!W)throw new o("intrinsic "+ne+" exists, but is not available. Please file an issue!");return{alias:ae,name:z,value:pe}}throw new s("intrinsic "+ne+" does not exist!")};return cu=function(ne,W){if(typeof ne!="string"||ne.length===0)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof W!="boolean")throw new o('"allowMissing" argument must be a boolean');if(X(/^%?[^%]*%?$/,ne)===null)throw new s("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var z=q(ne),ae=z.length>0?z[0]:"",pe=V("%"+ae+"%",W),ge=pe.name,be=pe.value,_e=!1,Ie=pe.alias;Ie&&(ae=Ie[0],L(z,E([0,1],Ie)));for(var de=1,Pe=!0;de<z.length;de+=1){var ye=z[de],we=U(ye,0,1),Ee=U(ye,-1);if((we==='"'||we==="'"||we==="`"||Ee==='"'||Ee==="'"||Ee==="`")&&we!==Ee)throw new s("property names with quotes must have matching quotes");if((ye==="constructor"||!Pe)&&(_e=!0),ae+="."+ye,ge="%"+ae+"%",A(h,ge))be=h[ge];else if(be!=null){if(!(ye in be)){if(!W)throw new o("base intrinsic for "+ne+" exists, but the property is not available.");return}if(T&&de+1>=z.length){var ve=T(be,ye);Pe=!!ve,Pe&&"get"in ve&&!("originalValue"in ve.get)?be=ve.get:be=be[ye]}else Pe=A(be,ye),be=be[ye];Pe&&!_e&&(h[ge]=be)}}return be},cu}var uu,Eg;function is(){if(Eg)return uu;Eg=1;var t=Tw(),e=wd(),r=e([t("%String.prototype.indexOf%")]);return uu=function(a,i){var s=t(a,!!i);return typeof s=="function"&&r(a,".prototype.")>-1?e([s]):s},uu}var hu,Sg;function v5(){if(Sg)return hu;Sg=1;var t=Bf()(),e=is(),r=e("Object.prototype.toString"),n=function(o){return t&&o&&typeof o=="object"&&Symbol.toStringTag in o?!1:r(o)==="[object Arguments]"},a=function(o){return n(o)?!0:o!==null&&typeof o=="object"&&"length"in o&&typeof o.length=="number"&&o.length>=0&&r(o)!=="[object Array]"&&"callee"in o&&r(o.callee)==="[object Function]"},i=(function(){return n(arguments)})();return n.isLegacyArguments=a,hu=i?n:a,hu}var lu,xg;function w5(){if(xg)return lu;xg=1;var t=is(),e=Bf()(),r=Bw(),n=ns(),a;if(e){var i=t("RegExp.prototype.exec"),s={},o=function(){throw s}
14,c={toString:o,valueOf:o};typeof Symbol.toPrimitive=="symbol"&&(c[Symbol.toPrimitive]=o),a=function(p){if(!p||typeof p!="object")return!1;var b=n(p,"lastIndex"),v=b&&r(b,"value");if(!v)return!1;try{i(p,c)}catch(w){return w===s}}}else{var u=t("Object.prototype.toString"),f="[object RegExp]";a=function(p){return!p||typeof p!="object"&&typeof p!="function"?!1:u(p)===f}}return lu=a,lu}var du,Ag;function _5(){if(Ag)return du;Ag=1;var t=is(),e=w5(),r=t("RegExp.prototype.exec"),n=rs();return du=function(i){if(!e(i))throw new n("`regex` must be a RegExp");return function(o){return r(i,o)!==null}},du}var pu,Rg;function E5(){if(Rg)return pu;Rg=1;const t=(function*(){}).constructor;return pu=()=>t,pu}var gu,Ig;function S5(){if(Ig)return gu;Ig=1;var t=is(),e=_5(),r=e(/^\s*(?:function)?\*/),n=Bf()(),a=_d(),i=t("Object.prototype.toString"),s=t("Function.prototype.toString"),o=E5();return gu=function(u){if(typeof u!="function")return!1;if(r(s(u)))return!0;if(!n){var f=i(u);return f==="[object GeneratorFunction]"}if(!a)return!1;var l=o();return l&&a(u)===l.prototype},gu}var bu,Bg;function x5(){if(Bg)return bu;Bg=1;var t=Function.prototype.toString,e=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,n;if(typeof e=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:function(){throw n}}),n={},e(function(){throw 42},null,r)}catch(T){T!==n&&(e=null)}else e=null;var a=/^\s*class\b/,i=function(C){try{var k=t.call(C);return a.test(k)}catch{return!1}},s=function(C){try{return i(C)?!1:(t.call(C),!0)}catch{return!1}},o=Object.prototype.toString,c="[object Object]",u="[object Function]",f="[object GeneratorFunction]",l="[object HTMLAllCollection]",p="[object HTML document.all class]",b="[object HTMLCollection]",v=typeof Symbol=="function"&&!!Symbol.toStringTag,w=!(0 in[,]),I=function(){return!1};if(typeof document=="object"){var S=document.all;o.call(S)===o.call(document.all)&&(I=function(C){if((w||!C)&&(typeof C>"u"||typeof C=="object"))try{var k=o.call(C);return(k===l||k===p||k===b||k===c)&&C("")==null}catch{}return!1})}return bu=e?function(C){if(I(C))return!0;if(!C||typeof C!="function"&&typeof C!="object")return!1;try{e(C,null,r)}catch(k){if(k!==n)return!1}return!i(C)&&s(C)}:function(C){if(I(C))return!0;if(!C||typeof C!="function"&&typeof C!="object")return!1;if(v)return s(C);if(i(C))return!1;var k=o.call(C);return k!==u&&k!==f&&!/^\[object HTML/.test(k)?!1:s(C)},bu}var mu,Tg;function A5(){if(Tg)return mu;Tg=1;var t=x5(),e=Object.prototype.toString,r=Object.prototype.hasOwnProperty,n=function(c,u,f){for(var l=0,p=c.length;l<p;l++)r.call(c,l)&&(f==null?u(c[l],l,c):u.call(f,c[l],l,c))},a=function(c,u,f){for(var l=0,p=c.length;l<p;l++)f==null?u(c.charAt(l),l,c):u.call(f,c.charAt(l),l,c)},i=function(c,u,f){for(var l in c)r.call(c,l)&&(f==null?u(c[l],l,c):u.call(f,c[l],l,c))};function s(o){return e.call(o)==="[object Array]"}return mu=function(c,u,f){if(!t(u))throw new TypeError("iterator must be a function");var l;arguments.length>=3&&(l=f),s(c)?n(c,u,l):typeof c=="string"?a(c,u,l):i(c,u,l)},mu}var yu,Pg;function R5(){return Pg||(Pg=1,yu=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),yu}var vu,Mg;function I5(){if(Mg)return vu;Mg=1;var t=R5(),e=typeof globalThis>"u"?ft:globalThis;return vu=function(){for(var n=[],a=0;a<t.length;a++)typeof e[t[a]]=="function"&&(n[n.length]=t[a]);return n},vu}var wu={exports:{}},_u,Og;function B5(){if(Og)return _u;Og=1;var t=Tf(),e=xw(),r=rs(),n=ns();return _u=function(i,s,o){if(!i||typeof i!="object"&&typeof i!="function")throw new r("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,p=!!n&&n(i,s);if(t)t(i,s,{configurable:f===null&&p?p.configurable:!f,enumerable:c===null&&p?p.enumerable:!c,value:o,writable:u===null&&p?p.writable:!u});else if(l||!c&&!u&&!f)i[s]=o;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_u}var Eu,Lg;function T5(){if(Lg)return Eu;Lg=1;var t=Tf(),e=function(){return!!t};return e.hasArrayLengthDefineBug=function(){if(!t)return null;try{return t([],"length",{value:1}).length!==1}catch{return!0}},Eu=e,Eu}var Su,Ng;function P5(){if(Ng)return Su;Ng=1;var t=Tw(),e=B5(),r=T5()(),n=ns(),a=rs(),i=t("%Math.floor%");return Su=function(o,c){if(typeof o!="function")throw new a("`fn` is not a function");if(typeof c!="number"||c<0||c>4294967295||i(c)!==c)throw new a("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],f=!0,l=!0;if("length"in o&&n){var p=n(o,"length");p&&!p.configurable&&(f=!1),p&&!p.writable&&(l=!1)}
14return(f||l||!u)&&(r?e(o,"length",c,!0,!0):e(o,"length",c)),o},Su}var xu,kg;function M5(){if(kg)return xu;kg=1;var t=zs(),e=vd(),r=Iw();return xu=function(){return r(t,e,arguments)},xu}var Cg;function O5(){return Cg||(Cg=1,(function(t){var e=P5(),r=Tf(),n=wd(),a=M5();t.exports=function(s){var o=n(arguments),c=1+s.length-(arguments.length-1);return e(o,c>0?c:0,!0)},r?r(t.exports,"apply",{value:a}):t.exports.apply=a})(wu)),wu.exports}var Au,Ug;function Pw(){if(Ug)return Au;Ug=1;var t=A5(),e=I5(),r=O5(),n=is(),a=ns(),i=_d(),s=n("Object.prototype.toString"),o=Bf()(),c=typeof globalThis>"u"?ft:globalThis,u=e(),f=n("String.prototype.slice"),l=n("Array.prototype.indexOf",!0)||function(S,T){for(var C=0;C<S.length;C+=1)if(S[C]===T)return C;return-1},p={__proto__:null};o&&a&&i?t(u,function(I){var S=new c[I];if(Symbol.toStringTag in S&&i){var T=i(S),C=a(T,Symbol.toStringTag);if(!C&&T){var k=i(T);C=a(k,Symbol.toStringTag)}if(C&&C.get){var $=r(C.get);p["$"+I]=$}}}):t(u,function(I){var S=new c[I],T=S.slice||S.set;if(T){var C=r(T);p["$"+I]=C}});function b(I){var S=!1;return t(p,function(T,C){if(!S)try{"$"+T(I)===C&&(S=f(C,1))}catch{}}),S}function v(I){var S=!1;return t(p,function(T,C){if(!S)try{T(I),S=f(C,1)}catch{}}),S}function w(I){return l(u,I)>-1}return Au=function(S){if(!S||typeof S!="object")return!1;if(!o){var T=f(s(S),8,-1);return w(T)?T:T!=="Object"?!1:v(S)}return a?b(S):null},Au}var Ru,Dg;function Mw(){if(Dg)return Ru;Dg=1;var t=Pw();return Ru=function(r){return!!t(r)},Ru}var Hg;function L5(){return Hg||(Hg=1,(function(t){var e=v5(),r=S5(),n=Pw(),a=Mw();function i(de){return de.call.bind(de)}var s=typeof BigInt<"u",o=typeof Symbol<"u",c=i(Object.prototype.toString),u=i(Number.prototype.valueOf),f=i(String.prototype.valueOf),l=i(Boolean.prototype.valueOf);if(s)var p=i(BigInt.prototype.valueOf);if(o)var b=i(Symbol.prototype.valueOf);function v(de,Pe){if(typeof de!="object")return!1;try{return Pe(de),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=a;function w(de){return typeof Promise<"u"&&de instanceof Promise||de!==null&&typeof de=="object"&&typeof de.then=="function"&&typeof de.catch=="function"}t.isPromise=w;function I(de){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(de):a(de)||U(de)}t.isArrayBufferView=I;function S(de){return n(de)==="Uint8Array"}t.isUint8Array=S;function T(de){return n(de)==="Uint8ClampedArray"}t.isUint8ClampedArray=T;function C(de){return n(de)==="Uint16Array"}t.isUint16Array=C;function k(de){return n(de)==="Uint32Array"}t.isUint32Array=k;function $(de){return n(de)==="Int8Array"}t.isInt8Array=$;function G(de){return n(de)==="Int16Array"}t.isInt16Array=G;function B(de){return n(de)==="Int32Array"}t.isInt32Array=B;function M(de){return n(de)==="Float32Array"}t.isFloat32Array=M;function N(de){return n(de)==="Float64Array"}t.isFloat64Array=N;function P(de){return n(de)==="BigInt64Array"}t.isBigInt64Array=P;function x(de){return n(de)==="BigUint64Array"}t.isBigUint64Array=x;function d(de){return c(de)==="[object Map]"}d.working=typeof Map<"u"&&d(new Map);function m(de){return typeof Map>"u"?!1:d.working?d(de):de instanceof Map}t.isMap=m;function h(de){return c(de)==="[object Set]"}h.working=typeof Set<"u"&&h(new Set);function g(de){return typeof Set>"u"?!1:h.working?h(de):de instanceof Set}t.isSet=g;function y(de){return c(de)==="[object WeakMap]"}y.working=typeof WeakMap<"u"&&y(new WeakMap);function _(de){return typeof WeakMap>"u"?!1:y.working?y(de):de instanceof WeakMap}t.isWeakMap=_;function R(de){return c(de)==="[object WeakSet]"}R.working=typeof WeakSet<"u"&&R(new WeakSet);function A(de){return R(de)}t.isWeakSet=A;function E(de){return c(de)==="[object ArrayBuffer]"}E.working=typeof ArrayBuffer<"u"&&E(new ArrayBuffer);function L(de){return typeof ArrayBuffer>"u"?!1:E.working?E(de):de instanceof ArrayBuffer}t.isArrayBuffer=L;function O(de){return c(de)==="[object DataView]"}O.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&O(new DataView(new ArrayBuffer(1),0,1));function U(de){return typeof DataView>"u"?!1:O.working?O(de):de instanceof DataView}t.isDataView=U;var X=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;
14function J(de){return c(de)==="[object SharedArrayBuffer]"}function j(de){return typeof X>"u"?!1:(typeof J.working>"u"&&(J.working=J(new X)),J.working?J(de):de instanceof X)}t.isSharedArrayBuffer=j;function q(de){return c(de)==="[object AsyncFunction]"}t.isAsyncFunction=q;function V(de){return c(de)==="[object Map Iterator]"}t.isMapIterator=V;function ee(de){return c(de)==="[object Set Iterator]"}t.isSetIterator=ee;function ne(de){return c(de)==="[object Generator]"}t.isGeneratorObject=ne;function W(de){return c(de)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=W;function z(de){return v(de,u)}t.isNumberObject=z;function ae(de){return v(de,f)}t.isStringObject=ae;function pe(de){return v(de,l)}t.isBooleanObject=pe;function ge(de){return s&&v(de,p)}t.isBigIntObject=ge;function be(de){return o&&v(de,b)}t.isSymbolObject=be;function _e(de){return z(de)||ae(de)||pe(de)||ge(de)||be(de)}t.isBoxedPrimitive=_e;function Ie(de){return typeof Uint8Array<"u"&&(L(de)||j(de))}t.isAnyArrayBuffer=Ie,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(de){Object.defineProperty(t,de,{enumerable:!1,value:function(){throw new Error(de+" is not supported in userland")}})})})(Bc)),Bc}var Iu,Fg;function N5(){return Fg||(Fg=1,Iu=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),Iu}var qg;function Pf(){return qg||(qg=1,(function(t){var e={},r=Object.getOwnPropertyDescriptors||function(X){for(var J=Object.keys(X),j={},q=0;q<J.length;q++)j[J[q]]=Object.getOwnPropertyDescriptor(X,J[q]);return j},n=/%[sdj%]/g;t.format=function(U){if(!G(U)){for(var X=[],J=0;J<arguments.length;J++)X.push(o(arguments[J]));return X.join(" ")}for(var J=1,j=arguments,q=j.length,V=String(U).replace(n,function(ne){if(ne==="%%")return"%";if(J>=q)return ne;switch(ne){case"%s":return String(j[J++]);case"%d":return Number(j[J++]);case"%j":try{return JSON.stringify(j[J++])}catch{return"[Circular]"}default:return ne}}),ee=j[J];J<q;ee=j[++J])C(ee)||!P(ee)?V+=" "+ee:V+=" "+o(ee);return V},t.deprecate=function(U,X){if(typeof ke<"u"&&ke.noDeprecation===!0)return U;if(typeof ke>"u")return function(){return t.deprecate(U,X).apply(this,arguments)};var J=!1;function j(){if(!J){if(ke.throwDeprecation)throw new Error(X);ke.traceDeprecation?console.trace(X):console.error(X),J=!0}return U.apply(this,arguments)}return j};var a={},i=/^$/;if(e.NODE_DEBUG){var s=e.NODE_DEBUG;s=s.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),i=new RegExp("^"+s+"$","i")}t.debuglog=function(U){if(U=U.toUpperCase(),!a[U])if(i.test(U)){var X=ke.pid;a[U]=function(){var J=t.format.apply(t,arguments);console.error("%s %d: %s",U,X,J)}}else a[U]=function(){};return a[U]};function o(U,X){var J={seen:[],stylize:u};return arguments.length>=3&&(J.depth=arguments[2]),arguments.length>=4&&(J.colors=arguments[3]),T(X)?J.showHidden=X:X&&t._extend(J,X),M(J.showHidden)&&(J.showHidden=!1),M(J.depth)&&(J.depth=2),M(J.colors)&&(J.colors=!1),M(J.customInspect)&&(J.customInspect=!0),J.colors&&(J.stylize=c),l(J,U,J.depth)}t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function c(U,X){var J=o.styles[X];return J?"\x1B["+o.colors[J][0]+"m"+U+"\x1B["+o.colors[J][1]+"m":U}function u(U,X){return U}function f(U){var X={};return U.forEach(function(J,j){X[J]=!0}),X}function l(U,X,J){if(U.customInspect&&X&&m(X.inspect)&&X.inspect!==t.inspect&&!(X.constructor&&X.constructor.prototype===X)){var j=X.inspect(J,U);return G(j)||(j=l(U,j,J)),j}var q=p(U,X);if(q)return q;var V=Object.keys(X),ee=f(V);if(U.showHidden&&(V=Object.getOwnPropertyNames(X)),d(X)&&(V.indexOf("message")>=0||V.indexOf("description")>=0))return b(X);if(V.length===0){if(m(X)){var ne=X.name?": "+X.name:"";return U.stylize("[Function"+ne+"]","special")}if(N(X))return U.stylize(RegExp.prototype.toString.call(X),"regexp");if(x(X))return U.stylize(Date.prototype.toString.call(X),"date");if(d(X))return b(X)}var W="",z=!1,ae=["{","}"];if(S(X)&&(z=!0,ae=["[","]"]),m(X)){var pe=X.name?": "+X.name:"";W=" [Function"+pe+"]"}if(N(X)&&(W=" "+RegExp.prototype.toString.call(X)),x(X)&&(W=" "+Date.prototype.toUTCString.call(X)),d(X)&&(W=" "+b(X)),V.length===0&&(!z||X.length==0))return ae[0]+W+ae[1];if(J<0)return N(X)?U.stylize(RegExp.prototype.toString.call(X),"regexp"):U.stylize("[Object]","special");U.seen.push(X);var ge;return z?ge=v(U,X,J,ee,V):ge=V.map(function(be){return w(U,X,J,ee,be,z)}),U.seen.pop(),I(ge,W,ae)}function p(U,X){if(M(X))return U.stylize("undefined","undefined");if(G(X)){var J="'"+JSON.stringify(X).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return U.stylize(J,"string")}if($(X))return U.stylize(""+X,"number");if(T(X))return U.stylize(""+X,"boolean");if(C(X))return U.stylize("null","null")}function b(U){return"["+Error.prototype.toString.call(U)+"]"}function v(U,X,J,j,q){for(var V=[],ee=0,ne=X.length;ee<ne;++ee)A(X,String(ee))?V.push(w(U,X,J,j,String(ee),!0)):V.push("");return q.forEach(function(W){W.match(/^\d+$/)||V.push(w(U,X,J,j,W,!0))}),V}function w(U,X,J,j,q,V){var ee,ne,W;if(W=Object.getOwnPropertyDescriptor(X,q)||{value:X[q]},W.get?W.set?ne=U.stylize("[Getter/Setter]","special"):ne=U.stylize("[Getter]","special"):W.set&&(ne=U.stylize("[
14Setter]","special")),A(j,q)||(ee="["+q+"]"),ne||(U.seen.indexOf(W.value)<0?(C(J)?ne=l(U,W.value,null):ne=l(U,W.value,J-1),ne.indexOf(`
15`)>-1&&(V?ne=ne.split(`
16`).map(function(z){return"  "+z}).join(`
17`).slice(2):ne=`
18`+ne.split(`
19`).map(function(z){return"   "+z}).join(`
20`))):ne=U.stylize("[Circular]","special")),M(ee)){if(V&&q.match(/^\d+$/))return ne;ee=JSON.stringify(""+q),ee.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(ee=ee.slice(1,-1),ee=U.stylize(ee,"name")):(ee=ee.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),ee=U.stylize(ee,"string"))}return ee+": "+ne}function I(U,X,J){var j=U.reduce(function(q,V){return V.indexOf(`
21`)>=0,q+V.replace(/\u001b\[\d\d?m/g,"").length+1},0);return j>60?J[0]+(X===""?"":X+`
22 `)+" "+U.join(`,
23  `)+" "+J[1]:J[0]+X+" "+U.join(", ")+" "+J[1]}t.types=L5();function S(U){return Array.isArray(U)}t.isArray=S;function T(U){return typeof U=="boolean"}t.isBoolean=T;function C(U){return U===null}t.isNull=C;function k(U){return U==null}t.isNullOrUndefined=k;function $(U){return typeof U=="number"}t.isNumber=$;function G(U){return typeof U=="string"}t.isString=G;function B(U){return typeof U=="symbol"}t.isSymbol=B;function M(U){return U===void 0}t.isUndefined=M;function N(U){return P(U)&&g(U)==="[object RegExp]"}t.isRegExp=N,t.types.isRegExp=N;function P(U){return typeof U=="object"&&U!==null}t.isObject=P;function x(U){return P(U)&&g(U)==="[object Date]"}t.isDate=x,t.types.isDate=x;function d(U){return P(U)&&(g(U)==="[object Error]"||U instanceof Error)}t.isError=d,t.types.isNativeError=d;function m(U){return typeof U=="function"}t.isFunction=m;function h(U){return U===null||typeof U=="boolean"||typeof U=="number"||typeof U=="string"||typeof U=="symbol"||typeof U>"u"}t.isPrimitive=h,t.isBuffer=N5();function g(U){return Object.prototype.toString.call(U)}function y(U){return U<10?"0"+U.toString(10):U.toString(10)}var _=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var U=new Date,X=[y(U.getHours()),y(U.getMinutes()),y(U.getSeconds())].join(":");return[U.getDate(),_[U.getMonth()],X].join(" ")}t.log=function(){console.log("%s - %s",R(),t.format.apply(t,arguments))},t.inherits=Ye(),t._extend=function(U,X){if(!X||!P(X))return U;for(var J=Object.keys(X),j=J.length;j--;)U[J[j]]=X[J[j]];return U};function A(U,X){return Object.prototype.hasOwnProperty.call(U,X)}var E=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(X){if(typeof X!="function")throw new TypeError('The "original" argument must be of type Function');if(E&&X[E]){var J=X[E];if(typeof J!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(J,E,{value:J,enumerable:!1,writable:!1,configurable:!0}),J}function J(){for(var j,q,V=new Promise(function(W,z){j=W,q=z}),ee=[],ne=0;ne<arguments.length;ne++)ee.push(arguments[ne]);ee.push(function(W,z){W?q(W):j(z)});try{X.apply(this,ee)}catch(W){q(W)}return V}return Object.setPrototypeOf(J,Object.getPrototypeOf(X)),E&&Object.defineProperty(J,E,{value:J,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(J,r(X))},t.promisify.custom=E;function L(U,X){if(!U){var J=new Error("Promise was rejected with a falsy value");J.reason=U,U=J}return X(U)}function O(U){if(typeof U!="function")throw new TypeError('The "original" argument must be of type Function');function X(){for(var J=[],j=0;j<arguments.length;j++)J.push(arguments[j]);var q=J.pop();if(typeof q!="function")throw new TypeError("The last argument must be of type Function");var V=this,ee=function(){return q.apply(V,arguments)};U.apply(this,J).then(function(ne){ke.nextTick(ee.bind(null,null,ne))},function(ne){ke.nextTick(L.bind(null,ne,ee))})}return Object.setPrototypeOf(X,Object.getPrototypeOf(U)),Object.defineProperties(X,r(U)),X}t.callbackify=O})(Ic)),Ic}var Bu,$g;function k5(){if($g)return Bu;$g=1;function t(v,w){var I=Object.keys(v);if(Object.getOwnPropertySymbols){var S=Object.getOwnPropertySymbols(v);w&&(S=S.filter(function(T){return Object.getOwnPropertyDescriptor(v,T).enumerable})),I.push.apply(I,S)}return I}function e(v){for(var w=1;w<arguments.length;w++){var I=arguments[w]!=null?arguments[w]:{};
vendor: 4,772 bytes, line 23
23w%2?t(Object(I),!0).forEach(function(S){r(v,S,I[S])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(I)):t(Object(I)).forEach(function(S){Object.defineProperty(v,S,Object.getOwnPropertyDescriptor(I,S))})}return v}function r(v,w,I){return w=s(w),w in v?Object.defineProperty(v,w,{value:I,enumerable:!0,configurable:!0,writable:!0}):v[w]=I,v}function n(v,w){if(!(v instanceof w))throw new TypeError("Cannot call a class as a function")}function a(v,w){for(var I=0;I<w.length;I++){var S=w[I];S.enumerable=S.enumerable||!1,S.configurable=!0,"value"in S&&(S.writable=!0),Object.defineProperty(v,s(S.key),S)}}function i(v,w,I){return w&&a(v.prototype,w),Object.defineProperty(v,"prototype",{writable:!1}),v}function s(v){var w=o(v,"string");return typeof w=="symbol"?w:String(w)}function o(v,w){if(typeof v!="object"||v===null)return v;var I=v[Symbol.toPrimitive];if(I!==void 0){var S=I.call(v,w);if(typeof S!="object")return S;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}var c=Or(),u=c.Buffer,f=Pf(),l=f.inspect,p=l&&l.custom||"inspect";function b(v,w,I){u.prototype.copy.call(v,w,I)}return Bu=(function(){function v(){n(this,v),this.head=null,this.tail=null,this.length=0}return i(v,[{key:"push",value:function(I){var S={data:I,next:null};this.length>0?this.tail.next=S:this.head=S,this.tail=S,++this.length}},{key:"unshift",value:function(I){var S={data:I,next:this.head};this.length===0&&(this.tail=S),this.head=S,++this.length}},{key:"shift",value:function(){if(this.length!==0){var I=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,I}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(I){if(this.length===0)return"";for(var S=this.head,T=""+S.data;S=S.next;)T+=I+S.data;return T}},{key:"concat",value:function(I){if(this.length===0)return u.alloc(0);for(var S=u.allocUnsafe(I>>>0),T=this.head,C=0;T;)b(T.data,S,C),C+=T.data.length,T=T.next;return S}},{key:"consume",value:function(I,S){var T;return I<this.head.data.length?(T=this.head.data.slice(0,I),this.head.data=this.head.data.slice(I)):I===this.head.data.length?T=this.shift():T=S?this._getString(I):this._getBuffer(I),T}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(I){var S=this.head,T=1,C=S.data;for(I-=C.length;S=S.next;){var k=S.data,$=I>k.length?k.length:I;if($===k.length?C+=k:C+=k.slice(0,I),I-=$,I===0){$===k.length?(++T,S.next?this.head=S.next:this.head=this.tail=null):(this.head=S,S.data=k.slice($));break}++T}return this.length-=T,C}},{key:"_getBuffer",value:function(I){var S=u.allocUnsafe(I),T=this.head,C=1;for(T.data.copy(S),I-=T.data.length;T=T.next;){var k=T.data,$=I>k.length?k.length:I;if(k.copy(S,S.length-I,0,$),I-=$,I===0){$===k.length?(++C,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=k.slice($));break}++C}return this.length-=C,S}},{key:p,value:function(I,S){return l(this,e(e({},S),{},{depth:0,customInspect:!1}))}}]),v})(),Bu}var Tu,Kg;function Ow(){if(Kg)return Tu;Kg=1;function t(s,o){var c=this,u=this._readableState&&this._readableState.destroyed,f=this._writableState&&this._writableState.destroyed;return u||f?(o?o(s):s&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,ke.nextTick(a,this,s)):ke.nextTick(a,this,s)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(s||null,function(l){!o&&l?c._writableState?c._writableState.errorEmitted?ke.nextTick(r,c):(c._writableState.errorEmitted=!0,ke.nextTick(e,c,l)):ke.nextTick(e,c,l):o?(ke.nextTick(r,c),o(l)):ke.nextTick(r,c)}),this)}function e(s,o){a(s,o),r(s)}function r(s){s._writableState&&!s._writableState.emitClose||s._readableState&&!s._readableState.emitClose||s.emit("close")}function n(){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 a(s,o){s.emit("error",o)}function i(s,o){var c=s._readableState,u=s._writableState;c&&c.autoDestroy||u&&u.autoDestroy?s.destroy(o):s.emit("error",o)}return Tu={destroy:t,undestroy:n,errorOrDestroy:i},Tu}var Pu={},Gg;function as(){if(Gg)return Pu;Gg=1;function t(o,c){o.prototype=Object.create(c.prototype),o.prototype.constructor=o,o.__proto__=c}var e={};function r(o,c,u){u||(u=Error);function f(p,b,v){return typeof c=="string"?c:c(p,b,v)}
vendor: 11,969 bytes, line 23
23var l=(function(p){t(b,p);function b(v,w,I){return p.call(this,f(v,w,I))||this}return b})(u);l.prototype.name=u.name,l.prototype.code=o,e[o]=l}function n(o,c){if(Array.isArray(o)){var u=o.length;return o=o.map(function(f){return String(f)}),u>2?"one of ".concat(c," ").concat(o.slice(0,u-1).join(", "),", or ")+o[u-1]:u===2?"one of ".concat(c," ").concat(o[0]," or ").concat(o[1]):"of ".concat(c," ").concat(o[0])}else return"of ".concat(c," ").concat(String(o))}function a(o,c,u){return o.substr(0,c.length)===c}function i(o,c,u){return(u===void 0||u>o.length)&&(u=o.length),o.substring(u-c.length,u)===c}function s(o,c,u){return typeof u!="number"&&(u=0),u+c.length>o.length?!1:o.indexOf(c,u)!==-1}return r("ERR_INVALID_OPT_VALUE",function(o,c){return'The value "'+c+'" is invalid for option "'+o+'"'},TypeError),r("ERR_INVALID_ARG_TYPE",function(o,c,u){var f;typeof c=="string"&&a(c,"not ")?(f="must not be",c=c.replace(/^not /,"")):f="must be";var l;if(i(o," argument"))l="The ".concat(o," ").concat(f," ").concat(n(c,"type"));else{var p=s(o,".")?"property":"argument";l='The "'.concat(o,'" ').concat(p," ").concat(f," ").concat(n(c,"type"))}return l+=". Received type ".concat(typeof u),l},TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",function(o){return"The "+o+" method is not implemented"}),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",function(o){return"Cannot call "+o+" after a stream was destroyed"}),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",function(o){return"Unknown encoding: "+o},TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Pu.codes=e,Pu}var Mu,jg;function Lw(){if(jg)return Mu;jg=1;var t=as().codes.ERR_INVALID_OPT_VALUE;function e(n,a,i){return n.highWaterMark!=null?n.highWaterMark:a?n[i]:null}function r(n,a,i,s){var o=e(a,s,i);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var c=s?i:"highWaterMark";throw new t(c,o)}return Math.floor(o)}return n.objectMode?16:16*1024}return Mu={getHighWaterMark:r},Mu}var Ou,Vg;function Nw(){if(Vg)return Ou;Vg=1,Ou=t;function t(r,n){if(e("noDeprecation"))return r;var a=!1;function i(){if(!a){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),a=!0}return r.apply(this,arguments)}return i}function e(r){try{if(!ft.localStorage)return!1}catch{return!1}var n=ft.localStorage[r];return n==null?!1:String(n).toLowerCase()==="true"}return Ou}var Lu,zg;function kw(){if(zg)return Lu;zg=1,Lu=M;function t(j){var q=this;this.next=null,this.entry=null,this.finish=function(){J(q,j)}}var e;M.WritableState=G;var r={deprecate:Nw()},n=_w(),a=Or().Buffer,i=(typeof ft<"u"?ft:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function s(j){return a.from(j)}function o(j){return a.isBuffer(j)||j instanceof i}var c=Ow(),u=Lw(),f=u.getHighWaterMark,l=as().codes,p=l.ERR_INVALID_ARG_TYPE,b=l.ERR_METHOD_NOT_IMPLEMENTED,v=l.ERR_MULTIPLE_CALLBACK,w=l.ERR_STREAM_CANNOT_PIPE,I=l.ERR_STREAM_DESTROYED,S=l.ERR_STREAM_NULL_VALUES,T=l.ERR_STREAM_WRITE_AFTER_END,C=l.ERR_UNKNOWN_ENCODING,k=c.errorOrDestroy;Ye()(M,n);function $(){}function G(j,q,V){e=e||Wa(),j=j||{},typeof V!="boolean"&&(V=q instanceof e),this.objectMode=!!j.objectMode,V&&(this.objectMode=this.objectMode||!!j.writableObjectMode),this.highWaterMark=f(this,j,"writableHighWaterMark",V),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var ee=j.decodeStrings===!1;this.decodeStrings=!ee,this.defaultEncoding=j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(ne){y(q,ne)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=j.emitClose!==!1,this.autoDestroy=!!j.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}G.prototype.getBuffer=function(){for(var q=this.bufferedRequest,V=[];q;)V.push(q),q=q.next;return V},(function(){try{Object.defineProperty(G.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var B;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(B=Function.prototype[Symbol.hasInstance],Object.defineProperty(M,Symbol.hasInstance,{value:function(q){return B.call(this,q)?!0:this!==M?!1:q&&q._writableState instanceof G}})):B=function(q){return q instanceof this};function M(j){e=e||Wa();var q=this instanceof e;if(!q&&!B.call(M,this))return new M(j);this._writableState=new G(j,this,q),this.writable=!0,j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final)),n.call(this)}M.prototype.pipe=function(){k(this,new w)};function N(j,q){var V=new T;k(j,V),ke.nextTick(q,V)}function P(j,q,V,ee){var ne;return V===null?ne=new S:typeof V!="string"&&!q.objectMode&&(ne=new p("chunk",["string","Buffer"],V)),ne?(k(j,ne),ke.nextTick(ee,ne),!1):!0}M.prototype.write=function(j,q,V){var ee=this._writableState,ne=!1,W=!ee.objectMode&&o(j);return W&&!a.isBuffer(j)&&(j=s(j)),typeof q=="function"&&(V=q,q=null),W?q="buffer":q||(q=ee.defaultEncoding),typeof V!="function"&&(V=$),ee.ending?N(this,V):(W||P(this,ee,j,V))&&(ee.pendingcb++,ne=d(this,ee,W,j,q,V)),ne},M.prototype.cork=function(){this._writableState.corked++},M.prototype.uncork=function(){var j=this._writableState;j.corked&&(j.corked--,!j.writing&&!j.corked&&!j.bufferProcessing&&j.bufferedRequest&&A(this,j))},M.prototype.setDefaultEncoding=function(q){if(typeof q=="string"&&(q=q.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((q+"").toLowerCase())>-1))throw new C(q);return this._writableState.defaultEncoding=q,this},Object.defineProperty(M.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function x(j,q,V){return!j.objectMode&&j.decodeStrings!==!1&&typeof q=="string"&&(q=a.from(q,V)),q}Object.defineProperty(M.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function d(j,q,V,ee,ne,W){if(!V){var z=x(q,ee,ne);ee!==z&&(V=!0,ne="buffer",ee=z)}var ae=q.objectMode?1:ee.length;q.length+=ae;var pe=q.length<q.highWaterMark;if(pe||(q.needDrain=!0),q.writing||q.corked){var ge=q.lastBufferedRequest;q.lastBufferedRequest={chunk:ee,encoding:ne,isBuf:V,callback:W,next:null},ge?ge.next=q.lastBufferedRequest:q.bufferedRequest=q.lastBufferedRequest,q.bufferedRequestCount+=1}else m(j,q,!1,ae,ee,ne,W);return pe}function m(j,q,V,ee,ne,W,z){q.writelen=ee,q.writecb=z,q.writing=!0,q.sync=!0,q.destroyed?q.onwrite(new I("write")):V?j._writev(ne,q.onwrite):j._write(ne,W,q.onwrite),q.sync=!1}function h(j,q,V,ee,ne){--q.pendingcb,V?(ke.nextTick(ne,ee),ke.nextTick(U,j,q),j._writableState.errorEmitted=!0,k(j,ee)):(ne(ee),j._writableState.errorEmitted=!0,k(j,ee),U(j,q))}function g(j){j.writing=!1,j.writecb=null,j.length-=j.writelen,j.writelen=0}function y(j,q){var V=j._writableState,ee=V.sync,ne=V.writecb;if(typeof ne!="function")throw new v;if(g(V),q)h(j,V,ee,q,ne);else{var W=E(V)||j.destroyed;!W&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest&&A(j,V),ee?ke.nextTick(_,j,V,W,ne):_(j,V,W,ne)}}function _(j,q,V,ee){V||R(j,q),q.pendingcb--,ee(),U(j,q)}function R(j,q){q.length===0&&q.needDrain&&(q.needDrain=!1,j.emit("drain"))}function A(j,q){q.bufferProcessing=!0;var V=q.bufferedRequest;if(j._writev&&V&&V.next){var ee=q.bufferedRequestCount,ne=new Array(ee),W=q.corkedRequestsFree;W.entry=V;for(var z=0,ae=!0;V;)ne[z]=V,V.isBuf||(ae=!1),V=V.next,z+=1;ne.allBuffers=ae,m(j,q,!0,q.length,ne,"",W.finish),q.pendingcb++,q.lastBufferedRequest=null,W.next?(q.corkedRequestsFree=W.next,W.next=null):q.corkedRequestsFree=new t(q),q.bufferedRequestCount=0}else{for(;V;){var pe=V.chunk,ge=V.encoding,be=V.callback,_e=q.objectMode?1:pe.length;if(m(j,q,!1,_e,pe,ge,be),V=V.next,q.bufferedRequestCount--,q.writing)break}V===null&&(q.lastBufferedRequest=null)}q.bufferedRequest=V,q.bufferProcessing=!1}M.prototype._write=function(j,q,V){V(new b("_write()"))},M.prototype._writev=null,M.prototype.end=function(j,q,V){var ee=this._writableState;return typeof j=="function"?(V=j,j=null,q=null):typeof q=="function"&&(V=q,q=null),j!=null&&this.write(j,q),ee.corked&&(ee.corked=1,this.uncork()),ee.ending||X(this,ee,V),this},Object.defineProperty(M.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function E(j){return j.ending&&j.length===0&&j.bufferedRequest===null&&!j.finished&&!j.writing}function L(j,q){j._final(function(V){q.pendingcb--,V&&k(j,V),q.prefinished=!0,j.emit("prefinish"),U(j,q)})}function O(j,q){!q.prefinished&&!q.finalCalled&&(typeof j._final=="function"&&!q.destroyed?(q.pendingcb++,q.finalCalled=!0,ke.nextTick(L,j,q)):(q.prefinished=!0,j.emit("prefinish")))}function U(j,q){var V=E(q);if(V&&(O(j,q),q.pendingcb===0&&(q.finished=!0,j.emit("finish"),q.autoDestroy))){var ee=j._readableState;(!ee||ee.autoDestroy&&ee.endEmitted)&&j.destroy()}return V}function X(j,q,V){q.ending=!0,U(j,q),V&&(q.finished?ke.nextTick(V):j.once("finish",V)),q.ended=!0,j.writable=!1}function J(j,q,V){var ee=j.entry;for(j.entry=null;ee;){var ne=ee.callback;q.pendingcb--,ne(V),ee=ee.next}q.corkedRequestsFree.next=j}return Object.defineProperty(M.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(q){this._writableState&&(this._writableState.destroyed=q)}}),M.prototype.destroy=c.destroy,M.prototype._undestroy=c.undestroy,M.prototype._destroy=function(j,q){q(j)},Lu}var Nu,Wg;function Wa(){if(Wg)return Nu;Wg=1;var t=Object.keys||function(u){var f=[];for(var l in u)f.push(l);return f};Nu=s;var e=Cw(),r=kw();Ye()(s,e);for(var n=t(r.prototype),a=0;a<n.length;a++){var i=n[a];s.prototype[i]||(s.prototype[i]=r.prototype[i])}function s(u){if(!(this instanceof s))return new s(u);e.call(this,u),r.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",o)))}Object.defineProperty(s.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(s.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(s.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function o(){this._writableState.ended||ke.nextTick(c,this)}function c(u){u.end()}return Object.defineProperty(s.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(f){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=f,this._writableState.destroyed=f)}}),Nu}var ku={},Zg;function Os(){if(Zg)return ku;Zg=1;var t=et().Buffer,e=t.isEncoding||function(S){switch(S=""+S,S&&S.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 r(S){if(!S)return"utf8";for(var T;;)switch(S){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";
vendor: 5,607 bytes, line 23
23case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return S;default:if(T)return;S=(""+S).toLowerCase(),T=!0}}function n(S){var T=r(S);if(typeof T!="string"&&(t.isEncoding===e||!e(S)))throw new Error("Unknown encoding: "+S);return T||S}ku.StringDecoder=a;function a(S){this.encoding=n(S);var T;switch(this.encoding){case"utf16le":this.text=l,this.end=p,T=4;break;case"utf8":this.fillLast=c,T=4;break;case"base64":this.text=b,this.end=v,T=3;break;default:this.write=w,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(T)}a.prototype.write=function(S){if(S.length===0)return"";var T,C;if(this.lastNeed){if(T=this.fillLast(S),T===void 0)return"";C=this.lastNeed,this.lastNeed=0}else C=0;return C<S.length?T?T+this.text(S,C):this.text(S,C):T||""},a.prototype.end=f,a.prototype.text=u,a.prototype.fillLast=function(S){if(this.lastNeed<=S.length)return S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,S.length),this.lastNeed-=S.length};function i(S){return S<=127?0:S>>5===6?2:S>>4===14?3:S>>3===30?4:S>>6===2?-1:-2}function s(S,T,C){var k=T.length-1;if(k<C)return 0;var $=i(T[k]);return $>=0?($>0&&(S.lastNeed=$-1),$):--k<C||$===-2?0:($=i(T[k]),$>=0?($>0&&(S.lastNeed=$-2),$):--k<C||$===-2?0:($=i(T[k]),$>=0?($>0&&($===2?$=0:S.lastNeed=$-3),$):0))}function o(S,T,C){if((T[0]&192)!==128)return S.lastNeed=0,"�";if(S.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return S.lastNeed=1,"�";if(S.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return S.lastNeed=2,"�"}}function c(S){var T=this.lastTotal-this.lastNeed,C=o(this,S);if(C!==void 0)return C;if(this.lastNeed<=S.length)return S.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,T,0,S.length),this.lastNeed-=S.length}function u(S,T){var C=s(this,S,T);if(!this.lastNeed)return S.toString("utf8",T);this.lastTotal=C;var k=S.length-(C-this.lastNeed);return S.copy(this.lastChar,0,k),S.toString("utf8",T,k)}function f(S){var T=S&&S.length?this.write(S):"";return this.lastNeed?T+"�":T}function l(S,T){if((S.length-T)%2===0){var C=S.toString("utf16le",T);if(C){var k=C.charCodeAt(C.length-1);if(k>=55296&&k<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1],C.slice(0,-1)}return C}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=S[S.length-1],S.toString("utf16le",T,S.length-1)}function p(S){var T=S&&S.length?this.write(S):"";if(this.lastNeed){var C=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,C)}return T}function b(S,T){var C=(S.length-T)%3;return C===0?S.toString("base64",T):(this.lastNeed=3-C,this.lastTotal=3,C===1?this.lastChar[0]=S[S.length-1]:(this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1]),S.toString("base64",T,S.length-C))}function v(S){var T=S&&S.length?this.write(S):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function w(S){return S.toString(this.encoding)}function I(S){return S&&S.length?this.write(S):""}return ku}var Cu,Yg;function Ed(){if(Yg)return Cu;Yg=1;var t=as().codes.ERR_STREAM_PREMATURE_CLOSE;function e(i){var s=!1;return function(){if(!s){s=!0;for(var o=arguments.length,c=new Array(o),u=0;u<o;u++)c[u]=arguments[u];i.apply(this,c)}}}function r(){}function n(i){return i.setHeader&&typeof i.abort=="function"}function a(i,s,o){if(typeof s=="function")return a(i,null,s);s||(s={}),o=e(o||r);var c=s.readable||s.readable!==!1&&i.readable,u=s.writable||s.writable!==!1&&i.writable,f=function(){i.writable||p()},l=i._writableState&&i._writableState.finished,p=function(){u=!1,l=!0,c||o.call(i)},b=i._readableState&&i._readableState.endEmitted,v=function(){c=!1,b=!0,u||o.call(i)},w=function(C){o.call(i,C)},I=function(){var C;if(c&&!b)return(!i._readableState||!i._readableState.ended)&&(C=new t),o.call(i,C);if(u&&!l)return(!i._writableState||!i._writableState.ended)&&(C=new t),o.call(i,C)},S=function(){i.req.on("finish",p)};return n(i)?(i.on("complete",p),i.on("abort",I),i.req?S():i.on("request",S)):u&&!i._writableState&&(i.on("end",f),i.on("close",f)),i.on("end",v),i.on("finish",p),s.error!==!1&&i.on("error",w),i.on("close",I),function(){i.removeListener("complete",p),i.removeListener("abort",I),i.removeListener("request",S),i.req&&i.req.removeListener("finish",p),i.removeListener("end",f),i.removeListener("close",f),i.removeListener("finish",p),i.removeListener("end",v),i.removeListener("error",w),i.removeListener("close",I)}}return Cu=a,Cu}var Uu,Xg;function C5(){if(Xg)return Uu;Xg=1;var t;function e(C,k,$){return k=r(k),k in C?Object.defineProperty(C,k,{value:$,enumerable:!0,configurable:!0,writable:!0}):C[k]=$,C}function r(C){var k=n(C,"string");return typeof k=="symbol"?k:String(k)}function n(C,k){if(typeof C!="object"||C===null)return C;var $=C[Symbol.toPrimitive];if($!==void 0){var G=$.call(C,k);if(typeof G!="object")return G;throw new TypeError("@@toPrimitive must return a primitive value.")}return(k==="string"?String:Number)(C)}var a=Ed(),i=Symbol("lastResolve"),s=Symbol("lastReject"),o=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),f=Symbol("handlePromise"),l=Symbol("stream");function p(C,k){return{value:C,done:k}}function b(C){var k=C[i];if(k!==null){var $=C[l].read();$!==null&&(C[u]=null,C[i]=null,C[s]=null,k(p($,!1)))}}function v(C){ke.nextTick(b,C)}function w(C,k){return function($,G){C.then(function(){if(k[c]){$(p(void 0,!0));return}k[f]($,G)},G)}}var I=Object.getPrototypeOf(function(){}
23),S=Object.setPrototypeOf((t={get stream(){return this[l]},next:function(){var k=this,$=this[o];if($!==null)return Promise.reject($);if(this[c])return Promise.resolve(p(void 0,!0));if(this[l].destroyed)return new Promise(function(N,P){ke.nextTick(function(){k[o]?P(k[o]):N(p(void 0,!0))})});var G=this[u],B;if(G)B=new Promise(w(G,this));else{var M=this[l].read();if(M!==null)return Promise.resolve(p(M,!1));B=new Promise(this[f])}return this[u]=B,B}},e(t,Symbol.asyncIterator,function(){return this}),e(t,"return",function(){var k=this;return new Promise(function($,G){k[l].destroy(null,function(B){if(B){G(B);return}$(p(void 0,!0))})})}),t),I),T=function(k){var $,G=Object.create(S,($={},e($,l,{value:k,writable:!0}),e($,i,{value:null,writable:!0}),e($,s,{value:null,writable:!0}),e($,o,{value:null,writable:!0}),e($,c,{value:k._readableState.endEmitted,writable:!0}),e($,f,{value:function(M,N){var P=G[l].read();P?(G[u]=null,G[i]=null,G[s]=null,M(p(P,!1))):(G[i]=M,G[s]=N)},writable:!0}),$));return G[u]=null,a(k,function(B){if(B&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"){var M=G[s];M!==null&&(G[u]=null,G[i]=null,G[s]=null,M(B)),G[o]=B;return}var N=G[i];N!==null&&(G[u]=null,G[i]=null,G[s]=null,N(p(void 0,!0))),G[c]=!0}),k.on("readable",v.bind(null,G)),G};return Uu=T,Uu}var Du,Jg;function U5(){return Jg||(Jg=1,Du=function(){throw new Error("Readable.from is not available in the browser")}),Du}var Hu,Qg;function Cw(){if(Qg)return Hu;Qg=1,Hu=N;var t;N.ReadableState=M,Vs().EventEmitter;var e=function(z,ae){return z.listeners(ae).length},r=_w(),n=Or().Buffer,a=(typeof ft<"u"?ft:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function i(W){return n.from(W)}function s(W){return n.isBuffer(W)||W instanceof a}var o=Pf(),c;o&&o.debuglog?c=o.debuglog("stream"):c=function(){};var u=k5(),f=Ow(),l=Lw(),p=l.getHighWaterMark,b=as().codes,v=b.ERR_INVALID_ARG_TYPE,w=b.ERR_STREAM_PUSH_AFTER_EOF,I=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,T,C,k;Ye()(N,r);var $=f.errorOrDestroy,G=["error","close","destroy","pause","resume"];function B(W,z,ae){if(typeof W.prependListener=="function")return W.prependListener(z,ae);!W._events||!W._events[z]?W.on(z,ae):Array.isArray(W._events[z])?W._events[z].unshift(ae):W._events[z]=[ae,W._events[z]]}function M(W,z,ae){t=t||Wa(),W=W||{},typeof ae!="boolean"&&(ae=z instanceof t),this.objectMode=!!W.objectMode,ae&&(this.objectMode=this.objectMode||!!W.readableObjectMode),this.highWaterMark=p(this,W,"readableHighWaterMark",ae),this.buffer=new u,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=W.emitClose!==!1,this.autoDestroy=!!W.autoDestroy,this.destroyed=!1,this.defaultEncoding=W.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,W.encoding&&(T||(T=Os().StringDecoder),this.decoder=new T(W.encoding),this.encoding=W.encoding)}function N(W){if(t=t||Wa(),!(this instanceof N))return new N(W);var z=this instanceof t;this._readableState=new M(W,this,z),this.readable=!0,W&&(typeof W.read=="function"&&(this._read=W.read),typeof W.destroy=="function"&&(this._destroy=W.destroy)),r.call(this)}Object.defineProperty(N.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(z){this._readableState&&(this._readableState.destroyed=z)}}),N.prototype.destroy=f.destroy,N.prototype._undestroy=f.undestroy,N.prototype._destroy=function(W,z){z(W)},N.prototype.push=function(W,z){var ae=this._readableState,pe;return ae.objectMode?pe=!0:typeof W=="string"&&(z=z||ae.defaultEncoding,z!==ae.encoding&&(W=n.from(W,z),z=""),pe=!0),P(this,W,z,!1,pe)},N.prototype.unshift=function(W){return P(this,W,null,!0,!1)};function P(W,z,ae,pe,ge){c("readableAddChunk",z);var be=W._readableState;if(z===null)be.reading=!1,y(W,be);else{var _e;if(ge||(_e=d(be,z)),_e)$(W,_e);else if(be.objectMode||z&&z.length>
vendor: 11,267 bytes, line 23
230)if(typeof z!="string"&&!be.objectMode&&Object.getPrototypeOf(z)!==n.prototype&&(z=i(z)),pe)be.endEmitted?$(W,new S):x(W,be,z,!0);else if(be.ended)$(W,new w);else{if(be.destroyed)return!1;be.reading=!1,be.decoder&&!ae?(z=be.decoder.write(z),be.objectMode||z.length!==0?x(W,be,z,!1):A(W,be)):x(W,be,z,!1)}else pe||(be.reading=!1,A(W,be))}return!be.ended&&(be.length<be.highWaterMark||be.length===0)}function x(W,z,ae,pe){z.flowing&&z.length===0&&!z.sync?(z.awaitDrain=0,W.emit("data",ae)):(z.length+=z.objectMode?1:ae.length,pe?z.buffer.unshift(ae):z.buffer.push(ae),z.needReadable&&_(W)),A(W,z)}function d(W,z){var ae;return!s(z)&&typeof z!="string"&&z!==void 0&&!W.objectMode&&(ae=new v("chunk",["string","Buffer","Uint8Array"],z)),ae}N.prototype.isPaused=function(){return this._readableState.flowing===!1},N.prototype.setEncoding=function(W){T||(T=Os().StringDecoder);var z=new T(W);this._readableState.decoder=z,this._readableState.encoding=this._readableState.decoder.encoding;for(var ae=this._readableState.buffer.head,pe="";ae!==null;)pe+=z.write(ae.data),ae=ae.next;return this._readableState.buffer.clear(),pe!==""&&this._readableState.buffer.push(pe),this._readableState.length=pe.length,this};var m=1073741824;function h(W){return W>=m?W=m:(W--,W|=W>>>1,W|=W>>>2,W|=W>>>4,W|=W>>>8,W|=W>>>16,W++),W}function g(W,z){return W<=0||z.length===0&&z.ended?0:z.objectMode?1:W!==W?z.flowing&&z.length?z.buffer.head.data.length:z.length:(W>z.highWaterMark&&(z.highWaterMark=h(W)),W<=z.length?W:z.ended?z.length:(z.needReadable=!0,0))}N.prototype.read=function(W){c("read",W),W=parseInt(W,10);var z=this._readableState,ae=W;if(W!==0&&(z.emittedReadable=!1),W===0&&z.needReadable&&((z.highWaterMark!==0?z.length>=z.highWaterMark:z.length>0)||z.ended))return c("read: emitReadable",z.length,z.ended),z.length===0&&z.ended?V(this):_(this),null;if(W=g(W,z),W===0&&z.ended)return z.length===0&&V(this),null;var pe=z.needReadable;c("need readable",pe),(z.length===0||z.length-W<z.highWaterMark)&&(pe=!0,c("length less than watermark",pe)),z.ended||z.reading?(pe=!1,c("reading or ended",pe)):pe&&(c("do read"),z.reading=!0,z.sync=!0,z.length===0&&(z.needReadable=!0),this._read(z.highWaterMark),z.sync=!1,z.reading||(W=g(ae,z)));var ge;return W>0?ge=q(W,z):ge=null,ge===null?(z.needReadable=z.length<=z.highWaterMark,W=0):(z.length-=W,z.awaitDrain=0),z.length===0&&(z.ended||(z.needReadable=!0),ae!==W&&z.ended&&V(this)),ge!==null&&this.emit("data",ge),ge};function y(W,z){if(c("onEofChunk"),!z.ended){if(z.decoder){var ae=z.decoder.end();ae&&ae.length&&(z.buffer.push(ae),z.length+=z.objectMode?1:ae.length)}z.ended=!0,z.sync?_(W):(z.needReadable=!1,z.emittedReadable||(z.emittedReadable=!0,R(W)))}}function _(W){var z=W._readableState;c("emitReadable",z.needReadable,z.emittedReadable),z.needReadable=!1,z.emittedReadable||(c("emitReadable",z.flowing),z.emittedReadable=!0,ke.nextTick(R,W))}function R(W){var z=W._readableState;c("emitReadable_",z.destroyed,z.length,z.ended),!z.destroyed&&(z.length||z.ended)&&(W.emit("readable"),z.emittedReadable=!1),z.needReadable=!z.flowing&&!z.ended&&z.length<=z.highWaterMark,j(W)}function A(W,z){z.readingMore||(z.readingMore=!0,ke.nextTick(E,W,z))}function E(W,z){for(;!z.reading&&!z.ended&&(z.length<z.highWaterMark||z.flowing&&z.length===0);){var ae=z.length;if(c("maybeReadMore read 0"),W.read(0),ae===z.length)break}z.readingMore=!1}N.prototype._read=function(W){$(this,new I("_read()"))},N.prototype.pipe=function(W,z){var ae=this,pe=this._readableState;switch(pe.pipesCount){case 0:pe.pipes=W;break;case 1:pe.pipes=[pe.pipes,W];break;default:pe.pipes.push(W);break}pe.pipesCount+=1,c("pipe count=%d opts=%j",pe.pipesCount,z);var ge=(!z||z.end!==!1)&&W!==ke.stdout&&W!==ke.stderr,be=ge?Ie:Ue;pe.endEmitted?ke.nextTick(be):ae.once("end",be),W.on("unpipe",_e);function _e(xe,Ne){c("onunpipe"),xe===ae&&Ne&&Ne.hasUnpiped===!1&&(Ne.hasUnpiped=!0,ye())}function Ie(){c("onend"),W.end()}var de=L(ae);W.on("drain",de);var Pe=!1;function ye(){c("cleanup"),W.removeListener("close",ve),W.removeListener("finish",Be),W.removeListener("drain",de),W.removeListener("error",Ee),W.removeListener("unpipe",_e),ae.removeListener("end",Ie),ae.removeListener("end",Ue),ae.removeListener("data",we),Pe=!0,pe.awaitDrain&&(!W._writableState||W._writableState.needDrain)&&de()}ae.on("data",we);function we(xe){c("ondata");var Ne=W.write(xe);c("dest.write",Ne),Ne===!1&&((pe.pipesCount===1&&pe.pipes===W||pe.pipesCount>1&&ne(pe.pipes,W)!==-1)&&!Pe&&(c("false write response, pause",pe.awaitDrain),pe.awaitDrain++),ae.pause())}function Ee(xe){c("onerror",xe),Ue(),W.removeListener("error",Ee),e(W,"error")===0&&$(W,xe)}B(W,"error",Ee);function ve(){W.removeListener("finish",Be),Ue()}W.once("close",ve);function Be(){c("onfinish"),W.removeListener("close",ve),Ue()}W.once("finish",Be);function Ue(){c("unpipe"),ae.unpipe(W)}return W.emit("pipe",ae),pe.flowing||(c("pipe resume"),ae.resume()),W};function L(W){return function(){var ae=W._readableState;c("pipeOnDrain",ae.awaitDrain),ae.awaitDrain&&ae.awaitDrain--,ae.awaitDrain===0&&e(W,"data")&&(ae.flowing=!0,j(W))}}N.prototype.unpipe=function(W){var z=this._readableState,ae={hasUnpiped:!1};if(z.pipesCount===0)return this;if(z.pipesCount===1)return W&&W!==z.pipes?this:(W||(W=z.pipes),z.pipes=null,z.pipesCount=0,z.flowing=!1,W&&W.emit("unpipe",this,ae),this);if(!W){var pe=z.pipes,ge=z.pipesCount;z.pipes=null,z.pipesCount=0,z.flowing=!1;for(var be=0;be<ge;be++)pe[be].emit("unpipe",this,{hasUnpiped:!1});return this}var _e=ne(z.pipes,W);return _e===-1?this:(z.pipes.splice(_e,1),z.pipesCount-=1,z.pipesCount===1&&(z.pipes=z.pipes[0]),W.emit("unpipe",this,ae),this)},N.prototype.on=function(W,z){var ae=r.prototype.on.call(this,W,z),pe=this._readableState;return W==="data"?(pe.readableListening=this.listenerCount("readable")>0,pe.flowing!==!1&&this.resume()):W==="readable"&&!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.flowing=!1,pe.emittedReadable=!1,c("on readable",pe.length,pe.reading),pe.length?_(this):pe.reading||ke.nextTick(U,this)),ae},N.prototype.addListener=N.prototype.on,N.prototype.removeListener=function(W,z){var ae=r.prototype.removeListener.call(this,W,z);return W==="readable"&&ke.nextTick(O,this),ae},N.prototype.removeAllListeners=function(W){var z=r.prototype.removeAllListeners.apply(this,arguments);return(W==="readable"||W===void 0)&&ke.nextTick(O,this),z};function O(W){var z=W._readableState;z.readableListening=W.listenerCount("readable")>0,z.resumeScheduled&&!z.paused?z.flowing=!0:W.listenerCount("data")>0&&W.resume()}function U(W){c("readable nexttick read 0"),W.read(0)}N.prototype.resume=function(){var W=this._readableState;return W.flowing||(c("resume"),W.flowing=!W.readableListening,X(this,W)),W.paused=!1,this};function X(W,z){z.resumeScheduled||(z.resumeScheduled=!0,ke.nextTick(J,W,z))}function J(W,z){c("resume",z.reading),z.reading||W.read(0),z.resumeScheduled=!1,W.emit("resume"),j(W),z.flowing&&!z.reading&&W.read(0)}N.prototype.pause=function(){return c("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(c("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function j(W){var z=W._readableState;for(c("flow",z.flowing);z.flowing&&W.read()!==null;);}N.prototype.wrap=function(W){var z=this,ae=this._readableState,pe=!1;W.on("end",function(){if(c("wrapped end"),ae.decoder&&!ae.ended){var _e=ae.decoder.end();_e&&_e.length&&z.push(_e)}z.push(null)}),W.on("data",function(_e){if(c("wrapped data"),ae.decoder&&(_e=ae.decoder.write(_e)),!(ae.objectMode&&_e==null)&&!(!ae.objectMode&&(!_e||!_e.length))){var Ie=z.push(_e);Ie||(pe=!0,W.pause())}});for(var ge in W)this[ge]===void 0&&typeof W[ge]=="function"&&(this[ge]=(function(Ie){return function(){return W[Ie].apply(W,arguments)}})(ge));for(var be=0;be<G.length;be++)W.on(G[be],this.emit.bind(this,G[be]));return this._read=function(_e){c("wrapped _read",_e),pe&&(pe=!1,W.resume())},this},typeof Symbol=="function"&&(N.prototype[Symbol.asyncIterator]=function(){return C===void 0&&(C=C5()),C(this)}),Object.defineProperty(N.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(N.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(N.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(z){this._readableState&&(this._readableState.flowing=z)}}),N._fromList=q,Object.defineProperty(N.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function q(W,z){if(z.length===0)return null;var ae;return z.objectMode?ae=z.buffer.shift():!W||W>=z.length?(z.decoder?ae=z.buffer.join(""):z.buffer.length===1?ae=z.buffer.first():ae=z.buffer.concat(z.length),z.buffer.clear()):ae=z.buffer.consume(W,z.decoder),ae}function V(W){var z=W._readableState;c("endReadable",z.endEmitted),z.endEmitted||(z.ended=!0,ke.nextTick(ee,z,W))}function ee(W,z){if(c("endReadableNT",W.endEmitted,W.length),!W.endEmitted&&W.length===0&&(W.endEmitted=!0,z.readable=!1,z.emit("end"),W.autoDestroy)){var ae=z._writableState;(!ae||ae.autoDestroy&&ae.finished)&&z.destroy()}}typeof Symbol=="function"&&(N.from=function(W,z){return k===void 0&&(k=U5()),k(N,W,z)});function ne(W,z){for(var ae=0,pe=W.length;ae<pe;ae++)if(W[ae]===z)return ae;return-1}return Hu}var Fu,eb;function Uw(){if(eb)return Fu;eb=1,Fu=o;var t=as().codes,e=t.ERR_METHOD_NOT_IMPLEMENTED,r=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=t.ERR_TRANSFORM_WITH_LENGTH_0,i=Wa();Ye()(o,i);function s(f,l){var p=this._transformState;p.transforming=!1;var b=p.writecb;if(b===null)return this.emit("error",new r);p.writechunk=null,p.writecb=null,l!=null&&this.push(l),b(f);var v=this._readableState;v.reading=!1,(v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}function o(f){if(!(this instanceof o))return new o(f);i.call(this,f),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,f&&(typeof f.transform=="function"&&(this._transform=f.transform),typeof f.flush=="function"&&(this._flush=f.flush)),this.on("prefinish",c)}function c(){var f=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(l,p){u(f,l,p)}):u(this,null,null)}o.prototype.push=function(f,l){return this._transformState.needTransform=!1,i.prototype.push.call(this,f,l)},o.prototype._transform=function(f,l,p){p(new e("_transform()"))},o.prototype._write=function(f,l,p){var b=this._transformState;if(b.writecb=p,b.writechunk=f,b.writeencoding=l,!b.transforming){var v=this._readableState;(b.needTransform||v.needReadable||v.length<v.highWaterMark)&&this._read(v.highWaterMark)}},o.prototype._read=function(f){var l=this._transformState;l.writechunk!==null&&!l.transforming?(l.transforming=!0,this._transform(l.writechunk,l.writeencoding,l.afterTransform)):l.needTransform=!0},o.prototype._destroy=function(f,l){i.prototype._destroy.call(this,f,function(p){l(p)})};function u(f,l,p){if(l)return f.emit("error",l);
23if(p!=null&&f.push(p),f._writableState.length)throw new a;if(f._transformState.transforming)throw new n;return f.push(null)}return Fu}var qu,tb;function D5(){if(tb)return qu;tb=1,qu=e;var t=Uw();Ye()(e,t);function e(r){if(!(this instanceof e))return new e(r);t.call(this,r)}return e.prototype._transform=function(r,n,a){a(null,r)},qu}var $u,rb;function H5(){if(rb)return $u;rb=1;var t;function e(p){var b=!1;return function(){b||(b=!0,p.apply(void 0,arguments))}}var r=as().codes,n=r.ERR_MISSING_ARGS,a=r.ERR_STREAM_DESTROYED;function i(p){if(p)throw p}function s(p){return p.setHeader&&typeof p.abort=="function"}function o(p,b,v,w){w=e(w);var I=!1;p.on("close",function(){I=!0}),t===void 0&&(t=Ed()),t(p,{readable:b,writable:v},function(T){if(T)return w(T);I=!0,w()});var S=!1;return function(T){if(!I&&!S){if(S=!0,s(p))return p.abort();if(typeof p.destroy=="function")return p.destroy();w(T||new a("pipe"))}}}function c(p){p()}function u(p,b){return p.pipe(b)}function f(p){return!p.length||typeof p[p.length-1]!="function"?i:p.pop()}function l(){for(var p=arguments.length,b=new Array(p),v=0;v<p;v++)b[v]=arguments[v];var w=f(b);if(Array.isArray(b[0])&&(b=b[0]),b.length<2)throw new n("streams");var I,S=b.map(function(T,C){var k=C<b.length-1,$=C>0;return o(T,k,$,function(G){I||(I=G),G&&S.forEach(c),!k&&(S.forEach(c),w(I))})});return b.reduce(u)}return $u=l,$u}var Ku,nb;function Dw(){if(nb)return Ku;nb=1,Ku=r;var t=Vs().EventEmitter,e=Ye();e(r,t),r.Readable=Cw(),r.Writable=kw(),r.Duplex=Wa(),r.Transform=Uw(),r.PassThrough=D5(),r.finished=Ed(),r.pipeline=H5(),r.Stream=r;function r(){t.call(this)}return r.prototype.pipe=function(n,a){var i=this;function s(b){n.writable&&n.write(b)===!1&&i.pause&&i.pause()}i.on("data",s);function o(){i.readable&&i.resume&&i.resume()}n.on("drain",o),!n._isStdio&&(!a||a.end!==!1)&&(i.on("end",u),i.on("close",f));var c=!1;function u(){c||(c=!0,n.end())}function f(){c||(c=!0,typeof n.destroy=="function"&&n.destroy())}function l(b){if(p(),t.listenerCount(this,"error")===0)throw b}i.on("error",l),n.on("error",l);function p(){i.removeListener("data",s),n.removeListener("drain",o),i.removeListener("end",u),i.removeListener("close",f),i.removeListener("error",l),n.removeListener("error",l),i.removeListener("end",p),i.removeListener("close",p),n.removeListener("close",p)}return i.on("end",p),i.on("close",p),n.on("close",p),n.emit("pipe",i),n},Ku}var Gu,ib;function F5(){if(ib)return Gu;ib=1;var t=et().Buffer,e=Dw().Transform,r=Ye();function n(o){e.call(this),this._block=t.allocUnsafe(o),this._blockSize=o,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}r(n,e),n.prototype._transform=function(o,c,u){var f=null;try{this.update(o,c)}catch(l){f=l}u(f)},n.prototype._flush=function(o){var c=null;try{this.push(this.digest())}catch(u){c=u}o(c)};var a=typeof Uint8Array<"u",i=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);function s(o,c){if(o instanceof t)return o;if(typeof o=="string")return t.from(o,c);if(i&&ArrayBuffer.isView(o)){if(o.byteLength===0)return t.alloc(0);var u=t.from(o.buffer,o.byteOffset,o.byteLength);if(u.byteLength===o.byteLength)return u}if(a&&o instanceof Uint8Array||t.isBuffer(o)&&o.constructor&&typeof o.constructor.isBuffer=="function"&&o.constructor.isBuffer(o))return t.from(o);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return n.prototype.update=function(o,c){if(this._finalized)throw new Error("Digest already called");o=s(o,c);for(var u=this._block,f=0;this._blockOffset+o.length-f>=this._blockSize;){for(var l=this._blockOffset;l<this._blockSize;)u[l++]=o[f++];this._update(),this._blockOffset=0}for(;f<o.length;)u[this._blockOffset++]=o[f++];for(var p=0,b=o.length*8;b>0;++p)this._length[p]+=b,b=this._length[p]/4294967296|0,b>0&&(this._length[p]-=4294967296*b);return this},n.prototype._update=function(){throw new Error("_update is not implemented")},n.prototype.digest=function(o){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var c=this._digest();o!==void 0&&(c=c.toString(o)),this._block.fill(0),this._blockOffset=0;for(var u=0;u<4;++u)this._length[u]=0;return c},n.prototype._digest=function(){throw new Error("_digest is not implemented")},Gu=n,Gu}var ju,ab;function Sd(){if(ab)return ju;ab=1;var t=Ye(),e=F5(),r=et().Buffer,n=new Array(16);function a(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}t(a,e),a.prototype._update=function(){for(var f=n,l=0;l<16;++l)f[l]=this._block.readInt32LE(l*4);var p=this._a,b=this._b,v=this._c,w=this._d;p=s(p,b,v,w,f[0],3614090360,7),w=s(w,p,b,v,f[1],3905402710,12),v=s(v,w,p,b,f[2],606105819,17),b=s(b,v,w,p,f[3],3250441966,22),p=s(p,b,v,w,f[4],4118548399,7),w=s(w,p,b,v,f[5],1200080426,12),v=s(v,w,p,b,f[6],2821735955,17),b=s(b,v,w,p,f[7],4249261313,22),p=s(p,b,v,w,f[8],1770035416,7),w=s(w,p,b,v,f[9],2336552879,12),v=s(v,w,p,b,f[10],4294925233,17),b=s(b,v,w,p,f[11],2304563134,22),p=s(p,b,v,w,f[12],1804603682,7),w=s(w,p,b,v,f[13],4254626195,12),v=s(v,w,p,b,f[14],2792965006,17),b=s(b,v,w,p,f[15],1236535329,22),p=o(p,b,v,w,f[1],4129170786,5),w=o(w,p,b,v,f[6],3225465664,9),v=o(v,w,p,b,f[11],643717713,14),b=o(b,v,w,p,f[0],3921069994,20),p=o(p,b,v,w,f[5],3593408605,5),w=o(w,p,b,v,f[10],38016083,9),v=o(v,w,p,b,f[15],3634488961,14),b=o(b,v,w,p,f[4],3889429448,20),p=o(p,b,v,w,f[9],568446438,5),w=o(w,p,b,v,f[14],3275163606,9),v=o(v,w,p,b,f[3],4107603335,14),b=o(b,v,w,p,f[8],1163531501,20),p=o(p,b,v,w,f[13],2850285829,5),w=o(w,p,b,v,f[2],4243563512,9),v=o(v,w,p,b,f[7],1735328473,14),b=o(b,v,w,p,f[12],2368359562,20),p=c(p,b,v,w,f[5],4294588738,4),w=c(w,p,b,v,f[8],2272392833,11),v=c(v,w,p,b,f[11],1839030562,16),b=c(b,v,w,p,f[14],4259657740,23),p=c(p,b,v,w,f[1],2763975236,4),w=c(w,p,b,v,f[4],1272893353,11),v=c(v,w,p,b,f[7],4139469664,16),b=c(b,v,w,p,f[10],3200236656,23),p=c(p,b,v,w,f[13],681279174,4),w=c(w,p,b,v,f[0],3936430074,11),v=c(v,w,p,b,f[3],3572445317,16),b=c(b,v,w,p,f[6],76029189,23),p=c(p,b,v,w,f[9],3654602809,4),w=c(w,p,b,v,f[12],3873151461,11),v=c(v,w,p,b,f[15],530742520,16),b=c(b,v,w,p,f[2],3299628645,23),p=u(p,b,v,w,f[0],4096336452,6),w=u(w,p,b,v,f[7],1126891415,10),v=u(v,w,p,b,f[14],2878612391,15),b=u(b,v,w,p,f[5],4237533241,21),p=u(p,b,v,w,f[12],1700485571,6),w=u(w,p,b,v,f[3],2399980690,10),v=u(v,w,p,b,f[10],4293915773,15),b=u(b,v,w,p,f[1],2240044497,21),p=u(p,b,v,w,f[8],1873313359,6),w=u(w,p,b,v,f[15],4264355552,10),v=u(v,w,p,b,f[6],2734768916,15),b=u(b,v,w,p,f[13],1309151649,21),p=u(p,b,v,w,f[4],4149444226,6),w=u(w,p,b,v,f[11],3174756917,10),v=u(v,w,p,b,f[2],718787259,15),b=u(b,v,w,p,f[9],3951481745,21),this._a=this._a+p|0,this._b=this._b+b|0,this._c=this._c+v|0,this._d=this._d+w|0},a.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 f=r.allocUnsafe(16);return f.writeInt32LE(this._a,0),f.writeInt32LE(this._b,4),f.writeInt32LE(this._c,8),f.writeInt32LE(this._d,12),f};function i(f,l){return f<<l|f>>>32-l}function s(f,l,p,b,v,w,I){return i(f+(l&p|~l&b)+v+w|0,I)+l|0}function o(f,l,p,b,v,w,I){return i(f+(l&b|p&~b)+v+w|0,I)+l|0}function c(f,l,p,b,v,w,I){return i(f+(l^p^b)+v+w|0,I)+l|0}function u(f,l,p,b,v,w,I){return i(f+(p^(l|~b))+v+w|0,I)+l|0}return ju=a,ju}var Vu,sb;function q5(){if(sb)return Vu;sb=1;var t={}.toString;return Vu=Array.isArray||function(e){return t.call(e)=="[object Array]"},Vu}var zu,ob;function $5(){if(ob)return zu;ob=1;var t=rs(),e=is(),r=e("TypedArray.prototype.buffer",!0),n=Mw();return zu=r||function(i){if(!n(i))throw new t("Not a Typed Array");return i.buffer},zu}var Wu,fb;function Mf(){if(fb)return Wu;fb=1;var t=et().Buffer,e=q5(),r=$5(),n=ArrayBuffer.isView||function(c){try{return r(c),!0}catch{return!1}},a=typeof Uint8Array<"u",i=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",s=i&&(t.prototype instanceof Uint8Array||t.TYPED_ARRAY_SUPPORT);return Wu=function(c,u){if(t.isBuffer(c))return c.constructor&&!("isBuffer"in c)?t.from(c):c;if(typeof c=="string")return t.from(c,u);if(i&&n(c)){if(c.byteLength===0)return t.alloc(0);if(s){var f=t.from(c.buffer,c.byteOffset,c.byteLength);if(f.byteLength===c.byteLength)return f}var l=c instanceof Uint8Array?c:new Uint8Array(c.buffer,c.byteOffset,c.byteLength),p=t.from(l);if(p.length===c.byteLength)return p}if(a&&c instanceof Uint8Array)return t.from(c);var b=e(c);if(b)for(var v=0;v<c.length;v+=1){var w=c[v];if(typeof w!="number"||w<0||w>255||~~w!==w)throw new RangeError("Array items must be numbers in the range 0-255.")}if(b||t.isBuffer(c)&&c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c))return t.from(c);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},Wu}var Zu,cb;function K5(){if(cb)return Zu;cb=1;var t=et().Buffer,e=Mf(),r=typeof Uint8Array<"u",n=r&&typeof ArrayBuffer<"u",a=n&&ArrayBuffer.isView;return Zu=function(i,s){if(typeof i=="string"||t.isBuffer(i)||r&&i instanceof Uint8Array||a&&a(i))return e(i,s);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')},Zu}var go={exports:{}},bo={exports:{}},ub;function Of(){if(ub)return bo.exports;ub=1,typeof ke>"u"||!ke.version||ke.version.indexOf("v0.")===0||ke.version.indexOf("v1.")===0&&ke.version.indexOf("v1.8.")!==0?bo.exports={nextTick:t}:bo.exports=ke;function t(e,r,n,a){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,s,o;switch(i){case 0:case 1:return ke.nextTick(e);case 2:return ke.nextTick(function(){e.call(null,r)}
23);case 3:return ke.nextTick(function(){e.call(null,r,n)});case 4:return ke.nextTick(function(){e.call(null,r,n,a)});default:for(s=new Array(i-1),o=0;o<s.length;)s[o++]=arguments[o];return ke.nextTick(function(){e.apply(null,s)})}}return bo.exports}var Yu,hb;function G5(){if(hb)return Yu;hb=1;var t={}.toString;return Yu=Array.isArray||function(e){return t.call(e)=="[object Array]"},Yu}var Xu,lb;function Hw(){return lb||(lb=1,Xu=Vs().EventEmitter),Xu}var mo={exports:{}},db;function xd(){return db||(db=1,(function(t,e){var r=Or(),n=r.Buffer;function a(s,o){for(var c in s)o[c]=s[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(a(r,e),e.Buffer=i);function i(s,o,c){return n(s,o,c)}a(n,i),i.from=function(s,o,c){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,o,c)},i.alloc=function(s,o,c){if(typeof s!="number")throw new TypeError("Argument must be a number");var u=n(s);return o!==void 0?typeof c=="string"?u.fill(o,c):u.fill(o):u.fill(0),u},i.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},i.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}}
23)(mo,mo.exports)),mo.exports}var Qt={},pb;function Ws(){if(pb)return Qt;pb=1;function t(w){return Array.isArray?Array.isArray(w):v(w)==="[object Array]"}Qt.isArray=t;function e(w){return typeof w=="boolean"}Qt.isBoolean=e;function r(w){return w===null}Qt.isNull=r;function n(w){return w==null}Qt.isNullOrUndefined=n;function a(w){return typeof w=="number"}Qt.isNumber=a;function i(w){return typeof w=="string"}Qt.isString=i;function s(w){return typeof w=="symbol"}Qt.isSymbol=s;function o(w){return w===void 0}Qt.isUndefined=o;function c(w){return v(w)==="[object RegExp]"}Qt.isRegExp=c;function u(w){return typeof w=="object"&&w!==null}Qt.isObject=u;function f(w){return v(w)==="[object Date]"}Qt.isDate=f;function l(w){return v(w)==="[object Error]"||w instanceof Error}Qt.isError=l;function p(w){return typeof w=="function"}Qt.isFunction=p;function b(w){return w===null||typeof w=="boolean"||typeof w=="number"||typeof w=="string"||typeof w=="symbol"||typeof w>"u"}Qt.isPrimitive=b,Qt.isBuffer=Or().Buffer.isBuffer;function v(w){return Object.prototype.toString.call(w)}return Qt}var Ju={exports:{}},gb;function j5(){return gb||(gb=1,(function(t){function e(i,s){if(!(i instanceof s))throw new TypeError("Cannot call a class as a function")}var r=xd().Buffer,n=Pf();function a(i,s,o){i.copy(s,o)}t.exports=(function(){function i(){e(this,i),this.head=null,this.tail=null,this.length=0}return i.prototype.push=function(o){var c={data:o,next:null};this.length>0?this.tail.next=c:this.head=c,this.tail=c,++this.length},i.prototype.unshift=function(o){var c={data:o,next:this.head};this.length===0&&(this.tail=c),this.head=c,++this.length},i.prototype.shift=function(){if(this.length!==0){var o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}},i.prototype.clear=function(){this.head=this.tail=null,this.length=0},i.prototype.join=function(o){if(this.length===0)return"";for(var c=this.head,u=""+c.data;c=c.next;)u+=o+c.data;return u},i.prototype.concat=function(o){if(this.length===0)return r.alloc(0);for(var c=r.allocUnsafe(o>>>0),u=this.head,f=0;u;)a(u.data,c,f),f+=u.data.length,u=u.next;return c},i})(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var i=n.inspect({length:this.length});return this.constructor.name+" "+i})})(Ju)),Ju.exports}var Qu,bb;function Fw(){if(bb)return Qu;bb=1;var t=Of();function e(a,i){var s=this,o=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return o||c?(i?i(a):a&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(n,this,a)):t.nextTick(n,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(u){!i&&u?s._writableState?s._writableState.errorEmitted||(s._writableState.errorEmitted=!0,t.nextTick(n,s,u)):t.nextTick(n,s,u):i&&i(u)}),this)}function r(){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 n(a,i){a.emit("error",i)}return Qu={destroy:e,undestroy:r},Qu}var eh,mb;function qw(){if(mb)return eh;mb=1;var t=Of();eh=w;function e(_){var R=this;this.next=null,this.entry=null,this.finish=function(){y(R,_)}}var r=!ke.browser&&["v0.10","v0.9."].indexOf(ke.version.slice(0,5))>-1?setImmediate:t.nextTick,n;w.WritableState=b;var a=Object.create(Ws());a.inherits=Ye();var i={deprecate:Nw()},s=Hw(),o=xd().Buffer,c=(typeof ft<"u"?ft:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function u(_){return o.from(_)}function f(_){return o.isBuffer(_)||_ instanceof c}var l=Fw();a.inherits(w,s);function p(){}function b(_,R){n=n||Za(),_=_||{};var A=R instanceof n;this.objectMode=!!_.objectMode,A&&(this.objectMode=this.objectMode||!!_.writableObjectMode);var E=_.highWaterMark,L=_.writableHighWaterMark,O=this.objectMode?16:16*1024;E||E===0?this.highWaterMark=E:A&&(L||L===0)?this.highWaterMark=L: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 U=_.decodeStrings===!1;this.decodeStrings=!U,this.defaultEncoding=_.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(X){B(R,X)},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 e(this)}b.prototype.getBuffer=function(){for(var R=this.bufferedRequest,A=[];R;)A.push(R),R=R.next;return A},(function(){try{Object.defineProperty(b.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var v;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(v=Function.prototype[Symbol.hasInstance],Object.defineProperty(w,Symbol.hasInstance,{value:function(_){return v.call(this,_)?!0:this!==w?!1:_&&_._writableState instanceof b}})):v=function(_){return _ instanceof this};function w(_){if(n=n||Za(),!v.call(w,this)&&!(this instanceof n))return new w(_);this._writableState=new b(_,this),this.writable=!0,_&&(typeof _.
23write=="function"&&(this._write=_.write),typeof _.writev=="function"&&(this._writev=_.writev),typeof _.destroy=="function"&&(this._destroy=_.destroy),typeof _.final=="function"&&(this._final=_.final)),s.call(this)}w.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function I(_,R){var A=new Error("write after end");_.emit("error",A),t.nextTick(R,A)}function S(_,R,A,E){var L=!0,O=!1;return A===null?O=new TypeError("May not write null values to stream"):typeof A!="string"&&A!==void 0&&!R.objectMode&&(O=new TypeError("Invalid non-string/buffer chunk")),O&&(_.emit("error",O),t.nextTick(E,O),L=!1),L}w.prototype.write=function(_,R,A){var E=this._writableState,L=!1,O=!E.objectMode&&f(_);return O&&!o.isBuffer(_)&&(_=u(_)),typeof R=="function"&&(A=R,R=null),O?R="buffer":R||(R=E.defaultEncoding),typeof A!="function"&&(A=p),E.ended?I(this,A):(O||S(this,E,_,A))&&(E.pendingcb++,L=C(this,E,O,_,R,A)),L},w.prototype.cork=function(){var _=this._writableState;_.corked++},w.prototype.uncork=function(){var _=this._writableState;_.corked&&(_.corked--,!_.writing&&!_.corked&&!_.bufferProcessing&&_.bufferedRequest&&P(this,_))},w.prototype.setDefaultEncoding=function(R){if(typeof R=="string"&&(R=R.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((R+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+R);return this._writableState.defaultEncoding=R,this};function T(_,R,A){return!_.objectMode&&_.decodeStrings!==!1&&typeof R=="string"&&(R=o.from(R,A)),R}Object.defineProperty(w.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C(_,R,A,E,L,O){if(!A){var U=T(R,E,L);E!==U&&(A=!0,L="buffer",E=U)}var X=R.objectMode?1:E.length;R.length+=X;var J=R.length<R.highWaterMark;if(J||(R.needDrain=!0),R.writing||R.corked){var j=R.lastBufferedRequest;R.lastBufferedRequest={chunk:E,encoding:L,isBuf:A,callback:O,next:null},j?j.next=R.lastBufferedRequest:R.bufferedRequest=R.lastBufferedRequest,R.bufferedRequestCount+=1}else k(_,R,!1,X,E,L,O);return J}function k(_,R,A,E,L,O,U){R.writelen=E,R.writecb=U,R.writing=!0,R.sync=!0,A?_._writev(L,R.onwrite):_._write(L,O,R.onwrite),R.sync=!1}function $(_,R,A,E,L){--R.pendingcb,A?(t.nextTick(L,E),t.nextTick(h,_,R),_._writableState.errorEmitted=!0,_.emit("error",E)):(L(E),_._writableState.errorEmitted=!0,_.emit("error",E),h(_,R))}function G(_){_.writing=!1,_.writecb=null,_.length-=_.writelen,_.writelen=0}function B(_,R){var A=_._writableState,E=A.sync,L=A.writecb;if(G(A),R)$(_,A,E,R,L);else{var O=x(A);!O&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&P(_,A),E?r(M,_,A,O,L):M(_,A,O,L)}}function M(_,R,A,E){A||N(_,R),R.pendingcb--,E(),h(_,R)}function N(_,R){R.length===0&&R.needDrain&&(R.needDrain=!1,_.emit("drain"))}function P(_,R){R.bufferProcessing=!0;var A=R.bufferedRequest;if(_._writev&&A&&A.next){var E=R.bufferedRequestCount,L=new Array(E),O=R.corkedRequestsFree;O.entry=A;for(var U=0,X=!0;A;)L[U]=A,A.isBuf||(X=!1),A=A.next,U+=1;L.allBuffers=X,k(_,R,!0,R.length,L,"",O.finish),R.pendingcb++,R.lastBufferedRequest=null,O.next?(R.corkedRequestsFree=O.next,O.next=null):R.corkedRequestsFree=new e(R),R.bufferedRequestCount=0}else{for(;A;){var J=A.chunk,j=A.encoding,q=A.callback,V=R.objectMode?1:J.length;if(k(_,R,!1,V,J,j,q),A=A.next,R.bufferedRequestCount--,R.writing)break}A===null&&(R.lastBufferedRequest=null)}R.bufferedRequest=A,R.bufferProcessing=!1}w.prototype._write=function(_,R,A){A(new Error("_write() is not implemented"))},w.prototype._writev=null,w.prototype.end=function(_,R,A){var E=this._writableState;typeof _=="function"?(A=_,_=null,R=null):typeof R=="function"&&(A=R,R=null),_!=null&&this.write(_,R),E.corked&&(E.corked=1,this.uncork()),E.ending||g(this,E,A)};function x(_){return _.ending&&_.length===0&&_.bufferedRequest===null&&!_.finished&&!_.writing}function d(_,R){_._final(function(A){R.pendingcb--,A&&_.emit("error",A),R.prefinished=!0,_.emit("prefinish"),h(_,R)})}function m(_,R){!R.prefinished&&!R.finalCalled&&(typeof _._final=="function"?(R.pendingcb++,R.finalCalled=!0,t.nextTick(d,_,R)):(R.prefinished=!0,_.emit("prefinish")))}function h(_,R){var A=x(R);return A&&(m(_,R),R.pendingcb===0&&(R.finished=!0,_.emit("finish"))),A}function g(_,R,A){R.ending=!0,h(_,R),A&&(R.finished?t.nextTick(A):_.once("finish",A)),R.ended=!0,_.writable=!1}function y(_,R,A){var E=_.entry;for(_.entry=null;E;){var L=E.callback;R.pendingcb--,L(A),E=E.next}R.corkedRequestsFree.next=_}return Object.defineProperty(w.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(_){this._writableState&&(this._writableState.destroyed=_)}}),w.prototype.destroy=l.destroy,w.prototype._undestroy=l.undestroy,w.prototype._destroy=function(_,R){this.end(),R(_)},eh}var th,yb;function Za(){if(yb)return th;yb=1;var t=Of(),e=Object.keys||function(l){var p=[];for(var b in l)p.push(b);return p};th=c;var r=Object.create(Ws());r.inherits=Ye();var n=$w(),a=qw();r.inherits(c,n);for(var i=e(a.prototype),s=0;s<i.length;s++){var o=i[s];c.prototype[o]||(c.prototype[o]=a.prototype[o])}function c(l){if(!(this instanceof c))return new c(l);n.call(this,l),a.call(this,l),l&&l.readable===!1&&(this.readable=!1),l&&l.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,l&&l.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",u)}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function u(){this.allowHalfOpen||this._writableState.ended||t.nextTick(f,this)}function f(l){l.end()}return Object.defineProperty(c.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(l){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=l,this._writableState.destroyed=l)}}),c.prototype._destroy=function(l,p){this.push(null),this.end(),t.nextTick(p,l)},th}var rh,vb;
23function $w(){if(vb)return rh;vb=1;var t=Of();rh=T;var e=G5(),r;T.ReadableState=S,Vs().EventEmitter;var n=function(q,V){return q.listeners(V).length},a=Hw(),i=xd().Buffer,s=(typeof ft<"u"?ft:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function o(q){return i.from(q)}function c(q){return i.isBuffer(q)||q instanceof s}var u=Object.create(Ws());u.inherits=Ye();var f=Pf(),l=void 0;f&&f.debuglog?l=f.debuglog("stream"):l=function(){};var p=j5(),b=Fw(),v;u.inherits(T,a);var w=["error","close","destroy","pause","resume"];function I(q,V,ee){if(typeof q.prependListener=="function")return q.prependListener(V,ee);!q._events||!q._events[V]?q.on(V,ee):e(q._events[V])?q._events[V].unshift(ee):q._events[V]=[ee,q._events[V]]}function S(q,V){r=r||Za(),q=q||{};var ee=V instanceof r;this.objectMode=!!q.objectMode,ee&&(this.objectMode=this.objectMode||!!q.readableObjectMode);var ne=q.highWaterMark,W=q.readableHighWaterMark,z=this.objectMode?16:16*1024;ne||ne===0?this.highWaterMark=ne:ee&&(W||W===0)?this.highWaterMark=W:this.highWaterMark=z,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new p,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=q.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,q.encoding&&(v||(v=Os().StringDecoder),this.decoder=new v(q.encoding),this.encoding=q.encoding)}function T(q){if(r=r||Za(),!(this instanceof T))return new T(q);this._readableState=new S(q,this),this.readable=!0,q&&(typeof q.read=="function"&&(this._read=q.read),typeof q.destroy=="function"&&(this._destroy=q.destroy)),a.call(this)}Object.defineProperty(T.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(q){this._readableState&&(this._readableState.destroyed=q)}}),T.prototype.destroy=b.destroy,T.prototype._undestroy=b.undestroy,T.prototype._destroy=function(q,V){this.push(null),V(q)},T.prototype.push=function(q,V){var ee=this._readableState,ne;return ee.objectMode?ne=!0:typeof q=="string"&&(V=V||ee.defaultEncoding,V!==ee.encoding&&(q=i.from(q,V),V=""),ne=!0),C(this,q,V,!1,ne)},T.prototype.unshift=function(q){return C(this,q,null,!0,!1)};function C(q,V,ee,ne,W){var z=q._readableState;if(V===null)z.reading=!1,P(q,z);else{var ae;W||(ae=$(z,V)),ae?q.emit("error",ae):z.objectMode||V&&V.length>0?(typeof V!="string"&&!z.objectMode&&Object.getPrototypeOf(V)!==i.prototype&&(V=o(V)),ne?z.endEmitted?q.emit("error",new Error("stream.unshift() after end event")):k(q,z,V,!0):z.ended?q.emit("error",new Error("stream.push() after EOF")):(z.reading=!1,z.decoder&&!ee?(V=z.decoder.write(V),z.objectMode||V.length!==0?k(q,z,V,!1):m(q,z)):k(q,z,V,!1))):ne||(z.reading=!1)}return G(z)}function k(q,V,ee,ne){V.flowing&&V.length===0&&!V.sync?(q.emit("data",ee),q.read(0)):(V.length+=V.objectMode?1:ee.length,ne?V.buffer.unshift(ee):V.buffer.push(ee),V.needReadable&&x(q)),m(q,V)}function $(q,V){var ee;return!c(V)&&typeof V!="string"&&V!==void 0&&!q.objectMode&&(ee=new TypeError("Invalid non-string/buffer chunk")),ee}function G(q){return!q.ended&&(q.needReadable||q.length<q.highWaterMark||q.length===0)}T.prototype.isPaused=function(){return this._readableState.flowing===!1},T.prototype.setEncoding=function(q){return v||(v=Os().StringDecoder),this._readableState.decoder=new v(q),this._readableState.encoding=q,this};var B=8388608;function M(q){return q>=B?q=B:(q--,q|=q>>>1,q|=q>>>2,q|=q>>>4,q|=q>>>8,q|=q>>>16,q++),q}function N(q,V){return q<=0||V.length===0&&V.ended?0:V.objectMode?1:q!==q?V.flowing&&V.length?V.buffer.head.data.length:V.length:(q>V.highWaterMark&&(V.highWaterMark=M(q)),q<=V.length?q:V.ended?V.length:(V.needReadable=!0,0))}T.prototype.read=function(q){l("read",q),q=parseInt(q,10);var V=this._readableState,ee=q;if(q!==0&&(V.emittedReadable=!1),q===0&&V.needReadable&&(V.length>=V.highWaterMark||V.ended))return l("read: emitReadable",V.length,V.ended),V.length===0&&V.ended?X(this):x(this),null;if(q=N(q,V),q===0&&V.ended)return V.length===0&&X(this),null;var ne=V.needReadable;l("need readable",ne),(V.length===0||V.length-q<V.highWaterMark)&&
23(ne=!0,l("length less than watermark",ne)),V.ended||V.reading?(ne=!1,l("reading or ended",ne)):ne&&(l("do read"),V.reading=!0,V.sync=!0,V.length===0&&(V.needReadable=!0),this._read(V.highWaterMark),V.sync=!1,V.reading||(q=N(ee,V)));var W;return q>0?W=E(q,V):W=null,W===null?(V.needReadable=!0,q=0):V.length-=q,V.length===0&&(V.ended||(V.needReadable=!0),ee!==q&&V.ended&&X(this)),W!==null&&this.emit("data",W),W};function P(q,V){if(!V.ended){if(V.decoder){var ee=V.decoder.end();ee&&ee.length&&(V.buffer.push(ee),V.length+=V.objectMode?1:ee.length)}V.ended=!0,x(q)}}function x(q){var V=q._readableState;V.needReadable=!1,V.emittedReadable||(l("emitReadable",V.flowing),V.emittedReadable=!0,V.sync?t.nextTick(d,q):d(q))}function d(q){l("emit readable"),q.emit("readable"),A(q)}function m(q,V){V.readingMore||(V.readingMore=!0,t.nextTick(h,q,V))}function h(q,V){for(var ee=V.length;!V.reading&&!V.flowing&&!V.ended&&V.length<V.highWaterMark&&(l("maybeReadMore read 0"),q.read(0),ee!==V.length);)ee=V.length;V.readingMore=!1}T.prototype._read=function(q){this.emit("error",new Error("_read() is not implemented"))},T.prototype.pipe=function(q,V){var ee=this,ne=this._readableState;switch(ne.pipesCount){case 0:ne.pipes=q;break;case 1:ne.pipes=[ne.pipes,q];break;default:ne.pipes.push(q);break}ne.pipesCount+=1,l("pipe count=%d opts=%j",ne.pipesCount,V);var W=(!V||V.end!==!1)&&q!==ke.stdout&&q!==ke.stderr,z=W?pe:Ee;ne.endEmitted?t.nextTick(z):ee.once("end",z),q.on("unpipe",ae);function ae(ve,Be){l("onunpipe"),ve===ee&&Be&&Be.hasUnpiped===!1&&(Be.hasUnpiped=!0,_e())}function pe(){l("onend"),q.end()}var ge=g(ee);q.on("drain",ge);var be=!1;function _e(){l("cleanup"),q.removeListener("close",ye),q.removeListener("finish",we),q.removeListener("drain",ge),q.removeListener("error",Pe),q.removeListener("unpipe",ae),ee.removeListener("end",pe),ee.removeListener("end",Ee),ee.removeListener("data",de),be=!0,ne.awaitDrain&&(!q._writableState||q._writableState.needDrain)&&ge()}var Ie=!1;ee.on("data",de);function de(ve){l("ondata"),Ie=!1;var Be=q.write(ve);Be===!1&&!Ie&&((ne.pipesCount===1&&ne.pipes===q||ne.pipesCount>1&&j(ne.pipes,q)!==-1)&&!be&&(l("false write response, pause",ne.awaitDrain),ne.awaitDrain++,Ie=!0),ee.pause())}function Pe(ve){l("onerror",ve),Ee(),q.removeListener("error",Pe),n(q,"error")===0&&q.emit("error",ve)}I(q,"error",Pe);function ye(){q.removeListener("finish",we),Ee()}q.once("close",ye);function we(){l("onfinish"),q.removeListener("close",ye),Ee()}q.once("finish",we);function Ee(){l("unpipe"),ee.unpipe(q)}return q.emit("pipe",ee),ne.flowing||(l("pipe resume"),ee.resume()),q};function g(q){return function(){var V=q._readableState;l("pipeOnDrain",V.awaitDrain),V.awaitDrain&&V.awaitDrain--,V.awaitDrain===0&&n(q,"data")&&(V.flowing=!0,A(q))}}T.prototype.unpipe=function(q){var V=this._readableState,ee={hasUnpiped:!1};if(V.pipesCount===0)return this;if(V.pipesCount===1)return q&&q!==V.pipes?this:(q||(q=V.pipes),V.pipes=null,V.pipesCount=0,V.flowing=!1,q&&q.emit("unpipe",this,ee),this);if(!q){var ne=V.pipes,W=V.pipesCount;V.pipes=null,V.pipesCount=0,V.flowing=!1;for(var z=0;z<W;z++)ne[z].emit("unpipe",this,{hasUnpiped:!1});return this}var ae=j(V.pipes,q);return ae===-1?this:(V.pipes.splice(ae,1),V.pipesCount-=1,V.pipesCount===1&&(V.pipes=V.pipes[0]),q.emit("unpipe",this,ee),this)},T.prototype.on=function(q,V){var ee=a.prototype.on.call(this,q,V);if(q==="data")this._readableState.flowing!==!1&&this.resume();else if(q==="readable"){var ne=this._readableState;!ne.endEmitted&&!ne.readableListening&&(ne.readableListening=ne.needReadable=!0,ne.emittedReadable=!1,ne.reading?ne.length&&x(this):t.nextTick(y,this))}return ee},T.prototype.addListener=T.prototype.on;function y(q){l("readable nexttick read 0"),q.read(0)}T.prototype.resume=function(){var q=this._readableState;return q.flowing||(l("resume"),q.flowing=!0,_(this,q)),this};function _(q,V){V.resumeScheduled||(V.resumeScheduled=!0,t.nextTick(R,q,V))}function R(q,V){V.reading||(l("resume read 0"),q.read(0)),V.resumeScheduled=!1,V.awaitDrain=0,q.emit("resume"),A(q),V.flowing&&!V.reading&&q.read(0)}T.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(l("pause"),this._readableState.flowing=!1,this.emit
23("pause")),this};function A(q){var V=q._readableState;for(l("flow",V.flowing);V.flowing&&q.read()!==null;);}T.prototype.wrap=function(q){var V=this,ee=this._readableState,ne=!1;q.on("end",function(){if(l("wrapped end"),ee.decoder&&!ee.ended){var ae=ee.decoder.end();ae&&ae.length&&V.push(ae)}V.push(null)}),q.on("data",function(ae){if(l("wrapped data"),ee.decoder&&(ae=ee.decoder.write(ae)),!(ee.objectMode&&ae==null)&&!(!ee.objectMode&&(!ae||!ae.length))){var pe=V.push(ae);pe||(ne=!0,q.pause())}});for(var W in q)this[W]===void 0&&typeof q[W]=="function"&&(this[W]=(function(ae){return function(){return q[ae].apply(q,arguments)}})(W));for(var z=0;z<w.length;z++)q.on(w[z],this.emit.bind(this,w[z]));return this._read=function(ae){l("wrapped _read",ae),ne&&(ne=!1,q.resume())},this},Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),T._fromList=E;function E(q,V){if(V.length===0)return null;var ee;return V.objectMode?ee=V.buffer.shift():!q||q>=V.length?(V.decoder?ee=V.buffer.join(""):V.buffer.length===1?ee=V.buffer.head.data:ee=V.buffer.concat(V.length),V.buffer.clear()):ee=L(q,V.buffer,V.decoder),ee}function L(q,V,ee){var ne;return q<V.head.data.length?(ne=V.head.data.slice(0,q),V.head.data=V.head.data.slice(q)):q===V.head.data.length?ne=V.shift():ne=ee?O(q,V):U(q,V),ne}function O(q,V){var ee=V.head,ne=1,W=ee.data;for(q-=W.length;ee=ee.next;){var z=ee.data,ae=q>z.length?z.length:q;if(ae===z.length?W+=z:W+=z.slice(0,q),q-=ae,q===0){ae===z.length?(++ne,ee.next?V.head=ee.next:V.head=V.tail=null):(V.head=ee,ee.data=z.slice(ae));break}++ne}return V.length-=ne,W}function U(q,V){var ee=i.allocUnsafe(q),ne=V.head,W=1;for(ne.data.copy(ee),q-=ne.data.length;ne=ne.next;){var z=ne.data,ae=q>z.length?z.length:q;if(z.copy(ee,ee.length-q,0,ae),q-=ae,q===0){ae===z.length?(++W,ne.next?V.head=ne.next:V.head=V.tail=null):(V.head=ne,ne.data=z.slice(ae));break}++W}return V.length-=W,ee}function X(q){var V=q._readableState;if(V.length>0)throw new Error('"endReadable()" called on non-empty stream');V.endEmitted||(V.ended=!0,t.nextTick(J,V,q))}function J(q,V){!q.endEmitted&&q.length===0&&(q.endEmitted=!0,V.readable=!1,V.emit("end"))}function j(q,V){for(var ee=0,ne=q.length;ee<ne;ee++)if(q[ee]===V)return ee;return-1}return rh}var nh,wb;function Kw(){if(wb)return nh;wb=1,nh=n;var t=Za(),e=Object.create(Ws());e.inherits=Ye(),e.inherits(n,t);function r(s,o){var c=this._transformState;c.transforming=!1;var u=c.writecb;if(!u)return this.emit("error",new Error("write callback called multiple times"));c.writechunk=null,c.writecb=null,o!=null&&this.push(o),u(s);var f=this._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}function n(s){if(!(this instanceof n))return new n(s);t.call(this,s),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,s&&(typeof s.transform=="function"&&(this._transform=s.transform),typeof s.flush=="function"&&(this._flush=s.flush)),this.on("prefinish",a)}function a(){var s=this;typeof this._flush=="function"?this._flush(function(o,c){i(s,o,c)}):i(this,null,null)}n.prototype.push=function(s,o){return this._transformState.needTransform=!1,t.prototype.push.call(this,s,o)},n.prototype._transform=function(s,o,c){throw new Error("_transform() is not implemented")},n.prototype._write=function(s,o,c){var u=this._transformState;if(u.writecb=c,u.writechunk=s,u.writeencoding=o,!u.transforming){var f=this._readableState;(u.needTransform||f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}},n.prototype._read=function(s){var o=this._transformState;o.writechunk!==null&&o.writecb&&!o.transforming?(o.transforming=!0,this._transform(o.writechunk,o.writeencoding,o.afterTransform)):o.needTransform=!0},n.prototype._destroy=function(s,o){var c=this;t.prototype._destroy.call(this,s,function(u){o(u),c.emit("close")})};function i(s,o,c){if(o)return s.emit("error",o);if(c!=null&&s.push(c),s._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(s._transformState.transforming)throw new Error("Calling transform done when still transforming");return s.push(null)}return nh}var ih,_b;function V5(){if(_b)return ih;_b=1,ih=r;var t=Kw(),e=Object.create(Ws());e.inherits=Ye(),e.inherits(r,t);function r(n){if(!(this instanceof r))return new r(n);t.call(this,n)}return r.prototype._transform=function(n,a,i){i(null,n)},ih}var Eb;function Gw(){return Eb||(Eb=1,(function(t,e){e=t.exports=$w(),e.Stream=e,e.Readable=e,e.Writable=qw(),e.Duplex=Za(),e.Transform=Kw(),e.PassThrough=V5()}
23)(go,go.exports)),go.exports}var ah,Sb;function z5(){if(Sb)return ah;Sb=1;var t=et().Buffer,e=K5(),r=Gw().Transform,n=Ye();function a(i){r.call(this),this._block=t.allocUnsafe(i),this._blockSize=i,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return n(a,r),a.prototype._transform=function(i,s,o){var c=null;try{this.update(i,s)}catch(u){c=u}o(c)},a.prototype._flush=function(i){var s=null;try{this.push(this.digest())}catch(o){s=o}i(s)},a.prototype.update=function(i,s){if(this._finalized)throw new Error("Digest already called");for(var o=e(i,s),c=this._block,u=0;this._blockOffset+o.length-u>=this._blockSize;){for(var f=this._blockOffset;f<this._blockSize;)c[f]=o[u],f+=1,u+=1;this._update(),this._blockOffset=0}for(;u<o.length;)c[this._blockOffset]=o[u],this._blockOffset+=1,u+=1;for(var l=0,p=o.length*8;p>0;++l)this._length[l]+=p,p=this._length[l]/4294967296|0,p>0&&(this._length[l]-=4294967296*p);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(i){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var s=this._digest();i!==void 0&&(s=s.toString(i)),this._block.fill(0),this._blockOffset=0;for(var o=0;o<4;++o)this._length[o]=0;return s},a.prototype._digest=function(){throw new Error("_digest is not implemented")},ah=a,ah}var sh,xb;function Ad(){if(xb)return sh;xb=1;var t=Or().Buffer,e=Ye(),r=z5(),n=new Array(16),a=[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],i=[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],s=[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],o=[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],c=[0,1518500249,1859775393,2400959708,2840853838],u=[1352829926,1548603684,1836072691,2053994217,0];function f(S,T){return S<<T|S>>>32-T}function l(S,T,C,k,$,G,B,M){return f(S+(T^C^k)+G+B|0,M)+$|0}function p(S,T,C,k,$,G,B,M){return f(S+(T&C|~T&k)+G+B|0,M)+$|0}function b(S,T,C,k,$,G,B,M){return f(S+((T|~C)^k)+G+B|0,M)+$|0}function v(S,T,C,k,$,G,B,M){return f(S+(T&k|C&~k)+G+B|0,M)+$|0}function w(S,T,C,k,$,G,B,M){return f(S+(T^(C|~k))+G+B|0,M)+$|0}function I(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}return e(I,r),I.prototype._update=function(){for(var S=n,T=0;T<16;++T)S[T]=this._block.readInt32LE(T*4);for(var C=this._a|0,k=this._b|0,$=this._c|0,G=this._d|0,B=this._e|0,M=this._a|0,N=this._b|0,P=this._c|0,x=this._d|0,d=this._e|0,m=0;m<80;m+=1){var h,g;m<16?(h=l(C,k,$,G,B,S[a[m]],c[0],s[m]),g=w(M,N,P,x,d,S[i[m]],u[0],o[m])):m<32?(h=p(C,k,$,G,B,S[a[m]],c[1],s[m]),g=v(M,N,P,x,d,S[i[m]],u[1],o[m])):m<48?(h=b(C,k,$,G,B,S[a[m]],c[2],s[m]),g=b(M,N,P,x,d,S[i[m]],u[2],o[m])):m<64?(h=v(C,k,$,G,B,S[a[m]],c[3],s[m]),g=p(M,N,P,x,d,S[i[m]],u[3],o[m])):(h=w(C,k,$,G,B,S[a[m]],c[4],s[m]),g=l(M,N,P,x,d,S[i[m]],u[4],o[m])),C=B,B=G,G=f($,10),$=k,k=h,M=d,d=x,x=f(P,10),P=N,N=g}var y=this._b+$+x|0;this._b=this._c+G+d|0,this._c=this._d+B+M|0,this._d=this._e+C+N|0,this._e=this._a+k+P|0,this._a=y},I.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 S=t.alloc?t.alloc(20):new t(20);return S.writeInt32LE(this._a,0),S.writeInt32LE(this._b,4),S.writeInt32LE(this._c,8),S.writeInt32LE(this._d,12),S.writeInt32LE(this._e,16),S},sh=I,sh}var oh={exports:{}},fh,Ab;function ss(){if(Ab)return fh;Ab=1;var t=et().Buffer,e=Mf();function r(n,a){this._block=t.alloc(n),this._finalSize=a,this._blockSize=n,this._len=0}return r.prototype.update=function(n,a){n=e(n,a||"utf8");for(var i=this._block,s=this._blockSize,o=n.length,c=this._len,u=0;u<o;){for(var f=c%s,l=Math.min(o-u,s-f),p=0;p<l;p++)i[f+p]=n[u+p];c+=l,u+=l,c%s===0&&this._update(i)}return this._len+=o,this},r.prototype.digest=function(n){var a=this._len%this._blockSize;this._block[a]=128,this._block.fill(0,a+1),a>=this._finalSize&&(this._update(this._block),this._block.fill(0));var i=this._len*8;if(i<=4294967295)this._block.writeUInt32BE(i,this._blockSize-4);else{var s=(i&4294967295)>>>0,o=(i-s)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(s,this._blockSize-4)}this._update(this._block);var c=this._hash();return n?c.toString(n):c},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},fh=r,fh}var ch,Rb;function W5(){if(Rb)return ch;Rb=1;var t=Ye(),e=ss(),r=et().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function i(){this.init(),this._w=a,e.call(this,64,56)}t(i,e),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(u){return u<<5|u>>>27}function o(u){return u<<30|u>>>2}function c(u,f,l,p){return u===0?f&l|~f&p:u===2?f&l|f&p|l&p:f^l^p}return i.prototype._update=function(u){for(var f=this._w,l=this._a|0,p=this._b|0,b=this._c|0,v=this._d|0,w=this._e|0,I=0;I<16;++I)f[I]=u.readInt32BE(I*4);for(;I<80;++I)f[I]=f[I-3]^f[I-8]^f[I-14]^f[I-16];for(var S=0;S<80;++S){var T=~~(S/20),C=s(l)+c(T,p,b,v)+w+f[S]+n[T]|0;w=v,v=b,b=o(p),p=l,l=C}this._a=l+this._a|0,this._b=p+this._b|0,this._c=b+this._c|0,this._d=v+this._d|0,this._e=w+this._e|0},i.prototype._hash=function(){var u=r.allocUnsafe(20);return u.writeInt32BE(this._a|0,0),u.writeInt32BE(this._b|0,4),u.writeInt32BE(this._c|0,8),u.writeInt32BE(this._d|0,12),u.writeInt32BE(this._e|0,16),u},ch=i,ch}var uh,Ib;function Z5(){if(Ib)return uh;Ib=1;var t=Ye(),e=ss(),r=et().Buffer,n=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function i(){this.init(),this._w=a,e.call(this,64,56)}t(i,e),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function s(f){return f<<1|f>>>31}function o(f){return f<<5|f>>>27}function c(f){return f<<30|f>>>2}function u(f,l,p,b){return f===0?l&p|~l&b:f===2?l&p|l&b|p&b:l^p^b}return i.prototype._update=function(f){for(var l=this._w,p=this._a|0,b=this._b|0,v=this._c|0,w=this._d|0,I=this._e|0,S=0;S<16;++S)l[S]=f.readInt32BE(S*4);for(;S<80;++S)l[S]=s(l[S-3]^l[S-8]^l[S-14]^l[S-16]);for(var T=0;T<80;
23++T){var C=~~(T/20),k=o(p)+u(C,b,v,w)+I+l[T]+n[C]|0;I=w,w=v,v=c(b),b=p,p=k}this._a=p+this._a|0,this._b=b+this._b|0,this._c=v+this._c|0,this._d=w+this._d|0,this._e=I+this._e|0},i.prototype._hash=function(){var f=r.allocUnsafe(20);return f.writeInt32BE(this._a|0,0),f.writeInt32BE(this._b|0,4),f.writeInt32BE(this._c|0,8),f.writeInt32BE(this._d|0,12),f.writeInt32BE(this._e|0,16),f},uh=i,uh}var hh,Bb;function jw(){if(Bb)return hh;Bb=1;var t=Ye(),e=ss(),r=et().Buffer,n=[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],a=new Array(64);function i(){this.init(),this._w=a,e.call(this,64,56)}t(i,e),i.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 s(p,b,v){return v^p&(b^v)}function o(p,b,v){return p&b|v&(p|b)}function c(p){return(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10)}function u(p){return(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7)}function f(p){return(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3}function l(p){return(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10}return i.prototype._update=function(p){for(var b=this._w,v=this._a|0,w=this._b|0,I=this._c|0,S=this._d|0,T=this._e|0,C=this._f|0,k=this._g|0,$=this._h|0,G=0;G<16;++G)b[G]=p.readInt32BE(G*4);for(;G<64;++G)b[G]=l(b[G-2])+b[G-7]+f(b[G-15])+b[G-16]|0;for(var B=0;B<64;++B){var M=$+u(T)+s(T,C,k)+n[B]+b[B]|0,N=c(v)+o(v,w,I)|0;$=k,k=C,C=T,T=S+M|0,S=I,I=w,w=v,v=M+N|0}this._a=v+this._a|0,this._b=w+this._b|0,this._c=I+this._c|0,this._d=S+this._d|0,this._e=T+this._e|0,this._f=C+this._f|0,this._g=k+this._g|0,this._h=$+this._h|0},i.prototype._hash=function(){var p=r.allocUnsafe(32);return p.writeInt32BE(this._a,0),p.writeInt32BE(this._b,4),p.writeInt32BE(this._c,8),p.writeInt32BE(this._d,12),p.writeInt32BE(this._e,16),p.writeInt32BE(this._f,20),p.writeInt32BE(this._g,24),p.writeInt32BE(this._h,28),p},hh=i,hh}var lh,Tb;function Y5(){if(Tb)return lh;Tb=1;var t=Ye(),e=jw(),r=ss(),n=et().Buffer,a=new Array(64);function i(){this.init(),this._w=a,r.call(this,64,56)}return t(i,e),i.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},i.prototype._hash=function(){var s=n.allocUnsafe(28);return s.writeInt32BE(this._a,0),s.writeInt32BE(this._b,4),s.writeInt32BE(this._c,8),s.writeInt32BE(this._d,12),s.writeInt32BE(this._e,16),s.writeInt32BE(this._f,20),s.writeInt32BE(this._g,24),s},lh=i,lh}var dh,Pb;function Vw(){if(Pb)return dh;Pb=1;var t=Ye(),e=ss(),r=et().Buffer,n=[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,
231322822218,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],a=new Array(160);function i(){this.init(),this._w=a,e.call(this,128,112)}t(i,e),i.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 s(w,I,S){return S^w&(I^S)}function o(w,I,S){return w&I|S&(w|I)}function c(w,I){return(w>>>28|I<<4)^(I>>>2|w<<30)^(I>>>7|w<<25)}function u(w,I){return(w>>>14|I<<18)^(w>>>18|I<<14)^(I>>>9|w<<23)}function f(w,I){return(w>>>1|I<<31)^(w>>>8|I<<24)^w>>>7}function l(w,I){return(w>>>1|I<<31)^(w>>>8|I<<24)^(w>>>7|I<<25)}function p(w,I){return(w>>>19|I<<13)^(I>>>29|w<<3)^w>>>6}function b(w,I){return(w>>>19|I<<13)^(I>>>29|w<<3)^(w>>>6|I<<26)}function v(w,I){return w>>>0<I>>>0?1:0}return i.prototype._update=function(w){for(var I=this._w,S=this._ah|0,T=this._bh|0,C=this._ch|0,k=this._dh|0,$=this._eh|0,G=this._fh|0,B=this._gh|0,M=this._hh|0,N=this._al|0,P=this._bl|0,x=this._cl|0,d=this._dl|0,m=this._el|0,h=this._fl|0,g=this._gl|0,y=this._hl|0,_=0;_<32;_+=2)I[_]=w.readInt32BE(_*4),I[_+1]=w.readInt32BE(_*4+4);for(;_<160;_+=2){var R=I[_-30],A=I[_-30+1],E=f(R,A),L=l(A,R);R=I[_-4],A=I[_-4+1];var O=p(R,A),U=b(A,R),X=I[_-14],J=I[_-14+1],j=I[_-32],q=I[_-32+1],V=L+J|0,ee=E+X+v(V,L)|0;V=V+U|0,ee=ee+O+v(V,U)|0,V=V+q|0,ee=ee+j+v(V,q)|0,I[_]=ee,I[_+1]=V}for(var ne=0;ne<160;ne+=2){ee=I[ne],V=I[ne+1];var W=o(S,T,C),z=o(N,P,x),ae=c(S,N),pe=c(N,S),ge=u($,m),be=u(m,$),_e=n[ne],Ie=n[ne+1],de=s($,G,B),Pe=s(m,h,g),ye=y+be|0,we=M+ge+v(ye,y)|0;ye=ye+Pe|0,we=we+de+v(ye,Pe)|0,ye=ye+Ie|0,we=we+_e+v(ye,Ie)|0,ye=ye+V|0,we=we+ee+v(ye,V)|0;var Ee=pe+z|0,ve=ae+W+v(Ee,pe)|0;M=B,y=g,B=G,g=h,G=$,h=m,m=d+ye|0,$=k+we+v(m,d)|0,k=C,d=x,C=T,x=P,T=S,P=N,N=ye+Ee|0,S=we+ve+v(N,ye)|0}this._al=this._al+N|0,this._bl=this._bl+P|0,this._cl=this._cl+x|0,this._dl=this._dl+d|0,this._el=this._el+m|0,this._fl=this._fl+h|0,this._gl=this._gl+g|0,this._hl=this._hl+y|0,this._ah=this._ah+S+v(this._al,N)|0,this._bh=this._bh+T+v(this._bl,P)|0,this._ch=this._ch+C+v(this._cl,x)|0,this._dh=this._dh+k+v(this._dl,d)|0,this._eh=this._eh+$+v(this._el,m)|0,this._fh=this._fh+G+v(this._fl,h)|0,this._gh=this._gh+B+v(this._gl,g)|0,this._hh=this._hh+M+v(this._hl,y)|0},i.prototype._hash=function(){var w=r.allocUnsafe(64);function I(S,T,C){w.writeInt32BE(S,C),w.writeInt32BE(T,C+4)}return I(this._ah,this._al,0),I(this._bh,this._bl,8),I(this._ch,this._cl,16),I(this._dh,this._dl,24),I(this._eh,this._el,32),I(this._fh,this._fl,40),I(this._gh,this._gl,48),I(this._hh,this._hl,56),w},dh=i,dh}var ph,Mb;function X5(){if(Mb)return ph;Mb=1;var t=Ye(),e=Vw(),r=ss(),n=et().Buffer,a=new Array(160);function i(){this.init(),this._w=a,r.call(this,128,112)}return t(i,e),i.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},i.prototype._hash=function(){var s=n.allocUnsafe(48);function o(c,u,f){s.writeInt32BE(c,f),s.writeInt32BE(u,f+4)}return o(this._ah,this._al,0),o(this._bh,this._bl,8),o(this._ch,this._cl,16),o(this._dh,this._dl,24),o(this._eh,this._el,32),o(this._fh,this._fl,40),s},ph=i,ph}var Ob;function Rd(){return Ob||(Ob=1,(function(t){t.exports=function(r){var n=r.toLowerCase(),a=t.exports[n];if(!a)throw new Error(n+" is not supported (we accept pull requests)");return new a},t.exports.sha=W5(),t.exports.sha1=Z5(),t.exports.sha224=Y5(),t.exports.sha256=jw(),t.exports.sha384=X5(),t.exports.sha512=Vw()})(oh)),oh.exports}var gh,Lb;function Ii(){if(Lb)return gh;Lb=1;var t=et().Buffer,e=Dw().Transform,r=Os().StringDecoder,n=Ye(),a=Mf();function i(s){e.call(this),this.hashMode=typeof s=="string",this.hashMode?this[s]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return n(i,e),i.prototype.update=function(s,o,c){var u=a(s,o),f=this._update(u);return this.hashMode?this:(c&&(f=this._toString(f,c)),f)},i.prototype.setAutoPadding=function(){},i.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},i.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},i.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},i.prototype._transform=function(s,o,c){var u;try{this.hashMode?this._update(s):this.push(this._update(s))}catch(f){u=f}finally{c(u)}},i.prototype._flush=function(s){var o;try{this.push(this.__final())}catch(c){o=c}s(o)},i.prototype._finalOrDigest=function(s){var o=this.__final()||t.alloc(0);return s&&(o=this._toString(o,s,!0)),o},i.prototype._toString=function(s,o,c){if(this._decoder||(this._decoder=new r(o),this._encoding=o),this._encoding!==o)throw new Error("can’t switch encodings");var u=this._decoder.write(s);return c&&(u+=this._decoder.end()),u},gh=i,gh}var bh,Nb;function Zs(){if(Nb)return bh;Nb=1;var t=Ye(),e=Sd(),r=Ad(),n=Rd(),a=Ii();function i(s){a.call(this,"digest"),this._hash=s}return t(i,a),i.prototype._update=function(s){this._hash.update(s)},i.prototype._final=function(){return this._hash.digest()},bh=function(o){return o=o.toLowerCase(),o==="md5"?new e:o==="rmd160"||o==="ripemd160"?new r:new i(n(o))},bh}var mh,kb;function J5(){if(kb)return mh;kb=1;var t=Ye(),e=et().Buffer,r=Ii(),n=e.alloc(128),a=64;
23function i(s,o){r.call(this,"digest"),typeof o=="string"&&(o=e.from(o)),this._alg=s,this._key=o,o.length>a?o=s(o):o.length<a&&(o=e.concat([o,n],a));for(var c=this._ipad=e.allocUnsafe(a),u=this._opad=e.allocUnsafe(a),f=0;f<a;f++)c[f]=o[f]^54,u[f]=o[f]^92;this._hash=[c]}return t(i,r),i.prototype._update=function(s){this._hash.push(s)},i.prototype._final=function(){var s=this._alg(e.concat(this._hash));return this._alg(e.concat([this._opad,s]))},mh=i,mh}var yh,Cb;function zw(){if(Cb)return yh;Cb=1;var t=Sd();return yh=function(e){return new t().update(e).digest()},yh}var vh,Ub;function Ww(){if(Ub)return vh;Ub=1;var t=Ye(),e=J5(),r=Ii(),n=et().Buffer,a=zw(),i=Ad(),s=Rd(),o=n.alloc(128);function c(u,f){r.call(this,"digest"),typeof f=="string"&&(f=n.from(f));var l=u==="sha512"||u==="sha384"?128:64;if(this._alg=u,this._key=f,f.length>l){var p=u==="rmd160"?new i:s(u);f=p.update(f).digest()}else f.length<l&&(f=n.concat([f,o],l));for(var b=this._ipad=n.allocUnsafe(l),v=this._opad=n.allocUnsafe(l),w=0;w<l;w++)b[w]=f[w]^54,v[w]=f[w]^92;this._hash=u==="rmd160"?new i:s(u),this._hash.update(b)}return t(c,r),c.prototype._update=function(u){this._hash.update(u)},c.prototype._final=function(){var u=this._hash.digest(),f=this._alg==="rmd160"?new i:s(this._alg);return f.update(this._opad).update(u).digest()},vh=function(f,l){return f=f.toLowerCase(),f==="rmd160"||f==="ripemd160"?new c("rmd160",l):f==="md5"?new e(a,l):new c(f,l)},vh}const Q5={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},eS={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},tS={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},rS={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},nS={sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},iS={sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},aS={sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sS={sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},oS={sign:"dsa",hash:"sha1",id:""},fS={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},cS={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},Zw={sha224WithRSAEncryption:Q5,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:eS,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:tS,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:rS,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:nS,sha224:iS,sha384:aS,sha512:sS,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:oS,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:fS,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:cS,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var wh,Db;function uS(){return Db||(Db=1,wh=Zw),wh}var yo={},_h,Hb;function Yw(){if(Hb)return _h;Hb=1;var t=isFinite,e=Math.pow(2,30)-1;return _h=function(r,n){if(typeof r!="number")throw new TypeError("Iterations not a number");if(r<0||!t(r))throw new TypeError("Bad iterations");
23if(typeof n!="number")throw new TypeError("Key length not a number");if(n<0||n>e||n!==n)throw new TypeError("Bad key length");return n+0},_h}var Eh,Fb;function Xw(){if(Fb)return Eh;Fb=1;var t;if(ft.process&&ft.process.browser)t="utf-8";else if(ft.process&&ft.process.version){var e=parseInt(ke.version.split(".")[0].slice(1),10);t=e>=6?"utf-8":"binary"}else t="utf-8";return Eh=t,Eh}var Sh,qb;function Jw(){if(qb)return Sh;qb=1;var t=et().Buffer,e=Mf(),r=typeof Uint8Array<"u",n=r&&typeof ArrayBuffer<"u",a=n&&ArrayBuffer.isView;return Sh=function(i,s,o){if(typeof i=="string"||t.isBuffer(i)||r&&i instanceof Uint8Array||a&&a(i))return e(i,s);throw new TypeError(o+" must be a string, a Buffer, a Uint8Array, or a DataView")},Sh}var xh,$b;function Qw(){if($b)return xh;$b=1;var t=zw(),e=Ad(),r=Rd(),n=et().Buffer,a=Yw(),i=Xw(),s=Jw(),o=n.alloc(128),c={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},u={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function f(v){return new e().update(v).digest()}function l(v){function w(I){return r(v).update(I).digest()}return v==="rmd160"||v==="ripemd160"?f:v==="md5"?t:w}function p(v,w,I){var S=l(v),T=v==="sha512"||v==="sha384"?128:64;w.length>T?w=S(w):w.length<T&&(w=n.concat([w,o],T));for(var C=n.allocUnsafe(T+c[v]),k=n.allocUnsafe(T+c[v]),$=0;$<T;$++)C[$]=w[$]^54,k[$]=w[$]^92;var G=n.allocUnsafe(T+I+4);C.copy(G,0,0,T),this.ipad1=G,this.ipad2=C,this.opad=k,this.alg=v,this.blocksize=T,this.hash=S,this.size=c[v]}p.prototype.run=function(v,w){v.copy(w,this.blocksize);var I=this.hash(w);return I.copy(this.opad,this.blocksize),this.hash(this.opad)};function b(v,w,I,S,T){S=a(I,S),v=s(v,i,"Password"),w=s(w,i,"Salt");var C=(T||"sha1").toLowerCase(),k=u[C]||C,$=c[k];if(typeof $!="number"||!$)throw new TypeError("Digest algorithm not supported: "+T);var G=new p(k,v,w.length),B=n.allocUnsafe(S),M=n.allocUnsafe(w.length+4);w.copy(M,0,0,w.length);for(var N=0,P=$,x=Math.ceil(S/P),d=1;d<=x;d++){M.writeUInt32BE(d,w.length);for(var m=G.run(M,G.ipad1),h=m,g=1;g<I;g++){h=G.run(h,G.ipad2);for(var y=0;y<P;y++)m[y]^=h[y]}m.copy(B,N),N+=P}return B}return xh=b,xh}var Ah,Kb;function hS(){if(Kb)return Ah;Kb=1;var t=et().Buffer,e=Yw(),r=Xw(),n=Qw(),a=Jw(),i,s=ft.crypto&&ft.crypto.subtle,o={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"},c=[],u;function f(){return u||(ft.process&&ft.process.nextTick?u=ft.process.nextTick:ft.queueMicrotask?u=ft.queueMicrotask:ft.setImmediate?u=ft.setImmediate:u=ft.setTimeout,u)}function l(v,w,I,S,T){return s.importKey("raw",v,{name:"PBKDF2"},!1,["deriveBits"]).then(function(C){return s.deriveBits({name:"PBKDF2",salt:w,iterations:I,hash:{name:T}},C,S<<3)}).then(function(C){return t.from(C)})}function p(v){if(ft.process&&!ft.process.browser||!s||!s.importKey||!s.deriveBits)return Promise.resolve(!1);if(c[v]!==void 0)return c[v];i=i||t.alloc(8);var w=l(i,i,10,128,v).then(function(){return!0},function(){return!1});return c[v]=w,w}function b(v,w){v.then(function(I){f()(function(){w(null,I)})},function(I){f()(function(){w(I)})})}return Ah=function(v,w,I,S,T,C){if(typeof T=="function"&&(C=T,T=void 0),S=e(I,S),v=a(v,r,"Password"),w=a(w,r,"Salt"),typeof C!="function")throw new Error("No callback provided to pbkdf2");T=T||"sha1";var k=o[T.toLowerCase()];if(!k||typeof ft.Promise!="function"){f()(function(){var $;try{$=n(v,w,I,S,T)}catch(G){C(G);return}C(null,$)});return}b(p(k).then(function($){return $?l(v,w,I,S,k):n(v,w,I,S,T)}),C)},Ah}var Gb;function e3(){return Gb||(Gb=1,yo.pbkdf2=hS(),yo.pbkdf2Sync=Qw()),yo}var Sr={},zi={},mr={},jb;function t3(){if(jb)return mr;jb=1,mr.readUInt32BE=function(a,i){var s=a[0+i]<<24|a[1+i]<<16|a[2+i]<<8|a[3+i];return s>>>0},mr.writeUInt32BE=function(a,i,s){a[0+s]=i>>>24,a[1+s]=i>>>16&255,a[2+s]=i>>>8&255,a[3+s]=i&255},mr.ip=function(a,i,s,o){for(var c=0,u=0,f=6;f>=0;f-=2){for(var l=0;l<=24;l+=8)c<<=1,c|=i>>>l+f&1;for(var l=0;l<=24;l+=8)c<<=1,c|=a>>>l+f&1}for(var f=6;f>=0;f-=2){for(var l=1;l<=25;l+=8)u<<=1,u|=i>>>l+f&1;for(var l=1;l<=25;l+=8)u<<=1,u|=a>>>l+f&1}s[o+0]=c>>>0,s[o+1]=u>>>0},mr.rip=function(a,i,s,o){for(var c=0,u=0,f=0;f<4;f++)for(var l=24;l>=0;l-=8)c<<=1,c|=i>>>
23l+f&1,c<<=1,c|=a>>>l+f&1;for(var f=4;f<8;f++)for(var l=24;l>=0;l-=8)u<<=1,u|=i>>>l+f&1,u<<=1,u|=a>>>l+f&1;s[o+0]=c>>>0,s[o+1]=u>>>0},mr.pc1=function(a,i,s,o){for(var c=0,u=0,f=7;f>=5;f--){for(var l=0;l<=24;l+=8)c<<=1,c|=i>>l+f&1;for(var l=0;l<=24;l+=8)c<<=1,c|=a>>l+f&1}for(var l=0;l<=24;l+=8)c<<=1,c|=i>>l+f&1;for(var f=1;f<=3;f++){for(var l=0;l<=24;l+=8)u<<=1,u|=i>>l+f&1;for(var l=0;l<=24;l+=8)u<<=1,u|=a>>l+f&1}for(var l=0;l<=24;l+=8)u<<=1,u|=a>>l+f&1;s[o+0]=c>>>0,s[o+1]=u>>>0},mr.r28shl=function(a,i){return a<<i&268435455|a>>>28-i};var t=[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];mr.pc2=function(a,i,s,o){for(var c=0,u=0,f=t.length>>>1,l=0;l<f;l++)c<<=1,c|=a>>>t[l]&1;for(var l=f;l<t.length;l++)u<<=1,u|=i>>>t[l]&1;s[o+0]=c>>>0,s[o+1]=u>>>0},mr.expand=function(a,i,s){var o=0,c=0;o=(a&1)<<5|a>>>27;for(var u=23;u>=15;u-=4)o<<=6,o|=a>>>u&63;for(var u=11;u>=3;u-=4)c|=a>>>u&63,c<<=6;c|=(a&31)<<1|a>>>31,i[s+0]=o>>>0,i[s+1]=c>>>0};var e=[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];mr.substitute=function(a,i){for(var s=0,o=0;o<4;o++){var c=a>>>18-o*6&63,u=e[o*64+c];s<<=4,s|=u}for(var o=0;o<4;o++){var c=i>>>18-o*6&63,u=e[256+o*64+c];s<<=4,s|=u}return s>>>0};var r=[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];return mr.permute=function(a){for(var i=0,s=0;s<r.length;s++)i<<=1,i|=a>>>r[s]&1;return i>>>0},mr.padSplit=function(a,i,s){for(var o=a.toString(2);o.length<i;)o="0"+o;for(var c=[],u=0;u<i;u+=s)c.push(o.slice(u,u+s));return c.join(" ")},mr}var Rh,Vb;function Lr(){if(Vb)return Rh;Vb=1,Rh=t;function t(e,r){if(!e)throw new Error(r||"Assertion failed")}return t.equal=function(r,n,a){if(r!=n)throw new Error(a||"Assertion failed: "+r+" != "+n)},Rh}var Ih,zb;function Id(){if(zb)return Ih;zb=1;var t=Lr();function e(r){this.options=r,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=r.padding!==!1}return Ih=e,e.prototype._init=function(){},e.prototype.update=function(n){return n.length===0?[]:this.type==="decrypt"?this._updateDecrypt(n):this._updateEncrypt(n)},e.prototype._buffer=function(n,a){for(var i=Math.min(this.buffer.length-this.bufferOff,n.length-a),s=0;s<i;s++)this.buffer[this.bufferOff+s]=n[a+s];return this.bufferOff+=i,i},e.prototype._flushBuffer=function(n,a){return this._update(this.buffer,0,n,a),this.bufferOff=0,this.blockSize},e.prototype._updateEncrypt=function(n){var a=0,i=0,s=(this.bufferOff+n.length)/this.blockSize|0,o=new Array(s*this.blockSize);this.bufferOff!==0&&(a+=this._buffer(n,a),this.bufferOff===this.buffer.length&&(i+=this._flushBuffer(o,i)));for(var c=n.length-(n.length-a)%this.blockSize;a<c;a+=this.blockSize)this._update(n,a,o,i),i+=this.blockSize;for(;a<n.length;a++,this.bufferOff++)this.buffer[this.bufferOff]=n[a];return o},e.prototype._updateDecrypt=function(n){for(var a=0,i=0,s=Math.ceil((this.bufferOff+n.length)/this.blockSize)-1,o=new Array(s*this.blockSize);s>0;s--)a+=this._buffer(n,a),i+=this._flushBuffer(o,i);return a+=this._buffer(n,a),o},e.prototype.final=function(n){var a;n&&(a=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),a?a.concat(i):i},e.prototype._pad=function(n,a){if(a===0)return!1;for(;a<n.length;)n[a++]=0;return!0},e.prototype._finalEncrypt=function(){if(!this._pad(this.buffer,this.bufferOff))return[];var n=new Array(this.blockSize);return this._update(this.buffer,0,n,0),n},e.prototype._unpad=function(n){return n},e.prototype._finalDecrypt=function(){t.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var n=new Array(this.blockSize);return this._flushBuffer(n,0),this._unpad(n)},Ih}var Bh,Wb;function r3(){if(Wb)return Bh;Wb=1;var t=Lr(),e=Ye(),r=t3(),n=Id();function a(){this.tmp=new Array(2),this.keys=null}function i(o){n.call(this,o);var c=new a;this._desState=c,this.deriveKeys(c,o.key)}e(i,n),Bh=i,i.create=function(c){return new i(c)};var s=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return i.prototype.deriveKeys=function(c,u){c.keys=new Array(32),t.equal(u.length,this.blockSize,"Invalid key length");var f=r.readUInt32BE(u,0),l=r.readUInt32BE(u,4);r.pc1(f,l,c.tmp,0),f=c.tmp[0],l=c.tmp[1];for(var p=0;p<c.keys.length;p+=2){var b=s[p>>>1];f=r.r28shl(f,b),l=r.r28shl(l,b),r.pc2(f,l,c.keys,p)}},i.prototype._update=function(c,u,f,l){var p=this._desState,b=r.readUInt32BE(c,u),v=r.readUInt32BE(c,u+4);r.ip(b,v,p.tmp,0),b=p.tmp[0],v=p.tmp[1],this.type==="encrypt"?this._encrypt
23(p,b,v,p.tmp,0):this._decrypt(p,b,v,p.tmp,0),b=p.tmp[0],v=p.tmp[1],r.writeUInt32BE(f,b,l),r.writeUInt32BE(f,v,l+4)},i.prototype._pad=function(c,u){if(this.padding===!1)return!1;for(var f=c.length-u,l=u;l<c.length;l++)c[l]=f;return!0},i.prototype._unpad=function(c){if(this.padding===!1)return c;for(var u=c[c.length-1],f=c.length-u;f<c.length;f++)t.equal(c[f],u);return c.slice(0,c.length-u)},i.prototype._encrypt=function(c,u,f,l,p){for(var b=u,v=f,w=0;w<c.keys.length;w+=2){var I=c.keys[w],S=c.keys[w+1];r.expand(v,c.tmp,0),I^=c.tmp[0],S^=c.tmp[1];var T=r.substitute(I,S),C=r.permute(T),k=v;v=(b^C)>>>0,b=k}r.rip(v,b,l,p)},i.prototype._decrypt=function(c,u,f,l,p){for(var b=f,v=u,w=c.keys.length-2;w>=0;w-=2){var I=c.keys[w],S=c.keys[w+1];r.expand(b,c.tmp,0),I^=c.tmp[0],S^=c.tmp[1];var T=r.substitute(I,S),C=r.permute(T),k=b;b=(v^C)>>>0,v=k}r.rip(b,v,l,p)},Bh}var Th={},Zb;function lS(){if(Zb)return Th;Zb=1;var t=Lr(),e=Ye(),r={};function n(i){t.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var s=0;s<this.iv.length;s++)this.iv[s]=i[s]}function a(i){function s(f){i.call(this,f),this._cbcInit()}e(s,i);for(var o=Object.keys(r),c=0;c<o.length;c++){var u=o[c];s.prototype[u]=r[u]}return s.create=function(l){return new s(l)},s}return Th.instantiate=a,r._cbcInit=function(){var s=new n(this.options.iv);this._cbcState=s},r._update=function(s,o,c,u){var f=this._cbcState,l=this.constructor.super_.prototype,p=f.iv;if(this.type==="encrypt"){for(var b=0;b<this.blockSize;b++)p[b]^=s[o+b];l._update.call(this,p,0,c,u);for(var b=0;b<this.blockSize;b++)p[b]=c[u+b]}else{l._update.call(this,s,o,c,u);for(var b=0;b<this.blockSize;b++)c[u+b]^=p[b];for(var b=0;b<this.blockSize;b++)p[b]=s[o+b]}},Th}var Ph,Yb;function dS(){if(Yb)return Ph;Yb=1;var t=Lr(),e=Ye(),r=Id(),n=r3();function a(s,o){t.equal(o.length,24,"Invalid key length");var c=o.slice(0,8),u=o.slice(8,16),f=o.slice(16,24);s==="encrypt"?this.ciphers=[n.create({type:"encrypt",key:c}),n.create({type:"decrypt",key:u}),n.create({type:"encrypt",key:f})]:this.ciphers=[n.create({type:"decrypt",key:f}),n.create({type:"encrypt",key:u}),n.create({type:"decrypt",key:c})]}function i(s){r.call(this,s);var o=new a(this.type,this.options.key);this._edeState=o}return e(i,r),Ph=i,i.create=function(o){return new i(o)},i.prototype._update=function(o,c,u,f){var l=this._edeState;l.ciphers[0]._update(o,c,u,f),l.ciphers[1]._update(u,f,u,f),l.ciphers[2]._update(u,f,u,f)},i.prototype._pad=n.prototype._pad,i.prototype._unpad=n.prototype._unpad,Ph}var Xb;function pS(){return Xb||(Xb=1,zi.utils=t3(),zi.Cipher=Id(),zi.DES=r3(),zi.CBC=lS(),zi.EDE=dS()),zi}var Mh,Jb;function gS(){if(Jb)return Mh;Jb=1;var t=Ii(),e=pS(),r=Ye(),n=et().Buffer,a={"des-ede3-cbc":e.CBC.instantiate(e.EDE),"des-ede3":e.EDE,"des-ede-cbc":e.CBC.instantiate(e.EDE),"des-ede":e.EDE,"des-cbc":e.CBC.instantiate(e.DES),"des-ecb":e.DES};a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],Mh=i,r(i,t);function i(s){t.call(this);var o=s.mode.toLowerCase(),c=a[o],u;s.decrypt?u="decrypt":u="encrypt";var f=s.key;n.isBuffer(f)||(f=n.from(f)),(o==="des-ede"||o==="des-ede-cbc")&&(f=n.concat([f,f.slice(0,8)]));var l=s.iv;n.isBuffer(l)||(l=n.from(l)),this._des=c.create({key:f,iv:l,type:u})}return i.prototype._update=function(s){return n.from(this._des.update(s))},i.prototype._final=function(){return n.from(this._des.final())},Mh}var xr={},vo={},wo={},Qb;function bS(){return Qb||(Qb=1,wo.encrypt=function(t,e){return t._cipher.encryptBlock(e)},wo.decrypt=function(t,e){return t._cipher.decryptBlock(e)}),wo}var _o={},n3={},Lf={};Lf.byteLength=vS;Lf.toByteArray=_S;Lf.fromByteArray=xS;var tn=[],Br=[],mS=typeof Uint8Array<"u"?Uint8Array:Array,Oh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Pa=0,yS=Oh.length;Pa<yS;++Pa)tn[Pa]=Oh[Pa],Br[Oh.charCodeAt(Pa)]=Pa;Br[45]=62;Br[95]=63;function i3(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function vS(t){var e=i3(t),r=e[0],n=e[1];return(r+n)*3/4-n}function wS(t,e,r){return(e+r)*3/4-r}function _S(t){var e,r=i3(t),n=r[0],a=r[1],i=new mS(wS(t,n,a)),s=0,o=a>0?n-4:n,c;for(c=0;c<o;c+=4)e=Br[t.charCodeAt(c)]<<18|Br[t.charCodeAt(c+1)]<<12|Br[t.charCodeAt(c+2)]<<6|Br[t.charCodeAt(c+3)],i[s++]=e>>16&255,i[s++]=e>>8&255,i[s++]=e&255;return a===2&&(e=Br[t.charCodeAt(c)]<<2|Br[t.charCodeAt(c+1)]>>4,i[s++]=e&255),a===1&&(e=Br[t.charCodeAt(c)]<<10|Br[t.charCodeAt(c+1)]<<4|Br[t.charCodeAt(c+2)]>>2,i[s++]=e>>8&255,i[s++]=e&255),i}function ES(t){return tn[t>>18&63]+tn[t>>12&63]+tn[t>>6&63]+tn[t&63]}function SS(t,e,r){for(var n,a=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),a.push(ES(n));return a.join("")}function xS(t){for(var e,r=t.length,n=r%3,a=[],i=16383,s=0,o=r-n;s<o;s+=i)a.push(SS(t,s,s+i>o?o:s+i));return n===1?(e=t[r-1],a.push(tn[e>>2]+tn[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],a.push(tn[e>>10]+tn[e>>4&63]+tn[e<<2&63]+"=")),a.join("")}var Bd={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Bd.read=function(t,e,r,n,a){var i,s,o=a*8-n-1,c=(1<<o)-1,u=c>>1,f=-7,l=r?a-1:0,p=r?-1:1,b=t[e+l];for(l+=p,i=b&(1<<-f)-1,b>>=-f,f+=o;f>0;i=i*256+t[e+l],l+=p,f-=8);for(s=i&(1<<-f)-1,i>>=-f,f+=n;f>0;s=s*256+t[e+l],l+=p,f-=8);if(i===0)i=1-u;else{if(i===c)return s?NaN:(b?-1:1)*(1/0);s=s+Math.pow(2,n),i=i-u}return(b?-1:1)*s*Math.pow(2,i-n)};Bd.write=function(t,e,r,n,a,i){var s,o,c,u=i*8-a-1,f=(1<<u)-1,l=f>>1,p=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=n?0:i-1,v=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+l>=1?e+=p/c:e+=p*Math.pow(2,1-l),e*c>=2&&(s++,c/=2),s+l>=f?(o=0,s=f):s+l>=1?(o=(e*c-1)*Math.pow(2,a),s=s+l):(o=e*Math.pow(2,l-1)*Math.pow(2,a),s=0));a>=8;t[r+b]=o&255,b+=v,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;t[r+b]=s&255,b+=v,s/=256,u-=8);t[r+b-v]|=w*128};/*!
24 * The buffer module from node.js, for the browser.
25 *
26 * @author   Feross Aboukhadijeh <https://feross.org>
27 * @license  MIT
28 */(function(t){const e=Lf,r=Bd,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=f,t.SlowBuffer=$,t.INSPECT_MAX_BYTES=50;const a=2147483647;t.kMaxLength=a;const{Uint8Array:i,ArrayBuffer:s,SharedArrayBuffer:o}=globalThis;f.TYPED_ARRAY_SUPPORT=c(),!f.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 c(){try{const Z=new i(1),D={foo:function(){return 42}};return Object.setPrototypeOf(D,i.prototype),Object.setPrototypeOf(Z,D),Z.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function u(Z){if(Z>
vendor: 20,239 bytes, line 28
28a)throw new RangeError('The value "'+Z+'" is invalid for option "size"');const D=new i(Z);return Object.setPrototypeOf(D,f.prototype),D}function f(Z,D,F){if(typeof Z=="number"){if(typeof D=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(Z)}return l(Z,D,F)}f.poolSize=8192;function l(Z,D,F){if(typeof Z=="string")return w(Z,D);if(s.isView(Z))return S(Z);if(Z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z);if(Be(Z,s)||Z&&Be(Z.buffer,s)||typeof o<"u"&&(Be(Z,o)||Z&&Be(Z.buffer,o)))return T(Z,D,F);if(typeof Z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Q=Z.valueOf&&Z.valueOf();if(Q!=null&&Q!==Z)return f.from(Q,D,F);const se=C(Z);if(se)return se;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Z[Symbol.toPrimitive]=="function")return f.from(Z[Symbol.toPrimitive]("string"),D,F);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z)}f.from=function(Z,D,F){return l(Z,D,F)},Object.setPrototypeOf(f.prototype,i.prototype),Object.setPrototypeOf(f,i);function p(Z){if(typeof Z!="number")throw new TypeError('"size" argument must be of type number');if(Z<0)throw new RangeError('The value "'+Z+'" is invalid for option "size"')}function b(Z,D,F){return p(Z),Z<=0?u(Z):D!==void 0?typeof F=="string"?u(Z).fill(D,F):u(Z).fill(D):u(Z)}f.alloc=function(Z,D,F){return b(Z,D,F)};function v(Z){return p(Z),u(Z<0?0:k(Z)|0)}f.allocUnsafe=function(Z){return v(Z)},f.allocUnsafeSlow=function(Z){return v(Z)};function w(Z,D){if((typeof D!="string"||D==="")&&(D="utf8"),!f.isEncoding(D))throw new TypeError("Unknown encoding: "+D);const F=G(Z,D)|0;let Q=u(F);const se=Q.write(Z,D);return se!==F&&(Q=Q.slice(0,se)),Q}function I(Z){const D=Z.length<0?0:k(Z.length)|0,F=u(D);for(let Q=0;Q<D;Q+=1)F[Q]=Z[Q]&255;return F}function S(Z){if(Be(Z,i)){const D=new i(Z);return T(D.buffer,D.byteOffset,D.byteLength)}return I(Z)}function T(Z,D,F){if(D<0||Z.byteLength<D)throw new RangeError('"offset" is outside of buffer bounds');if(Z.byteLength<D+(F||0))throw new RangeError('"length" is outside of buffer bounds');let Q;return D===void 0&&F===void 0?Q=new i(Z):F===void 0?Q=new i(Z,D):Q=new i(Z,D,F),Object.setPrototypeOf(Q,f.prototype),Q}function C(Z){if(f.isBuffer(Z)){const D=k(Z.length)|0,F=u(D);return F.length===0||Z.copy(F,0,0,D),F}if(Z.length!==void 0)return typeof Z.length!="number"||Ue(Z.length)?u(0):I(Z);if(Z.type==="Buffer"&&Array.isArray(Z.data))return I(Z.data)}function k(Z){if(Z>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return Z|0}function $(Z){return+Z!=Z&&(Z=0),f.alloc(+Z)}f.isBuffer=function(D){return D!=null&&D._isBuffer===!0&&D!==f.prototype},f.compare=function(D,F){if(Be(D,i)&&(D=f.from(D,D.offset,D.byteLength)),Be(F,i)&&(F=f.from(F,F.offset,F.byteLength)),!f.isBuffer(D)||!f.isBuffer(F))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(D===F)return 0;let Q=D.length,se=F.length;for(let ce=0,he=Math.min(Q,se);ce<he;++ce)if(D[ce]!==F[ce]){Q=D[ce],se=F[ce];break}return Q<se?-1:se<Q?1:0},f.isEncoding=function(D){switch(String(D).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}},f.concat=function(D,F){if(!Array.isArray(D))throw new TypeError('"list" argument must be an Array of Buffers');if(D.length===0)return f.alloc(0);let Q;if(F===void 0)for(F=0,Q=0;Q<D.length;++Q)F+=D[Q].length;const se=f.allocUnsafe(F);let ce=0;for(Q=0;Q<D.length;++Q){let he=D[Q];if(Be(he,i))ce+he.length>se.length?(f.isBuffer(he)||(he=f.from(he)),he.copy(se,ce)):i.prototype.set.call(se,he,ce);else if(f.isBuffer(he))he.copy(se,ce);else throw new TypeError('"list" argument must be an Array of Buffers');ce+=he.length}return se};function G(Z,D){if(f.isBuffer(Z))return Z.length;if(s.isView(Z)||Be(Z,s))return Z.byteLength;if(typeof Z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Z);const F=Z.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&F===0)return 0;let se=!1;for(;;)switch(D){case"ascii":case"latin1":case"binary":return F;case"utf8":case"utf-8":return Pe(Z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F*2;case"hex":return F>>>1;case"base64":return Ee(Z).length;default:if(se)return Q?-1:Pe(Z).length;D=(""+D).toLowerCase(),se=!0}}f.byteLength=G;function B(Z,D,F){let Q=!1;if((D===void 0||D<0)&&(D=0),D>this.length||((F===void 0||F>this.length)&&(F=this.length),F<=0)||(F>>>=0,D>>>=0,F<=D))return"";for(Z||(Z="utf8");;)switch(Z){case"hex":return O(this,D,F);case"utf8":case"utf-8":return _(this,D,F);case"ascii":return E(this,D,F);case"latin1":case"binary":return L(this,D,F);case"base64":return y(this,D,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,D,F);default:if(Q)throw new TypeError("Unknown encoding: "+Z);Z=(Z+"").toLowerCase(),Q=!0}}f.prototype._isBuffer=!0;function M(Z,D,F){const Q=Z[D];Z[D]=Z[F],Z[F]=Q}f.prototype.swap16=function(){const D=this.length;if(D%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let F=0;F<D;F+=2)M(this,F,F+1);return this},f.prototype.swap32=function(){const D=this.length;if(D%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let F=0;F<D;F+=4)M(this,F,F+3),M(this,F+1,F+2);return this},f.prototype.swap64=function(){const D=this.length;if(D%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let F=0;F<D;F+=8)M(this,F,F+7),M(this,F+1,F+6),M(this,F+2,F+5),M(this,F+3,F+4);return this},f.prototype.toString=function(){const D=this.length;return D===0?"":arguments.length===0?_(this,0,D):B.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(D){if(!f.isBuffer(D))throw new TypeError("Argument must be a Buffer");return this===D?!0:f.compare(this,D)===0},f.prototype.inspect=function(){let D="";const F=t.INSPECT_MAX_BYTES;return D=this.toString("hex",0,F).replace(/(.{2})/g,"$1 ").trim(),this.length>F&&(D+=" ... "),"<Buffer "+D+">"},n&&(f.prototype[n]=f.prototype.inspect),f.prototype.compare=function(D,F,Q,se,ce){if(Be(D,i)&&(D=f.from(D,D.offset,D.byteLength)),!f.isBuffer(D))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof D);if(F===void 0&&(F=0),Q===void 0&&(Q=D?D.length:0),se===void 0&&(se=0),ce===void 0&&(ce=this.length),F<0||Q>D.length||se<0||ce>this.length)throw new RangeError("out of range index");if(se>=ce&&F>=Q)return 0;if(se>=ce)return-1;if(F>=Q)return 1;if(F>>>=0,Q>>>=0,se>>>=0,ce>>>=0,this===D)return 0;let he=ce-se,Oe=Q-F;const $e=Math.min(he,Oe),Te=this.slice(se,ce),Ve=D.slice(F,Q);for(let De=0;De<$e;++De)if(Te[De]!==Ve[De]){he=Te[De],Oe=Ve[De];break}return he<Oe?-1:Oe<he?1:0};function N(Z,D,F,Q,se){if(Z.length===0)return-1;if(typeof F=="string"?(Q=F,F=0):F>2147483647?F=2147483647:F<-2147483648&&(F=-2147483648),F=+F,Ue(F)&&(F=se?0:Z.length-1),F<0&&(F=Z.length+F),F>=Z.length){if(se)return-1;F=Z.length-1}else if(F<0)if(se)F=0;else return-1;if(typeof D=="string"&&(D=f.from(D,Q)),f.isBuffer(D))return D.length===0?-1:P(Z,D,F,Q,se);if(typeof D=="number")return D=D&255,typeof i.prototype.indexOf=="function"?se?i.prototype.indexOf.call(Z,D,F):i.prototype.lastIndexOf.call(Z,D,F):P(Z,[D],F,Q,se);throw new TypeError("val must be string, number or Buffer")}function P(Z,D,F,Q,se){let ce=1,he=Z.length,Oe=D.length;if(Q!==void 0&&(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le")){if(Z.length<2||D.length<2)return-1;ce=2,he/=2,Oe/=2,F/=2}function $e(Ve,De){return ce===1?Ve[De]:Ve.readUInt16BE(De*ce)}let Te;if(se){let Ve=-1;for(Te=F;Te<he;Te++)if($e(Z,Te)===$e(D,Ve===-1?0:Te-Ve)){if(Ve===-1&&(Ve=Te),Te-Ve+1===Oe)return Ve*ce}else Ve!==-1&&(Te-=Te-Ve),Ve=-1}else for(F+Oe>he&&(F=he-Oe),Te=F;Te>=0;Te--){let Ve=!0;for(let De=0;De<Oe;De++)if($e(Z,Te+De)!==$e(D,De)){Ve=!1;break}if(Ve)return Te}return-1}f.prototype.includes=function(D,F,Q){return this.indexOf(D,F,Q)!==-1},f.prototype.indexOf=function(D,F,Q){return N(this,D,F,Q,!0)},f.prototype.lastIndexOf=function(D,F,Q){return N(this,D,F,Q,!1)};function x(Z,D,F,Q){F=Number(F)||0;const se=Z.length-F;Q?(Q=Number(Q),Q>se&&(Q=se)):Q=se;const ce=D.length;Q>ce/2&&(Q=ce/2);let he;for(he=0;he<Q;++he){const Oe=parseInt(D.substr(he*2,2),16);if(Ue(Oe))return he;Z[F+he]=Oe}return he}function d(Z,D,F,Q){return ve(Pe(D,Z.length-F),Z,F,Q)}function m(Z,D,F,Q){return ve(ye(D),Z,F,Q)}function h(Z,D,F,Q){return ve(Ee(D),Z,F,Q)}function g(Z,D,F,Q){return ve(we(D,Z.length-F),Z,F,Q)}f.prototype.write=function(D,F,Q,se){if(F===void 0)se="utf8",Q=this.length,F=0;else if(Q===void 0&&typeof F=="string")se=F,Q=this.length,F=0;else if(isFinite(F))F=F>>>0,isFinite(Q)?(Q=Q>>>0,se===void 0&&(se="utf8")):(se=Q,Q=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ce=this.length-F;if((Q===void 0||Q>ce)&&(Q=ce),D.length>0&&(Q<0||F<0)||F>this.length)throw new RangeError("Attempt to write outside buffer bounds");se||(se="utf8");let he=!1;for(;;)switch(se){case"hex":return x(this,D,F,Q);case"utf8":case"utf-8":return d(this,D,F,Q);case"ascii":case"latin1":case"binary":return m(this,D,F,Q);case"base64":return h(this,D,F,Q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,D,F,Q);default:if(he)throw new TypeError("Unknown encoding: "+se);se=(""+se).toLowerCase(),he=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y(Z,D,F){return D===0&&F===Z.length?e.fromByteArray(Z):e.fromByteArray(Z.slice(D,F))}function _(Z,D,F){F=Math.min(Z.length,F);const Q=[];let se=D;for(;se<F;){const ce=Z[se];let he=null,Oe=ce>239?4:ce>223?3:ce>191?2:1;if(se+Oe<=F){let $e,Te,Ve,De;switch(Oe){case 1:ce<128&&(he=ce);break;case 2:$e=Z[se+1],($e&192)===128&&(De=(ce&31)<<6|$e&63,De>127&&(he=De));break;case 3:$e=Z[se+1],Te=Z[se+2],($e&192)===128&&(Te&192)===128&&(De=(ce&15)<<12|($e&63)<<6|Te&63,De>2047&&(De<55296||De>57343)&&(he=De));break;case 4:$e=Z[se+1],Te=Z[se+2],Ve=Z[se+3],($e&192)===128&&(Te&192)===128&&(Ve&192)===128&&(De=(ce&15)<<18|($e&63)<<12|(Te&63)<<6|Ve&63,De>65535&&De<1114112&&(he=De))}}he===null?(he=65533,Oe=1):he>65535&&(he-=65536,Q.push(he>>>10&1023|55296),he=56320|he&1023),Q.push(he),se+=Oe}return A(Q)}const R=4096;function A(Z){const D=Z.length;if(D<=R)return String.fromCharCode.apply(String,Z);let F="",Q=0;for(;Q<D;)F+=String.fromCharCode.apply(String,Z.slice(Q,Q+=R));return F}function E(Z,D,F){let Q="";F=Math.min(Z.length,F);for(let se=D;se<F;++se)Q+=String.fromCharCode(Z[se]&127);return Q}function L(Z,D,F){let Q="";F=Math.min(Z.length,F);for(let se=D;se<F;++se)Q+=String.fromCharCode(Z[se]);return Q}function O(Z,D,F){const Q=Z.length;(!D||D<0)&&(D=0),(!F||F<0||F>Q)&&(F=Q);let se="";for(let ce=D;ce<F;++ce)se+=xe[Z[ce]];return se}function U(Z,D,F){const Q=Z.slice(D,F);let se="";for(let ce=0;ce<Q.length-1;ce+=2)se+=String.fromCharCode(Q[ce]+Q[ce+1]*256);return se}f.prototype.slice=function(D,F){const Q=this.length;D=~~D,F=F===void 0?Q:~~F,D<0?(D+=Q,D<0&&(D=0)):D>Q&&(D=Q),F<0?(F+=Q,F<0&&(F=0)):F>Q&&(F=Q),F<D&&(F=D);const se=this.subarray(D,F);return Object.setPrototypeOf(se,f.prototype),se};function X(Z,D,F){if(Z%1!==0||Z<0)throw new RangeError("offset is not uint");if(Z+D>F)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(D,F,Q){D=D>>>0,F=F>>>0,Q||X(D,F,this.length);let se=this[D],ce=1,he=0;for(;++he<F&&(ce*=256);)se+=this[D+he]*ce;return se},f.prototype.readUintBE=f.prototype.readUIntBE=function(D,F,Q){D=D>>>0,F=F>>>0,Q||X(D,F,this.length);let se=this[D+--F],ce=1;for(;F>0&&(ce*=256);)se+=this[D+--F]*ce;return se},f.prototype.readUint8=f.prototype.readUInt8=function(D,F){return D=D>>>0,F||X(D,1,this.length),this[D]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(D,F){return D=D>>>0,F||X(D,2,this.length),this[D]|this[D+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(D,F){return D=D>>>0,F||X(D,2,this.length),this[D]<<8|this[D+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(D,F){return D=D>>>0,F||X(D,4,this.length),(this[D]|this[D+1]<<8|this[D+2]<<16)+this[D+3]*16777216},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(D,F){return D=D>>>0,F||X(D,4,this.length),this[D]*16777216+(this[D+1]<<16|this[D+2]<<8|this[D+3])},f.prototype.readBigUInt64LE=Ne(function(D){D=D>>>0,be(D,"offset");const F=this[D],Q=this[D+7];(F===void 0||Q===void 0)&&_e(D,this.length-8);const se=F+this[++D]*2**8+this[++D]*2**16+this[++D]*2**24,ce=this[++D]+this[++D]*2**8+this[++D]*2**16+Q*2**24;return BigInt(se)+(BigInt(ce)<<BigInt(32))}),f.prototype.readBigUInt64BE=Ne(function(D){D=D>>>0,be(D,"offset");const F=this[D],Q=this[D+7];(F===void 0||Q===void 0)&&_e(D,this.length-8);const se=F*2**24+this[++D]*2**16+this[++D]*2**8+this[++D],ce=this[++D]*2**24+this[++D]*2**16+this[++D]*2**8+Q;return(BigInt(se)<<BigInt(32))+BigInt(ce)}),f.prototype.readIntLE=function(D,F,Q){D=D>>>0,F=F>>>0,Q||X(D,F,this.length);let se=this[D],ce=1,he=0;for(;++he<F&&(ce*=256);)se+=this[D+he]*ce;return ce*=128,se>=ce&&(se-=Math.pow(2,8*F)),se},f.prototype.readIntBE=function(D,F,Q){D=D>>>0,F=F>>>0,Q||X(D,F,this.length);let se=F,ce=1,he=this[D+--se];for(;se>0&&(ce*=256);)he+=this[D+--se]*ce;return ce*=128,he>=ce&&(he-=Math.pow(2,8*F)),he},f.prototype.readInt8=function(D,F){return D=D>>>0,F||X(D,1,this.length),this[D]&128?(255-this[D]+1)*-1:this[D]},f.prototype.readInt16LE=function(D,F){D=D>>>0,F||X(D,2,this.length);const Q=this[D]|this[D+1]<<8;return Q&32768?Q|4294901760:Q},f.prototype.readInt16BE=function(D,F){D=D>>>0,F||X(D,2,this.length);const Q=this[D+1]|this[D]<<8;return Q&32768?Q|4294901760:Q},f.prototype.readInt32LE=function(D,F){return D=D>>>0,F||X(D,4,this.length),this[D]|this[D+1]<<8|this[D+2]<<16|this[D+3]<<24},f.prototype.readInt32BE=function(D,F){return D=D>>>0,F||X(D,4,this.length),this[D]<<24|this[D+1]<<16|this[D+2]<<8|this[D+3]},f.prototype.readBigInt64LE=Ne(function(D){D=D>>>0,be(D,"offset");const F=this[D],Q=this[D+7];(F===void 0||Q===void 0)&&_e(D,this.length-8);const se=this[D+4]+this[D+5]*2**8+this[D+6]*2**16+(Q<<24);return(BigInt(se)<<BigInt(32))+BigInt(F+this[++D]*2**8+this[++D]*2**16+this[++D]*2**24)}),f.prototype.readBigInt64BE=Ne(function(D){D=D>>>0,be(D,"offset");const F=this[D],Q=this[D+7];(F===void 0||Q===void 0)&&_e(D,this.length-8);const se=(F<<24)+this[++D]*2**16+this[++D]*2**8+this[++D];return(BigInt(se)<<BigInt(32))+BigInt(this[++D]*2**24+this[++D]*2**16+this[++D]*2**8+Q)}),f.prototype.readFloatLE=function(D,F){return D=D>>>0,F||X(D,4,this.length),r.read(this,D,!0,23,4)},f.prototype.readFloatBE=function(D,F){return D=D>>>0,F||X(D,4,this.length),r.read(this,D,!1,23,4)},f.prototype.readDoubleLE=function(D,F){return D=D>>>0,F||X(D,8,this.length),r.read(this,D,!0,52,8)},f.prototype.readDoubleBE=function(D,F){return D=D>>>0,F||X(D,8,this.length),r.read(this,D,!1,52,8)};function J(Z,D,F,Q,se,ce){if(!f.isBuffer(Z))throw new TypeError('"buffer" argument must be a Buffer instance');if(D>se||D<ce)throw new RangeError('"value" argument is out of bounds');if(F+Q>Z.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(D,F,Q,se){if(D=+D,F=F>>>0,Q=Q>>>0,!se){const Oe=Math.pow(2,8*Q)-1;J(this,D,F,Q,Oe,0)}let ce=1,he=0;for(this[F]=D&255;++he<Q&&(ce*=256);)this[F+he]=D/ce&255;return F+Q},f.prototype.writeUintBE=f.prototype.writeUIntBE=function(D,F,Q,se){if(D=+D,F=F>>>0,Q=Q>>>0,!se){const Oe=Math.pow(2,8*Q)-1;J(this,D,F,Q,Oe,0)}let ce=Q-1,he=1;for(this[F+ce]=D&255;--ce>=0&&(he*=256);)this[F+ce]=D/he&255;return F+Q},f.prototype.writeUint8=f.prototype.writeUInt8=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,1,255,0),this[F]=D&255,F+1},f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,2,65535,0),this[F]=D&255,this[F+1]=D>>>8,F+2},f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,2,65535,0),this[F]=D>>>8,this[F+1]=D&255,F+2},f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,4,4294967295,0),this[F+3]=D>>>24,this[F+2]=D>>>16,this[F+1]=D>>>8,this[F]=D&255,F+4},f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,4,4294967295,0),this[F]=D>>>24,this[F+1]=D>>>16,this[F+2]=D>>>8,this[F+3]=D&255,F+4};function j(Z,D,F,Q,se){ge(D,Q,se,Z,F,7);let ce=Number(D&BigInt(4294967295));Z[F++]=ce,ce=ce>>8,Z[F++]=ce,ce=ce>>8,Z[F++]=ce,ce=ce>>8,Z[F++]=ce;let he=Number(D>>BigInt(32)&BigInt(4294967295));return Z[F++]=he,he=he>>8,Z[F++]=he,he=he>>8,Z[F++]=he,he=he>>8,Z[F++]=he,F}function q(Z,D,F,Q,se){ge(D,Q,se,Z,F,7);let ce=Number(D&BigInt(4294967295));Z[F+7]=ce,ce=ce>>8,Z[F+6]=ce,ce=ce>>8,Z[F+5]=ce,ce=ce>>8,Z[F+4]=ce;let he=Number(D>>BigInt(32)&BigInt(4294967295));return Z[F+3]=he,he=he>>8,Z[F+2]=he,he=he>>8,Z[F+1]=he,he=he>>8,Z[F]=he,F+8}f.prototype.writeBigUInt64LE=Ne(function(D,F=0){return j(this,D,F,BigInt(0),BigInt("0xffffffffffffffff"))}),f.prototype.writeBigUInt64BE=Ne(function(D,F=0){return q(this,D,F,BigInt(0),BigInt("0xffffffffffffffff"))}),f.prototype.writeIntLE=function(D,F,Q,se){if(D=+D,F=F>>>0,!se){const $e=Math.pow(2,8*Q-1);J(this,D,F,Q,$e-1,-$e)}let ce=0,he=1,Oe=0;for(this[F]=D&255;++ce<Q&&(he*=256);)D<0&&Oe===0&&this[F+ce-1]!==0&&(Oe=1),this[F+ce]=(D/he>>0)-Oe&255;return F+Q},f.prototype.writeIntBE=function(D,F,Q,se){if(D=+D,F=F>>>0,!se){const $e=Math.pow(2,8*Q-1);J(this,D,F,Q,$e-1,-$e)}let ce=Q-1,he=1,Oe=0;for(this[F+ce]=D&255;--ce>=0&&(he*=256);)D<0&&Oe===0&&this[F+ce+1]!==0&&(Oe=1),this[F+ce]=(D/he>>0)-Oe&255;return F+Q},f.prototype.writeInt8=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,1,127,-128),D<0&&(D=255+D+1),this[F]=D&255,F+1},f.prototype.writeInt16LE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,2,32767,-32768),this[F]=D&255,this[F+1]=D>>>8,F+2},f.prototype.writeInt16BE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,2,32767,-32768),this[F]=D>>>8,this[F+1]=D&255,F+2},f.prototype.writeInt32LE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,4,2147483647,-2147483648),this[F]=D&255,this[F+1]=D>>>8,this[F+2]=D>>>16,this[F+3]=D>>>24,F+4},f.prototype.writeInt32BE=function(D,F,Q){return D=+D,F=F>>>0,Q||J(this,D,F,4,2147483647,-2147483648),D<0&&(D=4294967295+D+1),this[F]=D>>>24,this[F+1]=D>>>16,this[F+2]=D>>>8,this[F+3]=D&255,F+4},f.prototype.writeBigInt64LE=Ne(function(D,F=0){return j(this,D,F,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),f.prototype.writeBigInt64BE=Ne(function(D,F=0){return q(this,D,F,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(Z,D,F,Q,se,ce){if(F+Q>Z.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("Index out of range")}function ee(Z,D,F,Q,se){return D=+D,F=F>>>0,se||V(Z,D,F,4),r.write(Z,D,F,Q,23,4),F+4}f.prototype.writeFloatLE=function(D,F,Q){return ee(this,D,F,!0,Q)},f.prototype.writeFloatBE=function(D,F,Q){return ee(this,D,F,!1,Q)};function ne(Z,D,F,Q,se){return D=+D,F=F>>>0,se||V(Z,D,F,8),r.write(Z,D,F,Q,52,8),F+8}f.prototype.writeDoubleLE=function(D,F,Q){return ne(this,D,F,!0,Q)},f.prototype.writeDoubleBE=function(D,F,Q){return ne(this,D,F,!1,Q)},f.prototype.copy=function(D,F,Q,se){if(!f.isBuffer(D))throw new TypeError("argument should be a Buffer");if(Q||(Q=0),!se&&se!==0&&(se=this.length),F>=D.length&&(F=D.length),F||(F=0),se>0&&se<Q&&(se=Q),se===Q||D.length===0||this.length===0)return 0;if(F<0)throw new RangeError("targetStart out of bounds");if(Q<0||Q>=this.length)throw new RangeError("Index out of range");if(se<0)throw new RangeError("sourceEnd out of bounds");se>this.length&&(se=this.length),D.length-F<se-Q&&(se=D.length-F+Q);const ce=se-Q;return this===D&&typeof i.prototype.copyWithin=="function"?this.copyWithin(F,Q,se):i.prototype.set.call(D,this.subarray(Q,se),F),ce}
vendor: 3,048 bytes, line 28
28,f.prototype.fill=function(D,F,Q,se){if(typeof D=="string"){if(typeof F=="string"?(se=F,F=0,Q=this.length):typeof Q=="string"&&(se=Q,Q=this.length),se!==void 0&&typeof se!="string")throw new TypeError("encoding must be a string");if(typeof se=="string"&&!f.isEncoding(se))throw new TypeError("Unknown encoding: "+se);if(D.length===1){const he=D.charCodeAt(0);(se==="utf8"&&he<128||se==="latin1")&&(D=he)}}else typeof D=="number"?D=D&255:typeof D=="boolean"&&(D=Number(D));if(F<0||this.length<F||this.length<Q)throw new RangeError("Out of range index");if(Q<=F)return this;F=F>>>0,Q=Q===void 0?this.length:Q>>>0,D||(D=0);let ce;if(typeof D=="number")for(ce=F;ce<Q;++ce)this[ce]=D;else{const he=f.isBuffer(D)?D:f.from(D,se),Oe=he.length;if(Oe===0)throw new TypeError('The value "'+D+'" is invalid for argument "value"');for(ce=0;ce<Q-F;++ce)this[ce+F]=he[ce%Oe]}return this};const W={};function z(Z,D,F){W[Z]=class extends F{constructor(){super(),Object.defineProperty(this,"message",{value:D.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Z}]`,this.stack,delete this.name}get code(){return Z}set code(se){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:se,writable:!0})}toString(){return`${this.name} [${Z}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(Z){return Z?`${Z} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(Z,D){return`The "${Z}" argument must be of type number. Received type ${typeof D}`},TypeError),z("ERR_OUT_OF_RANGE",function(Z,D,F){let Q=`The value of "${Z}" is out of range.`,se=F;return Number.isInteger(F)&&Math.abs(F)>2**32?se=ae(String(F)):typeof F=="bigint"&&(se=String(F),(F>BigInt(2)**BigInt(32)||F<-(BigInt(2)**BigInt(32)))&&(se=ae(se)),se+="n"),Q+=` It must be ${D}. Received ${se}`,Q},RangeError);function ae(Z){let D="",F=Z.length;const Q=Z[0]==="-"?1:0;for(;F>=Q+4;F-=3)D=`_${Z.slice(F-3,F)}${D}`;return`${Z.slice(0,F)}${D}`}function pe(Z,D,F){be(D,"offset"),(Z[D]===void 0||Z[D+F]===void 0)&&_e(D,Z.length-(F+1))}function ge(Z,D,F,Q,se,ce){if(Z>F||Z<D){const he=typeof D=="bigint"?"n":"";let Oe;throw D===0||D===BigInt(0)?Oe=`>= 0${he} and < 2${he} ** ${(ce+1)*8}${he}`:Oe=`>= -(2${he} ** ${(ce+1)*8-1}${he}) and < 2 ** ${(ce+1)*8-1}${he}`,new W.ERR_OUT_OF_RANGE("value",Oe,Z)}pe(Q,se,ce)}function be(Z,D){if(typeof Z!="number")throw new W.ERR_INVALID_ARG_TYPE(D,"number",Z)}function _e(Z,D,F){throw Math.floor(Z)!==Z?(be(Z,F),new W.ERR_OUT_OF_RANGE("offset","an integer",Z)):D<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${D}`,Z)}const Ie=/[^+/0-9A-Za-z-_]/g;function de(Z){if(Z=Z.split("=")[0],Z=Z.trim().replace(Ie,""),Z.length<2)return"";for(;Z.length%4!==0;)Z=Z+"=";return Z}function Pe(Z,D){D=D||1/0;let F;const Q=Z.length;let se=null;const ce=[];for(let he=0;he<Q;++he){if(F=Z.charCodeAt(he),F>55295&&F<57344){if(!se){if(F>56319){(D-=3)>-1&&ce.push(239,191,189);continue}else if(he+1===Q){(D-=3)>-1&&ce.push(239,191,189);continue}
28se=F;continue}if(F<56320){(D-=3)>-1&&ce.push(239,191,189),se=F;continue}F=(se-55296<<10|F-56320)+65536}else se&&(D-=3)>-1&&ce.push(239,191,189);if(se=null,F<128){if((D-=1)<0)break;ce.push(F)}else if(F<2048){if((D-=2)<0)break;ce.push(F>>6|192,F&63|128)}else if(F<65536){if((D-=3)<0)break;ce.push(F>>12|224,F>>6&63|128,F&63|128)}else if(F<1114112){if((D-=4)<0)break;ce.push(F>>18|240,F>>12&63|128,F>>6&63|128,F&63|128)}else throw new Error("Invalid code point")}return ce}function ye(Z){const D=[];for(let F=0;F<Z.length;++F)D.push(Z.charCodeAt(F)&255);return D}function we(Z,D){let F,Q,se;const ce=[];for(let he=0;he<Z.length&&!((D-=2)<0);++he)F=Z.charCodeAt(he),Q=F>>8,se=F%256,ce.push(se),ce.push(Q);return ce}function Ee(Z){return e.toByteArray(de(Z))}function ve(Z,D,F,Q){let se;for(se=0;se<Q&&!(se+F>=D.length||se>=Z.length);++se)D[se+F]=Z[se];return se}function Be(Z,D){return Z instanceof D||Z!=null&&Z.constructor!=null&&Z.constructor.name!=null&&Z.constructor.name===D.name}function Ue(Z){return Z!==Z}const xe=(function(){const Z="0123456789abcdef",D=new Array(256);for(let F=0;F<16;++F){const Q=F*16;for(let se=0;se<16;++se)D[Q+se]=Z[F]+Z[se]}return D})();function Ne(Z){return typeof BigInt>"u"?Ke:Z}function Ke(){throw new Error("BigInt not supported")}})(n3);const Fe=n3.Buffer;var Lh,em;function Ys(){return em||(em=1,Lh=function(e,r){for(var n=Math.min(e.length,r.length),a=new Fe(n),i=0;i<n;++i)a[i]=e[i]^r[i];return a}),Lh}var tm;function AS(){if(tm)return _o;tm=1;var t=Ys();return _o.encrypt=function(e,r){var n=t(r,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},_o.decrypt=function(e,r){var n=e._prev;e._prev=r;var a=e._cipher.decryptBlock(r);return t(a,n)},_o}var Nh={},rm;function RS(){if(rm)return Nh;rm=1;var t=et().Buffer,e=Ys();function r(n,a,i){var s=a.length,o=e(a,n._cache);return n._cache=n._cache.slice(s),n._prev=t.concat([n._prev,i?a:o]),o}return Nh.encrypt=function(n,a,i){for(var s=t.allocUnsafe(0),o;a.length;)if(n._cache.length===0&&(n._cache=n._cipher.encryptBlock(n._prev),n._prev=t.allocUnsafe(0)),n._cache.length<=a.length)o=n._cache.length,s=t.concat([s,r(n,a.slice(0,o),i)]),a=a.slice(o);else{s=t.concat([s,r(n,a,i)]);break}return s},Nh}var kh={},nm;function IS(){if(nm)return kh;nm=1;var t=et().Buffer;function e(r,n,a){var i=r._cipher.encryptBlock(r._prev),s=i[0]^n;return r._prev=t.concat([r._prev.slice(1),t.from([a?n:s])]),s}return kh.encrypt=function(r,n,a){for(var i=n.length,s=t.allocUnsafe(i),o=-1;++o<i;)s[o]=e(r,n[o],a);return s},kh}var Ch={},im;function BS(){if(im)return Ch;im=1;var t=et().Buffer;function e(n,a,i){for(var s,o=-1,c=8,u=0,f,l;++o<c;)s=n._cipher.encryptBlock(n._prev),f=a&1<<7-o?128:0,l=s[0]^f,u+=(l&128)>>o%8,n._prev=r(n._prev,i?f:l);return u}function r(n,a){var i=n.length,s=-1,o=t.allocUnsafe(n.length);for(n=t.concat([n,t.from([a])]);++s<i;)o[s]=n[s]<<1|n[s+1]>>7;return o}return Ch.encrypt=function(n,a,i){for(var s=a.length,o=t.allocUnsafe(s),c=-1;++c<s;)o[c]=e(n,a[c],i);return o},Ch}var Uh={},am;function TS(){if(am)return Uh;am=1;var t=Ys();function e(r){return r._prev=r._cipher.encryptBlock(r._prev),r._prev}return Uh.encrypt=function(r,n){for(;r._cache.length<n.length;)r._cache=Fe.concat([r._cache,e(r)]);var a=r._cache.slice(0,n.length);return r._cache=r._cache.slice(n.length),t(n,a)},Uh}var Dh={},Hh,sm;function a3(){if(sm)return Hh;sm=1;function t(e){for(var r=e.length,n;r--;)if(n=e.readUInt8(r),n===255)e.writeUInt8(0,r);else{n++,e.writeUInt8(n,r);break}}return Hh=t,Hh}var om;function fm(){if(om)return Dh;om=1;var t=Ys(),e=et().Buffer,r=a3();function n(i){var s=i._cipher.encryptBlockRaw(i._prev);return r(i._prev),s}var a=16;return Dh.encrypt=function(i,s){var o=Math.ceil(s.length/a),c=i._cache.length;i._cache=e.concat([i._cache,e.allocUnsafe(o*a)]);for(var u=0;u<o;u++){var f=n(i),l=c+u*a;i._cache.writeUInt32BE(f[0],l+0),i._cache.writeUInt32BE(f[1],l+4),i._cache.writeUInt32BE(f[2],l+8),i._cache.writeUInt32BE(f[3],l+12)}var p=i._cache.slice(0,s.length);return i._cache=i._cache.slice(s.length),t(s,p)},Dh}const PS={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},MS={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},OS={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},s3={"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:PS,aes192:MS,aes256:OS,"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 Fh,cm;function Td(){if(cm)return Fh;cm=1;var t={ECB:bS(),CBC:AS(),CFB:RS(),CFB8:IS(),CFB1:BS(),OFB:TS(),CTR:fm(),GCM:fm()},e=s3;for(var r in e)e[r].module=t[e[r].mode];return Fh=e,Fh}var qh={},um;function Nf(){if(um)return qh;um=1;var t=et().Buffer;function e(o){t.isBuffer(o)||(o=t.from(o));for(var c=o.length/4|0,u=new Array(c),f=0;f<c;f++)u[f]=o.readUInt32BE(f*4);return u}function r(o){for(var c=0;c<o.length;o++)o[c]=0}
28function n(o,c,u,f,l){for(var p=u[0],b=u[1],v=u[2],w=u[3],I=o[0]^c[0],S=o[1]^c[1],T=o[2]^c[2],C=o[3]^c[3],k,$,G,B,M=4,N=1;N<l;N++)k=p[I>>>24]^b[S>>>16&255]^v[T>>>8&255]^w[C&255]^c[M++],$=p[S>>>24]^b[T>>>16&255]^v[C>>>8&255]^w[I&255]^c[M++],G=p[T>>>24]^b[C>>>16&255]^v[I>>>8&255]^w[S&255]^c[M++],B=p[C>>>24]^b[I>>>16&255]^v[S>>>8&255]^w[T&255]^c[M++],I=k,S=$,T=G,C=B;return k=(f[I>>>24]<<24|f[S>>>16&255]<<16|f[T>>>8&255]<<8|f[C&255])^c[M++],$=(f[S>>>24]<<24|f[T>>>16&255]<<16|f[C>>>8&255]<<8|f[I&255])^c[M++],G=(f[T>>>24]<<24|f[C>>>16&255]<<16|f[I>>>8&255]<<8|f[S&255])^c[M++],B=(f[C>>>24]<<24|f[I>>>16&255]<<16|f[S>>>8&255]<<8|f[T&255])^c[M++],k=k>>>0,$=$>>>0,G=G>>>0,B=B>>>0,[k,$,G,B]}var a=[0,1,2,4,8,16,32,64,128,27,54],i=(function(){for(var o=new Array(256),c=0;c<256;c++)c<128?o[c]=c<<1:o[c]=c<<1^283;for(var u=[],f=[],l=[[],[],[],[]],p=[[],[],[],[]],b=0,v=0,w=0;w<256;++w){var I=v^v<<1^v<<2^v<<3^v<<4;I=I>>>8^I&255^99,u[b]=I,f[I]=b;var S=o[b],T=o[S],C=o[T],k=o[I]*257^I*16843008;l[0][b]=k<<24|k>>>8,l[1][b]=k<<16|k>>>16,l[2][b]=k<<8|k>>>24,l[3][b]=k,k=C*16843009^T*65537^S*257^b*16843008,p[0][I]=k<<24|k>>>8,p[1][I]=k<<16|k>>>16,p[2][I]=k<<8|k>>>24,p[3][I]=k,b===0?b=v=1:(b=S^o[o[o[C^S]]],v^=o[o[v]])}return{SBOX:u,INV_SBOX:f,SUB_MIX:l,INV_SUB_MIX:p}})();function s(o){this._key=e(o),this._reset()}return s.blockSize=16,s.keySize=256/8,s.prototype.blockSize=s.blockSize,s.prototype.keySize=s.keySize,s.prototype._reset=function(){for(var o=this._key,c=o.length,u=c+6,f=(u+1)*4,l=[],p=0;p<c;p++)l[p]=o[p];for(p=c;p<f;p++){var b=l[p-1];p%c===0?(b=b<<8|b>>>24,b=i.SBOX[b>>>24]<<24|i.SBOX[b>>>16&255]<<16|i.SBOX[b>>>8&255]<<8|i.SBOX[b&255],b^=a[p/c|0]<<24):c>6&&p%c===4&&(b=i.SBOX[b>>>24]<<24|i.SBOX[b>>>16&255]<<16|i.SBOX[b>>>8&255]<<8|i.SBOX[b&255]),l[p]=l[p-c]^b}for(var v=[],w=0;w<f;w++){var I=f-w,S=l[I-(w%4?0:4)];w<4||I<=4?v[w]=S:v[w]=i.INV_SUB_MIX[0][i.SBOX[S>>>24]]^i.INV_SUB_MIX[1][i.SBOX[S>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[S>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[S&255]]}this._nRounds=u,this._keySchedule=l,this._invKeySchedule=v},s.prototype.encryptBlockRaw=function(o){return o=e(o),n(o,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},s.prototype.encryptBlock=function(o){var c=this.encryptBlockRaw(o),u=t.allocUnsafe(16);return u.writeUInt32BE(c[0],0),u.writeUInt32BE(c[1],4),u.writeUInt32BE(c[2],8),u.writeUInt32BE(c[3],12),u},s.prototype.decryptBlock=function(o){o=e(o);var c=o[1];o[1]=o[3],o[3]=c;var u=n(o,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),f=t.allocUnsafe(16);return f.writeUInt32BE(u[0],0),f.writeUInt32BE(u[3],4),f.writeUInt32BE(u[2],8),f.writeUInt32BE(u[1],12),f},s.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},qh.AES=s,qh}var $h,hm;function LS(){if(hm)return $h;hm=1;var t=et().Buffer,e=t.alloc(16,0);function r(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var s=t.allocUnsafe(16);return s.writeUInt32BE(i[0]>>>0,0),s.writeUInt32BE(i[1]>>>0,4),s.writeUInt32BE(i[2]>>>0,8),s.writeUInt32BE(i[3]>>>0,12),s}function a(i){this.h=i,this.state=t.alloc(16,0),this.cache=t.allocUnsafe(0)}return a.prototype.ghash=function(i){for(var s=-1;++s<i.length;)this.state[s]^=i[s];this._multiply()},a.prototype._multiply=function(){for(var i=r(this.h),s=[0,0,0,0],o,c,u,f=-1;++f<128;){for(c=(this.state[~~(f/8)]&1<<7-f%8)!==0,c&&(s[0]^=i[0],s[1]^=i[1],s[2]^=i[2],s[3]^=i[3]),u=(i[3]&1)!==0,o=3;o>0;o--)i[o]=i[o]>>>1|(i[o-1]&1)<<31;i[0]=i[0]>>>1,u&&(i[0]=i[0]^225<<24)}this.state=n(s)},a.prototype.update=function(i){this.cache=t.concat([this.cache,i]);for(var s;this.cache.length>=16;)s=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(s)},a.prototype.final=function(i,s){return this.cache.length&&this.ghash(t.concat([this.cache,e],16)),this.ghash(n([0,i,0,s])),this.state},$h=a,$h}var Kh,lm;function o3(){if(lm)return Kh;lm=1;var t=Nf(),e=et().Buffer,r=Ii(),n=Ye(),a=LS(),i=Ys(),s=a3();function o(f,l){var p=0;f.length!==l.length&&p++;for(var b=Math.min(f.length,l.length),v=0;v<b;++v)p+=f[v]^l[v];return p}function c(f,l,p){if(l.length===12)return f._finID=e.concat([l,e.from([0,0,0,1])]),e.concat([l,e.from([0,0,0,2])]);var b=new a(p),v=l.length,w=v%16;b.update(l),w&&(w=16-w,b.update(e.alloc(w,0))),b.update(e.alloc(8,0));var I=v*8,S=e.alloc(8);S.writeUIntBE(I,0,8),b.update(S),f._finID=b.state;var T=e.from(f._finID);return s(T),T}function u(f,l,p,b){r.call(this);var v=e.alloc(4,0);this._cipher=new t.AES(l);var w=this._cipher.encryptBlock(v);this._ghash=new a(w),p=c(this,p,w),this._prev=e.from(p),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=b,this._alen=0,this._len=0,this._mode=f,this._authTag=null,this._called=!1}return n(u,r),u.prototype._update=function(f){if(!this._called&&this._alen){var l=16-this._alen%16;l<16&&(l=e.alloc(l,0),this._ghash.update(l))}this._called=!0;var p=this._mode.encrypt(this,f);return this._decrypt?this._ghash.update(f):this._ghash.update(p),this._len+=f.length,p},u.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var f=i(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&o(f,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=f,this._cipher.scrub()},u.prototype.getAuthTag=function(){if(this._decrypt||!e.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},u.prototype.setAuthTag=function(l){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=l},u.prototype.setAAD=function(l){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(l),this._alen+=l.length},Kh=u,Kh}var Gh,dm;function f3(){if(dm)return Gh;dm=1;
28var t=Nf(),e=et().Buffer,r=Ii(),n=Ye();function a(i,s,o,c){r.call(this),this._cipher=new t.AES(s),this._prev=e.from(o),this._cache=e.allocUnsafe(0),this._secCache=e.allocUnsafe(0),this._decrypt=c,this._mode=i}return n(a,r),a.prototype._update=function(i){return this._mode.encrypt(this,i,this._decrypt)},a.prototype._final=function(){this._cipher.scrub()},Gh=a,Gh}var jh,pm;function kf(){if(pm)return jh;pm=1;var t=et().Buffer,e=Sd();function r(n,a,i,s){if(t.isBuffer(n)||(n=t.from(n,"binary")),a&&(t.isBuffer(a)||(a=t.from(a,"binary")),a.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var o=i/8,c=t.alloc(o),u=t.alloc(s||0),f=t.alloc(0);o>0||s>0;){var l=new e;l.update(f),l.update(n),a&&l.update(a),f=l.digest();var p=0;if(o>0){var b=c.length-o;p=Math.min(o,f.length),f.copy(c,b,0,p),o-=p}if(p<f.length&&s>0){var v=u.length-s,w=Math.min(s,f.length-p);f.copy(u,v,p,p+w),s-=w}}return f.fill(0),{key:c,iv:u}}return jh=r,jh}var gm;function NS(){if(gm)return vo;gm=1;var t=Td(),e=o3(),r=et().Buffer,n=f3(),a=Ii(),i=Nf(),s=kf(),o=Ye();function c(b,v,w){a.call(this),this._cache=new f,this._cipher=new i.AES(v),this._prev=r.from(w),this._mode=b,this._autopadding=!0}o(c,a),c.prototype._update=function(b){this._cache.add(b);for(var v,w,I=[];v=this._cache.get();)w=this._mode.encrypt(this,v),I.push(w);return r.concat(I)};var u=r.alloc(16,16);c.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return b=this._mode.encrypt(this,b),this._cipher.scrub(),b;if(!b.equals(u))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function f(){this.cache=r.allocUnsafe(0)}f.prototype.add=function(b){this.cache=r.concat([this.cache,b])},f.prototype.get=function(){if(this.cache.length>15){var b=this.cache.slice(0,16);return this.cache=this.cache.slice(16),b}return null},f.prototype.flush=function(){for(var b=16-this.cache.length,v=r.allocUnsafe(b),w=-1;++w<b;)v.writeUInt8(b,w);return r.concat([this.cache,v])};function l(b,v,w){var I=t[b.toLowerCase()];if(!I)throw new TypeError("invalid suite type");if(typeof v=="string"&&(v=r.from(v)),v.length!==I.key/8)throw new TypeError("invalid key length "+v.length);if(typeof w=="string"&&(w=r.from(w)),I.mode!=="GCM"&&w.length!==I.iv)throw new TypeError("invalid iv length "+w.length);return I.type==="stream"?new n(I.module,v,w):I.type==="auth"?new e(I.module,v,w):new c(I.module,v,w)}function p(b,v){var w=t[b.toLowerCase()];if(!w)throw new TypeError("invalid suite type");var I=s(v,!1,w.key,w.iv);return l(b,I.key,I.iv)}return vo.createCipheriv=l,vo.createCipher=p,vo}var Eo={},bm;function kS(){if(bm)return Eo;bm=1;var t=o3(),e=et().Buffer,r=Td(),n=f3(),a=Ii(),i=Nf(),s=kf(),o=Ye();function c(b,v,w){a.call(this),this._cache=new u,this._last=void 0,this._cipher=new i.AES(v),this._prev=e.from(w),this._mode=b,this._autopadding=!0}o(c,a),c.prototype._update=function(b){this._cache.add(b);for(var v,w,I=[];v=this._cache.get(this._autopadding);)w=this._mode.decrypt(this,v),I.push(w);return e.concat(I)},c.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return f(this._mode.decrypt(this,b));if(b)throw new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function u(){this.cache=e.allocUnsafe(0)}u.prototype.add=function(b){this.cache=e.concat([this.cache,b])},u.prototype.get=function(b){var v;if(b){if(this.cache.length>16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v}else if(this.cache.length>=16)return v=this.cache.slice(0,16),this.cache=this.cache.slice(16),v;return null},u.prototype.flush=function(){if(this.cache.length)return this.cache};function f(b){var v=b[15];if(v<1||v>16)throw new Error("unable to decrypt data");for(var w=-1;++w<v;)if(b[w+(16-v)]!==v)throw new Error("unable to decrypt data");if(v!==16)return b.slice(0,16-v)}function l(b,v,w){var I=r[b.toLowerCase()];if(!I)throw new TypeError("invalid suite type");if(typeof w=="string"&&(w=e.from(w)),I.mode!=="GCM"&&w.length!==I.iv)throw new TypeError("invalid iv length "+w.length);if(typeof v=="string"&&(v=e.from(v)),v.length!==I.key/8)throw new TypeError("invalid key length "+v.length);return I.type==="stream"?new n(I.module,v,w,!0):I.type==="auth"?new t(I.module,v,w,!0):new c(I.module,v,w)}function p(b,v){var w=r[b.toLowerCase()];if(!w)throw new TypeError("invalid suite type");var I=s(v,!1,w.key,w.iv);return l(b,I.key,I.iv)}return Eo.createDecipher=p,Eo.createDecipheriv=l,Eo}var mm;function Pd(){if(mm)return xr;mm=1;var t=NS(),e=kS(),r=s3;function n(){return Object.keys(r)}return xr.createCipher=xr.Cipher=t.createCipher,xr.createCipheriv=xr.Cipheriv=t.createCipheriv,xr.createDecipher=xr.Decipher=e.createDecipher,xr.createDecipheriv=xr.Decipheriv=e.createDecipheriv,xr.listCiphers=xr.getCiphers=n,xr}var Vh={},ym;function CS(){return ym||(ym=1,(function(t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}})(Vh)),Vh}var vm;function US(){if(vm)return Sr;vm=1;var t=gS(),e=Pd(),r=Td(),n=CS(),a=kf();function i(f,l){f=f.toLowerCase();var p,b;if(r[f])p=r[f].key,b=r[f].iv;else if(n[f])p=n[f].key*8,b=n[f].iv;else throw new TypeError("invalid suite type");var v=a(l,!1,p,b);return o(f,v.key,v.iv)}function s(f,l){f=f.toLowerCase();var p,b;if(r[f])p=r[f].key,b=r[f].iv;else if(n[f])p=n[f].key*8,b=n[f].iv;else throw new TypeError("invalid suite type");var v=a(l,!1,p,b);return c(f,v.key,v.iv)}function o(f,l,p){if(f=f.toLowerCase(),r[f])return e.createCipheriv(f,l,p);if(n[f])return new t({key:l,iv:p,mode:f});throw new TypeError("invalid suite type")}function c(f,l,p){if(f=f.toLowerCase(),r[f])return e.createDecipheriv(f,l,p);if(n[f])return new t({key:l,iv:p,mode:f,decrypt:!0});throw new TypeError("invalid suite type")}function u(){return Object.keys(n).concat(e.getCiphers())}return Sr.createCipher=Sr.Cipher=i,Sr.createCipheriv=Sr.Cipheriv=o,Sr.createDecipher=Sr.Decipher=s,Sr.createDecipheriv=Sr.Decipheriv=c,Sr.listCiphers=Sr.getCiphers=u,Sr}var Wi={},Uo={exports:{}},DS=Uo.exports,wm;function er(){return wm||(wm=1,(function(t){(function(e,r){function n(x,d){if(!x)throw new Error(d||"Assertion failed")}function a(x,d){x.super_=d;var m=function(){};m.prototype=d.prototype,x.prototype=new m,x.prototype.constructor=x}function i(x,d,m){if(i.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&((d==="le"||d==="be")&&(m=d,d=10),this._init(x||0,d||10,m||"be"))}
vendor: 9,999 bytes, line 28
28typeof e=="object"?e.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Or().Buffer}catch{}i.isBN=function(d){return d instanceof i?!0:d!==null&&typeof d=="object"&&d.constructor.wordSize===i.wordSize&&Array.isArray(d.words)},i.max=function(d,m){return d.cmp(m)>0?d:m},i.min=function(d,m){return d.cmp(m)<0?d:m},i.prototype._init=function(d,m,h){if(typeof d=="number")return this._initNumber(d,m,h);if(typeof d=="object")return this._initArray(d,m,h);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),d=d.toString().replace(/\s+/g,"");var g=0;d[0]==="-"&&(g++,this.negative=1),g<d.length&&(m===16?this._parseHex(d,g,h):(this._parseBase(d,m,g),h==="le"&&this._initArray(this.toArray(),m,h)))},i.prototype._initNumber=function(d,m,h){d<0&&(this.negative=1,d=-d),d<67108864?(this.words=[d&67108863],this.length=1):d<4503599627370496?(this.words=[d&67108863,d/67108864&67108863],this.length=2):(n(d<9007199254740992),this.words=[d&67108863,d/67108864&67108863,1],this.length=3),h==="le"&&this._initArray(this.toArray(),m,h)},i.prototype._initArray=function(d,m,h){if(n(typeof d.length=="number"),d.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(d.length/3),this.words=new Array(this.length);for(var g=0;g<this.length;g++)this.words[g]=0;var y,_,R=0;if(h==="be")for(g=d.length-1,y=0;g>=0;g-=3)_=d[g]|d[g-1]<<8|d[g-2]<<16,this.words[y]|=_<<R&67108863,this.words[y+1]=_>>>26-R&67108863,R+=24,R>=26&&(R-=26,y++);else if(h==="le")for(g=0,y=0;g<d.length;g+=3)_=d[g]|d[g+1]<<8|d[g+2]<<16,this.words[y]|=_<<R&67108863,this.words[y+1]=_>>>26-R&67108863,R+=24,R>=26&&(R-=26,y++);return this.strip()};function o(x,d){var m=x.charCodeAt(d);return m>=65&&m<=70?m-55:m>=97&&m<=102?m-87:m-48&15}function c(x,d,m){var h=o(x,m);return m-1>=d&&(h|=o(x,m-1)<<4),h}i.prototype._parseHex=function(d,m,h){this.length=Math.ceil((d.length-m)/6),this.words=new Array(this.length);for(var g=0;g<this.length;g++)this.words[g]=0;var y=0,_=0,R;if(h==="be")for(g=d.length-1;g>=m;g-=2)R=c(d,m,g)<<y,this.words[_]|=R&67108863,y>=18?(y-=18,_+=1,this.words[_]|=R>>>26):y+=8;else{var A=d.length-m;for(g=A%2===0?m+1:m;g<d.length;g+=2)R=c(d,m,g)<<y,this.words[_]|=R&67108863,y>=18?(y-=18,_+=1,this.words[_]|=R>>>26):y+=8}this.strip()};function u(x,d,m,h){for(var g=0,y=Math.min(x.length,m),_=d;_<y;_++){var R=x.charCodeAt(_)-48;g*=h,R>=49?g+=R-49+10:R>=17?g+=R-17+10:g+=R}return g}i.prototype._parseBase=function(d,m,h){this.words=[0],this.length=1;for(var g=0,y=1;y<=67108863;y*=m)g++;g--,y=y/m|0;for(var _=d.length-h,R=_%g,A=Math.min(_,_-R)+h,E=0,L=h;L<A;L+=g)E=u(d,L,L+g,m),this.imuln(y),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E);if(R!==0){var O=1;for(E=u(d,L,d.length,m),L=0;L<R;L++)O*=m;this.imuln(O),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E)}this.strip()},i.prototype.copy=function(d){d.words=new Array(this.length);for(var m=0;m<this.length;m++)d.words[m]=this.words[m];d.length=this.length,d.negative=this.negative,d.red=this.red},i.prototype.clone=function(){var d=new i(null);return this.copy(d),d},i.prototype._expand=function(d){for(;this.length<d;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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"],l=[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],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(d,m){d=d||10,m=m|0||1;var h;if(d===16||d==="hex"){h="";for(var g=0,y=0,_=0;_<this.length;_++){var R=this.words[_],A=((R<<g|y)&16777215).toString(16);y=R>>>24-g&16777215,g+=2,g>=26&&(g-=26,_--),y!==0||_!==this.length-1?h=f[6-A.length]+A+h:h=A+h}for(y!==0&&(h=y.toString(16)+h);h.length%m!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(d===(d|0)&&d>=2&&d<=36){var E=l[d],L=p[d];h="";var O=this.clone();for(O.negative=0;!O.isZero();){var U=O.modn(L).toString(d);O=O.idivn(L),O.isZero()?h=U+h:h=f[E-U.length]+U+h}for(this.isZero()&&(h="0"+h);h.length%m!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var d=this.words[0];return this.length===2?d+=this.words[1]*67108864:this.length===3&&this.words[2]===1?d+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-d:d},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(d,m){return n(typeof s<"u"),this.toArrayLike(s,d,m)},i.prototype.toArray=function(d,m){return this.toArrayLike(Array,d,m)},i.prototype.toArrayLike=function(d,m,h){var g=this.byteLength(),y=h||Math.max(1,g);n(g<=y,"byte array longer than desired length"),n(y>0,"Requested array length <= 0"),this.strip();var _=m==="le",R=new d(y),A,E,L=this.clone();if(_){for(E=0;!L.isZero();E++)A=L.andln(255),L.iushrn(8),R[E]=A;for(;E<y;E++)R[E]=0}else{for(E=0;E<y-g;E++)R[E]=0;for(E=0;!L.isZero();E++)A=L.andln(255),L.iushrn(8),R[y-E-1]=A}return R},Math.clz32?i.prototype._countBits=function(d){return 32-Math.clz32(d)}:i.prototype._countBits=function(d){var m=d,h=0;return m>=4096&&(h+=13,m>>>=13),m>=64&&(h+=7,m>>>=7),m>=8&&(h+=4,m>>>=4),m>=2&&(h+=2,m>>>=2),h+m},i.prototype._zeroBits=function(d){if(d===0)return 26;var m=d,h=0;return(m&8191)===0&&(h+=13,m>>>=13),(m&127)===0&&(h+=7,m>>>=7),(m&15)===0&&(h+=4,m>>>=4),(m&3)===0&&(h+=2,m>>>=2),(m&1)===0&&h++,h},i.prototype.bitLength=function(){var d=this.words[this.length-1],m=this._countBits(d);return(this.length-1)*26+m};function b(x){for(var d=new Array(x.bitLength()),m=0;m<d.length;m++){var h=m/26|0,g=m%26;d[m]=(x.words[h]&1<<g)>>>g}return d}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var d=0,m=0;m<this.length;m++){var h=this._zeroBits(this.words[m]);if(d+=h,h!==26)break}return d},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(d){return this.negative!==0?this.abs().inotn(d).iaddn(1):this.clone()},i.prototype.fromTwos=function(d){return this.testn(d-1)?this.notn(d).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(d){for(;this.length<d.length;)this.words[this.length++]=0;for(var m=0;m<d.length;m++)this.words[m]=this.words[m]|d.words[m];return this.strip()},i.prototype.ior=function(d){return n((this.negative|d.negative)===0),this.iuor(d)},i.prototype.or=function(d){return this.length>d.length?this.clone().ior(d):d.clone().ior(this)},i.prototype.uor=function(d){return this.length>d.length?this.clone().iuor(d):d.clone().iuor(this)},i.prototype.iuand=function(d){var m;this.length>d.length?m=d:m=this;for(var h=0;h<m.length;h++)this.words[h]=this.words[h]&d.words[h];return this.length=m.length,this.strip()},i.prototype.iand=function(d){return n((this.negative|d.negative)===0),this.iuand(d)},i.prototype.and=function(d){return this.length>d.length?this.clone().iand(d):d.clone().iand(this)},i.prototype.uand=function(d){return this.length>d.length?this.clone().iuand(d):d.clone().iuand(this)},i.prototype.iuxor=function(d){var m,h;this.length>d.length?(m=this,h=d):(m=d,h=this);for(var g=0;g<h.length;g++)this.words[g]=m.words[g]^h.words[g];if(this!==m)for(;g<m.length;g++)this.words[g]=m.words[g];return this.length=m.length,this.strip()},i.prototype.ixor=function(d){return n((this.negative|d.negative)===0),this.iuxor(d)},i.prototype.xor=function(d){return this.length>d.length?this.clone().ixor(d):d.clone().ixor(this)},i.prototype.uxor=function(d){return this.length>d.length?this.clone().iuxor(d):d.clone().iuxor(this)},i.prototype.inotn=function(d){n(typeof d=="number"&&d>=0);var m=Math.ceil(d/26)|0,h=d%26;this._expand(m),h>0&&m--;for(var g=0;g<m;g++)this.words[g]=~this.words[g]&67108863;return h>0&&(this.words[g]=~this.words[g]&67108863>>26-h),this.strip()},i.prototype.notn=function(d){return this.clone().inotn(d)},i.prototype.setn=function(d,m){n(typeof d=="number"&&d>=0);var h=d/26|0,g=d%26;return this._expand(h+1),m?this.words[h]=this.words[h]|1<<g:this.words[h]=this.words[h]&~(1<<g),this.strip()},i.prototype.iadd=function(d){var m;if(this.negative!==0&&d.negative===0)return this.negative=0,m=this.isub(d),this.negative^=1,this._normSign();if(this.negative===0&&d.negative!==0)return d.negative=0,m=this.isub(d),d.negative=1,m._normSign();var h,g;this.length>d.length?(h=this,g=d):(h=d,g=this);for(var y=0,_=0;_<g.length;_++)m=(h.words[_]|0)+(g.words[_]|0)+y,this.words[_]=m&67108863,y=m>>>26;for(;y!==0&&_<h.length;_++)m=(h.words[_]|0)+y,this.words[_]=m&67108863,y=m>>>26;if(this.length=h.length,y!==0)this.words[this.length]=y,this.length++;else if(h!==this)for(;_<h.length;_++)this.words[_]=h.words[_];return this},i.prototype.add=function(d){var m;return d.negative!==0&&this.negative===0?(d.negative=0,m=this.sub(d),d.negative^=1,m):d.negative===0&&this.negative!==0?(this.negative=0,m=d.sub(this),this.negative=1,m):this.length>d.length?this.clone().iadd(d):d.clone().iadd(this)},i.prototype.isub=function(d){if(d.negative!==0){d.negative=0;
vendor: 8,176 bytes, line 28
28var m=this.iadd(d);return d.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(d),this.negative=1,this._normSign();var h=this.cmp(d);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,y;h>0?(g=this,y=d):(g=d,y=this);for(var _=0,R=0;R<y.length;R++)m=(g.words[R]|0)-(y.words[R]|0)+_,_=m>>26,this.words[R]=m&67108863;for(;_!==0&&R<g.length;R++)m=(g.words[R]|0)+_,_=m>>26,this.words[R]=m&67108863;if(_===0&&R<g.length&&g!==this)for(;R<g.length;R++)this.words[R]=g.words[R];return this.length=Math.max(this.length,R),g!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(d){return this.clone().isub(d)};function v(x,d,m){m.negative=d.negative^x.negative;var h=x.length+d.length|0;m.length=h,h=h-1|0;var g=x.words[0]|0,y=d.words[0]|0,_=g*y,R=_&67108863,A=_/67108864|0;m.words[0]=R;for(var E=1;E<h;E++){for(var L=A>>>26,O=A&67108863,U=Math.min(E,d.length-1),X=Math.max(0,E-x.length+1);X<=U;X++){var J=E-X|0;g=x.words[J]|0,y=d.words[X]|0,_=g*y+O,L+=_/67108864|0,O=_&67108863}m.words[E]=O|0,A=L|0}return A!==0?m.words[E]=A|0:m.length--,m.strip()}var w=function(d,m,h){var g=d.words,y=m.words,_=h.words,R=0,A,E,L,O=g[0]|0,U=O&8191,X=O>>>13,J=g[1]|0,j=J&8191,q=J>>>13,V=g[2]|0,ee=V&8191,ne=V>>>13,W=g[3]|0,z=W&8191,ae=W>>>13,pe=g[4]|0,ge=pe&8191,be=pe>>>13,_e=g[5]|0,Ie=_e&8191,de=_e>>>13,Pe=g[6]|0,ye=Pe&8191,we=Pe>>>13,Ee=g[7]|0,ve=Ee&8191,Be=Ee>>>13,Ue=g[8]|0,xe=Ue&8191,Ne=Ue>>>13,Ke=g[9]|0,Z=Ke&8191,D=Ke>>>13,F=y[0]|0,Q=F&8191,se=F>>>13,ce=y[1]|0,he=ce&8191,Oe=ce>>>13,$e=y[2]|0,Te=$e&8191,Ve=$e>>>13,De=y[3]|0,ze=De&8191,ut=De>>>13,St=y[4]|0,Je=St&8191,dt=St>>>13,Rt=y[5]|0,Y=Rt&8191,H=Rt>>>13,K=y[6]|0,te=K&8191,oe=K>>>13,ue=y[7]|0,le=ue&8191,Le=ue>>>13,We=y[8]|0,Me=We&8191,Ze=We>>>13,qe=y[9]|0,rt=qe&8191,Mt=qe>>>13;h.negative=d.negative^m.negative,h.length=19,A=Math.imul(U,Q),E=Math.imul(U,se),E=E+Math.imul(X,Q)|0,L=Math.imul(X,se);var Bt=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,A=Math.imul(j,Q),E=Math.imul(j,se),E=E+Math.imul(q,Q)|0,L=Math.imul(q,se),A=A+Math.imul(U,he)|0,E=E+Math.imul(U,Oe)|0,E=E+Math.imul(X,he)|0,L=L+Math.imul(X,Oe)|0;var Tt=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,A=Math.imul(ee,Q),E=Math.imul(ee,se),E=E+Math.imul(ne,Q)|0,L=Math.imul(ne,se),A=A+Math.imul(j,he)|0,E=E+Math.imul(j,Oe)|0,E=E+Math.imul(q,he)|0,L=L+Math.imul(q,Oe)|0,A=A+Math.imul(U,Te)|0,E=E+Math.imul(U,Ve)|0,E=E+Math.imul(X,Te)|0,L=L+Math.imul(X,Ve)|0;var Bi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Bi>>>26)|0,Bi&=67108863,A=Math.imul(z,Q),E=Math.imul(z,se),E=E+Math.imul(ae,Q)|0,L=Math.imul(ae,se),A=A+Math.imul(ee,he)|0,E=E+Math.imul(ee,Oe)|0,E=E+Math.imul(ne,he)|0,L=L+Math.imul(ne,Oe)|0,A=A+Math.imul(j,Te)|0,E=E+Math.imul(j,Ve)|0,E=E+Math.imul(q,Te)|0,L=L+Math.imul(q,Ve)|0,A=A+Math.imul(U,ze)|0,E=E+Math.imul(U,ut)|0,E=E+Math.imul(X,ze)|0,L=L+Math.imul(X,ut)|0;var Ti=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,A=Math.imul(ge,Q),E=Math.imul(ge,se),E=E+Math.imul(be,Q)|0,L=Math.imul(be,se),A=A+Math.imul(z,he)|0,E=E+Math.imul(z,Oe)|0,E=E+Math.imul(ae,he)|0,L=L+Math.imul(ae,Oe)|0,A=A+Math.imul(ee,Te)|0,E=E+Math.imul(ee,Ve)|0,E=E+Math.imul(ne,Te)|0,L=L+Math.imul(ne,Ve)|0,A=A+Math.imul(j,ze)|0,E=E+Math.imul(j,ut)|0,E=E+Math.imul(q,ze)|0,L=L+Math.imul(q,ut)|0,A=A+Math.imul(U,Je)|0,E=E+Math.imul(U,dt)|0,E=E+Math.imul(X,Je)|0,L=L+Math.imul(X,dt)|0;var Pi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,A=Math.imul(Ie,Q),E=Math.imul(Ie,se),E=E+Math.imul(de,Q)|0,L=Math.imul(de,se),A=A+Math.imul(ge,he)|0,E=E+Math.imul(ge,Oe)|0,E=E+Math.imul(be,he)|0,L=L+Math.imul(be,Oe)|0,A=A+Math.imul(z,Te)|0,E=E+Math.imul(z,Ve)|0,E=E+Math.imul(ae,Te)|0,L=L+Math.imul(ae,Ve)|0,A=A+Math.imul(ee,ze)|0,E=E+Math.imul(ee,ut)|0,E=E+Math.imul(ne,ze)|0,L=L+Math.imul(ne,ut)|0,A=A+Math.imul(j,Je)|0,E=E+Math.imul(j,dt)|0,E=E+Math.imul(q,Je)|0,L=L+Math.imul(q,dt)|0,A=A+Math.imul(U,Y)|0,E=E+Math.imul(U,H)|0,E=E+Math.imul(X,Y)|0,L=L+Math.imul(X,H)|0;var Mi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,A=Math.imul(ye,Q),E=Math.imul(ye,se),E=E+Math.imul(we,Q)|0,L=Math.imul(we,se),A=A+Math.imul(Ie,he)|0,E=E+Math.imul(Ie,Oe)|0,E=E+Math.imul(de,he)|0,L=L+Math.imul(de,Oe)|0,A=A+Math.imul(ge,Te)|0,E=E+Math.imul(ge,Ve)|0,E=E+Math.imul(be,Te)|0,L=L+Math.imul(be,Ve)|0,A=A+Math.imul(z,ze)|0,E=E+Math.imul(z,ut)|0,E=E+Math.imul(ae,ze)|0,L=L+Math.imul(ae,ut)|0,A=A+Math.imul(ee,Je)|0,E=E+Math.imul(ee,dt)|0,E=E+Math.imul(ne,Je)|0,L=L+Math.imul(ne,dt)|0,A=A+Math.imul(j,Y)|0,E=E+Math.imul(j,H)|0,E=E+Math.imul(q,Y)|0,L=L+Math.imul(q,H)|0,A=A+Math.imul(U,te)|0,E=E+Math.imul(U,oe)|0,E=E+Math.imul(X,te)|0,L=L+Math.imul(X,oe)|0;var Oi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,A=Math.imul(ve,Q),E=Math.imul(ve,se),E=E+Math.imul(Be,Q)|0,L=Math.imul(Be,se),A=A+Math.imul(ye,he)|0,E=E+Math.imul(ye,Oe)|0,E=E+Math.imul(we,he)|0,L=L+Math.imul(we,Oe)|0,A=A+Math.imul(Ie,Te)|0,E=E+Math.imul(Ie,Ve)|0,E=E+Math.imul(de,Te)|0,L=L+Math.imul(de,Ve)|0,A=A+Math.imul(ge,ze)|0,E=E+Math.imul(ge,ut)|0,E=E+Math.imul(be,ze)|0,L=L+Math.imul(be,ut)|0,A=A+Math.imul(z,Je)|0,E=E+Math.imul(z,dt)|0,E=E+Math.imul(ae,Je)|0,L=L+Math.imul(ae,dt)|0,A=A+Math.imul(ee,Y)|0,E=E+Math.imul(ee,H)|0,E=E+Math.imul(ne,Y)|0,L=L+Math.imul(ne,H)|0,A=A+Math.imul(j,te)|0,E=E+Math.imul(j,oe)|0,E=E+Math.imul(q,te)|0,L=L+Math.imul(q,oe)|0,A=A+Math.imul(U,le)|0,E=E+Math.imul(U,Le)|0,E=E+Math.imul(X,le)|0,L=L+Math.imul(X,Le)|0;var Li=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Li>>>26)|0,Li&=67108863,A=Math.imul(xe,Q),E=Math.imul(xe,se),E=E+Math.imul(Ne,Q)|0,L=Math.imul(Ne,se),A=A+Math.imul(ve,he)|0,E=E+Math.imul(ve,Oe)|0,E=E+Math.imul(Be,he)|0,L=L+Math.imul(Be,Oe)|0,A=A+Math.imul(ye,Te)|0,E=E+Math.imul(ye,Ve)|0,E=E+Math.imul(we,Te)|0,L=L+Math.imul(we,Ve)|0,A=A+Math.imul(Ie,ze)|0,E=E+Math.imul(Ie,ut)|0,E=E+Math.imul(de,ze)|0,L=L+Math.imul(de,ut)|0,A=A+Math.imul(ge,Je)|0,E=E+Math.imul(ge,dt)|0,E=E+Math.imul(be,Je)|0,L=L+Math.imul(be,dt)|0,A=A+Math.imul(z,Y)|0,E=E+Math.imul(z,H)|0,E=E+Math.imul(ae,Y)|0,L=L+Math.imul(ae,H)|0,A=A+Math.imul(ee,te)|0,E=E+Math.imul(ee,oe)|0,E=E+Math.imul(ne,te)|0,L=L+Math.imul(ne,oe)|0,A=A+Math.imul(j,le)|0,E=E+Math.imul(j,Le)|0,E=E+Math.imul(q,le)|0,L=L+Math.imul(q,Le)|0,A=A+Math.imul(U,Me)|0,E=E+Math.imul(U,Ze)|0,E=E+Math.imul(X,Me)|0,L=L+Math.imul(X,Ze)|0;var Ni=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Ni>>>26)|0,Ni&=67108863,A=Math.imul(Z,Q),E=Math.imul(Z,se),E=E+Math.imul(D,Q)|0,L=Math.imul(D,se),A=A+Math.imul(xe,he)|0,E=E+Math.imul(xe,Oe)|0,E=E+Math.imul(Ne,he)|0,L=L+Math.imul(Ne,Oe)|0,A=A+Math.imul(ve,Te)|0,E=E+Math.imul(ve,Ve)|0,E=E+Math.imul(Be,Te)|0,L=L+Math.imul(Be,Ve)|0,A=A+Math.imul(ye,ze)|0,E=E+Math.imul(ye,ut)|0,E=E+Math.imul(we,ze)|0,L=L+Math.imul(we,ut)|0,A=A+Math.imul(Ie,Je)|0,E=E+Math.imul(Ie,dt)|0,E=E+Math.imul(de,Je)|0,L=L+Math.imul(de,dt)|0,A=A+Math.imul(ge,Y)|0,E=E+Math.imul(ge,H)|0,E=E+Math.imul(be,Y)|0,L=L+Math.imul(be,H)|0,A=A+Math.imul(z,te)|0,E=E+Math.imul(z,oe)|0,E=E+Math.imul(ae,te)|0,L=L+Math.imul(ae,oe)|0,A=A+Math.imul(ee,le)|0,E=E+Math.imul(ee,Le)|0,E=E+Math.imul(ne,le)|0,L=L+Math.imul(ne,Le)|0,A=A+Math.imul(j,Me)|0,E=E+Math.imul(j,Ze)|0,E=E+Math.imul(q,Me)|0,L=L+Math.imul(q,Ze)|0,A=A+Math.imul(U,rt)|0,E=E+Math.imul(U,Mt)|0,E=E+Math.imul(X,rt)|0,L=L+Math.imul(X,Mt)|0;var ki=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(ki>>>26)|0,ki&=67108863,A=Math.imul(Z,he),E=Math.imul(Z,Oe),E=E+Math.imul(D,he)|0,L=Math.imul(D,Oe),A=A+Math.imul(xe,Te)|0,E=E+Math.imul(xe,Ve)|0,E=E+Math.imul(Ne,Te)|0,L=L+Math.imul(Ne,Ve)|0,A=A+Math.imul(ve,ze)|0,E=E+Math.imul(ve,ut)|0,E=E+Math.imul(Be,ze)|0,L=L+Math.imul(Be,ut)|0,A=A+Math.imul(ye,Je)|0,E=E+Math.imul(ye,dt)|0,E=E+Math.imul(we,Je)|0,L=L+Math.imul(we,dt)|0,A=A+Math.imul(Ie,Y)|0,E=E+Math.imul(Ie,H)|0,E=E+Math.imul(de,Y)|0,L=L+Math.imul(de,H)|0,A=A+Math.imul(ge,te)|0,E=E+Math.imul(ge,oe)|0,E=E+Math.imul(be,te)|0,L=L+Math.imul(be,oe)|0,A=A+Math.imul(z,le)|0,E=E+Math.imul(z,Le)|0,E=E+Math.imul(ae,le)|0,L=L+Math.imul(ae,Le)|0,A=A+Math.imul(ee,Me)|0,E=E+Math.imul(ee,Ze)|0,E=E+Math.imul(ne,Me)|0,L=L+Math.imul(ne,Ze)|0,A=A+Math.imul(j,rt)|0,E=E+Math.imul(j,Mt)|0,E=E+Math.imul(q,rt)|0,L=L+Math.imul(q,Mt)|0;
vendor: 5,311 bytes, line 28
28var Ci=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,A=Math.imul(Z,Te),E=Math.imul(Z,Ve),E=E+Math.imul(D,Te)|0,L=Math.imul(D,Ve),A=A+Math.imul(xe,ze)|0,E=E+Math.imul(xe,ut)|0,E=E+Math.imul(Ne,ze)|0,L=L+Math.imul(Ne,ut)|0,A=A+Math.imul(ve,Je)|0,E=E+Math.imul(ve,dt)|0,E=E+Math.imul(Be,Je)|0,L=L+Math.imul(Be,dt)|0,A=A+Math.imul(ye,Y)|0,E=E+Math.imul(ye,H)|0,E=E+Math.imul(we,Y)|0,L=L+Math.imul(we,H)|0,A=A+Math.imul(Ie,te)|0,E=E+Math.imul(Ie,oe)|0,E=E+Math.imul(de,te)|0,L=L+Math.imul(de,oe)|0,A=A+Math.imul(ge,le)|0,E=E+Math.imul(ge,Le)|0,E=E+Math.imul(be,le)|0,L=L+Math.imul(be,Le)|0,A=A+Math.imul(z,Me)|0,E=E+Math.imul(z,Ze)|0,E=E+Math.imul(ae,Me)|0,L=L+Math.imul(ae,Ze)|0,A=A+Math.imul(ee,rt)|0,E=E+Math.imul(ee,Mt)|0,E=E+Math.imul(ne,rt)|0,L=L+Math.imul(ne,Mt)|0;var Ui=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,A=Math.imul(Z,ze),E=Math.imul(Z,ut),E=E+Math.imul(D,ze)|0,L=Math.imul(D,ut),A=A+Math.imul(xe,Je)|0,E=E+Math.imul(xe,dt)|0,E=E+Math.imul(Ne,Je)|0,L=L+Math.imul(Ne,dt)|0,A=A+Math.imul(ve,Y)|0,E=E+Math.imul(ve,H)|0,E=E+Math.imul(Be,Y)|0,L=L+Math.imul(Be,H)|0,A=A+Math.imul(ye,te)|0,E=E+Math.imul(ye,oe)|0,E=E+Math.imul(we,te)|0,L=L+Math.imul(we,oe)|0,A=A+Math.imul(Ie,le)|0,E=E+Math.imul(Ie,Le)|0,E=E+Math.imul(de,le)|0,L=L+Math.imul(de,Le)|0,A=A+Math.imul(ge,Me)|0,E=E+Math.imul(ge,Ze)|0,E=E+Math.imul(be,Me)|0,L=L+Math.imul(be,Ze)|0,A=A+Math.imul(z,rt)|0,E=E+Math.imul(z,Mt)|0,E=E+Math.imul(ae,rt)|0,L=L+Math.imul(ae,Mt)|0;var Di=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Di>>>26)|0,Di&=67108863,A=Math.imul(Z,Je),E=Math.imul(Z,dt),E=E+Math.imul(D,Je)|0,L=Math.imul(D,dt),A=A+Math.imul(xe,Y)|0,E=E+Math.imul(xe,H)|0,E=E+Math.imul(Ne,Y)|0,L=L+Math.imul(Ne,H)|0,A=A+Math.imul(ve,te)|0,E=E+Math.imul(ve,oe)|0,E=E+Math.imul(Be,te)|0,L=L+Math.imul(Be,oe)|0,A=A+Math.imul(ye,le)|0,E=E+Math.imul(ye,Le)|0,E=E+Math.imul(we,le)|0,L=L+Math.imul(we,Le)|0,A=A+Math.imul(Ie,Me)|0,E=E+Math.imul(Ie,Ze)|0,E=E+Math.imul(de,Me)|0,L=L+Math.imul(de,Ze)|0,A=A+Math.imul(ge,rt)|0,E=E+Math.imul(ge,Mt)|0,E=E+Math.imul(be,rt)|0,L=L+Math.imul(be,Mt)|0;var Hi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,A=Math.imul(Z,Y),E=Math.imul(Z,H),E=E+Math.imul(D,Y)|0,L=Math.imul(D,H),A=A+Math.imul(xe,te)|0,E=E+Math.imul(xe,oe)|0,E=E+Math.imul(Ne,te)|0,L=L+Math.imul(Ne,oe)|0,A=A+Math.imul(ve,le)|0,E=E+Math.imul(ve,Le)|0,E=E+Math.imul(Be,le)|0,L=L+Math.imul(Be,Le)|0,A=A+Math.imul(ye,Me)|0,E=E+Math.imul(ye,Ze)|0,E=E+Math.imul(we,Me)|0,L=L+Math.imul(we,Ze)|0,A=A+Math.imul(Ie,rt)|0,E=E+Math.imul(Ie,Mt)|0,E=E+Math.imul(de,rt)|0,L=L+Math.imul(de,Mt)|0;var Fi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,A=Math.imul(Z,te),E=Math.imul(Z,oe),E=E+Math.imul(D,te)|0,L=Math.imul(D,oe),A=A+Math.imul(xe,le)|0,E=E+Math.imul(xe,Le)|0,E=E+Math.imul(Ne,le)|0,L=L+Math.imul(Ne,Le)|0,A=A+Math.imul(ve,Me)|0,E=E+Math.imul(ve,Ze)|0,E=E+Math.imul(Be,Me)|0,L=L+Math.imul(Be,Ze)|0,A=A+Math.imul(ye,rt)|0,E=E+Math.imul(ye,Mt)|0,E=E+Math.imul(we,rt)|0,L=L+Math.imul(we,Mt)|0;var qi=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(qi>>>26)|0,qi&=67108863,A=Math.imul(Z,le),E=Math.imul(Z,Le),E=E+Math.imul(D,le)|0,L=Math.imul(D,Le),A=A+Math.imul(xe,Me)|0,E=E+Math.imul(xe,Ze)|0,E=E+Math.imul(Ne,Me)|0,L=L+Math.imul(Ne,Ze)|0,A=A+Math.imul(ve,rt)|0,E=E+Math.imul(ve,Mt)|0,E=E+Math.imul(Be,rt)|0,L=L+Math.imul(Be,Mt)|0;var $i=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+($i>>>26)|0,$i&=67108863,A=Math.imul(Z,Me),E=Math.imul(Z,Ze),E=E+Math.imul(D,Me)|0,L=Math.imul(D,Ze),A=A+Math.imul(xe,rt)|0,E=E+Math.imul(xe,Mt)|0,E=E+Math.imul(Ne,rt)|0,L=L+Math.imul(Ne,Mt)|0;var Ki=(R+A|0)+((E&8191)<<13)|0;R=(L+(E>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,A=Math.imul(Z,rt),E=Math.imul(Z,Mt),E=E+Math.imul(D,rt)|0,L=Math.imul(D,Mt);var Gi=(R+A|0)+((E&8191)<<13)|0;return R=(L+(E>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,_[0]=Bt,_[1]=Tt,_[2]=Bi,_[3]=Ti,_[4]=Pi,_[5]=Mi,_[6]=Oi,_[7]=Li,_[8]=Ni,_[9]=ki,_[10]=Ci,_[11]=Ui,_[12]=Di,_[13]=Hi,_[14]=Fi,_[15]=qi,_[16]=$i,_[17]=Ki,_[18]=Gi,R!==0&&(_[19]=R,h.length++),h};Math.imul||(w=v);function I(x,d,m){m.negative=d.negative^x.negative,m.length=x.length+d.length;for(var h=0,g=0,y=0;y<m.length-1;y++){var _=g;g=0;for(var R=h&67108863,A=Math.min(y,d.length-1),E=Math.max(0,y-x.length+1);E<=A;E++){var L=y-E,O=x.words[L]|0,U=d.words[E]|0,X=O*U,J=X&67108863;_=_+(X/67108864|0)|0,J=J+R|0,R=J&67108863,_=_+(J>>>26)|0,g+=_>>>26,_&=67108863}m.words[y]=R,h=_,_=g}return h!==0?m.words[y]=h:m.length--,m.strip()}function S(x,d,m){var h=new T;return h.mulp(x,d,m)}i.prototype.mulTo=function(d,m){var h,g=this.length+d.length;return this.length===10&&d.length===10?h=w(this,d,m):g<63?h=v(this,d,m):g<1024?h=I(this,d,m):h=S(this,d,m),h};function T(x,d){this.x=x,this.y=d}T.prototype.makeRBT=function(d){for(var m=new Array(d),h=i.prototype._countBits(d)-1,g=0;g<d;g++)m[g]=this.revBin(g,h,d);return m},T.prototype.revBin=function(d,m,h){if(d===0||d===h-1)return d;for(var g=0,y=0;y<m;y++)g|=(d&1)<<m-y-1,d>>=1;return g},T.prototype.permute=function(d,m,h,g,y,_){for(var R=0;R<_;R++)g[R]=m[d[R]],y[R]=h[d[R]]},T.prototype.transform=function(d,m,h,g,y,_){this.permute(_,d,m,h,g,y);for(var R=1;R<y;R<<=1)for(var A=R<<1,E=Math.cos(2*Math.PI/A),L=Math.sin(2*Math.PI/A),O=0;O<y;O+=A)for(var U=E,X=L,J=0;J<R;J++){var j=h[O+J],q=g[O+J],V=h[O+J+R],ee=g[O+J+R],ne=U*V-X*ee;
vendor: 14,141 bytes, line 28
28ee=U*ee+X*V,V=ne,h[O+J]=j+V,g[O+J]=q+ee,h[O+J+R]=j-V,g[O+J+R]=q-ee,J!==A&&(ne=E*U-L*X,X=E*X+L*U,U=ne)}},T.prototype.guessLen13b=function(d,m){var h=Math.max(m,d)|1,g=h&1,y=0;for(h=h/2|0;h;h=h>>>1)y++;return 1<<y+1+g},T.prototype.conjugate=function(d,m,h){if(!(h<=1))for(var g=0;g<h/2;g++){var y=d[g];d[g]=d[h-g-1],d[h-g-1]=y,y=m[g],m[g]=-m[h-g-1],m[h-g-1]=-y}},T.prototype.normalize13b=function(d,m){for(var h=0,g=0;g<m/2;g++){var y=Math.round(d[2*g+1]/m)*8192+Math.round(d[2*g]/m)+h;d[g]=y&67108863,y<67108864?h=0:h=y/67108864|0}return d},T.prototype.convert13b=function(d,m,h,g){for(var y=0,_=0;_<m;_++)y=y+(d[_]|0),h[2*_]=y&8191,y=y>>>13,h[2*_+1]=y&8191,y=y>>>13;for(_=2*m;_<g;++_)h[_]=0;n(y===0),n((y&-8192)===0)},T.prototype.stub=function(d){for(var m=new Array(d),h=0;h<d;h++)m[h]=0;return m},T.prototype.mulp=function(d,m,h){var g=2*this.guessLen13b(d.length,m.length),y=this.makeRBT(g),_=this.stub(g),R=new Array(g),A=new Array(g),E=new Array(g),L=new Array(g),O=new Array(g),U=new Array(g),X=h.words;X.length=g,this.convert13b(d.words,d.length,R,g),this.convert13b(m.words,m.length,L,g),this.transform(R,_,A,E,g,y),this.transform(L,_,O,U,g,y);for(var J=0;J<g;J++){var j=A[J]*O[J]-E[J]*U[J];E[J]=A[J]*U[J]+E[J]*O[J],A[J]=j}return this.conjugate(A,E,g),this.transform(A,E,X,_,g,y),this.conjugate(X,_,g),this.normalize13b(X,g),h.negative=d.negative^m.negative,h.length=d.length+m.length,h.strip()},i.prototype.mul=function(d){var m=new i(null);return m.words=new Array(this.length+d.length),this.mulTo(d,m)},i.prototype.mulf=function(d){var m=new i(null);return m.words=new Array(this.length+d.length),S(this,d,m)},i.prototype.imul=function(d){return this.clone().mulTo(d,this)},i.prototype.imuln=function(d){n(typeof d=="number"),n(d<67108864);for(var m=0,h=0;h<this.length;h++){var g=(this.words[h]|0)*d,y=(g&67108863)+(m&67108863);m>>=26,m+=g/67108864|0,m+=y>>>26,this.words[h]=y&67108863}return m!==0&&(this.words[h]=m,this.length++),this.length=d===0?1:this.length,this},i.prototype.muln=function(d){return this.clone().imuln(d)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(d){var m=b(d);if(m.length===0)return new i(1);for(var h=this,g=0;g<m.length&&m[g]===0;g++,h=h.sqr());if(++g<m.length)for(var y=h.sqr();g<m.length;g++,y=y.sqr())m[g]!==0&&(h=h.mul(y));return h},i.prototype.iushln=function(d){n(typeof d=="number"&&d>=0);var m=d%26,h=(d-m)/26,g=67108863>>>26-m<<26-m,y;if(m!==0){var _=0;for(y=0;y<this.length;y++){var R=this.words[y]&g,A=(this.words[y]|0)-R<<m;this.words[y]=A|_,_=R>>>26-m}_&&(this.words[y]=_,this.length++)}if(h!==0){for(y=this.length-1;y>=0;y--)this.words[y+h]=this.words[y];for(y=0;y<h;y++)this.words[y]=0;this.length+=h}return this.strip()},i.prototype.ishln=function(d){return n(this.negative===0),this.iushln(d)},i.prototype.iushrn=function(d,m,h){n(typeof d=="number"&&d>=0);var g;m?g=(m-m%26)/26:g=0;var y=d%26,_=Math.min((d-y)/26,this.length),R=67108863^67108863>>>y<<y,A=h;if(g-=_,g=Math.max(0,g),A){for(var E=0;E<_;E++)A.words[E]=this.words[E];A.length=_}if(_!==0)if(this.length>_)for(this.length-=_,E=0;E<this.length;E++)this.words[E]=this.words[E+_];else this.words[0]=0,this.length=1;var L=0;for(E=this.length-1;E>=0&&(L!==0||E>=g);E--){var O=this.words[E]|0;this.words[E]=L<<26-y|O>>>y,L=O&R}return A&&L!==0&&(A.words[A.length++]=L),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(d,m,h){return n(this.negative===0),this.iushrn(d,m,h)},i.prototype.shln=function(d){return this.clone().ishln(d)},i.prototype.ushln=function(d){return this.clone().iushln(d)},i.prototype.shrn=function(d){return this.clone().ishrn(d)},i.prototype.ushrn=function(d){return this.clone().iushrn(d)},i.prototype.testn=function(d){n(typeof d=="number"&&d>=0);var m=d%26,h=(d-m)/26,g=1<<m;if(this.length<=h)return!1;var y=this.words[h];return!!(y&g)},i.prototype.imaskn=function(d){n(typeof d=="number"&&d>=0);var m=d%26,h=(d-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(m!==0&&h++,this.length=Math.min(h,this.length),m!==0){var g=67108863^67108863>>>m<<m;this.words[this.length-1]&=g}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.maskn=function(d){return this.clone().imaskn(d)},i.prototype.iaddn=function(d){return n(typeof d=="number"),n(d<67108864),d<0?this.isubn(-d):this.negative!==0?this.length===1&&(this.words[0]|0)<d?(this.words[0]=d-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(d),this.negative=1,this):this._iaddn(d)},i.prototype._iaddn=function(d){this.words[0]+=d;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},i.prototype.isubn=function(d){if(n(typeof d=="number"),n(d<67108864),d<0)return this.iaddn(-d);if(this.negative!==0)return this.negative=0,this.iaddn(d),this.negative=1,this;if(this.words[0]-=d,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this.strip()},i.prototype.addn=function(d){return this.clone().iaddn(d)},i.prototype.subn=function(d){return this.clone().isubn(d)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(d,m,h){var g=d.length+h,y;this._expand(g);var _,R=0;for(y=0;y<d.length;y++){_=(this.words[y+h]|0)+R;var A=(d.words[y]|0)*m;_-=A&67108863,R=(_>>26)-(A/67108864|0),this.words[y+h]=_&67108863}for(;y<this.length-h;y++)_=(this.words[y+h]|0)+R,R=_>>26,this.words[y+h]=_&67108863;if(R===0)return this.strip();for(n(R===-1),R=0,y=0;y<this.length;y++)_=-(this.words[y]|0)+R,R=_>>26,this.words[y]=_&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(d,m){var h=this.length-d.length,g=this.clone(),y=d,_=y.words[y.length-1]|0,R=this._countBits(_);h=26-R,h!==0&&(y=y.ushln(h),g.iushln(h),_=y.words[y.length-1]|0);var A=g.length-y.length,E;if(m!=="mod"){E=new i(null),E.length=A+1,E.words=new Array(E.length);for(var L=0;L<E.length;L++)E.words[L]=0}var O=g.clone()._ishlnsubmul(y,1,A);O.negative===0&&(g=O,E&&(E.words[A]=1));for(var U=A-1;U>=0;U--){var X=(g.words[y.length+U]|0)*67108864+(g.words[y.length+U-1]|0);for(X=Math.min(X/_|0,67108863),g._ishlnsubmul(y,X,U);g.negative!==0;)X--,g.negative=0,g._ishlnsubmul(y,1,U),g.isZero()||(g.negative^=1);E&&(E.words[U]=X)}return E&&E.strip(),g.strip(),m!=="div"&&h!==0&&g.iushrn(h),{div:E||null,mod:g}},i.prototype.divmod=function(d,m,h){if(n(!d.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var g,y,_;return this.negative!==0&&d.negative===0?(_=this.neg().divmod(d,m),m!=="mod"&&(g=_.div.neg()),m!=="div"&&(y=_.mod.neg(),h&&y.negative!==0&&y.iadd(d)),{div:g,mod:y}):this.negative===0&&d.negative!==0?(_=this.divmod(d.neg(),m),m!=="mod"&&(g=_.div.neg()),{div:g,mod:_.mod}):(this.negative&d.negative)!==0?(_=this.neg().divmod(d.neg(),m),m!=="div"&&(y=_.mod.neg(),h&&y.negative!==0&&y.isub(d)),{div:_.div,mod:y}):d.length>this.length||this.cmp(d)<0?{div:new i(0),mod:this}:d.length===1?m==="div"?{div:this.divn(d.words[0]),mod:null}:m==="mod"?{div:null,mod:new i(this.modn(d.words[0]))}:{div:this.divn(d.words[0]),mod:new i(this.modn(d.words[0]))}:this._wordDiv(d,m)},i.prototype.div=function(d){return this.divmod(d,"div",!1).div},i.prototype.mod=function(d){return this.divmod(d,"mod",!1).mod},i.prototype.umod=function(d){return this.divmod(d,"mod",!0).mod},i.prototype.divRound=function(d){var m=this.divmod(d);if(m.mod.isZero())return m.div;var h=m.div.negative!==0?m.mod.isub(d):m.mod,g=d.ushrn(1),y=d.andln(1),_=h.cmp(g);return _<0||y===1&&_===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},i.prototype.modn=function(d){n(d<=67108863);for(var m=(1<<26)%d,h=0,g=this.length-1;g>=0;g--)h=(m*h+(this.words[g]|0))%d;return h},i.prototype.idivn=function(d){n(d<=67108863);for(var m=0,h=this.length-1;h>=0;h--){var g=(this.words[h]|0)+m*67108864;this.words[h]=g/d|0,m=g%d}return this.strip()},i.prototype.divn=function(d){return this.clone().idivn(d)},i.prototype.egcd=function(d){n(d.negative===0),n(!d.isZero());var m=this,h=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var g=new i(1),y=new i(0),_=new i(0),R=new i(1),A=0;m.isEven()&&h.isEven();)m.iushrn(1),h.iushrn(1),++A;for(var E=h.clone(),L=m.clone();!m.isZero();){for(var O=0,U=1;(m.words[0]&U)===0&&O<26;++O,U<<=1);if(O>0)for(m.iushrn(O);O-- >0;)(g.isOdd()||y.isOdd())&&(g.iadd(E),y.isub(L)),g.iushrn(1),y.iushrn(1);for(var X=0,J=1;(h.words[0]&J)===0&&X<26;++X,J<<=1);if(X>0)for(h.iushrn(X);X-- >0;)(_.isOdd()||R.isOdd())&&(_.iadd(E),R.isub(L)),_.iushrn(1),R.iushrn(1);m.cmp(h)>=0?(m.isub(h),g.isub(_),y.isub(R)):(h.isub(m),_.isub(g),R.isub(y))}return{a:_,b:R,gcd:h.iushln(A)}},i.prototype._invmp=function(d){n(d.negative===0),n(!d.isZero());var m=this,h=d.clone();m.negative!==0?m=m.umod(d):m=m.clone();for(var g=new i(1),y=new i(0),_=h.clone();m.cmpn(1)>0&&h.cmpn(1)>0;){for(var R=0,A=1;(m.words[0]&A)===0&&R<26;++R,A<<=1);if(R>0)for(m.iushrn(R);R-- >0;)g.isOdd()&&g.iadd(_),g.iushrn(1);for(var E=0,L=1;(h.words[0]&L)===0&&E<26;++E,L<<=1);if(E>0)for(h.iushrn(E);E-- >0;)y.isOdd()&&y.iadd(_),y.iushrn(1);m.cmp(h)>=0?(m.isub(h),g.isub(y)):(h.isub(m),y.isub(g))}var O;return m.cmpn(1)===0?O=g:O=y,O.cmpn(0)<0&&O.iadd(d),O},i.prototype.gcd=function(d){if(this.isZero())return d.abs();if(d.isZero())return this.abs();var m=this.clone(),h=d.clone();m.negative=0,h.negative=0;for(var g=0;m.isEven()&&h.isEven();g++)m.iushrn(1),h.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;h.isEven();)h.iushrn(1);var y=m.cmp(h);if(y<0){var _=m;m=h,h=_}else if(y===0||h.cmpn(1)===0)break;m.isub(h)}while(!0);return h.iushln(g)},i.prototype.invm=function(d){return this.egcd(d).a.umod(d)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(d){return this.words[0]&d},i.prototype.bincn=function(d){n(typeof d=="number");var m=d%26,h=(d-m)/26,g=1<<m;if(this.length<=h)return this._expand(h+1),this.words[h]|=g,this;for(var y=g,_=h;y!==0&&_<this.length;_++){var R=this.words[_]|0;R+=y,y=R>>>26,R&=67108863,this.words[_]=R}return y!==0&&(this.words[_]=y,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(d){var m=d<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this.strip();var h;if(this.length>1)h=1;else{m&&(d=-d),n(d<=67108863,"Number is too big");var g=this.words[0]|0;h=g===d?0:g<d?-1:1}return this.negative!==0?-h|0:h},i.prototype.cmp=function(d){if(this.negative!==0&&d.negative===0)return-1;if(this.negative===0&&d.negative!==0)return 1;var m=this.ucmp(d);return this.negative!==0?-m|0:m},i.prototype.ucmp=function(d){if(this.length>d.length)return 1;if(this.length<d.length)return-1;for(var m=0,h=this.length-1;h>=0;h--){var g=this.words[h]|0,y=d.words[h]|0;if(g!==y){g<y?m=-1:g>y&&(m=1);break}}return m},i.prototype.gtn=function(d){return this.cmpn(d)===1},i.prototype.gt=function(d){return this.cmp(d)===1},i.prototype.gten=function(d){return this.cmpn(d)>=0},i.prototype.gte=function(d){return this.cmp(d)>=0},i.prototype.ltn=function(d){return this.cmpn(d)===-1},i.prototype.lt=function(d){return this.cmp(d)===-1},i.prototype.lten=function(d){return this.cmpn(d)<=0},i.prototype.lte=function(d){return this.cmp(d)<=0},i.prototype.eqn=function(d){return this.cmpn(d)===0},i.prototype.eq=function(d){return this.cmp(d)===0},i.red=function(d){return new N(d)},i.prototype.toRed=function(d){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),d.convertTo(this)._forceRed(d)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(d){return this.red=d,this},i.prototype.forceRed=function(d){return n(!this.red,"Already a number in reduction context"),this._forceRed(d)},i.prototype.redAdd=function(d){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,d)},i.prototype.redIAdd=function(d){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,d)},i.prototype.redSub=function(d){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,d)},i.prototype.redISub=function(d){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,d)},i.prototype.redShl=function(d){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,d)},i.prototype.redMul=function(d){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.mul(this,d)},i.prototype.redIMul=function(d){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,d),this.red.imul(this,d)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(d){return n(this.red&&!d.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,d)};var C={k256:null,p224:null,p192:null,p25519:null};function k(x,d){this.name=x,this.p=new i(d,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}k.prototype._tmp=function(){var d=new i(null);return d.words=new Array(Math.ceil(this.n/13)),d},k.prototype.ireduce=function(d){var m=d,h;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),h=m.b
vendor: 4,309 bytes, line 28
28itLength();while(h>this.n);var g=h<this.n?-1:m.ucmp(this.p);return g===0?(m.words[0]=0,m.length=1):g>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},k.prototype.split=function(d,m){d.iushrn(this.n,0,m)},k.prototype.imulK=function(d){return d.imul(this.k)};function $(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a($,k),$.prototype.split=function(d,m){for(var h=4194303,g=Math.min(d.length,9),y=0;y<g;y++)m.words[y]=d.words[y];if(m.length=g,d.length<=9){d.words[0]=0,d.length=1;return}var _=d.words[9];for(m.words[m.length++]=_&h,y=10;y<d.length;y++){var R=d.words[y]|0;d.words[y-10]=(R&h)<<4|_>>>22,_=R}_>>>=22,d.words[y-10]=_,_===0&&d.length>10?d.length-=10:d.length-=9},$.prototype.imulK=function(d){d.words[d.length]=0,d.words[d.length+1]=0,d.length+=2;for(var m=0,h=0;h<d.length;h++){var g=d.words[h]|0;m+=g*977,d.words[h]=m&67108863,m=g*64+(m/67108864|0)}return d.words[d.length-1]===0&&(d.length--,d.words[d.length-1]===0&&d.length--),d};function G(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}a(G,k);function B(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}a(B,k);function M(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}a(M,k),M.prototype.imulK=function(d){for(var m=0,h=0;h<d.length;h++){var g=(d.words[h]|0)*19+m,y=g&67108863;g>>>=26,d.words[h]=y,m=g}return m!==0&&(d.words[d.length++]=m),d},i._prime=function(d){if(C[d])return C[d];var m;if(d==="k256")m=new $;else if(d==="p224")m=new G;else if(d==="p192")m=new B;else if(d==="p25519")m=new M;else throw new Error("Unknown prime "+d);return C[d]=m,m};function N(x){if(typeof x=="string"){var d=i._prime(x);this.m=d.p,this.prime=d}else n(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}N.prototype._verify1=function(d){n(d.negative===0,"red works only with positives"),n(d.red,"red works only with red numbers")},N.prototype._verify2=function(d,m){n((d.negative|m.negative)===0,"red works only with positives"),n(d.red&&d.red===m.red,"red works only with red numbers")},N.prototype.imod=function(d){return this.prime?this.prime.ireduce(d)._forceRed(this):d.umod(this.m)._forceRed(this)},N.prototype.neg=function(d){return d.isZero()?d.clone():this.m.sub(d)._forceRed(this)},N.prototype.add=function(d,m){this._verify2(d,m);var h=d.add(m);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},N.prototype.iadd=function(d,m){this._verify2(d,m);var h=d.iadd(m);return h.cmp(this.m)>=0&&h.isub(this.m),h},N.prototype.sub=function(d,m){this._verify2(d,m);var h=d.sub(m);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},N.prototype.isub=function(d,m){this._verify2(d,m);var h=d.isub(m);return h.cmpn(0)<0&&h.iadd(this.m),h},N.prototype.shl=function(d,m){return this._verify1(d),this.imod(d.ushln(m))},N.prototype.imul=function(d,m){return this._verify2(d,m),this.imod(d.imul(m))},N.prototype.mul=function(d,m){return this._verify2(d,m),this.imod(d.mul(m))},N.prototype.isqr=function(d){return this.imul(d,d.clone())},N.prototype.sqr=function(d){return this.mul(d,d)},N.prototype.sqrt=function(d){if(d.isZero())return d.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var h=this.m.add(new i(1)).iushrn(2);return this.pow(d,h)}for(var g=this.m.subn(1),y=0;!g.isZero()&&g.andln(1)===0;)y++,g.iushrn(1);n(!g.isZero());var _=new i(1).toRed(this),R=_.redNeg(),A=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new i(2*E*E).toRed(this);this.pow(E,A).cmp(R)!==0;)E.redIAdd(R);for(var L=this.pow(E,g),O=this.pow(d,g.addn(1).iushrn(1)),U=this.pow(d,g),X=y;U.cmp(_)!==0;){for(var J=U,j=0;J.cmp(_)!==0;j++)J=J.redSqr();n(j<X);var q=this.pow(L,new i(1).iushln(X-j-1));O=O.redMul(q),L=q.redSqr(),U=U.redMul(L),X=j}return O},N.prototype.invm=function(d){var m=d._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},N.prototype.pow=function(d,m){if(m.isZero())return new i(1).toRed(this);if(m.cmpn(1)===0)return d.clone();var h=4,g=new Array(1<<h);g[0]=new i(1).toRed(this),g[1]=d;for(var y=2;y<g.length;y++)g[y]=this.mul(g[y-1],d);var _=g[0],R=0,A=0,E=m.bitLength()%26;for(E===0&&(E=26),y=m.length-1;y>=0;y--){for(var L=m.words[y],O=E-1;O>=0;O--){var U=L>>O&1;if(_!==g[0]&&(_=this.sqr(_)),U===0&&R===0){A=0;continue}
28R<<=1,R|=U,A++,!(A!==h&&(y!==0||O!==0))&&(_=this.mul(_,g[R]),A=0,R=0)}E=26}return _},N.prototype.convertTo=function(d){var m=d.umod(this.m);return m===d?m.clone():m},N.prototype.convertFrom=function(d){var m=d.clone();return m.red=null,m},i.mont=function(d){return new P(d)};function P(x){N.call(this,x),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}a(P,N),P.prototype.convertTo=function(d){return this.imod(d.ushln(this.shift))},P.prototype.convertFrom=function(d){var m=this.imod(d.mul(this.rinv));return m.red=null,m},P.prototype.imul=function(d,m){if(d.isZero()||m.isZero())return d.words[0]=0,d.length=1,d;var h=d.imul(m),g=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=h.isub(g).iushrn(this.shift),_=y;return y.cmp(this.m)>=0?_=y.isub(this.m):y.cmpn(0)<0&&(_=y.iadd(this.m)),_._forceRed(this)},P.prototype.mul=function(d,m){if(d.isZero()||m.isZero())return new i(0)._forceRed(this);var h=d.mul(m),g=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),y=h.isub(g).iushrn(this.shift),_=y;return y.cmp(this.m)>=0?_=y.isub(this.m):y.cmpn(0)<0&&(_=y.iadd(this.m)),_._forceRed(this)},P.prototype.invm=function(d){var m=this.imod(d._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,DS)})(Uo)),Uo.exports}var So={exports:{}},_m;function Md(){if(_m)return So.exports;_m=1;var t;So.exports=function(a){return t||(t=new e(null)),t.generate(a)};function e(n){this.rand=n}if(So.exports.Rand=e,e.prototype.generate=function(a){return this._rand(a)},e.prototype._rand=function(a){if(this.rand.getBytes)return this.rand.getBytes(a);for(var i=new Uint8Array(a),s=0;s<i.length;s++)i[s]=this.rand.getByte();return i},typeof self=="object")self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(a){var i=new Uint8Array(a);return self.crypto.getRandomValues(i),i}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(a){var i=new Uint8Array(a);return self.msCrypto.getRandomValues(i),i}:typeof window=="object"&&(e.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=S3();if(typeof r.randomBytes!="function")throw new Error("Not supported");e.prototype._rand=function(a){return r.randomBytes(a)}}catch{}return So.exports}var zh,Em;function c3(){if(Em)return zh;Em=1;var t=er(),e=Md();function r(n){this.rand=n||new e.Rand}return zh=r,r.create=function(a){return new r(a)},r.prototype._randbelow=function(a){var i=a.bitLength(),s=Math.ceil(i/8);do var o=new t(this.rand.generate(s));while(o.cmp(a)>=0);return o},r.prototype._randrange=function(a,i){var s=i.sub(a);return a.add(this._randbelow(s))},r.prototype.test=function(a,i,s){var o=a.bitLength(),c=t.mont(a),u=new t(1).toRed(c);i||(i=Math.max(1,o/48|0));for(var f=a.subn(1),l=0;!f.testn(l);l++);for(var p=a.shrn(l),b=f.toRed(c),v=!0;i>0;i--){var w=this._randrange(new t(2),f);s&&s(w);var I=w.toRed(c).redPow(p);if(!(I.cmp(u)===0||I.cmp(b)===0)){for(var S=1;S<l;S++){if(I=I.redSqr(),I.cmp(u)===0)return!1;if(I.cmp(b)===0)break}if(S===l)return!1}}return v},r.prototype.getDivisor=function(a,i){var s=a.bitLength(),o=t.mont(a),c=new t(1).toRed(o);i||(i=Math.max(1,s/48|0));for(var u=a.subn(1),f=0;!u.testn(f);f++);for(var l=a.shrn(f),p=u.toRed(o);i>0;i--){var b=this._randrange(new t(2),u),v=a.gcd(b);if(v.cmpn(1)!==0)return v;var w=b.toRed(o).redPow(l);if(!(w.cmp(c)===0||w.cmp(p)===0)){for(var I=1;I<f;I++){if(w=w.redSqr(),w.cmp(c)===0)return w.fromRed().subn(1).gcd(a);if(w.cmp(p)===0)break}if(I===f)return w=w.redSqr(),w.fromRed().subn(1).gcd(a)}}return!1},zh}var Wh,Sm;function u3(){if(Sm)return Wh;Sm=1;var t=ts();Wh=I,I.simpleSieve=v,I.fermatTest=w;var e=er(),r=new e(24),n=c3(),a=new n,i=new e(1),s=new e(2),o=new e(5);new e(16),new e(8);var c=new e(10),u=new e(3);new e(7);var f=new e(11),l=new e(4);new e(12);var p=null;function b(){if(p!==null)return p;var S=1048576,T=[];T[0]=2;for(var C=1,k=3;k<S;k+=2){for(var $=Math.ceil(Math.sqrt(k)),G=0;G<C&&T[G]<=$&&k%T[G]!==0;G++);C!==G&&T[G]<=$||(T[C++]=k)}return p=T,T}
28function v(S){for(var T=b(),C=0;C<T.length;C++)if(S.modn(T[C])===0)return S.cmpn(T[C])===0;return!0}function w(S){var T=e.mont(S);return s.toRed(T).redPow(S.subn(1)).fromRed().cmpn(1)===0}function I(S,T){if(S<16)return T===2||T===5?new e([140,123]):new e([140,39]);T=new e(T);for(var C,k;;){for(C=new e(t(Math.ceil(S/8)));C.bitLength()>S;)C.ishrn(1);if(C.isEven()&&C.iadd(i),C.testn(1)||C.iadd(s),T.cmp(s)){if(!T.cmp(o))for(;C.mod(c).cmp(u);)C.iadd(l)}else for(;C.mod(r).cmp(f);)C.iadd(l);if(k=C.shrn(1),v(k)&&v(C)&&w(k)&&w(C)&&a.test(k)&&a.test(C))return C}}return Wh}const HS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},FS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},qS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},$S={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},KS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},GS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},jS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd4
2807b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},VS={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},zS={modp1:HS,modp2:FS,modp5:qS,modp14:$S,modp15:KS,modp16:GS,modp17:jS,modp18:VS};var Zh,xm;function WS(){if(xm)return Zh;xm=1;var t=er(),e=c3(),r=new e,n=new t(24),a=new t(11),i=new t(10),s=new t(3),o=new t(7),c=u3(),u=ts();Zh=v;function f(I,S){return S=S||"utf8",Fe.isBuffer(I)||(I=new Fe(I,S)),this._pub=new t(I),this}function l(I,S){return S=S||"utf8",Fe.isBuffer(I)||(I=new Fe(I,S)),this._priv=new t(I),this}var p={};function b(I,S){var T=S.toString("hex"),C=[T,I.toString(16)].join("_");if(C in p)return p[C];var k=0;if(I.isEven()||!c.simpleSieve||!c.fermatTest(I)||!r.test(I))return k+=1,T==="02"||T==="05"?k+=8:k+=4,p[C]=k,k;r.test(I.shrn(1))||(k+=2);var $;switch(T){case"02":I.mod(n).cmp(a)&&(k+=8);break;case"05":$=I.mod(i),$.cmp(s)&&$.cmp(o)&&(k+=8);break;default:k+=4}return p[C]=k,k}function v(I,S,T){this.setGenerator(S),this.__prime=new t(I),this._prime=t.mont(this.__prime),this._primeLen=I.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,T?(this.setPublicKey=f,this.setPrivateKey=l):this._primeCode=8}Object.defineProperty(v.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=b(this.__prime,this.__gen)),this._primeCode}}),v.prototype.generateKeys=function(){return this._priv||(this._priv=new t(u(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},v.prototype.computeSecret=function(I){I=new t(I),I=I.toRed(this._prime);var S=I.redPow(this._priv).fromRed(),T=new Fe(S.toArray()),C=this.getPrime();if(T.length<C.length){var k=new Fe(C.length-T.length);k.fill(0),T=Fe.concat([k,T])}return T},v.prototype.getPublicKey=function(S){return w(this._pub,S)},v.prototype.getPrivateKey=function(S){return w(this._priv,S)},v.prototype.getPrime=function(I){return w(this.__prime,I)},v.prototype.getGenerator=function(I){return w(this._gen,I)},v.prototype.setGenerator=function(I,S){return S=S||"utf8",Fe.isBuffer(I)||(I=new Fe(I,S)),this.__gen=I,this._gen=new t(I),this};function w(I,S){var T=new Fe(I.toArray());return S?T.toString(S):T}return Zh}var Am;function ZS(){if(Am)return Wi;Am=1;var t=u3(),e=zS,r=WS();function n(s){var o=new Fe(e[s].prime,"hex"),c=new Fe(e[s].gen,"hex");return new r(o,c)}var a={binary:!0,hex:!0,base64:!0};function i(s,o,c,u){return Fe.isBuffer(o)||a[o]===void 0?i(s,"binary",o,c):(o=o||"binary",u=u||"binary",c=c||new Fe([2]),Fe.isBuffer(c)||(c=new Fe(c,u)),typeof s=="number"?new r(t(s,c),c,!0):(Fe.isBuffer(s)||(s=new Fe(s,o)),new r(s,c,!0)))}return Wi.DiffieHellmanGroup=Wi.createDiffieHellmanGroup=Wi.getDiffieHellman=n,Wi.createDiffieHellman=Wi.DiffieHellman=i,Wi}var ds={exports:{}},Do={exports:{}},YS=Do.exports,Rm;function Cf(){return Rm||(Rm=1,(function(t){(function(e,r){function n(m,h){if(!m)throw new Error(h||"Assertion failed")}function a(m,h){m.super_=h;var g=function(){};g.prototype=h.prototype,m.prototype=new g,m.prototype.constructor=m}function i(m,h,g){if(i.isBN(m))return m;this.negative=0,this.words=null,this.length=0,this.red=null,m!==null&&((h==="le"||h==="be")&&(g=h,h=10),this._init(m||0,h||10,g||"be"))}
vendor: 40,630 bytes, line 28
28typeof e=="object"?e.exports=i:r.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Or().Buffer}catch{}i.isBN=function(h){return h instanceof i?!0:h!==null&&typeof h=="object"&&h.constructor.wordSize===i.wordSize&&Array.isArray(h.words)},i.max=function(h,g){return h.cmp(g)>0?h:g},i.min=function(h,g){return h.cmp(g)<0?h:g},i.prototype._init=function(h,g,y){if(typeof h=="number")return this._initNumber(h,g,y);if(typeof h=="object")return this._initArray(h,g,y);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),h=h.toString().replace(/\s+/g,"");var _=0;h[0]==="-"&&(_++,this.negative=1),_<h.length&&(g===16?this._parseHex(h,_,y):(this._parseBase(h,g,_),y==="le"&&this._initArray(this.toArray(),g,y)))},i.prototype._initNumber=function(h,g,y){h<0&&(this.negative=1,h=-h),h<67108864?(this.words=[h&67108863],this.length=1):h<4503599627370496?(this.words=[h&67108863,h/67108864&67108863],this.length=2):(n(h<9007199254740992),this.words=[h&67108863,h/67108864&67108863,1],this.length=3),y==="le"&&this._initArray(this.toArray(),g,y)},i.prototype._initArray=function(h,g,y){if(n(typeof h.length=="number"),h.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(h.length/3),this.words=new Array(this.length);for(var _=0;_<this.length;_++)this.words[_]=0;var R,A,E=0;if(y==="be")for(_=h.length-1,R=0;_>=0;_-=3)A=h[_]|h[_-1]<<8|h[_-2]<<16,this.words[R]|=A<<E&67108863,this.words[R+1]=A>>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);else if(y==="le")for(_=0,R=0;_<h.length;_+=3)A=h[_]|h[_+1]<<8|h[_+2]<<16,this.words[R]|=A<<E&67108863,this.words[R+1]=A>>>26-E&67108863,E+=24,E>=26&&(E-=26,R++);return this._strip()};function o(m,h){var g=m.charCodeAt(h);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+m)}function c(m,h,g){var y=o(m,g);return g-1>=h&&(y|=o(m,g-1)<<4),y}i.prototype._parseHex=function(h,g,y){this.length=Math.ceil((h.length-g)/6),this.words=new Array(this.length);for(var _=0;_<this.length;_++)this.words[_]=0;var R=0,A=0,E;if(y==="be")for(_=h.length-1;_>=g;_-=2)E=c(h,g,_)<<R,this.words[A]|=E&67108863,R>=18?(R-=18,A+=1,this.words[A]|=E>>>26):R+=8;else{var L=h.length-g;for(_=L%2===0?g+1:g;_<h.length;_+=2)E=c(h,g,_)<<R,this.words[A]|=E&67108863,R>=18?(R-=18,A+=1,this.words[A]|=E>>>26):R+=8}this._strip()};function u(m,h,g,y){for(var _=0,R=0,A=Math.min(m.length,g),E=h;E<A;E++){var L=m.charCodeAt(E)-48;_*=y,L>=49?R=L-49+10:L>=17?R=L-17+10:R=L,n(L>=0&&R<y,"Invalid character"),_+=R}return _}i.prototype._parseBase=function(h,g,y){this.words=[0],this.length=1;for(var _=0,R=1;R<=67108863;R*=g)_++;_--,R=R/g|0;for(var A=h.length-y,E=A%_,L=Math.min(A,A-E)+y,O=0,U=y;U<L;U+=_)O=u(h,U,U+_,g),this.imuln(R),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O);if(E!==0){var X=1;for(O=u(h,U,h.length,g),U=0;U<E;U++)X*=g;this.imuln(X),this.words[0]+O<67108864?this.words[0]+=O:this._iaddn(O)}this._strip()},i.prototype.copy=function(h){h.words=new Array(this.length);for(var g=0;g<this.length;g++)h.words[g]=this.words[g];h.length=this.length,h.negative=this.negative,h.red=this.red};function f(m,h){m.words=h.words,m.length=h.length,m.negative=h.negative,m.red=h.red}if(i.prototype._move=function(h){f(h,this)},i.prototype.clone=function(){var h=new i(null);return this.copy(h),h},i.prototype._expand=function(h){for(;this.length<h;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch{i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var p=["","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"],b=[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],v=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(h,g){h=h||10,g=g|0||1;var y;if(h===16||h==="hex"){y="";for(var _=0,R=0,A=0;A<this.length;A++){var E=this.words[A],L=((E<<_|R)&16777215).toString(16);R=E>>>24-_&16777215,_+=2,_>=26&&(_-=26,A--),R!==0||A!==this.length-1?y=p[6-L.length]+L+y:y=L+y}for(R!==0&&(y=R.toString(16)+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}if(h===(h|0)&&h>=2&&h<=36){var O=b[h],U=v[h];y="";var X=this.clone();for(X.negative=0;!X.isZero();){var J=X.modrn(U).toString(h);X=X.idivn(U),X.isZero()?y=J+y:y=p[O-J.length]+J+y}for(this.isZero()&&(y="0"+y);y.length%g!==0;)y="0"+y;return this.negative!==0&&(y="-"+y),y}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var h=this.words[0];return this.length===2?h+=this.words[1]*67108864:this.length===3&&this.words[2]===1?h+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-h:h},i.prototype.toJSON=function(){return this.toString(16,2)},s&&(i.prototype.toBuffer=function(h,g){return this.toArrayLike(s,h,g)}),i.prototype.toArray=function(h,g){return this.toArrayLike(Array,h,g)};var w=function(h,g){return h.allocUnsafe?h.allocUnsafe(g):new h(g)};i.prototype.toArrayLike=function(h,g,y){this._strip();var _=this.byteLength(),R=y||Math.max(1,_);n(_<=R,"byte array longer than desired length"),n(R>0,"Requested array length <= 0");var A=w(h,R),E=g==="le"?"LE":"BE";return this["_toArrayLike"+E](A,_),A},i.prototype._toArrayLikeLE=function(h,g){for(var y=0,_=0,R=0,A=0;R<this.length;R++){var E=this.words[R]<<A|_;h[y++]=E&255,y<h.length&&(h[y++]=E>>8&255),y<h.length&&(h[y++]=E>>16&255),A===6?(y<h.length&&(h[y++]=E>>24&255),_=0,A=0):(_=E>>>24,A+=2)}if(y<h.length)for(h[y++]=_;y<h.length;)h[y++]=0},i.prototype._toArrayLikeBE=function(h,g){for(var y=h.length-1,_=0,R=0,A=0;R<this.length;R++){var E=this.words[R]<<A|_;h[y--]=E&255,y>=0&&(h[y--]=E>>8&255),y>=0&&(h[y--]=E>>16&255),A===6?(y>=0&&(h[y--]=E>>24&255),_=0,A=0):(_=E>>>24,A+=2)}if(y>=0)for(h[y--]=_;y>=0;)h[y--]=0},Math.clz32?i.prototype._countBits=function(h){return 32-Math.clz32(h)}:i.prototype._countBits=function(h){var g=h,y=0;return g>=4096&&(y+=13,g>>>=13),g>=64&&(y+=7,g>>>=7),g>=8&&(y+=4,g>>>=4),g>=2&&(y+=2,g>>>=2),y+g},i.prototype._zeroBits=function(h){if(h===0)return 26;var g=h,y=0;return(g&8191)===0&&(y+=13,g>>>=13),(g&127)===0&&(y+=7,g>>>=7),(g&15)===0&&(y+=4,g>>>=4),(g&3)===0&&(y+=2,g>>>=2),(g&1)===0&&y++,y},i.prototype.bitLength=function(){var h=this.words[this.length-1],g=this._countBits(h);return(this.length-1)*26+g};function I(m){for(var h=new Array(m.bitLength()),g=0;g<h.length;g++){var y=g/26|0,_=g%26;h[g]=m.words[y]>>>_&1}return h}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var h=0,g=0;g<this.length;g++){var y=this._zeroBits(this.words[g]);if(h+=y,y!==26)break}return h},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(h){return this.negative!==0?this.abs().inotn(h).iaddn(1):this.clone()},i.prototype.fromTwos=function(h){return this.testn(h-1)?this.notn(h).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(h){for(;this.length<h.length;)this.words[this.length++]=0;for(var g=0;g<h.length;g++)this.words[g]=this.words[g]|h.words[g];return this._strip()},i.prototype.ior=function(h){return n((this.negative|h.negative)===0),this.iuor(h)},i.prototype.or=function(h){return this.length>h.length?this.clone().ior(h):h.clone().ior(this)},i.prototype.uor=function(h){return this.length>h.length?this.clone().iuor(h):h.clone().iuor(this)},i.prototype.iuand=function(h){var g;this.length>h.length?g=h:g=this;for(var y=0;y<g.length;y++)this.words[y]=this.words[y]&h.words[y];return this.length=g.length,this._strip()},i.prototype.iand=function(h){return n((this.negative|h.negative)===0),this.iuand(h)},i.prototype.and=function(h){return this.length>h.length?this.clone().iand(h):h.clone().iand(this)},i.prototype.uand=function(h){return this.length>h.length?this.clone().iuand(h):h.clone().iuand(this)},i.prototype.iuxor=function(h){var g,y;this.length>h.length?(g=this,y=h):(g=h,y=this);for(var _=0;_<y.length;_++)this.words[_]=g.words[_]^y.words[_];if(this!==g)for(;_<g.length;_++)this.words[_]=g.words[_];return this.length=g.length,this._strip()},i.prototype.ixor=function(h){return n((this.negative|h.negative)===0),this.iuxor(h)},i.prototype.xor=function(h){return this.length>h.length?this.clone().ixor(h):h.clone().ixor(this)},i.prototype.uxor=function(h){return this.length>h.length?this.clone().iuxor(h):h.clone().iuxor(this)},i.prototype.inotn=function(h){n(typeof h=="number"&&h>=0);var g=Math.ceil(h/26)|0,y=h%26;this._expand(g),y>0&&g--;for(var _=0;_<g;_++)this.words[_]=~this.words[_]&67108863;return y>0&&(this.words[_]=~this.words[_]&67108863>>26-y),this._strip()},i.prototype.notn=function(h){return this.clone().inotn(h)},i.prototype.setn=function(h,g){n(typeof h=="number"&&h>=0);var y=h/26|0,_=h%26;return this._expand(y+1),g?this.words[y]=this.words[y]|1<<_:this.words[y]=this.words[y]&~(1<<_),this._strip()},i.prototype.iadd=function(h){var g;if(this.negative!==0&&h.negative===0)return this.negative=0,g=this.isub(h),this.negative^=1,this._normSign();if(this.negative===0&&h.negative!==0)return h.negative=0,g=this.isub(h),h.negative=1,g._normSign();var y,_;this.length>h.length?(y=this,_=h):(y=h,_=this);for(var R=0,A=0;A<_.length;A++)g=(y.words[A]|0)+(_.words[A]|0)+R,this.words[A]=g&67108863,R=g>>>26;for(;R!==0&&A<y.length;A++)g=(y.words[A]|0)+R,this.words[A]=g&67108863,R=g>>>26;if(this.length=y.length,R!==0)this.words[this.length]=R,this.length++;else if(y!==this)for(;A<y.length;A++)this.words[A]=y.words[A];return this},i.prototype.add=function(h){var g;return h.negative!==0&&this.negative===0?(h.negative=0,g=this.sub(h),h.negative^=1,g):h.negative===0&&this.negative!==0?(this.negative=0,g=h.sub(this),this.negative=1,g):this.length>h.length?this.clone().iadd(h):h.clone().iadd(this)},i.prototype.isub=function(h){if(h.negative!==0){h.negative=0;var g=this.iadd(h);return h.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(h),this.negative=1,this._normSign();var y=this.cmp(h);if(y===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _,R;y>0?(_=this,R=h):(_=h,R=this);for(var A=0,E=0;E<R.length;E++)g=(_.words[E]|0)-(R.words[E]|0)+A,A=g>>26,this.words[E]=g&67108863;for(;A!==0&&E<_.length;E++)g=(_.words[E]|0)+A,A=g>>26,this.words[E]=g&67108863;if(A===0&&E<_.length&&_!==this)for(;E<_.length;E++)this.words[E]=_.words[E];return this.length=Math.max(this.length,E),_!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(h){return this.clone().isub(h)};function S(m,h,g){g.negative=h.negative^m.negative;var y=m.length+h.length|0;g.length=y,y=y-1|0;var _=m.words[0]|0,R=h.words[0]|0,A=_*R,E=A&67108863,L=A/67108864|0;g.words[0]=E;for(var O=1;O<y;O++){for(var U=L>>>26,X=L&67108863,J=Math.min(O,h.length-1),j=Math.max(0,O-m.length+1);j<=J;j++){var q=O-j|0;_=m.words[q]|0,R=h.words[j]|0,A=_*R+X,U+=A/67108864|0,X=A&67108863}g.words[O]=X|0,L=U|0}return L!==0?g.words[O]=L|0:g.length--,g._strip()}var T=function(h,g,y){var _=h.words,R=g.words,A=y.words,E=0,L,O,U,X=_[0]|0,J=X&8191,j=X>>>13,q=_[1]|0,V=q&8191,ee=q>>>13,ne=_[2]|0,W=ne&8191,z=ne>>>13,ae=_[3]|0,pe=ae&8191,ge=ae>>>13,be=_[4]|0,_e=be&8191,Ie=be>>>13,de=_[5]|0,Pe=de&8191,ye=de>>>13,we=_[6]|0,Ee=we&8191,ve=we>>>13,Be=_[7]|0,Ue=Be&8191,xe=Be>>>13,Ne=_[8]|0,Ke=Ne&8191,Z=Ne>>>13,D=_[9]|0,F=D&8191,Q=D>>>13,se=R[0]|0,ce=se&8191,he=se>>>13,Oe=R[1]|0,$e=Oe&8191,Te=Oe>>>13,Ve=R[2]|0,De=Ve&8191,ze=Ve>>>13,ut=R[3]|0,St=ut&8191,Je=ut>>>13,dt=R[4]|0,Rt=dt&8191,Y=dt>>>13,H=R[5]|0,K=H&8191,te=H>>>13,oe=R[6]|0,ue=oe&8191,le=oe>>>13,Le=R[7]|0,We=Le&8191,Me=Le>>>13,Ze=R[8]|0,qe=Ze&8191,rt=Ze>>>13,Mt=R[9]|0,Bt=Mt&8191,Tt=Mt>>>13;y.negative=h.negative^g.negative,y.length=19,L=Math.imul(J,ce),O=Math.imul(J,he),O=O+Math.imul(j,ce)|0,U=Math.imul(j,he);var Bi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Bi>>>26)|0,Bi&=67108863,L=Math.imul(V,ce),O=Math.imul(V,he),O=O+Math.imul(ee,ce)|0,U=Math.imul(ee,he),L=L+Math.imul(J,$e)|0,O=O+Math.imul(J,Te)|0,O=O+Math.imul(j,$e)|0,U=U+Math.imul(j,Te)|0;var Ti=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,L=Math.imul(W,ce),O=Math.imul(W,he),O=O+Math.imul(z,ce)|0,U=Math.imul(z,he),L=L+Math.imul(V,$e)|0,O=O+Math.imul(V,Te)|0,O=O+Math.imul(ee,$e)|0,U=U+Math.imul(ee,Te)|0,L=L+Math.imul(J,De)|0,O=O+Math.imul(J,ze)|0,O=O+Math.imul(j,De)|0,U=U+Math.imul(j,ze)|0;var Pi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,L=Math.imul(pe,ce),O=Math.imul(pe,he),O=O+Math.imul(ge,ce)|0,U=Math.imul(ge,he),L=L+Math.imul(W,$e)|0,O=O+Math.imul(W,Te)|0,O=O+Math.imul(z,$e)|0,U=U+Math.imul(z,Te)|0,L=L+Math.imul(V,De)|0,O=O+Math.imul(V,ze)|0,O=O+Math.imul(ee,De)|0,U=U+Math.imul(ee,ze)|0,L=L+Math.imul(J,St)|0,O=O+Math.imul(J,Je)|0,O=O+Math.imul(j,St)|0,U=U+Math.imul(j,Je)|0;var Mi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,L=Math.imul(_e,ce),O=Math.imul(_e,he),O=O+Math.imul(Ie,ce)|0,U=Math.imul(Ie,he),L=L+Math.imul(pe,$e)|0,O=O+Math.imul(pe,Te)|0,O=O+Math.imul(ge,$e)|0,U=U+Math.imul(ge,Te)|0,L=L+Math.imul(W,De)|0,O=O+Math.imul(W,ze)|0,O=O+Math.imul(z,De)|0,U=U+Math.imul(z,ze)|0,L=L+Math.imul(V,St)|0,O=O+Math.imul(V,Je)|0,O=O+Math.imul(ee,St)|0,U=U+Math.imul(ee,Je)|0,L=L+Math.imul(J,Rt)|0,O=O+Math.imul(J,Y)|0,O=O+Math.imul(j,Rt)|0,U=U+Math.imul(j,Y)|0;var Oi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,L=Math.imul(Pe,ce),O=Math.imul(Pe,he),O=O+Math.imul(ye,ce)|0,U=Math.imul(ye,he),L=L+Math.imul(_e,$e)|0,O=O+Math.imul(_e,Te)|0,O=O+Math.imul(Ie,$e)|0,U=U+Math.imul(Ie,Te)|0,L=L+Math.imul(pe,De)|0,O=O+Math.imul(pe,ze)|0,O=O+Math.imul(ge,De)|0,U=U+Math.imul(ge,ze)|0,L=L+Math.imul(W,St)|0,O=O+Math.imul(W,Je)|0,O=O+Math.imul(z,St)|0,U=U+Math.imul(z,Je)|0,L=L+Math.imul(V,Rt)|0,O=O+Math.imul(V,Y)|0,O=O+Math.imul(ee,Rt)|0,U=U+Math.imul(ee,Y)|0,L=L+Math.imul(J,K)|0,O=O+Math.imul(J,te)|0,O=O+Math.imul(j,K)|0,U=U+Math.imul(j,te)|0;var Li=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Li>>>26)|0,Li&=67108863,L=Math.imul(Ee,ce),O=Math.imul(Ee,he),O=O+Math.imul(ve,ce)|0,U=Math.imul(ve,he),L=L+Math.imul(Pe,$e)|0,O=O+Math.imul(Pe,Te)|0,O=O+Math.imul(ye,$e)|0,U=U+Math.imul(ye,Te)|0,L=L+Math.imul(_e,De)|0,O=O+Math.imul(_e,ze)|0,O=O+Math.imul(Ie,De)|0,U=U+Math.imul(Ie,ze)|0,L=L+Math.imul(pe,St)|0,O=O+Math.imul(pe,Je)|0,O=O+Math.imul(ge,St)|0,U=U+Math.imul(ge,Je)|0,L=L+Math.imul(W,Rt)|0,O=O+Math.imul(W,Y)|0,O=O+Math.imul(z,Rt)|0,U=U+Math.imul(z,Y)|0,L=L+Math.imul(V,K)|0,O=O+Math.imul(V,te)|0,O=O+Math.imul(ee,K)|0,U=U+Math.imul(ee,te)|0,L=L+Math.imul(J,ue)|0,O=O+Math.imul(J,le)|0,O=O+Math.imul(j,ue)|0,U=U+Math.imul(j,le)|0;var Ni=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Ni>>>26)|0,Ni&=67108863,L=Math.imul(Ue,ce),O=Math.imul(Ue,he),O=O+Math.imul(xe,ce)|0,U=Math.imul(xe,he),L=L+Math.imul(Ee,$e)|0,O=O+Math.imul(Ee,Te)|0,O=O+Math.imul(ve,$e)|0,U=U+Math.imul(ve,Te)|0,L=L+Math.imul(Pe,De)|0,O=O+Math.imul(Pe,ze)|0,O=O+Math.imul(ye,De)|0,U=U+Math.imul(ye,ze)|0,L=L+Math.imul(_e,St)|0,O=O+Math.imul(_e,Je)|0,O=O+Math.imul(Ie,St)|0,U=U+Math.imul(Ie,Je)|0,L=L+Math.imul(pe,Rt)|0,O=O+Math.imul(pe,Y)|0,O=O+Math.imul(ge,Rt)|0,U=U+Math.imul(ge,Y)|0,L=L+Math.imul(W,K)|0,O=O+Math.imul(W,te)|0,O=O+Math.imul(z,K)|0,U=U+Math.imul(z,te)|0,L=L+Math.imul(V,ue)|0,O=O+Math.imul(V,le)|0,O=O+Math.imul(ee,ue)|0,U=U+Math.imul(ee,le)|0,L=L+Math.imul(J,We)|0,O=O+Math.imul(J,Me)|0,O=O+Math.imul(j,We)|0,U=U+Math.imul(j,Me)|0;var ki=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(ki>>>26)|0,ki&=67108863,L=Math.imul(Ke,ce),O=Math.imul(Ke,he),O=O+Math.imul(Z,ce)|0,U=Math.imul(Z,he),L=L+Math.imul(Ue,$e)|0,O=O+Math.imul(Ue,Te)|0,O=O+Math.imul(xe,$e)|0,U=U+Math.imul(xe,Te)|0,L=L+Math.imul(Ee,De)|0,O=O+Math.imul(Ee,ze)|0,O=O+Math.imul(ve,De)|0,U=U+Math.imul(ve,ze)|0,L=L+Math.imul(Pe,St)|0,O=O+Math.imul(Pe,Je)|0,O=O+Math.imul(ye,St)|0,U=U+Math.imul(ye,Je)|0,L=L+Math.imul(_e,Rt)|0,O=O+Math.imul(_e,Y)|0,O=O+Math.imul(Ie,Rt)|0,U=U+Math.imul(Ie,Y)|0,L=L+Math.imul(pe,K)|0,O=O+Math.imul(pe,te)|0,O=O+Math.imul(ge,K)|0,U=U+Math.imul(ge,te)|0,L=L+Math.imul(W,ue)|0,O=O+Math.imul(W,le)|0,O=O+Math.imul(z,ue)|0,U=U+Math.imul(z,le)|0,L=L+Math.imul(V,We)|0,O=O+Math.imul(V,Me)|0,O=O+Math.imul(ee,We)|0,U=U+Math.imul(ee,Me)|0,L=L+Math.imul(J,qe)|0,O=O+Math.imul(J,rt)|0,O=O+Math.imul(j,qe)|0,U=U+Math.imul(j,rt)|0;var Ci=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Ci>>>26)|0,Ci&=67108863,L=Math.imul(F,ce),O=Math.imul(F,he),O=O+Math.imul(Q,ce)|0,U=Math.imul(Q,he),L=L+Math.imul(Ke,$e)|0,O=O+Math.imul(Ke,Te)|0,O=O+Math.imul(Z,$e)|0,U=U+Math.imul(Z,Te)|0,L=L+Math.imul(Ue,De)|0,O=O+Math.imul(Ue,ze)|0,O=O+Math.imul(xe,De)|0,U=U+Math.imul(xe,ze)|0,L=L+Math.imul(Ee,St)|0,O=O+Math.imul(Ee,Je)|0,O=O+Math.imul(ve,St)|0,U=U+Math.imul(ve,Je)|0,L=L+Math.imul(Pe,Rt)|0,O=O+Math.imul(Pe,Y)|0,O=O+Math.imul(ye,Rt)|0,U=U+Math.imul(ye,Y)|0,L=L+Math.imul(_e,K)|0,O=O+Math.imul(_e,te)|0,O=O+Math.imul(Ie,K)|0,U=U+Math.imul(Ie,te)|0,L=L+Math.imul(pe,ue)|0,O=O+Math.imul(pe,le)|0,O=O+Math.imul(ge,ue)|0,U=U+Math.imul(ge,le)|0,L=L+Math.imul(W,We)|0,O=O+Math.imul(W,Me)|0,O=O+Math.imul(z,We)|0,U=U+Math.imul(z,Me)|0,L=L+Math.imul(V,qe)|0,O=O+Math.imul(V,rt)|0,O=O+Math.imul(ee,qe)|0,U=U+Math.imul(ee,rt)|0,L=L+Math.imul(J,Bt)|0,O=O+Math.imul(J,Tt)|0,O=O+Math.imul(j,Bt)|0,U=U+Math.imul(j,Tt)|0;var Ui=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Ui>>>26)|0,Ui&=67108863,L=Math.imul(F,$e),O=Math.imul(F,Te),O=O+Math.imul(Q,$e)|0,U=Math.imul(Q,Te),L=L+Math.imul(Ke,De)|0,O=O+Math.imul(Ke,ze)|0,O=O+Math.imul(Z,De)|0,U=U+Math.imul(Z,ze)|0,L=L+Math.imul(Ue,St)|0,O=O+Math.imul(Ue,Je)|0,O=O+Math.imul(xe,St)|0,U=U+Math.imul(xe,Je)|0,L=L+Math.imul(Ee,Rt)|0,O=O+Math.imul(Ee,Y)|0,O=O+Math.imul(ve,Rt)|0,U=U+Math.imul(ve,Y)|0,L=L+Math.imul(Pe,K)|0,O=O+Math.imul(Pe,te)|0,O=O+Math.imul(ye,K)|0,U=U+Math.imul(ye,te)|0,L=L+Math.imul(_e,ue)|0,O=O+Math.imul(_e,le)|0,O=O+Math.imul(Ie,ue)|0,U=U+Math.imul(Ie,le)|0,L=L+Math.imul(pe,We)|0,O=O+Math.imul(pe,Me)|0,O=O+Math.imul(ge,We)|0,U=U+Math.imul(ge,Me)|0,L=L+Math.imul(W,qe)|0,O=O+Math.imul(W,rt)|0,O=O+Math.imul(z,qe)|0,U=U+Math.imul(z,rt)|0,L=L+Math.imul(V,Bt)|0,O=O+Math.imul(V,Tt)|0,O=O+Math.imul(ee,Bt)|0,U=U+Math.imul(ee,Tt)|0;var Di=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Di>>>26)|0,Di&=67108863,L=Math.imul(F,De),O=Math.imul(F,ze),O=O+Math.imul(Q,De)|0,U=Math.imul(Q,ze),L=L+Math.imul(Ke,St)|0,O=O+Math.imul(Ke,Je)|0,O=O+Math.imul(Z,St)|0,U=U+Math.imul(Z,Je)|0,L=L+Math.imul(Ue,Rt)|0,O=O+Math.imul(Ue,Y)|0,O=O+Math.imul(xe,Rt)|0,U=U+Math.imul(xe,Y)|0,L=L+Math.imul(Ee,K)|0,O=O+Math.imul(Ee,te)|0,O=O+Math.imul(ve,K)|0,U=U+Math.imul(ve,te)|0,L=L+Math.imul(Pe,ue)|0,O=O+Math.imul(Pe,le)|0,O=O+Math.imul(ye,ue)|0,U=U+Math.imul(ye,le)|0,L=L+Math.imul(_e,We)|0,O=O+Math.imul(_e,Me)|0,O=O+Math.imul(Ie,We)|0,U=U+Math.imul(Ie,Me)|0,L=L+Math.imul(pe,qe)|0,O=O+Math.imul(pe,rt)|0,O=O+Math.imul(ge,qe)|0,U=U+Math.imul(ge,rt)|0,L=L+Math.imul(W,Bt)|0,O=O+Math.imul(W,Tt)|0,O=O+Math.imul(z,Bt)|0,U=U+Math.imul(z,Tt)|0;var Hi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Hi>>>26)|0,Hi&=67108863,L=Math.imul(F,St),O=Math.imul(F,Je),O=O+Math.imul(Q,St)|0,U=Math.imul(Q,Je),L=L+Math.imul(Ke,Rt)|0,O=O+Math.imul(Ke,Y)|0,O=O+Math.imul(Z,Rt)|0,U=U+Math.imul(Z,Y)|0,L=L+Math.imul(Ue,K)|0,O=O+Math.imul(Ue,te)|0,O=O+Math.imul(xe,K)|0,U=U+Math.imul(xe,te)|0,L=L+Math.imul(Ee,ue)|0,O=O+Math.imul(Ee,le)|0,O=O+Math.imul(ve,ue)|0,U=U+Math.imul(ve,le)|0,L=L+Math.imul(Pe,We)|0,O=O+Math.imul(Pe,Me)|0,O=O+Math.imul(ye,We)|0,U=U+Math.imul(ye,Me)|0,L=L+Math.imul(_e,qe)|0,O=O+Math.imul(_e,rt)|0,O=O+Math.imul(Ie,qe)|0,U=U+Math.imul(Ie,rt)|0,L=L+Math.imul(pe,Bt)|0,O=O+Math.imul(pe,Tt)|0,O=O+Math.imul(ge,Bt)|0,U=U+Math.imul(ge,Tt)|0;var Fi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Fi>>>26)|0,Fi&=67108863,L=Math.imul(F,Rt),O=Math.imul(F,Y),O=O+Math.imul(Q,Rt)|0,U=Math.imul(Q,Y),L=L+Math.imul(Ke,K)|0,O=O+Math.imul(Ke,te)|0,O=O+Math.imul(Z,K)|0,U=U+Math.imul(Z,te)|0,L=L+Math.imul(Ue,ue)|0,O=O+Math.imul(Ue,le)|0,O=O+Math.imul(xe,ue)|0,U=U+Math.imul(xe,le)|0,L=L+Math.imul(Ee,We)|0,O=O+Math.imul(Ee,Me)|0,O=O+Math.imul(ve,We)|0,U=U+Math.imul(ve,Me)|0,L=L+Math.imul(Pe,qe)|0,O=O+Math.imul(Pe,rt)|0,O=O+Math.imul(ye,qe)|0,U=U+Math.imul(ye,rt)|0,L=L+Math.imul(_e,Bt)|0,O=O+Math.imul(_e,Tt)|0,O=O+Math.imul(Ie,Bt)|0,U=U+Math.imul(Ie,Tt)|0;var qi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(qi>>>26)|0,qi&=67108863,L=Math.imul(F,K),O=Math.imul(F,te),O=O+Math.imul(Q,K)|0,U=Math.imul(Q,te),L=L+Math.imul(Ke,ue)|0,O=O+Math.imul(Ke,le)|0,O=O+Math.imul(Z,ue)|0,U=U+Math.imul(Z,le)|0,L=L+Math.imul(Ue,We)|0,O=O+Math.imul(Ue,Me)|0,O=O+Math.imul(xe,We)|0,U=U+Math.imul(xe,Me)|0,L=L+Math.imul(Ee,qe)|0,O=O+Math.imul(Ee,rt)|0,O=O+Math.imul(ve,qe)|0,U=U+Math.imul(ve,rt)|0,L=L+Math.imul(Pe,Bt)|0,O=O+Math.imul(Pe,Tt)|0,O=O+Math.imul(ye,Bt)|0,U=U+Math.imul(ye,Tt)|0;var $i=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+($i>>>26)|0,$i&=67108863,L=Math.imul(F,ue),O=Math.imul(F,le),O=O+Math.imul(Q,ue)|0,U=Math.imul(Q,le),L=L+Math.imul(Ke,We)|0,O=O+Math.imul(Ke,Me)|0,O=O+Math.imul(Z,We)|0,U=U+Math.imul(Z,Me)|0,L=L+Math.imul(Ue,qe)|0,O=O+Math.imul(Ue,rt)|0,O=O+Math.imul(xe,qe)|0,U=U+Math.imul(xe,rt)|0,L=L+Math.imul(Ee,Bt)|0,O=O+Math.imul(Ee,Tt)|0,O=O+Math.imul(ve,Bt)|0,U=U+Math.imul(ve,Tt)|0;var Ki=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Ki>>>26)|0,Ki&=67108863,L=Math.imul(F,We),O=Math.imul(F,Me),O=O+Math.imul(Q,We)|0,U=Math.imul(Q,Me),L=L+Math.imul(Ke,qe)|0,O=O+Math.imul(Ke,rt)|0,O=O+Math.imul(Z,qe)|0,U=U+Math.imul(Z,rt)|0,L=L+Math.imul(Ue,Bt)|0,O=O+Math.imul(Ue,Tt)|0,O=O+Math.imul(xe,Bt)|0,U=U+Math.imul(xe,Tt)|0;var Gi=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Gi>>>26)|0,Gi&=67108863,L=Math.imul(F,qe),O=Math.imul(F,rt),O=O+Math.imul(Q,qe)|0,U=Math.imul(Q,rt),L=L+Math.imul(Ke,Bt)|0,O=O+Math.imul(Ke,Tt)|0,O=O+Math.imul(Z,Bt)|0,U=U+Math.imul(Z,Tt)|0;var Qf=(E+L|0)+((O&8191)<<13)|0;E=(U+(O>>>13)|0)+(Qf>>>26)|0,Qf&=67108863,L=Math.imul(F,Bt),O=Math.imul(F,Tt),O=O+Math.imul(Q,Bt)|0,U=Math.imul(Q,Tt);var ec=(E+L|0)+((O&8191)<<13)|0;return E=(U+(O>>>13)|0)+(ec>>>26)|0,ec&=67108863,A[0]=Bi,A[1]=Ti,A[2]=Pi,A[3]=Mi,A[4]=Oi,A[5]=Li,A[6]=Ni,A[7]=ki,A[8]=Ci,A[9]=Ui,A[10]=Di,A[11]=Hi,A[12]=Fi,A[13]=qi,A[14]=$i,A[15]=Ki,A[16]=Gi,A[17]=Qf,A[18]=ec,E!==0&&(A[19]=E,y.length++),y};Math.imul||(T=S);function C(m,h,g){g.negative=h.negative^m.negative,g.length=m.length+h.length;for(var y=0,_=0,R=0;R<g.length-1;R++){var A=_;_=0;for(var E=y&67108863,L=Math.min(R,h.length-1),O=Math.max(0,R-m.length+1);O<=L;O++){var U=R-O,X=m.words[U]|0,J=h.words[O]|0,j=X*J,q=j&67108863;A=A+(j/67108864|0)|0,q=q+E|0,E=q&67108863,A=A+(q>>>26)|0,_+=A>>>26,A&=67108863}g.words[R]=E,y=A,A=_}return y!==0?g.words[R]=y:g.length--,g._strip()}function k(m,h,g){return C(m,h,g)}i.prototype.mulTo=function(h,g){var y,_=this.length+h.length;return this.length===10&&h.length===10?y=T(this,h,g):_<63?y=S(this,h,g):_<1024?y=C(this,h,g):y=k(this,h,g),y},i.prototype.mul=function(h){var g=new i(null);return g.words=new Array(this.length+h.length),this.mulTo(h,g)},i.prototype.mulf=function(h){var g=new i(null);return g.words=new Array(this.length+h.length),k(this,h,g)},i.prototype.imul=function(h){return this.clone().mulTo(h,this)},i.prototype.imuln=function(h){var g=h<0;g&&(h=-h),n(typeof h=="number"),n(h<67108864);for(var y=0,_=0;_<this.length;_++){var R=(this.words[_]|0)*h,A=(R&67108863)+(y&67108863);y>>=26,y+=R/67108864|0,y+=A>>>26,this.words[_]=A&67108863}return y!==0&&(this.words[_]=y,this.length++),this.length=h===0?1:this.length,g?this.ineg():this},i.prototype.muln=function(h){return this.clone().imuln(h)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(h){var g=I(h);if(g.length===0)return new i(1);for(var y=this,_=0;_<g.length&&g[_]===0;_++,y=y.sqr());if(++_<g.length)for(var R=y.sqr();_<g.length;_++,R=R.sqr())g[_]!==0&&(y=y.mul(R));return y},i.prototype.iushln=function(h){n(typeof h=="number"&&h>=0);var g=h%26,y=(h-g)/26,_=67108863>>>26-g<<26-g,R;if(g!==0){var A=0;for(R=0;R<this.length;R++){var E=this.words[R]&_,L=(this.words[R]|0)-E<<g;this.words[R]=L|A,A=E>>>26-g}A&&(this.words[R]=A,this.length++)}if(y!==0){for(R=this.length-1;R>=0;R--)this.words[R+y]=this.words[R];for(R=0;R<y;R++)this.words[R]=0;this.length+=y}return this._strip()},i.prototype.ishln=function(h){return n(this.negative===0),this.iushln(h)},i.prototype.iushrn=function(h,g,y){n(typeof h=="number"&&h>=0);var _;g?_=(g-g%26)/26:_=0;var R=h%26,A=Math.min((h-R)/26,this.length),E=67108863^67108863>>>R<<R,L=y;if(_-=A,_=Math.max(0,_),L){for(var O=0;O<A;O++)L.words[O]=this.words[O];L.length=A}if(A!==0)if(this.length>A)for(this.length-=A,O=0;O<this.length;O++)this.words[O]=this.words[O+A];else this.words[0]=0,this.length=1;var U=0;for(O=this.length-1;O>=0&&(U!==0||O>=_);O--){var X=this.words[O]|0;this.words[O]=U<<26-R|X>>>R,U=X&E}return L&&U!==0&&(L.words[L.length++]=U),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(h,g,y){return n(this.negative===0),this.iushrn(h,g,y)},i.prototype.shln=function(h){return this.clone().ishln(h)},i.prototype.ushln=function(h){return this.clone().iushln(h)},i.prototype.shrn=function(h){return this.clone().ishrn(h)},i.prototype.ushrn=function(h){return this.clone().iushrn(h)},i.prototype.testn=function(h){n(typeof h=="number"&&h>=0);var g=h%26,y=(h-g)/26,_=1<<g;if(this.length<=y)return!1;var R=this.words[y];return!!(R&_)},i.prototype.imaskn=function(h){n(typeof h=="number"&&h>=0);var g=h%26,y=(h-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=y)return this;if(g!==0&&y++,this.length=Math.min(y,this.length),g!==0){var _=67108863^67108863>>>g<<g;this.words[this.length-1]&=_}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(h){return this.clone().imaskn(h)},i.prototype.iaddn=function(h){return n(typeof h=="number"),n(h<67108864),h<0?this.isubn(-h):this.negative!==0?this.length===1&&(this.words[0]|0)<=h?(this.words[0]=h-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(h),this.negative=1,this):this._iaddn(h)},i.prototype._iaddn=function(h){this.words[0]+=h;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},i.prototype.isubn=function(h){if(n(typeof h=="number"),n(h<67108864),h<0)return this.iaddn(-h);if(this.negative!==0)return this.negative=0,this.iaddn(h),this.negative=1,this;if(this.words[0]-=h,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this._strip()},i.prototype.addn=function(h){return this.clone().iaddn(h)},i.prototype.subn=function(h){return this.clone().isubn(h)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(h,g,y){var _=h.length+y,R;this._expand(_);var A,E=0;for(R=0;R<h.length;R++){A=(this.words[R+y]|0)+E;var L=(h.words[R]|0)*g;A-=L&67108863,E=(A>>26)-(L/67108864|0),this.words[R+y]=A&67108863}for(;R<this.length-y;R++)A=(this.words[R+y]|0)+E,E=A>>26,this.words[R+y]=A&67108863;if(E===0)return this._strip();for(n(E===-1),E=0,R=0;R<this.length;R++)A=-(this.words[R]|0)+E,E=A>>26,this.words[R]=A&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(h,g){var y=this.length-h.length,_=this.clone(),R=h,A=R.words[R.length-1]|0,E=this._countBits(A);y=26-E,y!==0&&(R=R.ushln(y),_.iushln(y),A=R.words[R.length-1]|0);var L=_.length-R.length,O;if(g!=="mod"){O=new i(null),O.length=L+1,O.words=new Array(O.length);for(var U=0;U<O.length;U++)O.words[U]=0}var X=_.clone()._ishlnsubmul(R,1,L);X.negative===0&&(_=X,O&&(O.words[L]=1));for(var J=L-1;J>=0;J--){var j=(_.words[R.length+J]|0)*67108864+(_.words[R.length+J-1]|0);for(j=Math.min(j/A|0,67108863),_._ishlnsubmul(R,j,J);_.negative!==0;)j--,_.negative=0,_._ishlnsubmul(R,1,J),_.isZero()||(_.negative^=1);O&&(O.words[J]=j)}return O&&O._strip(),_._strip(),g!=="div"&&y!==0&&_.iushrn(y),{div:O||null,mod:_}},i.prototype.divmod=function(h,g,y){if(n(!h.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var _,R,A;return this.negative!==0&&h.negative===0?(A=this.neg().divmod(h,g),g!=="mod"&&(_=A.div.neg()),g!=="div"&&(R=A.mod.neg(),y&&R.negative!==0&&R.iadd(h)),{div:_,mod:R}):this.negative===0&&h.negative!==0?(A=this.divmod(h.neg(),g),g!=="mod"&&(_=A.div.neg()),{div:_,mod:A.mod}):(this.negative&h.negative)!==0?(A=this.neg().divmod(h.neg(),g),g!=="div"&&(R=A.mod.neg(),y&&R.negative!==0&&R.isub(h)),{div:A.div,mod:R}):h.length>this.length||this.cmp(h)<0?{div:new i(0),mod:this}:h.length===1?g==="div"?{div:this.divn(h.words[0]),mod:null}:g==="mod"?{div:null,mod:new i(this.modrn(h.words[0]))}:{div:this.divn(h.words[0]),mod:new i(this.modrn(h.words[0]))}:this._wordDiv(h,g)},i.prototype.div=function(h){return this.divmod(h,"div",!1).div},i.prototype.mod=function(h){return this.divmod(h,"mod",!1).mod},i.prototype.umod=function(h){return this.divmod(h,"mod",!0).mod},i.prototype.divRound=function(h){var g=this.divmod(h);if(g.mod.isZero())return g.div;var y=g.div.negative!==0?g.mod.isub(h):g.mod,_=h.ushrn(1),R=h.andln(1),A=y.cmp(_);return A<0||R===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},i.prototype.modrn=function(h){var g=h<0;g&&(h=-h),n(h<=67108863);for(var y=(1<<26)%h,_=0,R=this.length-1;R>=0;R--)_=(y*_+(this.words[R]|0))%h;return g?-_:_},i.prototype.modn=function(h){return this.modrn(h)},i.prototype.idivn=function(h){var g=h<0;g&&(h=-h),n(h<=67108863);for(var y=0,_=this.length-1;_>=0;_--){var R=(this.words[_]|0)+y*67108864;this.words[_]=R/h|0,y=R%h}return this._strip(),g?this.ineg():this},i.prototype.divn=function(h){return this.clone().idivn(h)},i.prototype.egcd=function(h){n(h.negative===0),n(!h.isZero());var g=this,y=h.clone();g.negative!==0?g=g.umod(h):g=g.clone();for(var _=new i(1),R=new i(0),A=new i(0),E=new i(1),L=0;g.isEven()&&y.isEven();)g.iushrn(1),y.iushrn(1),++L;for(var O=y.clone(),U=g.clone();!g.isZero();){for(var X=0,J=1;(g.words[0]&J)===0&&X<26;++X,J<<=1);if(X>0)for(g.iushrn(X);X-- >0;)(_.isOdd()||R.isOdd())&&(_.iadd(O),R.isub(U)),_.iushrn(1),R.iushrn(1);for(var j=0,q=1;(y.words[0]&q)===0&&j<26;++j,q<<=1);if(j>0)for(y.iushrn(j);j-- >0;)(A.isOdd()||E.isOdd())&&(A.iadd(O),E.isub(U)),A.iushrn(1),E.iushrn(1);g.cmp(y)>=0?(g.isub(y),_.isub(A),R.isub(E)):(y.isub(g),A.isub(_),E.isub(R))}return{a:A,b:E,gcd:y.iushln(L)}},i.prototype._invmp=function(h){n(h.negative===0),n(!h.isZero());var g=this,y=h.clone();g.negative!==0?g=g.umod(h):g=g.clone();for(var _=new i(1),R=new i(0),A=y.clone();g.cmpn(1)>0&&y.cmpn(1)>0;){for(var E=0,L=1;(g.words[0]&L)===0&&E<26;++E,L<<=1);if(E>0)for(g.iushrn(E);E-- >0;)_.isOdd()&&_.iadd(A),_.iushrn(1);for(var O=0,U=1;(y.words[0]&U)===0&&O<26;++O,U<<=1);if(O>0)for(y.iushrn(O);O-- >0;)R.isOdd()&&R.iadd(A),R.iushrn(1);g.cmp(y)>=0?(g.isub(y),_.isub(R)):(y.isub(g),R.isub(_))}var X;return g.cmpn(1)===0?X=_:X=R,X.cmpn(0)<0&&X.iadd(h),X},i.prototype.gcd=function(h){if(this.isZero())return h.abs();if(h.isZero())return this.abs();var g=this.clone(),y=h.clone();g.negative=0,y.negative=0;for(var _=0;g.isEven()&&y.isEven();_++)g.iushrn(1),y.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;y.isEven();)y.iushrn(1);var R=g.cmp(y);if(R<0){var A=g;g=y,y=A}else if(R===0||y.cmpn(1)===0)break;g.isub(y)}while(!0);return y.iushln(_)},i.prototype.invm=function(h){return this.egcd(h).a.umod(h)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(h){return this.words[0]&h},i.prototype.bincn=function(h){n(typeof h=="number");var g=h%26,y=(h-g)/26,_=1<<g;if(this.length<=y)return this._expand(y+1),this.words[y]|=_,this;for(var R=_,A=y;R!==0&&A<this.length;A++){var E=this.words[A]|0;E+=R,R=E>>>26,E&=67108863,this.words[A]=E}return R!==0&&(this.words[A]=R,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(h){var g=h<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var y;if(this.length>1)y=1;else{g&&(h=-h),n(h<=67108863,"Number is too big");var _=this.words[0]|0;y=_===h?0:_<h?-1:1}return this.negative!==0?-y|0:y},i.prototype.cmp=function(h){if(this.negative!==0&&h.negative===0)return-1;if(this.negative===0&&h.negative!==0)return 1;var g=this.ucmp(h);return this.negative!==0?-g|0:g},i.prototype.ucmp=function(h){if(this.length>h.length)return 1;if(this.length<h.length)return-1;for(var g=0,y=this.length-1;y>=0;y--){var _=this.words[y]|0,R=h.words[y]|0;if(_!==R){_<R?g=-1:_>R&&(g=1);break}}return g},i.prototype.gtn=function(h){return this.cmpn(h)===1},i.prototype.gt=function(h){return this.cmp(h)===1},i.prototype.gten=function(h){return this.cmpn(h)>=0},i.prototype.gte=function(h){return this.cmp(h)>=0},i.prototype.ltn=function(h){return this.cmpn(h)===-1},i.prototype.lt=function(h){return this.cmp(h)===-1},i.prototype.lten=function(h){return this.cmpn(h)<=0},i.prototype.lte=function(h){return this.cmp(h)<=0},i.prototype.eqn=function(h){return this.cmpn(h)===0},i.prototype.eq=function(h){return this.cmp(h)===0},i.red=function(h){return new x(h)},i.prototype.toRed=function(h){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),h.convertTo(this)._forceRed(h)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(h){return this.red=h,this},i.prototype.forceRed=function(h){return n(!this.red,"Already a number in reduction context"),this._forceRed(h)},i.prototype.redAdd=function(h){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,h)},i.prototype.redIAdd=function(h){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,h)},i.prototype.redSub=function(h){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,h)},i.prototype.redISub=function(h){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,h)},i.prototype.redShl=function(h){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,h)},i.prototype.redMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.mul(this,h)},i.prototype.redIMul=function(h){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,h),this.red.imul(this,h)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(h){return n(this.red&&!h.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,h)};var $={k256:null,p224:null,p192:null,p25519:null};function G(m,h){this.name=m,this.p=new i(h,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var h=new i(null);return h.words=new Array(Math.ceil(this.n/13)),h},G.prototype.ireduce=function(h){var g=h,y;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),y=g.bitLength();while(y>this.n);var _=y<this.n?-1:g.ucmp(this.p);return _===0?(g.words[0]=0,g.length=1):_>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},G.prototype.split=function(h,g){h.iushrn(this.n,0,g)},G.prototype.imulK=function(h){return h.imul(this.k)};function B(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}a(B,G),B.prototype.split=function(h,g){for(var y=4194303,_=Math.min(h.length,9),R=0;R<_;R++)g.words[R]=h.words[R];if(g.length=_,h.length<=9){h.words[0]=0,h.length=1;return}var A=h.words[9];for(g.words[g.length++]=A&y,R=10;R<h.length;R++){var E=h.words[R]|0;h.words[R-10]=(E&y)<<4|A>>>22,A=E}A>>>=22,h.words[R-10]=A,A===0&&h.length>10?h.length-=10:h.length-=9},B.prototype.imulK=function(h){h.words[h.length]=0,h.words[h.length+1]=0,h.length+=2;for(var g=0,y=0;y<h.length;y++){var _=h.words[y]|0;g+=_*977,h.words[y]=g&67108863,g=_*64+(g/67108864|0)}return h.words[h.length-1]===0&&(h.length--,h.words[h.length-1]===0&&h.length--),h};function M(){G.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}a(M,G);function N(){G.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}a(N,G);function P(){G.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}a(P,G),P.prototype.imulK=function(h){for(var g=0,y=0;y<h.length;y++){var _=(h.words[y]|0)*19+g,R=_&67108863;_>>>=26,h.words[y]=R,g=_}return g!==0&&(h.words[h.length++]=g),h},i._prime=function(h){if($[h])return $[h];var g;if(h==="k256")g=new B;else if(h==="p224")g=new M;else if(h==="p192")g=new N;else if(h==="p25519")g=new P;else throw new Error("Unknown prime "+h);return $[h]=g,g};function x(m){if(typeof m=="string"){var h=i._prime(m);this.m=h.p,this.prime=h}else n(m.gtn(1),"modulus must be greater than 1"),this.m=m,this.prime=null}x.prototype._verify1=function(h){n(h.negative===0,"red works only with positives"),n(h.red,"red works only with red numbers")},x.prototype._verify2=function(h,g){n((h.negative|g.negative)===0,"red works only with positives"),n(h.red&&h.red===g.red,"red works only with red numbers")},x.prototype.imod=function(h){return this.prime?this.prime.ireduce(h)._forceRed(this):(f(h,h.umod(this.m)._forceRed(this)),h)},x.prototype.neg=function(h){return h.isZero()?h.clone():this.m.sub(h)._forceRed(this)},x.prototype.add=function(h,g){this._verify2(h,g);var y=h.add(g);return y.cmp(this.m)>=0&&y.isub(this.m),y._forceRed(this)},x.prototype.iadd=function(h,g){this._verify2(h,g);var y=h.iadd(g);return y.cmp(this.m)>=0&&y.isub(this.m),y},x.prototype.sub=function(h,g){this._verify2(h,g);var y=h.sub(g);return y.cmpn(0)<0&&y.iadd(this.m),y._forceRed(this)},x.prototype.isub=function(h,g){this._verify2(h,g);var y=h.isub(g);return y.cmpn(0)<0&&y.iadd(this.m),y},x.prototype.shl=function(h,g){return this._verify1(h),this.imod(h.ushln(g))},x.prototype.imul=function(h,g){return this._verify2(h,g),this.imod(h.imul(g))},x.prototype.mul=function(h,g){return this._verify2(h,g),this.imod(h.mul(g))},x.prototype.isqr=function(h){return this.imul(h,h.clone())},x.prototype.sqr=function(h){return this.mul(h,h)},x.prototype.sqrt=function(h){if(h.isZero())return h.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var y=this.m.add(new i(1)).iushrn(2);return this.pow(h,y)}for(var _=this.m.subn(1),R=0;!_.isZero()&&_.andln(1)===0;)R++,_.iushrn(1);n(!_.isZero());var A=new i(1).toRed(this),E=A.redNeg(),L=this.m.subn(1).iushrn(1),O=this.m.bitLength();for(O=new i(2*O*O).toRed(this);this.pow(O,L).cmp(E)!==0;)O.redIAdd(E);for(var U=this.pow(O,_),X=this.pow(h,_.addn(1).iushrn(1)),J=this.pow(h,_),j=R;J.cmp(A)!==0;){for(var q=J,V=0;q.cmp(A)!==0;V++)q=q.redSqr();n(V<j);var ee=this.pow(U,new i(1).iushln(j-V-1));X=X.redMul(ee),U=ee.redSqr(),J=J.redMul(U),j=V}return X},x.prototype.invm=function(h){var g=h._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},x.prototype.pow=function(h,g){if(g.isZero())return new i(1).toRed(this);if(g.cmpn(1)===0)return h.clone();
28var y=4,_=new Array(1<<y);_[0]=new i(1).toRed(this),_[1]=h;for(var R=2;R<_.length;R++)_[R]=this.mul(_[R-1],h);var A=_[0],E=0,L=0,O=g.bitLength()%26;for(O===0&&(O=26),R=g.length-1;R>=0;R--){for(var U=g.words[R],X=O-1;X>=0;X--){var J=U>>X&1;if(A!==_[0]&&(A=this.sqr(A)),J===0&&E===0){L=0;continue}E<<=1,E|=J,L++,!(L!==y&&(R!==0||X!==0))&&(A=this.mul(A,_[E]),L=0,E=0)}O=26}return A},x.prototype.convertTo=function(h){var g=h.umod(this.m);return g===h?g.clone():g},x.prototype.convertFrom=function(h){var g=h.clone();return g.red=null,g},i.mont=function(h){return new d(h)};function d(m){x.call(this,m),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}a(d,x),d.prototype.convertTo=function(h){return this.imod(h.ushln(this.shift))},d.prototype.convertFrom=function(h){var g=this.imod(h.mul(this.rinv));return g.red=null,g},d.prototype.imul=function(h,g){if(h.isZero()||g.isZero())return h.words[0]=0,h.length=1,h;var y=h.imul(g),_=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=y.isub(_).iushrn(this.shift),A=R;return R.cmp(this.m)>=0?A=R.isub(this.m):R.cmpn(0)<0&&(A=R.iadd(this.m)),A._forceRed(this)},d.prototype.mul=function(h,g){if(h.isZero()||g.isZero())return new i(0)._forceRed(this);var y=h.mul(g),_=y.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),R=y.isub(_).iushrn(this.shift),A=R;return R.cmp(this.m)>=0?A=R.isub(this.m):R.cmpn(0)<0&&(A=R.iadd(this.m)),A._forceRed(this)},d.prototype.invm=function(h){var g=this.imod(h._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,YS)})(Do)),Do.exports}var Yh,Im;function Od(){if(Im)return Yh;Im=1;var t=Cf(),e=ts(),r=et().Buffer;function n(s){var o=s.modulus.byteLength(),c;do c=new t(e(o));while(c.cmp(s.modulus)>=0||!c.umod(s.prime1)||!c.umod(s.prime2));return c}function a(s){var o=n(s),c=o.toRed(t.mont(s.modulus)).redPow(new t(s.publicExponent)).fromRed();return{blinder:c,unblinder:o.invm(s.modulus)}}function i(s,o){var c=a(o),u=o.modulus.byteLength(),f=new t(s).mul(c.blinder).umod(o.modulus),l=f.toRed(t.mont(o.prime1)),p=f.toRed(t.mont(o.prime2)),b=o.coefficient,v=o.prime1,w=o.prime2,I=l.redPow(o.exponent1).fromRed(),S=p.redPow(o.exponent2).fromRed(),T=I.isub(S).imul(b).umod(v).imul(w);return S.iadd(T).imul(c.unblinder).umod(o.modulus).toArrayLike(r,"be",u)}return i.getr=n,Yh=i,Yh}var Xh={};const XS="6.6.1",JS={version:XS};var Jh={},Qh={},Bm;function h3(){return Bm||(Bm=1,(function(t){var e=t;function r(i,s){if(Array.isArray(i))return i.slice();if(!i)return[];var o=[];if(typeof i!="string"){for(var c=0;c<i.length;c++)o[c]=i[c]|0;return o}if(s==="hex"){i=i.replace(/[^a-z0-9]+/ig,""),i.length%2!==0&&(i="0"+i);for(var c=0;c<i.length;c+=2)o.push(parseInt(i[c]+i[c+1],16))}else for(var c=0;c<i.length;c++){var u=i.charCodeAt(c),f=u>>8,l=u&255;f?o.push(f,l):o.push(l)}return o}e.toArray=r;function n(i){return i.length===1?"0"+i:i}e.zero2=n;function a(i){for(var s="",o=0;o<i.length;o++)s+=n(i[o].toString(16));return s}e.toHex=a,e.encode=function(s,o){return o==="hex"?a(s):s}})(Qh)),Qh}var Tm;function Nr(){return Tm||(Tm=1,(function(t){var e=t,r=er(),n=Lr(),a=h3();e.assert=n,e.toArray=a.toArray,e.zero2=a.zero2,e.toHex=a.toHex,e.encode=a.encode;function i(f,l,p){var b=new Array(Math.max(f.bitLength(),p)+1),v;for(v=0;v<b.length;v+=1)b[v]=0;var w=1<<l+1,I=f.clone();for(v=0;v<b.length;v++){var S,T=I.andln(w-1);I.isOdd()?(T>(w>>1)-1?S=(w>>1)-T:S=T,I.isubn(S)):S=0,b[v]=S,I.iushrn(1)}return b}e.getNAF=i;function s(f,l){var p=[[],[]];f=f.clone(),l=l.clone();for(var b=0,v=0,w;f.cmpn(-b)>0||l.cmpn(-v)>0;){var I=f.andln(3)+b&3,S=l.andln(3)+v&3;I===3&&(I=-1),S===3&&(S=-1);var T;(I&1)===0?T=0:(w=f.andln(7)+b&7,(w===3||w===5)&&S===2?T=-I:T=I),p[0].push(T);var C;(S&1)===0?C=0:(w=l.andln(7)+v&7,(w===3||w===5)&&I===2?C=-S:C=S),p[1].push(C),2*b===T+1&&(b=1-b),2*v===C+1&&(v=1-v),f.iushrn(1),l.iushrn(1)}return p}e.getJSF=s;function o(f,l,p){var b="_"+l;f.prototype[l]=function(){return this[b]!==void 0?this[b]:this[b]=p.call(this)}}e.cachedProperty=o;function c(f){return typeof f=="string"?e.toArray(f,"hex"):f}e.parseBytes=c;function u(f){return new r(f,"hex","le")}e.intFromLE=u})(Jh)),Jh}var el={},tl,Pm;function Uf(){if(Pm)return tl;Pm=1;var t=er(),e=Nr(),r=e.getNAF,n=e.getJSF,a=e.assert;function i(o,c){this.type=o,this.p=new t(c.p,16),this.red=c.prime?t.red(c.prime):t.mont(this.p),this.zero=new t(0).toRed(this.red),this.one=new t(1).toRed(this.red),this.two=new t(2).toRed(this.red),this.n=c.n&&new t(c.n,16),this.g=c.g&&this.pointFromJSON(c.g,c.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var u=this.n&&this.p.div(this.n);!u||u.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}tl=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(c,u){a(c.precomputed);var f=c._getDoubles(),l=r(u,1,this._bitLength),p=(1<<f.step+1)-(f.step%2===0?2:1);p/=3;var b=[],v,w;for(v=0;v<l.length;v+=f.step){w=0;for(var I=v+f.step-1;I>=v;I--)w=(w<<1)+l[I];b.push(w)}for(var S=this.jpoint(null,null,null),T=this.jpoint(null,null,null),C=p;C>0;C--){for(v=0;v<b.length;v++)w=b[v],w===C?T=T.mixedAdd(f.points[v]):w===-C&&(T=T.mixedAdd(f.points[v].neg()));S=S.add(T)}return S.toP()},i.prototype._wnafMul=function(c,u){var f=4,l=c._getNAFPoints(f);f=l.wnd;for(var p=l.points,b=r(u,f,this._bitLength),v=this.jpoint(null,null,null),w=b.length-1;w>=0;w--){for(var I=0;w>=0&&b[w]===0;w--)I++;if(w>=0&&I++,v=v.dblp(I),w<0)break;var S=b[w];a(S!==0),c.type==="affine"?S>0?v=v.mixedAdd(p[S-1>>1]):v=v.mixedAdd(p[-S-1>>1].neg()):S>0?v=v.add(p[S-1>>1]):v=v.add(p[-S-1>>1].neg())}return c.type==="affine"?v.toP():v},i.prototype._wnafMulAdd=function(c,u,f,l,p){var b=this._wnafT1,v=this._wnafT2,w=this._wnafT3,I=0,S,T,C;for(S=0;S<l;S++){C=u[S];var k=C._getNAFPoints(c);b[S]=k.wnd,v[S]=k.points}for(S=l-1;S>=1;S-=2){var $=S-1,G=S;if(b[$]!==1||b[G]!==1){w[$]=r(f[$],b[$],this._bitLength),w[G]=r(f[G],b[G],this._bitLength),I=Math.max(w[$].length,I),I=Math.max(w[G].length,I);continue}
28var B=[u[$],null,null,u[G]];u[$].y.cmp(u[G].y)===0?(B[1]=u[$].add(u[G]),B[2]=u[$].toJ().mixedAdd(u[G].neg())):u[$].y.cmp(u[G].y.redNeg())===0?(B[1]=u[$].toJ().mixedAdd(u[G]),B[2]=u[$].add(u[G].neg())):(B[1]=u[$].toJ().mixedAdd(u[G]),B[2]=u[$].toJ().mixedAdd(u[G].neg()));var M=[-3,-1,-5,-7,0,7,5,1,3],N=n(f[$],f[G]);for(I=Math.max(N[0].length,I),w[$]=new Array(I),w[G]=new Array(I),T=0;T<I;T++){var P=N[0][T]|0,x=N[1][T]|0;w[$][T]=M[(P+1)*3+(x+1)],w[G][T]=0,v[$]=B}}var d=this.jpoint(null,null,null),m=this._wnafT4;for(S=I;S>=0;S--){for(var h=0;S>=0;){var g=!0;for(T=0;T<l;T++)m[T]=w[T][S]|0,m[T]!==0&&(g=!1);if(!g)break;h++,S--}if(S>=0&&h++,d=d.dblp(h),S<0)break;for(T=0;T<l;T++){var y=m[T];y!==0&&(y>0?C=v[T][y-1>>1]:y<0&&(C=v[T][-y-1>>1].neg()),C.type==="affine"?d=d.mixedAdd(C):d=d.add(C))}}for(S=0;S<l;S++)v[S]=null;return p?d:d.toP()};function s(o,c){this.curve=o,this.type=c,this.precomputed=null}return i.BasePoint=s,s.prototype.eq=function(){throw new Error("Not implemented")},s.prototype.validate=function(){return this.curve.validate(this)},i.prototype.decodePoint=function(c,u){c=e.toArray(c,u);var f=this.p.byteLength();if((c[0]===4||c[0]===6||c[0]===7)&&c.length-1===2*f){c[0]===6?a(c[c.length-1]%2===0):c[0]===7&&a(c[c.length-1]%2===1);var l=this.point(c.slice(1,1+f),c.slice(1+f,1+2*f));return l}else if((c[0]===2||c[0]===3)&&c.length-1===f)return this.pointFromX(c.slice(1,1+f),c[0]===3);throw new Error("Unknown point format")},s.prototype.encodeCompressed=function(c){return this.encode(c,!0)},s.prototype._encode=function(c){var u=this.curve.p.byteLength(),f=this.getX().toArray("be",u);return c?[this.getY().isEven()?2:3].concat(f):[4].concat(f,this.getY().toArray("be",u))},s.prototype.encode=function(c,u){return e.encode(this._encode(u),c)},s.prototype.precompute=function(c){if(this.precomputed)return this;var u={doubles:null,naf:null,beta:null};return u.naf=this._getNAFPoints(8),u.doubles=this._getDoubles(4,c),u.beta=this._getBeta(),this.precomputed=u,this},s.prototype._hasDoubles=function(c){if(!this.precomputed)return!1;var u=this.precomputed.doubles;return u?u.points.length>=Math.ceil((c.bitLength()+1)/u.step):!1},s.prototype._getDoubles=function(c,u){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var f=[this],l=this,p=0;p<u;p+=c){for(var b=0;b<c;b++)l=l.dbl();f.push(l)}return{step:c,points:f}},s.prototype._getNAFPoints=function(c){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var u=[this],f=(1<<c)-1,l=f===1?null:this.dbl(),p=1;p<f;p++)u[p]=u[p-1].add(l);return{wnd:c,points:u}},s.prototype._getBeta=function(){return null},s.prototype.dblp=function(c){for(var u=this,f=0;f<c;f++)u=u.dbl();return u},tl}var rl,Mm;function QS(){if(Mm)return rl;Mm=1;var t=Nr(),e=er(),r=Ye(),n=Uf(),a=t.assert;function i(c){n.call(this,"short",c),this.a=new e(c.a,16).toRed(this.red),this.b=new e(c.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(c),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}r(i,n),rl=i,i.prototype._getEndomorphism=function(u){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var f,l;if(u.beta)f=new e(u.beta,16).toRed(this.red);else{var p=this._getEndoRoots(this.p);f=p[0].cmp(p[1])<0?p[0]:p[1],f=f.toRed(this.red)}if(u.lambda)l=new e(u.lambda,16);else{var b=this._getEndoRoots(this.n);this.g.mul(b[0]).x.cmp(this.g.x.redMul(f))===0?l=b[0]:(l=b[1],a(this.g.mul(l).x.cmp(this.g.x.redMul(f))===0))}var v;return u.basis?v=u.basis.map(function(w){return{a:new e(w.a,16),b:new e(w.b,16)}}):v=this._getEndoBasis(l),{beta:f,lambda:l,basis:v}}},i.prototype._getEndoRoots=function(u){var f=u===this.p?this.red:e.mont(u),l=new e(2).toRed(f).redInvm(),p=l.redNeg(),b=new e(3).toRed(f).redNeg().redSqrt().redMul(l),v=p.redAdd(b).fromRed(),w=p.redSub(b).fromRed();return[v,w]},i.prototype._getEndoBasis=function(u){for(var f=this.n.ushrn(Math.floor(this.n.bitLength()/2)),l=u,p=this.n.clone(),b=new e(1),v=new e(0),w=new e(0),I=new e(1),S,T,C,k,$,G,B,M=0,N,P;l.cmpn(0)!==0;){var x=p.div(l);N=p.sub(x.mul(l)),P=w.sub(x.mul(b));var d=I.sub(x.mul(v));if(!C&&N.cmp(f)<0)S=B.neg(),T=b,C=N.neg(),k=P;else if(C&&++M===2)break;B=N,p=l,l=N,w=b,b=P,I=v,v=d}$=N.neg(),G=P;var m=C.sqr().add(k.sqr()),h=$.sqr().add(G.sqr());return h.cmp(m)>=0&&($=S,G=T),C.negative&&(C=C.neg(),k=k.neg()),$.negative&&($=$.neg(),G=G.neg()),[{a:C,b:k},{a:$,b:G}]},i.prototype._endoSplit=function(u){var f=this.endo.basis,l=f[0],p=f[1],b=p.b.mul(u).divRound(this.n),v=l.b.neg().mul(u).divRound(this.n),w=b.mul(l.a),I=v.mul(p.a),S=b.mul(l.b),T=v.mul(p.b),C=u.sub(w).sub(I),k=S.add(T).neg();return{k1:C,k2:k}},i.prototype.pointFromX=function(u,f){u=new e(u,16),u.red||(u=u.toRed(this.red));var l=u.redSqr().redMul(u).redIAdd(u.redMul(this.a)).redIAdd(this.b),p=l.redSqrt();if(p.redSqr().redSub(l).cmp(this.zero)!==0)throw new Error("invalid point");var b=p.fromRed().isOdd();return(f&&!b||!f&&b)&&(p=p.redNeg()),this.point(u,p)},i.prototype.validate=function(u){if(u.inf)return!0;var f=u.x,l=u.y,p=this.a.redMul(f),b=f.redSqr().redMul(f).redIAdd(p).redIAdd(this.b);return l.redSqr().redISub(b).cmpn(0)===0},i.prototype._endoWnafMulAdd=function(u,f,l){for(var p=this._endoWnafT1,b=this._endoWnafT2,v=0;v<u.length;v++){var w=this._endoSplit(f[v]),I=u[v],S=I._getBeta();w.k1.negative&&(w.k1.ineg(),I=I.neg(!0)),w.k2.negative&&(w.k2.ineg(),S=S.neg(!0)),p[v*2]=I,p[v*2+1]=S,b[v*2]=w.k1,b[v*2+1]=w.k2}for(var T=this._wnafMulAdd(1,p,b,v*2,l),C=0;C<v*2;C++)p[C]=null,b[C]=null;return T};function s(c,u,f,l){n.BasePoint.call(this,c,"affine"),u===null&&f===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new e(u,16),this.y=new e(f,16),l&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}r(s,n.BasePoint),i.prototype.point=function(u,f,l){return new s(this,u,f,l)},i.prototype.pointFromJSON=function(u,f){return s.fromJSON(this,u,f)},s.prototype._getBeta=function(){if(this.curve.endo){var u=this.prec
vendor: 8,339 bytes, line 28
28omputed;if(u&&u.beta)return u.beta;var f=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(u){var l=this.curve,p=function(b){return l.point(b.x.redMul(l.endo.beta),b.y)};u.beta=f,f.precomputed={beta:null,naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(p)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(p)}}}return f}},s.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},s.fromJSON=function(u,f,l){typeof f=="string"&&(f=JSON.parse(f));var p=u.point(f[0],f[1],l);if(!f[2])return p;function b(w){return u.point(w[0],w[1],l)}var v=f[2];return p.precomputed={beta:null,doubles:v.doubles&&{step:v.doubles.step,points:[p].concat(v.doubles.points.map(b))},naf:v.naf&&{wnd:v.naf.wnd,points:[p].concat(v.naf.points.map(b))}},p},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.inf},s.prototype.add=function(u){if(this.inf)return u;if(u.inf)return this;if(this.eq(u))return this.dbl();if(this.neg().eq(u))return this.curve.point(null,null);if(this.x.cmp(u.x)===0)return this.curve.point(null,null);var f=this.y.redSub(u.y);f.cmpn(0)!==0&&(f=f.redMul(this.x.redSub(u.x).redInvm()));var l=f.redSqr().redISub(this.x).redISub(u.x),p=f.redMul(this.x.redSub(l)).redISub(this.y);return this.curve.point(l,p)},s.prototype.dbl=function(){if(this.inf)return this;var u=this.y.redAdd(this.y);if(u.cmpn(0)===0)return this.curve.point(null,null);var f=this.curve.a,l=this.x.redSqr(),p=u.redInvm(),b=l.redAdd(l).redIAdd(l).redIAdd(f).redMul(p),v=b.redSqr().redISub(this.x.redAdd(this.x)),w=b.redMul(this.x.redSub(v)).redISub(this.y);return this.curve.point(v,w)},s.prototype.getX=function(){return this.x.fromRed()},s.prototype.getY=function(){return this.y.fromRed()},s.prototype.mul=function(u){return u=new e(u,16),this.isInfinity()?this:this._hasDoubles(u)?this.curve._fixedNafMul(this,u):this.curve.endo?this.curve._endoWnafMulAdd([this],[u]):this.curve._wnafMul(this,u)},s.prototype.mulAdd=function(u,f,l){var p=[this,f],b=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(p,b):this.curve._wnafMulAdd(1,p,b,2)},s.prototype.jmulAdd=function(u,f,l){var p=[this,f],b=[u,l];return this.curve.endo?this.curve._endoWnafMulAdd(p,b,!0):this.curve._wnafMulAdd(1,p,b,2,!0)},s.prototype.eq=function(u){return this===u||this.inf===u.inf&&(this.inf||this.x.cmp(u.x)===0&&this.y.cmp(u.y)===0)},s.prototype.neg=function(u){if(this.inf)return this;var f=this.curve.point(this.x,this.y.redNeg());if(u&&this.precomputed){var l=this.precomputed,p=function(b){return b.neg()};f.precomputed={naf:l.naf&&{wnd:l.naf.wnd,points:l.naf.points.map(p)},doubles:l.doubles&&{step:l.doubles.step,points:l.doubles.points.map(p)}}}return f},s.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var u=this.curve.jpoint(this.x,this.y,this.curve.one);return u};function o(c,u,f,l){n.BasePoint.call(this,c,"jacobian"),u===null&&f===null&&l===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(u,16),this.y=new e(f,16),this.z=new e(l,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return r(o,n.BasePoint),i.prototype.jpoint=function(u,f,l){return new o(this,u,f,l)},o.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var u=this.z.redInvm(),f=u.redSqr(),l=this.x.redMul(f),p=this.y.redMul(f).redMul(u);return this.curve.point(l,p)},o.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},o.prototype.add=function(u){if(this.isInfinity())return u;if(u.isInfinity())return this;var f=u.z.redSqr(),l=this.z.redSqr(),p=this.x.redMul(f),b=u.x.redMul(l),v=this.y.redMul(f.redMul(u.z)),w=u.y.redMul(l.redMul(this.z)),I=p.redSub(b),S=v.redSub(w);if(I.cmpn(0)===0)return S.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var T=I.redSqr(),C=T.redMul(I),k=p.redMul(T),$=S.redSqr().redIAdd(C).redISub(k).redISub(k),G=S.redMul(k.redISub($)).redISub(v.redMul(C)),B=this.z.redMul(u.z).redMul(I);return this.curve.jpoint($,G,B)},o.prototype.mixedAdd=function(u){if(this.isInfinity())return u.toJ();if(u.isInfinity())return this;var f=this.z.redSqr(),l=this.x,p=u.x.redMul(f),b=this.y,v=u.y.redMul(f).redMul(this.z),w=l.redSub(p),I=b.redSub(v);if(w.cmpn(0)===0)return I.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var S=w.redSqr(),T=S.redMul(w),C=l.redMul(S),k=I.redSqr().redIAdd(T).redISub(C).redISub(C),$=I.redMul(C.redISub(k)).redISub(b.redMul(T)),G=this.z.redMul(w);return this.curve.jpoint(k,$,G)},o.prototype.dblp=function(u){if(u===0)return this;if(this.isInfinity())return this;if(!u)return this.dbl();var f;if(this.curve.zeroA||this.curve.threeA){var l=this;for(f=0;f<u;f++)l=l.dbl();return l}var p=this.curve.a,b=this.curve.tinv,v=this.x,w=this.y,I=this.z,S=I.redSqr().redSqr(),T=w.redAdd(w);for(f=0;f<u;f++){var C=v.redSqr(),k=T.redSqr(),$=k.redSqr(),G=C.redAdd(C).redIAdd(C).redIAdd(p.redMul(S)),B=v.redMul(k),M=G.redSqr().redISub(B.redAdd(B)),N=B.redISub(M),P=G.redMul(N);P=P.redIAdd(P).redISub($);var x=T.redMul(I);f+1<u&&(S=S.redMul($)),v=M,I=x,T=P}return this.curve.jpoint(v,T.redMul(b),I)},o.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},o.prototype._zeroDbl=function(){var u,f,l;if(this.zOne){var p=this.x.redSqr(),b=this.y.redSqr(),v=b.redSqr(),w=this.x.redAdd(b).redSqr().redISub(p).redISub(v);w=w.redIAdd(w);var I=p.redAdd(p).redIAdd(p),S=I.redSqr().redISub(w).redISub(w),T=v.redIAdd(v);T=T.redIAdd(T),T=T.redIAdd(T),u=S,f=I.redMul(w.redISub(S)).redISub(T),l=this.y.redAdd(this.y)}else{var C=this.x.redSqr(),k=this.y.redSqr(),$=k.redSqr(),G=this.x.redAdd(k).redSqr().redISub(C).redISub($);G=G.redIAdd(G);var B=C.redAdd(C).redIAdd(C),M=B.redSqr(),N=$.redIAdd($);N=N.redIAdd(N),N=N.redIAdd(N),u=M.redISub(G).redISub(G),f=B.redMul(G.redISub(u)).redISub(N),l=this.y.redMul(this.z),l=l.redIAdd(l)}return this.curve.jpoint(u,f,l)},o.prototype._threeDbl=function(){var u,f,l;if(this.zOne){var p=this.x.redSqr(),b=this.y.redSqr(),v=b.redSqr(),w=this.x.redAdd(b).redSqr().redISub(p).redISub(v);w=w.redIAdd(w);var I=p.redAdd(p).redIAdd(p).redIAdd(this.curve.a),S=I.redSqr().redISub(w).redISub(w);u=S;var T=v.redIAdd(v);T=T.redIAdd(T),T=T.redIAdd(T),f=I.redMul(w.redISub(S)).redISub(T),l=this.y.redAdd(this.y)}else{var C=this.z.redSqr(),k=this.y.redSqr(),$=this.x.redMul(k),G=this.x.redSub(C).redMul(this.x.redAdd(C));G=G.redAdd(G).redIAdd(G);var B=$.redIAdd($);B=B.redIAdd(B);var M=B.redAdd(B);u=G.redSqr().redISub(M),l=this.y.redAdd(this.z).redSqr().redISub(k).redISub(C);var N=k.redSqr();N=N.redIAdd(N),N=N.redIAdd(N),N=N.redIAdd(N),f=G.redMul(B.redISub(u)).redISub(N)}return this.curve.jpoint(u,f,l)},o.prototype._dbl=function(){var u=this.curve.a,f=this.x,l=this.y,p=this.z,b=p.redSqr().redSqr(),v=f.redSqr(),w=l.redSqr(),I=v.redAdd(v).redIAdd(v).redIAdd(u.redMul(b)),S=f.redAdd(f);S=S.redIAdd(S);var T=S.redMul(w),C=I.redSqr().redISub(T.redAdd(T)),k=T.redISub(C),$=w.redSqr();$=$.redIAdd($),$=$.redIAdd($),$=$.redIAdd($);var G=I.redMul(k).redISub($),B=l.redAdd(l).redMul(p);return this.curve.jpoint(C,G,B)},o.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var u=this.x.redSqr(),f=this.y.redSqr(),l=this.z.redSqr(),p=f.redSqr(),b=u.redAdd(u).redIAdd(u),v=b.redSqr(),w=this.x.redAdd(f).redSqr().redISub(u).redISub(p);w=w.redIAdd(w),w=w.redAdd(w).redIAdd(w),w=w.redISub(v);var I=w.redSqr(),S=p.redIAdd(p);S=S.redIAdd(S),S=S.redIAdd(S),S=S.redIAdd(S);var T=b.redIAdd(w).redSqr().redISub(v).redISub(I).redISub(S),C=f.redMul(T);C=C.redIAdd(C),C=C.redIAdd(C);var k=this.x.redMul(I).redISub(C);k=k.redIAdd(k),k=k.redIAdd(k);var $=this.y.redMul(T.redMul(S.redISub(T)).redISub(w.redMul(I)));$=$.redIAdd($),$=$.redIAdd($),$=$.redIAdd($);var G=this.z.redAdd(w).redSqr().redISub(l).redISub(I);return this.curve.jpoint(k,$,G)}
28,o.prototype.mul=function(u,f){return u=new e(u,f),this.curve._wnafMul(this,u)},o.prototype.eq=function(u){if(u.type==="affine")return this.eq(u.toJ());if(this===u)return!0;var f=this.z.redSqr(),l=u.z.redSqr();if(this.x.redMul(l).redISub(u.x.redMul(f)).cmpn(0)!==0)return!1;var p=f.redMul(this.z),b=l.redMul(u.z);return this.y.redMul(b).redISub(u.y.redMul(p)).cmpn(0)===0},o.prototype.eqXToP=function(u){var f=this.z.redSqr(),l=u.toRed(this.curve.red).redMul(f);if(this.x.cmp(l)===0)return!0;for(var p=u.clone(),b=this.curve.redN.redMul(f);;){if(p.iadd(this.curve.n),p.cmp(this.curve.p)>=0)return!1;if(l.redIAdd(b),this.x.cmp(l)===0)return!0}},o.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},o.prototype.isInfinity=function(){return this.z.cmpn(0)===0},rl}var nl,Om;function ex(){if(Om)return nl;Om=1;var t=er(),e=Ye(),r=Uf(),n=Nr();function a(s){r.call(this,"mont",s),this.a=new t(s.a,16).toRed(this.red),this.b=new t(s.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}e(a,r),nl=a,a.prototype.validate=function(o){var c=o.normalize().x,u=c.redSqr(),f=u.redMul(c).redAdd(u.redMul(this.a)).redAdd(c),l=f.redSqrt();return l.redSqr().cmp(f)===0};function i(s,o,c){r.BasePoint.call(this,s,"projective"),o===null&&c===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(o,16),this.z=new t(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return e(i,r.BasePoint),a.prototype.decodePoint=function(o,c){return this.point(n.toArray(o,c),1)},a.prototype.point=function(o,c){return new i(this,o,c)},a.prototype.pointFromJSON=function(o){return i.fromJSON(this,o)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(o,c){return new i(o,c[0],c[1]||o.one)},i.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},i.prototype.isInfinity=function(){return this.z.cmpn(0)===0},i.prototype.dbl=function(){var o=this.x.redAdd(this.z),c=o.redSqr(),u=this.x.redSub(this.z),f=u.redSqr(),l=c.redSub(f),p=c.redMul(f),b=l.redMul(f.redAdd(this.curve.a24.redMul(l)));return this.curve.point(p,b)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(o,c){var u=this.x.redAdd(this.z),f=this.x.redSub(this.z),l=o.x.redAdd(o.z),p=o.x.redSub(o.z),b=p.redMul(u),v=l.redMul(f),w=c.z.redMul(b.redAdd(v).redSqr()),I=c.x.redMul(b.redISub(v).redSqr());return this.curve.point(w,I)},i.prototype.mul=function(o){for(var c=o.clone(),u=this,f=this.curve.point(null,null),l=this,p=[];c.cmpn(0)!==0;c.iushrn(1))p.push(c.andln(1));for(var b=p.length-1;b>=0;b--)p[b]===0?(u=u.diffAdd(f,l),f=f.dbl()):(f=u.diffAdd(f,l),u=u.dbl());return f},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(o){return this.getX().cmp(o.getX())===0},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nl}var il,Lm;function tx(){if(Lm)return il;Lm=1;var t=Nr(),e=er(),r=Ye(),n=Uf(),a=t.assert;function i(o){this.twisted=(o.a|0)!==1,this.mOneA=this.twisted&&(o.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",o),this.a=new e(o.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(o.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(o.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(o.c|0)===1}r(i,n),il=i,i.prototype._mulA=function(c){return this.mOneA?c.redNeg():this.a.redMul(c)},i.prototype._mulC=function(c){return this.oneC?c:this.c.redMul(c)},i.prototype.jpoint=function(c,u,f,l){return this.point(c,u,f,l)},i.prototype.pointFromX=function(c,u){c=new e(c,16),c.red||(c=c.toRed(this.red));var f=c.redSqr(),l=this.c2.redSub(this.a.redMul(f)),p=this.one.redSub(this.c2.redMul(this.d).redMul(f)),b=l.redMul(p.redInvm()),v=b.redSqrt();if(v.redSqr().redSub(b).cmp(this.zero)!==0)throw new Error("invalid point");var w=v.fromRed().isOdd();return(u&&!w||!u&&w)&&(v=v.redNeg()),this.point(c,v)},i.prototype.pointFromY=function(c,u){c=new e(c,16),c.red||(c=c.toRed(this.red));var f=c.redSqr(),l=f.redSub(this.c2),p=f.redMul(this.d).redMul(this.c2).redSub(this.a),b=l.redMul(p.redInvm());if(b.cmp(this.zero)===0){if(u)throw new Error("invalid point");return this.point(this.zero,c)}var v=b.redSqrt();if(v.redSqr().redSub(b).cmp(this.zero)!==0)throw new Error("invalid point");return v.fromRed().isOdd()!==u&&(v=v.redNeg()),this.point(v,c)},i.prototype.validate=function(c){if(c.isInfinity())return!0;c.normalize();var u=c.x.redSqr(),f=c.y.redSqr(),l=u.redMul(this.a).redAdd(f),p=this.c2.redMul(this.one.redAdd(this.d.redMul(u).redMul(f)));return l.cmp(p)===0};function s(o,c,u,f,l){n.BasePoint.call(this,o,"projective"),c===null&&u===null&&f===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(c,16),this.y=new e(u,16),this.z=f?new e(f,16):this.curve.one,this.t=l&&new e(l,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return r(s,n.BasePoint),i.prototype.pointFromJSON=function(c){return s.fromJSON(this,c)},i.prototype.point=function(c,u,f,l){return new s(this,c,u,f,l)},s.fromJSON=function(c,u){return new s(c,u[0],u[1],u[2])},s.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>
28":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},s.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},s.prototype._extDbl=function(){var c=this.x.redSqr(),u=this.y.redSqr(),f=this.z.redSqr();f=f.redIAdd(f);var l=this.curve._mulA(c),p=this.x.redAdd(this.y).redSqr().redISub(c).redISub(u),b=l.redAdd(u),v=b.redSub(f),w=l.redSub(u),I=p.redMul(v),S=b.redMul(w),T=p.redMul(w),C=v.redMul(b);return this.curve.point(I,S,C,T)},s.prototype._projDbl=function(){var c=this.x.redAdd(this.y).redSqr(),u=this.x.redSqr(),f=this.y.redSqr(),l,p,b,v,w,I;if(this.curve.twisted){v=this.curve._mulA(u);var S=v.redAdd(f);this.zOne?(l=c.redSub(u).redSub(f).redMul(S.redSub(this.curve.two)),p=S.redMul(v.redSub(f)),b=S.redSqr().redSub(S).redSub(S)):(w=this.z.redSqr(),I=S.redSub(w).redISub(w),l=c.redSub(u).redISub(f).redMul(I),p=S.redMul(v.redSub(f)),b=S.redMul(I))}else v=u.redAdd(f),w=this.curve._mulC(this.z).redSqr(),I=v.redSub(w).redSub(w),l=this.curve._mulC(c.redISub(v)).redMul(I),p=this.curve._mulC(v).redMul(u.redISub(f)),b=v.redMul(I);return this.curve.point(l,p,b)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},s.prototype._extAdd=function(c){var u=this.y.redSub(this.x).redMul(c.y.redSub(c.x)),f=this.y.redAdd(this.x).redMul(c.y.redAdd(c.x)),l=this.t.redMul(this.curve.dd).redMul(c.t),p=this.z.redMul(c.z.redAdd(c.z)),b=f.redSub(u),v=p.redSub(l),w=p.redAdd(l),I=f.redAdd(u),S=b.redMul(v),T=w.redMul(I),C=b.redMul(I),k=v.redMul(w);return this.curve.point(S,T,k,C)},s.prototype._projAdd=function(c){var u=this.z.redMul(c.z),f=u.redSqr(),l=this.x.redMul(c.x),p=this.y.redMul(c.y),b=this.curve.d.redMul(l).redMul(p),v=f.redSub(b),w=f.redAdd(b),I=this.x.redAdd(this.y).redMul(c.x.redAdd(c.y)).redISub(l).redISub(p),S=u.redMul(v).redMul(I),T,C;return this.curve.twisted?(T=u.redMul(w).redMul(p.redSub(this.curve._mulA(l))),C=v.redMul(w)):(T=u.redMul(w).redMul(p.redSub(l)),C=this.curve._mulC(v).redMul(w)),this.curve.point(S,T,C)},s.prototype.add=function(c){return this.isInfinity()?c:c.isInfinity()?this:this.curve.extended?this._extAdd(c):this._projAdd(c)},s.prototype.mul=function(c){return this._hasDoubles(c)?this.curve._fixedNafMul(this,c):this.curve._wnafMul(this,c)},s.prototype.mulAdd=function(c,u,f){return this.curve._wnafMulAdd(1,[this,u],[c,f],2,!1)},s.prototype.jmulAdd=function(c,u,f){return this.curve._wnafMulAdd(1,[this,u],[c,f],2,!0)},s.prototype.normalize=function(){if(this.zOne)return this;var c=this.z.redInvm();return this.x=this.x.redMul(c),this.y=this.y.redMul(c),this.t&&(this.t=this.t.redMul(c)),this.z=this.curve.one,this.zOne=!0,this},s.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()},s.prototype.getY=function(){return this.normalize(),this.y.fromRed()},s.prototype.eq=function(c){return this===c||this.getX().cmp(c.getX())===0&&this.getY().cmp(c.getY())===0},s.prototype.eqXToP=function(c){var u=c.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(u)===0)return!0;for(var f=c.clone(),l=this.curve.redN.redMul(this.z);;){if(f.iadd(this.curve.n),f.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(l),this.x.cmp(u)===0)return!0}},s.prototype.toP=s.prototype.normalize,s.prototype.mixedAdd=s.prototype.add,il}var Nm;function l3(){return Nm||(Nm=1,(function(t){var e=t;e.base=Uf(),e.short=QS(),e.mont=ex(),e.edwards=tx()})(el)),el}var al={},sl={},vt={},km;function un(){if(km)return vt;km=1;var t=Lr(),e=Ye();vt.inherits=e;function r(d,m){return(d.charCodeAt(m)&64512)!==55296||m<0||m+1>=d.length?!1:(d.charCodeAt(m+1)&64512)===56320}function n(d,m){if(Array.isArray(d))return d.slice();if(!d)return[];var h=[];if(typeof d=="string")if(m){if(m==="hex")for(d=d.replace(/[^a-z0-9]+/ig,""),d.length%2!==0&&(d="0"+d),y=0;y<d.length;y+=2)h.push(parseInt(d[y]+d[y+1],16))}else for(var g=0,y=0;y<d.length;y++){var _=d.charCodeAt(y);_<128?h[g++]=_:_<2048?(h[g++]=_>>
286|192,h[g++]=_&63|128):r(d,y)?(_=65536+((_&1023)<<10)+(d.charCodeAt(++y)&1023),h[g++]=_>>18|240,h[g++]=_>>12&63|128,h[g++]=_>>6&63|128,h[g++]=_&63|128):(h[g++]=_>>12|224,h[g++]=_>>6&63|128,h[g++]=_&63|128)}else for(y=0;y<d.length;y++)h[y]=d[y]|0;return h}vt.toArray=n;function a(d){for(var m="",h=0;h<d.length;h++)m+=o(d[h].toString(16));return m}vt.toHex=a;function i(d){var m=d>>>24|d>>>8&65280|d<<8&16711680|(d&255)<<24;return m>>>0}vt.htonl=i;function s(d,m){for(var h="",g=0;g<d.length;g++){var y=d[g];m==="little"&&(y=i(y)),h+=c(y.toString(16))}return h}vt.toHex32=s;function o(d){return d.length===1?"0"+d:d}vt.zero2=o;function c(d){return d.length===7?"0"+d:d.length===6?"00"+d:d.length===5?"000"+d:d.length===4?"0000"+d:d.length===3?"00000"+d:d.length===2?"000000"+d:d.length===1?"0000000"+d:d}vt.zero8=c;function u(d,m,h,g){var y=h-m;t(y%4===0);for(var _=new Array(y/4),R=0,A=m;R<_.length;R++,A+=4){var E;g==="big"?E=d[A]<<24|d[A+1]<<16|d[A+2]<<8|d[A+3]:E=d[A+3]<<24|d[A+2]<<16|d[A+1]<<8|d[A],_[R]=E>>>0}return _}vt.join32=u;function f(d,m){for(var h=new Array(d.length*4),g=0,y=0;g<d.length;g++,y+=4){var _=d[g];m==="big"?(h[y]=_>>>24,h[y+1]=_>>>16&255,h[y+2]=_>>>8&255,h[y+3]=_&255):(h[y+3]=_>>>24,h[y+2]=_>>>16&255,h[y+1]=_>>>8&255,h[y]=_&255)}return h}vt.split32=f;function l(d,m){return d>>>m|d<<32-m}vt.rotr32=l;function p(d,m){return d<<m|d>>>32-m}vt.rotl32=p;function b(d,m){return d+m>>>0}vt.sum32=b;function v(d,m,h){return d+m+h>>>0}vt.sum32_3=v;function w(d,m,h,g){return d+m+h+g>>>0}vt.sum32_4=w;function I(d,m,h,g,y){return d+m+h+g+y>>>0}vt.sum32_5=I;function S(d,m,h,g){var y=d[m],_=d[m+1],R=g+_>>>0,A=(R<g?1:0)+h+y;d[m]=A>>>0,d[m+1]=R}vt.sum64=S;function T(d,m,h,g){var y=m+g>>>0,_=(y<m?1:0)+d+h;return _>>>0}vt.sum64_hi=T;function C(d,m,h,g){var y=m+g;return y>>>0}
28vt.sum64_lo=C;function k(d,m,h,g,y,_,R,A){var E=0,L=m;L=L+g>>>0,E+=L<m?1:0,L=L+_>>>0,E+=L<_?1:0,L=L+A>>>0,E+=L<A?1:0;var O=d+h+y+R+E;return O>>>0}vt.sum64_4_hi=k;function $(d,m,h,g,y,_,R,A){var E=m+g+_+A;return E>>>0}vt.sum64_4_lo=$;function G(d,m,h,g,y,_,R,A,E,L){var O=0,U=m;U=U+g>>>0,O+=U<m?1:0,U=U+_>>>0,O+=U<_?1:0,U=U+A>>>0,O+=U<A?1:0,U=U+L>>>0,O+=U<L?1:0;var X=d+h+y+R+E+O;return X>>>0}vt.sum64_5_hi=G;function B(d,m,h,g,y,_,R,A,E,L){var O=m+g+_+A+L;return O>>>0}vt.sum64_5_lo=B;function M(d,m,h){var g=m<<32-h|d>>>h;return g>>>0}vt.rotr64_hi=M;function N(d,m,h){var g=d<<32-h|m>>>h;return g>>>0}vt.rotr64_lo=N;function P(d,m,h){return d>>>h}vt.shr64_hi=P;function x(d,m,h){var g=d<<32-h|m>>>h;return g>>>0}return vt.shr64_lo=x,vt}var ol={},Cm;function Xs(){if(Cm)return ol;Cm=1;var t=un(),e=Lr();function r(){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}return ol.BlockHash=r,r.prototype.update=function(a,i){if(a=t.toArray(a,i),this.pending?this.pending=this.pending.concat(a):this.pending=a,this.pendingTotal+=a.length,this.pending.length>=this._delta8){a=this.pending;var s=a.length%this._delta8;this.pending=a.slice(a.length-s,a.length),this.pending.length===0&&(this.pending=null),a=t.join32(a,0,a.length-s,this.endian);for(var o=0;o<a.length;o+=this._delta32)this._update(a,o,o+this._delta32)}return this},r.prototype.digest=function(a){return this.update(this._pad()),e(this.pending===null),this._digest(a)},r.prototype._pad=function(){var a=this.pendingTotal,i=this._delta8,s=i-(a+this.padLength)%i,o=new Array(s+this.padLength);o[0]=128;for(var c=1;c<s;c++)o[c]=0;if(a<<=3,this.endian==="big"){for(var u=8;u<this.padLength;u++)o[c++]=0;o[c++]=0,o[c++]=0,o[c++]=0,o[c++]=0,o[c++]=a>>>24&255,o[c++]=a>>>16&255,o[c++]=a>>>8&255,o[c++]=a&255}else for(o[c++]=a&255,o[c++]=a>>>8&255,o[c++]=a>>>16&255,o[c++]=a>>>24&255,o[c++]=0,o[c++]=0,o[c++]=0,o[c++]=0,u=8;u<this.padLength;u++)o[c++]=0;return o},ol}var Zi={},Wr={},Um;function d3(){if(Um)return Wr;Um=1;var t=un(),e=t.rotr32;function r(f,l,p,b){if(f===0)return n(l,p,b);if(f===1||f===3)return i(l,p,b);if(f===2)return a(l,p,b)}Wr.ft_1=r;function n(f,l,p){return f&l^~f&p}Wr.ch32=n;function a(f,l,p){return f&l^f&p^l&p}Wr.maj32=a;function i(f,l,p){return f^l^p}Wr.p32=i;function s(f){return e(f,2)^e(f,13)^e(f,22)}Wr.s0_256=s;function o(f){return e(f,6)^e(f,11)^e(f,25)}Wr.s1_256=o;function c(f){return e(f,7)^e(f,18)^f>>>3}Wr.g0_256=c;function u(f){return e(f,17)^e(f,19)^f>>>10}return Wr.g1_256=u,Wr}var fl,Dm;function rx(){if(Dm)return fl;Dm=1;var t=un(),e=Xs(),r=d3(),n=t.rotl32,a=t.sum32,i=t.sum32_5,s=r.ft_1,o=e.BlockHash,c=[1518500249,1859775393,2400959708,3395469782];function u(){if(!(this instanceof u))return new u;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return t.inherits(u,o),fl=u,u.blockSize=512,u.outSize=160,u.hmacStrength=80,u.padLength=64,u.prototype._update=function(l,p){for(var b=this.W,v=0;v<16;v++)b[v]=l[p+v];for(;v<b.length;v++)b[v]=n(b[v-3]^b[v-8]^b[v-14]^b[v-16],1);var w=this.h[0],I=this.h[1],S=this.h[2],T=this.h[3],C=this.h[4];for(v=0;v<b.length;v++){var k=~~(v/20),$=i(n(w,5),s(k,I,S,T),C,b[v],c[k]);C=T,T=S,S=n(I,30),I=w,w=$}this.h[0]=a(this.h[0],w),this.h[1]=a(this.h[1],I),this.h[2]=a(this.h[2],S),this.h[3]=a(this.h[3],T),this.h[4]=a(this.h[4],C)},u.prototype._digest=function(l){return l==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},fl}var cl,Hm;function p3(){if(Hm)return cl;Hm=1;var t=un(),e=Xs(),r=d3(),n=Lr(),a=t.sum32,i=t.sum32_4,s=t.sum32_5,o=r.ch32,c=r.maj32,u=r.s0_256,f=r.s1_256,l=r.g0_256,p=r.g1_256,b=e.BlockHash,v=[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,2756
28734187,3204031479,3329325298];function w(){if(!(this instanceof w))return new w;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=v,this.W=new Array(64)}return t.inherits(w,b),cl=w,w.blockSize=512,w.outSize=256,w.hmacStrength=192,w.padLength=64,w.prototype._update=function(S,T){for(var C=this.W,k=0;k<16;k++)C[k]=S[T+k];for(;k<C.length;k++)C[k]=i(p(C[k-2]),C[k-7],l(C[k-15]),C[k-16]);var $=this.h[0],G=this.h[1],B=this.h[2],M=this.h[3],N=this.h[4],P=this.h[5],x=this.h[6],d=this.h[7];for(n(this.k.length===C.length),k=0;k<C.length;k++){var m=s(d,f(N),o(N,P,x),this.k[k],C[k]),h=a(u($),c($,G,B));d=x,x=P,P=N,N=a(M,m),M=B,B=G,G=$,$=a(m,h)}this.h[0]=a(this.h[0],$),this.h[1]=a(this.h[1],G),this.h[2]=a(this.h[2],B),this.h[3]=a(this.h[3],M),this.h[4]=a(this.h[4],N),this.h[5]=a(this.h[5],P),this.h[6]=a(this.h[6],x),this.h[7]=a(this.h[7],d)},w.prototype._digest=function(S){return S==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")},cl}var ul,Fm;function nx(){if(Fm)return ul;Fm=1;var t=un(),e=p3();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return t.inherits(r,e),ul=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=function(a){return a==="hex"?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")},ul}var hl,qm;function g3(){if(qm)return hl;qm=1;var t=un(),e=Xs(),r=Lr(),n=t.rotr64_hi,a=t.rotr64_lo,i=t.shr64_hi,s=t.shr64_lo,o=t.sum64,c=t.sum64_hi,u=t.sum64_lo,f=t.sum64_4_hi,l=t.sum64_4_lo,p=t.sum64_5_hi,b=t.sum64_5_lo,v=e.BlockHash,w=[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,
281126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(){if(!(this instanceof I))return new I;v.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=w,this.W=new Array(160)}t.inherits(I,v),hl=I,I.blockSize=1024,I.outSize=512,I.hmacStrength=192,I.padLength=128,I.prototype._prepareBlock=function(h,g){for(var y=this.W,_=0;_<32;_++)y[_]=h[g+_];for(;_<y.length;_+=2){var R=x(y[_-4],y[_-3]),A=d(y[_-4],y[_-3]),E=y[_-14],L=y[_-13],O=N(y[_-30],y[_-29]),U=P(y[_-30],y[_-29]),X=y[_-32],J=y[_-31];y[_]=f(R,A,E,L,O,U,X,J),y[_+1]=l(R,A,E,L,O,U,X,J)}},I.prototype._update=function(h,g){this._prepareBlock(h,g);var y=this.W,_=this.h[0],R=this.h[1],A=this.h[2],E=this.h[3],L=this.h[4],O=this.h[5],U=this.h[6],X=this.h[7],J=this.h[8],j=this.h[9],q=this.h[10],V=this.h[11],ee=this.h[12],ne=this.h[13],W=this.h[14],z=this.h[15];r(this.k.length===y.length);for(var ae=0;ae<y.length;ae+=2){var pe=W,ge=z,be=B(J,j),_e=M(J,j),Ie=S(J,j,q,V,ee),de=T(J,j,q,V,ee,ne),Pe=this.k[ae],ye=this.k[ae+1],we=y[ae],Ee=y[ae+1],ve=p(pe,ge,be,_e,Ie,de,Pe,ye,we,Ee),Be=b(pe,ge,be,_e,Ie,de,Pe,ye,we,Ee);pe=$(_,R),ge=G(_,R),be=C(_,R,A,E,L),_e=k(_,R,A,E,L,O);var Ue=c(pe,ge,be,_e),xe=u(pe,ge,be,_e);W=ee,z=ne,ee=q,ne=V,q=J,V=j,J=c(U,X,ve,Be),j=u(X,X,ve,Be),U=L,X=O,L=A,O=E,A=_,E=R,_=c(ve,Be,Ue,xe),R=u(ve,Be,Ue,xe)}o(this.h,0,_,R),o(this.h,2,A,E),o(this.h,4,L,O),o(this.h,6,U,X),o(this.h,8,J,j),o(this.h,10,q,V),o(this.h,12,ee,ne),o(this.h,14,W,z)},I.prototype._digest=function(h){return h==="hex"?t.toHex32(this.h,"big"):t.split32(this.h,"big")};function S(m,h,g,y,_){var R=m&g^~m&_;return R<0&&(R+=4294967296),R}function T(m,h,g,y,_,R){var A=h&y^~h&R;return A<0&&(A+=4294967296),A}function C(m,h,g,y,_){var R=m&g^m&_^g&_;return R<0&&(R+=4294967296),R}function k(m,h,g,y,_,R){var A=h&y^h&R^y&R;return A<0&&(A+=4294967296),A}function $(m,h){var g=n(m,h,28),y=n(h,m,2),_=n(h,m,7),R=g^y^_;return R<0&&(R+=4294967296),R}function G(m,h){var g=a(m,h,28),y=a(h,m,2),_=a(h,m,7),R=g^y^_;return R<0&&(R+=4294967296),R}function B(m,h){var g=n(m,h,14),y=n(m,h,18),_=n(h,m,9),R=g^y^_;return R<0&&(R+=4294967296),R}function M(m,h){var g=a(m,h,14),y=a(m,h,18),_=a(h,m,9),R=g^y^_;return R<0&&(R+=4294967296),R}function N(m,h){var g=n(m,h,1),y=n(m,h,8),_=i(m,h,7),R=g^y^_;return R<0&&(R+=4294967296),R}function P(m,h){var g=a(m,h,1),y=a(m,h,8),_=s(m,h,7),R=g^y^_;return R<0&&(R+=4294967296),R}function x(m,h){var g=n(m,h,19),y=n(h,m,29),_=i(m,h,6),R=g^y^_;return R<0&&(R+=4294967296),R}function d(m,h){var g=a(m,h,19),y=a(h,m,29),_=s(m,h,6),R=g^y^_;return R<0&&(R+=4294967296),R}return hl}var ll,$m;function ix(){if($m)return ll;$m=1;var t=un(),e=g3();function r(){if(!(this instanceof r))return new r;e.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return t.inherits(r,e),ll=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=function(a){return a==="hex"?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")},ll}var Km;function ax(){return Km||(Km=1,Zi.sha1=rx(),Zi.sha224=nx(),Zi.sha256=p3(),Zi.sha384=ix(),Zi.sha512=g3()),Zi}var dl={},Gm;function sx(){if(Gm)return dl;Gm=1;var t=un(),e=Xs(),r=t.rotl32,n=t.sum32,a=t.sum32_3,i=t.sum32_4,s=e.BlockHash;function o(){if(!(this instanceof o))return new o;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}t.inherits(o,s),dl.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(I,S){for(var T=this.h[0],C=this.h[1],k=this.h[2],$=this.h[3],G=this.h[4],B=T,M=C,N=k,P=$,x=G,d=0;d<80;d++){var m=n(r(i(T,c(d,C,k,$),I[l[d]+S],u(d)),b[d]),G);T=G,G=$,$=r(k,10),k=C,C=m,m=n(r(i(B,c(79-d,M,N,P),I[p[d]+S],f(d)),v[d]),x),B=x,x=P,P=r(N,10),N=M,M=m}m=a(this.h[1],k,P),this.h[1]=a(this.h[2],$,x),this.h[2]=a(this.h[3],G,B),this.h[3]=a(this.h[4],T,M),this.h[4]=a(this.h[0],C,N),this.h[0]=m},o.prototype._digest=function(I){return I==="hex"?t.toHex32(this.h,"little"):t.split32(this.h,"little")};function c(w,I,S,T){return w<=15?I^S^T:w<=31?I&S|~I&T:w<=47?(I|~S)^T:w<=63?I&T|S&~T:I^(S|~T)}function u(w){return w<=15?0:w<=31?1518500249:w<=47?1859775393:w<=63?2400959708:2840853838}function f(w){return w<=15?1352829926:w<=31?1548603684:w<=47?1836072691:w<=63?2053994217:0}var l=[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],p=[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],b=[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],v=[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];return dl}var pl,jm;function ox(){if(jm)return pl;jm=1;var t=un(),e=Lr();function r(n,a,i){if(!(this instanceof r))return new r(n,a,i);this.Hash=n,this.blockSize=n.blockSize/8,this.outSize=n.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(a,i))}return pl=r,r.prototype._init=function(a){a.length>this.blockSize&&(a=new this.Hash().update(a).digest()),e(a.length<=this.blockSize);for(var i=a.length;i<this.blockSize;i++)a.push(0);for(i=0;i<a.length;i++)a[i]^=54;for(this.inner=new this.Hash().update(a),i=0;i<a.length;i++)a[i]^=106;this.outer=new this.Hash().update(a)},r.prototype.update=function(a,i){return this.inner.update(a,i),this},r.prototype.digest=function(a){return this.outer.update(this.inner.digest()),this.outer.digest(a)},pl}var Vm;function Ld(){return Vm||(Vm=1,(function(t){var e=t;e.utils=un(),e.common=Xs(),e.sha=ax(),e.ripemd=sx(),e.hmac=ox(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160})(sl)),sl}var gl,zm;function fx(){return zm||(zm=1,gl
vendor: 26,127 bytes, line 28
28={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}
28),gl}var Wm;function Nd(){return Wm||(Wm=1,(function(t){var e=t,r=Ld(),n=l3(),a=Nr(),i=a.assert;function s(u){u.type==="short"?this.curve=new n.short(u):u.type==="edwards"?this.curve=new n.edwards(u):this.curve=new n.mont(u),this.g=this.curve.g,this.n=this.curve.n,this.hash=u.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=s;function o(u,f){Object.defineProperty(e,u,{configurable:!0,enumerable:!0,get:function(){var l=new s(f);return Object.defineProperty(e,u,{configurable:!0,enumerable:!0,value:l}),l}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=fx()}catch{c=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"}
28,{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})})(al)),al}var bl,Zm;function cx(){if(Zm)return bl;Zm=1;var t=Ld(),e=h3(),r=Lr();function n(a){if(!(this instanceof n))return new n(a);this.hash=a.hash,this.predResist=!!a.predResist,this.outLen=this.hash.outSize,this.minEntropy=a.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var i=e.toArray(a.entropy,a.entropyEnc||"hex"),s=e.toArray(a.nonce,a.nonceEnc||"hex"),o=e.toArray(a.pers,a.persEnc||"hex");r(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,s,o)}return bl=n,n.prototype._init=function(i,s,o){var c=i.concat(s).concat(o);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var u=0;u<this.V.length;u++)this.K[u]=0,this.V[u]=1;this._update(c),this._reseed=1,this.reseedInterval=281474976710656},n.prototype._hmac=function(){return new t.hmac(this.hash,this.K)},n.prototype._update=function(i){var s=this._hmac().update(this.V).update([0]);i&&(s=s.update(i)),this.K=s.digest(),this.V=this._hmac().update(this.V).digest(),i&&(this.K=this._hmac().update(this.V).update([1]).update(i).digest(),this.V=this._hmac().update(this.V).digest())},n.prototype.reseed=function(i,s,o,c){typeof s!="string"&&(c=o,o=s,s=null),i=e.toArray(i,s),o=e.toArray(o,c),r(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(o||[])),this._reseed=1},n.prototype.generate=function(i,s,o,c){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof s!="string"&&(c=o,o=s,s=null),o&&(o=e.toArray(o,c||"hex"),this._update(o));for(var u=[];u.length<i;)this.V=this._hmac().update(this.V).digest(),u=u.concat(this.V);var f=u.slice(0,i);return this._update(o),this._reseed++,e.encode(f,s)},bl}var ml,Ym;function ux(){if(Ym)return ml;Ym=1;var t=er(),e=Nr(),r=e.assert;function n(a,i){this.ec=a,this.priv=null,this.pub=null,i.priv&&this._importPrivate(i.priv,i.privEnc),i.pub&&this._importPublic(i.pub,i.pubEnc)}return ml=n,n.fromPublic=function(i,s,o){return s instanceof n?s:new n(i,{pub:s,pubEnc:o})},n.fromPrivate=function(i,s,o){return s instanceof n?s:new n(i,{priv:s,privEnc:o})},n.prototype.validate=function(){var i=this.getPublic();return i.isInfinity()?{result:!1,reason:"Invalid public key"}:i.validate()?i.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},n.prototype.getPublic=function(i,s){return typeof i=="string"&&(s=i,i=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),s?this.pub.encode(s,i):this.pub},n.prototype.getPrivate=function(i){return i==="hex"?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(i,s){this.priv=new t(i,s||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(i,s){if(i.x||i.y){this.ec.curve.type==="mont"?r(i.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&r(i.x&&i.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(i.x,i.y);return}this.pub=this.ec.curve.decodePoint(i,s)},n.prototype.derive=function(i){return i.validate()||r(i.validate(),"public point not validated"),i.mul(this.priv).getX()},n.prototype.sign=function(i,s,o){return this.ec.sign(i,this,s,o)},n.prototype.verify=function(i,s,o){return this.ec.verify(i,s,this,void 0,o)},n.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},ml}var yl,Xm;function hx(){if(Xm)return yl;Xm=1;var t=er(),e=Nr(),r=e.assert;function n(c,u){if(c instanceof n)return c;this._importDER(c,u)||(r(c.r&&c.s,"Signature without r or s"),this.r=new t(c.r,16),this.s=new t(c.s,16),c.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=c.recoveryParam)}yl=n;function a(){this.place=0}function i(c,u){var f=c[u.place++];if(!(f&128))return f;var l=f&15;if(l===0||l>4||c[u.place]===0)return!1;for(var p=0,b=0,v=u.place;b<l;b++,v++)p<<=8,p|=c[v],p>>>=0;return p<=127?!1:(u.place=v,p)}function s(c){for(var u=0,f=c.length-1;!c[u]&&!(c[u+1]&128)&&u<f;)u++;return u===0?c:c.slice(u)}n.prototype._importDER=function(u,f){u=e.toArray(u,f);var l=new a;
28if(u[l.place++]!==48)return!1;var p=i(u,l);if(p===!1||p+l.place!==u.length||u[l.place++]!==2)return!1;var b=i(u,l);if(b===!1||(u[l.place]&128)!==0)return!1;var v=u.slice(l.place,b+l.place);if(l.place+=b,u[l.place++]!==2)return!1;var w=i(u,l);if(w===!1||u.length!==w+l.place||(u[l.place]&128)!==0)return!1;var I=u.slice(l.place,w+l.place);if(v[0]===0)if(v[1]&128)v=v.slice(1);else return!1;if(I[0]===0)if(I[1]&128)I=I.slice(1);else return!1;return this.r=new t(v),this.s=new t(I),this.recoveryParam=null,!0};function o(c,u){if(u<128){c.push(u);return}var f=1+(Math.log(u)/Math.LN2>>>3);for(c.push(f|128);--f;)c.push(u>>>(f<<3)&255);c.push(u)}return n.prototype.toDER=function(u){var f=this.r.toArray(),l=this.s.toArray();for(f[0]&128&&(f=[0].concat(f)),l[0]&128&&(l=[0].concat(l)),f=s(f),l=s(l);!l[0]&&!(l[1]&128);)l=l.slice(1);var p=[2];o(p,f.length),p=p.concat(f),p.push(2),o(p,l.length);var b=p.concat(l),v=[48];return o(v,b.length),v=v.concat(b),e.encode(v,u)},yl}var vl,Jm;function lx(){if(Jm)return vl;Jm=1;var t=er(),e=cx(),r=Nr(),n=Nd(),a=Md(),i=r.assert,s=ux(),o=hx();function c(u){if(!(this instanceof c))return new c(u);typeof u=="string"&&(i(Object.prototype.hasOwnProperty.call(n,u),"Unknown curve "+u),u=n[u]),u instanceof n.PresetCurve&&(u={curve:u}),this.curve=u.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=u.curve.g,this.g.precompute(u.curve.n.bitLength()+1),this.hash=u.hash||u.curve.hash}return vl=c,c.prototype.keyPair=function(f){return new s(this,f)},c.prototype.keyFromPrivate=function(f,l){return s.fromPrivate(this,f,l)},c.prototype.keyFromPublic=function(f,l){return s.fromPublic(this,f,l)},c.prototype.genKeyPair=function(f){f||(f={});for(var l=new e({hash:this.hash,pers:f.pers,persEnc:f.persEnc||"utf8",entropy:f.entropy||a(this.hash.hmacStrength),entropyEnc:f.entropy&&f.entropyEnc||"utf8",nonce:this.n.toArray()}),p=this.n.byteLength(),b=this.n.sub(new t(2));;){var v=new t(l.generate(p));if(!(v.cmp(b)>0))return v.iaddn(1),this.keyFromPrivate(v)}},c.prototype._truncateToN=function(f,l,p){var b;if(t.isBN(f)||typeof f=="number")f=new t(f,16),b=f.byteLength();else if(typeof f=="object")b=f.length,f=new t(f,16);else{var v=f.toString();b=v.length+1>>>1,f=new t(v,16)}typeof p!="number"&&(p=b*8);var w=p-this.n.bitLength();return w>0&&(f=f.ushrn(w)),!l&&f.cmp(this.n)>=0?f.sub(this.n):f},c.prototype.sign=function(f,l,p,b){if(typeof p=="object"&&(b=p,p=null),b||(b={}),typeof f!="string"&&typeof f!="number"&&!t.isBN(f)){i(typeof f=="object"&&f&&typeof f.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),i(f.length>>>0===f.length);for(var v=0;v<f.length;v++)i((f[v]&255)===f[v])}l=this.keyFromPrivate(l,p),f=this._truncateToN(f,!1,b.msgBitLength),i(!f.isNeg(),"Can not sign a negative message");var w=this.n.byteLength(),I=l.getPrivate().toArray("be",w),S=f.toArray("be",w);i(new t(S).eq(f),"Can not sign message");for(var T=new e({hash:this.hash,entropy:I,nonce:S,pers:b.pers,persEnc:b.persEnc||"utf8"}),C=this.n.sub(new t(1)),k=0;;k++){var $=b.k?b.k(k):new t(T.generate(this.n.byteLength()));if($=this._truncateToN($,!0),!($.cmpn(1)<=0||$.cmp(C)>=0)){var G=this.g.mul($);if(!G.isInfinity()){var B=G.getX(),M=B.umod(this.n);if(M.cmpn(0)!==0){var N=$.invm(this.n).mul(M.mul(l.getPrivate()).iadd(f));if(N=N.umod(this.n),N.cmpn(0)!==0){var P=(G.getY().isOdd()?1:0)|(B.cmp(M)!==0?2:0);return b.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),P^=1),new o({r:M,s:N,recoveryParam:P})}}}}}},c.prototype.verify=function(f,l,p,b,v){v||(v={}),f=this._truncateToN(f,!1,v.msgBitLength),p=this.keyFromPublic(p,b),l=new o(l,"hex");var w=l.r,I=l.s;if(w.cmpn(1)<0||w.cmp(this.n)>=0||I.cmpn(1)<0||I.cmp(this.n)>=0)return!1;var S=I.invm(this.n),T=S.mul(f).umod(this.n),C=S.mul(w).umod(this.n),k;return this.curve._maxwellTrick?(k=this.g.jmulAdd(T,p.getPublic(),C),k.isInfinity()?!1:k.eqXToP(w)):(k=this.g.mulAdd(T,p.getPublic(),C),k.isInfinity()?!1:k.getX().umod(this.n).cmp(w)===0)},c.prototype.recoverPubKey=function(u,f,l,p){i((3&l)===l,"The recovery param is more than two bits"),f=new o(f,p);var b=this.n,v=new t(u),w=f.r,I=f.s,S=l&1,T=l>>1;if(w.cmp(this.curve.p.umod(this.curve.n))>=0&&T)throw new Error("Unable to find sencond key candinate");T?w=this.curve.pointFromX(w.add(this.curve.n),S):w=this.curve.pointFromX(w,S);var C=f.r.invm(b),k=b.sub(v).mul(C).umod(b),$=I.mul(C).umod(b);return this.g.mulAdd(k,w,$)},c.prototype.getKeyRecoveryParam=function(u,f,l,p){if(f=new o(f,p),f.recoveryParam!==null)return f.recoveryParam;for(var b=0;b<4;b++){var v;try{v=this.recoverPubKey(u,f,b)}catch{continue}if(v.eq(l))return b}throw new Error("Unable to find valid recovery factor")},vl}var wl,Qm;function dx(){if(Qm)return wl;Qm=1;var t=Nr(),e=t.assert,r=t.parseBytes,n=t.cachedProperty;function a(i,s){this.eddsa=i,this._secret=r(s.secret),i.isPoint(s.pub)?this._pub=s.pub:this._pubBytes=r(s.pub)}return a.fromPublic=function(s,o){return o instanceof a?o:new a(s,{pub:o})},a.fromSecret=function(s,o){return o instanceof a?o:new a(s,{secret:o})},a.prototype.secret=function(){return this._secret},n(a,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(a,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(a,"privBytes",function(){var s=this.eddsa,o=this.hash(),c=s.encodingLength-1,u=o.slice(0,s.encodingLength);return u[0]&=248,u[c]&=127,u[c]|=64,u}),n(a,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(a,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(a,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),a.prototype.sign=function(s){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(s,this)},a.prototype.verify=function(s,o){return this.eddsa.verify(s,o,this)},a.prototype.getSecret=function(s){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),s)},a.prototype.getPublic=function(s){return t.encode(this.pubBytes(),s)},wl=a,wl}var _l,ey;function px(){if(ey)return _l;ey=1;var t=er(),e=Nr(),r=e.assert,n=e.cachedProperty,a=e.parseBytes;function i(s,o){this.eddsa=s,typeof o!="object"&&(o=a(o)),Array.isArray(o)&&(r(o.length===s.encodingLength*2,"Signature has invali
28d size"),o={R:o.slice(0,s.encodingLength),S:o.slice(s.encodingLength)}),r(o.R&&o.S,"Signature without R or S"),s.isPoint(o.R)&&(this._R=o.R),o.S instanceof t&&(this._S=o.S),this._Rencoded=Array.isArray(o.R)?o.R:o.Rencoded,this._Sencoded=Array.isArray(o.S)?o.S:o.Sencoded}return n(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return e.encode(this.toBytes(),"hex").toUpperCase()},_l=i,_l}var El,ty;function gx(){if(ty)return El;ty=1;var t=Ld(),e=Nd(),r=Nr(),n=r.assert,a=r.parseBytes,i=dx(),s=px();function o(c){if(n(c==="ed25519","only tested with ed25519 so far"),!(this instanceof o))return new o(c);c=e[c].curve,this.curve=c,this.g=c.g,this.g.precompute(c.n.bitLength()+1),this.pointClass=c.point().constructor,this.encodingLength=Math.ceil(c.n.bitLength()/8),this.hash=t.sha512}return El=o,o.prototype.sign=function(u,f){u=a(u);var l=this.keyFromSecret(f),p=this.hashInt(l.messagePrefix(),u),b=this.g.mul(p),v=this.encodePoint(b),w=this.hashInt(v,l.pubBytes(),u).mul(l.priv()),I=p.add(w).umod(this.curve.n);return this.makeSignature({R:b,S:I,Rencoded:v})},o.prototype.verify=function(u,f,l){if(u=a(u),f=this.makeSignature(f),f.S().gte(f.eddsa.curve.n)||f.S().isNeg())return!1;var p=this.keyFromPublic(l),b=this.hashInt(f.Rencoded(),p.pubBytes(),u),v=this.g.mul(f.S()),w=f.R().add(p.pub().mul(b));return w.eq(v)},o.prototype.hashInt=function(){for(var u=this.hash(),f=0;f<arguments.length;f++)u.update(arguments[f]);return r.intFromLE(u.digest()).umod(this.curve.n)},o.prototype.keyFromPublic=function(u){return i.fromPublic(this,u)},o.prototype.keyFromSecret=function(u){return i.fromSecret(this,u)},o.prototype.makeSignature=function(u){return u instanceof s?u:new s(this,u)},o.prototype.encodePoint=function(u){var f=u.getY().toArray("le",this.encodingLength);return f[this.encodingLength-1]|=u.getX().isOdd()?128:0,f},o.prototype.decodePoint=function(u){u=r.parseBytes(u);var f=u.length-1,l=u.slice(0,f).concat(u[f]&-129),p=(u[f]&128)!==0,b=r.intFromLE(l);return this.curve.pointFromY(b,p)},o.prototype.encodeInt=function(u){return u.toArray("le",this.encodingLength)},o.prototype.decodeInt=function(u){return r.intFromLE(u)},o.prototype.isPoint=function(u){return u instanceof this.pointClass},El}var ry;function kd(){return ry||(ry=1,(function(t){var e=t;e.version=JS.version,e.utils=Nr(),e.rand=Md(),e.curve=l3(),e.curves=Nd(),e.ec=lx(),e.eddsa=gx()})(Xh)),Xh}var Ar={},Sl={},xl={};const bx={},mx=Object.freeze(Object.defineProperty({__proto__:null,default:bx},Symbol.toStringTag,{value:"Module"})),yx=f_(mx);var ny;function vx(){return ny||(ny=1,(function(t){var e=Js(),r=Ye(),n=t;n.define=function(s,o){return new a(s,o)};function a(i,s){this.name=i,this.body=s,this.decoders={},this.encoders={}}a.prototype._createNamed=function(s){var o;try{o=yx.runInThisContext("(function "+this.name+`(entity) {
29  this._initNamed(entity);
30})`)}catch{o=function(u){this._initNamed(u)}}return r(o,s),o.prototype._initNamed=function(u){s.call(this,u)},new o(this)},a.prototype._getDecoder=function(s){return s=s||"der",this.decoders.hasOwnProperty(s)||(this.decoders[s]=this._createNamed(e.decoders[s])),this.decoders[s]},a.prototype.decode=function(s,o,c){return this._getDecoder(o).decode(s,c)},a.prototype._getEncoder=function(s){return s=s||"der",this.encoders.hasOwnProperty(s)||(this.encoders[s]=this._createNamed(e.encoders[s])),this.encoders[s]},a.prototype.encode=function(s,o,c){return this._getEncoder(o).encode(s,c)}})(xl)),xl}var Al={},Rl={},iy;function wx(){if(iy)return Rl;iy=1;var t=Ye();function e(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}Rl.Reporter=e,e.prototype.isError=function(a){return a instanceof r},e.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},e.prototype.restore=function(a){var i=this._reporterState;i.obj=a.obj,i.path=i.path.slice(0,a.pathLen)},e.prototype.enterKey=function(a){return this._reporterState.path.push(a)},e.prototype.exitKey=function(a){var i=this._reporterState;i.path=i.path.slice(0,a-1)},e.prototype.leaveKey=function(a,i,s){var o=this._reporterState;this.exitKey(a),o.obj!==null&&(o.obj[i]=s)},e.prototype.path=function(){return this._reporterState.path.join("/")},e.prototype.enterObject=function(){var a=this._reporterState,i=a.obj;return a.obj={},i},e.prototype.leaveObject=function(a){var i=this._reporterState,s=i.obj;return i.obj=a,s},e.prototype.error=function(a){var i,s=this._reporterState,o=a instanceof r;if(o?i=a:i=new r(s.path.map(function(c){return"["+JSON.stringify(c)+"]"}).join(""),a.message||a,a.stack),!s.options.partial)throw i;return o||s.errors.push(i),i},e.prototype.wrapResult=function(a){var i=this._reporterState;return i.options.partial?{result:this.isError(a)?null:a,errors:i.errors}:a};function r(n,a){this.path=n,this.rethrow(a)}
30return t(r,Error),r.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(i){this.stack=i.stack}return this},Rl}var xo={},ay;function sy(){if(ay)return xo;ay=1;var t=Ye(),e=xs().Reporter,r=Or().Buffer;function n(i,s){if(e.call(this,s),!r.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}t(n,e),xo.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:e.prototype.save.call(this)}},n.prototype.restore=function(s){var o=new n(this.base);return o.offset=s.offset,o.length=this.offset,this.offset=s.offset,e.prototype.restore.call(this,s.reporter),o},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(s){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(s||"DecoderBuffer overrun")},n.prototype.skip=function(s,o){if(!(this.offset+s<=this.length))return this.error(o||"DecoderBuffer overrun");var c=new n(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+s,this.offset+=s,c},n.prototype.raw=function(s){return this.base.slice(s?s.offset:this.offset,this.length)};function a(i,s){if(Array.isArray(i))this.length=0,this.value=i.map(function(o){return o instanceof a||(o=new a(o,s)),this.length+=o.length,o},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return s.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=r.byteLength(i);else if(r.isBuffer(i))this.value=i,this.length=i.length;else return s.error("Unsupported type: "+typeof i)}return xo.EncoderBuffer=a,a.prototype.join=function(s,o){return s||(s=new r(this.length)),o||(o=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(c){c.join(s,o),o+=c.length}):(typeof this.value=="number"?s[o]=this.value:typeof this.value=="string"?s.write(this.value,o):r.isBuffer(this.value)&&this.value.copy(s,o),o+=this.length)),s},xo}var Il,oy;function _x(){if(oy)return Il;oy=1;var t=xs().Reporter,e=xs().EncoderBuffer,r=xs().DecoderBuffer,n=Lr(),a=["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"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a),s=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function o(u,f){var l={};this._baseState=l,l.enc=u,l.parent=f||null,l.children=null,l.tag=null,l.args=null,l.reverseArgs=null,l.choice=null,l.optional=!1,l.any=!1,l.obj=!1,l.use=null,l.useDecoder=null,l.key=null,l.default=null,l.explicit=null,l.implicit=null,l.contains=null,l.parent||(l.children=[],this._wrap())}Il=o;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return o.prototype.clone=function(){var f=this._baseState,l={};
30c.forEach(function(b){l[b]=f[b]});var p=new this.constructor(l.parent);return p._baseState=l,p},o.prototype._wrap=function(){var f=this._baseState;i.forEach(function(l){this[l]=function(){var b=new this.constructor(this);return f.children.push(b),b[l].apply(b,arguments)}},this)},o.prototype._init=function(f){var l=this._baseState;n(l.parent===null),f.call(this),l.children=l.children.filter(function(p){return p._baseState.parent===this},this),n.equal(l.children.length,1,"Root node can have only one child")},o.prototype._useArgs=function(f){var l=this._baseState,p=f.filter(function(b){return b instanceof this.constructor},this);f=f.filter(function(b){return!(b instanceof this.constructor)},this),p.length!==0&&(n(l.children===null),l.children=p,p.forEach(function(b){b._baseState.parent=this},this)),f.length!==0&&(n(l.args===null),l.args=f,l.reverseArgs=f.map(function(b){if(typeof b!="object"||b.constructor!==Object)return b;var v={};return Object.keys(b).forEach(function(w){w==(w|0)&&(w|=0);var I=b[w];v[I]=w}),v}))}
30,s.forEach(function(u){o.prototype[u]=function(){var l=this._baseState;throw new Error(u+" not implemented for encoding: "+l.enc)}}),a.forEach(function(u){o.prototype[u]=function(){var l=this._baseState,p=Array.prototype.slice.call(arguments);return n(l.tag===null),l.tag=u,this._useArgs(p),this}}),o.prototype.use=function(f){n(f);var l=this._baseState;return n(l.use===null),l.use=f,this},o.prototype.optional=function(){var f=this._baseState;return f.optional=!0,this},o.prototype.def=function(f){var l=this._baseState;return n(l.default===null),l.default=f,l.optional=!0,this},o.prototype.explicit=function(f){var l=this._baseState;return n(l.explicit===null&&l.implicit===null),l.explicit=f,this},o.prototype.implicit=function(f){var l=this._baseState;return n(l.explicit===null&&l.implicit===null),l.implicit=f,this},o.prototype.obj=function(){var f=this._baseState,l=Array.prototype.slice.call(arguments);return f.obj=!0,l.length!==0&&this._useArgs(l),this},o.prototype.key=function(f){var l=this._baseState;return n(l.key===null),l.key=f,this},o.prototype.any=function(){var f=this._baseState;return f.any=!0,this},o.prototype.choice=function(f){var l=this._baseState;return n(l.choice===null),l.choice=f,this._useArgs(Object.keys(f).map(function(p){return f[p]})),this},o.prototype.contains=function(f){var l=this._baseState;return n(l.use===null),l.contains=f,this},o.prototype._decode=function(f,l){var p=this._baseState;if(p.parent===null)return f.wrapResult(p.children[0]._decode(f,l));var b=p.default,v=!0,w=null;if(p.key!==null&&(w=f.enterKey(p.key)),p.optional){var I=null;if(p.explicit!==null?I=p.explicit:p.implicit!==null?I=p.implicit:p.tag!==null&&(I=p.tag),I===null&&!p.any){var S=f.save();try{p.choice===null?this._decodeGeneric(p.tag,f,l):this._decodeChoice(f,l),v=!0}catch{v=!1}f.restore(S)}else if(v=this._peekTag(f,I,p.any),f.isError(v))return v}var T;if(p.obj&&v&&(T=f.enterObject()),v){if(p.explicit!==null){var C=this._decodeTag(f,p.explicit);if(f.isError(C))return C;f=C}var k=f.offset;if(p.use===null&&p.choice===null){if(p.any)var S=f.save();var $=this._decodeTag(f,p.implicit!==null?p.implicit:p.tag,p.any);if(f.isError($))return $;p.any?b=f.raw(S):f=$}if(l&&l.track&&p.tag!==null&&l.track(f.path(),k,f.length,"tagged"),l&&l.track&&p.tag!==null&&l.track(f.path(),f.offset,f.length,"content"),p.any?b=b:p.choice===null?b=this._decodeGeneric(p.tag,f,l):b=this._decodeChoice(f,l),f.isError(b))return b;if(!p.any&&p.choice===null&&p.children!==null&&p.children.forEach(function(M){M._decode(f,l)}),p.contains&&(p.tag==="octstr"||p.tag==="bitstr")){var G=new r(b);b=this._getUse(p.contains,f._reporterState.obj)._decode(G,l)}}return p.obj&&v&&(b=f.leaveObject(T)),p.key!==null&&(b!==null||v===!0)?f.leaveKey(w,p.key,b):w!==null&&f.exitKey(w),b},o.prototype._decodeGeneric=function(f,l,p){var b=this._baseState;return f==="seq"||f==="set"?null:f==="seqof"||f==="setof"?this._decodeList(l,f,b.args[0],p):/str$/.test(f)?this._decodeStr(l,f,p):f==="objid"&&b.args?this._decodeObjid(l,b.args[0],b.args[1],p):f==="objid"?this._decodeObjid(l,null,null,p):f==="gentime"||f==="utctime"?this._decodeTime(l,f,p):f==="null_"?this._decodeNull(l,p):f==="bool"?this._decodeBool(l,p):f==="objDesc"?this._decodeStr(l,f,p):f==="int"||f==="enum"?this._decodeInt(l,b.args&&b.args[0],p):b.use!==null?this._getUse(b.use,l._reporterState.obj)._decode(l,p):l.error("unknown tag: "+f)},o.prototype._getUse=function(f,l){var p=this._baseState;return p.useDecoder=this._use(f,l),n(p.useDecoder._baseState.parent===null),p.useDecoder=p.useDecoder._baseState.children[0],p.implicit!==p.useDecoder._baseState.implicit&&(p.useDecoder=p.useDecoder.clone(),p.useDecoder._baseState.implicit=p.implicit),p.useDecoder},o.prototype._decodeChoice=function(f,l){var p=this._baseState,b=null,v=!1;return Object.keys(p.choice).some(function(w){var I=f.save(),S=p.choice[w];try{var T=S._decode(f,l);if(f.isError(T))return!1;b={type:w,value:T},v=!0}catch{return f.restore(I),!1}return!0},this),v?b:f.error("Choice not matched")},o.prototype._createEncoderBuffer=function(f){return new e(f,this.reporter)},o.prototype._encode=function(f,l,p){var b=this._baseState;if(!(b.default!==null&&b.default===f)){var v=this._encodeValue(f,l,p);if(v!==void 0&&!this._skipDefault(v,l,p))return v}},o.prototype._encodeValue=function(f,l,p){var b=this._baseState;if(b.parent===null)return b.children[0]._encode(f,l||new t);var S=null;if(this.reporter=l,b.optional&&f===void 0)if(b.default!==null)f=b.default;else return;var v=null,w=!1;if(b.any)S=this._createEncoderBuffer(f);else if(b.choice)S=this._encodeChoice(f,l);else if(b.contains)v=this._getUse(b.contains,p)._encode(f,l),w=!0;else if(b.children)v=b.children.map(function(k){if(k._baseState.tag==="null_")return k._encode(null,l,f);if(k._baseState.key===null)return l.error("Child should have a key");var $=l.enterKey(k._baseState.key);if(typeof f!="object")return l.error("Child expected, but input is not object");var G=k._encode(f[k._baseState.key],l,f);return l.leaveKey($),G},this).filter(function(k){return k}),v=this._createEncoderBuffer(v);else if(b.tag==="seqof"||b.tag==="setof"){if(!(b.args&&b.args.length===1))return l.error("Too many args for : "+b.tag);if(!Array.isArray(f))return l.error("seqof/setof, but data is not Array");var I=this.clone();I._baseState.implicit=null,v=this._createEncoderBuffer(f.map(function(k){var $=this._baseState;return this._getUse($.args[0],f)._encode(k,l)},I))}else b.use!==null?S=this._getUse(b.use,p)._encode(f,l):(v=this._encodePrimitive(b.tag,f),w=!0);var S;if(!b.any&&b.choice===null){var T=b.implicit!==null?b.implicit:b.tag,C=b.implicit===null?"universal":"context";T===null?b.use===null&&l.error("Tag could be omitted only for .use()"):b.use===null&&(S=this._encodeComposite(T,w,C,v))}return b.explicit!==null&&(S=this._encodeComposite(b.explicit,!1,"context",S)),S},o.prototype._encodeChoice=function(f,l){var p=this._baseState,b=p.choice[f.type];return b||n(!1,f.type+" not found in "+JSON.stringify(Object.keys(p.choice))),b._encode(f.value,l)},o.prototype._encodePrimitive=function(f,l){var p=this._baseState;if(/str$/.test(f))return this._encodeStr(l,f);if(f==="objid"&&p.args)return this._encodeObjid(l,p.reverseArgs[0],p.args[1]);if(f==="objid")return this._encodeObjid(l,null,null);if(f==="gentime"||f==="utctime")return this._encodeTime(l,f);if(f==="null_")return this._encodeNull();if(f==="int"||f==="enum")return this._encodeInt(l,p.args&&p.reverseArgs[0]);if(f==="bool")return this._encodeBool(l);if(f==="objDesc")return this._encodeStr(l,f);throw new Error("Unsupported tag: "+f)},o.prototype._isNumstr=function(f){return/^[0-9 ]*$/.test(f)},o.prototype._isPrintstr=function(f){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(f)},Il}var fy;function xs(){return fy||(fy=1,(function(t){var e=t;e.Reporter=wx().Reporter,e.DecoderBuffer=sy().DecoderBuffer,e.EncoderBuffer=sy().EncoderBuffer,e.Node=_x()})(Al)),Al}var Bl={},Tl={},cy;
30function Ex(){return cy||(cy=1,(function(t){var e=b3();t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e._reverse(t.tagClass),t.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"},t.tagByName=e._reverse(t.tag)})(Tl)),Tl}var uy;function b3(){return uy||(uy=1,(function(t){var e=t;e._reverse=function(n){var a={};return Object.keys(n).forEach(function(i){(i|0)==i&&(i=i|0);var s=n[i];a[s]=i}),a},e.der=Ex()})(Bl)),Bl}var Pl={},Ml,hy;function m3(){if(hy)return Ml;hy=1;var t=Ye(),e=Js(),r=e.base,n=e.bignum,a=e.constants.der;function i(u){this.enc="der",this.name=u.name,this.entity=u,this.tree=new s,this.tree._init(u.body)}Ml=i,i.prototype.decode=function(f,l){return f instanceof r.DecoderBuffer||(f=new r.DecoderBuffer(f,l)),this.tree._decode(f,l)};function s(u){r.Node.call(this,"der",u)}t(s,r.Node),s.prototype._peekTag=function(f,l,p){if(f.isEmpty())return!1;var b=f.save(),v=o(f,'Failed to peek tag: "'+l+'"');return f.isError(v)?v:(f.restore(b),v.tag===l||v.tagStr===l||v.tagStr+"of"===l||p)},s.prototype._decodeTag=function(f,l,p){var b=o(f,'Failed to decode tag of "'+l+'"');if(f.isError(b))return b;var v=c(f,b.primitive,'Failed to get length of "'+l+'"');if(f.isError(v))return v;if(!p&&b.tag!==l&&b.tagStr!==l&&b.tagStr+"of"!==l)return f.error('Failed to match tag: "'+l+'"');if(b.primitive||v!==null)return f.skip(v,'Failed to match body of: "'+l+'"');var w=f.save(),I=this._skipUntilEnd(f,'Failed to skip indefinite length body: "'+this.tag+'"');return f.isError(I)?I:(v=f.offset-w.offset,f.restore(w),f.skip(v,'Failed to match body of: "'+l+'"'))},s.prototype._skipUntilEnd=function(f,l){for(;;){var p=o(f,l);if(f.isError(p))return p;var b=c(f,p.primitive,l);if(f.isError(b))return b;var v;if(p.primitive||b!==null?v=f.skip(b):v=this._skipUntilEnd(f,l),f.isError(v))return v;if(p.tagStr==="end")break}},s.prototype._decodeList=function(f,l,p,b){for(var v=[];!f.isEmpty();){var w=this._peekTag(f,"end");if(f.isError(w))return w;var I=p.decode(f,"der",b);if(f.isError(I)&&w)break;v.push(I)}return v},s.prototype._decodeStr=function(f,l){if(l==="bitstr"){var p=f.readUInt8();return f.isError(p)?p:{unused:p,data:f.raw()}}else if(l==="bmpstr"){var b=f.raw();if(b.length%2===1)return f.error("Decoding of string type: bmpstr length mismatch");for(var v="",w=0;w<b.length/2;w++)v+=String.fromCharCode(b.readUInt16BE(w*2));return v}else if(l==="numstr"){var I=f.raw().toString("ascii");return this._isNumstr(I)?I:f.error("Decoding of string type: numstr unsupported characters")}else{if(l==="octstr")return f.raw();if(l==="objDesc")return f.raw();if(l==="printstr"){var S=f.raw().toString("ascii");return this._isPrintstr(S)?S:f.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(l)?f.raw().toString():f.error("Decoding of string type: "+l+" unsupported")}},s.prototype._decodeObjid=function(f,l,p){for(var b,v=[],w=0;!f.isEmpty();){var I=f.readUInt8();w<<=7,w|=I&127,(I&128)===0&&(v.push(w),w=0)}I&128&&v.push(w);var S=v[0]/40|0,T=v[0]%40;if(p?b=v:b=[S,T].concat(v.slice(1)),l){var C=l[b.join(" ")];C===void 0&&(C=l[b.join(".")]),C!==void 0&&(b=C)}return b},s.prototype._decodeTime=function(f,l){var p=f.raw().toString();if(l==="gentime")var b=p.slice(0,4)|0,v=p.slice(4,6)|0,w=p.slice(6,8)|0,I=p.slice(8,10)|0,S=p.slice(10,12)|0,T=p.slice(12,14)|0;else if(l==="utctime"){var b=p.slice(0,2)|0,v=p.slice(2,4)|0,w=p.slice(4,6)|0,I=p.slice(6,8)|0,S=p.slice(8,10)|0,T=p.slice(10,12)|0;b<70?b=2e3+b:b=1900+b}else return f.error("Decoding "+l+" time is not supported yet");return Date.UTC(b,v-1,w,I,S,T,0)},s.prototype._decodeNull=function(f){return null},s.prototype._decodeBool=function(f){var l=f.readUInt8();return f.isError(l)?l:l!==0},s.prototype._decodeInt=function(f,l){var p=f.raw(),b=new n(p);return l&&(b=l[b.toString(10)]||b),b},s.prototype._use=function(f,l){return typeof f=="function"&&(f=f(l)),f._getDecoder("der").tree};function o(u,f){var l=u.readUInt8(f);if(u.isError(l))return l;var p=a.tagClass[l>>6],b=(l&32)===0;
30if((l&31)===31){var v=l;for(l=0;(v&128)===128;){if(v=u.readUInt8(f),u.isError(v))return v;l<<=7,l|=v&127}}else l&=31;var w=a.tag[l];return{cls:p,primitive:b,tag:l,tagStr:w}}function c(u,f,l){var p=u.readUInt8(l);if(u.isError(p))return p;if(!f&&p===128)return null;if((p&128)===0)return p;var b=p&127;if(b>4)return u.error("length octect is too long");p=0;for(var v=0;v<b;v++){p<<=8;var w=u.readUInt8(l);if(u.isError(w))return w;p|=w}return p}return Ml}var Ol,ly;function Sx(){if(ly)return Ol;ly=1;var t=Ye(),e=Or().Buffer,r=m3();function n(a){r.call(this,a),this.enc="pem"}return t(n,r),Ol=n,n.prototype.decode=function(i,s){for(var o=i.toString().split(/[\r\n]+/g),c=s.label.toUpperCase(),u=/^-----(BEGIN|END) ([^-]+)-----$/,f=-1,l=-1,p=0;p<o.length;p++){var b=o[p].match(u);if(b!==null&&b[2]===c)if(f===-1){if(b[1]!=="BEGIN")break;f=p}else{if(b[1]!=="END")break;l=p;break}}if(f===-1||l===-1)throw new Error("PEM section not found for: "+c);var v=o.slice(f+1,l).join("");v.replace(/[^a-z0-9\+\/=]+/gi,"");var w=new e(v,"base64");return r.prototype.decode.call(this,w,s)},Ol}var dy;function xx(){return dy||(dy=1,(function(t){var e=t;e.der=m3(),e.pem=Sx()})(Pl)),Pl}var Ll={},Nl,py;function y3(){if(py)return Nl;py=1;var t=Ye(),e=Or().Buffer,r=Js(),n=r.base,a=r.constants.der;function i(u){this.enc="der",this.name=u.name,this.entity=u,this.tree=new s,this.tree._init(u.body)}Nl=i,i.prototype.encode=function(f,l){return this.tree._encode(f,l).join()};function s(u){n.Node.call(this,"der",u)}t(s,n.Node),s.prototype._encodeComposite=function(f,l,p,b){var v=c(f,l,p,this.reporter);if(b.length<128){var S=new e(2);return S[0]=v,S[1]=b.length,this._createEncoderBuffer([S,b])}for(var w=1,I=b.length;I>=256;I>>=8)w++;var S=new e(2+w);S[0]=v,S[1]=128|w;for(var I=1+w,T=b.length;T>0;I--,T>>=8)S[I]=T&255;return this._createEncoderBuffer([S,b])},s.prototype._encodeStr=function(f,l){if(l==="bitstr")return this._createEncoderBuffer([f.unused|0,f.data]);if(l==="bmpstr"){for(var p=new e(f.length*2),b=0;b<f.length;b++)p.writeUInt16BE(f.charCodeAt(b),b*2);return this._createEncoderBuffer(p)}else return l==="numstr"?this._isNumstr(f)?this._createEncoderBuffer(f):this.reporter.error("Encoding of string type: numstr supports only digits and space"):l==="printstr"?this._isPrintstr(f)?this._createEncoderBuffer(f):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(l)?this._createEncoderBuffer(f):l==="objDesc"?this._createEncoderBuffer(f):this.reporter.error("Encoding of string type: "+l+" unsupported")},s.prototype._encodeObjid=function(f,l,p){if(typeof f=="string"){if(!l)return this.reporter.error("string objid given, but no values map found");if(!l.hasOwnProperty(f))return this.reporter.error("objid not found in values map");f=l[f].split(/[\s\.]+/g);for(var b=0;b<f.length;b++)f[b]|=0}else if(Array.isArray(f)){f=f.slice();for(var b=0;b<f.length;b++)f[b]|=0}if(!Array.isArray(f))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(f));if(!p){if(f[1]>=40)return this.reporter.error("Second objid identifier OOB");f.splice(0,2,f[0]*40+f[1])}for(var v=0,b=0;b<f.length;b++){var w=f[b];for(v++;w>=128;w>>=7)v++}for(var I=new e(v),S=I.length-1,b=f.length-1;b>=0;b--){var w=f[b];for(I[S--]=w&127;(w>>=7)>0;)I[S--]=128|w&127}return this._createEncoderBuffer(I)};function o(u){return u<10?"0"+u:u}s.prototype._encodeTime=function(f,l){var p,b=new Date(f);return l==="gentime"?p=[o(b.getFullYear()),o(b.getUTCMonth()+1),o(b.getUTCDate()),o(b.getUTCHours()),o(b.getUTCMinutes()),o(b.getUTCSeconds()),"Z"].join(""):l==="utctime"?p=[o(b.getFullYear()%100),o(b.getUTCMonth()+1),o(b.getUTCDate()),o(b.getUTCHours()),o(b.getUTCMinutes()),o(b.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+l+" time is not supported yet"),this._encodeStr(p,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(f,l){if(typeof f=="string"){if(!l)return this.reporter.error("String int or enum given, but no values map");if(!l.hasOwnProperty(f))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(f));f=l[f]}if(typeof f!="number"&&!e.isBuffer(f)){var p=f.toArray();!f.sign&&p[0]&128&&p.unshift(0),f=new e(p)}if(e.isBuffer(f)){var b=f.length;f.length===0&&b++;var w=new e(b);return f.copy(w),f.length===0&&(w[0]=0),this._createEncoderBuffer(w)}if(f<128)return this._createEncoderBuffer(f);if(f<256)return this._createEncoderBuffer([0,f]);for(var b=1,v=f;v>=256;v>>=8)b++;for(var w=new Array(b),v=w.length-1;v>=0;v--)w[v]=f&255,f>>=8;return w[0]&128&&w.unshift(0),this._createEncoderBuffer(new e(w))},s.prototype._encodeBool=function(f){return this._createEncoderBuffer(f?255:0)},s.prototype._use=function(f,l){return typeof f=="function"&&(f=f(l)),f._getEncoder("der").tree},s.prototype._skipDefault=function(f,l,p){var b=this._baseState,v;if(b.default===null)return!1;var w=f.join();if(b.defaultBuffer===void 0&&(b.defaultBuffer=this._encodeValue(b.default,l,p).join()),w.length!==b.defaultBuffer.length)return!1;for(v=0;v<w.length;v++)if(w[v]!==b.defaultBuffer[v])return!1;return!0};function c(u,f,l,p){var b;if(u==="seqof"?u="seq":u==="setof"&&(u="set"),a.tagByName.hasOwnProperty(u))b=a.tagByName[u];else if(typeof u=="number"&&(u|0)===u)b=u;else return p.error("Unknown tag: "+u);return b>=31?p.error("Multi-octet tag encoding unsupported"):(f||(b|=32),b|=a.tagClassByName[l||"universal"]<<6,b)}return Nl}var kl,gy;function Ax(){if(gy)return kl;gy=1;var t=Ye(),e=y3();function r(n){e.call(this,n),this.enc="pem"}return t(r,e),kl=r,r.prototype.encode=function(a,i){for(var s=e.prototype.encode.call(this,a),o=s.toString("base64"),c=["-----BEGIN "+i.label+"-----"],u=0;u<o.length;u+=64)c.push(o.slice(u,u+64));return c.push("-----END "+i.label+"-----"),c.join(`
31`)},kl}var by;function Rx(){return by||(by=1,(function(t){var e=t;e.der=y3(),e.pem=Ax()})(Ll)),Ll}var my;function Js(){return my||(my=1,(function(t){var e=t;e.bignum=er(),e.define=vx().define,e.base=xs(),e.constants=b3(),e.decoders=xx(),e.encoders=Rx()})(Sl)),Sl}
31var Cl,yy;function Ix(){if(yy)return Cl;yy=1;var t=Js(),e=t.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),r=t.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),n=t.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),a=t.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())}),i=t.define("RelativeDistinguishedName",function(){this.setof(r)}),s=t.define("RDNSequence",function(){this.seqof(i)}),o=t.define("Name",function(){this.choice({rdnSequence:this.use(s)})}),c=t.define("Validity",function(){this.seq().obj(this.key("notBefore").use(e),this.key("notAfter").use(e))}),u=t.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),f=t.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(n),this.key("issuer").use(o),this.key("validity").use(c),this.key("subject").use(o),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(u).optional())}),l=t.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(f),this.key("signatureAlgorithm").use(n),this.key("signatureValue").bitstr())});return Cl=l,Cl}var vy;function Bx(){if(vy)return Ar;vy=1;var t=Js();Ar.certificate=Ix();var e=t.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())});Ar.RSAPrivateKey=e;var r=t.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});Ar.RSAPublicKey=r;var n=t.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())}),a=t.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(n),this.key("subjectPublicKey").bitstr())});Ar.PublicKey=a;var i=t.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(n),this.key("subjectPrivateKey").octstr())});Ar.PrivateKey=i;var s=t.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())});Ar.EncryptedPrivateKey=s;var o=t.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())});Ar.DSAPrivateKey=o,Ar.DSAparam=t.define("DSAparam",function(){this.int()});var c=t.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),u=t.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())});return Ar.ECPrivateKey=u,Ar.signature=t.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}),Ar}const Tx={"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 Ul,wy;function Px(){if(wy)return Ul;wy=1;var t=/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,e=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,n=kf(),a=Pd(),i=et().Buffer;return Ul=function(s,o){var c=s.toString(),u=c.match(t),f;if(u){var p="aes"+u[1],b=i.from(u[2],"hex"),v=i.from(u[3].replace(/[\r\n]/g,""),"base64"),w=n(o,b.slice(0,8),parseInt(u[1],10)).key,I=[],S=a.createDecipheriv(p,w,b);
31I.push(S.update(v)),I.push(S.final()),f=i.concat(I)}else{var l=c.match(r);f=i.from(l[2].replace(/[\r\n]/g,""),"base64")}var T=c.match(e)[1];return{tag:T,data:f}},Ul}var Dl,_y;function Df(){if(_y)return Dl;_y=1;var t=Bx(),e=Tx,r=Px(),n=Pd(),a=e3().pbkdf2Sync,i=et().Buffer;function s(c,u){var f=c.algorithm.decrypt.kde.kdeparams.salt,l=parseInt(c.algorithm.decrypt.kde.kdeparams.iters.toString(),10),p=e[c.algorithm.decrypt.cipher.algo.join(".")],b=c.algorithm.decrypt.cipher.iv,v=c.subjectPrivateKey,w=parseInt(p.split("-")[1],10)/8,I=a(u,f,l,w,"sha1"),S=n.createDecipheriv(p,I,b),T=[];return T.push(S.update(v)),T.push(S.final()),i.concat(T)}function o(c){var u;typeof c=="object"&&!i.isBuffer(c)&&(u=c.passphrase,c=c.key),typeof c=="string"&&(c=i.from(c));var f=r(c,u),l=f.tag,p=f.data,b,v;switch(l){case"CERTIFICATE":v=t.certificate.decode(p,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(v||(v=t.PublicKey.decode(p,"der")),b=v.algorithm.algorithm.join("."),b){case"1.2.840.113549.1.1.1":return t.RSAPublicKey.decode(v.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return v.subjectPrivateKey=v.subjectPublicKey,{type:"ec",data:v};case"1.2.840.10040.4.1":return v.algorithm.params.pub_key=t.DSAparam.decode(v.subjectPublicKey.data,"der"),{type:"dsa",data:v.algorithm.params};default:throw new Error("unknown key id "+b)}case"ENCRYPTED PRIVATE KEY":p=t.EncryptedPrivateKey.decode(p,"der"),p=s(p,u);case"PRIVATE KEY":switch(v=t.PrivateKey.decode(p,"der"),b=v.algorithm.algorithm.join("."),b){case"1.2.840.113549.1.1.1":return t.RSAPrivateKey.decode(v.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:v.algorithm.curve,privateKey:t.ECPrivateKey.decode(v.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return v.algorithm.params.priv_key=t.DSAparam.decode(v.subjectPrivateKey,"der"),{type:"dsa",params:v.algorithm.params};default:throw new Error("unknown key id "+b)}case"RSA PUBLIC KEY":return t.RSAPublicKey.decode(p,"der");case"RSA PRIVATE KEY":return t.RSAPrivateKey.decode(p,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:t.DSAPrivateKey.decode(p,"der")};case"EC PRIVATE KEY":return p=t.ECPrivateKey.decode(p,"der"),{curve:p.parameters.value,privateKey:p.privateKey};default:throw new Error("unknown key type "+l)}}return o.signature=t.signature,Dl=o,Dl}const v3={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"};var Ey;function Mx(){if(Ey)return ds.exports;Ey=1;var t=et().Buffer,e=Ww(),r=Od(),n=kd().ec,a=Cf(),i=Df(),s=v3,o=1;function c(S,T,C,k,$){var G=i(T);if(G.curve){if(k!=="ecdsa"&&k!=="ecdsa/rsa")throw new Error("wrong private key type");return u(S,G)}else if(G.type==="dsa"){if(k!=="dsa")throw new Error("wrong private key type");return f(S,G,C)}if(k!=="rsa"&&k!=="ecdsa/rsa")throw new Error("wrong private key type");if(T.padding!==void 0&&T.padding!==o)throw new Error("illegal or unsupported padding mode");S=t.concat([$,S]);for(var B=G.modulus.byteLength(),M=[0,1];S.length+M.length+1<B;)M.push(255);M.push(0);for(var N=-1;++N<S.length;)M.push(S[N]);var P=r(M,G);return P}function u(S,T){var C=s[T.curve.join(".")];if(!C)throw new Error("unknown curve "+T.curve.join("."));var k=new n(C),$=k.keyFromPrivate(T.privateKey),G=$.sign(S);return t.from(G.toDER())}function f(S,T,C){for(var k=T.params.priv_key,$=T.params.p,G=T.params.q,B=T.params.g,M=new a(0),N,P=b(S,G).mod(G),x=!1,d=p(k,G,S,C);x===!1;)N=w(G,d,C),M=I(B,N,$,G),x=N.invm(G).imul(P.add(k.mul(M))).mod(G),x.cmpn(0)===0&&(x=!1,M=new a(0));return l(M,x)}function l(S,T){S=S.toArray(),T=T.toArray(),S[0]&128&&(S=[0].concat(S)),T[0]&128&&(T=[0].concat(T));var C=S.length+T.length+4,k=[48,C,2,S.length];return k=k.concat(S,[2,T.length],T),t.from(k)}function p(S,T,C,k){if(S=t.from(S.toArray()),S.length<T.byteLength()){var $=t.alloc(T.byteLength()-S.length);S=t.concat([$,S])}var G=C.length,B=v(C,T),M=t.alloc(G);M.fill(1);var N=t.alloc(G);return N=e(k,N).update(M).update(t.from([0])).update(S).update(B).digest(),M=e(k,N).update(M).digest(),N=e(k,N).update(M).update(t.from([1])).update(S).update(B).digest(),M=e(k,N).update(M).digest(),{k:N,v:M}}function b(S,T){var C=new a(S),k=(S.length<<3)-T.bitLength();return k>0&&C.ishrn(k),C}function v(S,T){S=b(S,T),S=S.mod(T);var C=t.from(S.toArray());if(C.length<T.byteLength()){var k=t.alloc(T.byteLength()-C.length);C=t.concat([k,C])}return C}function w(S,T,C){var k,$;do{for(k=t.alloc(0);k.length*8<S.bitLength();)T.v=e(C,T.k).update(T.v).digest(),k=t.concat([k,T.v]);$=b(k,S),T.k=e(C,T.k).update(T.v).update(t.from([0])).digest(),T.v=e(C,T.k).update(T.v).digest()}while($.cmp(S)!==-1);return $}function I(S,T,C,k){return S.toRed(a.mont(C)).redPow(T).fromRed().mod(k)}return ds.exports=c,ds.exports.getKey=p,ds.exports.makeKey=w,ds.exports}var Hl,Sy;function Ox(){if(Sy)return Hl;Sy=1;var t=et().Buffer,e=Cf(),r=kd().ec,n=Df(),a=v3;function i(u,f,l,p,b){var v=n(l);if(v.type==="ec"){if(p!=="ecdsa"&&p!=="ecdsa/rsa")throw new Error("wrong public key type");return s(u,f,v)}else if(v.type==="dsa"){if(p!=="dsa")throw new Error("wrong public key type");return o(u,f,v)}if(p!=="rsa"&&p!=="ecdsa/rsa")throw new Error("wrong public key type");f=t.concat([b,f]);for(var w=v.modulus.byteLength(),I=[1],S=0;f.length+I.length+2<w;)I.push(255),S+=1;I.push(0);for(var T=-1;++T<f.length;)I.push(f[T]);I=t.from(I);var C=e.mont(v.modulus);u=new e(u).toRed(C),u=u.redPow(new e(v.publicExponent)),u=t.from(u.fromRed().toArray());var k=S<8?1:0;for(w=Math.min(u.length,I.length),u.length!==I.length&&(k=1),T=-1;++T<w;)k|=u[T]^I[T];return k===0}function s(u,f,l){var p=a[l.data.algorithm.curve.join(".")];if(!p)throw new Error("unknown curve "+l.data.algorithm.curve.join("."));var b=new r(p),v=l.data.subjectPrivateKey.data;return b.verify(f,u,v)}function o(u,f,l){var p=l.data.p,b=l.data.q,v=l.data.g,w=l.data.pub_key,I=n.signature.decode(u,"der"),S=I.s,T=I.r;c(S,b),c(T,b);var C=e.mont(p),k=S.invm(b),$=v.toRed(C).redPow(new e(f).mul(k).mod(b)).fromRed().mul(w.toRed(C).redPow(T.mul(k).mod(b)).fromRed()).mod(p).mod(b);return $.cmp(T)===0}function c(u,f){if(u.cmpn(0)<=0)throw new Error("invalid sig");if(u.cmp(f)>=0)throw new Error("invalid sig")}return Hl=i,Hl}var Fl,xy;function Lx(){if(xy)return Fl;xy=1;var t=et().Buffer,e=Zs(),r=Gw(),n=Ye(),a=Mx(),i=Ox(),s=Zw;
31Object.keys(s).forEach(function(l){s[l].id=t.from(s[l].id,"hex"),s[l.toLowerCase()]=s[l]});function o(l){r.Writable.call(this);var p=s[l];if(!p)throw new Error("Unknown message digest");this._hashType=p.hash,this._hash=e(p.hash),this._tag=p.id,this._signType=p.sign}n(o,r.Writable),o.prototype._write=function(p,b,v){this._hash.update(p),v()},o.prototype.update=function(p,b){return this._hash.update(typeof p=="string"?t.from(p,b):p),this},o.prototype.sign=function(p,b){this.end();var v=this._hash.digest(),w=a(v,p,this._hashType,this._signType,this._tag);return b?w.toString(b):w};function c(l){r.Writable.call(this);var p=s[l];if(!p)throw new Error("Unknown message digest");this._hash=e(p.hash),this._tag=p.id,this._signType=p.sign}n(c,r.Writable),c.prototype._write=function(p,b,v){this._hash.update(p),v()},c.prototype.update=function(p,b){return this._hash.update(typeof p=="string"?t.from(p,b):p),this},c.prototype.verify=function(p,b,v){var w=typeof b=="string"?t.from(b,v):b;this.end();var I=this._hash.digest();return i(w,I,p,this._signType,this._tag)};function u(l){return new o(l)}function f(l){return new c(l)}return Fl={Sign:u,Verify:f,createSign:u,createVerify:f},Fl}var ql,Ay;function Nx(){if(Ay)return ql;Ay=1;var t=kd(),e=er();ql=function(s){return new n(s)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};r.p224=r.secp224r1,r.p256=r.secp256r1=r.prime256v1,r.p192=r.secp192r1=r.prime192v1,r.p384=r.secp384r1,r.p521=r.secp521r1;function n(i){this.curveType=r[i],this.curveType||(this.curveType={name:i}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,s){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,s)},n.prototype.computeSecret=function(i,s,o){s=s||"utf8",Fe.isBuffer(i)||(i=new Fe(i,s));var c=this.curve.keyFromPublic(i).getPublic(),u=c.mul(this.keys.getPrivate()).getX();return a(u,o,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,s){var o=this.keys.getPublic(s==="compressed",!0);return s==="hybrid"&&(o[o.length-1]%2?o[0]=7:o[0]=6),a(o,i)},n.prototype.getPrivateKey=function(i){return a(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,s){return s=s||"utf8",Fe.isBuffer(i)||(i=new Fe(i,s)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,s){s=s||"utf8",Fe.isBuffer(i)||(i=new Fe(i,s));var o=new e(i);return o=o.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(o),this};function a(i,s,o){Array.isArray(i)||(i=i.toArray());var c=new Fe(i);if(o&&c.length<o){var u=new Fe(o-c.length);u.fill(0),c=Fe.concat([u,c])}return s?c.toString(s):c}return ql}var $l={},Kl,Ry;function w3(){if(Ry)return Kl;Ry=1;var t=Zs(),e=et().Buffer;Kl=function(n,a){for(var i=e.alloc(0),s=0,o;i.length<a;)o=r(s++),i=e.concat([i,t("sha1").update(n).update(o).digest()]);return i.slice(0,a)};function r(n){var a=e.allocUnsafe(4);return a.writeUInt32BE(n,0),a}return Kl}var Gl,Iy;function _3(){return Iy||(Iy=1,Gl=function(e,r){for(var n=e.length,a=-1;++a<n;)e[a]^=r[a];return e}),Gl}var jl,By;function E3(){if(By)return jl;By=1;var t=er(),e=et().Buffer;function r(n,a){return e.from(n.toRed(t.mont(a.modulus)).redPow(new t(a.publicExponent)).fromRed().toArray())}return jl=r,jl}var Vl,Ty;function kx(){if(Ty)return Vl;Ty=1;var t=Df(),e=ts(),r=Zs(),n=w3(),a=_3(),i=er(),s=E3(),o=Od(),c=et().Buffer;Vl=function(b,v,w){var I;b.padding?I=b.padding:w?I=1:I=4;var S=t(b),T;if(I===4)T=u(S,v);else if(I===1)T=f(S,v,w);else if(I===3){if(T=new i(v),T.cmp(S.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return w?o(T,S):s(T,S)};function u(p,b){var v=p.modulus.byteLength(),w=b.length,I=r("sha1").update(c.alloc(0)).digest(),S=I.length,T=2*S;if(w>v-T-2)throw new Error("message too long");var C=c.alloc(v-w-T-2),k=v-S-1,$=e(S),G=a(c.concat([I,C,c.alloc(1,1),b],k),n($,k)),B=a($,n(G,S));return new i(c.concat([c.alloc(1),B,G],v))}function f(p,b,v){var w=b.length,I=p.modulus.byteLength();if(w>I-11)throw new Error("message too long");var S;return v?S=c.alloc(I-w-3,255):S=l(I-w-3),new i(c.concat([c.from([0,v?1:2]),S,c.alloc(1),b],I))}function l(p){for(var b=c.allocUnsafe(p),v=0,w=e(p*2),I=0,S;v<p;)I===w.length&&(w=e(p*2),I=0),S=w[I++],S&&(b[v++]=S);return b}return Vl}var zl,Py;function Cx(){if(Py)return zl;Py=1;var t=Df(),e=w3(),r=_3(),n=er(),a=Od(),i=Zs(),s=E3(),o=et().Buffer;zl=function(p,b,v){var w;p.padding?w=p.padding:v?w=1:w=4;var I=t(p),S=I.modulus.byteLength();if(b.length>S||new n(b).cmp(I.modulus)>=0)throw new Error("decryption error");var T;v?T=s(new n(b),I):T=a(b,I);
31var C=o.alloc(S-T.length);if(T=o.concat([C,T],S),w===4)return c(I,T);if(w===1)return u(I,T,v);if(w===3)return T;throw new Error("unknown padding")};function c(l,p){var b=l.modulus.byteLength(),v=i("sha1").update(o.alloc(0)).digest(),w=v.length;if(p[0]!==0)throw new Error("decryption error");var I=p.slice(1,w+1),S=p.slice(w+1),T=r(I,e(S,w)),C=r(S,e(T,b-w-1));if(f(v,C.slice(0,w)))throw new Error("decryption error");for(var k=w;C[k]===0;)k++;if(C[k++]!==1)throw new Error("decryption error");return C.slice(k)}function u(l,p,b){for(var v=p.slice(0,2),w=2,I=0;p[w++]!==0;)if(w>=p.length){I++;break}var S=p.slice(2,w-1);if((v.toString("hex")!=="0002"&&!b||v.toString("hex")!=="0001"&&b)&&I++,S.length<8&&I++,I)throw new Error("decryption error");return p.slice(w)}function f(l,p){l=o.from(l),p=o.from(p);var b=0,v=l.length;l.length!==p.length&&(b++,v=Math.min(l.length,p.length));for(var w=-1;++w<v;)b+=l[w]^p[w];return b}return zl}var My;function Ux(){return My||(My=1,(function(t){t.publicEncrypt=kx(),t.privateDecrypt=Cx(),t.privateEncrypt=function(r,n){return t.publicEncrypt(r,n,!0)},t.publicDecrypt=function(r,n){return t.privateDecrypt(r,n,!0)}})($l)),$l}var Ma={},Oy;function Dx(){if(Oy)return Ma;Oy=1;function t(){throw new Error(`secure random number generation not supported by this browser
32use chrome, FireFox or Internet Explorer 11`)}var e=et(),r=ts(),n=e.Buffer,a=e.kMaxLength,i=ft.crypto||ft.msCrypto,s=Math.pow(2,32)-1;function o(p,b){if(typeof p!="number"||p!==p)throw new TypeError("offset must be a number");if(p>s||p<0)throw new TypeError("offset must be a uint32");if(p>a||p>b)throw new RangeError("offset out of range")}function c(p,b,v){if(typeof p!="number"||p!==p)throw new TypeError("size must be a number");if(p>s||p<0)throw new TypeError("size must be a uint32");if(p+b>v||p>a)throw new RangeError("buffer too small")}i&&i.getRandomValues||!ke.browser?(Ma.randomFill=u,Ma.randomFillSync=l):(Ma.randomFill=t,Ma.randomFillSync=t);function u(p,b,v,w){if(!n.isBuffer(p)&&!(p instanceof ft.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof b=="function")w=b,b=0,v=p.length;else if(typeof v=="function")w=v,v=p.length-b;else if(typeof w!="function")throw new TypeError('"cb" argument must be a function');return o(b,p.length),c(v,b,p.length),f(p,b,v,w)}function f(p,b,v,w){if(ke.browser){var I=p.buffer,S=new Uint8Array(I,b,v);if(i.getRandomValues(S),w){ke.nextTick(function(){w(null,p)});return}return p}if(w){r(v,function(C,k){if(C)return w(C);k.copy(p,b),w(null,p)});return}var T=r(v);return T.copy(p,b),p}function l(p,b,v){if(typeof b>"u"&&(b=0),!n.isBuffer(p)&&!(p instanceof ft.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return o(b,p.length),v===void 0&&(v=p.length-b),c(v,b,p.length),f(p,b,v)}return Ma}var Ly;function S3(){if(Ly)return nt;Ly=1,nt.randomBytes=nt.rng=nt.pseudoRandomBytes=nt.prng=ts(),nt.createHash=nt.Hash=Zs(),nt.createHmac=nt.Hmac=Ww();var t=uS(),e=Object.keys(t),r=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);nt.getHashes=function(){return r};var n=e3();nt.pbkdf2=n.pbkdf2,nt.pbkdf2Sync=n.pbkdf2Sync;var a=US();nt.Cipher=a.Cipher,nt.createCipher=a.createCipher,nt.Cipheriv=a.Cipheriv,nt.createCipheriv=a.createCipheriv,nt.Decipher=a.Decipher,nt.createDecipher=a.createDecipher,nt.Decipheriv=a.Decipheriv,nt.createDecipheriv=a.createDecipheriv,nt.getCiphers=a.getCiphers,nt.listCiphers=a.listCiphers;var i=ZS();nt.DiffieHellmanGroup=i.DiffieHellmanGroup,nt.createDiffieHellmanGroup=i.createDiffieHellmanGroup,nt.getDiffieHellman=i.getDiffieHellman,nt.createDiffieHellman=i.createDiffieHellman,nt.DiffieHellman=i.DiffieHellman;var s=Lx();nt.createSign=s.createSign,nt.Sign=s.Sign,nt.createVerify=s.createVerify,nt.Verify=s.Verify,nt.createECDH=Nx();var o=Ux();nt.publicEncrypt=o.publicEncrypt,nt.privateEncrypt=o.privateEncrypt,nt.publicDecrypt=o.publicDecrypt,nt.privateDecrypt=o.privateDecrypt;var c=Dx();return nt.randomFill=c.randomFill,nt.randomFillSync=c.randomFillSync,nt.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet
33we accept pull requests
34https://github.com/browserify/crypto-browserify`)},nt.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},nt}var Ny;function Hx(){if(Ny)return ls;Ny=1,Object.defineProperty(ls,"__esModule",{value:!0}),ls.NodeRandomSource=void 0;const t=Ri();class e{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof e5<"u"){const n=S3();n&&n.randomBytes&&(this._crypto=n,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(n){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let a=this._crypto.randomBytes(n);if(a.length!==n)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(n);for(let s=0;s<i.length;s++)i[s]=a[s];return(0,t.wipe)(a),i}}return ls.NodeRandomSource=e,ls}var ky;function Fx(){if(ky)return us;ky=1,Object.defineProperty(us,"__esModule",{value:!0}),us.SystemRandomSource=void 0;const t=QE(),e=Hx();
34class r{constructor(){if(this.isAvailable=!1,this.name="",this._source=new t.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new e.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(a){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(a)}}return us.SystemRandomSource=r,us}var at={},Wl={},Cy;function qx(){return Cy||(Cy=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(o,c){var u=o>>>16&65535,f=o&65535,l=c>>>16&65535,p=c&65535;return f*p+(u*p+f*l<<16>>>0)|0}t.mul=Math.imul||e;function r(o,c){return o+c|0}t.add=r;function n(o,c){return o-c|0}t.sub=n;function a(o,c){return o<<c|o>>>32-c}t.rotl=a;function i(o,c){return o<<32-c|o>>>c}t.rotr=i;function s(o){return typeof o=="number"&&isFinite(o)&&Math.floor(o)===o}t.isInteger=Number.isInteger||s,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(o){return t.isInteger(o)&&o>=-t.MAX_SAFE_INTEGER&&o<=t.MAX_SAFE_INTEGER}})(Wl)),Wl}var Uy;function Cd(){if(Uy)return at;
34Uy=1,Object.defineProperty(at,"__esModule",{value:!0});var t=qx();function e(g,y){return y===void 0&&(y=0),(g[y+0]<<8|g[y+1])<<16>>16}at.readInt16BE=e;function r(g,y){return y===void 0&&(y=0),(g[y+0]<<8|g[y+1])>>>0}at.readUint16BE=r;function n(g,y){return y===void 0&&(y=0),(g[y+1]<<8|g[y])<<16>>16}at.readInt16LE=n;function a(g,y){return y===void 0&&(y=0),(g[y+1]<<8|g[y])>>>0}at.readUint16LE=a;function i(g,y,_){return y===void 0&&(y=new Uint8Array(2)),_===void 0&&(_=0),y[_+0]=g>>>8,y[_+1]=g>>>0,y}at.writeUint16BE=i,at.writeInt16BE=i;function s(g,y,_){return y===void 0&&(y=new Uint8Array(2)),_===void 0&&(_=0),y[_+0]=g>>>0,y[_+1]=g>>>8,y}at.writeUint16LE=s,at.writeInt16LE=s;function o(g,y){return y===void 0&&(y=0),g[y]<<24|g[y+1]<<16|g[y+2]<<8|g[y+3]}at.readInt32BE=o;function c(g,y){return y===void 0&&(y=0),(g[y]<<24|g[y+1]<<16|g[y+2]<<8|g[y+3])>>>0}at.readUint32BE=c;function u(g,y){return y===void 0&&(y=0),g[y+3]<<24|g[y+2]<<16|g[y+1]<<8|g[y]}at.readInt32LE=u;function f(g,y){return y===void 0&&(y=0),(g[y+3]<<24|g[y+2]<<16|g[y+1]<<8|g[y])>>>0}at.readUint32LE=f;function l(g,y,_){return y===void 0&&(y=new Uint8Array(4)),_===void 0&&(_=0),y[_+0]=g>>>24,y[_+1]=g>>>16,y[_+2]=g>>>8,y[_+3]=g>>>0,y}at.writeUint32BE=l,at.writeInt32BE=l;function p(g,y,_){return y===void 0&&(y=new Uint8Array(4)),_===void 0&&(_=0),y[_+0]=g>>>0,y[_+1]=g>>>8,y[_+2]=g>>>16,y[_+3]=g>>>24,y}at.writeUint32LE=p,at.writeInt32LE=p;function b(g,y){y===void 0&&(y=0);var _=o(g,y),R=o(g,y+4);return _*4294967296+R-(R>>31)*4294967296}at.readInt64BE=b;function v(g,y){y===void 0&&(y=0);var _=c(g,y),R=c(g,y+4);return _*4294967296+R}at.readUint64BE=v;function w(g,y){y===void 0&&(y=0);var _=u(g,y),R=u(g,y+4);return R*4294967296+_-(_>>31)*4294967296}at.readInt64LE=w;function I(g,y){y===void 0&&(y=0);var _=f(g,y),R=f(g,y+4);return R*4294967296+_}at.readUint64LE=I;function S(g,y,_){return y===void 0&&(y=new Uint8Array(8)),_===void 0&&(_=0),l(g/4294967296>>>0,y,_),l(g>>>0,y,_+4),y}at.writeUint64BE=S,at.writeInt64BE=S;function T(g,y,_){return y===void 0&&(y=new Uint8Array(8)),_===void 0&&(_=0),p(g>>>0,y,_),p(g/4294967296>>>0,y,_+4),y}at.writeUint64LE=T,at.writeInt64LE=T;function C(g,y,_){if(_===void 0&&(_=0),g%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(g/8>y.length-_)throw new Error("readUintBE: array is too short for the given b
34itLength");for(var R=0,A=1,E=g/8+_-1;E>=_;E--)R+=y[E]*A,A*=256;return R}at.readUintBE=C;function k(g,y,_){if(_===void 0&&(_=0),g%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(g/8>y.length-_)throw new Error("readUintLE: array is too short for the given bitLength");for(var R=0,A=1,E=_;E<_+g/8;E++)R+=y[E]*A,A*=256;return R}at.readUintLE=k;function $(g,y,_,R){if(_===void 0&&(_=new Uint8Array(g/8)),R===void 0&&(R=0),g%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!t.isSafeInteger(y))throw new Error("writeUintBE value must be an integer");for(var A=1,E=g/8+R-1;E>=R;E--)_[E]=y/A&255,A*=256;return _}at.writeUintBE=$;function G(g,y,_,R){if(_===void 0&&(_=new Uint8Array(g/8)),R===void 0&&(R=0),g%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!t.isSafeInteger(y))throw new Error("writeUintLE value must be an integer");for(var A=1,E=R;E<R+g/8;E++)_[E]=y/A&255,A*=256;return _}at.writeUintLE=G;function B(g,y){y===void 0&&(y=0);var _=new DataView(g.buffer,g.byteOffset,g.byteLength);return _.getFloat32(y)}at.readFloat32BE=B;function M(g,y){y===void 0&&(y=0);var _=new DataView(g.buffer,g.byteOffset,g.byteLength);return _.getFloat32(y,!0)}at.readFloat32LE=M;function N(g,y){y===void 0&&(y=0);var _=new DataView(g.buffer,g.byteOffset,g.byteLength);return _.getFloat64(y)}at.readFloat64BE=N;function P(g,y){y===void 0&&(y=0);var _=new DataView(g.buffer,g.byteOffset,g.byteLength);return _.getFloat64(y,!0)}at.readFloat64LE=P;function x(g,y,_){y===void 0&&(y=new Uint8Array(4)),_===void 0&&(_=0);var R=new DataView(y.buffer,y.byteOffset,y.byteLength);return R.setFloat32(_,g),y}at.writeFloat32BE=x;function d(g,y,_){y===void 0&&(y=new Uint8Array(4)),_===void 0&&(_=0);var R=new DataView(y.buffer,y.byteOffset,y.byteLength);return R.setFloat32(_,g,!0),y}at.writeFloat32LE=d;function m(g,y,_){y===void 0&&(y=new Uint8Array(8)),_===void 0&&(_=0);var R=new DataView(y.buffer,y.byteOffset,y.byteLength);return R.setFloat64(_,g),y}at.writeFloat64BE=m;function h(g,y,_){y===void 0&&(y=new Uint8Array(8)),_===void 0&&(_=0);var R=new DataView(y.buffer,y.byteOffset,y.byteLength);return R.setFloat64(_,g,!0),y}return at.writeFloat64LE=h,at}var Dy;function x3(){return Dy||(Dy=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=Fx(),r=Cd(),n=Ri();t.defaultRandomSource=new e.SystemRandomSource;function a(u,f=t.defaultRandomSource){return f.randomBytes(u)}t.randomBytes=a;function i(u=t.defaultRandomSource){const f=a(4,u),l=(0,r.readUint32LE)(f);return(0,n.wipe)(f),l}t.randomUint32=i;const s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function o(u,f=s,l=t.defaultRandomSource){if(f.length<2)throw new Error("randomString charset is too short");if(f.length>256)throw new Error("randomString charset is too long");let p="";const b=f.length,v=256-256%b;for(;u>0;){const w=a(Math.ceil(u*256/v),l);for(let I=0;I<w.length&&u>0;I++){const S=w[I];S<v&&(p+=f.charAt(S%b),u--)}(0,n.wipe)(w)}return p}t.randomString=o;function c(u,f=s,l=t.defaultRandomSource){const p=Math.ceil(u/(Math.log(f.length)/Math.LN2));return o(p,f,l)}t.randomStringForEntropy=c})(xc)),xc}var Hy;function Fy(){return Hy||(Hy=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=x3(),r=Ri();t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function n(k){const $=new Float64Array(16);if(k)for(let G=0;G<k.length;G++)$[G]=k[G];return $}const a=new Uint8Array(32);a[0]=9;const i=n([56129,1]);function s(k){let $=1;for(let G=0;G<16;G++){let B=k[G]+$+65535;$=Math.floor(B/65536),k[G]=B-$*65536}k[0]+=$-1+37*($-1)}function o(k,$,G){const B=~(G-1);for(let M=0;M<16;M++){const N=B&(k[M]^$[M]);k[M]^=N,$[M]^=N}}function c(k,$){const G=n(),B=n();for(let M=0;M<16;M++)B[M]=$[M];s(B),s(B),s(B);for(let M=0;M<2;M++){G[0]=B[0]-65517;for(let P=1;P<15;P++)G[P]=B[P]-65535-(G[P-1]>>16&1),G[P-1]&=65535;G[15]=B[15]-32767-(G[14]>>16&1);const N=G[15]>>16&1;G[14]&=65535,o(B,G,1-N)}for(let M=0;M<16;M++)k[2*M]=B[M]&255,k[2*M+1]=B[M]>>8}function u(k,$){for(let G=0;G<16;G++)k[G]=$[2*G]+($[2*G+1]<<8);k[15]&=32767}function f(k,$,G){for(let B=0;B<16;B++)k[B]=$[B]+G[B]}function l(k,$,G){for(let B=0;B<16;B++)k[B]=$[B]-G[B]}function p(k,$,G){let B,M,N=0,P=0,x=0,d=0,m=0,h=0,g=0,y=0,_=0,R=0,A=0,E=0,L=0,O=0,U=0,X=0,J=0,j=0,q=0,V=0,ee=0,ne=0,W=0,z=0,ae=0,pe=0,ge=0,be=0,_e=0,Ie=0,de=0,Pe=G[0],ye=G[1],we=G[2],Ee=G[3],ve=G[4],Be=G[5],Ue=G[6],xe=G[7],Ne=G[8],Ke=G[9],Z=G[10],D=G[11],F=G[12],Q=G[13],se=G[14],ce=G[15];B=$[0],N+=B*Pe,P+=B*ye,x+=B*we,d+=B*Ee,m+=B*ve,h+=B*Be,g+=B*Ue,y+=B*xe,_+=B*Ne,R+=B*Ke,A+=B*Z,E+=B*D,L+=B*F,O+=B*Q,U+=B*se,X+=B*ce,B=$[1],P+=B*Pe,x+=B*ye,d+=B*we,m+=B*Ee,h+=B*ve,g+=B*Be,y+=B*Ue,_+=B*xe,R+=B*Ne,A+=B*Ke,E+=B*Z,L+=B*D,O+=B*F,U+=B*Q,X+=B*se,J+=B*ce,B=$[2],x+=B*Pe,d+=B*ye,m+=B*we,h+=B*Ee,g+=B*ve,y+=B*Be,_+=B*Ue,R+=B*xe,A+=B*Ne,E+=B*Ke,L+=B*Z,O+=B*D,U+=B*F,X+=B*Q,J+=B*se,j+=B*ce,B=$[3],d+=B*Pe,m+=B*ye,h+=B*we,g+=B*Ee,y+=B*ve,_+=B*Be,R+=B*Ue,A+=B*xe,E+=B*Ne,L+=B*Ke,O+=B*Z,U+=B*D,X+=B*F,J+=B*Q,j+=B*se,q+=B*ce,B=$[4],m+=B*Pe,h+=B*ye,g+=B*we,y+=B*Ee,_+=B*ve,R+=B*Be,A+=B*Ue,E+=B*xe,L+=B*Ne,O+=B*Ke,
34U+=B*Z,X+=B*D,J+=B*F,j+=B*Q,q+=B*se,V+=B*ce,B=$[5],h+=B*Pe,g+=B*ye,y+=B*we,_+=B*Ee,R+=B*ve,A+=B*Be,E+=B*Ue,L+=B*xe,O+=B*Ne,U+=B*Ke,X+=B*Z,J+=B*D,j+=B*F,q+=B*Q,V+=B*se,ee+=B*ce,B=$[6],g+=B*Pe,y+=B*ye,_+=B*we,R+=B*Ee,A+=B*ve,E+=B*Be,L+=B*Ue,O+=B*xe,U+=B*Ne,X+=B*Ke,J+=B*Z,j+=B*D,q+=B*F,V+=B*Q,ee+=B*se,ne+=B*ce,B=$[7],y+=B*Pe,_+=B*ye,R+=B*we,A+=B*Ee,E+=B*ve,L+=B*Be,O+=B*Ue,U+=B*xe,X+=B*Ne,J+=B*Ke,j+=B*Z,q+=B*D,V+=B*F,ee+=B*Q,ne+=B*se,W+=B*ce,B=$[8],_+=B*Pe,R+=B*ye,A+=B*we,E+=B*Ee,L+=B*ve,O+=B*Be,U+=B*Ue,X+=B*xe,J+=B*Ne,j+=B*Ke,q+=B*Z,V+=B*D,ee+=B*F,ne+=B*Q,W+=B*se,z+=B*ce,B=$[9],R+=B*Pe,A+=B*ye,E+=B*we,L+=B*Ee,O+=B*ve,U+=B*Be,X+=B*Ue,J+=B*xe,j+=B*Ne,q+=B*Ke,V+=B*Z,ee+=B*D,ne+=B*F,W+=B*Q,z+=B*se,ae+=B*ce,B=$[10],A+=B*Pe,E+=B*ye,L+=B*we,O+=B*Ee,U+=B*ve,X+=B*Be,J+=B*Ue,j+=B*xe,q+=B*Ne,V+=B*Ke,ee+=B*Z,ne+=B*D,W+=B*F,z+=B*Q,ae+=B*se,pe+=B*ce,B=$[11],E+=B*Pe,L+=B*ye,O+=B*we,U+=B*Ee,X+=B*ve,J+=B*Be,j+=B*Ue,q+=B*xe,V+=B*Ne,ee+=B*Ke,ne+=B*Z,W+=B*D,z+=B*F,ae+=B*Q,pe+=B*se,ge+=B*ce,B=$[12],L+=B*Pe,O+=B*ye,U+=B*we,X+=B*Ee,J+=B*ve,j+=B*Be,q+=B*Ue,V+=B*xe,ee+=B*Ne,ne+=B*Ke,W+=B*Z,z+=B*D,ae+=B*F,pe+=B*Q,ge+=B*se,be+=B*ce,B=$[13],O+=B*Pe,U+=B*ye,X+=B*we,J+=B*Ee,j+=B*ve,q+=B*Be,V+=B*Ue,ee+=B*xe,ne+=B*Ne,W+=B*Ke,z+=B*Z,ae+=B*D,pe+=B*F,ge+=B*Q,be+=B*se,_e+=B*ce,B=$[14],U+=B*Pe,X+=B*ye,J+=B*we,j+=B*Ee,q+=B*ve,V+=B*Be,ee+=B*Ue,ne+=B*xe,W+=B*Ne,z+=B*Ke,ae+=B*Z,pe+=B*D,ge+=B*F,be+=B*Q,_e+=B*se,Ie+=B*ce,B=$[15],X+=B*Pe,J+=B*ye,j+=B*we,q+=B*Ee,V+=B*ve,ee+=B*Be,ne+=B*Ue,W+=B*xe,z+=B*Ne,ae+=B*Ke,pe+=B*Z,ge+=B*D,be+=B*F,_e+=B*Q,Ie+=B*se,de+=B*ce,N+=38*J,P+=38*j,x+=38*q,d+=38*V,m+=38*ee,h+=38*ne,g+=38*W,y+=38*z,_+=38*ae,R+=38*pe,A+=38*ge,E+=38*be,L+=38*_e,O+=38*Ie,U+=38*de,M=1,B=N+M+65535,M=Math.floor(B/65536),N=B-M*65536,B=P+M+65535,M=Math.floor(B/65536),P=B-M*65536,B=x+M+65535,M=Math.floor(B/65536),x=B-M*65536,B=d+M+65535,M=Math.floor(B/65536),d=B-M*65536,B=m+M+65535,M=Math.floor(B/65536),m=B-M*65536,B=h+M+65535,M=Math.floor(B/65536),h=B-M*65536,B=g+M+65535,M=Math.floor(B/65536),g=B-M*65536,B=y+M+65535,M=Math.floor(B/65536),y=B-M*65536,B=_+M+65535,M=Math.floor(B/65536),_=B-M*65536,B=R+M+65535,M=Math.floor(B/65536),R=B-M*65536,B=A+M+65535,M=Math.floor(B/65536),A=B-M*65536,B=E+M+65535,M=Math.floor(B/65536),E=B-M*65536,B=L+M+65535,M=Math.floor(B/65536),L=B-M*65536,B=O+M+65535,M=Math.floor(B/65536),O=B-M*65536,B=U+M+65535,M=Math.floor(B/65536),U=B-M*65536,B=X+M+65535,M=Math.floor(B/65536),X=B-M*65536,N+=M-1+37*(M-1),M=1,B=N+M+65535,M=Math.floor(B/65536),N=B-M*65536,B=P+M+65535,M=Math.floor(B/65536),P=B-M*65536,B=x+M+65535,M=Math.floor(B/65536),x=B-M*65536,B=d+M+65535,M=Math.floor(B/65536),d=B-M*65536,B=m+M+65535,M=Math.floor(B/65536),m=B-M*65536,B=h+M+65535,M=Math.floor(B/65536),h=B-M*65536,B=g+M+65535,M=Math.floor(B/65536),g=B-M*65536,B=y+M+65535,M=Math.floor(B/65536),y=B-M*65536,B=_+M+65535,M=Math.floor(B/65536),_=B-M*65536,B=R+M+65535,M=Math.floor(B/65536),R=B-M*65536,B=A+M+65535,M=Math.floor(B/65536),A=B-M*65536,B=E+M+65535,M=Math.floor(B/65536),E=B-M*65536,B=L+M+65535,M=Math.floor(B/65536),L=B-M*65536,B=O+M+65535,M=Math.floor(B/65536),O=B-M*65536,B=U+M+65535,M=Math.floor(B/65536),U=B-M*65536,B=X+M+65535,M=Math.floor(B/65536),X=B-M*65536,N+=M-1+37*(M-1),k[0]=N,k[1]=P,k[2]=x,k[3]=d,k[4]=m,k[5]=h,k[6]=g,k[7]=y,k[8]=_,k[9]=R,k[10]=A,k[11]=E,k[12]=L,k[13]=O,k[14]=U,k[15]=X}function b(k,$){p(k,$,$)}function v(k,$){const G=n();for(let B=0;B<16;B++)G[B]=$[B];for(let B=253;B>=0;B--)b(G,G),B!==2&&B!==4&&p(G,G,$);for(let B=0;B<16;B++)k[B]=G[B]}function w(k,$){const G=new Uint8Array(32),B=new Float64Array(80),M=n(),N=n(),P=n(),x=n(),d=n(),m=n();for(let _=0;_<31;_++)G[_]=k[_];G[31]=k[31]&127|64,G[0]&=248,u(B,$);for(let _=0;_<16;_++)N[_]=B[_];M[0]=x[0]=1;for(let _=254;_>=0;--_){const R=G[_>>>3]>>>(_&7)&1;o(M,N,R),o(P,x,R),f(d,M,P),l(M,M,P),f(P,N,x),l(N,N,x),b(x,d),b(m,M),p(M,P,M),p(P,N,d),f(d,M,P),l(M,M,P),b(N,M),l(P,x,m),p(M,P,i),f(M,M,x),p(P,P,M),p(M,x,m),p(x,N,B),b(N,d),o(M,N,R),o(P,x,R)}for(let _=0;_<16;_++)B[_+16]=M[_],B[_+32]=P[_],B[_+48]=N[_],B[_+64]=x[_];const h=B.subarray(32),g=B.subarray(16);v(h,h),p(g,g,h);const y=new Uint8Array(32);return c(y,g),y}t.scalarMult=w;function I(k){return w(k,a)}t.scalarMultBase=I;function S(k){if(k.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const $=new Uint8Array(k);return{publicKey:I($),secretKey:$}}t.generateKeyPairFromSeed=S;function T(k){const $=(0,e.randomBytes)(32,k),G=S($);return(0,r.wipe)($),G}t.generateKeyPair=T;function C(k,$,G=!1){if(k.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if($.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const B=w(k,$);if(G){let M=0;for(let N=0;N<B.length;N++)M|=B[N];if(M===0)throw new Error("X25519: invalid shared key")}return B}t.sharedKey=C})(Sc)),Sc}var Oa={},ps={},qy;function $x(){if(qy)return ps;qy=1,Object.defineProperty(ps,"__esModule",{value:!0});var t=Cd(),e=Ri(),r=20;function n(o,c,u){for(var f=1634760805,l=u[3]<<24|u[2]<<16|u[1]<<8|u[0],p=u[7]<<24|u[6]<<16|u[5]<<8|u[4],b=u[11]<<24|u[10]<<16|u[9]<<8|u[8],v=u[15]<<24|u[14]<<16|u[13]<<8|u[12],w=857760878,I=c[3]<<24|c[2]<<16|c[1]<<8|c[0],S=c[7]<<24|c[6]<<16|c[5]<<8|c[4],T=c[11]<<24|c[10]<<16|c[9]<<8|c[8],C=c[15]<<24|c[14]<<16|c[13]<<8|c[12],k=2036477234,$=u[19]<<24|u[18]<<16|u[17]<<8|u[16],G=u[23]<<24|u[22]<<16|u[21]<<8|u[20],B=u[27]<<24|u[26]<<16|u[25]<<8|u[24],M=u[31]<<24|u[30]<<16|u[29]<<8|u[28],N=1797285236,P=f,x=l,d=p,m=b,h=v,g=w,y=I,_=S,R=T,A=C,E=k,L=$,O=G,U=B,X=M,J=N,j,q=0;q<r;q+=2)j=P+O|0,h^=j<<7|j>>>25,j=h+P|0,R^=j<<9|j>>>23,j=R+h|0,O^=j<<13|j>>>19,j=O+R|0,P^=j<<18|j>>>14,j=g+x|0,A^=j<<7|j>>>25,j=A+g|0,U^=j<<9|j>>>23,j=U+A|0,x^=j<<13|j>>>19,j=x+U|0,g^=j<<18|j>>>14,j=E+y|0,X^=j<<7|j>>>25,j=X+E|0,d^=j<<9|j>>>23,j=d+X|0,y^=j<<13|j>>>19,j=y+d|0,E^=j<<18|j>>>14,j=J+L|0,m^=j<<7|j>>>25,j=m+J|0,_^=j<<9|j>>>23,j=_+m|0,L^=j<<13|j>>>19,j=L+_|0,J^=j<<18|j>>>14,j=P+m|0,x^=j<<7|j>>>25,j=x+P|0,d^=j<<9|j>>>23,j=d+x|0,m^=j<<13|j>>>19,j=m+d|0,P^=j<<18|j>>>14,j=g+h|0,y^=j<<7|j>>>25,j=y+g|0,_^=j<<9|j>>>23,j=_+y|0,h^=j<<13|j>>>19,j=h+_|0,g^=j<<18|j>>>14,j=E+A|0,L^=j<<7|j>>>25,j=L+E|0,R^=j<<9|j>>>23,j=R+L|0,A^=j<<13|j>>>19,j=A+R|0,E^=j<<18|j>>>14,j=J+X|0,O^=j<<7|j>>>25,j=O+J|0,U^=j<<9|j>>>23,j=U+O|0,X^=j<<13|j>>>19,j=X+U|0,J^=j<<18|j>>>14;t.writeUint32LE(P+f|0,o,0),t.writeUint32LE(x+l|0,o,4),t.writeUint32LE(d+p|0,o,8),t.writeUint32LE(m+b|0,o,12),t.writeUint32LE(h+v|0,o,16),t.writeUint32LE(g+w|0,o,20),t.writeUint32LE(y+I|0,o,24),t.writeUint32LE(_+S|0,o,28),t.writeUint32LE(R+T|0,o,32),t.writeUint32LE(A+C|0,o,36),t.writeUint32LE(E+k|0,o,40),t.writeUint32LE(L+$|0,o,44),t.writeUint32LE(O+G|0,o,48),t.writeUint32LE(U+B|0,o,52),t.writeUint32LE(X+M|0,o,56),t.writeUint32LE(J+N|0,o,60)}function a(o,c,u,f,l){if(l===void 0&&(l=0),o.length!==32)throw new Error("Salsa20: key size must be 32 bytes");if(f.length<u.length)throw new Error("Salsa20: destination is shorter than source");var p,b;if(l===0){if(c.length!==8)throw new Error("Salsa20 nonce must be 8 bytes");p=new Uint8Array(16),p.set(c),b=c.length}else{if(c.length!==16)throw new Error("Salsa20 nonce with counter must be 16 bytes");p=c,b=16-l}for(var v=new Uint8Array(64),w=0;w<u.length;w+=64){n(v,p,o);for(var I=w;I<w+64&&I<u.length;I++)f[I]=u[I]^v[I-w];s(p,b,p.length-b)}return e.wipe(v),l===0&&e.wipe(p),f}ps.streamXOR=a;function i(o,c,u,f){return f===void 0&&(f=0),e.wipe(u),a(o,c,u,u,f)}ps.stream=i;function s(o,c,u){for(var f=1;u--;)f=f+(o[c]&255)|0,o[c]=f&255,f>>>=8,c++;if(f>0)throw new Error("Salsa20: counter overflow")}return ps}var $y;function A3(){if($y)return Oa;$y=1,Object.defineProperty(Oa,"__esModule",{value:!0});var t=Cd(),e=$x(),r=Ri();function n(o,c,u,f,l){if(l===void 0&&(l=0),l===0){if(c.length!==24)throw new Error("XSalsa20 nonce must be 24 bytes")}else if(c.length!==32)throw new Error("XSalsa20 nonce with counter must be 32 bytes");var p=s(o,c.subarray(0,16),new Uint8Array(32)),b=e.streamXOR(p,c.subarray(16),u,f,l);return r.wipe(p),b}Oa.streamXOR=n;function a(o,c,u,f){return f===void 0&&(f=0),r.wipe(u),n(o,c,u,u,f)}Oa.stream=a;var i=20;function s(o,c,u){for(var f=1634760805,l=o[3]<<24|o[2]<<16|o[1]<<8|o[0],p=o[7]<<24|o[6]<<16|o[5]<<8|o[4],b=o[11]<<24|o[10]<<16|o[9]<<8|o[8],v=o[15]<<24|o[14]<<16|o[13]<<8|o[12],w=857760878,I=c[3]<<24|c[2]<<16|c[1]<<8|c[0],S=c[7]<<24|c[6]<<16|c[5]<<8|c[4],T=c[11]<<24|c[10]<<16|c[9]<<8|c[8],C=c[15]<<24|c[14]<<16|c[13]<<8|c[12],k=2036477234,$=o[19]<<24|o[18]<<16|o[17]<<8|o[16],G=o[23]<<24|o[22]<<16|o[21]<<8|o[20],B=o[27]<<24|o[26]<<16|o[25]<<8|o[24],M=o[31]<<24|o[30]<<16|o[29]<<8|o[28],N=1797285236,P,x=0;x<i;x+=2)P=f+G|0,v^=P<<7|P>>>25,P=v+f|0,T^=P<<9|P>>>23,P=T+v|0,G^=P<<13|P>>>19,P=G+T|0,f^=P<<18|P>>>14,P=w+l|0,C^=P<<7|P>>>25,P=C+w|0,B^=P<<9|P>>>23,P=B+C|0,l^=P<<13|P>>>19,P=l+B|0,w^=P<<18|P>>>14,P=k+I|0,M^=P<<7|P>>>25,P=M+k|0,p^=P<<9|P>>>23,P=p+M|0,I^=P<<13|P>>>19,P=I+p|0,k^=P<<18|P>>>14,P=N+$|0,b^=P<<7|P>>>25,P=b+N|0,S^=P<<9|P>>>23,P=S+b|0,$^=P<<13|P>>>19,P=$+S|0,N^=P<<18|P>>>14,P=f+b|0,l^=P<<7|P>>>25,P=l+f|0,p^=P<<9|P>>>23,P=p+l|0,b^=P<<13|P>>>19,P=b+p|0,f^=P<<18|P>>>14,P=w+v|0,I^=P<<7|P>>>25,P=I+w|0,S^=P<<9|P>>>23,P=S+I|0,v^=P<<13|P>>>19,P=v+S|0,w^=P<<18|P>>>14,P=k+C|0,$^=P<<7|P>>>25,P=$+k|0,T^=P<<9|P>>>23,P=T+$|0,C^=P<<13|P>>>19,P=C+T|0,k^=P<<18|P>>>14,P=N+M|0,G^=P<<7|P>>>25,P=G+N|0,B^=P<<9|P>>>23,P=B+G|0,M^=P<<13|P>>>19,P=M+B|0,N^=P<<18|P>>>14;return t.writeUint32LE(f,u,0),t.writeUint32LE(w,u,4),t.writeUint32LE(k,u,8),t.writeUint32LE(N,u,12),t.writeUint32LE(I,u,16),t.writeUint32LE(S,u,20),t.writeUint32LE(T,u,24),t.writeUint32LE(C,u,28),u}return Oa.hsalsa=s,Oa}var pn={},Zl={},Yi={},Ky;function Kx(){if(Ky)return Yi;Ky=1,Object.defineProperty(Yi,"__esModule",{value:!0});
34function t(a,i,s){return~(a-1)&i|a-1&s}Yi.select=t;function e(a,i){return(a|0)-(i|0)-1>>>31&1}Yi.lessOrEqual=e;function r(a,i){if(a.length!==i.length)return 0;for(var s=0,o=0;o<a.length;o++)s|=a[o]^i[o];return 1&s-1>>>8}Yi.compare=r;function n(a,i){return a.length===0||i.length===0?!1:r(a,i)!==0}return Yi.equal=n,Yi}var Gy;function Gx(){return Gy||(Gy=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Kx(),r=Ri();t.DIGEST_LENGTH=16;var n=(function(){function s(o){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=o[0]|o[1]<<8;this._r[0]=c&8191;var u=o[2]|o[3]<<8;this._r[1]=(c>>>13|u<<3)&8191;var f=o[4]|o[5]<<8;this._r[2]=(u>>>10|f<<6)&7939;var l=o[6]|o[7]<<8;this._r[3]=(f>>>7|l<<9)&8191;var p=o[8]|o[9]<<8;this._r[4]=(l>>>4|p<<12)&255,this._r[5]=p>>>1&8190;var b=o[10]|o[11]<<8;this._r[6]=(p>>>14|b<<2)&8191;var v=o[12]|o[13]<<8;this._r[7]=(b>>>11|v<<5)&8065;var w=o[14]|o[15]<<8;this._r[8]=(v>>>8|w<<8)&8191,this._r[9]=w>>>5&127,this._pad[0]=o[16]|o[17]<<8,this._pad[1]=o[18]|o[19]<<8,this._pad[2]=o[20]|o[21]<<8,this._pad[3]=o[22]|o[23]<<8,this._pad[4]=o[24]|o[25]<<8,this._pad[5]=o[26]|o[27]<<8,this._pad[6]=o[28]|o[29]<<8,this._pad[7]=o[30]|o[31]<<8}return s.prototype._blocks=function(o,c,u){for(var f=this._fin?0:2048,l=this._h[0],p=this._h[1],b=this._h[2],v=this._h[3],w=this._h[4],I=this._h[5],S=this._h[6],T=this._h[7],C=this._h[8],k=this._h[9],$=this._r[0],G=this._r[1],B=this._r[2],M=this._r[3],N=this._r[4],P=this._r[5],x=this._r[6],d=this._r[7],m=this._r[8],h=this._r[9];u>=16;){var g=o[c+0]|o[c+1]<<8;l+=g&8191;var y=o[c+2]|o[c+3]<<8;p+=(g>>>13|y<<3)&8191;var _=o[c+4]|o[c+5]<<8;b+=(y>>>10|_<<6)&8191;var R=o[c+6]|o[c+7]<<8;v+=(_>>>7|R<<9)&8191;var A=o[c+8]|o[c+9]<<8;w+=(R>>>4|A<<12)&8191,I+=A>>>1&8191;var E=o[c+10]|o[c+11]<<8;S+=(A>>>14|E<<2)&8191;var L=o[c+12]|o[c+13]<<8;T+=(E>>>11|L<<5)&8191;var O=o[c+14]|o[c+15]<<8;C+=(L>>>8|O<<8)&8191,k+=O>>>5|f;var U=0,X=U;X+=l*$,X+=p*(5*h),X+=b*(5*m),X+=v*(5*d),X+=w*(5*x),U=X>>>13,X&=8191,X+=I*(5*P),X+=S*(5*N),X+=T*(5*M),X+=C*(5*B),X+=k*(5*G),U+=X>>>13,X&=8191;var J=U;J+=l*G,J+=p*$,J+=b*(5*h),J+=v*(5*m),J+=w*(5*d),U=J>>>13,J&=8191,J+=I*(5*x),J+=S*(5*P),J+=T*(5*N),J+=C*(5*M),J+=k*(5*B),U+=J>>>13,J&=8191;var j=U;j+=l*B,j+=p*G,j+=b*$,j+=v*(5*h),j+=w*(5*m),U=j>>>13,j&=8191,j+=I*(5*d),j+=S*(5*x),j+=T*(5*P),j+=C*(5*N),j+=k*(5*M),U+=j>>>13,j&=8191;var q=U;q+=l*M,q+=p*B,q+=b*G,q+=v*$,q+=w*(5*h),U=q>>>13,q&=8191,q+=I*(5*m),q+=S*(5*d),q+=T*(5*x),q+=C*(5*P),q+=k*(5*N),U+=q>>>13,q&=8191;var V=U;V+=l*N,V+=p*M,V+=b*B,V+=v*G,V+=w*$,U=V>>>13,V&=8191,V+=I*(5*h),V+=S*(5*m),V+=T*(5*d),V+=C*(5*x),V+=k*(5*P),U+=V>>>13,V&=8191;var ee=U;ee+=l*P,ee+=p*N,ee+=b*M,ee+=v*B,ee+=w*G,U=ee>>>13,ee&=8191,ee+=I*$,ee+=S*(5*h),ee+=T*(5*m),ee+=C*(5*d),ee+=k*(5*x),U+=ee>>>13,ee&=8191;var ne=U;ne+=l*x,ne+=p*P,ne+=b*N,ne+=v*M,ne+=w*B,U=ne>>>13,ne&=8191,ne+=I*G,ne+=S*$,ne+=T*(5*h),ne+=C*(5*m),ne+=k*(5*d),U+=ne>>>13,ne&=8191;var W=U;W+=l*d,W+=p*x,W+=b*P,W+=v*N,W+=w*M,U=W>>>13,W&=8191,W+=I*B,W+=S*G,W+=T*$,W+=C*(5*h),W+=k*(5*m),U+=W>>>13,W&=8191;var z=U;z+=l*m,z+=p*d,z+=b*x,z+=v*P,z+=w*N,U=z>>>13,z&=8191,z+=I*M,z+=S*B,z+=T*G,z+=C*$,z+=k*(5*h),U+=z>>>13,z&=8191;var ae=U;ae+=l*h,ae+=p*m,ae+=b*d,ae+=v*x,ae+=w*P,U=ae>>>13,ae&=8191,ae+=I*N,ae+=S*M,ae+=T*B,ae+=C*G,ae+=k*$,U+=ae>>>13,ae&=8191,U=(U<<2)+U|0,U=U+X|0,X=U&8191,U=U>>>13,J+=U,l=X,p=J,b=j,v=q,w=V,I=ee,S=ne,T=W,C=z,k=ae,c+=16,u-=16}this._h[0]=l,this._h[1]=p,this._h[2]=b,this._h[3]=v,this._h[4]=w,this._h[5]=I,this._h[6]=S,this._h[7]=T,this._h[8]=C,this._h[9]=k},s.prototype.finish=function(o,c){c===void 0&&(c=0);var u=new Uint16Array(10),f,l,p,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(f=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=f,f=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=f*5,f=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=f,f=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=f,u[0]=this._h[0]+5,f=u[0]>>>13,u[0]&=8191,b=1;b<10;b++)u[b]=this._h[b]+f,f=u[b]>>>13,u[b]&=8191;for(u[9]-=8192,l=(f^1)-1,b=0;b<10;b++)u[b]&=l;for(l=~l,b=0;b<10;b++)this._h[b]=this._h[b]&l|u[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,p=this._h[0]+this._pad[0],this._h[0]=p&65535,b=1;b<8;b++)p=(this._h[b]+this._pad[b]|0)+(p>>>16)|0,this._h[b]=p&65535;return o[c+0]=this._h[0]>>>0,o[c+1]=this._h[0]>>>8,o[c+2]=this._h[1]>>>0,o[c+3]=this._h[1]>>>8,o[c+4]=this._h[2]>>>0,o[c+5]=this._h[2]>>>8,o[c+6]=this._h[3]>>>0,o[c+7]=this._h[3]>>>8,o[c+8]=this._h[4]>>>0,o[c+9]=this._h[4]>>>8,o[c+10]=this._h[5]>>>0,o[c+11]=this._h[5]>>>8,o[c+12]=this._h[6]>>>0,o[c+13]=this._h[6]>>>8,o[c+14]=this._h[7]>>>0,o[c+15]=this._h[7]>>>8,this._finished=!0,this},s.prototype.update=function(o){var c=0,u=o.length,f;if(this._leftover){f=16-this._leftover,f>u&&(f=u);for(var l=0;l<f;l++)this._buffer[this._leftover+l]=o[c+l];if(u-=f,c+=f,this._leftover+=f,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(u>=16&&(f=u-u%16,this._blocks(o,c,f),c+=f,u-=f),u){for(var l=0;l<u;l++)this._buffer[this._leftover+l]=o[c+l];this._leftover+=u}return this},s.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var o=new Uint8Array(16);return this.finish(o),o},s.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},s})();t.Poly1305=n;function a(s,o){var c=new n(s);c.update(o);var u=c.digest();return c.clean(),u}t.oneTimeAuth=a;function i(s,o){return s.length!==t.DIGEST_LENGTH||o.length!==t.DIGEST_LENGTH?!1:e.equal(s,o)}t.equal=i}
34)(Zl)),Zl}var jy;function R3(){if(jy)return pn;jy=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.generateKey=pn.openSecretBox=pn.secretBox=void 0;const t=A3(),e=Gx(),r=Ri(),n=x3();function a(o,c,u){if(c.length!==24)throw new Error("secretBox nonce must be 24 bytes");const f=new Uint8Array(64),l=new Uint8Array(32);l.set(c),(0,t.stream)(o,l,f,8);const p=new Uint8Array(16+u.length);for(let v=0;v<32&&v<u.length;v++)p[16+v]=u[v]^f[32+v];u.length>32&&(0,t.streamXOR)(o,l,u.subarray(32),p.subarray(48),8);const b=(0,e.oneTimeAuth)(f.subarray(0,32),p.subarray(16));for(let v=0;v<b.length;v++)p[v]=b[v];return(0,r.wipe)(b),(0,r.wipe)(f),(0,r.wipe)(l),p}pn.secretBox=a;function i(o,c,u){if(c.length!==24)throw new Error("secretBox nonce must be 24 bytes");if(u.length<16)throw new Error("secretBox data must be at least 16 bytes");const f=new Uint8Array(64),l=new Uint8Array(32);l.set(c),(0,t.stream)(o,l,f,8);const p=(0,e.oneTimeAuth)(f.subarray(0,32),u.subarray(16));if(!(0,e.equal)(p,u.subarray(0,16)))return null;const b=u.subarray(16),v=new Uint8Array(b.length);for(let w=0;w<32&&w<b.length;w++)v[w]=b[w]^f[32+w];return b.length>32&&(0,t.streamXOR)(o,l,b.subarray(32),v.subarray(32),8),(0,r.wipe)(p),(0,r.wipe)(f),(0,r.wipe)(l),v}pn.openSecretBox=i;function s(o){return(0,n.randomBytes)(32,o)}return pn.generateKey=s,pn}var Vy;function jx(){return Vy||(Vy=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.openBox=t.box=t.precomputeSharedKey=t.generateKeyPair=void 0;const e=Fy(),r=A3(),n=R3(),a=Ri();var i=Fy();Object.defineProperty(t,"generateKeyPair",{enumerable:!0,get:function(){return i.generateKeyPair}});const s=new Uint8Array(16);function o(f,l){const p=(0,e.scalarMult)(l,f);return(0,r.hsalsa)(p,s,p),p}t.precomputeSharedKey=o;function c(f,l,p,b){const v=o(f,l),w=(0,n.secretBox)(v,p,b);return(0,a.wipe)(v),w}t.box=c;function u(f,l,p,b){const v=o(f,l),w=(0,n.openSecretBox)(v,p,b);return(0,a.wipe)(v),w}t.openBox=u})(Ec)),Ec}var zy;function Vx(){return zy||(zy=1,(function(t){var e=Vi&&Vi.__createBinding||(Object.create?(function(n,a,i,s){s===void 0&&(s=i);var o=Object.getOwnPropertyDescriptor(a,i);(!o||("get"in o?!a.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return a[i]}}),Object.defineProperty(n,s,o)}):(function(n,a,i,s){s===void 0&&(s=i),n[s]=a[i]})),r=Vi&&Vi.__exportStar||function(n,a){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(a,i)&&e(a,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(jx(),t),r(R3(),t)})(Vi)),Vi}Vx();var Yl,Wy;function zx(){return Wy||(Wy=1,Yl=function(e){return ArrayBuffer.isView(e)?Fe.from(e.buffer,e.byteOffset,e.byteLength):Fe.from(e)}),Yl}var Wx=zx();const EI=Q0(Wx);Cf();function Pr(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Ls(t,e,r,n,a){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Zx(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function N0(t,e=""){if(!Number.isSafeInteger(t)||t<0){const r=e&&`"${e}" `;throw new Error(`${r}expected integer >= 0, got ${t}`)}}function ga(t,e,r=""){const n=Zx(t),a=t?.length,i=e!==void 0;if(!n||i&&a!==e){const s=r&&`"${r}" `,o=i?` of length ${e}`:"",c=n?`length=${a}`:`type=${typeof t}`;throw new Error(s+"expected Uint8Array"+o+", got "+c)}return t}function Zy(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Yx(t,e){ga(t,void 0,"digestInto() output");const r=e.outputLen;if(t.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function tf(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function k0(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const I3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function B3(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const mn=I3?t=>t:t=>B3(t);function Xx(t){for(let e=0;e<t.length;e++)t[e]=B3(t[e]);return t}const La=I3?t=>t:Xx;function Jx(t,e={}){const r=(a,i)=>t(i).update(a).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=a=>t(a),Object.assign(r,e),Object.freeze(r)}const Qx=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,
346,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),Ao=BigInt(2**32-1),Yy=BigInt(32);function eA(t,e=!1){return e?{h:Number(t&Ao),l:Number(t>>Yy&Ao)}:{h:Number(t>>Yy&Ao)|0,l:Number(t&Ao)|0}}const T3=(t,e,r)=>t>>>r|e<<32-r,P3=(t,e,r)=>t<<32-r|e>>>r,tA=(t,e,r)=>t<<64-r|e>>>r-32,rA=(t,e,r)=>t>>>r-32|e<<64-r,nA=(t,e)=>e,iA=(t,e)=>t;function M3(t,e,r,n){const a=(e>>>0)+(n>>>0);return{h:t+r+(a/2**32|0)|0,l:a|0}}const O3=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),L3=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Kt=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Re=new Uint32Array(32);function Jn(t,e,r,n,a,i){const s=a[i],o=a[i+1];let c=Re[2*t],u=Re[2*t+1],f=Re[2*e],l=Re[2*e+1],p=Re[2*r],b=Re[2*r+1],v=Re[2*n],w=Re[2*n+1],I=O3(c,f,s);u=L3(I,u,l,o),c=I|0,{Dh:w,Dl:v}={Dh:w^u,Dl:v^c},{Dh:w,Dl:v}={Dh:nA(w,v),Dl:iA(w)},{h:b,l:p}=M3(b,p,w,v),{Bh:l,Bl:f}={Bh:l^b,Bl:f^p},{Bh:l,Bl:f}={Bh:T3(l,f,24),Bl:P3(l,f,24)},Re[2*t]=c,Re[2*t+1]=u,Re[2*e]=f,Re[2*e+1]=l,Re[2*r]=p,Re[2*r+1]=b,Re[2*n]=v,Re[2*n+1]=w}function Qn(t,e,r,n,a,i){const s=a[i],o=a[i+1];let c=Re[2*t],u=Re[2*t+1],f=Re[2*e],l=Re[2*e+1],p=Re[2*r],b=Re[2*r+1],v=Re[2*n],w=Re[2*n+1],I=O3(c,f,s);u=L3(I,u,l,o),c=I|0,{Dh:w,Dl:v}={Dh:w^u,Dl:v^c},{Dh:w,Dl:v}={Dh:T3(w,v,16),Dl:P3(w,v,16)},{h:b,l:p}=M3(b,p,w,v),{Bh:l,Bl:f}={Bh:l^b,Bl:f^p},{Bh:l,Bl:f}={Bh:tA(l,f,63),Bl:rA(l,f,63)},Re[2*t]=c,Re[2*t+1]=u,Re[2*e]=f,Re[2*e+1]=l,Re[2*r]=p,Re[2*r+1]=b,Re[2*n]=v,Re[2*n+1]=w}function aA(t,e={},r,n,a){if(N0(r),t<0||t>r)throw new Error("outputLen bigger than keyLen");const{key:i,salt:s,personalization:o}=e;if(i!==void 0&&(i.length<1||i.length>r))throw new Error('"key" expected to be undefined or of length=1..'+r);s!==void 0&&ga(s,n,"salt"),o!==void 0&&ga(o,a,"personalization")}class sA{buffer;buffer32;finished=!1;destroyed=!1;length=0;pos=0;blockLen;outputLen;constructor(e,r){N0(e),N0(r),this.blockLen=e,this.outputLen=r,this.buffer=new Uint8Array(e),this.buffer32=tf(this.buffer)}update(e){Zy(this),ga(e);const{blockLen:r,buffer:n,buffer32:a}=this,i=e.length,s=e.byteOffset,o=e.buffer;for(let c=0;c<i;){this.pos===r&&(La(a),this.compress(a,0,!1),La(a),this.pos=0);const u=Math.min(r-this.pos,i-c),f=s+c;if(u===r&&!(f%4)&&c+u<i){const l=new Uint32Array(o,f,Math.floor((i-c)/4));La(l);for(let p=0;c+r<i;p+=a.length,c+=r)this.length+=r,this.compress(l,p,!1);La(l);continue}n.set(e.subarray(c,c+u),this.pos),this.pos+=u,this.length+=u,c+=u}return this}digestInto(e){Zy(this),Yx(e,this);const{pos:r,buffer32:n}=this;this.finished=!0,k0(this.buffer.subarray(r)),La(n),this.compress(n,0,!0),La(n);const a=tf(e);this.get().forEach((i,s)=>a[s]=mn(i))}digest(){const{buffer:e,outputLen:r}=this;this.digestInto(e);const n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){const{buffer:r,length:n,finished:a,destroyed:i,outputLen:s,pos:o}=this;return e||=new this.constructor({dkLen:s}),e.set(...this.get()),e.buffer.set(r),e.destroyed=i,e.finished=a,e.length=n,e.pos=o,e.outputLen=s,e}clone(){return this._cloneInto()}}class oA extends sA{v0l=Kt[0]|0;v0h=Kt[1]|0;v1l=Kt[2]|0;v1h=Kt[3]|0;v2l=Kt[4]|0;v2h=Kt[5]|0;v3l=Kt[6]|0;v3h=Kt[7]|0;v4l=Kt[8]|0;v4h=Kt[9]|0;v5l=Kt[10]|0;v5h=Kt[11]|0;v6l=Kt[12]|0;v6h=Kt[13]|0;v7l=Kt[14]|0;v7h=Kt[15]|0;constructor(e={}){const r=e.dkLen===void 0?64:e.dkLen;super(128,r),aA(r,e,64,16,16);let{key:n,personalization:a,salt:i}=e,s=0;if(n!==void 0&&(ga(n,void 0,"key"),s=n.length),this.v0l^=this.outputLen|s<<8|65536|1<<24,i!==void 0){ga(i,void 0,"salt");const o=tf(i);this.v4l^=mn(o[0]),this.v4h^=mn(o[1]),this.v5l^=mn(o[2]),this.v5h^=mn(o[3])}if(a!==void 0){ga(a,void 0,"personalization");const o=tf(a);this.v6l^=mn(o[0]),this.v6h^=mn(o[1]),this.v7l^=mn(o[2]),this.v7h^=mn(o[3])}if(n!==void 0){const o=new Uint8Array(this.blockLen);o.set(n),this.update(o)}}
34get(){let{v0l:e,v0h:r,v1l:n,v1h:a,v2l:i,v2h:s,v3l:o,v3h:c,v4l:u,v4h:f,v5l:l,v5h:p,v6l:b,v6h:v,v7l:w,v7h:I}=this;return[e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I]}set(e,r,n,a,i,s,o,c,u,f,l,p,b,v,w,I){this.v0l=e|0,this.v0h=r|0,this.v1l=n|0,this.v1h=a|0,this.v2l=i|0,this.v2h=s|0,this.v3l=o|0,this.v3h=c|0,this.v4l=u|0,this.v4h=f|0,this.v5l=l|0,this.v5h=p|0,this.v6l=b|0,this.v6h=v|0,this.v7l=w|0,this.v7h=I|0}compress(e,r,n){this.get().forEach((c,u)=>Re[u]=c),Re.set(Kt,16);let{h:a,l:i}=eA(BigInt(this.length));Re[24]=Kt[8]^i,Re[25]=Kt[9]^a,n&&(Re[28]=~Re[28],Re[29]=~Re[29]);let s=0;const o=Qx;for(let c=0;c<12;c++)Jn(0,4,8,12,e,r+2*o[s++]),Qn(0,4,8,12,e,r+2*o[s++]),Jn(1,5,9,13,e,r+2*o[s++]),Qn(1,5,9,13,e,r+2*o[s++]),Jn(2,6,10,14,e,r+2*o[s++]),Qn(2,6,10,14,e,r+2*o[s++]),Jn(3,7,11,15,e,r+2*o[s++]),Qn(3,7,11,15,e,r+2*o[s++]),Jn(0,5,10,15,e,r+2*o[s++]),Qn(0,5,10,15,e,r+2*o[s++]),Jn(1,6,11,12,e,r+2*o[s++]),Qn(1,6,11,12,e,r+2*o[s++]),Jn(2,7,8,13,e,r+2*o[s++]),Qn(2,7,8,13,e,r+2*o[s++]),Jn(3,4,9,14,e,r+2*o[s++]),Qn(3,4,9,14,e,r+2*o[s++]);this.v0l^=Re[0]^Re[16],this.v0h^=Re[1]^Re[17],this.v1l^=Re[2]^Re[18],this.v1h^=Re[3]^Re[19],this.v2l^=Re[4]^Re[20],this.v2h^=Re[5]^Re[21],this.v3l^=Re[6]^Re[22],this.v3h^=Re[7]^Re[23],this.v4l^=Re[8]^Re[24],this.v4h^=Re[9]^Re[25],this.v5l^=Re[10]^Re[26],this.v5h^=Re[11]^Re[27],this.v6l^=Re[12]^Re[28],this.v6h^=Re[13]^Re[29],this.v7l^=Re[14]^Re[30],this.v7h^=Re[15]^Re[31],k0(Re)}destroy(){this.destroyed=!0,k0(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Ud=Jx(t=>new oA(t));var yn;class Dd{constructor(e){if(yn.set(this,void 0),typeof e=="string"){const[r,n]=At(e,[re.Ed25519PublicKey]);Ls(this,yn,r)}else Ls(this,yn,e)}compare(e){if(e instanceof Dd)return $s(this.bytes(),e.bytes());throw new Hs("EdDSA key expected")}hash(){return wr(Ud(Pr(this,yn,"f"),{dkLen:20}),re.Ed25519PublicKeyHash)}bytes(){return Pr(this,yn,"f")}toProtocol(){const e=new Uint8Array(Pr(this,yn,"f").length+1);return e[0]=0,e.set(Pr(this,yn,"f"),1),e}toString(){return wr(Pr(this,yn,"f"),re.Ed25519PublicKey)}}yn=new WeakMap;class fA extends Ce{constructor(e){super(),this.message=e,this.name="InvalidCurveError"}}var vs;const Xl={p256:{pk:re.P256PublicKey,sk:re.P256SecretKey,pkh:re.P256PublicKeyHash,sig:re.P256Signature,tag:2},secp256k1:{pk:re.Secp256k1PublicKey,sk:re.Secp256k1SecretKey,pkh:re.Secp256k1PublicKeyHash,sig:re.Secp256k1Signature,tag:1}};class rf{constructor(e,r){vs.set(this,void 0);const[n,a]=(()=>{if(typeof e=="string"){const[i,s]=At(e,[re.Secp256k1PublicKey,re.P256PublicKey]);return[i,s===re.Secp256k1PublicKey?"secp256k1":"p256"]}else{if(r!==void 0)return[e,r];throw new fA("missing curve type")}})();Ls(this,vs,n),this.curve=a}compare(e){if(e instanceof rf)if(this.curve===e.curve){const r=this.curve==="secp256k1";return $s(this.bytes(r),e.bytes(r))}else return this.curve==="secp256k1"?-1:1;else throw new Hs("ECDSA key expected")}hash(){const e=this.bytes();return wr(Ud(e,{dkLen:20}),Xl[this.curve].pkh)}bytes(e=!0){return this.curve==="secp256k1"?H8.Point.fromHex(Pr(this,vs,"f")).toBytes(e):K8.Point.fromHex(Pr(this,vs,"f")).toBytes(e)}toProtocol(){const e=this.bytes(),r=new Uint8Array(e.length+1);return r[0]=Xl[this.curve].tag,r.set(e,1),r}toString(){const e=this.bytes();return wr(e,Xl[this.curve].pk)}}vs=new WeakMap;var vn;class Hd{constructor(e){if(vn.set(this,void 0),typeof e=="string"){const[r,n]=At(e,[re.BLS12_381PublicKey]);Ls(this,vn,r)}else Ls(this,vn,e)}compare(e){if(e instanceof Hd)return $s(this.bytes(),e.bytes());throw new Hs("BLS key expected")}hash(){return wr(Ud(Pr(this,vn,"f"),{dkLen:20}),re.BLS12_381PublicKeyHash)}bytes(){return Pr(this,vn,"f")}toProtocol(){const e=new Uint8Array(Pr(this,vn,"f").length+1);return e[0]=3,e.set(Pr(this,vn,"f"),1),e}toString(){return wr(Pr(this,vn,"f"),re.BLS12_381PublicKey)}}vn=new WeakMap;function Xy(t){const[e,r]=At(t,[re.Ed25519PublicKey,re.Secp256k1PublicKey,re.P256PublicKey,re.BLS12_381PublicKey]);switch(r){case re.Ed25519PublicKey:return new Dd(e);case re.Secp256k1PublicKey:return new rf(e,"secp256k1");case re.P256PublicKey:return new rf(e,"p256");case re.BLS12_381PublicKey:return new Hd(e)}}var N3;class gs extends pt{constructor(e,r){super(),this.mapType=e,this.reason=r,this.message=`The map type '${JSON.stringify(e)}
34' is invalid. Reason: ${r}.`,this.name="InvalidMapTypeError"}}const k3=Symbol.for("taquito-michelson-map-type-symbol");function cA(t){if(!("prim"in t))throw new gs(t,"Missing 'prim' field");if(!["map","big_map"].includes(t.prim))throw new gs(t,"The prim field should be 'map' or 'big_map'");if(!("args"in t))throw new gs(t,"Missing 'args' field");if(!Array.isArray(t.args))throw new gs(t,"The 'args' field should be an array");if(t.args.length!==2)throw new gs(t,"The 'args' field should have 2 elements")}class Jy extends pt{constructor(e,r,n,a){super(),this.value=e,this.type=r,this.reason=a,this.name="MapTypecheckError",this.message=`The ${n} provided: ${JSON.stringify(e)} is not compatible with the expected michelson type: ${JSON.stringify(r)}. Reason: ${JSON.stringify(a)}.`,this.name="MapTypecheckError"}}class dr{static isMichelsonMap(e){return e&&e[k3]===!0}constructor(e){this.valueMap=new Map,this.keyMap=new Map,this[N3]=!0,e&&this.setType(e)}setType(e){cA(e),this.keySchema=new jr(e.args[0]),this.valueSchema=new jr(e.args[1])}removeType(){this.keySchema=void 0,this.valueSchema=void 0}static fromLiteral(e,r){const n=new dr(r);return Object.keys(e).forEach(a=>{n.set(a,e[a])}),n}typecheckKey(e){if(this.keySchema&&!this.keySchema.Typecheck(e))throw new Jy(e,this.keySchema,"key","Type validation failed")}typecheckValue(e){if(this.valueSchema&&!this.valueSchema.Typecheck(e))throw new Jy(e,this.valueSchema,"value","Type validation failed")}assertTypecheckValue(e){this.typecheckValue(e)}assertTypecheckKey(e){this.typecheckKey(e)}serializeDeterministically(e){return JE(e)}*keys(){for(const[e]of this.entries())yield e}*values(){for(const[,e]of this.entries())yield e}*entries(){for(const e of this.valueMap.keys())yield[this.keyMap.get(e),this.valueMap.get(e)]}get(e){this.assertTypecheckKey(e);const r=this.serializeDeterministically(e);return this.valueMap.get(r)}set(e,r){this.assertTypecheckKey(e),this.assertTypecheckValue(r);const n=this.serializeDeterministically(e);this.keyMap.set(n,e),this.valueMap.set(n,r)}delete(e){this.assertTypecheckKey(e),this.keyMap.delete(this.serializeDeterministically(e)),this.valueMap.delete(this.serializeDeterministically(e))}has(e){this.assertTypecheckKey(e);const r=this.serializeDeterministically(e);return this.keyMap.has(r)&&this.valueMap.has(r)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(e){for(const[r,n]of this.entries())e(n,r,this)}}N3=k3;class yt extends pt{constructor(e,r,n){super(),this.value=e,this.token=r,this.name="TokenValidationError";const a=this.token.annot(),i=a?`[${a}] `:"";this.message=`${i}${n}`}}class Et{static get fieldNumberingStrategy(){return Et._fieldNumberingStrategy}static set fieldNumberingStrategy(e){Et._fieldNumberingStrategy=e}constructor(e,r,n,a){this.val=e,this.idx=r,this.fac=n,this.parentTokenType=a,this.createToken=this.fac}typeWithoutAnnotations(){const e=n=>{if(typeof n=="object"){if(Array.isArray(n))return n.map(s=>e(s));const a=n;return a.args?{prim:a.prim,args:a.args.map(i=>e(i))}:{prim:a.prim}}return n};return(n=>n.args?{prim:n.prim,args:n.args.map(a=>e(a))}:{prim:n.prim})(this.val)}annot(){return(Array.isArray(this.val.annots)&&this.val.annots.length>0?this.val.annots[0]:String(this.idx)).replace(/(%|:)(_Liq_entry_)?/,"")}hasAnnotations(){return Array.isArray(this.val.annots)&&this.val.annots.length}get tokenVal(){return this.val}ExtractSignature(){return[[this.generateSchema()]]}}Et._fieldNumberingStrategy="Latest";class Dt extends Et{compare(e,r){return e<r?-1:e>r?1:0}}class Qy extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="BigMapValidationError"}}class yr extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}generateSchema(){return{__michelsonType:yr.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}validate(e){if(!dr.isMichelsonMap(e))throw new Qy(e,this,`Value ${JSON.stringify(e)} is not a MichelsonMap`)}objLitToMichelsonMap(e){return e instanceof dr?e:typeof e=="object"?Object.keys(e).length===0?new dr:dr.fromLiteral(e):e}Encode(e){const r=this.objLitToMichelsonMap(e.pop());return this.validate(r),Array.from(r.keys()).sort((n,a)=>this.KeySchema.compare(n,a)).map(n=>({prim:"Elt",args:[this.KeySchema.EncodeObject(n),this.ValueSchema.EncodeObject(r.get(n))]}))}EncodeObject(e,r){const n=this.objLitToMichelsonMap(e);return this.validate(n),r&&r[yr.prim]?r[yr.prim](n,this.val):Array.from(n.keys()).sort((a,i)=>this.KeySchema.compare(a,i)).map(a=>({prim:"Elt",args:[this.KeySchema.EncodeObject(a),this.ValueSchema.EncodeObject(n.get(a))]}))}Execute(e,r){if(r&&r[yr.prim])return r[yr.prim](e,this.val);if(Array.isArray(e)){const n=new dr(this.val);return e.forEach(a=>{n.set(this.KeySchema.ToKey(a.args[0]),this.ValueSchema.Execute(a.args[1]))}),n}else{if("int"in e)return e.int;throw new Qy(e,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(e)}`)}}findAndReturnTokens(e,r){return yr.prim===e&&r.push(this),this.KeySchema.findAndReturnTokens(e,r),this.ValueSchema.findAndReturnTokens(e,r),r}}yr.prim="big_map";class ev extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="OrValidationError"}}class ht extends Dt{constructor(e,r,n,a){super(e,r,n,a),this.val=e,this.idx=r,this.fac=n,this.parentTokenType=a}Encode(e){const r=e[e.length-1],n=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let a=1;n instanceof ht&&(a=Object.keys(n.generateSchema().schema).length);const i=this.createToken(this.val.args[1],this.getIdxForChildren()+a,"Or");if(String(n.annot())===String(r)&&!(n instanceof ht))return e.pop(),{prim:"Left",args:[n.Encode(e)]};if(String(i.annot())===String(r)&&!(i instanceof ht))return e.pop(),{prim:"Right",args:[i.Encode(e)]};if(n instanceof ht){const s=n.Encode(e);if(s)return{prim:"Left",args:[s]}}if(i instanceof ht){const s=i.Encode(e);if(s)return{prim:"Right",args:[s]}}return null}ExtractSignature(){const e=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let r=1;e instanceof ht&&(r=Object.keys(e.generateSchema().schema).length);const n=this.createToken(this.val.args[1],this.getIdxForChildren()+r,"Or"),a=[];if(e instanceof ht)a.push(...e.ExtractSignature());else for(const i of e.ExtractSignature())a.push([e.annot(),...i]);if(n instanceof ht)a.push(...n.ExtractSignature());else for(const i of n.ExtractSignature())a.push([n.annot(),...i]);return a}EncodeObject(e,r){this.validateJavascriptObject(e);const n=Object.keys(e)[0],a=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let i=1;a instanceof ht&&(i=Object.keys(a.generateSchema().schema).length);const s=this.createToken(this.val.args[1],this.getIdxForChildren()+i,"Or");if(String(a.annot())===String(n)&&!(a instanceof ht))return{prim:"Left",args:[a.EncodeObject(e[n],r)]};if(String(s.annot())===String(n)&&!(s instanceof ht))return{prim:"Right",args:[s.EncodeObject(e[n],r)]};if(a instanceof ht){const o=a.EncodeObject(e,r);if(o)return{prim:"Left",args:[o]}}if(s instanceof ht){const o=s.EncodeObject(e,r);if(o)return{prim:"Right",args:[o]}}return null}validateJavascriptObject(e){if(typeof e!="object"||Array.isArray(e)||e===null||Object.keys(e).length!==1)throw new ev(e,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(e)}`)}Execute(e,r){const n=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let a=1;n instanceof ht&&(a=Object.keys(n.generateSchema().schema).length);const i=this.createToken(this.val.args[1],this.getIdxForChildren()+a,"Or");if(e.prim==="Right")return i instanceof ht?i.Execute(e.args[0],r):{[i.annot()]:i.Execute(e.args[0],r)};if(e.prim==="Left")return n instanceof ht?n.Execute(e.args[0],r):{[n.annot()]:n.Execute(e.args[0],r)};throw new ev(e,this,`Was expecting Left or Right prim but got: ${JSON.stringify(e.prim)}`)}traversal(e,r,n){const a=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let i=1,s;
34a instanceof ht?(s=e(a),i=Object.keys(a.generateSchema().schema).length):s={[a.annot()]:e(a)};const o=this.createToken(this.val.args[1],this.getIdxForChildren()+i,"Or");let c;return o instanceof ht?c=r(o):c={[o.annot()]:r(o)},n(s,c)}generateSchema(){return{__michelsonType:ht.prim,schema:this.traversal(e=>e instanceof ht?e.generateSchema().schema:e.generateSchema(),e=>e instanceof ht?e.generateSchema().schema:e.generateSchema(),(e,r)=>({...e,...r}))}}findToken(e){const r=this.createToken(this.val.args[0],this.getIdxForChildren(),"Or");let n=1;if(r instanceof ht){const i=r.generateSchema();n=Object.keys(i.schema).length}const a=this.createToken(this.val.args[1],this.getIdxForChildren()+n,"Or");if(String(r.annot())===String(e)&&!(r instanceof ht)&&r instanceof Dt)return r;if(String(a.annot())===String(e)&&!(a instanceof ht)&&a instanceof Dt)return a;if(r instanceof ht){const i=r.findToken(e);if(i)return i}if(a instanceof ht){const i=a.findToken(e);if(i)return i}return null}compare(e,r){const n=Object.keys(e)[0],a=Object.keys(r)[0];if(n===a){const i=this.findToken(n);if(i instanceof Dt)return i.compare(e[n],r[n])}else{const i=JSON.stringify(this.EncodeObject(e)),s=JSON.stringify(this.EncodeObject(r));return i<s?-1:1}}ToKey(e){return this.Execute(e)}
34ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}findAndReturnTokens(e,r){return ht.prim===e&&r.push(this),this.traversal(n=>n.findAndReturnTokens(e,r),n=>n.findAndReturnTokens(e,r),(n,a)=>({...n,...a})),r}getIdxForChildren(){return Et.fieldNumberingStrategy==="Legacy"?this.idx:this.parentTokenType==="Or"?this.idx:0}}ht.prim="or";class uA extends pt{constructor(e){super(e),this.message=e,this.name="TokenArgumentValidationError"}}class hA extends pt{constructor(e,r){super(),this.val1=e,this.val2=r,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(e)} and ${JSON.stringify(r)} are not comparable`}}function C0(t,e=qt.prim){if(Array.isArray(t))return C0({prim:e,args:t},e);if(t.args===void 0)throw new uA(`The value ${JSON.stringify(t)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return t.args.length>2?[t.args[0],{prim:e,args:t.args.slice(1)}]:[t.args[0],t.args[1]]}class qt extends Dt{constructor(e,r,n,a){super(Array.isArray(e)?{prim:qt.prim,args:e}:e.prim?e:{prim:qt.prim,args:e},r,n,a)}args(){return C0(this.val)}tokens(){let e=0;return this.args().map(r=>{const n=this.createToken(r,this.getIdxForChildren()+e,"Pair");return n instanceof qt?e+=Object.keys(n.generateSchema()).length:e++,n})}Encode(e){return{prim:"Pair",args:this.tokens().map(r=>r.Encode(e))}}ExtractSignature(){const e=this.args(),r=this.createToken(e[0],this.getIdxForChildren(),"Pair");let n=1;r instanceof ht&&(n=Object.keys(r.generateSchema()).length);const a=this.createToken(e[1],this.getIdxForChildren()+n,"Pair"),i=[];for(const s of r.ExtractSignature())for(const o of a.ExtractSignature())i.push([...s,...o]);return i}
34ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}ToKey(e){return this.Execute(e)}EncodeObject(e,r){const[n,a]=this.tokens();let i;n instanceof qt&&!n.hasAnnotations()?i=e:i=e[n.annot()];let s;return a instanceof qt&&!a.hasAnnotations()?s=e:s=e[a.annot()],{prim:"Pair",args:[n.EncodeObject(i,r),a.EncodeObject(s,r)]}}traversal(e,r){const n=this.args(),a=this.createToken(n[0],this.getIdxForChildren(),"Pair");let i=1,s;a instanceof qt&&!a.hasAnnotations()?(s=e(a),a instanceof qt&&(i=Object.keys(a.generateSchema()).length)):s={[a.annot()]:e(a)};const o=this.createToken(n[1],this.getIdxForChildren()+i,"Pair");let c;return o instanceof qt&&!o.hasAnnotations()?c=r(o):c={[o.annot()]:r(o)},{...s,...c}}Execute(e,r){const n=C0(e,"Pair");return this.traversal(a=>a.Execute(n[0],r),a=>a.Execute(n[1],r))}generateSchema(){return{__michelsonType:qt.prim,schema:this.traversal(e=>e instanceof qt&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema(),e=>e instanceof qt&&!e.hasAnnotations()?e.generateSchema().schema:e.generateSchema())}}compare(e,r){const[n,a]=this.tokens(),i=(s,o)=>s instanceof qt&&!s.hasAnnotations()?o:o[s.annot()];if(n instanceof Dt&&a instanceof Dt){const s=n.compare(i(n,e),i(n,r));return s===0?a.compare(i(a,e),i(a,r)):s}throw new hA(e,r)}findAndReturnTokens(e,r){return qt.prim===e&&r.push(this),this.tokens().map(n=>n.findAndReturnTokens(e,r)),r}getIdxForChildren(){return Et.fieldNumberingStrategy==="Legacy"?this.idx:this.parentTokenType==="Pair"?this.idx:0}}qt.prim="pair";class Jl extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="NatValidationError"}}class _n extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return new tt(e[Object.keys(e)[0]])}Encode(e){const r=e.pop();return this.validate(r),{int:new tt(r).toFixed()}}validate(e){let r;try{r=new tt(e)}catch{throw new Jl(e,this,`Value is not a number: ${JSON.stringify(e)}`)}if(r.isNaN())throw new Jl(e,this,`Value is not a number: ${JSON.stringify(e)}`);if(r.isNegative())throw new Jl(e,this,`Value cannot be negative: ${JSON.stringify(e)}`)}EncodeObject(e,r){return this.validate(e),r&&r[_n.prim]?r[_n.prim](e):{int:new tt(e).toFixed()}}generateSchema(){return{__michelsonType:_n.prim,schema:_n.prim}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:_n.prim}}}ToKey({int:e}){return new tt(e)}compare(e,r){const n=Number(e),a=Number(r);return n===a?0:n<a?-1:1}findAndReturnTokens(e,r){return _n.prim===e&&r.push(this),r}}_n.prim="nat";class En extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return e[Object.keys(e)[0]]}generateSchema(){return{__michelsonType:En.prim,schema:En.prim}}Encode(e){return{string:e.pop()}}EncodeObject(e,r){return r&&r[En.prim]?r[En.prim](e):{string:e}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:En.prim}}}findAndReturnTokens(e,r){return En.prim===e&&r.push(this),r}}En.prim="string";class Ro extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="AddressValidationError"}}class ai extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}ToBigMapKey(e){return{key:{bytes:Ss(e)},type:{prim:"bytes"}}}validate(e){if(typeof e!="string")throw new Ro(e,this,"Type error");if(it(e)!==Se.VALID)throw new Ro(e,this,`Address is not valid: ${JSON.stringify(e)}`)}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[ai.prim]?r[ai.prim](e):{string:e}}Execute(e){if(e.string)return e.string;if(!e.bytes)throw new Ro(e,this,`cannot be missing both string and bytes: ${JSON.stringify(e)}`);return T0(e.bytes)}generateSchema(){return{__michelsonType:ai.prim,schema:ai.prim}}ToKey({bytes:e,string:r}){if(r)return r;if(!e)throw new Ro({bytes:e,string:r},this,`cannot be missing both string and bytes ${JSON.stringify({string:r,bytes:e})}`);return T0(e)}compare(e,r){const[n,a]=P0(e),[i,s]=P0(r),o=a||"",c=s||"",u=Ss(n,"array"),f=Ss(i,"array"),l=$s(u,f);return l===0?o<c?-1:o>c?1:0:l}findAndReturnTokens(e,r){return ai.prim===e&&r.push(this),r}}ai.prim="address";class lA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="MapValidationError"}}
34class mi extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get ValueSchema(){return this.createToken(this.val.args[1],0)}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(e){if(!dr.isMichelsonMap(e))throw new lA(e,this,`Value ${JSON.stringify(e)} is not a valid MichelsonMap`)}Execute(e,r){const n=new dr(this.val);return e.forEach(a=>{n.set(this.KeySchema.ToKey(a.args[0]),this.ValueSchema.Execute(a.args[1],r))}),n}objLitToMichelsonMap(e){return e instanceof dr?e:typeof e=="object"?Object.keys(e).length===0?new dr:dr.fromLiteral(e):e}Encode(e){const r=this.objLitToMichelsonMap(e.pop());return this.validate(r),Array.from(r.keys()).sort((n,a)=>this.KeySchema.compare(n,a)).map(n=>({prim:"Elt",args:[this.KeySchema.EncodeObject(n),this.ValueSchema.EncodeObject(r.get(n))]}))}EncodeObject(e,r){const n=this.objLitToMichelsonMap(e);return this.validate(n),r&&r[mi.prim]?r[mi.prim](n):Array.from(n.keys()).sort((a,i)=>this.KeySchema.compare(a,i)).map(a=>({prim:"Elt",args:[this.KeySchema.EncodeObject(a),this.ValueSchema.EncodeObject(n.get(a))]}))}generateSchema(){return{__michelsonType:mi.prim,schema:{key:this.KeySchema.generateSchema(),value:this.ValueSchema.generateSchema()}}}findAndReturnTokens(e,r){return mi.prim===e&&r.push(this),this.KeySchema.findAndReturnTokens(e,r),this.ValueSchema.findAndReturnTokens(e,r),r}}mi.prim="map";class Sn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return String(e.prim).toLowerCase()==="true"}Encode(e){return{prim:e.pop()?"True":"False"}}EncodeObject(e,r){return r&&r[Sn.prim]?r[Sn.prim](e):{prim:e?"True":"False"}}generateSchema(){return{__michelsonType:Sn.prim,schema:Sn.prim}}ToBigMapKey(e){return{key:this.EncodeObject(e),type:{prim:Sn.prim}}}ToKey(e){return this.EncodeObject(e)}compare(e,r){return e&&r||!e&&!r?0:e?1:-1}findAndReturnTokens(e,r){return Sn.prim===e&&r.push(this),r}}Sn.prim="bool";class Ql extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="ContractValidationError"}}class $r extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(typeof e!="string")throw new Ql(e,this,"Type error");if(it(e)!==Se.VALID)throw new Ql(e,this,`Value ${JSON.stringify(e)} is not a valid contract address.`);return null}Execute(e){if(e.string)return e.string;if(!e.bytes)throw new Ql(e,this,`Value ${JSON.stringify(e)} is not a valid contract address. must contain bytes or string.`);return T0(e.bytes)}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[$r.prim]?r[$r.prim](e):{string:e}}generateSchema(){const e=this.createToken(this.val.args[0],0);return{__michelsonType:$r.prim,schema:{parameter:this.val.args[0]?e.generateSchema():{}}}}findAndReturnTokens(e,r){return $r.prim===e&&r.push(this),r}}$r.prim="contract";class dA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="ListValidationError"}}class ia extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(e){if(!Array.isArray(e))throw new dA(e,this,`Value ${JSON.stringify(e)} is not a valid array`)}Encode(e){const r=e.pop();this.validate(r);const n=this.createToken(this.val.args[0],0);return r.reduce((a,i)=>[...a,n.EncodeObject(i)],[])}Execute(e,r){const n=this.createToken(this.val.args[0],0);return this.validate(e),e.reduce((a,i)=>[...a,n.Execute(i,r)],[])}EncodeObject(e,r){const n=this.createToken(this.val.args[0],0);return this.validate(e),r&&r[ia.prim]?r[ia.prim](e):e.reduce((a,i)=>[...a,n.EncodeObject(i)],[])}generateSchema(){return{__michelsonType:ia.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(e,r){return ia.prim===e&&r.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(e,r),r}}ia.prim="list";class tv extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="MutezValidationError"}}class xn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return new tt(e[Object.keys(e)[0]])}generateSchema(){return{__michelsonType:xn.prim,schema:xn.prim}}validate(e){let r;try{r=new tt(e)}catch{throw new tv(e,this,`Value is not a number: ${e}`)}if(r.isNaN())throw new tv(e,this,`Value is not a number: ${e}`)}Encode(e){const r=e.pop();return this.validate(r),{int:String(r).toString()}}EncodeObject(e,r){return this.validate(e),r&&r[xn.prim]?r[xn.prim](e):{int:String(e).toString()}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:xn.prim}}}ToKey({int:e}){return e}compare(e,r){const n=Number(e),a=Number(r);return n===a?0:n<a?-1:1}findAndReturnTokens(e,r){return xn.prim===e&&r.push(this),r}}xn.prim="mutez";class pA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="BytesValidationError"}}class An extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}ToBigMapKey(e){return{key:{bytes:e},type:{prim:An.prim}}}validate(e){if(!(typeof e=="string"&&/^[0-9a-fA-F]*$/.test(e)&&e.length%2===0))throw new pA(e,this,`Invalid bytes: ${e}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=l1(this.convertUint8ArrayToHexString(r)),this.validate(r),{bytes:String(r).toString()}}EncodeObject(e,r){return e=this.convertUint8ArrayToHexString(e),typeof e=="string"&&(e=l1(e)),this.validate(e),r&&r[An.prim]?r[An.prim](e):{bytes:String(e).toString()}}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:An.prim,schema:An.prim}}ToKey({bytes:e,string:r}){return r||e}findAndReturnTokens(e,r){return An.prim===e&&r.push(this),r}}An.prim="bytes";class Ya extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}subToken(){return this.createToken(this.val.args[0],this.idx)}schema(){return this.createToken(this.val.args[0],0)}annot(){return Array.isArray(this.val.annots)?super.annot():this.createToken(this.val.args[0],this.idx).annot()}Encode(e){const r=e;return r==null?{prim:"None"}:Array.isArray(r)&&(r[r.length-1]===void 0||r[r.length-1]===null)?(r.pop(),{prim:"None"}):{prim:"Some",args:[this.schema().Encode(e)]}}EncodeObject(e,r){let n=e;return n==null?{prim:"None"}:(n=typeof n=="object"&&"Some"in n?n.Some:n,Array.isArray(n)&&n.length===1&&(n=n[0]),{prim:"Some",args:[this.schema().EncodeObject(n,r)]})}Execute(e,r){return e.prim==="None"?null:{Some:this.schema().Execute(e.args[0],r)}}generateSchema(){return{__michelsonType:Ya.prim,schema:this.schema().generateSchema()}}ExtractSignature(){return[...this.schema().ExtractSignature()]}get KeySchema(){return this.schema()}compare(e,r){if(e){if(!r)return 1}else return-1;return this.KeySchema.compare(e,r)}ToKey(e){return this.Execute(e)}
34ToBigMapKey(e){return{key:this.EncodeObject(e),type:this.typeWithoutAnnotations()}}findAndReturnTokens(e,r){return Ya.prim===e&&r.push(this),this.subToken().findAndReturnTokens(e,r),r}}Ya.prim="option";class Rn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){if(e.string&&/^\d+$/.test(e.string))return new Date(Number(e.string)*1e3).toISOString();if(e.string)return new Date(e.string).toISOString();if(e.int)return new Date(Number(e.int)*1e3).toISOString()}Encode(e){const r=e.pop();return typeof r=="number"?{int:String(r)}:{string:r}}EncodeObject(e,r){return r&&r[Rn.prim]?r[Rn.prim](e):typeof e=="number"?{int:String(e)}:{string:e}}generateSchema(){return{__michelsonType:Rn.prim,schema:Rn.prim}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:Rn.prim}}}findAndReturnTokens(e,r){return Rn.prim===e&&r.push(this),r}}Rn.prim="timestamp";class rv extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="IntValidationError"}}class vr extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return new tt(e[Object.keys(e)[0]])}generateSchema(){return{__michelsonType:vr.prim,schema:vr.prim}}validate(e){let r;try{r=new tt(e)}catch{throw new rv(e,this,`Value is not a number: ${JSON.stringify(e)}`)}if(r.isNaN())throw new rv(e,this,`Value is not a number: ${JSON.stringify(e)}`)}Encode(e){const r=e.pop();return this.validate(r),{int:new tt(r).toFixed()}}EncodeObject(e,r){return this.validate(e),r&&r[vr.prim]?r[vr.prim](e):{int:new tt(e).toFixed()}}ToBigMapKey(e){return{key:{int:String(e)},type:{prim:vr.prim}}}ToKey({int:e}){return e}compare(e,r){const n=Number(e),a=Number(r);return n===a?0:n<a?-1:1}findAndReturnTokens(e,r){return vr.prim===e&&r.push(this),r}}vr.prim="int";const U0=Symbol();class In extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Encode(e){return e.pop(),{prim:"Unit"}}EncodeObject(e,r){return r&&r[In.prim]?r[In.prim](e):{prim:"Unit"}}Execute(e){return U0}generateSchema(){return{__michelsonType:In.prim,schema:In.prim}}compare(e,r){return 0}ToKey(e){return U0}ToBigMapKey(e){return{key:{prim:"Unit"},type:{prim:In.prim}}}findAndReturnTokens(e,r){return In.prim===e&&r.push(this),r}}In.prim="unit";class gA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="KeyValidationError"}}class Bn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return e.string?e.string:C4(e.bytes)}validate(e){if(H4(e)!==Se.VALID)throw new gA(e,this,"Key is not valid")}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[Bn.prim]?r[Bn.prim](e):{string:e}}generateSchema(){return{__michelsonType:Bn.prim,schema:Bn.prim}}ToKey(e){return this.Execute(e)}ToBigMapKey(e){return{key:{string:e},type:{prim:Bn.prim}}}compare(e,r){const n=Xy(e),a=Xy(r),i=n.toProtocol(),s=a.toProtocol();return i[0]===s[0]?n.compare(a):i[0]>s[0]?1:-1}findAndReturnTokens(e,r){return Bn.prim===e&&r.push(this),r}}Bn.prim="key";class bA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="KeyHashValidationError"}}class Tn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return e.string?e.string:B0(e.bytes)}validate(e){if(hd(e)!==Se.VALID)throw new bA(e,this,`KeyHash is not valid: ${JSON.stringify(e)}`)}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[Tn.prim]?r[Tn.prim](e):{string:e}}generateSchema(){return{__michelsonType:Tn.prim,schema:Tn.prim}}ToKey({string:e,bytes:r}){return e||B0(r)}ToBigMapKey(e){return{key:{string:e},type:{prim:Tn.prim}}}compare(e,r){const n=I0(e,"array"),a=I0(r,"array");return $s(n,a)}findAndReturnTokens(e,r){return Tn.prim===e&&r.push(this),r}}Tn.prim="key_hash";class mA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="SignatureValidationError"}}class Pn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return e.string?e.string:e.bytes}validate(e){if(D4(e)!==Se.VALID)throw new mA(e,this,"Signature is not val
34id")}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[Pn.prim]?r[Pn.prim](e):{string:e}}generateSchema(){return{__michelsonType:Pn.prim,schema:Pn.prim}}ToKey(e){return this.Execute(e)}ToBigMapKey(e){return{key:{string:e},type:{prim:Pn.prim}}}findAndReturnTokens(e,r){return Pn.prim===e&&r.push(this),r}}Pn.prim="signature";class aa extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get paramSchema(){return this.createToken(this.val.args[0],this.idx)}get returnSchema(){return this.createToken(this.val.args[1],this.idx+1)}Execute(e){return e.string?e.string:e}Encode(e){return e.pop()}EncodeObject(e,r){return r&&r[aa.prim]?r[aa.prim](e):e}generateSchema(){return{__michelsonType:aa.prim,schema:{parameters:this.paramSchema.generateSchema(),returns:this.returnSchema.generateSchema()}}}findAndReturnTokens(e,r){return aa.prim===e&&r.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(e,r),this.createToken(this.val.args[1],this.idx).findAndReturnTokens(e,r),r}}aa.prim="lambda";
34class si extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){return e.string}Encode(...e){return{string:e.pop()}}EncodeObject(e,r){return r&&r[si.prim]?r[si.prim](e):{string:e}}generateSchema(){return{__michelsonType:si.prim,schema:si.prim}}findAndReturnTokens(e,r){return si.prim===e&&r.push(this),r}}si.prim="operation";class yA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="SetValidationError"}}class sa extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get KeySchema(){return this.createToken(this.val.args[0],0)}validate(e){if(!Array.isArray(e))throw new yA(e,this,`Value ${JSON.stringify(e)} is not an array`)}Encode(e){const r=e.pop();return this.validate(r),r.sort((n,a)=>this.KeySchema.compare(n,a)).reduce((n,a)=>[...n,this.KeySchema.EncodeObject(a)],[])}Execute(e,r){return e.reduce((n,a)=>[...n,this.KeySchema.Execute(a,r)],[])}EncodeObject(e,r){return this.validate(e),r&&r[sa.prim]?r[sa.prim](e):e.sort((n,a)=>this.KeySchema.compare(n,a)).reduce((n,a)=>[...n,this.KeySchema.EncodeObject(a)],[])}generateSchema(){return{__michelsonType:sa.prim,schema:this.KeySchema.generateSchema()}}findAndReturnTokens(e,r){return sa.prim===e&&r.push(this),this.KeySchema.findAndReturnTokens(e,r),r}}sa.prim="set";class vA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="ChainIDValidationError"}}class Mn extends Dt{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(G2(e)!==Se.VALID)throw new vA(e,this,`Value ${JSON.stringify(e)} is not a valid ChainID`)}Execute(e){return e[Object.keys(e)[0]]}generateSchema(){return{__michelsonType:Mn.prim,schema:Mn.prim}}Encode(e){const r=e.pop();return this.validate(r),{string:r}}EncodeObject(e,r){return this.validate(e),r&&r[Mn.prim]?r[Mn.prim](e):{string:e}}ToKey({string:e}){return e}ToBigMapKey(e){return{key:{string:e},type:{prim:Mn.prim}}}findAndReturnTokens(e,r){return Mn.prim===e&&r.push(this),r}}Mn.prim="chain_id";class nv extends pt{constructor(){super(),this.name="TicketEncodeError",this.message="Tickets cannot be sent to the blockchain; they are created on-chain"}}const wA={prim:"contract"},_A={prim:"int"};class Xr extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new nv}EncodeObject(e,r){if(r&&r[Xr.prim])return r[Xr.prim](e,this.val);throw new nv}Execute(e,r){if(r&&r[Xr.prim])return r[Xr.prim](e,this.val);const n=this.createToken(wA,this.idx),a=this.valueToken,i=this.createToken(_A,this.idx);return e.args[2]===void 0&&e.args[1].args!==void 0?{ticketer:n.Execute(e.args[0],r),value:a.Execute(e.args[1].args[0],r),amount:i.Execute(e.args[1].args[1],r)}:{ticketer:n.Execute(e.args[0],r),value:a.Execute(e.args[1],r),amount:i.Execute(e.args[2],r)}}generateSchema(){return{__michelsonType:Xr.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:$r.prim,schema:$r.prim},amount:{__michelsonType:vr.prim,schema:vr.prim}}}}findAndReturnTokens(e,r){return Xr.prim===e&&r.push(this),this.valueToken.findAndReturnTokens(e,r),r}}Xr.prim="ticket";class iv extends pt{constructor(){super(),this.name="TicketDeprecatedEncodeError",this.message="Ticket_deprecated cannot be sent to the blockchain; they are created on-chain"}}const EA={prim:"contract"},SA={prim:"int"};class Jr extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(e){throw new iv}EncodeObject(e,r){if(r&&r[Jr.prim])return r[Jr.prim](e,this.val);throw new iv}Execute(e,r){if(r&&r[Jr.prim])return r[Jr.prim](e,this.val);const n=this.createToken(EA,this.idx),a=this.valueToken,i=this.createToken(SA,this.idx);return e.args[2]===void 0&&e.args[1].args!==void 0?{ticketer:n.Execute(e.args[0],r),value:a.Execute(e.args[1].args[0],r),amount:i.Execute(e.args[1].args[1],r)}:{ticketer:n.Execute(e.args[0],r),value:a.Execute(e.args[1],r),amount:i.Execute(e.args[2],r)}}generateSchema(){return{__michelsonType:Jr.prim,schema:{value:this.valueToken.generateSchema(),ticketer:{__michelsonType:$r.prim,schema:$r.prim},amount:{__michelsonType:vr.prim,schema:vr.prim}}}}findAndReturnTokens(e,r){return Jr.prim===e&&r.push(this),this.valueToken.findAndReturnTokens(e,r),r}}Jr.prim="ticket_deprecated";class e0 extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="NeverTokenError"}}
34class oi extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Encode(e){const r=e.pop();throw new e0(r,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(r)}.`)}EncodeObject(e,r){if(r&&r[oi.prim])return r[oi.prim](e);throw new e0(e,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(e)}.`)}Execute(e){throw new e0(e,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(e)}.`)}generateSchema(){return{__michelsonType:oi.prim,schema:oi.prim}}findAndReturnTokens(e,r){return oi.prim===e&&r.push(this),r}}oi.prim="never";class t0 extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="SaplingStateValidationError"}}class On extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}isValid(e){return typeof e=="object"&&Object.keys(e).length===0}Execute(e,r){if(r&&r[On.prim])return r[On.prim](e,this.val);if("int"in e)return e.int;throw new t0(e,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(e)}`)}Encode(e){const r=e.pop();if(this.isValid(r))return[];throw new t0(r,this,`Invalid sapling_state. Received: ${JSON.stringify(r)} while expecting: {}`)}EncodeObject(e,r){if(r&&r[On.prim])return r[On.prim](e);if(this.isValid(e))return[];throw new t0(e,this,`Invalid sapling_state. Received: ${JSON.stringify(e)} while expecting: {}`)}generateSchema(){return{__michelsonType:On.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,r){return On.prim===e&&r.push(this),r}}On.prim="sapling_state";class av extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="SaplingTransactionValidationError"}}class oa extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){throw new av(e,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const r=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(r&&r[2].length%2===0)return r[2];throw new av(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.validateBytes(this.convertUint8ArrayToHexString(r)),{bytes:String(r).toString()}}EncodeObject(e,r){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),r&&r[oa.prim]?r[oa.prim](e):{bytes:String(e).toString()}}generateSchema(){return{__michelsonType:oa.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,r){return oa.prim===e&&r.push(this),r}}oa.prim="sapling_transaction";class sv extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="SaplingTransactionDeprecatedValidationError"}}class fa extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e){throw new sv(e,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(e)}.`)}validateBytes(e){const r=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(e);if(r&&r[2].length%2===0)return r[2];throw new sv(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.validateBytes(this.convertUint8ArrayToHexString(r)),{bytes:String(r).toString()}}EncodeObject(e,r){return e=this.validateBytes(this.convertUint8ArrayToHexString(e)),r&&r[fa.prim]?r[fa.prim](e):{bytes:String(e).toString()}}generateSchema(){return{__michelsonType:fa.prim,schema:{memoSize:this.val.args[0].int}}}findAndReturnTokens(e,r){return fa.prim===e&&r.push(this),r}}fa.prim="sapling_transaction_deprecated";class xA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="Bls12381frValidationError"}}class fi extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(!(/^[0-9a-fA-F]*$/.test(e)&&e.length%2===0))throw new xA(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return typeof r=="number"?{int:r.toString()}:(r=this.convertUint8ArrayToHexString(r),this.validate(r),{bytes:r})}EncodeObject(e,r){return r&&r[fi.prim]?r[fi.prim](e):typeof e=="number"?{int:e.toString()}:(e=this.convertUint8ArrayToHexString(e),this.validate(e),{bytes:e})}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:fi.prim,schema:fi.prim}}findAndReturnTokens(e,r){return fi.prim===e&&r.push(this),r}}fi.prim="bls12_381_fr";class AA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="Bls12381g1ValidationError"}}
34class ci extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(!(/^[0-9a-fA-F]*$/.test(e)&&e.length%2===0))throw new AA(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.convertUint8ArrayToHexString(r),this.validate(r),{bytes:r}}EncodeObject(e,r){return e=this.convertUint8ArrayToHexString(e),this.validate(e),r&&r[ci.prim]?r[ci.prim](e):{bytes:e}}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:ci.prim,schema:ci.prim}}findAndReturnTokens(e,r){return ci.prim===e&&r.push(this),r}}ci.prim="bls12_381_g1";class RA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="Bls12381g2ValidationError"}}class ui extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(!(/^[0-9a-fA-F]*$/.test(e)&&e.length%2===0))throw new RA(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.convertUint8ArrayToHexString(r),this.validate(r),{bytes:r}}EncodeObject(e,r){return e=this.convertUint8ArrayToHexString(e),this.validate(e),r&&r[ui.prim]?r[ui.prim](e):{bytes:e}}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:ui.prim,schema:ui.prim}}findAndReturnTokens(e,r){return ui.prim===e&&r.push(this),r}}ui.prim="bls12_381_g2";class IA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="ChestValidationError"}}class hi extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(!(/^[0-9a-fA-F]*$/.test(e)&&e.length%2==0))throw new IA(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.convertUint8ArrayToHexString(r),this.validate(r),{bytes:r}}EncodeObject(e,r){return e=this.convertUint8ArrayToHexString(e),this.validate(e),r&&r[hi.prim]?r[hi.prim](e):{bytes:e}}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:hi.prim,schema:hi.prim}}findAndReturnTokens(e,r){return hi.prim===e&&r.push(this),r}}hi.prim="chest";class BA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="ChestKeyValidationError"}}class li extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}validate(e){if(!(/^[0-9a-fA-F]*$/.test(e)&&e.length%2===0))throw new BA(e,this,`Invalid bytes: ${JSON.stringify(e)}`)}convertUint8ArrayToHexString(e){return e.constructor===Uint8Array?_r(e):e}Encode(e){let r=e.pop();return r=this.convertUint8ArrayToHexString(r),this.validate(r),{bytes:r}}EncodeObject(e,r){return e=this.convertUint8ArrayToHexString(e),this.validate(e),r&&r[li.prim]?r[li.prim](e):{bytes:e}}Execute(e){return e.bytes}generateSchema(){return{__michelsonType:li.prim,schema:li.prim}}findAndReturnTokens(e,r){return li.prim===e&&r.push(this),r}}li.prim="chest_key";class ov extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="GlobalConstantEncodingError"}}class TA extends yt{constructor(e,r,n){super(e,r,n),this.value=e,this.token=r,this.name="GlobalConstantDecodingError"}}
34class Ln extends Et{constructor(e,r,n){super(e,r,n),this.val=e,this.idx=r,this.fac=n}Execute(e,r){if(r&&r[Ln.prim])return r[Ln.prim](e,this.val);throw new TA(e,this,`Unable to decode a value represented by a global constants. Please provide an expanded script to the Michelson-Encoder or semantics for the decoding. The following global constant hash was encountered: ${this.val.args[0].string}.`)}Encode(e){throw new ov(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}EncodeObject(e,r){if(r&&r[Ln.prim])return r[Ln.prim](e);throw new ov(e,this,`Unable to encode a script containing global constants. Please provide an expanded script to the Michelson-Encoder. The following global constant hash was encountered: ${this.val.args[0].string}.`)}generateSchema(){return{__michelsonType:Ln.prim,schema:{hash:this.val.args[0].string}}}findAndReturnTokens(e,r){return Ln.prim===e&&r.push(this),r}}Ln.prim="constant";const PA=[qt,_n,En,yr,ai,mi,Sn,ht,$r,ia,xn,An,Ya,Rn,vr,In,Bn,Tn,Pn,aa,si,sa,Mn,Xr,Jr,oi,On,oa,fa,fi,ci,ui,hi,li,Ln];class MA extends pt{constructor(e,r){super(e),this.message=e,this.data=r,this.name="Invalid token error"}}function wa(t,e,r){if(Array.isArray(t))return new qt(t,e,wa,r);const n=PA.find(a=>a.prim===t.prim);if(!n)throw new MA(`Malformed data: ${JSON.stringify(t)}. Expected a value with a valid prim property`,t);return new n(t,e,wa,r)}class D0 extends Ov{constructor(e,r,n,a){super(e,r,n,a),this.viewName=e,this.sigs=r,this.args=n,this.cause=a,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(n)} received for name "${e}" expecting one of the following signatures ${JSON.stringify(r)}`}}class r0 extends pt{constructor(e,r){super(),this.script=e,this.reason=r,this.name="InvalidScriptError";let n="Invalid on-chain view found in the following script.";r&&(n+=` Reason: ${r}.`),n+=`Script: ${JSON.stringify(e)}`,this.message=n}}class Nn extends pt{constructor(e,r){super(),this.script=e,this.reason=r,this.name="InvalidRpcResponseError";let n="Invalid RPC response passed as argument(s).";r&&(n+=` Reason: ${r}.`),n+=` Received: ${JSON.stringify(e)}`,this.message=n}}class n0 extends pt{constructor(e){super(e),this.message=e,this.name="InvalidBigMapSchemaError"}}class OA extends pt{constructor(e,r){super(e),this.message=e,this.value=r,this.name="InvalidBigMapDiffError"}}class LA extends pt{constructor(e,r,n,a){super(),this.details=r,this.schema=n,this.value=a,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${e}. Schema is: ${JSON.stringify(n)}. The ${e} is: ${JSON.stringify(a)}. Error details: ${r}`}}class NA extends pt{constructor(e,r,n,a,i){super(),this.details=r,this.schema=n,this.value=a,this.semantics=i,this.name="StorageEncodingError",this.message=`Unable to encode ${e}. The schema is: ${JSON.stringify(n)}, the value is: ${JSON.stringify(a)}.${i?`And the semantic is: ${JSON.stringify(i)}`:""}. Error details: ${r}`}}class kA extends pt{constructor(e){super(e),this.message=e,this.name="MissingArgumentError"}}var C3;const U3=Symbol.for("taquito-schema-type-symbol");function Ns(t,e=qt.prim){if(Array.isArray(t))return Ns({prim:e,args:t},e);const r=t;return r.prim===e&&r.args&&r.args.length>2?{...r,args:[r.args?.[0],{prim:e,args:r.args?.slice(1)}]}:r}function Fd(t,e){if(t===void 0||e===void 0)return t===e;const r=Ns(t),n=Ns(e);return r.prim===n.prim&&(r.args===void 0&&n.args===void 0||r.args!==void 0&&n.args!==void 0&&r.args.length===n.args.length&&r.args.every((a,i)=>Fd(a,n.args?.[i]??{})))&&(r.annots===void 0&&n.annots===void 0||r.annots!==void 0&&n.annots!==void 0&&r.annots.length===n.annots.length&&r.annots.every((a,i)=>a===n.annots?.[i]))}class jr{static isSchema(e){return e&&e[U3]===!0}static fromRPCResponse(e){if(!e)throw new Nn(e,"the RPC response is empty");if(!e.script)throw new Nn(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new Nn(e,"The response.script.code should be an array");let r=e.script.code;for(;r.length===1&&Array.isArray(r[0]);)r=r[0];const n=r.find(a=>"prim"in a&&a.prim==="storage");if(!n||!Array.isArray(n.args))throw new Nn(e,'The response.script.code has an element of type {prim: "storage"}, but its args is not an array');return new jr(n.args[0])}isExpressionExtended(e){return"prim"in e&&Array.isArray(e.args)}constructor(e){if(this.val=e,this[C3]=!0,this.root=wa(e,0),this.root instanceof yr)this.bigMap=this.root;else if(this.isExpressionExtended(e)&&e.prim==="pair"){const r=e.args[0];this.isExpressionExtended(r)&&r.prim==="big_map"&&(this.bigMap=new yr(r,0,wa))}}removeTopLevelAnnotation(e){return(this.root instanceof qt||this.root instanceof ht)&&this.root.hasAnnotations()&&typeof e=="object"&&Object.keys(e).length===1?e[Object.keys(e)[0]]:e}Execute(e,r){const n=this.root.Execute(e,r);return this.removeTopLevelAnnotation(n)}Typecheck(e){if(this.root instanceof yr&&Number.isInteger(Number(e))||this.root instanceof Xr&&e.ticketer&&e.value&&e.amount||this.root instanceof Jr&&e.ticketer&&e.value&&e.amount||this.root instanceof mi&&this.root.ValueSchema instanceof yr)return!0;try{return this.root.EncodeObject(e),!0}catch{return!1}}ExecuteOnBigMapDiff(e,r){if(!this.bigMap)throw new n0("Big map schema is undefined");if(!Array.isArray(e))throw new OA(`Big map diff must be an array, got: ${JSON.stringify(e)}`,e);const n=e.map(({key:a,value:i})=>({args:[a,i]}));return this.bigMap.Execute(n,r)}ExecuteOnBigMapValue(e,r){if(!this.bigMap)throw new n0("Big map schema is undefined");
34return this.bigMap.ValueSchema.Execute(e,r)}EncodeBigMapKey(e){if(!this.bigMap)throw new n0("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(e)}catch(r){throw new LA("key",r,this.bigMap.KeySchema,e)}}Encode(e,r){try{return this.root.EncodeObject(e,r)}catch(n){throw n instanceof yt?n:new NA("storage object",n,this.root,e,r)}}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}FindFirstInTopLevelPair(e,r){return this.findValue(this.root.val,e,r)}findValue(e,r,n){if(Fd(n,e))return r;if(Array.isArray(e)||e.prim==="pair"){const a=Ns(e),i=Ns(r,"Pair");if(a.args===void 0||i.args===void 0)throw new kA("Tokens have no arguments");if(a.args[0])return this.findValue(a.args[0],i.args[0],n)||this.findValue(a.args[1],i.args[1],n)}}findToken(e){const r=[];return this.root.findAndReturnTokens(e,r)}}C3=U3;class ka{static fromRPCResponse(e){if(!e)throw new Nn(e,"the RPC response is empty");if(!e.script)throw new Nn(e,"the RPC response has no script");if(!Array.isArray(e.script.code))throw new Nn(e,"The response.script.code should be an array");const r=e.script.code.find(n=>"prim"in n&&n.prim==="parameter");if(!r)throw new Nn(e,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray(r.args))throw new Nn(e,'The response.script.code has an element of type {prim: "parameter"}, but its args is not an array');return new ka(r.args[0])}get isMultipleEntryPoint(){return this.root instanceof ht||this.root instanceof Ya&&this.root.subToken()instanceof ht}get hasAnnotation(){return this.isMultipleEntryPoint?Object.keys(this.generateSchema())[0]!=="0":!0}constructor(e){this.root=wa(e,0)}Execute(e,r){return this.root.Execute(e,r)}Encode(...e){try{return this.root.Encode(e.reverse())}catch(r){throw r instanceof yt?r:new D0("Unable to encode parameter",this.root,e,r)}}EncodeObject(e,r){try{return this.root.EncodeObject(e,r)}catch(n){throw n instanceof yt?n:new D0("Unable to encode parameter object",this.root,e,n)}}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class qd{static fromRPCResponse(e){const r=[],n=e&&e.script&&Array.isArray(e.script.code)&&e.script.code.filter(a=>a.prim==="view");return n&&n.forEach(a=>{r.push(new qd(a.args))}),r}constructor(e){if(!e)throw new r0(e,"the args are not defined");if(e.length!==4)throw new r0(e,"there should be exactly 4 arguments");if(!("string"in e[0])||!e[0].string)throw new r0(e,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=e[0].string,this.viewArgsType=e[1],this.viewReturnType=e[2],this.instructions=e[3],this.rootArgsType=wa(this.viewArgsType,0),this.rootReturnType=wa(this.viewReturnType,0)}encodeViewArgs(e){try{return this.rootArgsType.EncodeObject(e)}catch(r){throw new D0(this.viewName,void 0,e,r)}}decodeViewResult(e,r){return this.rootReturnType.Execute(e,r)}extractArgsSchema(){return this.rootArgsType.generateSchema()}extractResultSchema(){return this.rootReturnType.generateSchema()}}class ri{constructor(e,r){this.tag=e,this.type=r}static fromMichelineValue(e){return new ri(e.annots?.[0],e.args?.[0])}static fromRPCResponse(e){const r=[];return e.script.code.forEach(n=>{!("prim"in n)||n.prim!=="code"||!("args"in n)||!n.args||r.push(...ri.extractEventsRecursively(n.args))}),ri.removeDuplicates(r)}static removeDuplicates(e){const r=[];return e.forEach(n=>{r.findIndex(i=>i.tag===n.tag&&Fd(i.type,n.type))===-1&&r.push(n)}),r}static extractEventsRecursively(e){return Array.isArray(e)?e.flatMap(r=>ri.extractEventsRecursively(r)):"prim"in e?e.prim==="EMIT"?[ri.fromMichelineValue(e)]:!("args"in e)||!e.args?[]:e.args.flatMap(r=>ri.extractEventsRecursively(r)):[]}}const or=Symbol("source_reference");class bs extends pt{constructor(e,r,n){super(),this.src=e,this.idx=r,this.message=n,this.name="ScanError"}}var fr;(function(t){t[t.Comment=0]="Comment",t[t.Number=1]="Number",t[t.String=2]="String",t[t.Bytes=3]="Bytes",t[t.Ident=4]="Ident"})(fr||(fr={}));const CA=new RegExp("\\s"),UA=new RegExp("[:@%_A-Za-z]"),DA=new RegExp("[@%_\\.A-Za-z0-9]"),fv=new RegExp("[0-9]"),HA=new RegExp("[0-9a-fA-F]");function*i0(t,e=!1){let r=0;for(;r<t.length;){for(;r<t.length&&CA.test(t[r]);)r++;if(r===t.length)return;const n=t[r],a=r;if(UA.test(n)){for(r++;r<t.length&&DA.test(t[r]);)r++;yield{t:fr.Ident,v:t.slice(a,r),first:a,last:r}}else if(t.length-r>1&&t.substring(r,r+2)==="0x"){for(r+=2;r<t.length&&HA.test(t[r]);)r++;if((r-a&1)!==0)throw new bs(t,r,"Bytes literal length is expected to be power of two");yield{t:fr.Bytes,v:t.slice(a,r),first:a,last:r}}else if(fv.test(n)||n==="-"){n==="-"&&r++;const i=r;for(;r<t.length&&fv.test(t[r]);)r++;if(i===r)throw new bs(t,r,"Number literal is too short");
34yield{t:fr.Number,v:t.slice(a,r),first:a,last:r}}else if(n==='"'){r++;let i=!1;for(;r<t.length&&(i||t[r]!=='"');r++)!i&&t[r]==="\\"?i=!0:i=!1;if(r===t.length)throw new bs(t,r,"Unterminated string literal");r++,yield{t:fr.String,v:t.slice(a,r),first:a,last:r}}else if(n==="#"){for(r++;r<t.length&&t[r]!==`
35`;)r++;e&&(yield{t:fr.Comment,v:t.slice(a,r),first:a,last:r})}else if(t.length-r>1&&t.substring(r,r+2)==="/*"){for(r+=2;r<t.length&&!(t.length-r>1&&t.substring(r,r+2)==="*/");)r++;if(r===t.length)throw new bs(t,r,"Unterminated C style comment");r+=2,e&&(yield{t:fr.Comment,v:t.slice(a,r),first:a,last:r})}else if(n==="("||n===")"||n==="{"||n==="}"||n===";")r++,yield{t:n,v:n,first:a,last:r};else throw new bs(t,r,`Invalid character at offset ${r}: \`${n}'`)}}const Io=Symbol("ref_contract");var Dn;(function(t){t.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",t.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",t.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",t.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",t.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",t.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",t.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",t.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",t.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",t.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",t.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",t.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",t.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",t.PtParisBx="PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ",t.PsParisCZ="PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi",t.PsQuebecn="PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg",t.PsRiotuma="PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7",t.PtSeouLou="PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh",t.PtTALLiNt="PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgFZKGtDdAXu",t.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(Dn||(Dn={}));const D3=Dn.PtTALLiNt,cv={Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P:0,PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY:1,PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt:2,PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP:3,Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd:4,PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU:5,PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS:5,PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb:6,PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo:7,PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq:8,PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA:8,PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i:9,PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV:10,PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r:11,PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx:11,PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP:12,Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A:12,PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw:13,PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY:13,PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg:14,PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW:15,PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc:16,PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1:16,PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf:17,ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH:19,PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ:20,PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi:20,PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg:21,PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7:22,PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh:23,PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgF
35ZKGtDdAXu:24,ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK:25};function Ca(t,e){return cv[t]<cv[e]}class Kr extends pt{constructor(e,r){super(),this.prim=e,this.message=r,this.name="MacroError"}}function Pt(t,e){if(e===0&&t.args===void 0||t.args?.length===e)return!0;throw new Kr(t,`macro ${t.prim} expects ${e} arguments, was given ${t.args?.length}`)}function ms(t){if(t.annots===void 0)return!0;throw new Kr(t,`unexpected annotation on macro ${t.prim}: ${t.annots}`)}function uv(t,e){if("int"in e)return!0;throw new Kr(t,`macro ${t.prim} expects int argument`)}function As(t,e,r,n){let a=0,i=0;const s=[null,null];let o;if(a===e.length)throw new Kr(t,`unexpected end: ${t.prim}`);let c=e[a++];switch(c){case"P":{const{r:f,n:l,an:p}=As(t,e.slice(a),r.slice(i),n);o=f,a+=l,i+=p;break}case"A":i!==r.length&&(s[0]=r[i++]);break;default:throw new Kr(t,`${t.prim}: unexpected character: ${c}`)}let u;if(a===e.length)throw new Kr(t,`unexpected end: ${t.prim}`);switch(c=e[a++],c){case"P":{const{r:f,n:l,an:p}=As(t,e.slice(a),r.slice(i),n);u=f.map(([b,v])=>[b+1,v]),a+=l,i+=p;break}case"I":i!==r.length&&(s[1]=r[i++]);break;default:throw new Kr(t,`${t.prim}: unexpected character: ${c}`)}return{r:n(o,u,[0,s]),n:a,an:i}}function nf(t,e,r,n){const a=e[0];switch(a){case"A":return e.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CAR",annots:["@%%"]},nf(t,e.slice(1),[],n)]]},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%@","%@",...r]}]:n.a;case"D":return e.length>1?[{prim:"DUP"},{prim:"DIP",args:[[{prim:"CDR",annots:["@%%"]},nf(t,e.slice(1),[],n)]]},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%@",...r]}]:n.d;default:throw new Kr(t,`${t.prim}: unexpected character: ${a}`)}}function FA(t,e){let r=t.length;for(;r>0&&t[r-1]===e;)r--;return t.slice(0,r)}function a0(t){const e=[],r=[];if(t!==void 0)for(const n of t)(n.length!==0&&n[0]==="%"?e:r).push(n);return{fields:e,rest:r}}function Gt({prim:t,annots:e,args:r}){return{prim:t,...e&&{annots:e},...r&&{args:r}}}const qA=/^P[PAI]{3,}R$/,$A=/^UNP[PAI]{2,}R$/,KA=/^C[AD]{2,}R$/,GA=/^SET_C[AD]+R$/,jA=/^MAP_C[AD]+R$/,VA=/^DI{2,}P$/,zA=/^DU+P$/;function WA(t,e){const r=e?.protocol||D3;function n(a){return a!==void 0?[{prim:"RENAME",annots:a}]:[]}switch(t.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(Pt(t,0))return[{prim:"COMPARE"},Gt({prim:t.prim.slice(3),annots:t.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(Pt(t,2))return[{prim:t.prim.slice(2)},Gt({prim:"IF",annots:t.annots,args:t.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(Pt(t,2))return[{prim:"COMPARE"},{prim:t.prim.slice(5)},Gt({prim:"IF",annots:t.annots,args:t.args})];break;case"FAIL":if(Pt(t,0)&&ms(t))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(Pt(t,0)&&ms(t))return[{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_EQ":case"ASSERT_NEQ":case"ASSERT_LT":case"ASSERT_GT":case"ASSERT_LE":case"ASSERT_GE":if(Pt(t,0)&&ms(t))return[{prim:t.prim.slice(7)},{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_CMPEQ":case"ASSERT_CMPNEQ":case"ASSERT_CMPLT":case"ASSERT_CMPGT":case"ASSERT_CMPLE":case"ASSERT_CMPGE":if(Pt(t,0)&&ms(t))return[[{prim:"COMPARE"},{prim:t.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(Pt(t,0)&&ms(t))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(Pt(t,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(t.annots)]}];break;case"ASSERT_LEFT":if(Pt(t,0))return[{prim:"IF_LEFT",args:[n(t.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(Pt(t,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],n(t.annots)]}];break;case"IF_SOME":if(Pt(t,2))return[Gt({prim:"IF_NONE",annots:t.annots,args:[t.args[1],t.args[0]]})];break;case"IF_RIGHT":if(Pt(t,2))return[Gt({prim:"IF_LEFT",annots:t.annots,args:[t.args[1],t.args[0]]})];break;case"CAR":case"CDR":if(t.args!==void 0){if(Pt(t,1)&&uv(t,t.args[0])){const a=parseInt(t.args[0].int,10);return Gt({prim:"GET",args:[{int:t.prim==="CAR"?String(a*2+1):String(a*2)}],annots:t.annots})}}else return t}if(qA.test(t.prim)&&Pt(t,0)){const{fields:a,rest:i}=a0(t.annots),{r:s}=As(t,t.prim.slice(1),a,(o,c,u)=>[...o||[],...c||[],u]);return s.map(([o,c],u)=>{const f=[...FA(c,null).map(p=>p===null?"%":p),...o===0&&u===s.length-1?i:[]],l=Gt({prim:"PAIR",annots:f.length!==0?f:void 0});return o===0?l:{prim:"DIP",args:o===1?[[l]]:[{int:String(o)},[l]]}})}if($A.test(t.prim))if(Ca(r,Dn.PtEdo2Zk)&&Pt(t,0)){const{r:a}=As(t,t.prim.slice(3),t.annots||[],(i,s,o)=>[o,...s||[],...i||[]]);return a.map(([i,s])=>{const o=[{prim:"DUP"},Gt({prim:"CAR",annots:s[0]!==null?[s[0]]:void 0}),{prim:"DIP",args:[[Gt({prim:"CDR",annots:s[1]!==null?[s[1]]:void 0})]]}];return i===0?o:{prim:"DIP",args:i===1?[[o]]:[{int:String(i)},[o]]}})}else{if(t.prim==="UNPAIR")return t;if(Pt(t,0)){const{r:a}=As(t,t.prim.slice(3),[],(i,s,o)=>[o,...s||[],...i||[]]);return a.map(([i])=>{const s=Gt({prim:"UNPAIR"});return i===0?s:{prim:"DIP",args:i===1?[[s]]:[{int:String(i)},[s]]}})}}if(KA.test(t.prim)&&Pt(t,0)){const a=[...t.prim.slice(1,t.prim.length-1)];return a.map((i,s)=>{const o=s===a.length-1?t.annots:void 0;switch(i){case"A":return Gt({prim:"CAR",annots:o});case"D":return Gt({prim:"CDR",annots:o});default:throw new Kr(t,`unexpected character: ${i}`)}})}if(GA.test(t.prim)&&Pt(t,0)){const{fields:a,rest:i}=a0(t.annots);if(a.length>1)throw new Kr(t,`unexpected annotation on macro ${t.prim}: ${a}`);const s=a.length!==0?{a:[{prim:"DUP"},{prim:"CAR",annots:a},{prim:"DROP"},{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:[a[0],"%@"]}],d:[{prim:"DUP"},{prim:"CDR",annots:a},{prim:"DROP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",a[0]]}]}:{a:[{prim:"CDR",annots:["@%%"]},{prim:"SWAP"},{prim:"PAIR",annots:["%","%@"]}],d:[{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@","%"]}]};return nf(t,t.prim.slice(5,t.prim.length-1),i,s)}
35if(jA.test(t.prim)&&Pt(t,1)){const{fields:a}=a0(t.annots);if(a.length>1)throw new Kr(t,`unexpected annotation on macro ${t.prim}: ${a}`);const i={a:[{prim:"DUP"},{prim:"CDR",annots:["@%%"]},{prim:"DIP",args:[[Gt({prim:"CAR",annots:a.length!==0?["@"+a[0].slice(1)]:void 0}),t.args[0]]]},{prim:"SWAP"},{prim:"PAIR",annots:[a.length!==0?a[0]:"%","%@"]}],d:[{prim:"DUP"},Gt({prim:"CDR",annots:a.length!==0?["@"+a[0].slice(1)]:void 0}),t.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",a.length!==0?a[0]:"%"]}]};return nf(t,t.prim.slice(5,t.prim.length-1),[],i)}if(VA.test(t.prim)&&Pt(t,1)){let a=0;for(;t.prim[1+a]==="I";)a++;return Gt({prim:"DIP",args:[{int:String(a)},t.args[0]]})}if(zA.test(t.prim)){let a=0;for(;t.prim[1+a]==="U";)a++;if(Ca(r,Dn.PtEdo2Zk)){if(a===1){if(t.args===void 0)return t;Pt(t,1)&&uv(t,t.args[0])&&(a=parseInt(t.args[0].int,10))}else Pt(t,0);return a===1?[Gt({prim:"DUP",annots:t.annots})]:a===2?[{prim:"DIP",args:[[Gt({prim:"DUP",annots:t.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(a-1)},[Gt({prim:"DUP",annots:t.annots})]]},{prim:"DIG",args:[{int:String(a)}]}]}else{if(a===1)return t;if(Pt(t,0))return Gt({prim:"DUP",args:[{int:String(a)}],annots:t.annots})}}return t}function ZA(t,e){return t.args!==void 0&&t.args.length===1&&"string"in t.args[0]&&t.args[0].string in e?e[t.args[0].string]:t}class Ho extends pt{constructor(e,r){super(),this.token=e,this.message=r,this.name="MichelineParseError"}}class ei extends pt{constructor(e,r){super(),this.node=e,this.message=r,this.name="JSONParseError"}}const s0=new Ho(null,"Unexpected EOF");function hv(t){return t.t===fr.Ident&&(t.v[0]==="@"||t.v[0]==="%"||t.v[0]===":")}const YA=new RegExp("^-?[0-9]+$"),XA=new RegExp("^([0-9a-fA-F]{2})*$");class ca{constructor(e){this.opt=e}expand(e){if(this.opt?.expandGlobalConstant!==void 0&&e.prim==="constant"){const r=ZA(e,this.opt.expandGlobalConstant);return r!==e&&(r[or]={...e[or]||{first:0,last:0},globalConstant:e}),r}if(this.opt?.expandMacros===void 0||this.opt?.expandMacros){const r=WA(e,this.opt);return r!==e&&(r[or]={...e[or]||{first:0,last:0},macro:e}),r}else return e}parseListExpr(e,r){const n={first:r.first,last:r.last},a=r.t==="(";let i;if(a){if(i=e.next(),i.done)throw s0;n.last=i.value.last}else i={value:r};if(i.value.t!==fr.Ident)throw new Ho(i.value,`not an identifier: ${i.value.v}`);const s={prim:i.value.v,[or]:n};for(;;){const o=e.next();if(o.done){if(a)throw s0;break}else if(o.value.t===")"){if(!a)throw new Ho(o.value,"unexpected closing bracket");n.last=o.value.last;break}else if(hv(o.value))s.annots=s.annots||[],s.annots.push(o.value.v),n.last=o.value.last;else{s.args=s.args||[];const c=this.parseExpr(e,o.value);n.last=c[or]?.last||n.last,s.args.push(c)}}return this.expand(s)}parseArgs(e,r){const n={first:r.first,last:r.last},a={prim:r.v,[or]:n};for(;;){const i=e.next();if(i.done||i.value.t==="}"||i.value.t===";")return[a,i];if(hv(i.value))n.last=i.value.last,a.annots=a.annots||[],a.annots.push(i.value.v);else{const s=this.parseExpr(e,i.value);n.last=s[or]?.last||n.last,a.args=a.args||[],a.args.push(s)}}}parseSequenceExpr(e,r){const n={first:r.first,last:r.last},a=[];a[or]=n;const i=r.t==="{";let s=r.t==="{"?null:{value:r};for(;;){if(s===null&&(s=e.next(),s.done||(n.last=s.value.last)),s.done){if(i)throw s0;return a}if(s.value.t==="}"){if(i)return a;throw new Ho(s.value,"unexpected closing bracket")}else if(s.value.t===fr.Ident){const[o,c]=this.parseArgs(e,s.value);n.last=o[or]?.last||n.last,a.push(this.expand(o)),s=c}else{const o=this.parseExpr(e,s.value);n.last=o[or]?.last||n.last,a.push(o),s=null}s===null&&(s=e.next(),s.done||(n.last=s.value.last)),!s.done&&s.value.t===";"&&(s=null)}}parseExpr(e,r){switch(r.t){case fr.Ident:return this.expand({prim:r.v,[or]:{first:r.first,last:r.last}});case fr.Number:return{int:r.v,[or]:{first:r.first,last:r.last}};case fr.String:return{string:JSON.parse(r.v),[or]:{first:r.first,last:r.last}};case fr.Bytes:return{bytes:r.v.slice(2),[or]:{first:r.first,last:r.last}};case"{":return this.parseSequenceExpr(e,r);default:return this.parseListExpr(e,r)}}parseSequence(e){if(typeof e!="string")throw new TypeError(`string type was expected, got ${typeof e} instead`);const r=i0(e),n=r.next();return n.done?null:this.parseSequenceExpr(r,n.value)}parseList(e){if(typeof e!="string")throw new TypeError(`string type was expected, got ${typeof e} instead`);const r=i0(e),n=r.next();return n.done?null:this.parseListExpr(r,n.value)}parseMichelineExpression(e){if(typeof e!="string")throw new TypeError(`string type was expected, got ${typeof e} instead`);const r=i0(e),n=r.next();return n.done?null:this.parseExpr(r,n.value)}parseScript(e){return this.parseSequence(e)}parseData(e){return this.parseList(e)}parseJSON(e){if(typeof e!="object")throw new TypeError(`object type was expected, got ${typeof e} instead`);if(Array.isArray(e)){const r=[];for(const n of e){if(n===null||typeof n!="object")throw new ei(n,`unex
35pected sequence element: ${n}`);r.push(this.parseJSON(n))}return r}else if("prim"in e){const r=e;if(typeof r.prim=="string"&&(r.annots===void 0||Array.isArray(r.annots))&&(r.args===void 0||Array.isArray(r.args))){const n={prim:r.prim};if(r.annots!==void 0){for(const a of r.annots)if(typeof a!="string")throw new ei(a,`string expected: ${a}`);n.annots=r.annots}if(r.args!==void 0){n.args=[];for(const a of r.args){if(a===null||typeof a!="object")throw new ei(a,`unexpected argument: ${a}`);n.args.push(this.parseJSON(a))}}return this.expand(n)}throw new ei(e,`malformed prim expression: ${e}`)}else if("string"in e){if(typeof e.string=="string")return{string:e.string};throw new ei(e,`malformed string literal: ${e}`)}else if("int"in e){if(typeof e.int=="string"&&YA.test(e.int))return{int:e.int};throw new ei(e,`malformed int literal: ${e}`)}else if("bytes"in e){if(typeof e.bytes=="string"&&XA.test(e.bytes))return{bytes:e.bytes};throw new ei(e,`malformed bytes literal: ${e}`)}else throw new ei(e,`unexpected object: ${e}`)}}const JA=[1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225],QA=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];class H0 extends pt{constructor(e){super(),this.message=e,this.name="Base58DecodingError"}}function lv(t){const e=(t.length+9)%64,r=e===0?0:64-e;if(t.length>268435455)throw new u_("",`: Invalid length ${t.length} is too big -- SHA-256.`);const n=t.length<<3,a=[...t,128,...new Array(r).fill(0),0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255];function i(f,l){return f>>>l|f<<32-l}const s=[...JA],o=new Array(64),c=new Array(8);for(let f=0;f<a.length;f+=64){let l=f,p=0;for(;p<16;)o[p]=a[l]<<24|a[l+1]<<16|a[l+2]<<8|a[l+3],l+=4,p++;for(;p<64;){const b=i(o[p-15],7)^i(o[p-15],18)^o[p-15]>>>3,v=i(o[p-2],17)^i(o[p-2],19)^o[p-2]>>>10;o[p]=(v|0)+o[p-7]+b+o[p-16]|0,p++}for(let b=0;b<8;b++)c[b]=s[b];for(let b=0;b<64;b++){const v=i(c[0],2)^i(c[0],13)^i(c[0],22),w=i(c[4],6)^i(c[4],11)^i(c[4],25),I=c[7]+w+(c[4]&c[5]^~c[4]&c[6])+QA[b]+o[b]|0,S=v+(c[0]&c[1]^c[0]&c[2]^c[1]&c[2])|0;c[7]=c[6],c[6]=c[5],c[5]=c[4],c[4]=c[3]+I|0,c[3]=c[2],c[2]=c[1],c[1]=c[0],c[0]=I+S|0}for(let b=0;b<8;b++)s[b]=s[b]+c[b]|0}const u=[];for(const f of s)u.push(f>>24&255),u.push(f>>16&255),u.push(f>>8&255),u.push(f&255);return u}const o0=[0,1,2,3,4,5,6,7,8,-1,-1,-1,-1,-1,-1,-1,9,10,11,12,13,14,15,16,-1,17,18,19,20,21,-1,22,23,24,25,26,27,28,29,30,31,32,-1,-1,-1,-1,-1,-1,33,34,35,36,37,38,39,40,41,42,43,-1,44,45,46,47,48,49,50,51,52,53,54,55,56,57];function dv(t,e){const r=t.charCodeAt(e)-49;if(r>=o0.length||o0[r]===-1)throw new H0(`Unexpected character at position ${e}: ${t[e]}`);return o0[r]}function e7(t){const e=[];let r=0;for(;r<t.length&&dv(t,r)===0;)r++;let n=r;for(;r<t.length;){let a=dv(t,r++),i=0;for(;a!==0||i<e.length;){const s=(e[i]||0)*58+a;e[i++]=s%256,a=Math.floor(s/256)}}for(;n-- >0;)e.push(0);return e.reverse()}function H3(t){const e=e7(t);if(e.length<4)throw new H0(`Data is too short ${e.length}`);const r=e.slice(0,e.length-4),n=e.slice(e.length-4),a=lv(lv(r));if(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])throw new H0("Invalid checksum");return r}class t7 extends Ce{constructor(e){super(),this.message=e,this.name="InvalidMichelsonError"}}class r7 extends Ce{constructor(e){super(),this.message=e,this.name="InvalidTypeExpressionError"}}class n7 extends Ce{constructor(e){super(),this.message=e,this.name="InvalidDataExpressionError"}}class i7 extends Ce{constructor(e){super(),this.entrypoint=e,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${e}"`}}class a7 extends pt{constructor(e){super(),this.message=e,this.name="LongIntegerError"}}class Gr extends pt{constructor(e,r){super(),this.val=e,this.message=r,this.name="MichelsonError"}}class lt extends Gr{constructor(e,r,n){super(e,r),this.val=e,this.message=r,this.name="MichelsonTypeError",n!==void 0&&(this.data=n)}}class F3{append(e){let r=0;for(;e!==0||r<this.buf.length;){const n=(this.buf[r]||0)*10+e;this.buf[r++]=n%256,e=Math.floor(n/256)}}constructor(e){if(this.neg=!1,this.buf=[],e!==void 0)if(typeof e=="string")for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);if(r===0&&n===45)this.neg=!0;else{if(n<48||n>57)throw new a7(`unexpected character in integer constant "${e[r]}"`);this.append(n-48)}}else e<0?(this.neg=!0,this.append(-e)):this.append(e)}cmp(e){if(this.neg!==e.neg)return(e.neg?1:0)-(this.neg?1:0);{let r=0;if(this.buf.length!==e.buf.length)r=this.buf.length<e.buf.length?-1:1;else if(this.buf.length!==0){let n=e.buf.length-1;for(;n>
35=0&&this.buf[n]===e.buf[n];)n--;r=n<0?0:this.buf[n]<e.buf[n]?-1:1}return this.neg?r===0?0:-r:r}}get sign(){return this.buf.length===0?0:this.neg?-1:1}}function $a(t){const e=[];for(let r=0;r<t.length;r+=2){const n=parseInt(t.slice(r,r+2),16);if(Number.isNaN(n))return null;e.push(n)}return e}function F0(t){try{return new F3(t),!0}catch{return!1}}function q3(t){try{return new F3(t).sign>=0}catch{return!1}}const s7=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function Xa(t,e){if(Array.isArray(t))return{};let r,n,a;if(t.annots!==void 0){for(const i of t.annots)if(i.length!==0){if(!s7.test(i)||!e?.specialVar&&(i==="@%"||i==="@%%")||!e?.specialFields&&i==="%@")throw new Gr(t,`${t.prim}: unexpected annotation: ${i}`);switch(i[0]){case"%":(e?.emptyFields||i.length>1)&&(r=r||[],r.push(i));break;case":":i.length>1&&(n=n||[],n.push(i));break;case"@":(e?.emptyVar||i.length>1)&&(a=a||[],a.push(i));break}}}return{f:r,t:n,v:a}}const o7={BlockHash:[32,[1,52]],OperationHash:[32,[5,116]],OperationListHash:[32,[133,233]],OperationListListHash:[32,[29,159,109]],ProtocolHash:[32,[2,170]],ContextHash:[32,[79,199]],ED25519PublicKeyHash:[20,[6,161,159]],SECP256K1PublicKeyHash:[20,[6,161,161]],P256PublicKeyHash:[20,[6,161,164]],ContractHash:[20,[2,90,121]],CryptoboxPublicKeyHash:[16,[153,103]],ED25519Seed:[32,[13,15,58,7]],ED25519PublicKey:[32,[13,15,37,217]],SECP256K1SecretKey:[32,[17,162,224,201]],P256SecretKey:[32,[16,81,238,189]],ED25519EncryptedSeed:[56,[7,90,60,179,41]],SECP256K1EncryptedSecretKey:[56,[9,237,241,174,150]],P256EncryptedSecretKey:[56,[9,48,57,115,171]],SECP256K1PublicKey:[33,[3,254,226,86]],P256PublicKey:[33,[3,178,139,127]],SECP256K1Scalar:[33,[38,248,136]],SECP256K1Element:[33,[5,92,0]],ED25519SecretKey:[64,[43,246,78,7]],ED25519Signature:[64,[9,245,205,134,18]],SECP256K1Signature:[64,[13,115,101,19,63]],P256Signature:[64,[54,240,44,52]],GenericSignature:[64,[4,130,43]],ChainID:[4,[87,82,0]],RollupAddress:[20,[1,128,120,31]]};function Bo(t,...e){const r=H3(t);for(const n of e){const[a,i]=o7[n];if(r.length===a+i.length){let s=0;for(;s<i.length&&r[s]===i[s];)s++;if(s===i.length)return[n,r.slice(i.length)]}}return null}function Fr(t,e){const r=e,n=Array.isArray(r)?r:r.args;return n.length===2?t==="pair"?{prim:"pair",args:n}:{prim:"Pair",args:n}:{...Array.isArray(r)?{prim:t}:r,args:[n[0],{prim:t,args:n.slice(1)}]}}function di(t){return Array.isArray(t)||t.prim==="pair"}function pv(t){return Array.isArray(t)||"prim"in t&&t.prim==="Pair"}const f7=/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])[T ]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|[+-]([01][0-9]|2[0-3]):([0-5][0-9]))$/;function c7(t){if("string"in t){if(q3(t.string))return new Date(parseInt(t.string,10));if(f7.test(t.string)){const e=new Date(t.string);if(!Number.isNaN(e.valueOf))return e}}else if(F0(t.int))return new Date(parseInt(t.int,10));return null}const u7=31,$3={ABS:!0,ADD:!0,ADDRESS:!0,AMOUNT:!0,AND:!0,APPLY:!0,BALANCE:!0,BLAKE2B:!0,CAR:!0,CDR:!0,CHAIN_ID:!0,CHECK_SIGNATURE:!0,COMPARE:!0,CONCAT:!0,CONS:!0,EDIV:!0,EQ:!0,EXEC:!0,FAILWITH:!0,GE:!0,GET_AND_UPDATE:!0,GT:!0,HASH_KEY:!0,IMPLICIT_ACCOUNT:!0,INT:!0,ISNAT:!0,JOIN_TICKETS:!0,KECCAK:!0,LE:!0,LEVEL:!0,LSL:!0,LSR:!0,LT:!0,MEM:!0,MUL:!0,NEG:!0,NEQ:!0,NEVER:!0,NOT:!0,NOW:!0,OR:!0,PACK:!0,PAIRING_CHECK:!0,READ_TICKET:!0,SAPLING_VERIFY_UPDATE:!0,SELF:!0,SELF_ADDRESS:!0,SENDER:!0,SET_DELEGATE:!0,SHA256:!0,SHA3:!0,SHA512:!0,SIZE:!0,SLICE:!0,SOME:!0,SOURCE:!0,SPLIT_TICKET:!0,SUB:!0,SWAP:!0,TICKET:!0,TICKET_DEPRECATED:!0,TOTAL_VOTING_POWER:!0,TRANSFER_TOKENS:!0,UNIT:!0,VOTING_POWER:!0,XOR:!0,RENAME:!0,OPEN_CHEST:!0,SUB_MUTEZ:!0,MIN_BLOCK_TIME:!0,BYTES:!0,NAT:!0,IS_IMPLICIT_ACCOUNT:!0,INDEX_ADDRESS:!0,GET_ADDRESS_INDEX:!0},K3=Object.assign({},$3,{CONTRACT:!0,CREATE_CONTRACT:!0,DIG:!0,DIP:!0,DROP:!0,DUG:!0,DUP:!0,EMIT:!0,EMPTY_BIG_MAP:!0,EMPTY_MAP:!0,EMPTY_SET:!0,GET:!0,IF:!0,IF_CONS:!0,IF_LEFT:!0,IF_NONE:!0,ITER:!0,LAMBDA:!0,LAMBDA_REC:!0,LEFT:!0,LOOP:!0,LOOP_LEFT:!0,MAP:!0,NIL:!0,NONE:!0,PAIR:!0,PUSH:!0,RIGHT:!0,SAPLING_EMPTY_STATE:!0,UNPACK:!0,UNPAIR:!0,UPDATE:!0,CAST:!0,VIEW:!0}),G3={unit:!0,never:!0,bool:!0,int:!0,nat:!0,string:!0,chain_id:!0,bytes:!0,mutez:!0,key_hash:!0,key:!0,signature:!0,timestamp:!0,address:!0,tx_rollup_l2_address:!0},os=Object.assign({},G3,{or:!0,pair:!0,set:!0,big_map:!0,contract:!0,lambda:!0,list:!0,map:!0,operation:!0,option:!0,bls12_381_g1:!0,bls12_381_g2:!0,bls12_381_fr:!0,sapling_transaction:!0,sapling_transaction_deprecated:!0,sapling_state:!0,ticket:!0,chest_key:!0,chest:!0});class mt extends Gr{constructor(e,r){super(e,r),this.val=e,this.message=r,this.name="MichelsonValidationError"}}function fn(t){return"prim"in t}function h7(t){return Array.isArray(t)||"prim"in t}function j3(t){if(fn(t))return!0;throw new mt(t,"prim expression expected")}function pi(t){if(Array.isArray(t))return!0;throw new mt(t,"sequence expression expected")}function ar(t){if(h7(t))return!0;throw new mt(t,"prim or sequence expression expected")}function f0(t){if(t.int[0]==="-")throw new mt(t,"natural number expected")}function Rs(t){if("int"in t)return!0;throw new mt(t,"int literal expected")}function V3(t){if("string"in t)return!0;throw new mt(t,"string literal expected")}function l7(t){if("string"in t||"bytes"in t)return!0;throw new mt(t,"string or bytes literal expected")}function ct(t,e){if(e===0&&t.args===void 0||t.args?.length===e)return!0;throw new mt(t,`${e} arguments expected`)}function qr(t){if(Array.isArray(t)){for(const e of t){if(!Array.isArray(e)&&!fn(e))throw new mt(t,"sequence or prim expected");qr(e)}return!0}if(j3(t)){if(Object.prototype.hasOwnProperty.call($3,t.prim))return ct(t,0),!0;switch(t.prim){case"DROP":case"PAIR":case"UNPAIR":case"DUP":case"UPDATE":case"GET":t.args!==void 0&&ct(t,1)&&Rs(t.args[0])&&f0(t.args[0]);break;case"DIG":case"DUG":case"SAPLING_EMPTY_STATE":ct(t,1)&&Rs(t.args[0])&&f0(t.args[0]);break;case"NONE":case"LEFT":case"RIGHT":case"NIL":case"CAST":ct(t,1)&&rn(t.args[0]);break;case"UNPACK":ct(t,1)&&$d(t.args[0]);break;case"CONTRACT":ct(t,1)&&Hf(t.args[0]);break;case"IF_NONE":case"IF_LEFT":case"IF_CONS":case"IF":ct(t,2)&&(pi(t.args[0])&&qr(t.args[0]),pi(t.args[1])&&qr(t.args[1]));break;case"MAP":case"ITER":case"LOOP":case"LOOP_LEFT":ct(t,1)&&qr(t.args[0]);break;case"CREATE_CONTRACT":ct(t,1)&&W3(t.args[0]);break;case"DIP":if(t.args?.length===2)Rs(t.args[0])&&f0(t.args[0]),pi(t.args[1])&&qr(t.args[1]);else if(t.args?.length===1)pi(t.args[0])&&qr(t.args[0]);else throw new mt(t,"1 or 2 arguments expected");break;case"PUSH":ct(t,2)&&(Ja(t.args[0]),ni(t.args[1]));break;case"EMPTY_SET":ct(t,1)&&Hn(t.args[0]);break;case"EMPTY_MAP":ct(t,2)&&(Hn(t.args[0]),rn(t.args[1]));break;case"EMPTY_BIG_MAP":ct(t,2)&&(Hn(t.args[0]),Ff(t.args[1]));break;case"LAMBDA_REC":case"LAMBDA":ct(t,3)&&(rn(t.args[0]),rn(t.args[1]),pi(t.args[2])&&qr(t.args[2]));break;case"VIEW":ct(t,2)&&(V3(t.args[0])&&z3(t.args[0]),rn(t.args[1])&&Ja(t.args[1]));break;case"EMIT":t.args&&t.args.length>0?ct(t,1):ct(t,0);break;default:throw new mt(t,"instruction expected")}}return!0}function Hn(t){if(ar(t)){if(Array.isArray(t)||t.prim==="pair"||t.prim==="or"||t.prim==="option")Ea(t,e=>Hn(e));else if(!Object.prototype.hasOwnProperty.call(G3,t.prim))throw new mt(t,`${t.prim}: type is not comparable`)}return!0}function $d(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim)||t.prim==="big_map"||t.prim==="operation"||t.prim==="sapling_state"||t.prim==="ticket")throw new mt(t,`${t.prim}: type can't be used inside PACK/UNPACK instructions`);Ea(t,e=>$d(e))}return!0}function Ja(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim)||t.prim==="big_map"||t.prim==="operation"||t.prim==="sapling_state"||t.prim==="ticket"||t.prim==="contract")throw new mt(t,`${t.prim}: type can't be pushed`);Ea(t,e=>Ja(e))}return!0}function Kd(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim)||t.prim==="operation"||t.prim==="contract")throw new mt(t,`${t.prim}: type can't be used as part of a storage`);Ea(t,e=>Kd(e))}return!0}function Hf(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim)||t.prim==="operation")throw new mt(t,`${t.prim}: type can't be used as part of a parameter`);Ea(t,e=>Hf(e))}return!0}function Ff(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim)||t.prim==="big_map"||t.prim==="operation"||t.prim==="sapling_state")throw new mt(t,`${t.prim}: type can't be used inside a big_map`);Ea(t,e=>Ff(e))}return!0}const d7=new RegExp("^[a-zA-Z0-9_.%@]*$");function z3(t){if(t.string.length>u7)throw new mt(t,`view name too long: ${t.string}`);if(!d7.test(t.string))throw new mt(t,`invalid character(s) in view n
35ame: ${t.string}`)}function rn(t){if(ar(t)&&fn(t)){if(!Object.prototype.hasOwnProperty.call(os,t.prim))throw new mt(t,"type expected");Ea(t,e=>rn(e))}return!0}function Ea(t,e){if(Array.isArray(t)||t.prim==="pair"){const r=Array.isArray(t)?t:t.args;if(r===void 0||r.length<2)throw new mt(t,"at least 2 arguments expected");return r.forEach(n=>{ar(n)&&e(n)}),!0}switch(t.prim){case"option":case"list":ct(t,1)&&ar(t.args[0])&&e(t.args[0]);break;case"contract":ct(t,1)&&Hf(t.args[0]);break;case"or":ct(t,2)&&ar(t.args[0])&&ar(t.args[1])&&(e(t.args[0]),e(t.args[1]));break;case"lambda":ct(t,2)&&(rn(t.args[0]),rn(t.args[1]));break;case"set":ct(t,1)&&Hn(t.args[0]);break;case"map":ct(t,2)&&ar(t.args[0])&&ar(t.args[1])&&(Hn(t.args[0]),e(t.args[1]));break;case"big_map":ct(t,2)&&ar(t.args[0])&&ar(t.args[1])&&(Hn(t.args[0]),Ff(t.args[1]),e(t.args[1]));break;case"ticket":ct(t,1)&&ar(t.args[0])&&Hn(t.args[0]);break;case"sapling_state":case"sapling_transaction":ct(t,1)&&Rs(t.args[0]);break;default:ct(t,0)}return!0}function ni(t){if("int"in t||"string"in t||"bytes"in t)return!0;if(Array.isArray(t)){let e=0;for(const r of t)fn(r)&&r.prim==="Elt"?(ct(r,2)&&(ni(r.args[0]),ni(r.args[1])),e++):ni(r);if(e!==0&&e!==t.length)throw new mt(t,"data entries and map elements can't be intermixed");return!0}if(fn(t))switch(t.prim){case"Unit":case"True":case"False":case"None":ct(t,0);break;case"Pair":if(t.args===void 0||t.args.length<2)throw new mt(t,"at least 2 arguments expected");for(const e of t.args)ni(e);break;case"Left":case"Right":case"Some":ct(t,1)&&ni(t.args[0]);break;case"Lambda_rec":t.args&&qr(t.args);break;case"Ticket":ct(t,4)&&(l7(t.args[0]),rn(t.args[1]),ni(t.args[2]),Rs(t.args[3]));break;default:if(Object.prototype.hasOwnProperty.call(K3,t.prim))qr(t);else throw new mt(t,"data entry or instruction expected")}else throw new mt(t,"data entry expected");return!0}function W3(t){if(pi(t)){const e={},r={};for(const n of t)if(j3(n)){if(n.prim!=="view"){if(n.prim in e)throw new mt(t,`duplicate contract section: ${n.prim}`);e[n.prim]=!0}switch(n.prim){case"code":ct(n,1)&&pi(n.args[0])&&qr(n.args[0]);break;case"parameter":if(ct(n,1)&&Hf(n.args[0]),n.annots)throw new mt(n,"Annotation must be part of the parameter type");break;case"storage":ct(n,1)&&Kd(n.args[0]);break;case"view":if(ct(n,4)){if(V3(n.args[0])){const a=n.args[0];if(a.string in r)throw new mt(t,`duplicate view name: ${a.string}`);r[a.string]=!0,z3(a)}Ja(n.args[1]),Ja(n.args[2]),pi(n.args[3])&&qr(n.args[3])}break;default:throw new mt(t,`unexpected contract section: ${n.prim}`)}}}return!0}function Z3(t){return Object.prototype.hasOwnProperty.call(K3,t.prim)}function gv(t){if(!Array.isArray(t))return!1;for(const e of t)if("prim"in e){if(Z3(e))throw new Gr(t,`Instruction outside of a lambda: ${JSON.stringify(t)}`);if(e.prim==="Elt")throw new Gr(t,`Elt item outside of a map literal: ${JSON.stringify(t)}`)}return!0}const p7=["parameter","storage","code","False","Elt","Left","None","Pair","Right","Some","True","Unit","PACK","UNPACK","BLAKE2B","SHA256","SHA512","ABS","ADD","AMOUNT","AND","BALANCE","CAR","CDR","CHECK_SIGNATURE","COMPARE","CONCAT","CONS","CREATE_ACCOUNT","CREATE_CONTRACT","IMPLICIT_ACCOUNT","DIP","DROP","DUP","EDIV","EMPTY_MAP","EMPTY_SET","EQ","EXEC","FAILWITH","GE","GET","GT","HASH_KEY","IF","IF_CONS","IF_LEFT","IF_NONE","INT","LAMBDA","LE","LEFT","LOOP","LSL","LSR","LT","MAP","MEM","MUL","NEG","NEQ","NIL","NONE","NOT","NOW","OR","PAIR","PUSH","RIGHT","SIZE","SOME","SOURCE","SENDER","SELF","STEPS_TO_QUOTA","SUB","SWAP","TRANSFER_TOKENS","SET_DELEGATE","UNIT","UPDATE","XOR","ITER","LOOP_LEFT","ADDRESS","CONTRACT","ISNAT","CAST","RENAME","bool","contract","int","key","key_hash","lambda","list","map","big_map","nat","option","or","pair","set","signature","string","bytes","mutez","timestamp","unit","operation","address","SLICE","DIG","DUG","EMPTY_BIG_MAP","APPLY","chain_id","CHAIN_ID","LEVEL","SELF_ADDRESS","never","NEVER","UNPAIR","VOTING_POWER","TOTAL_VOTING_POWER","KECCAK","SHA3","PAIRING_CHECK","bls12_381_g1","bls12_381_g2","bls12_381_fr","sapling_state","sapling_transaction_deprecated","SAPLING_EMPTY_STATE","SAPLING_VERIFY_UPDATE","ticket","TICKET_DEPRECATED","READ_TICKET","SPLIT_TICKET","JOIN_TICKETS","GET_AND_UPDATE","chest","chest_key","OPEN_CHEST","VIEW","view","constant","SUB_MUTEZ","tx_rollup_l2_address","MIN_BLOCK_TIME","sapling_transaction","EMIT","Lambda_rec","LAMBDA_REC","TICKET","BYTES","NAT","Ticket","IS_IMPLICIT_ACCOUNT","INDEX_ADDRESS","GET_ADDRESS_INDEX"];Object.assign({},...p7.map((t,e)=>({[t]:e})));var bv;(function(t){t[t.Int=0]="Int",t[t.String=1]="String",t[t.Sequence=2]="Sequence",t[t.Prim0=3]="Prim0",t[t.Prim0Annot=4]="Prim0Annot",t[t.Prim1=5]="Prim1",t[t.Prim1Annot=6]="Prim1Annot",t[t.Prim2=7]="Prim2",t[t.Prim2Annot=8]="Prim2Annot",t[t.Prim=9]="Prim",t[t.Bytes=10]="Bytes"})(bv||(bv={}));const ti=new Error("bounds out of range");class Qa{constructor(e,r=0,n=e.length){this.buffer=e,this.idx=r,this.cap=n}get length(){return this.cap-this.idx}readBytes(e){if(this.cap-this.idx<e)throw ti;const r=this.buffer.slice(this.idx,this.idx+e);return this.idx+=e,r}reader(e){if(this.cap-this.idx<e)throw ti;const r=new Qa(this.buffer,this.idx,this.idx+e);return this.idx+=e,r}copy(){return new Qa(this.buffer,this.idx,this.cap)}readUint8(){if(this.cap-this.idx<1)throw ti;return this.buffer[this.idx++]>>>0}readUint16(){if(this.cap-this.idx<2)throw ti;const e=this.buffer[this.idx++],r=this.buffer[this.idx++];return(e<<8|r)>>>0}readUint32(){if(this.cap-this.idx<4)throw ti;const e=this.buffer[this.idx++],r=this.buffer[this.idx++],n=this.buffer[this.idx++],a=this.buffer[this.idx++];return(e<<24|r<<16|n<<8|a)>>>0}readInt8(){if(this.cap-this.idx<1)throw ti;return this.buffer[this.idx++]<<24>>24}readInt16(){if(this.cap-this.idx<2)throw ti;const e=this.buffer[this.idx++],r=this.buffer[this.idx++];return(e<<8|r)<<16>>16}readInt32(){if(this.cap-this.idx<4)throw ti;const e=this.buffer[this.idx++],r=this.buffer[this.idx++],n=this.buffer[this.idx++],a=this.buffer[this.idx++];return e<<24|r<<16|n<<8|a}}var af;(function(t){t[t.Implicit=0]="Implicit",t[t.Originated=1]="Originated"})(af||(af={}));var Is;(function(t){t[t.ED25519=0]="ED25519",t[t.SECP256K1=1]="SECP256K1",t[t.P256=2]="P256"})(Is||(Is={}));function Y3(t){let e;const r=t.readUint8();switch(r){case Is.ED25519:e="ED25519PublicKeyHash";break;case Is.SECP256K1:e="SECP256K1PublicKeyHash";break;case Is.P256:e="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${r}`)}return{type:e,hash:t.readBytes(20)}}function g7(t){let e;const r=t.readUint8();switch(r){case af.Implicit:e=Y3(t);break;case af.Originated:e={type:"ContractHash",hash:t.readBytes(20)},t.readBytes(1);break;default:throw new Error(`unknown address tag: ${r}`)}if(t.length!==0){const n=new TextDecoder;e.entryPoint=n.decode(new Uint8Array(t.readBytes(t.length)))}return e}var Bs;(function(t){t[t.ED25519=0]="ED25519",t[t.SECP256K1=1]="SECP256K1",t[t.P256=2]="P256"})(Bs||(Bs={}));function b7(t){let e,r;const n=t.readUint8();switch(n){case Bs.ED25519:r="ED25519PublicKey",e=32;break;case Bs.SECP256K1:r="SECP256K1PublicKey",e=33;break;case Bs.P256:r="P256PublicKey",e=33;break;default:throw new Error(`unknown public key tag: ${n}`)}return{type:r,publicKey:t.readBytes(e)}}function m7(t){const e=$a(t.bytes);if(e===null)throw new Error(`can't parse bytes: "${t.bytes}"`);const r=new Qa(new Uint8Array(e));return g7(r)}function y7(t){const e=$a(t.bytes);if(e===null)throw new Error(`can't parse bytes: "${t.bytes}"`);const r=new Qa(new Uint8Array(e));return Y3(r)}function v7(t){const e=$a(t.bytes);if(e===null)throw new Error(`can't parse bytes: "${t.bytes}"`);const r=new Qa(new Uint8Array(e));return b7(r)}class ot extends Gr{constructor(e,r,n){super(e,n),this.val=e,this.stackState=r,this.message=n,this.name="MichelsonInstructionError"}}function bt(t){return Array.isArray(t)?"pair":t.prim}function sf(t){return"prim"in t?t.args:t}function Tr(t,e,r=!1){if(bt(t)!==bt(e))throw new lt(t,`types mismatch: ${bt(t)} != ${bt(e)}`,void 0);
35const n=[Xa(t),Xa(e)];if(n[0].t&&n[1].t&&n[0].t[0]!==n[1].t[0])throw new lt(t,`${bt(t)}: type names mismatch: ${n[0].t[0]} != ${n[1].t[0]}`,void 0);if(r&&n[0].f&&n[1].f&&n[0].f[0]!==n[1].f[0])throw new lt(t,`${bt(t)}: field names mismatch: ${n[0].f[0]} != ${n[1].f}`,void 0);if(di(t)){const a=Fr("pair",t),i=Fr("pair",e);Tr(a.args[0],i.args[0],!0),Tr(a.args[1],i.args[1],!0);return}switch(t.prim){case"option":case"list":case"contract":case"set":case"ticket":Tr(t.args[0],e.args[0]);break;case"or":Tr(t.args[0],e.args[0],!0),Tr(t.args[1],e.args[1],!0);break;case"lambda":case"map":case"big_map":Tr(t.args[0],e.args[0]),Tr(t.args[1],e.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(t.args[0].int,10)!==parseInt(e.args[0].int,10))throw new lt(t,`${bt(t)}: type argument mismatch: ${t.args[0].int} != ${e.args[0].int}`,void 0)}}function X3(t,e){if(t.length!==e.length)throw new lt(t,`stack length mismatch: ${t.length} != ${e.length}`,void 0);for(let r=0;r<t.length;r++)Tr(t[r],e[r])}function _t(t,e=!1){if(!Array.isArray(t)){const r=Xa(t);if((r.t?.length||0)>1)throw new lt(t,`${t.prim}: at most one type annotation allowed: ${t.annots}`,void 0);if(e){if((r.f?.length||0)>1)throw new lt(t,`${t.prim}: at most one field annotation allowed: ${t.annots}`,void 0)}else if((r.f?.length||0)>0)throw new lt(t,`${t.prim}: field annotations aren't allowed: ${t.annots}`,void 0)}if(di(t)){const r=sf(t);for(const n of r)_t(n,!0);return}switch(t.prim){case"option":case"list":case"contract":case"set":_t(t.args[0]);break;case"or":for(const r of t.args)_t(r,!0);break;case"lambda":case"map":case"big_map":_t(t.args[0]),_t(t.args[1])}}function J3(t){if(!Array.isArray(t))return!1;for(const e of t)if(!(Array.isArray(e)&&J3(e)||"prim"in e&&Z3(e)))return!1;return!0}function hr(t,e,r){if(di(e)){if(pv(t)){gv(t);const n=Fr("Pair",t),a=Fr("pair",e);hr(n.args[0],a.args[0],r),hr(n.args[1],a.args[1],r);return}throw new lt(e,`pair expected: ${JSON.stringify(t)}`,t)}switch(e.prim){case"int":if("int"in t&&F0(t.int))return;throw new lt(e,`integer value expected: ${JSON.stringify(t)}`,t);case"nat":case"mutez":if("int"in t&&q3(t.int))return;throw new lt(e,`natural value expected: ${JSON.stringify(t)}`,t);case"string":if("string"in t)return;throw new lt(e,`string value expected: ${JSON.stringify(t)}`,t);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in t&&$a(t.bytes)!==null)return;throw new lt(e,`bytes value expected: ${JSON.stringify(t)}`,t);case"bool":if("prim"in t&&(t.prim==="True"||t.prim==="False"))return;throw new lt(e,`boolean value expected: ${JSON.stringify(t)}`,t);case"key_hash":if("string"in t&&Bo(t.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash")!==null)return;if("bytes"in t)try{y7(t);return}catch{}throw new lt(e,`key hash expected: ${JSON.stringify(t)}`,t);
35case"timestamp":if(("string"in t||"int"in t)&&c7(t)!==null)return;throw new lt(e,`timestamp expected: ${JSON.stringify(t)}`,t);case"address":if("string"in t){let n=t.string;const a=t.string.indexOf("%");if(a>=0&&(n=t.string.slice(0,a)),Bo(n,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress")!==null)return}else if("bytes"in t)try{m7(t);return}catch{}throw new lt(e,`address expected: ${JSON.stringify(t)}`,t);case"key":if("string"in t&&Bo(t.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey")!==null)return;if("bytes"in t)try{v7(t);return}catch{}throw new lt(e,`public key expected: ${JSON.stringify(t)}`,t);case"unit":if("prim"in t&&t.prim==="Unit")return;throw new lt(e,`unit value expected: ${JSON.stringify(t)}`,t);case"signature":if("bytes"in t||"string"in t&&Bo(t.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature")!==null)return;throw new lt(e,`signature expected: ${JSON.stringify(t)}`,t);case"chain_id":if(("bytes"in t||"string"in t)&&("string"in t?H3(t.string):$a(t.bytes))!==null)return;throw new lt(e,`chain id expected: ${JSON.stringify(t)}`,t);case"option":if("prim"in t){if(t.prim==="None")return;if(t.prim==="Some"){hr(t.args[0],e.args[0],r);return}}throw new lt(e,`option expected: ${JSON.stringify(t)}`,t);case"list":case"set":if(gv(t)){for(const n of t)hr(n,e.args[0],r);return}throw new lt(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);case"or":if("prim"in t){if(t.prim==="Left"){hr(t.args[0],e.args[0],r);return}else if(t.prim==="Right"){hr(t.args[0],e.args[1],r);return}}throw new lt(e,`union (or) expected: ${JSON.stringify(t)}`,t);case"lambda":if(J3(t)){const n=Vt(t,[e.args[0]],r);if("failed"in n)throw new lt(e,`function is failed with error type: ${n.failed}`,t);if(n.length!==1)throw new lt(e,"function must return a value",t);Tr(e.args[1],n[0]);return}throw new lt(e,`function expected: ${JSON.stringify(t)}`,t);case"map":case"big_map":if(Array.isArray(t)){for(const n of t){if(!("prim"in n)||n.prim!=="Elt")throw new lt(e,`map elements expected: ${JSON.stringify(t)}`,t);hr(n.args[0],e.args[0],r),hr(n.args[1],e.args[1],r)}return}throw new lt(e,`${e.prim} expected: ${JSON.stringify(t)}`,t);case"bls12_381_fr":if("int"in t&&F0(t.int)||"bytes"in t&&$a(t.bytes)!==null)return;throw new lt(e,`BLS12-381 element expected: ${JSON.stringify(t)}`,t);case"sapling_state":if(Array.isArray(t))return;throw new lt(e,`sapling state expected: ${JSON.stringify(t)}`,t);case"ticket":if("prim"in t&&t.prim==="Ticket"){hr(t.args[0],{prim:"address"},r),x7(t.args[1],e.args[0]),hr(t.args[2],e.args[0],r),hr(t.args[3],{prim:"nat"},r);return}else if(pv(t)){hr(t,{prim:"pair",args:[{prim:"address"},e.args[0],{prim:"nat"}]},r);return}throw new lt(e,`ticket expected: ${JSON.stringify(t)}`,t);default:throw new lt(e,`type ${bt(e)} don't have Michelson literal representation`,t)}}function w7(t,e,r){let n=e,a=e,i=0;for(const s of t){const o=Vt(s,a,r);if(n=o,"failed"in o)break;a=o,i++}if("failed"in n&&n.level==0&&(!("prim"in n.failed)||n.failed.prim!=="never")&&i!==t.length-1)throw new ot(t,n,"FAIL must appear in a tail position");if(r?.traceCallback!==void 0){const s={op:t,in:e,out:n};r.traceCallback(s)}return"failed"in n?{failed:n.failed,level:n.level+1}:n}function Vt(t,e,r){const n=r?.protocol||D3;if(Array.isArray(t))return w7(t,e,r);const a=t;function i(P,...x){if(e.length<x.length+P)throw new ot(a,e,`${a.prim}: stack must have at least ${x.length} element(s)`);let d=P;for(const m of x){if(m!==null&&m.length!==0){let h=0;for(;h<m.length&&m[h]!==bt(e[d]);)h++;if(h===m.length)throw new ot(a,e,`${a.prim}: stack type mismatch: [${d}] expected to be ${m}, got ${bt(e[d])} instead`)}d++}return e.slice(P,x.length+P)}function s(P){return(...x)=>{try{return P(...x)}catch(d){throw d instanceof Gr?new ot(a,e,d.message):d}}}function o(P){return x=>{try{return P(x)}catch(d){throw d instanceof Gr?new ot(a,e,d.message):d}}}const c=s(Xa),u=s(X3),f=s(Tr),l=o(Hn),p=o($d),b=o(Kd),v=o(Ja),w=o(Ff);function I(P,x){const d=c(a,{...x,emptyFields:P.f!==void 0&&P.f>1,emptyVar:P.v!==void 0&&P.v>1}),m=(h,g,y)=>{if(h&&h.length>(g||0))throw new ot(a,e,`${a.prim}: at most ${g||0} ${y} annotations allowed`)};return m(d.f,P.f,"field"),m(d.t,P.t,"type"),m(d.v,P.v,"variable"),d}function S(P,x){const d=P,m=Array.isArray(d)?{prim:"pair",args:d}:d,h=c(m),g=x.v!==void 0||x.t!==void 0||x.f!==void 0?[...(x.v===null?h.v:x.v)||[],...(x.t===null?h.t:x.t)||[],...(x.f===null?h.f:x.f)||[]]:void 0,{annots:y,..._}=m;return{..._,...g&&g.length!==0&&{annots:g}}}function T(P,x){const d=I({v:1});return S(P,{v:d.v!==void 0?d.v:x!==void 0?[x]:null,t:null})}function C(P,x,d,m,h){const g=c(x).f?.[0],y=d.f?.[m];
35if(y!==void 0&&y!=="%"&&g!==void 0&&y!==g)throw new ot(a,e,`${a.prim}: field names doesn't match: ${y} !== ${g}`);const _=d.v?.[m],R=c(P).v?.[0];return S(x,{t:null,v:_?_==="@%"?g?["@"+g.slice(1)]:void 0:_==="@%%"?R?["@"+R.slice(1)+"."+(g?g.slice(1):h)]:g?["@"+g.slice(1)]:void 0:[_]:null})}function k(P,x,d=x){const m=Fr("pair",P);if(d===1)return[m.args[0]];if(d===2)return m.args;const h=m.args[1];if(di(h))return[m.args[0],...k(h,x,d-1)];throw new ot(a,e,`${a.prim}: at least ${x} fields are expected`)}function $(P,x,d=x){if(d===0)return P;const m=Fr("pair",P);if(d===1)return m.args[0];const h=m.args[1];if(di(h))return $(h,x,d-2);if(d===2)return h;throw new ot(a,e,`${a.prim}: at least ${x+1} fields are expected`)}function G(P,x,d,m=d){if(m===0)return x;const h=Fr("pair",P);if(m===1)return{...h,args:[x,h.args[1]]};const g=h.args[1];if(di(g))return{...h,args:[h.args[0],G(g,x,d,m-2)]};if(m===2)return{...h,args:[h.args[0],x]};throw new ot(a,e,`${a.prim}: at least ${d+1} fields are expected`)}const B=(P,x)=>["@"+(P.v?P.v[0].slice(1)+".":"")+x];function M(P,x){return"failed"in P||"failed"in x?"failed"in P?x:P:(u(P,x),P)}const N=(P=>{switch(P.prim){case"DUP":{const x=P.args?parseInt(P.args[0].int,10):1;if(x===0)throw new ot(P,e,"DUP 0 is forbidden");const d=i(x-1,null)[0];if(bt(d)==="ticket")throw new ot(P,e,"ticket can't be DUPed");return[d,...e]}case"SWAP":{const x=i(0,null,null);return I({}),[x[1],x[0],...e.slice(2)]}case"SOME":return[S({prim:"option",args:[i(0,null)[0]]},I({t:1,v:1})),...e.slice(1)];case"UNIT":return[S({prim:"unit"},I({v:1,t:1})),...e];case"PAIR":{const x=P.args?parseInt(P.args[0].int,10):2;if(x<2)throw new ot(P,e,`PAIR ${x} is forbidden`);const d=i(0,...new Array(x).fill(null)),m=I({f:x,t:1,v:1},{specialFields:!0}),h=y=>{const _=y.lastIndexOf(".");return y.slice(_>0?_+1:1)},g=d.map((y,_)=>{const R=c(y),A=m.f&&m.f.length>_&&m.f[_]!=="%"?m.f[_]==="%@"?R.v?["%"+h(R.v?.[0]||"")]:void 0:[m.f[_]]:void 0;return S(y,{v:null,t:null,f:A})});return[S({prim:"pair",args:g},{t:m.t,v:m.v}),...e.slice(x)]}case"UNPAIR":{const x=P.args?parseInt(P.args[0].int,10):2;if(x<2)throw new ot(P,e,`UNPAIR ${x} is forbidden`);const d=i(0,["pair"])[0],m=I({f:2,v:2},{specialVar:!0});return[...k(d,x).map((g,y)=>C(d,g,m,y,y===0?"car":"cdr")),...e.slice(1)]}case"CAR":case"CDR":{const x=Fr("pair",i(0,["pair"])[0]),d=x.args[P.prim==="CAR"?0:1],m=I({f:1,v:1},{specialVar:!0});return[C(x,d,m,0,P.prim.toLocaleLowerCase()),...e.slice(1)]}case"CONS":{const x=i(0,null,["list"]);return f(x[0],x[1].args[0]),[T({prim:"list",args:[x[1].args[0]]}),...e.slice(2)]}case"SIZE":return i(0,["string","list","set","map","bytes"]),[T({prim:"nat"}),...e.slice(1)];case"MEM":{const x=i(0,null,["set","map","big_map"]);return l(x[0]),f(x[0],x[1].args[0]),[T({prim:"bool"}),...e.slice(2)]}case"GET":if(P.args){const x=parseInt(P.args[0].int,10),d=i(0,["pair"])[0];return[T($(d,x)),...e.slice(1)]}else{const x=i(0,null,["map","big_map"]);return l(x[0]),f(x[0],x[1].args[0]),[T({prim:"option",args:[x[1].args[1]]}),...e.slice(2)]}case"UPDATE":if(P.args){const x=parseInt(P.args[0].int,10),d=i(0,null,["pair"]);return[T(G(d[1],d[0],x)),...e.slice(2)]}else{const x=i(0,null,["bool","option"]);if(l(x[0]),x[1].prim==="bool"){const m=i(2,["set"]);return f(x[0],m[0].args[0]),[T({prim:"set",args:[S(x[0],{t:null})]}),...e.slice(3)]}const d=i(2,["map","big_map"]);return f(x[0],d[0].args[0]),d[0].prim==="map"?[T({prim:"map",args:[S(x[0],{t:null}),S(x[1].args[0],{t:null})]}),...e.slice(3)]:(w(x[1].args[0]),[T({prim:"big_map",args:[S(x[0],{t:null}),S(x[1].args[0],{t:null})]}),...e.slice(3)])}case"GET_AND_UPDATE":{const x=I({v:2}),d=i(0,null,["option"],["map","big_map"]);l(d[0]),f(d[0],d[2].args[0]),f(d[1].args[0],d[2].args[1]);const m=x.v?.map(h=>h!=="@"?[h]:void 0);return d[2].prim==="map"?[S({prim:"option",args:[d[2].args[1]]},{v:m?.[0]}),S({prim:"map",args:[S(d[0],{t:null}),S(d[1].args[0],{t:null})]},{v:m?.[1]}),...e.slice(3)]:(w(d[1].args[0]),[S({prim:"option",args:[d[2].args[1]]},{v:m?.[0]}),S({prim:"big_map",args:[S(d[0],{t:null}),S(d[1].args[0],{t:null})]},{v:m?.[1]}),...e.slice(3)])}case"EXEC":{const x=i(0,null,["lambda"]);return f(x[0],x[1].args[0]),[T(x[1].args[1]),...e.slice(2)]}case"APPLY":{const x=i(0,null,["lambda"]);if(b(x[0]),v(x[0]),!di(x[1].args[0]))throw new ot(P,e,`${P.prim}: function's argument must be a pair: ${bt(x[1].args[0])}`);const d=x[1].args[0];return f(x[0],sf(d)[0]),[T({prim:"lambda",args:[sf(d)[1],x[1].args[1]]}),...e.slice(2)]}case"FAILWITH":{const x=i(0,null)[0];return Ca(n,Dn.PtEdo2Zk)||p(x),{failed:x,level:0}}case"NEVER":return i(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[T(i(0,null)[0]),...e.slice(1)];case"CONCAT":{const x=i(0,["string","list","bytes"]);if(x[0].prim==="list"){if(bt(x[0].args[0])!=="string"&&bt(x[0].args[0])!=="bytes")throw new ot(P,e,`${P.prim}
35: can't concatenate list of ${bt(x[0].args[0])}'s`);return[T(x[0].args[0]),...e.slice(1)]}const d=i(1,["string","bytes"]);if(x[0].prim!==d[0].prim)throw new ot(P,e,`${P.prim}: can't concatenate ${x[0].prim} with ${d[0].prim}`);return[T(d[0]),...e.slice(2)]}case"SLICE":return[T({prim:"option",args:[i(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),...e.slice(3)];case"PACK":{const x=i(0,null)[0];return p(x),[T({prim:"bytes"},"@packed"),...e.slice(1)]}case"ADD":{const x=i(0,["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","timestamp","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(x[0].prim==="nat"&&x[1].prim==="int"||x[0].prim==="int"&&x[1].prim==="nat")return[T({prim:"int"}),...e.slice(2)];if(x[0].prim==="int"&&x[1].prim==="timestamp"||x[0].prim==="timestamp"&&x[1].prim==="int")return[T({prim:"timestamp"}),...e.slice(2)];if((x[0].prim==="int"||x[0].prim==="nat"||x[0].prim==="mutez"||x[0].prim==="bls12_381_g1"||x[0].prim==="bls12_381_g2"||x[0].prim==="bls12_381_fr")&&x[0].prim===x[1].prim)return[T(x[0]),...e.slice(2)];throw new ot(P,e,`${P.prim}: can't add ${x[0].prim} to ${x[1].prim}`)}case"SUB":{const x=Ca(n,Dn.PsiThaCa)?i(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):i(0,["nat","int","timestamp"],["nat","int","timestamp"]);if((x[0].prim==="nat"||x[0].prim==="int")&&(x[1].prim==="nat"||x[1].prim==="int")||x[0].prim==="timestamp"&&x[1].prim==="timestamp")return[T({prim:"int"}),...e.slice(2)];if(x[0].prim==="timestamp"&&x[1].prim==="int")return[T({prim:"timestamp"}),...e.slice(2)];if(x[0].prim==="mutez"&&x[1].prim==="mutez")return[T({prim:"mutez"}),...e.slice(2)];throw new ot(P,e,`${P.prim}: can't subtract ${x[0].prim} from ${x[1].prim}`)}case"SUB_MUTEZ":return i(0,["mutez"],["mutez"]),[T({prim:"option",args:[{prim:"mutez"}]}),...e.slice(2)];case"MUL":{const x=i(0,["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"],["nat","int","mutez","bls12_381_g1","bls12_381_g2","bls12_381_fr"]);if(x[0].prim==="nat"&&x[1].prim==="int"||x[0].prim==="int"&&x[1].prim==="nat")return[T({prim:"int"}),...e.slice(2)];if(x[0].prim==="nat"&&x[1].prim==="mutez"||x[0].prim==="mutez"&&x[1].prim==="nat")return[T({prim:"mutez"}),...e.slice(2)];if((x[0].prim==="bls12_381_g1"||x[0].prim==="bls12_381_g2"||x[0].prim==="bls12_381_fr")&&x[1].prim==="bls12_381_fr"||(x[0].prim==="nat"||x[0].prim==="int")&&x[0].prim===x[1].prim)return[T(x[0]),...e.slice(2)];if((x[0].prim==="nat"||x[0].prim==="int")&&x[1].prim==="bls12_381_fr"||(x[1].prim==="nat"||x[1].prim==="int")&&x[0].prim==="bls12_381_fr")return[T({prim:"bls12_381_fr"}),...e.slice(2)];throw new ot(P,e,`${P.prim}: can't multiply ${x[0].prim} by ${x[1].prim}`)}case"EDIV":{const x=(m,h)=>({prim:"option",args:[{prim:"pair",args:[{prim:m},{prim:h}]}]}),d=i(0,["nat","int","mutez"],["nat","int","mutez"]);if(d[0].prim==="nat"&&d[1].prim==="nat")return[T(x("nat","nat")),...e.slice(2)];if((d[0].prim==="nat"||d[0].prim==="int")&&(d[1].prim==="nat"||d[1].prim==="int"))return[T(x("int","nat")),...e.slice(2)];if(d[0].prim==="mutez"&&d[1].prim==="nat")return[T(x("mutez","mutez")),...e.slice(2)];if(d[0].prim==="mutez"&&d[1].prim==="mutez")return[T(x("nat","mutez")),...e.slice(2)];throw new ot(P,e,`${P.prim}: can't euclideally divide ${d[0].prim} by ${d[1].prim}`)}case"ABS":return i(0,["int"]),[T({prim:"nat"}),...e.slice(1)];case"ISNAT":return i(0,["int"]),[T({prim:"option",args:[{prim:"nat"}]}),...e.slice(1)];case"INT":return i(0,["nat","bls12_381_fr","bytes"]),[T({prim:"int"}),...e.slice(1)];case"BYTES":return i(0,["nat","int"]),[T({prim:"bytes"}),...e.slice(1)];case"NAT":return i(0,["bytes"]),[T({prim:"nat"}),...e.slice(1)];case"NEG":{const x=i(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return x.prim==="nat"||x.prim==="int"?[T({prim:"int"}),...e.slice(1)]:[T(x),...e.slice(1)]}case"LSL":case"LSR":return i(0,["nat","bytes"],["nat","bytes"]),[T({prim:"nat"}),...e.slice(2)];case"OR":case"XOR":{const x=i(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(x[0].prim!==x[1].prim)throw new ot(P,e,`${P.prim}: both arguments must be of the same type: ${x[0].prim}, ${x[1].prim}`);return[T(x[1]),...e.slice(2)]}case"AND":{const x=i(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if((x[0].prim!=="int"||x[1].prim!=="nat")&&x[0].prim!==x[1].prim)throw new ot(P,e,`${P.prim}: both arguments must be of the same type: ${x[0].prim}, ${x[1].prim}`);return[T(x[1]),...e.slice(2)]}case"NOT":return i(0,["nat","bytes","bool","int"])[0].prim==="bool"?[T({prim:"bool"}),...e.slice(1)]:[T({prim:"int"}),...e.slice(1)];
35case"COMPARE":{const x=i(0,null,null);return l(x[0]),l(x[1]),[T({prim:"int"}),...e.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return i(0,["int"]),[T({prim:"bool"}),...e.slice(1)];case"SELF":{if(r?.contract===void 0)throw new ot(P,e,`${P.prim}: contract required`);const x=I({f:1,v:1}),d=q0(r.contract,x.f?.[0]);if(d===null)throw new ot(P,e,`${P.prim}: contract has no entrypoint ${d}`);return[S({prim:"contract",args:[d]},{v:x.v?x.v:["@self"]}),...e]}case"TRANSFER_TOKENS":{const x=i(0,null,["mutez"],["contract"]);return f(x[0],x[2].args[0]),[T({prim:"operation"}),...e.slice(3)]}case"SET_DELEGATE":{const x=i(0,["option"])[0];if(bt(x.args[0])!=="key_hash")throw new ot(P,e,`${P.prim}: key hash expected: ${bt(x.args[0])}`);return[T({prim:"operation"}),...e.slice(1)]}case"IMPLICIT_ACCOUNT":return i(0,["key_hash"]),[T({prim:"contract",args:[{prim:"unit"}]}),...e.slice(1)];case"NOW":return[T({prim:"timestamp"},"@now"),...e];case"AMOUNT":return[T({prim:"mutez"},"@amount"),...e];case"BALANCE":return[T({prim:"mutez"},"@balance"),...e];case"CHECK_SIGNATURE":return i(0,["key"],["signature"],["bytes"]),[T({prim:"bool"}),...e.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return i(0,["bytes"]),[T({prim:"bytes"}),...e.slice(1)];case"HASH_KEY":return i(0,["key"]),[T({prim:"key_hash"}),...e.slice(1)];case"SOURCE":return[T({prim:"address"},"@source"),...e];case"SENDER":return[T({prim:"address"},"@sender"),...e];case"ADDRESS":{const x=i(0,["contract"])[0],d=I({v:1});return[S({prim:"address",[Io]:x},{v:d.v?d.v:B(c(x),"address")}),...e.slice(1)]}case"SELF_ADDRESS":{const x={prim:"address"};return r?.contract!==void 0&&(x[Io]={prim:"contract",args:[nn(r.contract,"parameter").args[0]]}),[T(x,"@address"),...e]}case"CHAIN_ID":return[T({prim:"chain_id"}),...e];case"DROP":{I({});const x=P.args!==void 0?parseInt(P.args[0].int,10):1;return i(x-1,null),e.slice(x)}case"DIG":{I({});const x=parseInt(P.args[0].int,10);return[i(x,null)[0],...e.slice(0,x),...e.slice(x+1)]}case"DUG":{I({});const x=parseInt(P.args[0].int,10);return[...e.slice(1,x+1),i(0,null)[0],...e.slice(x+1)]}case"NONE":return _t(P.args[0]),[S({prim:"option",args:[P.args[0]]},I({t:1,v:1})),...e];case"LEFT":case"RIGHT":{const x=i(0,null)[0],d=I({f:2,t:1,v:1},{specialFields:!0}),m=c(x),h=[S(x,{t:null,v:null,f:d.f&&d.f.length>0&&d.f[0]!=="%"?d.f[0]==="%@"?m.v?["%"+m.v[0].slice(1)]:void 0:d.f:void 0}),S(P.args[0],{t:null,f:d.f&&d.f.length>1&&d.f[1]!=="%"?d.f:void 0})];return[S({prim:"or",args:P.prim==="LEFT"?h:[h[1],h[0]]},{t:d.t,v:d.v}),...e.slice(1)]}case"NIL":return _t(P.args[0]),[S({prim:"list",args:[P.args[0]]},I({t:1,v:1})),...e];case"UNPACK":return i(0,["bytes"]),_t(P.args[0]),[T({prim:"option",args:[P.args[0]]},"@unpacked"),...e.slice(1)];case"CONTRACT":{const x=i(0,["address"])[0];_t(P.args[0]);const d=I({v:1,f:1}),m=x[Io];if(m!==void 0){const h=q0(m,d.f?.[0]);if(h===null)throw new ot(P,e,`${P.prim}: contract has no entrypoint ${h}`);f(h,P.args[0])}return[S({prim:"option",args:[{prim:"contract",args:[P.args[0]]}]},{v:d.v?d.v:B(c(x),"contract")}),...e.slice(1)]}case"CAST":{I({});const x=i(0,null)[0];return _t(P.args[0]),f(P.args[0],x),[P.args[0],...e.slice(1)]}case"IF_NONE":{I({});const x=i(0,["option"])[0],d=e.slice(1),m=Vt(P.args[0],d,r),h=Vt(P.args[1],[S(x.args[0],{t:null,v:B(c(x),"some")}),...d],r);return M(m,h)}case"IF_LEFT":{I({});const x=i(0,["or"])[0],d=c(x),m=c(x.args[0]),h=c(x.args[1]),g=e.slice(1),y=Vt(P.args[0],[S(x.args[0],{t:null,v:B(d,m.f?m.f[0].slice(1):"left")}),...g],r),_=Vt(P.args[1],[S(x.args[1],{t:null,v:B(d,h.f?h.f[0].slice(1):"right")}),...g],r);return M(y,_)}case"IF_CONS":{I({});const x=i(0,["list"])[0],d=c(x),m=e.slice(1),h=Vt(P.args[0],[S(x.args[0],{t:null,v:B(d,"hd")}),S(x,{t:null,v:B(d,"tl")}),...m],r),g=Vt(P.args[1],m,r);return M(h,g)}case"IF":{I({}),i(0,["bool"]);const x=e.slice(1),d=Vt(P.args[0],x,r),m=Vt(P.args[1],x,r);return M(d,m)}case"MAP":{const x=i(0,["list","map","option"])[0],d=e.slice(1),m=x.prim==="map"?{prim:"pair",args:x.args}:x.args[0],h=Vt(P.args[0],[S(m,{t:null,v:B(c(x),"elt")}),...d],r);if("failed"in h){if(!("prim"in h.failed)||h.failed.prim!=="never")throw new ot(P,e,`${P.prim}: FAIL is not allowed in MAP`);return{failed:h.failed,level:h.level+1}}if(h.length<1)throw new ot(P,e,`${P.prim}: function must return a value`);return u(h.slice(1),d),x.prim==="list"?[T({prim:"list",args:[h[0]]}),...d]:x.prim==="map"?[T({prim:"map",args:[x.args[0],h[0]]}),...d]:[T({prim:"option",args:[h[0]]}),...d]}case"ITER":{I({});const x=i(0,["set","list","map"])[0],d=e.slice(1),m=x.prim==="map"?{prim:"pair",args:x.args}:x.args[0],h=Vt(P.args[0],[S(m,{t:null,v:B(c(x),"elt")}),...d],r);return"failed"in h?{failed:h.failed,level:h.level+1}:(u(h,d),d)}case"LOOP":{I({}),i(0,["bool"]);const x=e.slice(1),d=Vt(P.args[0],x,r);return"failed"in d?{failed:d.failed,level:d.level+1}:(u(d,[{prim:"bool"},...x]),x)}case"LOOP_LEFT":{I({});const x=i(0,["or"])[0],d=e.slice(1),m=Vt(P.args[0],[S(x.args[0],{t:null,v:B(c(x),"left")}),...d],r);return"failed"in m?{failed:m.failed,level:m.level+1}:(u(m,[x,...d]),[S(x.args[1],{t:null,v:I({v:1}).v}),...d])}case"DIP":{I({});const x=P.args.length===2?parseInt(P.args[0].int,10):1;i(x-1,null);const d=e.slice(0,x),m=e.slice(x),h=P.args.length===2?Vt(P.args[1],m,r):Vt(P.args[0],m,r);return"failed"in h?{failed:h.failed,level:h.level+1}:[...d,...h]}case"CREATE_CONTRACT":{const x=I({v:2}),d=i(0,["option"],["mutez"],null);if(bt(d[0].args[0])!=="key_hash")throw new ot(P,e,`${P.prim}: key hash expected: ${bt(d[0].args[0])}`);b(d[2])&&(e6(P.args[0]),Tr(nn(P.args[0],"storage").args[0],d[2]));const m=x.v?.map(h=>h!=="@"?[h]:void 0);return[S({prim:"operation"},{v:m?.[0]}),S({prim:"address",[Io]:{prim:"contract",args:[nn(P.args[0],"parameter").args[0]]}},{v:m?.[1]}),...e.slice(3)]}case"PUSH":return _t(P.args[0]),hr(P.args[1],P.args[0],{...r,contract:void 0}),[T(P.args[0]),...e];case"EMPTY_SET":return _t(P.args[0]),l(P.args[0]),[S({prim:"set",args:P.args},I({t:1,v:1})),...e];case"EMPTY_MAP":return _t(P.args[0]),l(P.args[0]),_t(P.args[1]),[S({prim:"map",args:P.args},I({t:1,v:1})),...e];case"EMPTY_BIG_MAP":return _t(P.args[0]),l(P.args[0]),_t(P.args[1]),w(P.args[0]),[S({prim:"big_map",args:P.args},I({t:1,v:1})),...e];case"LAMBDA_REC":case"LAMBDA":{_t(P.args[0]),_t(P.args[1]);const x=[P.args[0]];P.prim==="LAMBDA_REC"&&x.push({prim:"lambda",args:[P.args[0],P.args[1]]});const d=Vt(P.args[2],x,{...r,contract:void 0});if("failed"in d)return{failed:d.failed,level:d.level+1};if(d.length!==1)throw new ot(P,e,`${P.prim}: function must return a value`);return f(P.args[1],d[0]),[T({prim:"lambda",args:[P.args[0],P.args[1]]}),...e]}case"LEVEL":return[T({prim:"nat"},"@level"),...e];case"TOTAL_VOTING_POWER":return[T({prim:"nat"}),...e];case"VOTING_POWER":return i(0,["key_hash"]),[T({prim:"nat"}),...e.slice(1)];case"TICKET":{const x=i(0,null,["nat"])[0];return l(x),Ca(n,Dn.PtLimaPtL)?[S({prim:"ticket",args:[x]},I({t:1,v:1})),...e.slice(2)]:[T({prim:"option",args:[S({prim:"ticket",args:[x]},I({t:1,v:1}))]}),...e.slice(2)]}case"JOIN_TICKETS":{const x=Fr("pair",i(0,["pair"])[0]);if(bt(x.args[0])!=="ticket")throw new ot(P,e,`${P.prim}: ticket expected: ${bt(x.args[0])}`);
35return f(x.args[0],x.args[1]),[T({prim:"option",args:[S(x.args[0],{t:null})]}),...e.slice(1)]}case"SPLIT_TICKET":{const x=i(0,["ticket"],["pair"]),d=Fr("pair",x[1]);if(bt(d.args[0])!=="nat")throw new ot(P,e,`${P.prim}: nat expected: ${bt(d.args[0])}`);return f(d.args[0],d.args[1]),[T({prim:"option",args:[{prim:"pair",args:[S(x[0],{t:null}),S(x[0],{t:null})]}]}),...e.slice(2)]}case"READ_TICKET":{const x=I({v:2}),d=i(0,["ticket"])[0],m=x.v?.map(h=>h!=="@"?[h]:void 0);return[S({prim:"pair",args:[{prim:"address"},S(d.args[0],{t:null}),{prim:"nat"}]},{v:m?.[0]}),S(d,{v:m?.[1],t:null}),...e.slice(1)]}case"PAIRING_CHECK":{const x=i(0,["list"])[0].args[0];if(!di(x))throw new ot(P,e,`${P.prim}: pair expected: ${bt(x)}`);const d=Fr("pair",x);if(bt(d.args[0])!=="bls12_381_g1")throw new ot(P,e,`${P.prim}: bls12_381_g1 expected: ${bt(d.args[0])}`);if(bt(d.args[1])!=="bls12_381_g2")throw new ot(P,e,`${P.prim}: bls12_381_g2 expected: ${bt(d.args[1])}`);return[T({prim:"bool"}),...e.slice(1)]}case"SAPLING_EMPTY_STATE":return[S({prim:"sapling_state",args:[P.args[0]]},I({v:1,t:1})),...e];case"SAPLING_VERIFY_UPDATE":{const x=i(0,["sapling_transaction"],["sapling_state"]);if(parseInt(x[0].args[0].int,10)!==parseInt(x[1].args[0].int,10))throw new ot(P,e,`${P.prim}: sapling memo size mismatch: ${x[0].args[0].int} != ${x[1].args[0].int}`);return Ca(n,Dn.PtJakarta)?[T({prim:"option",args:[{prim:"pair",args:[{prim:"int"},S(x[1],{t:null})]}]}),...e.slice(2)]:[T({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},S(x[1],{t:null})]}]}]}),...e.slice(2)]}case"OPEN_CHEST":return i(0,["chest_key"],["chest"],["nat"]),[T({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),...e.slice(3)];case"VIEW":{const x=i(0,null,["address"]);return v(x[0]),[T({prim:"option",args:[P.args[1]]}),...e.slice(2)]}case"MIN_BLOCK_TIME":return[T({prim:"nat"}),...e];case"EMIT":{const x=I({f:1,t:1});if(P.args){const d=i(0,null);return f(d[0],P.args[0]),[S({prim:"operation"},x),...e.slice(1)]}return[S({prim:"operation"},x),...e.slice(1)]}case"IS_IMPLICIT_ACCOUNT":return i(0,["address"]),[T({prim:"option",args:[{prim:"key_hash"}]}),...e.slice(1)];case"INDEX_ADDRESS":return i(0,["address"]),[T({prim:"nat"}),...e.slice(1)];case"GET_ADDRESS_INDEX":return i(0,["address"]),[T({prim:"option",args:[{prim:"nat"}]}),...e.slice(1)];default:throw new Gr(P,`unexpected instruction: ${P.prim}`)}})(a);if(r?.traceCallback!==void 0){const P={op:a,in:e,out:N};r.traceCallback(P)}return N}function nn(t,e){for(const r of t)if(r.prim===e)return r;throw new Gr(t,`missing contract section: ${e}`)}function _7(t){const e={};for(const r of t)r.prim==="view"&&(e[r.args[0].string]=r);return e}function Q3(t){if(Array.isArray(t)){for(const e of t)if("prim"in e&&(e.prim==="parameter"||e.prim==="storage"||e.prim==="code"))return!0}return!1}function q0(t,e){e=e||"%default";const r=of(t).find(n=>n[0]===e);return r!==void 0?r[1]:e==="%default"?Q3(t)?nn(t,"parameter").args[0]:t:null}function E7(t){return Array.isArray(t)||t.prim==="or"}function of(t){if(Q3(t)){const e=nn(t,"parameter"),r=of(e.args[0]),n=Xa(e);return n.f?[[n.f[0],e.args[0]],...r]:r}if(E7(t)){const e=sf(t),r=n=>{const a=Xa(e[n]);if(bt(e[n])==="or"){const i=of(e[n]);return a.f?[[a.f[0],e[n]],...i]:i}return a.f?[[a.f[0],e[n]]]:[]};return[...r(0),...r(1)]}return[]}function e6(t,e){const r=(c,u,f,l)=>{_t(c,!0),_t(u);const p={prim:"pair",args:[{...c,annots:["@parameter"]},{...u,annots:["@storage"]}]},b=Vt(l,[p],{...e,contract:t});if("failed"in b)return b;try{X3(b,[f])}catch(v){throw v instanceof Gr?new ot(l,b,v.message):v}return b},n=nn(t,"parameter").args[0],a=nn(t,"storage").args[0],i=nn(t,"code").args[0],o=r(n,a,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},a]},i);for(const c of Object.values(_7(t)))r(c.args[1],a,c.args[2],c.args[3]);return o}function t6(t,e,r){_t(e),hr(t,e,r||null)}function S7(t,e,r){for(const n of e)_t(n);if(r?.contract!==void 0)for(const n of["parameter","storage"]){const a=nn(r.contract,n).args[0];_t(a)}return Vt(t,e,r||null)}function x7(t,e,r=!1){if(Array.isArray(t)){for(const n of t)_t(n);for(const n of e)_t(n)}else _t(t),_t(e);Tr(t,e,r)}function A7(t,e,r){try{return t6(t,e,r),!0}catch{return!1}}class Gd{constructor(e,r){this.contract=e,this.ctx={contract:e,...r},this.output=e6(e,this.ctx)}static parse(e,r){const n=new ca(r),a=typeof e=="string"?n.parseScript(e):n.parseJSON(e);if(a===null)throw new t7("empty Michelson");if(W3(a))return new Gd(a,r)}static parseTypeExpression(e,r){const n=new ca(r),a=typeof e=="string"?n.parseScript(e):n.parseJSON(e);if(a===null)throw new r7("empty type expression");if(rn(a))return _t(a),a}static parseDataExpression(e,r){const n=new ca(r),a=typeof e=="string"?n.parseScript(e):n.parseJSON(e);if(a===null)throw new n7("empty data expression");if(ni(a))return a;throw void 0}section(e){return nn(this.contract,e)}entryPoints(){return of(this.contract)}entryPoint(e){return q0(this.contract,e)}assertDataValid(e,r){t6(e,r,this.ctx)}isDataValid(e,r){return A7(e,r,this.ctx)}assertParameterValid(e,r){const n=this.entryPoint(e||void 0);if(n===null)throw new i7(e?.toString());this.assertDataValid(r,n)}isParameterValid(e,r){try{return this.assertParameterValid(e,r),!0}catch{return!1}}functionType(e,r){return S7(e,r,this.ctx)}}new Gd([{prim:"parameter",args:[{prim:"unit"}]},{prim:"storage",args:[{prim:"unit"}]},{prim:"code",args:[[{prim:"CAR"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PAIR"}]]}]);var c0={},mv;function R7(){return mv||(mv=1,(function(t){function e(S,T){var C;return S instanceof Fe?C=S:C=Fe.from(S.buffer,S.byteOffset,S.byteLength),C.toString(T)}var r=function(S){return Fe.from(S)};function n(S){for(var T=0,C=Math.min(256*256,S.length+1),k=new Uint16Array(C),$=[],G=0;;){var B=T<S.length;if(!B||G>=C-1){var M=k.subarray(0,G),N=M;if($.push(String.fromCharCode.apply(null,N)),!B)return $.join("");S=S.subarray(T),T=0,G=0}var P=S[T++];if((P&128)===0)k[G++]=P;else if((P&224)===192){var x=S[T++]&63;k[G++]=(P&31)<<6|x}else if((P&240)===224){var x=S[T++]&63,d=S[T++]&63;k[G++]=(P&31)<<12|x<<6|d}else if((P&248)===240){var x=S[T++]&63,d=S[T++]&63,m=S[T++]&63,h=(P&7)<<18|x<<12|d<<6|m;h>65535&&(h-=65536,k[G++]=h>>>10&1023|55296,h=56320|h&1023),k[G++]=h}}}function a(S){for(var T=0,C=S.length,k=0,$=Math.max(32,C+(C>>>
351)+7),G=new Uint8Array($>>>3<<3);T<C;){var B=S.charCodeAt(T++);if(B>=55296&&B<=56319){if(T<C){var M=S.charCodeAt(T);(M&64512)===56320&&(++T,B=((B&1023)<<10)+(M&1023)+65536)}if(B>=55296&&B<=56319)continue}if(k+4>G.length){$+=8,$*=1+T/S.length*2,$=$>>>3<<3;var N=new Uint8Array($);N.set(G),G=N}if((B&4294967168)===0){G[k++]=B;continue}else if((B&4294965248)===0)G[k++]=B>>>6&31|192;else if((B&4294901760)===0)G[k++]=B>>>12&15|224,G[k++]=B>>>6&63|128;else if((B&4292870144)===0)G[k++]=B>>>18&7|240,G[k++]=B>>>12&63|128,G[k++]=B>>>6&63|128;else continue;G[k++]=B&63|128}return G.slice?G.slice(0,k):G.subarray(0,k)}var i="Failed to ",s=function(S,T,C){if(S)throw new Error("".concat(i).concat(T,": the '").concat(C,"' option is unsupported."))},o=typeof Fe=="function"&&Fe.from,c=o?r:a;function u(){this.encoding="utf-8"}u.prototype.encode=function(S,T){return s(T&&T.stream,"encode","stream"),c(S)};function f(S){var T;try{var C=new Blob([S],{type:"text/plain;charset=UTF-8"});T=URL.createObjectURL(C);var k=new XMLHttpRequest;return k.open("GET",T,!1),k.send(),k.responseText}finally{T&&URL.revokeObjectURL(T)}}var l=!o&&typeof Blob=="function"&&typeof URL=="function"&&typeof URL.createObjectURL=="function",p=["utf-8","utf8","unicode-1-1-utf-8"],b=n;o?b=e:l&&(b=function(S){try{return f(S)}catch{return n(S)}});var v="construct 'TextDecoder'",w="".concat(i," ").concat(v,": the ");function I(S,T){s(T&&T.fatal,v,"fatal"),S=S||"utf-8";var C;if(o?C=Fe.isEncoding(S):C=p.indexOf(S.toLowerCase())!==-1,!C)throw new RangeError("".concat(w," encoding label provided ('").concat(S,"') is invalid."));this.encoding=S,this.fatal=!1,this.ignoreBOM=!1}I.prototype.decode=function(S,T){s(T&&T.stream,"decode","stream");var C;return S instanceof Uint8Array?C=S:S.buffer instanceof ArrayBuffer?C=new Uint8Array(S.buffer):C=new Uint8Array(S),b(C,this.encoding)},t.TextEncoder=t.TextEncoder||u,t.TextDecoder=t.TextDecoder||I})(typeof window<"u"?window:typeof ft<"u"?ft:c0)),c0}R7();const $0=t=>t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),""),It=(t,e=8)=>t.toString(16).padStart(e,"0"),jd=31;var ie;(function(t){t.SECRET="secret",t.RAW="raw",t.TZ1="tz1",t.BRANCH="branch",t.ZARITH="zarith",t.PUBLIC_KEY="public_key",t.PKH="pkh",t.PKH_ARR="pkhArr",t.DELEGATE="delegate",t.SCRIPT="script",t.BALLOT_STATEMENT="ballotStmt",t.PROPOSAL="proposal",t.PROPOSAL_ARR="proposalArr",t.INT32="int32",t.INT16="int16",t.PARAMETERS="parameters",t.ADDRESS="address",t.SMART_CONTRACT_ADDRESS="smart_contract_address",t.SMART_ROLLUP_ADDRESS="smart_rollup_address",t.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",t.VALUE="value",t.PADDED_BYTES="padded_bytes",t.SMART_ROLLUP_MESSAGE="smart_rollup_message",t.MANAGER="manager",t.BLOCK_PAYLOAD_HASH="blockPayloadHash",t.ENTRYPOINT="entrypoint",t.OPERATION="operation",t.OP_ACTIVATE_ACCOUNT="activate_account",t.OP_DELEGATION="delegation",t.OP_TRANSACTION="transaction",t.OP_ORIGINATION="origination",t.OP_BA
35LLOT="ballot",t.OP_FAILING_NOOP="failing_noop",t.OP_ATTESTATION="attestation",t.OP_ATTESTATION_WITH_DAL="attestation_with_dal",t.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",t.OP_REVEAL="reveal",t.OP_PROPOSALS="proposals",t.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",t.OP_TRANSFER_TICKET="transfer_ticket",t.BURN_LIMIT="burn_limit",t.OP_INCREASE_PAID_STORAGE="increase_paid_storage",t.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",t.OP_UPDATE_COMPANION_KEY="update_companion_key",t.SIGNATURE_PROOF="signature_proof",t.OP_DRAIN_DELEGATE="drain_delegate",t.DEPOSITS_LIMIT="deposits_limit",t.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",t.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",t.PVM_KIND="pvm_kind",t.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",t.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",t.OP_DAL_PUBLISH_COMMITMENT="dal_publish_commitment",t.SLOT_HEADER="slot_header"})(ie||(ie={}));const Yr={"00":"parameter","01":"storage","02":"code","03":"False","04":"Elt","05":"Left","06":"None","07":"Pair","08":"Right","09":"Some","0a":"True","0b":"Unit","0c":"PACK","0d":"UNPACK","0e":"BLAKE2B","0f":"SHA256",10:"SHA512",11:"ABS",12:"ADD",13:"AMOUNT",14:"AND",15:"BALANCE",16:"CAR",17:"CDR",18:"CHECK_SIGNATURE",19:"COMPARE","1a":"CONCAT","1b":"CONS","1c":"CREATE_ACCOUNT","1d":"CREATE_CONTRACT","1e":"IMPLICIT_ACCOUNT","1f":"DIP",20:"DROP",21:"DUP",22:"EDIV",23:"EMPTY_MAP",24:"EMPTY_SET",25:"EQ",26:"EXEC",27:"FAILWITH",28:"GE",29:"GET","2a":"GT","2b":"HASH_KEY","2c":"IF","2d":"IF_CONS","2e":"IF_LEFT","2f":"IF_NONE",30:"INT",31:"LAMBDA",32:"LE",33:"LEFT",34:"LOOP",35:"LSL",36:"LSR",37:"LT",38:"MAP",39:"MEM","3a":"MUL","3b":"NEG","3c":"NEQ","3d":"NIL","3e":"NONE","3f":"NOT",40:"NOW",41:"OR",42:"PAIR",43:"PUSH",44:"RIGHT",45:"SIZE",46:"SOME",47:"SOURCE",48:"SENDER",49:"SELF","4a":"STEPS_TO_QUOTA","4b":"SUB","4c":"SWAP","4d":"TRANSFER_TOKENS","4e":"SET_DELEGATE","4f":"UNIT",50:"UPDATE",51:"XOR",52:"ITER",53:"LOOP_LEFT",54:"ADDRESS",55:"CONTRACT",56:"ISNAT",57:"CAST",58:"RENAME",59:"bool","5a":"contract","5b":"int","5c":"key","5d":"key_hash","5e":"lambda","5f":"list",60:"map",61:"big_map",62:"nat",63:"option",64:"or",65:"pair",66:"set",67:"signature",68:"string",69:"bytes","6a":"mutez","6b":"timestamp","6c":"unit","6d":"operation","6e":"address","6f":"SLICE",70:"DIG",71:"DUG",72:"EMPTY_BIG_MAP",73:"APPLY",74:"chain_id",75:"CHAIN_ID",76:"LEVEL",77:"SELF_ADDRESS",78:"never",79:"NEVER","7a":"UNPAIR","7b":"VOTING_POWER","7c":"TOTAL_VOTING_POWER","7d":"KECCAK","7e":"SHA3","7f":"PAIRING_CHECK",80:"bls12_381_g1",81:"bls12_381_g2",82:"bls12_381_fr",83:"sapling_state",84:"sapling_transaction_deprecated",85:"SAPLING_EMPTY_STATE",86:"SAPLING_VERIFY_UPDATE",87:"ticket",88:"TICKET_DEPRECATED",89:"READ_TICKET","8a":"SPLIT_TICKET","8b":"JOIN_TICKETS","8c":"GET_AND_UPDATE","8d":"chest","8e":"chest_key","8f":"OPEN_CHEST",90:"VIEW",91:"view",92:"constant",93:"SUB_MUTEZ",94:"tx_rollup_l2_address",95:"MIN_BLOCK_TIME",96:"sapling_transaction",97:"EMIT",98:"Lambda_rec",99:"LAMBDA_REC","9a":"TICKET","9b":"BYTES","9c":"NAT","9d":"Ticket","9e":"IS_IMPLICIT_ACCOUNT","9f":"INDEX_ADDRESS",a0:"GET_ADDRESS_INDEX"},I7=(()=>{const t={};return Object.keys(Yr).forEach(e=>{t[Yr[e]]=e}),t})(),K0={4:"activate_account",107:"reveal",110:"delegation",108:"transaction",109:"origination",6:"ballot",21:"attestation",23:"attestation_with_dal",1:"seed_nonce_revelation",5:"proposals",111:"register_global_constant",158:"transfer_ticket",112:"set_deposits_limit",113:"increase_paid_storage",114:"update_consensus_key",115:"update_companion_key",9:"drain_delegate",200:"smart_rollup_originate",201:"smart_rollup_add_messages",206:"smart_rollup_execute_outbox_message",230:"dal_publish_commitment",17:"failing_noop"},yv=(()=>{const t={};return Object.keys(K0).forEach(e=>{const r=typeof e=="string"?parseInt(e,10):e;t[K0[r]]=It(r,2)}),t})(),ff={"00":"default","01":"root","02":"do","03":"set_delegate","04":"remove_delegate","05":"deposit","06":"stake","07":"unstake","08":"finalize_unstake","09":"set_delegate_parameters"},vv=(()=>{const t={};
35return Object.keys(ff).forEach(e=>{t[ff[e]]=e}),t})();class wv extends Ce{constructor(e,r){super(),this.operation=e,this.errorDetail=r,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",r&&(this.message+=` ${r}.`)}}class r6 extends Ce{constructor(e){super(),this.entrypoint=e,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${e.length}", maximum length is "${jd}".`}}class B7 extends Ce{constructor(e){super(),this.ballotValue=e,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${e}" expecting one of the following: "yay", "nay", "pass".`}}class T7 extends Ce{constructor(e){super(),this.ballotValue=e,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${e}", cannot be decoded.`}}class P7 extends Ce{constructor(e){super(),this.value=e,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${e}", unalbe to encode.`}}class n6 extends Ce{constructor(e){super(),this.message=e,this.name="OperationDecodingError"}}class M7 extends Ce{constructor(e){super(),this.message=e,this.name="OperationEncodingError"}}class O7 extends Ce{constructor(e){super(),this.op=e,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${e}", can submit an issue on our github for feature request.`}}class L7 extends Ce{constructor(e){super(),this.pvm=e,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${e}" expecting either "arith" or "wasm_2_0_0".`}}class N7 extends Ce{constructor(e){super(),this.pvm=e,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${e}", cannot be decoded.`}}class k7 extends Ce{constructor(e,r){super(),this.address=e,this.errorDetail=r,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${e}"`,r&&(this.message+=` ${r}.`)}}class C7 extends Ce{constructor(e,r){super(),this.hash=e,this.errorDetail=r,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${e}"`,r&&(this.message+=` ${r}.`)}}class U7 extends Ce{constructor(e,r){super(),this.commitment=e,this.errorDetail=r,this.name="InvalidDalCommitmentError",this.message=`Invalid dal commitment "${e}"`,r&&(this.message+=` ${r}.`)}}class Vr{static fromHexString(e){const r=e.toLowerCase();if(/^(([a-f]|\d){2})*$/.test(r)){const n=new Uint8Array((r.match(/([a-z]|\d){2}/g)||[]).map(a=>parseInt(a,16)));return new Vr(n)}else throw new Es(r)}constructor(e,r=0){this.arr=e,this.offset=r}consume(e){const r=this.arr.subarray(this.offset,this.offset+e);return this.offset+=e,r}get(e){return this.arr[this.offset+e]}length(){return this.arr.length-this.offset}slice(e,r){return new Vr(this.arr.slice(e,r))}}const D7=t=>"prim"in t,H7=t=>"bytes"in t&&typeof t.bytes=="string",F7=t=>"string"in t&&typeof t.string=="string",q7=t=>"int"in t&&typeof t.int=="string",$7=t=>{const e=_i(t.code),r=_i(t.storage);return`${It(e.length/2,8)}${e}${It(r.length/2,8)}${r}`},K7=t=>{const e=Mr(t),r=Mr(t);return{code:Ei(new Vr(e)),storage:Ei(new Vr(r))}},_i=t=>{if(Array.isArray(t)){const e=t.map(n=>_i(n)).join(""),r=e.length/2;return`02${It(r)}${e}`}else{if(D7(t))return X7(t);if(H7(t))return j7(t);if(F7(t))return z7(t);if(q7(t))return Z7(t)}throw new P7(JSON.stringify(t))},Ei=t=>{const e=t.consume(1);switch(e[0]){case 10:return V7(t);case 1:return W7(t);case 0:return Y7(t);case 2:{const r=new Vr(Mr(t)),n=[];for(;r.length()>0;)n.push(Ei(r));return n}default:return J7(t,e)}},Mr=(t,e=4)=>{const r=t.consume(e),n=parseInt(Fe.from(r).toString("hex"),16);return t.consume(n)},G7=(t,e=4)=>{const r=[];let n=t;for(;n.length();){const a=n.consume(e),i=parseInt(Fe.from(a).toString("hex"),16);r.push(n.consume(i)),n=n.slice(i+e)}return r},j7=t=>{if(!/^([A-Fa-f0-9]{2})*$/.test(t.bytes))throw new Es(t.bytes);const e=t.bytes.length/2;return`0a${It(e)}${t.bytes}`},V7=t=>{const e=Mr(t);return{bytes:Fe.from(e).toString("hex")}},z7=t=>{const e=Fe.from(t.string,"utf8").toString("hex"),r=e.length/2;return`01${It(r)}${e}`},W7=t=>{const e=Mr(t);return{string:Fe.from(e).toString("utf8")}},Z7=({int:t})=>{const e=new tt(t,10),r=e.toString(2)[0]==="-"?"1":"0",n=e.toString(2).replace(/-/g,""),a=n.length<=6?6:(n.length-6)%7?n.length+7-(n.length-6)%7:n.length,s=n.padStart(a,"0").match(/\d{6,7}/g).reverse();return s[0]=r+s[0],`00${s.map((c,u)=>parseInt((u===s.length-1?"0":"1")+c,2).toString(16).padStart(2,"0")).join("")}`},Y7=t=>{let e=t.consume(1)[0];const r=[],n=128;for(;e&n;)r.push(e),e=t.consume(1)[0];
35r.push(e);const a=!!(64&r[0]);r[0]=r[0]&127;const i=r.map((o,c)=>o.toString(2).slice(c===0?-6:-7).padStart(c===0?6:7,"0")).reverse();let s=new tt(i.join(""),2);return a&&(s=s.times(-1)),{int:s.toFixed()}},X7=t=>{const e=+Array.isArray(t.annots),r=Array.isArray(t.args)?t.args.length:0,n=It(Math.min(2*r+e+3,9),2),a=I7[t.prim];let i=(t.args||[]).map(o=>_i(o)).join("");const s=Array.isArray(t.annots)?t9(t.annots):"";return(t.prim==="LAMBDA"||t.prim==="LAMBDA_REC")&&r&&(i=It(i.length/2)+i+It(0)),(t.prim==="pair"||t.prim==="Pair")&&r>2&&(i=s===""?It(i.length/2)+i+It(0):It(i.length/2)+i),t.prim==="view"&&t.args&&(i=It(i.length/2)+i+It(0)),`${n}${a}${i}${s}`},J7=(t,e)=>{const r=(e[0]-3)%2===1;let n=Math.floor((e[0]-3)/2);const a=t.consume(1)[0].toString(16).padStart(2,"0"),i={prim:Yr[a]};if((Yr[a]==="LAMBDA"||Yr[a]==="LAMBDA_REC")&&t.consume(4),Yr[a]==="view")return n!=0?Q7(t,i):i;let s,o;(Yr[a]==="pair"||Yr[a]==="Pair")&&n>2&&(s=e9(t),n=0,o=_v(t));const c=new Array(n).fill(0).map(()=>Ei(t));return(Yr[a]==="LAMBDA"||Yr[a]==="LAMBDA_REC")&&t.consume(4),s?i.args=s:c.length&&(i.args=c),o&&o[0]!==""?i.annots=o:r&&(i.annots=_v(t)),i},Q7=(t,e)=>(t.consume(4),e.args=new Array(4).fill(0).map(()=>Ei(t)),t.consume(4),e),e9=t=>{const e=new Vr(Mr(t)),r=[];for(;e.length()>0;)r.push(Ei(e));return r},t9=t=>{const e=t.map(n=>Fe.from(n,"utf8").toString("hex")).join("20"),r=e.length/2;return`${It(r)}${e}`},_v=t=>{const e=t.consume(4),r=parseInt(Fe.from(e).toString("hex"),16),n=t.consume(r);return Fe.from(n).toString("hex").split("20").map(i=>Fe.from(i,"hex").toString("utf8"))},Sa=t=>e=>{const[r]=At(e,[t]);return _r(r)},Zt=t=>e=>{const r=e.consume(Zo[t]);return wr(r,t)},r9=Zt(re.Ed25519PublicKeyHash),n9=Zt(re.BlockHash),qf=t=>{const e=t.consume(1);if(e[0]===0)return Zt(re.Ed25519PublicKeyHash)(t);if(e[0]===1)return Zt(re.Secp256k1PublicKeyHash)(t);if(e[0]===2)return Zt(re.P256PublicKeyHash)(t);if(e[0]===3)return Zt(re.BLS12_381PublicKeyHash)(t)},i9=t=>{if(!Vd(t))return;const e=[];for(t.consume(4);t.length()>0;)e.push(qf(t));return e},a9=Sa(re.BlockHash),s9=Sa(re.Ed25519PublicKeyHash),ba=t=>t?"ff":"00",i6=t=>Sa(re.ProtocolHash)(t),a6=t=>Zt(re.ProtocolHash)(t),o9=t=>{const e=[];for(t.consume(4);t.length()>0;)e.push(a6(t));return e},f9=t=>It(32*t.length)+t.map(e=>i6(e)).join(""),c9=t=>{switch(t){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new B7(t)}},u9=t=>{const e=t.consume(1);switch(e[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new T7(e[0].toString())}},h9=t=>{switch(t){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new L7(t)}},l9=t=>{const e=t.consume(1);switch(e[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new N7(e[0].toString())}},d9=t=>t?ba(!0)+zd(t):ba(!1),p9=t=>{const e=parseInt(String(t),10),r=[];for(let n=0;n<4;n++){const a=(4-(n+1))*8;r.push((e&255<<a)>>a)}return Fe.from(r).toString("hex")},g9=t=>{const e=t.consume(4);let r=0;for(let n=0;n<e.length;n++)r=r|e[n]<<(e.length-(n+1))*8;return r},b9=t=>{const e=parseInt(String(t),10),r=[];for(let n=0;n<2;n++){const a=(2-(n+1))*8;r.push((e&255<<a)>>a)}return Fe.from(r).toString("hex")},m9=t=>{const e=t.consume(2);let r=0;for(let n=0;n<e.length;n++)r=r|e[n]<<(e.length-(n+1))*8;return r},Vd=t=>t.consume(1)[0]===255,y9=t=>{if(Vd(t))return qf(t)},zd=t=>{try{return I0(t)}catch(e){throw new td(t,e instanceof Ce?e.result:void 0)}},v9=t=>{if(!t)return ba(!1);if(t.length===0)return ba(!0)+It(0);const e=t.reduce((r,n)=>r+zd(n),"");return ba(!0)+It(e.length/2)+e},w9=t=>{try{return k4(t)}catch(e){throw new Hs(t,e instanceof Ce?e.result:void 0)}},_9=t=>Ss(t),E9=t=>{try{return Sa(re.SmartRollupHash)(t)}catch(e){throw e instanceof Ce?new k7(t):e}},S9=t=>Ss(t),x9=t=>{switch(t.consume(1)[0]){case 0:return Zt(re.Ed25519PublicKey)(t);case 1:return Zt(re.Secp256k1PublicKey)(t);case 2:return Zt(re.P256PublicKey)(t);case 3:return Zt(re.BLS12_381PublicKey)(t);default:throw new Hs(void 0,Se.NO_PREFIX_MATCHED)}},A9=t=>{try{return Sa(re.SmartRollupCommitmentHash)(t)}catch(e){throw e instanceof Ce?new C7(t):e}},R9=t=>{switch(t.consume(1)[0]){case 0:return qf(t);case 1:{const r=Zt(re.ContractHash)(t);return t.consume(1),r}default:throw new st(t.toString(),": Unable to decode.")}},I9=t=>
35Zt(re.SmartRollupHash)(t),B9=t=>{if(t.consume(1)[0]===1){const r=Zt(re.ContractHash)(t);return t.consume(1),r}throw new ha(t.toString(),Se.NO_PREFIX_MATCHED)},T9=t=>Zt(re.SmartRollupCommitmentHash)(t),Wd=t=>{const e=[];let r=new tt(t,10);if(r.isNaN())throw new TypeError(`Invalid zarith number ${t}`);for(;;)if(r.lt(128)){r.lt(16)&&e.push("0"),e.push(r.toString(16));break}else{let n=r.mod(128);r=r.minus(n),r=r.dividedBy(128),n=n.plus(128),e.push(n.toString(16))}return e.join("")},Zd=t=>{let e=0;for(;e<t.length()&&(t.get(e)&128)!==0;)e+=1;let r=new tt(0);for(let n=e;n>=0;n-=1){const a=t.get(n)&127;r=r.multipliedBy(128),r=r.plus(a)}return t.consume(e+1),new tt(r).toString()},P9=t=>{const e=It(t.consume(1)[0],2);if(e in ff)return ff[e];{const r=Mr(t,1),n=Fe.from(r).toString("utf8");if(n.length>jd)throw new r6(n);return n}},M9=t=>{if(t.consume(1)[0]!==0){const r=P9(t),n=Mr(t),a=Ei(new Vr(n));return{entrypoint:r,value:a}}},O9=t=>{if(t in vv)return`${vv[t]}`;if(t.length>jd)throw new r6(t);return`ff${_i({string:t}).slice(8)}`},L9=t=>{if(!t||t.entrypoint==="default"&&"prim"in t.value&&t.value.prim==="Unit")return"00";const e=O9(t.entrypoint),r=_i(t.value),n=It(r.length/2);return`ff${e}${n}${r}`},N9=t=>{const e=_i(t);return`${It(e.length/2)}${e}`},k9=t=>{const e=Mr(t);return Ei(new Vr(e))},C9=Sa(re.ValueHash),U9=Zt(re.ValueHash),D9=t=>`${_i({string:t}).slice(2)}`,H9=t=>{const e=Mr(t);return Fe.from(e).toString("utf8")},F9=t=>t?`ff${Wd(t)}`:"00",q9=t=>{const e=t.consume(1);if(Fe.from(e).toString("hex")!=="00")return Zd(t)},$9=t=>t?`ff${Wd(t)}`:"00",K9=t=>{const e=t.consume(1);if(Fe.from(e).toString("hex")!=="00")return Zd(t)},G9=t=>{try{const[e,r]=At(t,K2);if(r===re.BLS12_381Signature)return s6(_r(e));throw new sr("we only support encoding of BLSIG signatures from protocol Seoul")}catch(e){throw e instanceof Ce?new l_(t,e.result):e}},j9=t=>{if(t.consume(4),t.length().toString()==="96")return Zt(re.BLS12_381Signature)(t);throw new sr("we only support decoding of BLSIG signatures")},V9=t=>t?ba(!0)+G9(t):ba(!1),z9=t=>{if(Vd(t))return j9(t)},s6=(t,e=8)=>`${It(t.length/2,e)}${t}`,W9=t=>{const e=Mr(t);return Fe.from(e).toString("hex")},Z9=t=>{const e=t.reduce((r,n)=>r+`${It(n.length/2)}${n}`,"");return`${It(e.length/2)}${e}`},Y9=t=>{const e=Mr(t);return G7(new Vr(e)).map(n=>Fe.from(n).toString("hex"))},X9=t=>{try{return Sa(re.SlotHeader)(t)}catch(e){throw e instanceof Ce?new U7(t):e}},J9=t=>Zt(re.SlotHeader)(t),Q9=t=>It(t.slot_index,2)+X9(t.commitment)+t.commitment_proof,eR=t=>{const e=t.consume(1);return{slot_index:Number(e[0].toString(10)),commitment:J9(t),commitment_proof:$0(t.consume(96))}},o6={branch:ie.BRANCH,contents:[ie.OPERATION]},Yd={pkh:ie.TZ1,secret:ie.SECRET},Xd={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,public_key:ie.PUBLIC_KEY,proof:ie.SIGNATURE_PROOF},Jd={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,delegate:ie.DELEGATE},Qd={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,amount:ie.ZARITH,destination:ie.ADDRESS,parameters:ie.PARAMETERS},ep={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,balance:ie.ZARITH,delegate:ie.DELEGATE,script:ie.SCRIPT},tp={source:ie.PKH,period:ie.INT32,proposal:ie.PROPOSAL,ballot:ie.BALLOT_STATEMENT},rp={slot:ie.INT16,level:ie.INT32,round:ie.INT32,block_payload_hash:ie.BLOCK_PAYLOAD_HASH},np={slot:ie.INT16,level:ie.INT32,round:ie.INT32,block_payload_hash:ie.BLOCK_PAYLOAD_HASH,dal_attestation:ie.ZARITH},ip={level:ie.INT32,nonce:ie.RAW},ap={source:ie.PKH,period:ie.INT32,proposals:ie.PROPOSAL_ARR},sp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,value:ie.VALUE},op={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,ticket_contents:ie.VALUE,ticket_ty:ie.VALUE,ticket_ticketer:ie.ADDRESS,ticket_amount:ie.ZARITH,destination:ie.ADDRESS,entrypoint:ie.ENTRYPOINT},fp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,amount:ie.ZARITH,destination:ie.SMART_CONTRACT_ADDRESS},cp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,pk:ie.PUBLIC_KEY,proof:ie.SIGNATURE_PROOF},up={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,pk:ie.PUBLIC_KEY,proof:ie.SIGNATURE_PROOF},hp={consensus_key:ie.PKH,delegate:ie.PKH,destination:ie.PKH},lp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,limit:ie.DEPOSITS_LIMIT},dp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,pvm_kind:ie.PVM_KIND,
35kernel:ie.PADDED_BYTES,parameters_ty:ie.VALUE,whitelist:ie.PKH_ARR},pp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,message:ie.SMART_ROLLUP_MESSAGE},gp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,rollup:ie.SMART_ROLLUP_ADDRESS,cemented_commitment:ie.SMART_ROLLUP_COMMITMENT_HASH,output_proof:ie.PADDED_BYTES},bp={source:ie.PKH,fee:ie.ZARITH,counter:ie.ZARITH,gas_limit:ie.ZARITH,storage_limit:ie.ZARITH,slot_header:ie.SLOT_HEADER},mp={arbitrary:ie.PADDED_BYTES},tR=t=>e=>{if(!(e.kind in t)||!(e.kind in yv))throw new wi(e.kind);return yv[e.kind]+t[e.kind](e)},rR=t=>e=>{const r=e.consume(1),n=K0[r[0]];if(n===void 0)throw new O7(r[0].toString());const a=t[n](e);if(typeof a!="object")throw new n6("Invalid operation, cannot be decoded.");return{kind:n,...a}},kt=t=>e=>r=>Object.keys(e).reduce((a,i)=>{const s=e[i];if(r&&Array.isArray(s)){const o=t[s[0]],c=r[i];if(!Array.isArray(c))throw new M7(`Invalid operation value "${JSON.stringify(c)}" of key "${i}, expected value to be Array.`);return a+c.reduce((u,f)=>u+o(f),"")}else{const o=t[s];return a+o(r[i])}},""),Ct=t=>e=>r=>Object.keys(e).reduce((a,i)=>{const s=e[i];if(Array.isArray(s)){const o=t[s[0]],c=[],u=r.length();for(;r.length()>0;)if(c.push(o(r)),u===r.length())throw new n6("Unable to decode value");return{...a,[i]:c}}else{const o=t[s],c=o(r);return typeof c<"u"?{...a,[i]:c}:{...a}}},{}),Ge={[ie.SECRET]:t=>$0(t.consume(20)),[ie.RAW]:t=>$0(t.consume(32)),[ie.TZ1]:r9,[ie.BRANCH]:n9,[ie.ZARITH]:Zd,[ie.PUBLIC_KEY]:x9,[ie.PKH]:qf,[ie.PKH_ARR]:i9,[ie.DELEGATE]:y9,[ie.INT32]:g9,[ie.SCRIPT]:K7,[ie.BALLOT_STATEMENT]:u9,[ie.PROPOSAL]:a6,[ie.PROPOSAL_ARR]:o9,[ie.PARAMETERS]:M9,[ie.ADDRESS]:R9,[ie.SMART_ROLLUP_ADDRESS]:I9,[ie.SMART_CONTRACT_ADDRESS]:B9,[ie.SMART_ROLLUP_COMMITMENT_HASH]:T9,[ie.VALUE]:k9,[ie.INT16]:m9,[ie.BLOCK_PAYLOAD_HASH]:U9,[ie.ENTRYPOINT]:H9,[ie.BURN_LIMIT]:q9,[ie.DEPOSITS_LIMIT]:K9,[ie.SIGNATURE_PROOF]:z9,[ie.PVM_KIND]:l9,[ie.PADDED_BYTES]:W9,[ie.SMART_ROLLUP_MESSAGE]:Y9,[ie.SLOT_HEADER]:eR};Ge[ie.OPERATION]=rR(Ge);Ge[ie.OP_ACTIVATE_ACCOUNT]=t=>Ct(Ge)(Yd)(t);Ge[ie.OP_FAILING_NOOP]=t=>Ct(Ge)(mp)(t);Ge[ie.OP_DELEGATION]=t=>Ct(Ge)(Jd)(t);Ge[ie.OP_TRANSACTION]=t=>Ct(Ge)(Qd)(t);Ge[ie.OP_ORIGINATION]=t=>Ct(Ge)(ep)(t);Ge[ie.OP_BALLOT]=t=>Ct(Ge)(tp)(t);Ge[ie.OP_ATTESTATION]=t=>Ct(Ge)(rp)(t);Ge[ie.OP_ATTESTATION_WITH_DAL]=t=>Ct(Ge)(np)(t);Ge[ie.OP_SEED_NONCE_REVELATION]=t=>Ct(Ge)(ip)(t);Ge[ie.OP_PROPOSALS]=t=>Ct(Ge)(ap)(t);Ge[ie.OP_REVEAL]=t=>Ct(Ge)(Xd)(t);Ge[ie.OP_REGISTER_GLOBAL_CONSTANT]=t=>Ct(Ge)(sp)(t);Ge[ie.OP_TRANSFER_TICKET]=t=>Ct(Ge)(op)(t);Ge[ie.OP_INCREASE_PAID_STORAGE]=t=>Ct(Ge)(fp)(t);Ge[ie.OP_UPDATE_CONSENSUS_KEY]=t=>Ct(Ge)(cp)(t);Ge[ie.OP_UPDATE_COMPANION_KEY]=t=>Ct(Ge)(up)(t);Ge[ie.OP_DRAIN_DELEGATE]=t=>Ct(Ge)(hp)(t);Ge[ie.OP_SMART_ROLLUP_ORIGINATE]=t=>Ct(Ge)(dp)(t);Ge[ie.OP_SMART_ROLLUP_ADD_MESSAGES]=t=>Ct(Ge)(pp)(t);Ge[ie.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=t=>Ct(Ge)(gp)(t);Ge[ie.OP_DAL_PUBLISH_COMMITMENT]=t=>Ct(Ge)(bp)(t);Ge[ie.MANAGER]=Ct(Ge)(o6);Ge[ie.OP_SET_DEPOSITS_LIMIT]=t=>Ct(Ge)(lp)(t);const je={[ie.SECRET]:t=>t,[ie.RAW]:t=>t,[ie.TZ1]:s9,[ie.BRANCH]:a9,[ie.ZARITH]:Wd,[ie.PUBLIC_KEY]:w9,[ie.PKH]:zd,[ie.PKH_ARR]:v9,[ie.DELEGATE]:d9,[ie.SCRIPT]:$7,[ie.BALLOT_STATEMENT]:c9,[ie.PROPOSAL]:i6,[ie.PROPOSAL_ARR]:f9,[ie.INT32]:p9,[ie.PARAMETERS]:L9,[ie.ADDRESS]:_9,[ie.SMART_ROLLUP_ADDRESS]:E9,[ie.SMART_CONTRACT_ADDRESS]:S9,[ie.SMART_ROLLUP_COMMITMENT_HASH]:A9,[ie.VALUE]:N9,[ie.INT16]:b9,[ie.BLOCK_PAYLOAD_HASH]:C9,[ie.ENTRYPOINT]:D9,[ie.BURN_LIMIT]:F9,[ie.DEPOSITS_LIMIT]:$9,[ie.SIGNATURE_PROOF]:V9,[ie.PVM_KIND]:h9,[ie.PADDED_BYTES]:s6,[ie.SMART_ROLLUP_MESSAGE]:Z9,[ie.SLOT_HEADER]:Q9};je[ie.OPERATION]=tR(je);je[ie.OP_ACTIVATE_ACCOUNT]=t=>kt(je)(Yd)(t);je[ie.OP_DELEGATION]=t=>kt(je)(Jd)(t);je[ie.OP_TRANSACTION]=t=>kt(je)(Qd)(t);je[ie.OP_ORIGINATION]=t=>kt(je)(ep)(t);je[ie.OP_BALLOT]=t=>kt(je)(tp)(t);je[ie.OP_ATTESTATION]=t=>kt(je)(rp)(t);je[ie.OP_ATTESTATION_WITH_DAL]=t=>kt(je)(np)(t);je[ie.OP_SEED_NONCE_REVELATION]=t=>kt(je)(ip)(t);je[ie.OP_PROPOSALS]=t=>kt(je)(ap)(t);je[ie.OP_REVEAL]=t=>kt(je)(Xd)(t);je[ie.OP_REGISTER_GLOBAL_CONSTANT]=t=>kt(je)(sp)(t);je[ie.OP_TRANSFER_TICKET]=t=>kt(je)(op)(t);je[ie.OP_INCREASE_PAID_STORAGE]=t=>kt(je)(fp)(t);je[ie.OP_UPDATE_CONSENSUS_KEY]=t=>kt(je)(cp)(t);je[ie.OP_UPDATE_COMPANION_KEY]=t=>kt(je)(up)(t);je[ie.OP_DRAIN_DELEGATE]=t=>kt(je)(hp)(t);je[ie.OP_SMART_ROLLUP_ORIGINATE]=t=>kt(je)(dp)(t);je[ie.OP_SMART_ROLLUP_ADD_MESSAGES]=t=>kt(je)(pp)(t);je[ie.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=t=>kt(je)(gp)(t);je[ie.OP_DAL_PUBLISH_COMMITMENT]=t=>kt(je)(bp)(t);je[ie.MANAGER]=kt(je)(o6);je[ie.OP_SET_DEPOSITS_LIMIT]=t=>kt(je)(lp)(t);je[ie.OP_FAILING_NOOP]=t=>kt(je)(mp)(t);const f6={activate_account:Yd,reveal:Xd,delegation:Jd,transaction:Qd,origination:ep,ballot:tp,attestation:rp,attestation_with_dal:np,seed_nonce_revelation:ip,proposals:ap,register_global_constant:sp,transfer_ticket:op,increase_paid_storage:fp,update_consensus_key:cp,update_companion_key:up,drain_delegate:hp,set_deposits_limit:lp,smart_rollup_originate:dp,smart_rollup_add_messages:pp,smart_rollup_execute_outbox_message:gp,dal_publish_commitment:bp,failing_noop:mp},nR=(t,e)=>e.filter(r=>!t.includes(r)),iR=(t,e)=>t.filter(r=>r!==e),aR=t=>Object.keys(f6).includes(t),sR=t=>{const e=t.kind,r=Object.keys(t),n=iR(r,"kind"),a=Object.keys(f6[e]);return nR(n,a)};var G0;(function(t){t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdo2Zk="PtE
35do2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",t.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",t.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",t.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",t.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",t.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",t.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",t.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",t.PtParisBx="PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ",t.PsParisCZ="PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi",t.PsQuebecn="PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg",t.PsRiotuma="PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7",t.PtSeouLou="PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh",t.PtTALLiNt="PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgFZKGtDdAXu",t.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(G0||(G0={}));typeof globalThis.TextEncoder>"u"&&(globalThis.TextEncoder=TextEncoder);typeof globalThis.TextDecoder>"u"&&(globalThis.TextDecoder=TextDecoder);const oR=G0.PtTALLiNt;function fR(t,e){return{encoder:je[t],decoder:r=>{const n=Vr.fromHexString(r);return Ge[t](n)}}}class c6{constructor(e=oR){this.protocolHash=e,this.codec=fR(ie.MANAGER,this.protocolHash)}forge(e){const r=V2(e.branch);if(r!==Se.VALID)throw new c_(e.branch,r);for(const a of e.contents){if(!aR(a.kind))throw new wi(a.kind);const i=sR(a);if(i.length===1){if(a.kind==="delegation"&&i[0]==="delegate")continue;if(a.kind==="origination"&&i[0]==="delegate")continue;if(a.kind==="transaction"&&i[0]==="parameters")continue;if(a.kind==="set_deposits_limit"&&i[0]==="limit")continue;if(a.kind==="smart_rollup_originate"&&i[0]==="whitelist")continue;if(a.kind==="update_consensus_key"&&i[0]==="proof")continue;if(a.kind==="update_companion_key"&&i[0]==="proof")continue;if(a.kind==="reveal"&&i[0]==="proof")continue;throw new wv(a,`missing properties "${i.join(", ")}"`)}else if(i.length>1)throw new wv(a,`missing properties "${i.join(", ")}"`)}const n=this.codec.encoder(e).toLowerCase();return Promise.resolve(n)}parse(e){return Promise.resolve(this.codec.decoder(e))}}new c6;var u6={};function cR(t,e){const r=JSON.parse(t.body);if(r[0]&&r[0].kind&&r[0].msg){const n=JSON.stringify({kind:r[0].kind,id:r[0].id,msg:r[0].msg.replace(e,"")});return new qn(`Http error response: (${t.status}) ${n}`,t.status,t.statusText,n,t.url)}else return t}class yp{constructor(e){this.context=e}async inject(e){let r;try{r=await this.context.rpc.injectOperation(e)}catch(n){const a=". You may want to use --replace to provide adequate fee and replace it";throw n instanceof qn&&n.message.includes(a)?cR(n,a):n}return r}}class To extends ed{constructor(){super(),this.name="UnconfiguredSignerError",this.message="No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance."}}class j0{async publicKey(){throw new To}async publicKeyHash(){throw new To}async secretKey(){throw new To}async sign(e,r){throw new To}}function h6(t){return new Ht(e=>(t.on("data",r=>{e.next(r)}),t.on("error",r=>{e.error(r)}),t.on("close",()=>{e.complete()}),()=>{t.close()}))}const Zr=(t,e)=>({...t,kind:e}),cf=(t,e)=>{if(Array.isArray(t)){const r=t.find(n=>n.kind===e);if(r&&l6(r,e))return r}},l6=(t,e)=>t.kind===e,uR=[fe.TRANSACTION,fe.DELEGATION,fe.ORIGINATION,fe.REVEAL,fe.REGISTER_GLOBAL_CONSTANT,fe.INCREASE_PAID_STORAGE,fe.TRANSFER_TICKET,fe.UPDATE_CONSENSUS_KEY,fe.UPDATE_COMPANION_KEY,fe.SMART_ROLLUP_ADD_MESSAGES,fe.SMART_ROLLUP_ORIGINATE,fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE],d6=t=>t.kind===fe.TRANSACTION&&t.destination?.startsWith("KT1")?!0:["origination","register_global_constant","transfer_ticket","update_consensus_key","update_companion_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(t.kind)!==-1,Ua=t=>uR.includes(t.kind),vp=t=>["transaction","delegation","origination","register_global_constant","increase_paid_storage","transfer_ticket","update_consensus_key","update_companion_key","smart_rollup_add_messages","smart_rollup_originate","smart_rollup_execute_outbox_message"].indexOf(t.kind)!==-1,$f=t=>"metadata"in t,xa=t=>$f(t)&&"operation_result"in t.metadata,p6=t=>$f(t)&&"internal_operation_results"in t.metadata,Po={TZ1:171,TZ2:157,TZ3:447,TZ4:3252},Mo={TZ1:278,TZ2:277,TZ3:306,TZ4:736},V0=0,g6=250;var wt;(function(t){t.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",t.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",t.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",t.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",t.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",t.PtEdo2Zk="PtE
35do2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",t.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",t.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",t.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",t.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",t.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",t.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",t.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",t.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",t.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",t.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",t.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",t.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",t.PtParisBx="PtParisBxoLz5gzMmn3d9WBQNoPSZakgnkMC2VNuQ3KXfUtUQeZ",t.PsParisCZ="PsParisCZo7KAh1Z1smVd9ZMZ1HHn5gkzbM94V3PLCpknFWhUAi",t.PsQuebecn="PsQuebecnLByd3JwTiGadoG4nGWi3HYiLXUjkibeFV8dCFeVMUg",t.PsRiotuma="PsRiotumaAMotcRoDWW1bysEhQy2n1M5fy8JgRp8jjRfHGmfeA7",t.PtSeouLou="PtSeouLouXkxhg39oWzjxDWaCydNfR3RxCUrNe4Q9Ro8BTehcbh",t.PtTALLiNt="PtTALLiNtPec7mE7yY4m3k26J8Qukef3E3ehzhfXgFZKGtDdAXu",t.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(wt||(wt={}));wt.Pt24m4xi,wt.PsBABY5H,wt.PsBabyM1,wt.PsCARTHA,wt.PsDELPH1,wt.PtEdo2Zk,wt.PsFLorena,wt.PtGRANADs,wt.PtHangz2,wt.PsiThaCa,wt.Psithaca2,
35wt.PtJakart2,wt.PtKathman,wt.PtLimaPtL,wt.PtMumbai2,wt.PtNairobi,wt.ProxfordY,wt.PtParisBx,wt.PsParisCZ,wt.PsQuebecn,wt.PsRiotuma,wt.PtSeouLou,wt.PtTALLiNt,wt.ProtoALpha;var z0;(function(t){t.MAINNET="NetXdQprcVkpaWU",t.GHOSTNET="NetXnHfVqm9iesp",t.SHADOWNET="NetXsqzbfFenSTS",t.CARTHAGENET="NetXjD3HPJJjmcd",t.DELPHINET="NetXm8tYqnMWky1",t.EDONET="NetXSgo1ZT2DRUG",t.FLORENCENET="NetXxkAx4woPLyu",t.GRANADANET="NetXz969SFaFn8k",t.HANGZHOUNET="NetXZSsxBpMQeAT",t.ITHACANET="NetXbhmtAbMukLc",t.JAKARTANET2="NetXLH1uAxK7CCh",t.KATHMANDUNET="NetXazhm4yetmff",t.LIMANET="NetXizpkH94bocH",t.MUMBAINET="NetXQw6nWSnrJ5t",t.MUMBAINET2="NetXgbcrNtXD2yA",t.NAIROBINET="NetXyuzvDo2Ugzb",t.OXFORDNET2="NetXxWsskGahzQB",t.PARISBNET="NetXo8SqH1c38SS",t.PARISCNET="NetXXWAHLEvre9b",t.QUEBECNET="NetXuTeGinLEqxp",t.RIONET="NetXPdgaoabtBth",t.SEOULNET="NetXd56aBs1aeW3",t.TALLINNNET="NetXe8DbhW9A1eS"})(z0||(z0={}));const Da=t=>Math.round(hR(t)*37/10),hR=t=>{switch(t.substring(0,3)){case"tz1":return Po.TZ1;case"tz2":return Po.TZ2;case"tz3":return Po.TZ3;case"tz4":return Po.TZ4;default:throw new Error(`Cannot estimate reveal gas limit for ${t}`)}},W0=t=>Math.round(b6(t)*12/10),b6=t=>{switch(t.substring(0,3)){case"tz1":return Mo.TZ1;case"tz2":return Mo.TZ2;case"tz3":return Mo.TZ3;case"tz4":return Mo.TZ4*1.7;default:throw new Error(`Cannot estimate reveal fee for ${t}`)}},lR=t=>"with"in t;class wp extends df{constructor(e,r,n){super(),this.errors=e,this.errorDetails=r,this.operationsWithResults=n,this.name="TezosOperationError",this.lastError=e[e.length-1],this.message=`(${this.kind}) ${this.id}`,lR(this.lastError)&&(this.lastError.with.string?this.message=this.lastError.with.string:this.lastError.with.int?this.message=this.lastError.with.int:this.message=JSON.stringify(this.lastError.with))}get id(){return this.lastError.id}get kind(){return this.lastError.kind}}class m6 extends Error{constructor(e){super(),this.result=e,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}const an=t=>{const e=Array.isArray(t)?t:[t],r=[];for(let n=0;n<e.length;n++)for(let a=0;a<e[n].contents.length;a++){const i=e[n].contents[a];xa(i)&&"fee"in i&&(r.push({fee:i.fee,...i.metadata.operation_result}),Array.isArray(i.metadata.internal_operation_results)&&i.metadata.internal_operation_results.forEach(s=>r.push(s.result)))}return r},es=(t,e="failed")=>{const r=Array.isArray(t)?t:[t];let n=[];for(let a=0;a<r.length;a++)for(let i=0;i<r[a].contents.length;i++){const s=r[a].contents[i];if($f(s)&&(xa(s)&&s.metadata.operation_result.status===e&&(n=n.concat(s.metadata.operation_result.errors||[])),p6(s)&&Array.isArray(s.metadata.internal_operation_results)))for(const o of s.metadata.internal_operation_results)"result"in o&&o.result.status===e&&(n=n.concat(o.result.errors||[]))}return n};class u0 extends pt{constructor(e){super(),this.message=e,this.name="OriginationOperationError"}}class Fo extends Ce{constructor(e){super(),this.message=e,this.name="InvalidEstimateValueError"}}const gn=tt,dR=(t,{ALLOCATION_BURN:e,ORIGINATION_BURN:r}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{gn.config({DECIMAL_PLACES:0,ROUNDING_MODE:gn.ROUND_UP});const n=an({contents:t});let a=new gn(0),i=new gn(0),s=new gn(0),o=new gn(0),c=new gn(0),u=new gn(0);return n.forEach(f=>{s=s.plus(f.fee||0),o=o.plus(Array.isArray(f.originated_contracts)?f.originated_contracts.length*r:0),c=c.plus("allocated_destination_contract"in f?e:0),a=a.plus(f.consumed_milligas||0),u=u.plus("paid_storage_size_diff"in f&&Number(f.paid_storage_size_diff)||0)}),i=i.plus(c).plus(o).plus(u),{totalFee:s,totalMilliGas:a,totalGas:a.dividedBy(1e3),totalStorage:i,totalAllocationBurn:c,totalOriginationBurn:o,totalPaidStorageDiff:u,totalStorageBurn:new gn(i.multipliedBy(g6))}};class y6 extends Ce{constructor(e){super(),this.invalidConfirmations=e,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${e} expecting at least 1`}}class v6 extends Ds{constructor(e){super(),this.message=e,this.name="ConfirmationTimeoutError"}}class Oo extends df{constructor(e,r){super(),this.message=e,this.cause=r,this.name="RPCResponseError"}}class pR extends ed{constructor(){super(),this.name="ConfirmationUndefinedError",this.message="Default confirmation count can not be undefined"}}class Yt extends Ds{constructor(e){super(),this.message=e,this.name="ObservableError"}}class Ev extends Yt{constructor(e){super(e),this.message=e,this.name="OriginationWalletOperationError"}}const gR=60,_p=typeof ke<"u"?u6:void 0,bR=/^(1|true)$/i.test(_p?.TAQUITO_OP_TRACE??""),mR=/^(1|true)$/i.test(_p?.TAQUITO_OP_TRACE_VERBOSE??""),h0=Number(_p?.TAQUITO_OP_TRACE_SLOW_MS??"60000"),yR=Number.isFinite(h0)&&h0>=0?h0:6e4,l0=t=>typeof t=="object"&&t!==null?t:void 0,vR=t=>Array.isArray(t)?t:[],Sv=t=>Array.isArray(t)?t.map(e=>{const r=l0(e)??{},n=l0(r.metadata),a=l0(n?.operation_result);return{kind:typeof r.kind=="string"?r.kind:"unknown",status:typeof a?.status=="string"?a.status:"unknown",errors:vR(a?.errors),consumed_milligas:typeof a?.consumed_milligas=="string"?a.consumed_milligas:void 0}}):[],wR=t=>t instanceof Error?`${t.name}: ${t.message}`:String(t),xv=t=>{bR&&console.log(`[taquito:wallet-op-trace] ${JSON.stringify(t)}`)};class Kn{async operationResults(){return this._operationResult.pipe(en()).toPromise()}async getInclusionBlock(){const e=await this._includedInBlock.pipe(en()).toPromise();if(!e)throw new Yt("Inclusion block is undefined");return e}async getOperationResultsIfIncluded(){if(this._included)return this.operationResults().catch(()=>{})}async receipt(){const e=await this.operationResults();if(!e)throw new Yt("Unable to get operation results");return dR(e)}constructor(e,r,n){if(this.opHash=e,this.context=r,this._newHead$=n,this._operationResult=new gi(1),this._includedInBlock=new gi(1),this._included=!1,this.newHead$=this._newHead$.pipe(bi(a=>{const i=this.lastHead?.header.level??a.header.level-1;return md(i+1,a.header.level-i-1).pipe(js(s=>this.context.readProvider.getBlock(s)),vw(a))}),ef(a=>this.lastHead=a),Ms({connector:()=>new gi(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!0})),this.confirmed$=this.newHead$.pipe(yi(a=>{for(const i of a.operations)for(const s of i)if(s.hash===this.opHash)return this._included=!0,this._includedInBlock.next(a),this._operationResult.next(s.contents),a}),L0(a=>typeof a<"u"),en(),Ms({connector:()=>new gi(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!0})),j2(this.opHash)!==Se.VALID)throw new Lv(this.opHash);this.confirmed$.pipe(en(),If(()=>Rf(void 0))).subscribe()}async getCurrentConfirmation(){return this._included?T1([this._includedInBlock,Ai(this.context.readProvider.getBlock("head"))]).pipe(yi(([e,r])=>r.header.level-e.header.level+1),en()).toPromise():0}async isInCurrentBranch(e="head"){if(!this._included)return!0;const r=await this.context.readProvider.getBlockLevel(e),n=await this.getInclusionBlock(),a=r-n.header.level;if(a<=0)return!0;const i=Math.min(n.header.level+a,n.header.level+gR);return new Set(await this.context.readProvider.getLiveBlocks(i)).has(n.hash)}confirmationObservable(e){if(typeof e<"u"&&e<1)throw new y6(e);const{defaultConfirmationCount:r}=this.context.config,n=e!==void 0?e:r;if(n===void 0)throw new pR;return T1([this._includedInBlock,this.newHead$]).pipe(yw(([,a],[,i])=>a.hash===i.hash),yi(([a,i])=>({block:i,expectedConfirmation:n,currentConfirmation:i.header.level-a.header.level+1,completed:i.header.level-a.header.level>=n-1,isInCurrentBranch:()=>this.isInCurrentBranch(i.hash)})),ZE(({completed:a})=>!a,!0))}async confirmation(e){const r=Date.now(),n=e??this.context.config.defaultConfirmationCount;
35try{const a=await this.confirmationObservable(e).toPromise(),i=await this.getOperationResultsIfIncluded(),s=Sv(i),o=s.filter(u=>u.status!=="applied").map(u=>u.status),c=Date.now()-r;return(mR||c>=yR||o.length>0)&&xv({stage:"confirmation-complete",opHash:this.opHash,elapsedMs:c,expectedConfirmation:n,currentConfirmation:a?.currentConfirmation,completed:a?.completed,statuses:s.map(u=>u.status),results:s}),a}catch(a){const i=await this.getOperationResultsIfIncluded();throw xv({stage:"confirmation-error",opHash:this.opHash,elapsedMs:Date.now()-r,expectedConfirmation:n,error:wR(a),results:Sv(i)}),a}}}const _R=[fe.REVEAL,fe.ORIGINATION,fe.TRANSACTION,fe.DELEGATION,fe.REGISTER_GLOBAL_CONSTANT,fe.INCREASE_PAID_STORAGE,fe.TRANSFER_TICKET];class ER extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r,this.getOriginatedContractAddresses=async()=>{const a=await this.operationResults();if(a){const i=a.filter(o=>o.kind==="origination");let s=[];for(const o of i)o.metadata.operation_result.originated_contracts&&(s=[...s,...o.metadata.operation_result.originated_contracts]);return s}else throw new Yt("Unable to fetch operation results")}}async revealOperation(){const e=await this.operationResults();if(e)return e.find(r=>r.kind===fe.REVEAL);throw new Yt("Unable to fetch operation results")}async status(){if(!this._included)return"pending";const e=await this.operationResults();if(e)return e.filter(r=>_R.indexOf(r.kind)!==-1).map(r=>xa(r)?r.metadata.operation_result.status:"unknown")[0]||"unknown";throw new Yt("Unable to fetch operation results")}}class w6 extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async revealOperation(){const e=await this.operationResults();if(e)return e.find(r=>r.kind===fe.REVEAL);throw new Yt("Unable to fetch operation result")}async delegationOperation(){const e=await this.operationResults();if(e)return e.find(r=>r.kind===fe.DELEGATION);throw new Yt("Unable to fetch operation result")}async status(){if(!this._included)return"pending";const e=await this.delegationOperation();return e?e.metadata.operation_result.status:"unknown"}}class SR extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async revealOperation(){const e=await this.operationResults();if(e)return e.find(r=>r.kind===fe.REVEAL);throw new Yt("Unable to fetch operation result")}async increasePaidStorageOperation(){const e=await this.operationResults();if(e)return e.find(r=>r.kind===fe.INCREASE_PAID_STORAGE);throw new Yt("Unable to fetch operation result")}async status(){if(!this._included)return"pending";const e=await this.increasePaidStorageOperation();return e?e.metadata.operation_result.status:"unknown"}}const _6=t=>V2(t)===Se.VALID;class E6 extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async originationOperation(){const e=await this.operationResults();if(e)return cf(e,fe.ORIGINATION);throw new Yt("Unable to fetch operation result")}async revealOperation(){const e=await this.operationResults();if(e)return cf(e,fe.REVEAL);throw new Yt("Unable to fetch operation result")}async status(){if(!this._included)return"pending";const e=await this.originationOperation();return e?e.metadata.operation_result.status:"unknown"}async contract(){const r=((await this.originationOperation())?.metadata.operation_result.originated_contracts||[])[0];if(!r)throw new Ev("No contract was originated in this operation");await this.confirmation();const n=await this.getInclusionBlock();if(!_6(n.hash))throw new Ev("Inclusion block hash is invalid");return this.context.wallet.at(r,void 0,n.hash)}}class S6 extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async revealOperation(){const e=await this.operationResults();if(!e)throw new Yt("operationResult returned undefined");return e.find(r=>r.kind===fe.REVEAL)}async transactionOperation(){const e=await this.operationResults();if(!e)throw new Yt("operationResult returned undefined");return e.find(r=>r.kind===fe.TRANSACTION)}async status(){if(!this._included)return"pending";const e=await this.transactionOperation();return e?e.metadata.operation_result.status:"unknown"}}class x6 extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async revealOperation(){const e=await this.operationResults();if(!e)throw new Yt("operationResult returned undefined");return e.find(r=>r.kind===fe.REVEAL)}async transferTicketOperation(){const e=await this.operationResults();if(!e)throw new Yt("operationResult returned undefined");return e.find(r=>r.kind===fe.TRANSFER_TICKET)}async status(){if(!this._included)return"pending";const e=await this.transferTicketOperation();return e?e.metadata.operation_result.status:"unknown"}}class A6 extends Kn{constructor(e,r,n){super(e,r,n),this.opHash=e,this.context=r}async revealOperation(){const e=await this.operationResults();if(!e)throw new Yt("operationResult returned undefined");return e.find(r=>r.kind===fe.REVEAL)}async registerGlobalConstantOperation(){const e=await this.operationResults();
35if(e)return cf(e,fe.REGISTER_GLOBAL_CONSTANT);throw new Yt("Unable to fetch operation result")}async status(){if(!this._included)return"pending";const e=await this.registerGlobalConstantOperation();return e?e.metadata.operation_result.status:"unknown"}async globalConstantHash(){return(await this.registerGlobalConstantOperation())?.metadata.operation_result.global_address}}function xR(t){return function(r){return new xf(null).pipe(bw({each:t,with:()=>dw(()=>new v6("Confirmation polling timed out"))}),Ps(()=>r))}}const AR=(t,e,r)=>t.pipe(xR(e.config.confirmationPollingTimeoutSecond*1e3),Ms({connector:()=>new gi(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!0}));class RR{constructor(e){this.context=e,this.sharedHeadObs=mw(()=>h6(this.context.stream.subscribeBlock("head")))}async createNewHeadObservable(){return AR(this.sharedHeadObs,this.context)}createPastBlockWalker(e,r=1){return Ai(this.context.readProvider.getBlock(e)).pipe(bi(n=>r===1?Rf(n):md(n.header.level,r-1).pipe(zE(n),js(async a=>this.context.readProvider.getBlock(typeof a=="number"?a:a.header.level)))))}async createHeadObservableFromConfig({blockIdentifier:e}){const r=[];return e&&r.push(this.createPastBlockWalker(e)),r.push(await this.createNewHeadObservable()),Qo(...r)}async createOperation(e,r={}){return new Kn(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createBatchOperation(e,r={}){return new ER(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createTransactionOperation(e,r={}){return new S6(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createTransferTicketOperation(e,r={}){return new x6(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createDelegationOperation(e,r={}){return new w6(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createOriginationOperation(e,r={}){return new E6(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createIncreasePaidStorageOperation(e,r={}){return new SR(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}async createRegisterGlobalConstantOperation(e,r={}){return new A6(e,this.context.clone(),await this.createHeadObservableFromConfig(r))}}const Ep=typeof ke<"u"?u6:void 0,IR=/^(1|true)$/i.test(Ep?.TAQUITO_OP_TRACE??""),BR=/^(1|true)$/i.test(Ep?.TAQUITO_OP_TRACE_VERBOSE??""),d0=Number(Ep?.TAQUITO_OP_TRACE_SLOW_MS??"60000"),TR=Number.isFinite(d0)&&d0>=0?d0:6e4,ys=t=>typeof t=="object"&&t!==null?t:void 0,Av=t=>Array.isArray(t)?t:[],Rv=t=>t.map(e=>{const r=ys(e)??{},n=ys(r.metadata),a=ys(n?.operation_result),i=n?.internal_operation_results,s=Array.isArray(i)?i.reduce((o,c)=>{const u=ys(c),f=ys(u?.result),l=f?.status;return typeof l!="string"||l==="applied"||o.push({kind:typeof u?.kind=="string"?u.kind:"unknown",status:l,errors:Av(f?.errors)}),o},[]):[];return{kind:typeof r.kind=="string"?r.kind:"unknown",status:typeof a?.status=="string"?a.status:"unknown",errors:Av(a?.errors),consumed_milligas:typeof a?.consumed_milligas=="string"?a.consumed_milligas:void 0,internalFailures:s}}),PR=t=>t instanceof Error?`${t.name}: ${t.message}`:String(t),Iv=t=>{IR&&console.log(`[taquito:op-trace] ${JSON.stringify(t)}`)};class Jt{get includedInBlock(){return this._foundAt}async getInclusionBlock(){const e=await this._includedInBlock.pipe(en()).toPromise();if(!e)throw new Error("Inclusion block is undefined");return e}constructor(e,r,n,a){if(this.hash=e,this.raw=r,this.results=n,this.context=a,this._pollingConfig$=new gi(1),this._includedInBlock=new gi(1),this.currentHead$=this._pollingConfig$.pipe(bi(i=>new xf(i).pipe(bw({each:i.timeout*1e3,with:()=>dw(()=>new v6("Confirmation polling timed out"))}))),bi(()=>mw(()=>h6(this.context.stream.subscribeBlock("head"))).pipe(bi(i=>{const s=this.lastHead?.header.level??i.header.level-1;return md(s+1,i.header.level-s-1).pipe(js(o=>this.context.readProvider.getBlock(o)),vw(i))}),ef(i=>this.lastHead=i))),M1({refCount:!0})),this.confirmed$=this.currentHead$.pipe(yi(i=>{for(let s=3;s>=0;s--)for(const o of i.operations[s])if(o.hash===this.hash)return this._foundAt=i.header.level,this._includedInBlock.next(i),this._foundAt;if(i.header.level-this._foundAt>=0)return this._foundAt}),L0(i=>i!==void 0),en(),M1()),this._foundAt=Number.POSITIVE_INFINITY,j2(this.hash)!==Se.VALID)throw new Lv(this.hash);this.confirmed$.pipe(en(),If(()=>Rf(bd))).subscribe()}get revealOperation(){return Array.isArray(this.results)&&this.results.find(e=>e.kind==="reveal")}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map(e=>xa(e)?e.metadata.operation_result.status:"unknown")[0]||"unknown"}async confirmation(e,r){if(typeof e<"u"&&e<1)throw new y6(e);const{defaultConfirmationCount:n,confirmationPollingTimeoutSecond:a}=this.context.config,i=r||a,s=Date.now();this._pollingConfig$.next({timeout:i});const o=e!==void 0?e:n;return new Promise((c,u)=>{this.confirmed$.pipe(bi(()=>this.currentHead$),L0(f=>f.header.level-this._foundAt>=o-1),en()).subscribe({error:f=>{Iv({stage:"confirmation-error",hash:this.hash,elapsedMs:Date.now()-s,expectedConfirmations:o,timeoutSec:i,includedInBlock:Number.isFinite(this._foundAt)?this._foundAt:null,status:this.status,error:PR(f),results:Rv(this.results)}),u(f)},complete:()=>{const f=Date.now()-s;(BR||f>=TR||this.status!=="applied")&&Iv({stage:"confirmation-complete",hash:this.hash,elapsedMs:f,expectedConfirmations:o,timeoutSec:i,includedInBlock:Number.isFinite(this._foundAt)?this._foundAt:null,status:this.status,results:Rv(this.results)}),c(this._foundAt+(o-1))}})})}}class R6 extends Ce{constructor(e,r,n){super(),this.smartContractMethodName=e,this.sigs=r,this.invalidParams=n,this.name="InvalidParameterError",this.message=`${e} Received ${n.length} arguments while expecting one of the following signatures (${JSON.stringify(r)})`}}class I6 extends Ce{constructor(e){super(),this.source=e,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${e}. Please use the smart contract abstraction to set your delegate.`}}class ks extends Ce{constructor(e,r){super(),this.message=e,this.data=r,this.name="InvalidCodeParameter"}}class Sp extends Ce{constructor(e,r){super(),this.message=e,this.data=r,this.name="InvalidInitParameter"}}class B6 extends df{constructor(e,r,n,a){super(),this.message=e,this.viewName=r,this.failWith=n,this.cause=a,this.name="ViewSimulationError"}}const T6=t=>{if(MR(t.body)){const e=JSON.parse(t.body);if(Array.isArray(e)&&"with"in e[e.length-1])return e[e.length-1].with}},MR=t=>{try{JSON.parse(t)}catch{return!1}return!0};class Z0 extends Ce{constructor(e){super(),this.info=e,this.name="InvalidViewSimulationContext",this.message=`${e} Please configure the context of the view execution in the execute
35View method.`}}class P6 extends df{constructor(e){super(),this.message=e,this.name="RevealOperationError"}}class M6 extends Ce{constructor(e){super(),this.message=e,this.name}}class O6 extends Ce{constructor(e){super(),this.message=e,this.name="InvalidBalanceError"}}const L6=async({pkh:t,secret:e})=>({kind:fe.ACTIVATION,pkh:t,secret:e}),Kf=async({code:t,init:e,balance:r="0",delegate:n,storage:a,fee:i,gasLimit:s,storageLimit:o,mutez:c=!1})=>{if(a!==void 0&&e!==void 0)throw new M6("Storage and Init cannot be set a the same time. Please either use storage or init but not both.");if(!Array.isArray(t))throw new ks("Wrong code parameter type, expected an array",t);let u;if(a!==void 0){const p=t.find(v=>"prim"in v&&v.prim==="storage");if(p?.args===void 0)throw new ks("The storage section is missing from the script",t);u=new jr(p.args[0]).Encode(a)}else if(e!==void 0&&typeof e=="object")u=e;else throw new Sp("Wrong init parameter type, expected JSON Michelson",e);const f={code:t,storage:u};if(isNaN(Number(r)))throw new O6(`Invalid Balance "${r}", cannot be converted to a number`);const l={kind:fe.ORIGINATION,fee:i,gas_limit:s,storage_limit:o,balance:c?r.toString():ld("tz","mutez",r).toString(),script:f};return n&&(l.delegate=n),l},ua=async({to:t,amount:e,parameter:r,fee:n,gasLimit:a,storageLimit:i,mutez:s=!1})=>({kind:fe.TRANSACTION,fee:n,gas_limit:a,storage_limit:i,amount:s?e.toString():ld("tz","mutez",e).toString(),destination:t,parameters:r}),Gf=async({delegate:t,source:e,fee:r,gasLimit:n,storageLimit:a})=>({kind:fe.DELEGATION,source:e,fee:r,gas_limit:n,storage_limit:a,delegate:t}),N6=async({fee:t,gasLimit:e,storageLimit:r},n)=>({kind:fe.DELEGATION,fee:t,gas_limit:e,storage_limit:r,delegate:n}),qo=async({fee:t,gasLimit:e,storageLimit:r,proof:n},a,i)=>({kind:fe.REVEAL,fee:t,public_key:i,source:a,gas_limit:e??Da(a),storage_limit:r,proof:n}),jf=async({value:t,source:e,fee:r,gasLimit:n,storageLimit:a})=>
35({kind:fe.REGISTER_GLOBAL_CONSTANT,value:t,fee:r,gas_limit:n,storage_limit:a,source:e}),Vf=async({ticketContents:t,ticketTy:e,ticketTicketer:r,ticketAmount:n,destination:a,entrypoint:i,source:s,fee:o,gasLimit:c,storageLimit:u})=>({kind:fe.TRANSFER_TICKET,fee:o,gas_limit:c,storage_limit:u,source:s,ticket_contents:t,ticket_ty:e,ticket_ticketer:r,ticket_amount:n,destination:a,entrypoint:i}),zf=async({source:t,fee:e,gasLimit:r,storageLimit:n,amount:a,destination:i})=>({kind:fe.INCREASE_PAID_STORAGE,source:t,fee:e,gas_limit:r,storage_limit:n,amount:a,destination:i}),k6=async({consensus_key:t,delegate:e,destination:r})=>({kind:fe.DRAIN_DELEGATE,consensus_key:t,delegate:e,destination:r}),C6=async({source:t,proposal:e,ballot:r})=>({kind:fe.BALLOT,source:t,proposal:e,ballot:r}),U6=async({source:t,proposals:e})=>({kind:fe.PROPOSALS,source:t,proposals:e}),Wf=async({source:t,fee:e,gasLimit:r,storageLimit:n,pk:a,proof:i})=>({kind:fe.UPDATE_CONSENSUS_KEY,source:t,fee:e,gas_limit:r,storage_limit:n,pk:a,proof:i}),Zf=async({source:t,fee:e,gasLimit:r,storageLimit:n,pk:a,proof:i})=>({kind:fe.UPDATE_COMPANION_KEY,source:t,fee:e,gas_limit:r,storage_limit:n,pk:a,proof:i}),Yf=async({source:t,fee:e,gasLimit:r,storageLimit:n,message:a})=>({kind:fe.SMART_ROLLUP_ADD_MESSAGES,source:t,fee:e,gas_limit:r,storage_limit:n,message:a}),Xf=async({source:t,fee:e,gasLimit:r,storageLimit:n,pvmKind:a,kernel:i,parametersType:s})=>({kind:fe.SMART_ROLLUP_ORIGINATE,source:t,fee:e,gas_limit:r,storage_limit:n,pvm_kind:a,kernel:i,parameters_ty:s}),Jf=async({source:t,fee:e,gasLimit:r,storageLimit:n,rollup:a,cementedCommitment:i,outputProof:s})=>({kind:fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,source:t,fee:e,gas_limit:r,storage_limit:n,rollup:a,cemented_commitment:i,output_proof:s});class Qs{clearRpcCache(){const e=this.context.rpc;typeof e.deleteAllCachedData=="function"&&e.deleteAllCachedData()}parseRpcErrors(e){if(!(e instanceof qn))return[];let r;try{r=JSON.parse(e.body)}catch{return[]}return Array.isArray(r)?r.filter(n=>typeof n=="object"&&n!==null):[]}toBigInt(e){if(typeof e=="bigint")return e;if(typeof e=="number"&&Number.isFinite(e)&&Number.isInteger(e)||typeof e=="string"&&/^-?\d+$/.test(e))return BigInt(e);if(typeof e=="object"&&e!==null&&"toString"in e){const r=e.toString();if(/^-?\d+$/.test(r))return BigInt(r)}}parseCounterAdjustments(e){return this.parseRpcErrors(e).filter(r=>{const n=r.id,a=r.contract,i=r.expected,s=r.found;return typeof n=="string"&&(n.endsWith("contract.counter_in_the_past")||n.endsWith("contract.counter_in_the_future"))&&typeof a=="string"&&typeof i=="string"&&typeof s=="string"}).map(r=>({contract:r.contract,expected:BigInt(r.expected),found:BigInt(r.found)})).filter(r=>r.expected!==r.found)}hasGasLimitTooHighAndBlockExhausted(e){const r=this.parseRpcErrors(e).map(n=>n.id).filter(n=>typeof n=="string");return r.some(n=>n.endsWith("gas_limit_too_high"))&&r.some(n=>n.endsWith("gas_exhausted.block"))}async patchSimulationGasLimits(e,r,n){if(!this.hasGasLimitTooHighAndBlockExhausted(r)||!Array.isArray(e.operation.contents))return;const a=await this.context.readProvider.getProtocolConstants("head"),i=this.toBigInt(a.hard_gas_limit_per_operation),s=this.toBigInt(a.hard_gas_limit_per_block),o=BigInt(0);if(typeof i>"u"||typeof s>"u"||i<=o||s<=o)return;const c=e.operation.contents.map(w=>({...w})),u=n&&n.length>0?n.filter(w=>w>=0&&w<c.length):[];let f=o;for(const[w,I]of c.entries()){const S=I.kind,T=this.toBigInt(I.gas_limit);if(!(typeof T>"u")){if(u.length===0){if(S!=="reveal"&&T>=i){u.push(w);continue}}else if(u.includes(w))continue;f+=T}}if(u.length===0)return;const l=s-f,p=l>o?l/BigInt(u.length):o,b=p>i?i:p;let v=!1;for(const w of u){const I=c[w];this.toBigInt(I.gas_limit)!==b&&(c[w].gas_limit=b.toString(),v=!0)}if(v)return{...e,operation:{...e.operation,contents:c}}}patchSimulationCounters(e,r){if(r.length===0||!Array.isArray(e.operation.contents))return;const n=e.operation.contents.map(i=>({...i}));let a=!1;for(const i of r){const s=i.expected-i.found;for(const o of n){const c=o.source,u=o.counter;if(c!==i.contract||typeof u>"u")continue;const f=BigInt(String(u));
35f<i.found||(o.counter=(f+s).toString(),a=!0)}}if(a)return{...e,operation:{...e.operation,contents:n}}}get rpc(){return this.context.rpc}get signer(){return this.context.signer}constructor(e){this.context=e}async forge({opOb:{branch:e,contents:r,protocol:n},counter:a}){return{opbytes:await this.context.forger.forge({branch:e,contents:r}),opOb:{branch:e,contents:r,protocol:n},counter:a}}async estimate({fee:e,gasLimit:r,storageLimit:n,...a},i){let s=e,o=r,c=n;if(s&&s%1!==0)throw new Fo(`Fee value must not be a decimal: ${s}`);if(o&&o%1!==0)throw new Fo(`Gas Limit value must not be a decimal: ${o}`);if(c&&c%1!==0)throw new Fo(`Storage Limit value must not be a decimal: ${c}`);if(e===void 0||r===void 0||n===void 0){const u=await i({fee:e,gasLimit:r,storageLimit:n,...a});s??(s=u.suggestedFeeMutez),o??(o=u.gasLimit),c??(c=u.storageLimit)}return{fee:s,gasLimit:o,storageLimit:c}}async getRPCOp(e){switch(e.kind){case fe.TRANSACTION:return ua({...e});case fe.ORIGINATION:return Kf(await this.context.parser.prepareCodeOrigination({...e}));case fe.DELEGATION:return Gf({...e});case fe.REGISTER_GLOBAL_CONSTANT:return jf({...e});case fe.INCREASE_PAID_STORAGE:return zf({...e});case fe.UPDATE_CONSENSUS_KEY:return Wf({...e});case fe.UPDATE_COMPANION_KEY:return Zf({...e});case fe.TRANSFER_TICKET:return Vf({...e});case fe.SMART_ROLLUP_ADD_MESSAGES:return Yf({...e});case fe.SMART_ROLLUP_ORIGINATE:return Xf({...e});case fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return Jf({...e});default:throw new wi(e.kind)}}async simulate(e,r){const n=r?.simulation?.gasLimitPatchableIndexes;try{return{opResponse:await this.rpc.simulateOperation(e),op:e,context:this.context.clone()}}catch(a){const i=this.parseCounterAdjustments(a),s=this.patchSimulationCounters(e,i);if(s)try{return{opResponse:await this.rpc.simulateOperation(s),op:s,context:this.context.clone()}}catch(c){const u=await this.patchSimulationGasLimits(s,c,n);if(!u)throw c;return{opResponse:await this.rpc.simulateOperation(u),op:u,context:this.context.clone()}}const o=await this.patchSimulationGasLimits(e,a,n);if(!o)throw a;return{opResponse:await this.rpc.simulateOperation(o),op:o,context:this.context.clone()}}}async isRevealOpNeeded(e,r){return!(!await this.isAccountRevealRequired(r)||!this.isRevealRequiredForOpType(e))}async isAccountRevealRequired(e){return!await this.context.readProvider.isAccountRevealed(e,"head")}isRevealRequiredForOpType(e){let r=!1;for(const n of e)vp(n)&&(r=!0);return r}async signAndInject(e){let r=await this.signForgedBytes(e);const n=[];let a;try{a=await this.rpc.preapplyOperations([r.opOb])}catch(o){const c=this.parseCounterAdjustments(o),u=await this.patchForgedBytesCounters(r,c);if(!u)throw o;r=await this.signForgedBytes(u),a=await this.rpc.preapplyOperations([r.opOb])}if(!Array.isArray(a))throw new m6(a);for(let o=0;o<a.length;o++)for(let c=0;c<a[o].contents.length;c++)n.push(a[o].contents[c]);const i=es(a);if(i.length)throw new wp(i,"Error occurred during validation simulation of operation",n);const s=await this.context.injector.inject(r.opbytes);return this.clearRpcCache(),{hash:s,forgedBytes:r,opResponse:n,context:this.context.clone()}}async signForgedBytes(e){const r=await this.signer.sign(e.opbytes,new Uint8Array([3]));return{...e,opbytes:r.sbytes,opOb:{...e.opOb,signature:r.prefixSig}}}async patchForgedBytesCounters(e,r){if(r.length===0||!Array.isArray(e.opOb.contents))return;const n=e.opOb.branch;if(typeof n!="string")return;const a=e.opOb.contents.map(o=>({...o}));let i=!1;for(const o of r){const c=o.expected-o.found;for(const u of a){const f=u.source,l=u.counter;if(f!==o.contract||typeof l>"u")continue;const p=BigInt(String(l));p<o.found||(u.counter=(p+c).toString(),i=!0)}}if(!i)return;const s=await this.context.forger.forge({branch:n,contents:a});return{...e,opbytes:s,opOb:{...e.opOb,contents:a}}}}function Lo(t,e,r,n){if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Lt(t,e,r,n,a){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,r),r}const uf="default";class D6{constructor(e,r,n,a,i="unit",s=!0,o=!1){this.provider=e,this.address=r,this.parameterSchema=n,this.name=a,this.args=i,this.isMultipleEntrypoint=s,this.isAnonymous=o}getSignature(){const e=this.parameterSchema.generateSchema();return this.isAnonymous?e.schema?.[this.name]:e}send(e={}){return this.provider&&"pkh"in this.provider?this.provider.transfer(this.toTransferParams(e)).send():this.provider.transfer(this.toTransferParams(e))}
35toTransferParams({fee:e,gasLimit:r,storageLimit:n,source:a,amount:i=0,mutez:s=!1}={}){return{to:this.address,amount:i,fee:e,mutez:s,source:a,gasLimit:r,storageLimit:n,parameter:{entrypoint:this.isMultipleEntrypoint?this.name:uf,value:this.isAnonymous?this.parameterSchema.EncodeObject({[this.name]:this.args}):this.parameterSchema.EncodeObject(this.args)}}}}class OR{constructor(e,r,n,a,i,s="Unit"){this._rpc=e,this._readProvider=r,this._contractAddress=n,this._smartContractViewSchema=a,this._contractStorageType=i,this._args=s}getSignature(){return{parameter:this._smartContractViewSchema.extractArgsSchema(),result:this._smartContractViewSchema.extractResultSchema()}}async executeView(e){this.verifyContextExecution(e);const r=await this._readProvider.getChainId(),n=this.transformArgsToMichelson(),a={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:n,chain_id:r,source:e.viewCaller};return e.source&&(a.payer=e.source),this.executeViewAndDecodeResult(a)}verifyContextExecution(e){if(e.source&&it(e.source)!==Se.VALID)throw new Z0(`The source account who initialized the view execution is invalid: ${e.source}.`);if(!e.viewCaller||it(e.viewCaller)!==Se.VALID)throw new Z0(`The contract which is the caller of view is invalid: ${e.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(e){throw new Ov(this._smartContractViewSchema.viewName,this.getSignature(),this._args,e)}}adaptViewCodeToContext(e,r,n){const a={BALANCE:[{prim:"PUSH",args:[{prim:"mutez"},{int:n}]}],SENDER:[{prim:"PUSH",args:[{prim:"address"},{string:r}]}],SELF_ADDRESS:[{prim:"PUSH",args:[{prim:"address"},{string:this._contractAddress}]}],AMOUNT:[{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]}]};return e.forEach((i,s)=>{i.prim in a&&(e[s]=Object(a)[i.prim]),i.args&&i.args.length!==0?this.adaptViewCodeToContext(i.args,r,n):Array.isArray(i)&&this.adaptViewCodeToContext(i,r,n)}),e}async executeViewAndDecodeResult(e){let r;try{r=(await this._rpc.runScriptView(e)).data}catch(n){const a=T6(n);throw a?new B6(`The simulation of the on-chain view named ${this._smartContractViewSchema.viewName} failed with: ${JSON.stringify(a)}`,this._smartContractViewSchema.viewName,a,n):n}return this._smartContractViewSchema.decodeViewResult(r)}}class LR{constructor(e,r){this.provider=e,this.contractAddress=r}createContractMethodObjectParam(e,r,n,a=!0,i=!1){return new D6(this.provider,this.contractAddress,e,r,n,a,i)}createContractViewObjectParam(e,r,n,a,i){return new OR(e,r,this.contractAddress,n,a,i)}}class H6{constructor(e,r,n,a){this.id=e,this.schema=r,this.provider=n,this.defaultBlock=a}async get(e,r){try{return await this.provider.getBigMapKeyByID(this.id.toString(),e,this.schema,r??this.defaultBlock)}catch(n){if(n instanceof qn&&n.status===Ga.NOT_FOUND)return;throw n}}async getMultipleValues(e,r,n=5){return this.provider.getBigMapKeysByID(this.id.toString(),e,this.schema,r??this.defaultBlock,n)}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}class F6{constructor(e,r,n){this.id=e,this.provider=r,this.defaultBlock=n}async getSaplingDiff(e){return this.provider.getSaplingDiffByID(this.id.toString(),e??this.defaultBlock)}getId(){return this.id.toString()}}const hf=(t,e)=>({big_map:(r,n)=>{if(!r||!("int"in r)||r.int===void 0)return{};{const a=new jr(n);return new H6(new tt(r.int),a,t,e)}},sapling_state:r=>!r||!("int"in r)||r.int===void 0?{}:new F6(new tt(r.int),t,e)});class q6{constructor(e,r,n,a,i,s,o){this.currentContract=e,this.name=r,this.callbackParametersSchema=n,this.parameterSchema=a,this.args=i,this.rpc=s,this.readProvider=o}async read(e){const r=G2(e??"");if(pa(e??"")==Se.VALID)throw new Nv("Since version 12, the lambda view no longer depends on a lambda contract. The read method no longer accepts a contract address as a parameter.");if(e&&r!==Se.VALID)throw new d_(e,r);const n=this.parameterSchema.Encode(...this.args),a=await this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:n,chain_id:e||await this.readProvider.getChainId()});return this.callbackParametersSchema.Execute(a.data)}}const NR=(t,e,r)=>{const n=e.ExtractSignatures();if(!n.find(a=>a.length===t.length))throw new R6(r,n,t)},kR=t=>{let e=!1;if("prim"in t&&t.prim==="pair"&&t.args){const r=t.args[t.args.length-1];"prim"in r&&r.prim==="contract"&&(e=!0)}return e};class Cs{constructor(e,r,n,a,i,s,o,c="head"){this.address=e,this.script=r,this.storageProvider=a,this.entrypoints=i,this.rpc=s,this.readProvider=o,this.readBlock=c,this.methodsObject={},this.views={},this.contractViews={},this.contractMethodFactory=new LR(n,e),this.schema=jr.fromRPCResponse({script:this.script}),this.parameterSchema=ka.fromRPCResponse({script:this.script}),this.viewSchema=qd.fromRPCResponse({script:this.script}),this.viewSchema.length!==0&&this._initializeOnChainViews(this,s,this.readProvider,this.viewSchema),this.eventSchema=ri.fromRPCResponse({script:this.script}),this._initializeMethods(this,this.entrypoints.entrypoints,this.rpc,this.readProvider)}_initializeMethods(e,r,n,a){const i=this.parameterSchema,s=Object.keys(r);
35if(i.isMultipleEntryPoint){s.forEach(f=>{const l=new ka(r[f]);if(this.methodsObject[f]=function(p){return e.contractMethodFactory.createContractMethodObjectParam(l,f,p)},kR(r[f])){const p=function(...b){const v=r[f].args[0],w=new ka(v),I=r[f].args[1].args[0],S=new ka(I);return NR(b,w,f),new q6(e,f,S,w,b,n,a)};this.views[f]=p}});const o=i.generateSchema();(o.schema&&typeof o.schema=="object"?Object.keys(o.schema):[]).filter(f=>Object.keys(r).indexOf(f)===-1).forEach(f=>{this.methodsObject[f]=function(l){return e.contractMethodFactory.createContractMethodObjectParam(i,f,l,!1,!0)}})}else{const o=this.parameterSchema;this.methodsObject[uf]=function(c){return e.contractMethodFactory.createContractMethodObjectParam(o,uf,c,!1)}}}_initializeOnChainViews(e,r,n,a){const i=this.schema.val;a.forEach(s=>{this.contractViews[s.viewName]=function(o){return e.contractMethodFactory.createContractViewObjectParam(r,n,s,i,o)}})}async storage(){return this.readBlock!=="head"?this.schema.Execute(this.script.storage,hf(this.storageProvider,this.readBlock)):this.storageProvider.getStorage(this.address,this.schema,this.readBlock)}}var gt;const Xi=tt,jt=(t,e)=>({fee:t.fee??e.fee,gasLimit:t.gasLimit??e.gasLimit,storageLimit:t.
35storageLimit??e.storageLimit});class fs extends Qs{constructor(e){super(e),this.context=e,gt.set(this,void 0),Lt(this,gt,{})}async getBlockHash(e){return this.context.readProvider.getBlockHash(e??"head~2")}async getProtocolHash(){return this.context.readProvider.getNextProtocol("head")}async getHeadCounter(e){return this.context.readProvider.getCounter(e,"head")??"0"}adjustGasForManagerOperations(e,r,n,a=new Xi(0)){if(n<=0)return r;const i=e.minus(a);return i.lte(0)?new Xi(0):Xi.min(r,i.div(n).integerValue(Xi.ROUND_DOWN))}getOperationLimits(e,r={}){const{hard_gas_limit_per_operation:n,hard_gas_limit_per_block:a,hard_storage_limit_per_operation:i}=e;return{fee:0,gasLimit:this.adjustGasForManagerOperations(a,n,r.opsNeedingGasLimitPatch??0,r.explicitGasLimitTotal).toNumber(),storageLimit:i.toNumber()}}async getOperationLimitsForManagerOperation(e,r,n,a){const i=await this.isRevealOpNeeded([{kind:n}],r);return this.getOperationLimits(e,{opsNeedingGasLimitPatch:typeof a>"u"?1:0,explicitGasLimitTotal:i?new Xi(Da(r)):void 0})}getFee(e,r,n){return(!Lo(this,gt,"f")[r]||Lo(this,gt,"f")[r]<n)&&(Lo(this,gt,"f")[r]=n),{counter:`${++Lo(this,gt,"f")[r]}`,fee:typeof e.fee>"u"?"0":`${e.fee}`,gas_limit:typeof e.gas_limit>"u"?"0":`${e.gas_limit}`,storage_limit:typeof e.storage_limit>"u"?"0":`${e.storage_limit}`}}getSource(e,r,n){return{source:typeof e.source>"u"?n||r:e.source}}async addRevealOperationIfNeeded(e,r){if(vp(e)){const n=[e],{publicKey:a,pkh:i}=await this.getKeys();if(await this.isAccountRevealRequired(r)){if(!a)throw new tc(i);const[,s]=At(i,da);return n.unshift(await qo({fee:W0(i),storageLimit:V0,gasLimit:Da(i),proof:s===re.BLS12_381PublicKeyHash?(await this.signer.provePossession()).prefixSig:void 0},r,a)),n}}return e}async getKeys(){const e=this.context.isAnySignerConfigured();return{pkh:e?await this.signer.publicKeyHash():await this.context.wallet.pkh(),publicKey:e?await this.signer.publicKey():await this.context.wallet.pk()}}convertIntoArray(e){return Array.isArray(e)?[...e]:[e]}getSingleManagerOperationSimulation(e,r){if(!(typeof r<"u"||e.length===0))return{gasLimitPatchableIndexes:[e.length-1]}}withSimulationMetadata(e,r){return r&&Object.defineProperty(e,"simulation",{value:r,configurable:!0,enumerable:!1,writable:!0}),e}constructOpContents(e,r,n,a,i){return e.map(s=>{switch(s.kind){case fe.ACTIVATION:case fe.DRAIN_DELEGATE:return{...s};case fe.ORIGINATION:return{...s,balance:typeof s.balance<"u"?`${s.balance}`:"0",...this.getSource(s,n,a),...this.getFee(s,n,r)};case fe.TRANSACTION:{const o={...s,amount:typeof s.amount<"u"?`${s.amount}`:"0",...this.getSource(s,n,a),...this.getFee(s,n,r)};if(o.source.toLowerCase().startsWith("kt1"))throw new Nv(`KT1 addresses are not supported as source since ${wt.PsBabyM1}`);return o}case fe.REVEAL:case fe.DELEGATION:case fe.REGISTER_GLOBAL_CONSTANT:case fe.UPDATE_CONSENSUS_KEY:case fe.UPDATE_COMPANION_KEY:case fe.SMART_ROLLUP_ADD_MESSAGES:case fe.SMART_ROLLUP_ORIGINATE:case fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return{...s,...this.getSource(s,n,a),...this.getFee(s,n,r)};case fe.TRANSFER_TICKET:return{...s,ticket_amount:`${s.ticket_amount}`,...this.getSource(s,n,a),...this.getFee(s,n,r)};case fe.INCREASE_PAID_STORAGE:return{...s,amount:`${s.amount}`,...this.getSource(s,n,a),...this.getFee(s,n,r)};case fe.BALLOT:if(i===void 0)throw new Oo("Failed to get the current voting period index");return{...s,period:i?.voting_period.index,...this.getSource(s,n,a)};case fe.PROPOSALS:if(i===void 0)throw new Oo("Failed to get the current voting period index");return{...s,period:i?.voting_period.index,...this.getSource(s,n,a)};default:throw new wi(s.kind)}})}async activate({pkh:e,secret:r}){const n=await L6({pkh:e,secret:r}),a=this.convertIntoArray(n),i=await this.getBlockHash(),s=await this.getProtocolHash();Lt(this,gt,{});const o=parseInt(await this.getHeadCounter(e),10),c=this.constructOpContents(a,o,e);return{opOb:{branch:i,contents:c,protocol:s},counter:o}}async reveal({fee:e,gasLimit:r,storageLimit:n,proof:a}){const{pkh:i,publicKey:s}=await this.getKeys();if(!s)throw new tc(i);const[,o]=At(i,da);if(o===re.BLS12_381PublicKeyHash)if(a)At(a,[re.BLS12_381Signature]);else{const{prefixSig:T}=await this.signer.provePossession();a=T}else if(a)throw new sr("Proof field is only allowed to reveal a bls account ");const c=await this.context.readProvider.getProtocolConstants("head"),u=await this.getOperationLimits(c),f=jt({fee:e,storageLimit:n,gasLimit:r},u),l=await qo({fee:f.fee,gasLimit:f.gasLimit,storageLimit:f.storageLimit,proof:a},i,s),p=this.convertIntoArray(l),b=await this.getBlockHash(),v=await this.getProtocolHash();Lt(this,gt,{});const w=parseInt(await this.getHeadCounter(i),10),I=this.constructOpContents(p,w,i);return{opOb:{branch:b,contents:I,protocol:v},counter:w}}async originate({fee:e,storageLimit:r,gasLimit:n,...a},i){const{pkh:s}=await this.getKeys(),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.getOperationLimitsForManagerOperation(o,s,fe.ORIGINATION,n),u=await Kf(await this.context.parser.prepareCodeOrigination({...a,...jt({fee:e,storageLimit:r,gasLimit:n},c)})),f=await this.addRevealOperationIfNeeded(u,s),l=this.convertIntoArray(f),p=await this.getBlockHash(),b=await this.getProtocolHash();Lt(this,gt,{});const v=parseInt(await this.getHeadCounter(s),10),w=this.constructOpContents(l,v,s,i),I={opOb:{branch:p,c
35ontents:w,protocol:b},counter:v};return this.withSimulationMetadata(I,this.getSingleManagerOperationSimulation(l,n))}async transaction({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.TRANSACTION,n),c=await ua({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async stake({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.TRANSACTION,n),c=await ua({...a,to:i,...jt({fee:e,storageLimit:r,gasLimit:n},o),parameter:{entrypoint:"stake",value:{prim:"Unit"}}}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async unstake({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.TRANSACTION,n),c=await ua({...a,to:i,...jt({fee:e,storageLimit:r,gasLimit:n},o),parameter:{entrypoint:"unstake",value:{prim:"Unit"}}}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async finalizeUnstake({fee:e,storageLimit:r,gasLimit:n,to:a,...i}){const{pkh:s}=await this.getKeys(),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.getOperationLimitsForManagerOperation(o,s,fe.TRANSACTION,n),u=await ua({...i,to:a||s,amount:0,...jt({fee:e,storageLimit:r,gasLimit:n},c),parameter:{entrypoint:"finalize_unstake",value:{prim:"Unit"}}}),f=await this.addRevealOperationIfNeeded(u,s),l=this.convertIntoArray(f),p=await this.getBlockHash(),b=await this.getProtocolHash();Lt(this,gt,{});const v=parseInt(await this.getHeadCounter(s),10),w=this.constructOpContents(l,v,s,i.source),I={opOb:{branch:p,c
35ontents:w,protocol:b},counter:v};return this.withSimulationMetadata(I,this.getSingleManagerOperationSimulation(l,n))}async delegation({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.DELEGATION,n),c=await Gf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async registerDelegate({fee:e,storageLimit:r,gasLimit:n},a){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.DELEGATION,n),c=jt({fee:e,storageLimit:r,gasLimit:n},o),u=await N6({fee:c.fee,storageLimit:c.storageLimit,gasLimit:c.gasLimit},i),f=await this.addRevealOperationIfNeeded(u,i),l=this.convertIntoArray(f),p=await this.getBlockHash(),b=await this.getProtocolHash();Lt(this,gt,{});const v=parseInt(await this.getHeadCounter(i),10),w=this.constructOpContents(l,v,i,a),I={opOb:{branch:p,c
35ontents:w,protocol:b},counter:v};return this.withSimulationMetadata(I,this.getSingleManagerOperationSimulation(l,n))}async registerGlobalConstant({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.REGISTER_GLOBAL_CONSTANT,n),c=await jf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async updateConsensusKey({fee:e,storageLimit:r,gasLimit:n,...a},i){const{pkh:s}=await this.getKeys(),[,o]=At(a.pk,on);if(o===re.BLS12_381PublicKey){if(!a.proof)throw new vi("Proof is required to set a bls account as consensus key ")}else if(a.proof)throw new sr("Proof field is only allowed for a bls account as consensus key");const c=await this.context.readProvider.getProtocolConstants("head"),u=await this.getOperationLimitsForManagerOperation(c,s,fe.UPDATE_CONSENSUS_KEY,n),f=await Wf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},u)}),l=await this.addRevealOperationIfNeeded(f,s),p=this.convertIntoArray(l),b=await this.getBlockHash(),v=await this.getProtocolHash();Lt(this,gt,{});const w=parseInt(await this.getHeadCounter(s),10),I=this.constructOpContents(p,w,s,i),S={opOb:{branch:b,contents:I,protocol:v},counter:w};return this.withSimulationMetadata(S,this.getSingleManagerOperationSimulation(p,n))}async updateCompanionKey({fee:e,storageLimit:r,gasLimit:n,...a},i){const{pkh:s}=await this.getKeys(),[,o]=At(a.pk,on);if(o!==re.BLS12_381PublicKey)throw new sr("companion key must be a bls account");if(!a.proof)throw new vi("Proof is required to set a bls account as companion key ");const c=await this.context.readProvider.getProtocolConstants("head"),u=await this.getOperationLimitsForManagerOperation(c,s,fe.UPDATE_COMPANION_KEY,n),f=await Zf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},u)}),l=await this.addRevealOperationIfNeeded(f,s),p=this.convertIntoArray(l),b=await this.getBlockHash(),v=await this.getProtocolHash();Lt(this,gt,{});const w=parseInt(await this.getHeadCounter(s),10),I=this.constructOpContents(p,w,s,i),S={opOb:{branch:b,contents:I,protocol:v},counter:w};return this.withSimulationMetadata(S,this.getSingleManagerOperationSimulation(p,n))}async increasePaidStorage({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.INCREASE_PAID_STORAGE,n),c=await zf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async ballot(e){const{pkh:r}=await this.getKeys(),n=await C6({...e}),a=this.convertIntoArray(n),i=await this.getBlockHash(),s=await this.getProtocolHash();Lt(this,gt,{});const o=parseInt(await this.getHeadCounter(r),10);let c;try{c=await this.rpc.getCurrentPeriod()}catch{throw new Oo("Failed to get the current voting period index")}const u=this.constructOpContents(a,o,r,e.source,c);return{opOb:{branch:i,contents:u,protocol:s},counter:o}}async proposals(e){const{pkh:r}=await this.getKeys(),n=await U6({...e}),a=this.convertIntoArray(n),i=await this.getBlockHash(),s=await this.getProtocolHash();Lt(this,gt,{});const o=parseInt(await this.getHeadCounter(r),10);let c;try{c=await this.rpc.getCurrentPeriod()}catch{throw new Oo("Failed to get the current voting period index")}const u=this.constructOpContents(a,o,r,e.source,c);return{opOb:{branch:i,contents:u,protocol:s},counter:o}}async drainDelegate(e,r){const{pkh:n}=await this.getKeys(),a=await k6({...e}),i=this.convertIntoArray(a),s=await this.getBlockHash(),o=await this.getProtocolHash();Lt(this,gt,{});const c=parseInt(await this.getHeadCounter(n),10),u=this.constructOpContents(i,c,n,r);return{opOb:{branch:s,contents:u,protocol:o},counter:c}}async transferTicket({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.TRANSFER_TICKET,n),c=await Vf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};
35return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async smartRollupAddMessages({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.SMART_ROLLUP_ADD_MESSAGES,n),c=await Yf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async smartRollupOriginate({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.SMART_ROLLUP_ORIGINATE,n),c=await Xf({...jt({fee:e,storageLimit:r,gasLimit:n},o),...a}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async smartRollupExecuteOutboxMessage({fee:e,storageLimit:r,gasLimit:n,...a}){const{pkh:i}=await this.getKeys(),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.getOperationLimitsForManagerOperation(s,i,fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,n),c=await Jf({...a,...jt({fee:e,storageLimit:r,gasLimit:n},o)}),u=await this.addRevealOperationIfNeeded(c,i),f=this.convertIntoArray(u),l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(i),10),v=this.constructOpContents(f,b,i,a.source),w={opOb:{branch:l,contents:v,protocol:p},counter:b};return this.withSimulationMetadata(w,this.getSingleManagerOperationSimulation(f,n))}async batch(e,r){const{pkh:n,publicKey:a}=await this.getKeys(),i=await this.context.readProvider.getProtocolConstants("head"),s=await this.isRevealOpNeeded(e,n),o=e.reduce((I,S)=>Ua(S)&&typeof S.gasLimit<"u"?I.plus(S.gasLimit):I,s?new Xi(Da(n)):new Xi(0)),c=this.getOperationLimits(i,{opsNeedingGasLimitPatch:e.filter(I=>Ua(I)&&typeof I.gasLimit>"u").length,explicitGasLimitTotal:o}),u=[],f=[];if(r)for(const I of e)if(Ua(I)){const S=r.shift(),T=jt(I,{fee:S.suggestedFeeMutez,storageLimit:S.storageLimit,gasLimit:S.gasLimit});u.push(await this.getRPCOp({...I,...T})),f.push(!1)}else u.push({...I}),f.push(!1);else for(const I of e)if(Ua(I)){const S=jt(I,c);u.push(await this.getRPCOp({...I,...S})),f.push(typeof I.gasLimit>"u")}else u.push({...I}),f.push(!1);if(s){if(!a)throw new tc(n);const[,I]=At(n,da);u.unshift(await qo({fee:W0(n),storageLimit:V0,gasLimit:Da(n),proof:I===re.BLS12_381PublicKeyHash?(await this.signer.provePossession()).prefixSig:void 0},n,a)),f.unshift(!1)}const l=await this.getBlockHash(),p=await this.getProtocolHash();Lt(this,gt,{});const b=parseInt(await this.getHeadCounter(n),10),v=this.constructOpContents(u,b,n),w=f.flatMap((I,S)=>I?[S]:[]);return{opOb:{branch:l,contents:v,protocol:p},counter:b,simulation:w.length>0?{gasLimitPatchableIndexes:w}:void 0}}async contractCall(e){const r=await this.getBlockHash(),n=await this.getProtocolHash(),{pkh:a}=await this.getKeys();Lt(this,gt,{});const i=parseInt(await this.getHeadCounter(a),10),s=e.toTransferParams(),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.getOperationLimitsForManagerOperation(o,a,fe.TRANSACTION,s.gasLimit),u=jt({fee:s.fee,storageLimit:s.storageLimit,gasLimit:s.gasLimit},c),f={kind:fe.TRANSACTION,fee:s.fee??u.fee,gas_limit:s.gasLimit??u.gasLimit,storage_limit:s.storageLimit??u.storageLimit,amount:String(s.amount),destination:s.to,parameters:s.parameter},l=await this.addRevealOperationIfNeeded(f,a),p=this.convertIntoArray(l),b=this.constructOpContents(p,i,a),v={opOb:{branch:r,contents:b,protocol:n},counter:i};
35return this.withSimulationMetadata(v,this.getSingleManagerOperationSimulation(p,s.gasLimit))}async toPreapply(e){const{opOb:{contents:r,branch:n,protocol:a}}=e,i=this.toForge(e),s=await this.context.forger.forge(i),o=await this.context.signer.sign(s,new Uint8Array([3]));return[{contents:r,branch:n,protocol:a,signature:o.prefixSig}]}toForge({opOb:{contents:e,branch:r}}){return{branch:r,contents:e}}}gt=new WeakMap;class CR extends Qs{constructor(e){super(e),this.prepare=new fs(this.context)}async getBalance(e){const r=it(e);if(r!==Se.VALID)throw new st(e,r);return this.context.readProvider.getBalance(e,"head")}async getSpendable(e){const r=it(e);if(r!==Se.VALID)throw new st(e,r);return this.context.readProvider.getSpendable(e,"head")}async getDelegate(e){const r=it(e);if(r!==Se.VALID)throw new st(e,r);return this.context.readProvider.getDelegate(e,"head")}async activate(e,r){const n=hd(e);if(n!==Se.VALID)throw new td(e,n);const a=await this.prepare.activate({pkh:e,secret:r}),i=await this.forge(a),s=`${i.opbytes}00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000`;return new Jt(await this.rpc.injectOperation(s),{...i,opbytes:s},[],this.context.clone())}}const ma={minimalFeeMutez:100,feePerGasMutez:.1,feePerByteMutez:1},Bv=t=>{if(!Array.isArray(t)||t.length<2)return;const e=Number(t[0]),r=Number(t[1]);if(!(!Number.isFinite(e)||!Number.isFinite(r)||r===0))return e/r},$6=t=>{const e=Number(t?.minimal_fees),r=Bv(t?.minimal_nanotez_per_gas_unit),n=Bv(t?.minimal_nanotez_per_byte);return{minimalFeeMutez:Number.isFinite(e)?e:ma.minimalFeeMutez,feePerGasMutez:typeof r=="number"?r/1e3:ma.feePerGasMutez,feePerByteMutez:typeof n=="number"?n/1e3:ma.feePerByteMutez}};class Ut{constructor(e,r,n,a,i=ma.minimalFeeMutez,s=ma){this._milligasLimit=e,this._storageLimit=r,this.opSize=n,this.minimalFeePerStorageByteMutez=a,this.baseFeeMutez=i,this.feeParams=s}get burnFeeMutez(){return this.roundUp(Number(this.storageLimit)*Number(this.minimalFeePerStorageByteMutez))}get storageLimit(){return Math.max(Number(this._storageLimit),0)}get gasLimit(){return this.roundUp(Number(this._milligasLimit)/1e3)}get operationFeeMutez(){return this.gasLimit*this.feeParams.feePerGasMutez+Number(this.opSize)*this.feeParams.feePerByteMutez}roundUp(e){return Math.ceil(Number(e))}get minimalFeeMutez(){return this.roundUp(this.operationFeeMutez+this.feeParams.minimalFeeMutez)}get suggestedFeeMutez(){return this.roundUp(this.operationFeeMutez+this.feeParams.minimalFeeMutez*1.2)}get usingBaseFeeMutez(){return Math.max(Number(this.baseFeeMutez),this.feeParams.minimalFeeMutez)+this.roundUp(this.operationFeeMutez)}get totalCost(){return this.minimalFeeMutez+this.burnFeeMutez}get consumedMilligas(){return Number(this._milligasLimit)}static createEstimateInstanceFromProperties(e){let r=0,n=0,a=0,i=0,s;const o=e[0]?.feeParams;return e.forEach(c=>{r+=c.milligasLimit,n+=c.storageLimit,a+=c.opSize,i=Math.max(c.minimalFeePerStorageByteMutez,i),c.baseFeeMutez&&(s=s?s+c.baseFeeMutez:c.baseFeeMutez)}),new Ut(r,n,a,i,s,o)}static createArrayEstimateInstancesFromProperties(e){return e.map(r=>new Ut(r.milligasLimit,r.storageLimit,r.opSize,r.minimalFeePerStorageByteMutez,r.baseFeeMutez,r.feeParams))}}class K6 extends pt{constructor(){super(),this.name="RevealEstimateError",this.message="Public key is unknown, unable to estimate the reveal operation in Wallet API."}}const UR="edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg";class G6 extends Qs{constructor(){super(...arguments),this.REVEAL_LENGTH=324,this.REVEAL_LENGTH_TZ4=622,this.MILLIGAS_BUFFER=100*1e3,this.STORAGE_BUFFER=20,this.prepare=new fs(this.context)}async getKeys(){const e=this.context.isAnySignerConfigured();return{publicKeyHash:e?await this.signer.publicKeyHash():await this.context.wallet.pkh(),publicKey:e?await this.signer.publicKey():await this.context.wallet.pk()}}getEstimationPropertiesFromOperationContent(e,r,n,a){const i=an({contents:[e]});let s=0,o=0;return i.forEach(c=>{s+=Number(c.consumed_milligas)||0,o+="allocated_destination_contract"in c?a:0,o+="originated_contracts"in c&&Array.isArray(c.originated_contracts)?c.originated_contracts.length*a:0,o+="storage_size"in c&&"global_address"in c&&Number(c.storage_size)||0,o+="paid_storage_size_diff"in c&&Number(c.paid_storage_size_diff)||0,o+="genesis_commitment_hash"in c&&Number(c.size)||0}),Ua(e)?{milligasLimit:d6(e)?s+Number(this.MILLIGAS_BUFFER):s,storageLimit:o>0?o+this.STORAGE_BUFFER:0,opSize:r,minimalFeePerStorageByteMutez:n.toNumber()}:{milligasLimit:0,storageLimit:0,opSize:r,minimalFeePerStorageByteMutez:n.toNumber(),baseFeeMutez:0}}async calculateEstimates(e,r){let n=ma;
35try{n=$6(await this.rpc.getMempoolFilter({include_default:!0}))}catch{}const{opbytes:a,opOb:{branch:i,contents:s}}=await this.forge(e),o={operation:{branch:i,contents:s,signature:UR},chain_id:await this.context.readProvider.getChainId()},{opResponse:c}=await this.simulate(o,e),{cost_per_byte:u,origination_size:f}=r,l=[...es(c,"backtracked"),...es(c)];if(l.length)throw new wp(l,"Error occurred during estimation",c.contents);let p=1;return Array.isArray(e.opOb.contents)&&e.opOb.contents.length>1&&(p=c.contents[0].kind==="reveal"?e.opOb.contents.length-1:e.opOb.contents.length),c.contents.map(b=>{const v=b;v.source=v.source||"";let w,I;return v.source.startsWith(re.BLS12_381PublicKeyHash)?(w=this.REVEAL_LENGTH_TZ4/2,I=(a.length/2+Zo[re.BLS12_381Signature])/p):(w=this.REVEAL_LENGTH/2,I=(a.length/2+Zo[re.Ed25519Signature])/p),{...this.getEstimationPropertiesFromOperationContent(b,b.kind==="reveal"?w:I,u,f??257),feeParams:n}})}async originate(e){const r=await this.prepare.originate(e),n=await this.context.readProvider.getProtocolConstants("head"),a=await this.calculateEstimates(r,n);if(r.opOb.contents[0].kind==="reveal"){const i=r.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;a.shift(),a[0].opSize-=i}return Ut.createEstimateInstanceFromProperties(a)}async transfer({fee:e,storageLimit:r,gasLimit:n,...a}){const i=it(a.to);if(i!==Se.VALID)throw new st(a.to,i);const s=it(a.source??"");if(a.source&&s!==Se.VALID)throw new st(a.source,s);if(a.amount<0)throw new kn(a.amount.toString());const o=await this.prepare.transaction({fee:e,storageLimit:r,gasLimit:n,...a}),c=await this.context.readProvider.getProtocolConstants("head"),u=await this.calculateEstimates(o,c);if(o.opOb.contents[0].kind==="reveal"){const f=o.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;u.shift(),u[0].opSize-=f}return Ut.createEstimateInstanceFromProperties(u)}async stake({fee:e,storageLimit:r,gasLimit:n,...a}){const i=it(a.source??"");if(a.source&&i!==Se.VALID)throw new st(a.source,i);if(a.to||(a.to=a.source),a.to&&a.to!==a.source)throw new Ka(a.to);if(a.amount<0)throw new kn(a.amount.toString());const s=await this.prepare.stake({fee:e,storageLimit:r,gasLimit:n,...a}),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.calculateEstimates(s,o);if(s.opOb.contents[0].kind==="reveal"){c.shift();const u=s.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;c[0].opSize-=u}return Ut.createEstimateInstanceFromProperties(c)}async unstake({fee:e,storageLimit:r,gasLimit:n,...a}){const i=it(a.source??"");if(a.source&&i!==Se.VALID)throw new st(a.source,i);if(a.to||(a.to=a.source),a.to&&a.to!==a.source)throw new Ka(a.to);if(a.amount<0)throw new kn(a.amount.toString());const s=await this.prepare.unstake({fee:e,storageLimit:r,gasLimit:n,...a}),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.calculateEstimates(s,o);if(s.opOb.contents[0].kind==="reveal"){c.shift();const u=s.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;c[0].opSize-=u}return Ut.createEstimateInstanceFromProperties(c)}async finalizeUnstake({fee:e,storageLimit:r,gasLimit:n,...a}){const i=it(a.source??"");if(a.source&&i!==Se.VALID)throw new st(a.source,i);if(a.to||(a.to=a.source),a.amount||(a.amount=0),a.amount!==void 0&&a.amount!==0)throw new Error("Amount must be 0 for finalize_unstake operation");const s=await this.prepare.finalizeUnstake({fee:e,storageLimit:r,gasLimit:n,...a}),o=await this.context.readProvider.getProtocolConstants("head"),c=await this.calculateEstimates(s,o);if(s.opOb.contents[0].kind==="reveal"){c.shift();const u=s.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;c[0].opSize-=u}return Ut.createEstimateInstanceFromProperties(c)}async transferTicket({fee:e,storageLimit:r,gasLimit:n,...a}){const i=it(a.destination);if(i!==Se.VALID)throw new st(a.destination,i);const s=it(a.source??"");if(a.source&&s!==Se.VALID)throw new st(a.source,s);const o=await this.context.readProvider.getProtocolConstants("head"),c=await this.prepare.transferTicket({fee:e,storageLimit:r,gasLimit:n,...a}),u=await this.calculateEstimates(c,o);if(c.opOb.contents[0].kind==="reveal"){u.shift();const f=c.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;u[0].opSize-=f}return Ut.createEstimateInstanceFromProperties(u)}
35async setDelegate({fee:e,gasLimit:r,storageLimit:n,...a}){const i=it(a.source??"");if(a.source&&i!==Se.VALID)throw new st(a.source,i);const s=it(a.delegate??"");if(a.delegate&&s!==Se.VALID)throw new st(a.delegate,s);const o=await this.prepare.delegation({fee:e,storageLimit:n,gasLimit:r,...a}),c=await this.context.readProvider.getProtocolConstants("head"),u=await this.calculateEstimates(o,c);if(o.opOb.contents[0].kind==="reveal"){u.shift();const f=o.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;u[0].opSize-=f}return Ut.createEstimateInstanceFromProperties(u)}async batch(e){const r=await this.context.readProvider.getProtocolConstants("head"),n=await this.prepare.batch(e),a=await this.calculateEstimates(n,r);return Ut.createArrayEstimateInstancesFromProperties(a)}async registerDelegate({fee:e,storageLimit:r,gasLimit:n,...a},i){const s=(await this.getKeys()).publicKeyHash,o=await this.context.readProvider.getProtocolConstants("head"),c=i||s,u=await this.prepare.registerDelegate({fee:e,storageLimit:r,gasLimit:n,...a},c),f=await this.calculateEstimates(u,o);if(u.opOb.contents[0].kind==="reveal"){f.shift();const l=u.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;f[0].opSize-=l}return Ut.createEstimateInstanceFromProperties(f)}async reveal(e){const{publicKeyHash:r,publicKey:n}=await this.getKeys();if(!n)throw new K6;if(await this.isAccountRevealRequired(r)){const[,a]=At(r,da);if(a===re.BLS12_381PublicKeyHash)if(e&&e.proof)At(e.proof,[re.BLS12_381Signature]);else{const{prefixSig:c}=await this.signer.provePossession();e={...e,proof:c}}else if(e&&e.proof)throw new sr("Proof field is only allowed to reveal a bls account ");const i=await this.context.readProvider.getProtocolConstants("head"),s=e?await this.prepare.reveal(e):await this.prepare.reveal({}),o=await this.calculateEstimates(s,i);return Ut.createEstimateInstanceFromProperties(o)}}async registerGlobalConstant({fee:e,storageLimit:r,gasLimit:n,...a}){const i=await this.prepare.registerGlobalConstant({fee:e,storageLimit:r,gasLimit:n,...a}),s=await this.context.readProvider.getProtocolConstants("head"),o=await this.calculateEstimates(i,s);if(i.opOb.contents[0].kind==="reveal"){o.shift();const c=i.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;o[0].opSize-=c}return Ut.createEstimateInstanceFromProperties(o)}async increasePaidStorage({fee:e,storageLimit:r,gasLimit:n,...a}){if(a.amount<=0)throw new kn(a.amount.toString());const i=await this.context.readProvider.getProtocolConstants("head"),s=await this.prepare.increasePaidStorage({fee:e,storageLimit:r,gasLimit:n,...a}),o=await this.calculateEstimates(s,i);if(s.opOb.contents[0].kind==="reveal"){o.shift();const c=s.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;o[0].opSize-=c}return Ut.createEstimateInstanceFromProperties(o)}async updateConsensusKey(e){const[,r]=At(e.pk,on);if(r===re.BLS12_381PublicKey){if(!e.proof)throw new vi("Proof is required to set a bls account as consensus key ")}else if(e.proof)throw new sr("Proof field is only allowed for a bls account as consensus key");const n=await this.context.readProvider.getProtocolConstants("head"),a=await this.prepare.updateConsensusKey(e),i=await this.calculateEstimates(a,n);if(a.opOb.contents[0].kind==="reveal"){i.shift();const s=a.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;i[0].opSize-=s}return Ut.createEstimateInstanceFromProperties(i)}async updateCompanionKey(e){const[,r]=At(e.pk,on);if(r!==re.BLS12_381PublicKey)throw new sr("companion key must be a bls account");if(!e.proof)throw new vi("Proof is required to set a bls account as companion key ");const n=await this.context.readProvider.getProtocolConstants("head"),a=await this.prepare.updateCompanionKey(e),i=await this.calculateEstimates(a,n);if(a.opOb.contents[0].kind==="reveal"){i.shift();const s=a.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;i[0].opSize-=s}return Ut.createEstimateInstanceFromProperties(i)}async smartRollupAddMessages(e){const r=await this.context.readProvider.getProtocolConstants("head"),n=await this.prepare.smartRollupAddMessages(e),a=await this.calculateEstimates(n,r);if(n.opOb.contents[0].kind==="reveal"){a.shift();const i=n.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;a[0].opSize-=i}return Ut.createEstimateInstanceFromProperties(a)}async smartRollupOriginate(e){const r=await this.context.readProvider.getProtocolConstants("head"),n=await this.prepare.smartRollupOriginate(e),a=await this.calculateEstimates(n,r);if(n.opOb.contents[0].kind==="reveal"){a.shift();const i=n.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;a[0].opSize-=i}return Ut.createEstimateInstanceFromProperties(a)}async smartRollupExecuteOutboxMessage(e){const r=await this.context.readProvider.getProtocolConstants("head"),n=await this.prepare.smartRollupExecuteOutboxMessage(e),a=await this.calculateEstimates(n,r);return n.opOb.contents[0].kind==="reveal"&&a.shift(),Ut.createEstimateInstanceFromProperties(a)}async contractCall(e){const r=await this.context.readProvider.getProtocolConstants("head"),n=await this.prepare.contractCall(e),a=await this.calculateEstimates(n,r);if(n.opOb.contents[0].kind==="reveal"){a.shift();const i=n.opOb.contents[0].source.startsWith(re.BLS12_381PublicKeyHash)?this.REVEAL_LENGTH_TZ4/2:this.REVEAL_LENGTH/2;a[0].opSize-=i}return Ut.createEstimateInstanceFromProperties(a)}}const DR=[fe.ACTIVATION,fe.ORIGINATION,fe.TRANSACTION,fe.DELEGATION,fe.REGIST
35ER_GLOBAL_CONSTANT,fe.INCREASE_PAID_STORAGE,fe.TRANSFER_TICKET,fe.SMART_ROLLUP_ADD_MESSAGES,fe.SMART_ROLLUP_ORIGINATE,fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE],p0=tt;class j6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}sumProp(e,r){return e.reduce((n,a)=>r in a?Number(a[r])+n:n,0)}getOriginatedContractAddresses(){const e=this.results.filter(n=>n.kind==="origination");let r=[];for(const n of e)n.metadata.operation_result.originated_contracts&&(r=[...r,...n.metadata.operation_result.originated_contracts]);return r}get status(){return this.results.filter(e=>DR.indexOf(e.kind)!==-1).map(e=>xa(e)?e.metadata.operation_result.status:"unknown")[0]||"unknown"}get fee(){return this.sumProp(this.params,"fee")}get gasLimit(){return this.sumProp(this.params,"gas_limit")}get storageLimit(){return this.sumProp(this.params,"storage_limit")}get consumedGas(){return p0.config({DECIMAL_PLACES:0,ROUNDING_MODE:p0.ROUND_UP}),new p0(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(an({contents:this.results}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(an({contents:this.results}),"paid_storage_size_diff"))}get errors(){return es({contents:this.results})}}class xp extends Qs{constructor(e,r){super(e),this.estimator=r,this.operations=[],this.prepare=new fs(this.context)}withTransfer(e){const r=it(e.to);if(e.amount<0)throw new kn(e.amount.toString());if(r!==Se.VALID)throw new st(e.to,r);return this.operations.push({kind:fe.TRANSACTION,...e}),this}withTransferTicket(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);return this.operations.push({kind:fe.TRANSFER_TICKET,...e}),this}withContractCall(e,r={}){return this.withTransfer(e.toTransferParams(r))}withDelegation(e){const r=it(e.source??"");if(e.source&&r!==Se.VALID)throw new st(e.source,r);const n=it(e.delegate??"");if(e.delegate&&n!==Se.VALID)throw new st(e.delegate,n);return this.operations.push({kind:fe.DELEGATION,...e}),this}withActivation({pkh:e,secret:r}){const n=hd(e);if(n!==Se.VALID)throw new td(e,n);return this.operations.push({kind:fe.ACTIVATION,pkh:e,secret:r}),this}withOrigination(e){return this.operations.push({kind:fe.ORIGINATION,...e}),this}withRegisterGlobalConstant(e){return this.operations.push({kind:fe.REGIST
35ER_GLOBAL_CONSTANT,...e}),this}withIncreasePaidStorage(e){return this.operations.push({kind:fe.INCREASE_PAID_STORAGE,...e}),this}withUpdateConsensusKey(e){const[,r]=At(e.pk,on);if(r===re.BLS12_381PublicKey){if(!e.proof)throw new vi("Proof is required to set a bls account as consensus key ")}else if(e.proof)throw new sr("Proof field is only allowed for a bls account as consensus key");return this.operations.push({kind:fe.UPDATE_CONSENSUS_KEY,...e}),this}withUpdateCompanionKey(e){const[,r]=At(e.pk,on);if(r!==re.BLS12_381PublicKey)throw new sr("companion key must be a bls account");if(!e.proof)throw new vi("Proof is required to set a bls account as companion key ");return this.operations.push({kind:fe.UPDATE_COMPANION_KEY,...e}),this}withSmartRollupAddMessages(e){return this.operations.push({kind:fe.SMART_ROLLUP_ADD_MESSAGES,...e}),this}withSmartRollupOriginate(e){return this.operations.push({kind:fe.SMART_ROLLUP_ORIGINATE,...e}),this}withSmartRollupExecuteOutboxMessage(e){return this.operations.push({kind:fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE,...e}),this}async getRPCOp(e){switch(e.kind){case fe.TRANSACTION:return ua({...e});case fe.ORIGINATION:return Kf(await this.context.parser.prepareCodeOrigination({...e}));case fe.DELEGATION:return Gf({...e});case fe.REGISTER_GLOBAL_CONSTANT:return jf({...e});case fe.INCREASE_PAID_STORAGE:return zf({...e});case fe.UPDATE_CONSENSUS_KEY:return Wf({...e});case fe.UPDATE_COMPANION_KEY:return Zf({...e});case fe.TRANSFER_TICKET:return Vf({...e});case fe.SMART_ROLLUP_ADD_MESSAGES:return Yf({...e});case fe.SMART_ROLLUP_ORIGINATE:return Xf({...e});case fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return Jf({...e});default:throw new wi(JSON.stringify(e.kind))}}with(e){for(const r of e)switch(r.kind){case fe.TRANSACTION:this.withTransfer(r);break;case fe.ORIGINATION:this.withOrigination(r);break;case fe.DELEGATION:this.withDelegation(r);break;case fe.ACTIVATION:this.withActivation(r);break;case fe.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(r);break;case fe.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(r);break;case fe.TRANSFER_TICKET:this.withTransferTicket(r);break;case fe.SMART_ROLLUP_ADD_MESSAGES:this.withSmartRollupAddMessages(r);break;case fe.SMART_ROLLUP_ORIGINATE:this.withSmartRollupOriginate(r);break;case fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:this.withSmartRollupExecuteOutboxMessage(r);break;default:throw new wi(JSON.stringify(r.kind))}return this}async send(e){const r=await this.signer.publicKeyHash(),n=e&&e.source||r,a=await this.estimator.batch(this.operations);a.length!==this.operations.length&&a.shift();const i=await this.prepare.batch(this.operations,a),s=await this.forge(i),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new j6(o,i.opOb.contents,n,u,f,c)}}class HR{constructor(e,r){this.context=e,this.estimator=r}batch(e){const r=new xp(this.context,this.estimator);return Array.isArray(e)&&r.with(e),r}}const g0=tt;class Y0 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="delegation"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get delegate(){return this.params.delegate}get isRegisterOperation(){return this.delegate===this.source}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return g0.config({DECIMAL_PLACES:0,ROUNDING_MODE:g0.ROUND_UP}),this.consumedMilliGas?new g0(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get errors(){return this.operationResults?.errors}}const b0=tt;class V6 extends Jt{constructor(e,r,n,a,i,s){super(e,n,a,i),this.params=r,this.contractProvider=s;const o=this.operationResults&&this.operationResults.originated_contracts;Array.isArray(o)&&(this.contractAddress=o[0])}get status(){return this.operationResults?.status??"unknown"}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="origination"),r=e&&xa(e)&&e.metadata.operation_result;return r||void 0}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}
35get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return b0.config({DECIMAL_PLACES:0,ROUNDING_MODE:b0.ROUND_UP}),this.consumedMilliGas?new b0(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get storageDiff(){const e=this.operationResults&&this.operationResults.paid_storage_size_diff;return e||void 0}get storageSize(){const e=this.operationResults&&this.operationResults.storage_size;return e||void 0}get errors(){return this.operationResults?.errors}async contract(e,r){if(!this.contractAddress)throw new u0("No contract was originated in this operation");if(await this.confirmation(e,r),!Number.isFinite(this.includedInBlock))throw new u0("Confirmation completed but includedInBlock was not set");const n=await this.getInclusionBlock();if(!_6(n.hash))throw new u0("Confirmation completed but includedInBlock was not set");return this.contractProvider.at(this.contractAddress,void 0,n.hash)}}const m0=tt;class z6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="register_global_constant"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get registeredExpression(){return this.params.value}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){return this.operationResults?.errors}get consumedGas(){return m0.config({DECIMAL_PLACES:0,ROUNDING_MODE:m0.ROUND_UP}),this.consumedMilliGas?new m0(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){return this.operationResults?.consumed_milligas}}const y0=tt;class W6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(r=>r.kind==="reveal");return e?[e]:[]}get status(){const r=this.operationResults[0];return r?r.metadata.operation_result.status:"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get publicKey(){return this.params.public_key}get proof(){if(this.params.proof)return this.params.proof;throw new sr("Only BLS key has proof")}sumProp(e,r){return e.reduce((n,a)=>r in a?Number(a[r])+n:n,0)}get consumedGas(){return y0.config({DECIMAL_PLACES:0,ROUNDING_MODE:y0.ROUND_UP}),new y0(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(an({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(an({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(an({contents:this.operationResults}),"storage_size"))}get errors(){return es({contents:this.operationResults})}}const No=tt;class ws extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(r=>r.kind==="transaction");return e?[e]:[]}get status(){const r=this.operationResults[0];return r?r.metadata.operation_result.status:"unknown"}get amount(){return new No(this.params.amount)}get destination(){return this.params.destination}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}sumProp(e,r){return e.reduce((n,a)=>r in a?Number(a[r])+n:n,0)}get consumedGas(){return No.config({DECIMAL_PLACES:0,ROUNDING_MODE:No.ROUND_UP}),new No(this.consumedMilliGas).dividedBy(1e3).toString()}get consumedMilliGas(){return String(this.sumProp(an({contents:this.operationResults}),"consumed_milligas"))}get storageDiff(){return String(this.sumProp(an({contents:this.operationResults}),"paid_storage_size_diff"))}get storageSize(){return String(this.sumProp(an({contents:this.operationResults}),"storage_size"))}get errors(){return es({contents:this.operationResults})}}const v0=tt;class Z6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind===fe.TRANSFER_TICKET),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}
35get storageLimit(){return Number(this.params.storage_limit)}get consumedGas(){return v0.config({DECIMAL_PLACES:0,ROUNDING_MODE:v0.ROUND_UP}),this.consumedMilliGas?new v0(this.consumedMilliGas).dividedBy(1e3).toString():void 0}get consumedMilliGas(){return this.operationResults?.consumed_milligas}}class Y6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="increase_paid_storage"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get errors(){return this.operationResults?.errors}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}class X6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const r=Array.isArray(this.results)&&this.results.find(n=>n.kind==="ballot");return r||void 0}get period(){return this.operationResults?.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}class J6 extends Jt{constructor(e,r,n,a,i){super(e,n,a,i),this.params=r}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="drain_delegate"),r=e&&e.metadata&&e.metadata.balance_updates;return r||void 0}get consensusKey(){return this.params.consensus_key}get delegate(){return this.params.delegate}get destination(){return this.params.destination}}class Q6 extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const r=Array.isArray(this.results)&&this.results.find(n=>n.kind==="proposals");return r||void 0}get proposals(){return this.params.proposals}get period(){return this.operationResults?.period}}class e_ extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="update_consensus_key"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get proof(){if(this.params.proof)return this.params.proof;throw new sr("Only updating consensus key to a BLS account has proof")}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get errors(){return this.operationResults?.errors}}class t_ extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="update_companion_key"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get pk(){return this.params.pk}get proof(){if(this.params.proof)return this.params.proof;throw new sr("Only updating companion key to a BLS account has proof")}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get errors(){return this.operationResults?.errors}}class r_ extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind==="smart_rollup_add_messages"),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get message(){return this.params.message}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get errors(){return this.operationResults?.errors}}class n_ extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind===fe.SMART_ROLLUP_ORIGINATE),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}
35get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){return this.operationResults?.errors}}class FR extends Jt{constructor(e,r,n,a,i,s){super(e,a,i,s),this.params=r,this.source=n}get operationResults(){const e=Array.isArray(this.results)&&this.results.find(n=>n.kind===fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),r=e&&e.metadata&&e.metadata.operation_result;return r||void 0}get status(){return this.operationResults?.status??"unknown"}get rollup(){return this.params.rollup}get cementedCommitment(){return this.params.cemented_commitment}get outputProof(){return this.params.output_proof}get fee(){return Number(this.params.fee)}get gasLimit(){return Number(this.params.gas_limit)}get storageLimit(){return Number(this.params.storage_limit)}get consumedMilliGas(){return this.operationResults?.consumed_milligas}get errors(){return this.operationResults?.errors}}const qR=[0,200,400,800],$R=t=>new Promise(e=>{setTimeout(e,t)}),Ap=t=>t instanceof qn&&t.status===Ga.NOT_FOUND,X0=async(t,e=qR)=>{let r;for(const n of e){n>0&&await $R(n);try{return await t()}catch(a){if(!Ap(a))throw a;r=a}}throw r};class KR extends Qs{constructor(e,r){super(e),this.estimator=r,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new fs(this.context)}async getStorage(e,r,n="head"){const a=pa(e);if(a!==Se.VALID)throw new ha(e,a);const i=n==="head"?await X0(()=>this.context.readProvider.getScript(e,"head")):await this.context.readProvider.getScript(e,n);r||(r=i);let s;return jr.isSchema(r)?s=r:s=jr.fromRPCResponse({script:r}),s.Execute(i.storage,hf(this,n))}async getBigMapKeyByID(e,r,n,a){const{key:i,type:s}=n.EncodeBigMapKey(r),{packed:o}=await this.context.packer.packData({data:i,type:s}),c=U4(o),u=a??"head",f=await this.context.readProvider.getBigMapValue({id:e.toString(),expr:c},u);return n.ExecuteOnBigMapValue(f,hf(this,u))}async getBigMapKeysByID(e,r,n,a,i=5){const s=await this.getBlockForRequest(r,a),o=new dr;let c=0,u=[];for(;c<r.length;){const l=r.slice(c,c+i).map(p=>this.getBigMapValueOrUndefined(p,e,n,s));u=[...u,...await Promise.all(l)],c+=i}for(let f=0;f<u.length;f++)o.set(r[f],u[f]);return o}async getBlockForRequest(e,r){return e.length===1||typeof r<"u"?r:await this.context.readProvider.getBlockLevel("head")}async getBigMapValueOrUndefined(e,r,n,a){try{return await this.getBigMapKeyByID(r,e,n,a)}catch(i){if(i instanceof qn&&i.status===Ga.NOT_FOUND)return;throw i}}async getSaplingDiffByID(e,r="head"){return this.context.readProvider.getSaplingDiffById({id:e.toString()},r)}async originate(e){const r=await this.estimate(e,this.estimator.originate.bind(this.estimator)),n=await this.prepare.originate({...e,...r}),a=n.opOb.contents.find(f=>f.kind===fe.ORIGINATION),i=await this.forge(n),{hash:s,context:o,forgedBytes:c,opResponse:u}=await this.signAndInject(i);return new V6(s,a,c,u,o,this)}async setDelegate(e){const r=it(e.source??"");if(e.source&&r!==Se.VALID)throw new st(e.source,r);const n=it(e.delegate??"");if(e.delegate&&n!==Se.VALID)throw new st(e.delegate,n);if(/^kt1/i.test(e.source??""))throw new I6(e.source??"");const a=await this.signer.publicKeyHash(),i=e.source||a,s=await this.estimate(e,this.estimator.setDelegate.bind(this.estimator)),o=await this.prepare.delegation({...e,...s}),c=o.opOb.contents.find(v=>v.kind===fe.DELEGATION),u=await this.forge(o),{hash:f,context:l,forgedBytes:p,opResponse:b}=await this.signAndInject(u);return new Y0(f,c,i,p,b,l)}async registerDelegate(e){const r=await this.estimate(e,this.estimator.registerDelegate.bind(this.estimator)),n=await this.signer.publicKeyHash(),a=await this.prepare.registerDelegate({...e,...r}),i=a.opOb.contents.find(l=>l.kind===fe.DELEGATION),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new Y0(o,i,n,u,f,c)}async transfer(e){const r=it(e.to);if(r!==Se.VALID)throw new st(e.to,r);const n=it(e.source??"");if(e.source&&n!==Se.VALID)throw new st(e.source,n);if(e.amount<0)throw new kn(e.amount.toString());const a=await this.signer.publicKeyHash(),i=await this.estimate(e,this.estimator.transfer.bind(this.estimator)),s=e.source||a,o=await this.prepare.transaction({...e,...i}),c=o.opOb.contents.find(v=>v.kind===fe.TRANSACTION),u=await this.forge(o),{hash:f,context:l,forgedBytes:p,opResponse:b}=await this.signAndInject(u);return new ws(f,c,s,p,b,l)}async stake(e){const r=it(e.source??"");if(e.source&&r!==Se.VALID)throw new st(e.source,r);if(e.to||(e.to=e.source),e.to&&e.to!==e.source)throw new Ka(e.to);if(e.amount<0)throw new kn(e.amount.toString());const n=await this.signer.publicKeyHash(),a=await this.estimate(e,this.estimator.stake.bind(this.estimator)),i=e.source||n,s=await this.prepare.stake({...e,...a}),o=s.opOb.contents.find(b=>b.kind===fe.TRANSACTION),c=await this.forge(s),{hash:u,context:f,forgedBytes:l,opResponse:p}=await this.signAndInject(c);return new ws(u,o,i,l,p,f)}async unstake(e){const r=it(e.source??"");if(e.source&&r!==Se.VALID)throw new st(e.source,r);if(e.to||(e.to=e.source),e.to&&e.to!==e.source)throw new Ka(e.to);if(e.amount<0)throw new kn(e.amount.toString());const n=await this.signer.publicKeyHash(),a=await this.estimate(e,this.estimator.unstake.bind(this.estimator)),i=e.source||n,s=await this.prepare.unstake({...e,...a}),o=s.opOb.contents.find(b=>b.kind===fe.TRANSACTION),c=await this.forge(s),{hash:u,context:f,forgedBytes:l,opResponse:p}=await this.signAndInject(c);return new ws(u,o,i,l,p,f)}async finalizeUnstake(e){const r=it(e.source??"");if(e.source&&r!==Se.VALID)throw new st(e.source,r);if(e.to||(e.to=e.source),e.amount||(e.amount=0),e.amount!==void 0&&e.amount>0)throw new Mv("Amount must be 0 to finalize unstake.");const n=await this.signer.publicKeyHash(),a=await this.estimate(e,this.estimator.finalizeUnstake.bind(this.estimator)),i=e.source||n,s=await this.prepare.finalizeUnstake({...e,...a}),o=s.opOb.contents.find(b=>b.kind===fe.TRANSACTION),c=await this.forge(s),{hash:u,context:f,forgedBytes:l,opResponse:p}=await this.signAndInject(c);return new ws(u,o,i,l,p,f)}async transferTicket(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);const n=it(e.source??"");if(e.source&&n!==Se.VALID)throw new st(e.source,n);const a=await this.signer.publicKeyHash(),i=e.source??a,s=await this.estimate(e,this.estimator.transferTicket.bind(this.estimator)),o=await this.prepare.transferTicket({...e,...s}),c=o.opOb.contents.find(v=>v.kind===fe.TRANSFER_TICKET),u=await this.forge(o),{hash:f,context:l,forgedBytes:p,opResponse:b}=await this.signAndInject(u);return new Z6(f,c,i,p,b,l)}async reveal(e){const r=await this.signer.publicKeyHash(),[,n]=At(r,da);if(n===re.BLS12_381PublicKeyHash)if(e.proof)At(e.proof,[re.BLS12_381Signature]);else{const{prefixSig:i}=await this.signer.provePossession();e.proof=i}else if(e.proof)throw new sr("Proof field is only allowed to reveal a bls account ");const a=await this.estimator.reveal(e);if(a){const i=await this.estimate(e,async()=>a),s=await this.prepare.reveal({...e,...i}),o=s.opOb.contents.find(b=>b.kind===fe.REVEAL),c=await this.forge(s),{hash:u,context:f,forgedBytes:l,opResponse:p}=await this.signAndInject(c);return new W6(u,o,r,l,p,f)}else throw new P6(`The publicKeyHash '${r}' has already been revealed.`)}async registerGlobalConstant(e){const r=await this.signer.publicKeyHash(),n=await this.estimate(e,this.estimator.registerGlobalConstant.bind(this.estimator)),a=await this.prepare.registerGlobalConstant({...e,...n}),i=a.opOb.contents.find(l=>
35l.kind===fe.REGISTER_GLOBAL_CONSTANT),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new z6(o,i,r,u,f,c)}async increasePaidStorage(e){if(e.amount<=0)throw new kn(e.amount.toString());const r=await this.signer.publicKeyHash(),n=await this.estimate(e,this.estimator.increasePaidStorage.bind(this.estimator)),a=await this.prepare.increasePaidStorage({...e,...n}),i=a.opOb.contents.find(l=>l.kind===fe.INCREASE_PAID_STORAGE),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new Y6(o,i,r,u,f,c)}async drainDelegate(e){const r=await this.prepare.drainDelegate(e),n=r.opOb.contents.find(u=>u.kind===fe.DRAIN_DELEGATE),a=await this.forge(r),{hash:i,context:s,forgedBytes:o,opResponse:c}=await this.signAndInject(a);return new J6(i,n,o,c,s)}async ballot(e){const r=await this.signer.publicKeyHash(),n=it(e.source??"");if(e.source&&n!==Se.VALID)throw new st(e.source,n);const a=e.source??r,i=await this.prepare.ballot({...e,source:a}),s=i.opOb.contents.find(p=>p.kind===fe.BALLOT),o=await this.forge(i),{hash:c,context:u,forgedBytes:f,opResponse:l}=await this.signAndInject(o);return new X6(c,s,r,f,l,u)}async proposals(e){const r=await this.signer.publicKeyHash(),n=it(e.source??"");if(e.source&&n!==Se.VALID)throw new st(e.source,n);const a=e.source??r,i=await this.prepare.proposals({...e,source:a}),s=i.opOb.contents.find(p=>p.kind===fe.PROPOSALS),o=await this.forge(i),{hash:c,context:u,forgedBytes:f,opResponse:l}=await this.signAndInject(o);return new Q6(c,s,r,f,l,u)}async updateConsensusKey(e){const r=await this.signer.publicKeyHash(),[,n]=At(e.pk,on);if(n===re.BLS12_381PublicKey){if(!e.proof)throw new vi("Proof is required to set a bls account as consensus key ")}else if(e.proof)throw new sr("Proof field is only allowed for a bls account as consensus key");const a=await this.estimate(e,this.estimator.updateConsensusKey.bind(this.estimator)),i=await this.prepare.updateConsensusKey({...e,...a}),s=i.opOb.contents.find(p=>p.kind===fe.UPDATE_CONSENSUS_KEY),o=await this.forge(i),{hash:c,context:u,forgedBytes:f,opResponse:l}=await this.signAndInject(o);return new e_(c,s,r,f,l,u)}async updateCompanionKey(e){const r=await this.signer.publicKeyHash(),[,n]=At(e.pk,on);if(n!==re.BLS12_381PublicKey)throw new sr("Proof field is only allowed for a bls account as companion key");if(!e.proof)throw new vi("Proof is required to set a bls account as companion key ");const a=await this.estimate(e,this.estimator.updateCompanionKey.bind(this.estimator)),i=await this.prepare.updateCompanionKey({...e,...a}),s=i.opOb.contents.find(p=>p.kind===fe.UPDATE_COMPANION_KEY),o=await this.forge(i),{hash:c,context:u,forgedBytes:f,opResponse:l}=await this.signAndInject(o);return new t_(c,s,r,f,l,u)}async smartRollupAddMessages(e){const r=await this.signer.publicKeyHash(),n=await this.estimate(e,this.estimator.smartRollupAddMessages.bind(this.estimator)),a=await this.prepare.smartRollupAddMessages({...e,...n}),i=a.opOb.contents.find(l=>l.kind===fe.SMART_ROLLUP_ADD_MESSAGES),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new r_(o,i,r,u,f,c)}async smartRollupOriginate(e){const r=await this.signer.publicKeyHash(),n=await this.estimate(e,this.estimator.smartRollupOriginate.bind(this.estimator)),a=await this.prepare.smartRollupOriginate({...e,...n}),i=a.opOb.contents.find(l=>l.kind===fe.SMART_ROLLUP_ORIGINATE),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new n_(o,i,r,u,f,c)}async smartRollupExecuteOutboxMessage(e){const r=await this.signer.publicKeyHash(),n=await this.estimate(e,this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)),a=await this.prepare.smartRollupExecuteOutboxMessage({...e,...n}),i=a.opOb.contents.find(l=>l.kind===fe.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),s=await this.forge(a),{hash:o,context:c,forgedBytes:u,opResponse:f}=await this.signAndInject(s);return new FR(o,i,r,u,f,c)}async failingNoop(e){const r={kind:fe.FAILING_NOOP,arbitrary:e.arbitrary},n=await this.context.readProvider.getBlockHash(e.basedOnBlock),a=await this.context.forger.forge({branch:n,contents:[r]}),{prefixSig:i}=await this.signer.sign(a,new Uint8Array([3]));return{signature:i,bytes:a,signedContent:{branch:n,contents:[{kind:fe.FAILING_NOOP,arbitrary:e.arbitrary}]}}}async at(e,r=a=>a,n="head"){const a=pa(e);if(a!==Se.VALID)throw new ha(e,a);const i=this.context.withExtensions().rpc,s=this.context.withExtensions().readProvider,o=async f=>{const l=await s.getScript(e,f),p=f==="head"?await s.getEntrypoints(e):await i.getEntrypoints(e,{block:String(f)});return{script:l,entrypoints:p}};let c;try{c=await o(n)}catch(f){if(n!=="head"&&Ap(f))c=await X0(()=>o("head"));else throw f}const u=new Cs(e,c.script,this,this,c.entrypoints,i,s,"head");return r(u,this.context)}
35async atExactBlock(e,r=a=>a,n){const a=pa(e);if(a!==Se.VALID)throw new ha(e,a);const i=this.context.withExtensions().rpc,s=this.context.withExtensions().readProvider,o=await s.getScript(e,n),c=await i.getEntrypoints(e,{block:String(n)}),u=new Cs(e,o,this,this,c,i,s,n);return r(u,this.context)}batch(e){const r=new xp(this.context,this.estimator);return Array.isArray(e)&&r.with(e),r}}class i_{constructor(e,r){this.walletProvider=e,this.context=r,this.operations=[]}withTransfer(e){const r=it(e.to);if(r!==Se.VALID)throw new st(e.to,r);return this.operations.push({kind:fe.TRANSACTION,...e}),this}withContractCall(e,r={}){return this.withTransfer(e.toTransferParams(r))}withDelegation(e){const r=it(e.delegate??"");if(e.delegate&&r!==Se.VALID)throw new st(e.delegate,r);return this.operations.push({kind:fe.DELEGATION,...e}),this}withOrigination(e){return this.operations.push({kind:fe.ORIGINATION,...e}),this}withIncreasePaidStorage(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);return this.operations.push({kind:fe.INCREASE_PAID_STORAGE,...e}),this}withTransferTicket(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);return this.operations.push({kind:fe.TRANSFER_TICKET,...e}),this}withRegisterGlobalConstant(e){return this.operations.push({kind:fe.REGIST
35ER_GLOBAL_CONSTANT,...e}),this}async mapOperation(e){switch(e.kind){case fe.TRANSACTION:return this.walletProvider.mapTransferParamsToWalletParams(async()=>e);case fe.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams(async()=>this.context.parser.prepareCodeOrigination({...e}));case fe.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams(async()=>e);case fe.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams(async()=>e);case fe.REGISTER_GLOBAL_CONSTANT:return this.walletProvider.mapRegisterGlobalConstantParamsToWalletParams(async()=>e);case fe.TRANSFER_TICKET:return this.walletProvider.mapTransferTicketParamsToWalletParams(async()=>e);default:throw new wi(JSON.stringify(e.kind))}}with(e){for(const r of e)switch(r.kind){case fe.TRANSACTION:this.withTransfer(r);break;case fe.ORIGINATION:this.withOrigination(r);break;case fe.DELEGATION:this.withDelegation(r);break;case fe.INCREASE_PAID_STORAGE:this.withIncreasePaidStorage(r);break;case fe.REGISTER_GLOBAL_CONSTANT:this.withRegisterGlobalConstant(r);break;case fe.TRANSFER_TICKET:this.withTransferTicket(r);break;default:throw new wi(JSON.stringify(r.kind))}return this}async send(){const e=[];for(const n of this.operations)e.push(await this.mapOperation(n));const r=await this.walletProvider.sendOperations(e);return this.context.operationFactory.createBatchOperation(r)}}class Rp{constructor(e){this.context=e,this.walletCommand=r=>({send:r})}get walletProvider(){return this.context.walletProvider}async pkh({forceRefetch:e}={}){return(!this._pkh||e)&&(this._pkh=await this.walletProvider.getPKH()),this._pkh}async pk({forceRefetch:e}={}){return(!this._pk||e)&&(this._pk=await this.walletProvider.getPK()),this._pk}originate(e){return this.walletCommand(async()=>{const r=await this.walletProvider.mapOriginateParamsToWalletParams(()=>this.context.parser.prepareCodeOrigination({...e})),n=await this.walletProvider.sendOperations([r]);return this.context.operationFactory.createOriginationOperation(n)})}setDelegate(e){const r=it(e.delegate??"");if(e.delegate&&r!==Se.VALID)throw new st(e.delegate,r);return this.walletCommand(async()=>{const n=await this.walletProvider.mapDelegateParamsToWalletParams(async()=>e),a=await this.walletProvider.sendOperations([n]);return this.context.operationFactory.createDelegationOperation(a)})}async signFailingNoop(e){const r={kind:fe.FAILING_NOOP,arbitrary:e.arbitrary},n=await this.context.readProvider.getBlockHash(e.basedOnBlock),a=await this.context.forger.forge({branch:n,contents:[r]});return{signature:await this.walletProvider.sign(a,Uint8Array.from([3])),bytes:a,signedContent:{branch:n,contents:[{kind:fe.FAILING_NOOP,arbitrary:e.arbitrary}]}}}registerDelegate(){return this.walletCommand(async()=>{const e=await this.walletProvider.mapDelegateParamsToWalletParams(async()=>({delegate:await this.pkh()})),r=await this.walletProvider.sendOperations([e]);return this.context.operationFactory.createDelegationOperation(r)})}transfer(e){const r=it(e.to);if(r!==Se.VALID)throw new st(e.to,r);return this.walletCommand(async()=>{const n=await this.walletProvider.mapTransferParamsToWalletParams(async()=>e),a=await this.walletProvider.sendOperations([n]);return this.context.operationFactory.createTransactionOperation(a)})}transferTicket(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);return this.walletCommand(async()=>{const n=await this.walletProvider.mapTransferTicketParamsToWalletParams(async()=>e),a=await this.walletProvider.sendOperations([n]);return this.context.operationFactory.createTransferTicketOperation(a)})}stake(e){return this.walletCommand(async()=>{const r=await this.walletProvider.mapStakeParamsToWalletParams(async()=>{const a=await this.pkh();if(e.to||(e.to=a),e.to!==a)throw new Ka(e.to);return e.parameter={entrypoint:"stake",value:{prim:"Unit"}},e}),n=await this.walletProvider.sendOperations([r]);return this.context.operationFactory.createTransactionOperation(n)})}unstake(e){return this.walletCommand(async()=>{const r=await this.walletProvider.mapUnstakeParamsToWalletParams(async()=>{const a=await this.pkh();if(e.to||(e.to=a),e.to!==a)throw new Ka(e.to);return e.parameter={entrypoint:"unstake",value:{prim:"Unit"}},e}),n=await this.walletProvider.sendOperations([r]);return await this.context.operationFactory.createTransactionOperation(n)})}finalizeUnstake(e){return this.walletCommand(async()=>{const r=await this.walletProvider.mapFinalizeUnstakeParamsToWalletParams(async()=>{const a=await this.pkh();if(e.to||(e.to=a),e.amount||(e.amount=0),e.amount!==0)throw new Mv("Amount must be 0 to finalize unstake.");return e.parameter={entrypoint:"finalize_unstake",value:{prim:"Unit"}},e}),n=await this.walletProvider.sendOperations([r]);return await this.context.operationFactory.createTransactionOperation(n)})}increasePaidStorage(e){const r=it(e.destination);if(r!==Se.VALID)throw new st(e.destination,r);return this.walletCommand(async()=>{const n=await this.walletProvider.mapIncreasePaidStorageWalletParams(async()=>e),a=await this.walletProvider.sendOperations([n]);return this.context.operationFactory.createIncreasePaidStorageOperation(a)})}registerGlobalConstant(e){return this.walletCommand(async()=>{const r=await this.walletProvider.mapRegisterGlobalConstantParamsToWalletParams(async()=>e),n=await this.walletProvider.sendOperations([r]);return this.context.operationFactory.createRegisterGlobalConstantOperation(n)})}batch(e){const r=new i_(this.walletProvider,this.context);return Array.isArray(e)&&r.with(e),r}async at(e,r=a=>a,n="head"){const a=pa(e);if(a!==Se.VALID)throw new ha(e,a);const i=this.context.withExtensions().rpc,s=this.context.withExtensions().readProvider,o=async f=>{const l=await s.getScript(e,f),p=f==="head"?await s.getEntrypoints(e):await i.getEntrypoints(e,{block:String(f)});return{script:l,entrypoints:p}};let c;try{c=await o(n)}catch(f){if(n!=="head"&&Ap(f))c=await X0(()=>o("head"));else throw f}const u=new Cs(e,c.script,this,this.context.contract,c.entrypoints,i,s,"head");return r(u,this.context)}
35async atExactBlock(e,r=a=>a,n){const a=pa(e);if(a!==Se.VALID)throw new ha(e,a);const i=this.context.withExtensions().rpc,s=this.context.withExtensions().readProvider,o=await s.getScript(e,n),c=await i.getEntrypoints(e,{block:String(n)}),u=new Cs(e,o,this,this.context.contract,c,i,s,n);return r(u,this.context)}}class Ip{constructor(e){this.context=e}async getPKH(){return this.context.signer.publicKeyHash()}async getPK(){return this.context.signer.publicKey()}async mapTransferParamsToWalletParams(e){return Zr(await e(),fe.TRANSACTION)}async mapStakeParamsToWalletParams(e){return Zr(await e(),fe.TRANSACTION)}async mapUnstakeParamsToWalletParams(e){return Zr(await e(),fe.TRANSACTION)}async mapFinalizeUnstakeParamsToWalletParams(e){return Zr(await e(),fe.TRANSACTION)}async mapOriginateParamsToWalletParams(e){return Zr(await e(),fe.ORIGINATION)}async mapDelegateParamsToWalletParams(e){return Zr(await e(),fe.DELEGATION)}async mapIncreasePaidStorageWalletParams(e){return Zr(await e(),fe.INCREASE_PAID_STORAGE)}async mapTransferTicketParamsToWalletParams(e){return Zr(await e(),fe.TRANSFER_TICKET)}async mapRegisterGlobalConstantParamsToWalletParams(e){return Zr(await e(),fe.REGISTER_GLOBAL_CONSTANT)}async sendOperations(e){return(await this.context.batch.batch(e).send()).hash}async sign(e,r){const{prefixSig:n}=await this.context.signer.sign(e,r);return n}}class Bp{constructor(e){this.context=e}async getNextProto(){if(!this.context.proto){const e=await this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}async parseScript(e){return new ca({protocol:await this.getNextProto()}).parseScript(e)}async parseMichelineExpression(e){return new ca({protocol:await this.getNextProto()}).parseMichelineExpression(e)}async parseJSON(e){return new ca({protocol:await this.getNextProto()}).parseJSON(e)}async prepareCodeOrigination(e){const r=e;if(r.code=await this.formatCodeParam(e.code),e.init)r.init=await this.formatInitParam(e.init);else if(e.storage){const n=r.code.find(s=>"prim"in s&&s.prim==="storage");if(!n?.args)throw new ks("The storage section is missing from the script",e.code);const a=new jr(n.args[0]),i=await this.findGlobalConstantsHashAndValue(a);if(Object.keys(i).length!==0){const o=new ca({expandGlobalConstant:i}).parseJSON(n.args[0]),c=new jr(o);r.init=c.Encode(e.storage)}else r.init=a.Encode(e.storage);delete r.storage}return r}async formatCodeParam(e){let r;if(typeof e=="string"){const n=await this.parseScript(e);if(n===null)throw new ks("Unable to parse",e);r=n}else{const n=await this.parseJSON(e),a=["parameter","storage","code"];r=n.sort((i,s)=>a.indexOf(i.prim)-a.indexOf(s.prim))}return r}async formatInitParam(e){let r;if(typeof e=="string"){const n=await this.parseMichelineExpression(e);if(n===null)throw new Sp("Invalid init parameter",e);r=n}else r=await this.parseJSON(e);return r}async findGlobalConstantsHashAndValue(e){const r=e.findToken("constant"),n={};if(r.length!==0)for(const a of r){const i=a.tokenVal.args;if(i){const s=i[0];if(s.string){const o=s.string,c=await this.context.globalConstantsProvider.getGlobalConstantByHash(o);Object.assign(n,{[o]:c})}}}return n}}class Tp{constructor(e){this.context=e}async packData(e){return this.context.rpc.packData(e)}}class a_ extends ed{constructor(){super(),this.name="UnconfiguredGlobalConstantsProviderError",this.message="No global constants provider has been configured. Please configure one by calling setGlobalConstantsProvider({globalConstantsProvider}) on your TezosToolkit instance."}}class s_{async getGlobalConstantByHash(e){throw new a_}}class Pp{constructor(e){this.rpc=e}async getBalance(e,r){return this.rpc.getBalance(e,{block:String(r)})}async getSpendable(e,r){return this.rpc.getSpendable(e,{block:String(r)})}async getDelegate(e,r){return this.rpc.getDelegate(e,{block:String(r)})}async getNextProtocol(e){return(await this.rpc.getProtocols({block:String(e)})).next_protocol}async getProtocolConstants(e){const{time_between_blocks:r,minimal_block_delay:n,hard_gas_limit_per_operation:a,hard_gas_limit_per_block:i,hard_storage_limit_per_operation:s,cost_per_byte:o,smart_rollup_origination_size:c}=await this.rpc.getConstants({block:String(e)});return{time_between_blocks:r,minimal_block_delay:n,hard_gas_limit_per_operation:a,hard_gas_limit_per_block:i,hard_storage_limit_per_operation:s,cost_per_byte:o,smart_rollup_origination_size:c}}async getScript(e,r){const{script:n}=await this.rpc.getContract(e,{block:String(r)});return n}async getStorage(e,r){return this.rpc.getStorage(e,{block:String(r)})}async getBlockHash(e){const{hash:r}=await this.rpc.getBlockHeader({block:String(e)});return r}async getBlockLevel(e){const{level:r}=await this.rpc.getBlockHeader({block:String(e)});return r}async getCounter(e,r){const{counter:n}=await this.rpc.getContract(e,{block:String(r)});return n||"0"}async getBlockTimestamp(e){const{timestamp:r}=await this.rpc.getBlockHeader({block:String(e)});return r}async getBigMapValue(e,r){return this.rpc.getBigMapExpr(e.id,e.expr,{block:String(r)})}async getSaplingDiffById(e,r){return this.rpc.getSaplingDiffById(e.id,{block:String(r)})}async getSaplingDiffByContract(e,r){return this.rpc.getSaplingDiffByContract(e,{block:String(r)})}async getEntrypoints(e){return this.rpc.getEntrypoints(e)}async getChainId(){return this.rpc.getChainId()}async isAccountRevealed(e,r){const n=await this.rpc.getManagerKey(e,{block:String(r)});return n&&typeof n=="object"?!!n.key:!!n}async getBlock(e){return this.rpc.getBlock({block:String(e)})}getLiveBlocks(e){return this.rpc.getLiveBlocks({block:String(e)})}getAdaptiveIssuanceLaunchCycle(e){return this.rpc.getAdaptiveIssuanceLaunchCycle({block:String(e)})}}class Tv extends Ce{constructor(e){super(),this.type=e,this.name="UnsupportedEventError",this.message=`Unsupported event type "${e}" expecting one of the "data", "error", or "close".`}}class GR extends Ce{constructor(e){super(),this.invalidExpression=e,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}const jR=(t,e)=>t.hash===e.opHash,VR=(t,e)=>{switch(t.kind){case"attestation":return"metadata"in t&&t.metadata.delegate===e.source;case"activate_account":return"metadata"in t&&t.pkh===e.source;default:return"source"in t&&t.source===e.source}},zR=(t,e)=>"kind"in t&&t.kind===e.kind,WR=(t,e)=>{switch(t.kind){case"delegation":return t.delegate===e.destination;case"origination":if("metadata"in t&&"operation_result"in t.metadata&&"originated_contracts"in t.metadata.operation_result&&Array.isArray(t.metadata.operation_result.originated_contracts))return t.metadata.operation_result.originated_contracts.some(r=>r===e.destination);break;case"transaction":return t.destination===e.destination;default:return!1}},ZR=(t,e,r,n)=>!(t.kind!=="event"||r&&t.tag!==r||e&&t.source!==e||n&&t.result.status!=="applied"),YR=(t,e)=>"opHash"in e?jR(t,e):"source"in e?VR(t,e):"kind"in e?zR(t,e):"destination"in e?WR(t,e):!1,XR=(t,e)=>{if(Array.isArray(e.and))return e.and.every(r=>J0(t,r));if(Array.isArray(e.or))return e.or.some(r=>J0(t,r));throw new GR(e)},J0=(t,e)=>{const r=[];return Array.isArray(e)?r.push(...e):r.push(e),r.every(n=>"and"in n||"or"in n?XR(t,n):YR(t,n))};class _s{constructor(e,r=!1,n=ww()){this.shouldRetry=r,this.operatorFunction=n,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new Gs,e.pipe(WE(this.completed$),ef(a=>{this.call(this.messageListeners,a)},a=>{this.call(this.errorListeners,a)},()=>{this.call(this.closeListeners)}),this.shouldRetry?n:ef(),If(()=>HE)).subscribe()}call(e,r){for(const n of e)try{n(r)}catch(a){console.error(a)}}remove(e,r){const n=e.indexOf(r);n!==-1&&e.splice(n,1)}on(e,r){switch(e){case"data":this.messageListeners.push(r);break;case"error":this.errorListeners.push(r);break;
35case"close":this.closeListeners.push(r);break;default:throw new Tv(e)}}off(e,r){switch(e){case"data":this.remove(this.messageListeners,r);break;case"error":this.remove(this.errorListeners,r);break;case"close":this.remove(this.closeListeners,r);break;default:throw new Tv(e)}}close(){this.completed$.next()}}const JR={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:ww()},QR=t=>Ai(t.rpc.getBlock()).pipe(en()),eI=t=>js(e=>new Ht(r=>{for(const n of e.operations)for(const a of n)for(const i of a.contents)J0({hash:a.hash,...i},t)&&r.next({hash:a.hash,...i});r.complete()})),tI=t=>js(e=>new Ht(r=>{for(const n of e.operations)for(const a of n)for(const i of a.contents){const o=i.metadata.internal_operation_results;if(o)for(const c of o)ZR(c,t?.address,t?.tag,t?.excludeFailedOperations)&&r.next({opHash:a.hash,blockHash:e.hash,level:e.header.level,...c})}r.complete()}));class lf{constructor(e,r={}){this.context=e,this._config$=new xf({...JR,...r}),this.timer$=this._config$.pipe(yi(n=>n?.pollingIntervalMilliseconds),bi(n=>n?O0(0,n):Ai(this.getConfirmationPollingInterval()).pipe(bi(a=>O0(0,a))))),this.newBlock$=this.timer$.pipe(VE(()=>QR(this.context)),KE("hash"),Ms({resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!0}))}get config(){return this._config$.getValue()}async getConfirmationPollingInterval(){if(!this.config.pollingIntervalMilliseconds)try{const n=await this.context.readProvider.getProtocolConstants("head"),i=(n.minimal_block_delay?n.minimal_block_delay.multipliedBy(1e3):new tt(5e3)).dividedBy(3);this.config.pollingIntervalMilliseconds=i.toNumber()===0?700:Math.max(i.toNumber(),700)}catch{return 5e3}return this.config.pollingIntervalMilliseconds}subscribeBlock(e){return new _s(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(e){return new _s(this.newBlock$.pipe(yi(r=>r?.hash)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(e){return new _s(this.newBlock$.pipe(eI(e)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(e){return new _s(this.newBlock$.pipe(tI(e)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}}class Mp{constructor(e){this.context=e}async getNextProto(){if(!this.context.proto){const e=await this.context.readProvider.getNextProtocol("head");this.context.proto=e}return this.context.proto}async forge({branch:e,contents:r}){return new c6(await this.getNextProto()).forge({branch:e,contents:r})}}const o_={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class Us{constructor(e,r=new j0,n,a=new xf({...o_}),i,s,o,c,u,f,l,p){this._rpc=e,this._signer=r,this._proto=n,this._config=a,this.providerDecorator=[],this.tz=new CR(this),this.estimate=new G6(this),this.contract=new KR(this,this.estimate),this.prepare=new fs(this),this.batch=new HR(this,this.estimate),this.wallet=new Rp(this),this.withExtensions=()=>{let b=this.clone();return this.providerDecorator.forEach(v=>{b=v(b)}),b},typeof this._rpc=="string"?this._rpcClient=new ko(this._rpc):this._rpcClient=this._rpc,this._forger=i||new Mp(this),this._injector=s||new yp(this),this.operationFactory=new RR(this),this._walletProvider=c||new Ip(this),this._parser=u||new Bp(this),this._packer=o||new Tp(this),this._globalConstantsProvider=f||new s_,this._readProvider=l||new Pp(this._rpcClient),this._stream=p||new lf(this)}get config(){return this._config.getValue()}set config(e){this._config.next({...e})}setPartialConfig(e){this._config.next({...this._config.getValue(),...e})}get rpc(){return this._rpcClient}set rpc(e){this._rpcClient=e}get injector(){return this._injector}set injector(e){this._injector=e}get forger(){return this._forger}set forger(e){this._forger=e}get signer(){return this._signer}set signer(e){this._signer=e}get walletProvider(){return this._walletProvider}set walletProvider(e){this._walletProvider=e}set proto(e){this._proto=e}get proto(){return this._proto}get parser(){return this._parser}set parser(e){this._parser=e}get packer(){return this._packer}set packer(e){this._packer=e}
35get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(e){this._globalConstantsProvider=e}get readProvider(){return this._readProvider}set readProvider(e){this._readProvider=e}get stream(){return this._stream}set stream(e){this._stream=e}async isAnyProtocolActive(e=[]){if(this._proto)return e.includes(this._proto);{const r=await this.readProvider.getNextProtocol("head");return e.includes(r)}}isAnySignerConfigured(){return!(this.signer instanceof j0)}clone(){return new Us(this.rpc,this.signer,this.proto,this._config,this.forger,this._injector,this.packer,this._walletProvider,this._parser,this._globalConstantsProvider,this._readProvider,this._stream)}registerProviderDecorator(e){this.providerDecorator.push(e)}}const rI={commitHash:"f724c83a603e3623928be71c46030af223a779ee",version:"24.3.0"};class nI{constructor(e){this._rpc=e,this._options={},this.format=ld,typeof this._rpc=="string"?this._rpcClient=new ko(this._rpc):this._rpcClient=this._rpc,this._context=new Us(e),this._wallet=new Rp(this._context),this.setProvider({rpc:this._rpcClient})}setProvider({rpc:e,stream:r,signer:n,protocol:a,config:i,forger:s,wallet:o,packer:c,globalConstantsProvider:u,readProvider:f,parserProvider:l,injectorProvider:p}){this.setRpcProvider(e),this.setStreamProvider(r),this.setSignerProvider(n),this.setForgerProvider(s),this.setWalletProvider(o),this.setPackerProvider(c),this.setGlobalConstantsProvider(u),this.setReadProvider(f),this.setParserProvider(l),this.setInjectorProvider(p),this._context.proto=a,i&&this._context.setPartialConfig(i)}setSignerProvider(e){!this._options.signer&&typeof e>"u"?(this._context.signer=new j0,this._options.signer=e):typeof e<"u"&&(this._context.signer=e,this._options.signer=e)}setRpcProvider(e){typeof e=="string"?this._rpcClient=new ko(e):e===void 0||(this._rpcClient=e),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(e){if(typeof e<"u")this._options.forger=e,this._context.forger=e;else if(this._options.forger===void 0){const r=this.getFactory(Mp)();this._options.forger=r,this._context.forger=r}}setStreamProvider(e){if(typeof e=="string"){const r=new lf(new Us(new ko(e)));this._options.stream=r,this._context.stream=r}else if(typeof e<"u")this._options.stream=e,this._context.stream=e;else if(this._options.stream===void 0){const r=this.getFactory(lf)();this._options.stream=r,this._context.stream=r}}setWalletProvider(e){if(!this._options.wallet&&typeof e>"u"){const r=this.getFactory(Ip)();this._options.wallet=r,this._context.walletProvider=r}else typeof e<"u"&&(this._options.wallet=e,this._context.walletProvider=e)}setPackerProvider(e){if(!this._options.packer&&typeof e>"u"){const r=this.getFactory(Tp)();this._context.packer=r,this._options.packer=r}else typeof e<"u"&&(this._context.packer=e,this._options.packer=e)}setGlobalConstantsProvider(e){if(!this._options.globalConstantsProvider&&typeof e>"u"){const r=new s_;this._context.globalConstantsProvider=r,this._options.globalConstantsProvider=r}else typeof e<"u"&&(this._context.globalConstantsProvider=e,this._options.globalConstantsProvider=e)}setReadProvider(e){const r=e||new Pp(this._context.rpc);this._options.readProvider=r,this._context.readProvider=r}setParserProvider(e){if(!this._options.parserProvider&&typeof e>"u"){const r=new Bp(this._context);this._context.parser=r,this._options.parserProvider=r}else typeof e<"u"&&(this._context.parser=e,this._options.parserProvider=e)}setInjectorProvider(e){if(!this._options.injectorProvider&&typeof e>"u"){const r=new yp(this._context);this._context.injector=r,this._options.injectorProvider=r}else typeof e<"u"&&(this._context.injector=e,this._options.injectorProvider=e)}setFieldNumberingStrategy(e){Et.fieldNumberingStrategy=e}get tz(){return this._context.tz}get contract(){return this._context.contract}get prepare(){return this._context.prepare}get wallet(){return this._wallet}get operation(){return this._context.operationFactory}get estimate(){return this._context.estimate}get stream(){return this._context.stream}get rpc(){return this._context.rpc}get signer(){return this._context.signer}
35get globalConstants(){return this._context.globalConstantsProvider}addExtension(e){Array.isArray(e)?e.forEach(r=>r.configureContext(this._context)):e.configureContext(this._context)}getFactory(e){return(...r)=>new e(this._context,...r)}getVersionInfo(){return rI}}const SI=Object.freeze(Object.defineProperty({__proto__:null,BallotOperation:X6,BatchOperation:j6,BigMapAbstraction:H6,COST_PER_BYTE:g6,get ChainIds(){return z0},Context:Us,ContractAbstraction:Cs,ContractMethodObject:D6,ContractView:q6,DEFAULT_FEE_PARAMS:ma,DEFAULT_SMART_CONTRACT_METHOD_NAME:uf,DelegateOperation:Y0,DelegationWalletOperation:w6,DrainDelegateOperation:J6,Estimate:Ut,IncreasePaidStorageOperation:Y6,InvalidBalanceError:O6,InvalidCodeParameter:ks,InvalidDelegationSource:I6,InvalidEstimateValueError:Fo,InvalidInitParameter:Sp,InvalidParameterError:R6,InvalidViewSimulationContext:Z0,LegacyWalletProvider:Ip,MichelCodecParser:Bp,MichelsonMap:dr,ObservableSubscription:_s,get OpKind(){return fe},Operation:Jt,OperationBatch:xp,OriginationOperation:V6,OriginationParameterError:M6,OriginationWalletOperation:E6,PollingSubscribeProvider:lf,PrepareProvider:fs,ProposalsOperation:Q6,get Protocols(){return wt},REVEAL_STORAGE_LIMIT:V0,RPCEstimateProvider:G6,RegisterGlobalConstantOperation:z6,RegisterGlobalConstantWalletOperation:A6,RevealEstimateError:K6,RevealOperation:W6,RevealOperationError:P6,RpcInjector:yp,RpcPacker:Tp,RpcReadAdapter:Pp,SaplingStateAbstraction:F6,SmartRollupAddMessagesOperation:r_,SmartRollupOriginateOperation:n_,TaquitoLocalForger:Mp,TezosOperationError:wp,TezosPreapplyFailureError:m6,TezosToolkit:nI,Token:Et,TransactionOperation:ws,TransactionWalletOperation:S6,TransferTicketOperation:Z6,TransferTicketWalletOperation:x6,UnconfiguredGlobalConstantsProviderError:a_,UnitValue:U0,UpdateCompanionKeyOperation:t_,UpdateConsensusKeyOperation:e_,ViewSimulationError:B6,Wallet:Rp,WalletOperation:Kn,WalletOperationBatch:i_,attachKind:Zr,createActivationOperation:L6,createBallotOperation:C6,createDrainDelegateOperation:k6,createIncreasePaidStorageOperation:zf,createOriginationOperation:Kf,createProposalsOperation:U6,createRegisterDelegateOperation:N6,createRegisterGlobalConstantOperation:jf,createRevealOperation:qo,createSetDelegateOperation:Gf,createSmartRollupAddMessagesOperation:Yf,createSmartRollupExecuteOutboxMessageOperation:Jf,createSmartRollupOriginateOperation:Xf,createTransferOperation:ua,createTransferTicketOperation:Vf,createUpdateCompanionKeyOperation:Zf,createUpdateConsensusKeyOperation:Wf,defaultConfigConfirmation:o_,feeParamsFromMempoolFilter:$6,findWithKind:cf,getRevealFee:W0,getRevealFeeInternal:b6,getRevealGasLimit:Da,hasMetadata:$f,hasMetadataWithInternalOperationResult:p6,hasMetadataWithResult:xa,isKind:l6,isOpRequireReveal:vp,isOpWithFee:Ua,isOpWithGasBuffer:d6,smartContractAbstractionSemantic:hf,validateAndExtractFailwith:T6},Symbol.toStringTag,{value:"Module"}));export{qs as $,ii as A,Fe as B,cI as C,oI as D,z_ as E,Si as F,Y_ as G,Gv as H,hI as I,uI as J,dn as K,Ba as L,Ia as M,io as N,no as O,Z_ as P,Fv as Q,K8 as R,bI as S,Hv as T,ua as U,Vf as V,zf as W,Kf as X,Gf as Y,jf as Z,ad as _,_a as a,vI as a0,_r as a1,EI as a2,Pv as a3,aI as a4,SI as a5,u8 as b,Yv as c,S3 as d,lr as e,Vs as f,Up as g,bf as h,w0 as i,fI as j,Ko as k,F_ as l,Hr as m,Xv as n,ja as o,Er as p,lI as q,jv as r,Wv as s,gf as t,sI as u,dI as v,pI as w,gI as x,W_ as y,d2 as z};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.