@joclaim/browser-extension-sdk 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,7 +16,7 @@ e.read=function(t,e,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=
|
|
|
16
16
|
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
17
17
|
* @license MIT
|
|
18
18
|
*/
|
|
19
|
-
!function(){"use strict";var o="input is invalid type",s="object"==typeof window,a=s?window:{};a.JS_SHA3_NO_WINDOW&&(s=!1);var c=!s&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node?a=n.g:c&&(a=self);var l=!a.JS_SHA3_NO_COMMON_JS&&t.exports,u=n.amdO,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],f=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],A=[224,256,384,512],E=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new F(t,e,t).update(r)[n]()}},B=function(t,e,n){return function(r,i){return new F(t,e,i).update(r)[n]()}},I=function(t,e,n){return function(e,r,i,o){return v["cshake"+t].update(e,r,i,o)[n]()}},C=function(t,e,n){return function(e,r,i,o){return v["kmac"+t].update(e,r,i,o)[n]()}},T=function(t,e,n,r){for(var i=0;i<m.length;++i){var o=m[i];t[o]=e(n,r,o)}return t},b=function(t,e){var n=y(t,e,"hex");return n.create=function(){return new F(t,e,t)},n.update=function(t){return n.create().update(t)},T(n,y,t,e)},D=[{name:"keccak",padding:[1,256,65536,16777216],bits:A,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:A,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:E,createMethod:function(t,e){var n=B(t,e,"hex");return n.create=function(n){return new F(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},T(n,B,t,e)}},{name:"cshake",padding:p,bits:E,createMethod:function(t,e){var n=w[t],r=I(t,0,"hex");return r.create=function(r,i,o){return i||o?new F(t,e,r).bytepad([i,o],n):v["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},T(r,I,t,e)}},{name:"kmac",padding:p,bits:E,createMethod:function(t,e){var n=w[t],r=C(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},T(r,C,t,e)}}],v={},M=[],N=0;N<D.length;++N)for(var S=D[N],_=S.bits,L=0;L<_.length;++L){var x=S.name+"_"+_[L];if(M.push(x),v[x]=S.createMethod(_[L],S.padding),"sha3"!==S.name){var R=S.name+_[L];M.push(R),v[R]=v[x]}}function F(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){F.call(this,t,e,n)}F.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(o);if(null===t)throw new Error(o);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(o);e=!0}for(var r,i,s=this.blocks,a=this.byteCount,c=t.length,l=this.blockCount,u=0,d=this.s;u<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,r=1;r<l+1;++r)s[r]=0;if(e)for(r=this.start;u<c&&r<a;++u)s[r>>2]|=t[u]<<f[3&r++];else for(r=this.start;u<c&&r<a;++u)(i=t.charCodeAt(u))<128?s[r>>2]|=i<<f[3&r++]:i<2048?(s[r>>2]|=(192|i>>6)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]):i<55296||i>=57344?(s[r>>2]|=(224|i>>12)<<f[3&r++],s[r>>2]|=(128|i>>6&63)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++u)),s[r>>2]|=(240|i>>18)<<f[3&r++],s[r>>2]|=(128|i>>12&63)<<f[3&r++],s[r>>2]|=(128|i>>6&63)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]);if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=s[l],r=0;r<l;++r)d[r]^=s[r];O(d),this.reset=!0}else this.start=r}return this},F.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},F.prototype.encodeString=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(o);if(null===t)throw new Error(o);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(o);e=!0}var r=0,i=t.length;if(e)r=i;else for(var s=0;s<t.length;++s){var a=t.charCodeAt(s);a<128?r+=1:a<2048?r+=2:a<55296||a>=57344?r+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(t),r},F.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];O(r)}},F.prototype.toString=F.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<r;){for(o=0;o<e&&s<r;++o,++s)t=n[o],a+=d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15];s%e===0&&(O(n),o=0)}return i&&(t=n[o],a+=d[t>>4&15]+d[15&t],i>1&&(a+=d[t>>12&15]+d[t>>8&15]),i>2&&(a+=d[t>>20&15]+d[t>>16&15])),a},F.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(t);s<r;){for(o=0;o<e&&s<r;++o,++s)c[s]=n[o];s%e===0&&O(n)}return i&&(c[o]=n[o],t=t.slice(0,a)),t},F.prototype.buffer=F.prototype.arrayBuffer,F.prototype.digest=F.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<n&&a<i;++s,++a)t=a<<2,e=r[s],c[t]=255&e,c[t+1]=e>>8&255,c[t+2]=e>>16&255,c[t+3]=e>>24&255;a%n===0&&O(r)}return o&&(t=a<<2,e=r[s],c[t]=255&e,o>1&&(c[t+1]=e>>8&255),o>2&&(c[t+2]=e>>16&255)),c},k.prototype=new F,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),F.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,s,a,c,l,u,h,d,p,f,A,E,m,w,y,B,I,C,T,b,D,v,M,N,S,_,L,x,R,F,k,O,Q,U,P,G,V,j,H,Y,z,J,W,q,K,Z,X,$,tt,et,nt,rt,it,ot,st,at,ct,lt,ut;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(c<<1|l>>>31),n=o^(l<<1|c>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=s^(u<<1|h>>>31),n=a^(h<<1|u>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=c^(d<<1|p>>>31),n=l^(p<<1|d>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=u^(i<<1|o>>>31),n=h^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,f=t[0],A=t[1],J=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,N=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ct=t[30]<<9|t[31]>>>23,j=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,F=t[2]<<1|t[3]>>>31,k=t[3]<<1|t[2]>>>31,E=t[13]<<12|t[12]>>>20,m=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,_=t[33]<<13|t[32]>>>19,L=t[32]<<13|t[33]>>>19,lt=t[42]<<2|t[43]>>>30,ut=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,O=t[14]<<6|t[15]>>>26,Q=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,Z=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,x=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,b=t[6]<<28|t[7]>>>4,D=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,P=t[27]<<25|t[26]>>>7,B=t[36]<<21|t[37]>>>11,I=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,z=t[9]<<27|t[8]>>>5,v=t[18]<<20|t[19]>>>12,M=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,G=t[38]<<8|t[39]>>>24,V=t[39]<<8|t[38]>>>24,C=t[48]<<14|t[49]>>>18,T=t[49]<<14|t[48]>>>18,t[0]=f^~E&w,t[1]=A^~m&y,t[10]=b^~v&N,t[11]=D^~M&S,t[20]=F^~O&U,t[21]=k^~Q&P,t[30]=Y^~J&q,t[31]=z^~W&K,t[40]=et^~rt&ot,t[41]=nt^~it&st,t[2]=E^~w&B,t[3]=m^~y&I,t[12]=v^~N&_,t[13]=M^~S&L,t[22]=O^~U&G,t[23]=Q^~P&V,t[32]=J^~q&Z,t[33]=W^~K&X,t[42]=rt^~ot&at,t[43]=it^~st&ct,t[4]=w^~B&C,t[5]=y^~I&T,t[14]=N^~_&x,t[15]=S^~L&R,t[24]=U^~G&j,t[25]=P^~V&H,t[34]=q^~Z&$,t[35]=K^~X&tt,t[44]=ot^~at<,t[45]=st^~ct&ut,t[6]=B^~C&f,t[7]=I^~T&A,t[16]=_^~x&b,t[17]=L^~R&D,t[26]=G^~j&F,t[27]=V^~H&k,t[36]=Z^~$&Y,t[37]=X^~tt&z,t[46]=at^~lt&et,t[47]=ct^~ut&nt,t[8]=C^~f&E,t[9]=T^~A&m,t[18]=x^~b&v,t[19]=R^~D&M,t[28]=j^~F&O,t[29]=H^~k&Q,t[38]=$^~Y&J,t[39]=tt^~z&W,t[48]=lt^~et&rt,t[49]=ut^~nt&it,t[0]^=g[r],t[1]^=g[r+1]};if(l)t.exports=v;else{for(N=0;N<M.length;++N)a[M[N]]=v[M[N]];u&&(void 0===(r=function(){return v}.call(e,n,e,t))||(t.exports=r))}}()},9534(t,e){(function(){var e;function n(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function r(){return new n(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=function(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var c=32767&this[t],l=this[t++]>>15,u=a*c+l*s;i=((c=s*c+((32767&u)<<15)+n[r]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),n[r++]=1073741823&c}return i},e=30):i&&"Netscape"!=navigator.appName?(n.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},e=26):(n.prototype.am=function(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var c=16383&this[t],l=this[t++]>>14,u=a*c+l*s;i=((c=s*c+((16383&u)<<14)+n[r]+i)>>28)+(u>>14)+a*l,n[r++]=268435455&c}return i},e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-e,n.prototype.F2=2*e-52;var o,s,a=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)a[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)a[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)a[o++]=s;function c(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function l(t,e){var n=a[t.charCodeAt(e)];return null==n?-1:n}function u(t){var e=r();return e.fromInt(t),e}function h(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function d(t){this.m=t}function p(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function f(t,e){return t&e}function g(t,e){return t|e}function A(t,e){return t^e}function E(t,e){return t&~e}function m(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function w(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function y(){}function B(t){return t}function I(t){this.r2=r(),this.q3=r(),n.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}d.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},d.prototype.revert=function(t){return t},d.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},d.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},d.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},p.prototype.convert=function(t){var e=r();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(n.ZERO)>0&&this.m.subTo(e,e),e},p.prototype.revert=function(t){var e=r();return t.copyTo(e),this.reduce(e),e},p.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},p.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},p.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},n.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},n.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},n.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,s=0;--i>=0;){var a=8==r?255&t[i]:l(t,i);a<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&n.ZERO.subTo(this,this)},n.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},n.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},n.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},n.prototype.lShiftTo=function(t,e){var n,r=t%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(t/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},n.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},n.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},n.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),o=r.t;for(e.t=o+i.t;--o>=0;)e[o]=0;for(o=0;o<i.t;++o)e[o+r.t]=r.am(0,i[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&n.ZERO.subTo(e,e)},n.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},n.prototype.divRemTo=function(t,e,i){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=e&&e.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=r());var a=r(),c=this.s,l=t.s,u=this.DB-h(o[o.t-1]);u>0?(o.lShiftTo(u,a),s.lShiftTo(u,i)):(o.copyTo(a),s.copyTo(i));var d=a.t,p=a[d-1];if(0!=p){var f=p*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),g=this.FV/f,A=(1<<this.F1)/f,E=1<<this.F2,m=i.t,w=m-d,y=null==e?r():e;for(a.dlShiftTo(w,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),n.ONE.dlShiftTo(d,y),y.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--w>=0;){var B=i[--m]==p?this.DM:Math.floor(i[m]*g+(i[m-1]+E)*A);if((i[m]+=a.am(0,B,i,w,0,d))<B)for(a.dlShiftTo(w,y),i.subTo(y,i);i[m]<--B;)i.subTo(y,i)}null!=e&&(i.drShiftTo(d,e),c!=l&&n.ZERO.subTo(e,e)),i.t=d,i.clamp(),u>0&&i.rShiftTo(u,i),c<0&&n.ZERO.subTo(i,i)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},n.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(t,e){if(t>4294967295||t<1)return n.ONE;var i=r(),o=r(),s=e.convert(this),a=h(t)-1;for(s.copyTo(i);--a>=0;)if(e.sqrTo(i,o),(t&1<<a)>0)e.mulTo(o,s,i);else{var c=i;i=o,o=c}return e.revert(i)},n.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=c(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=c(n));return i?o:"0"},n.prototype.negate=function(){var t=r();return n.ZERO.subTo(this,t),t},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(t){var e=r();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(n.ZERO)>0&&t.subTo(e,e),e},n.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new d(e):new p(e),this.exp(t,n)},n.ZERO=u(0),n.ONE=u(1),y.prototype.convert=B,y.prototype.revert=B,y.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},y.prototype.sqrTo=function(t,e){t.squareTo(e)},I.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=r();return t.copyTo(e),this.reduce(e),e},I.prototype.revert=function(t){return t},I.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},I.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},I.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var C,T,b,D=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],v=(1<<26)/D[D.length-1];function M(){var t;t=(new Date).getTime(),T[b++]^=255&t,T[b++]^=t>>8&255,T[b++]^=t>>16&255,T[b++]^=t>>24&255,b>=F&&(b-=F)}if(n.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},n.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),i=u(n),o=r(),s=r(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(t)+a},n.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),o=!1,s=0,a=0,c=0;c<t.length;++c){var u=l(t,c);u<0?"-"==t.charAt(c)&&0==this.signum()&&(o=!0):(a=e*a+u,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(n.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(n.ONE.shiftLeft(t-1),this);else{var i=new Array,o=7&t;i.length=1+(t>>3),e.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},n.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},n.prototype.changeBit=function(t,e){var r=n.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},n.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},n.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},n.prototype.multiplyLowerTo=function(t,e,n){var r,i=Math.min(this.t+t.t,e);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,t[i],n,i,0,this.t);for(r=Math.min(t.t,e);i<r;++i)this.am(0,t[i],n,i,0,e-i);n.clamp()},n.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},n.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},n.prototype.millerRabin=function(t){var e=this.subtract(n.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var o=e.shiftRight(i);(t=t+1>>1)>D.length&&(t=D.length);for(var s=r(),a=0;a<t;++a){s.fromInt(D[Math.floor(Math.random()*D.length)]);var c=s.modPow(o,this);if(0!=c.compareTo(n.ONE)&&0!=c.compareTo(e)){for(var l=1;l++<i&&0!=c.compareTo(e);)if(0==(c=c.modPowInt(2,this)).compareTo(n.ONE))return!1;if(0!=c.compareTo(e))return!1}}return!0},n.prototype.clone=function(){var t=r();return this.copyTo(t),t},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},n.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},n.prototype.equals=function(t){return 0==this.compareTo(t)},n.prototype.min=function(t){return this.compareTo(t)<0?this:t},n.prototype.max=function(t){return this.compareTo(t)>0?this:t},n.prototype.and=function(t){var e=r();return this.bitwiseTo(t,f,e),e},n.prototype.or=function(t){var e=r();return this.bitwiseTo(t,g,e),e},n.prototype.xor=function(t){var e=r();return this.bitwiseTo(t,A,e),e},n.prototype.andNot=function(t){var e=r();return this.bitwiseTo(t,E,e),e},n.prototype.not=function(){for(var t=r(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},n.prototype.shiftLeft=function(t){var e=r();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},n.prototype.shiftRight=function(t){var e=r();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},n.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+m(this[t]);return this.s<0?this.t*this.DB:-1},n.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=w(this[n]^e);return t},n.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},n.prototype.setBit=function(t){return this.changeBit(t,g)},n.prototype.clearBit=function(t){return this.changeBit(t,E)},n.prototype.flipBit=function(t){return this.changeBit(t,A)},n.prototype.add=function(t){var e=r();return this.addTo(t,e),e},n.prototype.subtract=function(t){var e=r();return this.subTo(t,e),e},n.prototype.multiply=function(t){var e=r();return this.multiplyTo(t,e),e},n.prototype.divide=function(t){var e=r();return this.divRemTo(t,e,null),e},n.prototype.remainder=function(t){var e=r();return this.divRemTo(t,null,e),e},n.prototype.divideAndRemainder=function(t){var e=r(),n=r();return this.divRemTo(t,e,n),new Array(e,n)},n.prototype.modPow=function(t,e){var n,i,o=t.bitLength(),s=u(1);if(o<=0)return s;n=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new d(e):e.isEven()?new I(e):new p(e);var a=new Array,c=3,l=n-1,f=(1<<n)-1;if(a[1]=i.convert(this),n>1){var g=r();for(i.sqrTo(a[1],g);c<=f;)a[c]=r(),i.mulTo(g,a[c-2],a[c]),c+=2}var A,E,m=t.t-1,w=!0,y=r();for(o=h(t[m])-1;m>=0;){for(o>=l?A=t[m]>>o-l&f:(A=(t[m]&(1<<o+1)-1)<<l-o,m>0&&(A|=t[m-1]>>this.DB+o-l)),c=n;!(1&A);)A>>=1,--c;if((o-=c)<0&&(o+=this.DB,--m),w)a[A].copyTo(s),w=!1;else{for(;c>1;)i.sqrTo(s,y),i.sqrTo(y,s),c-=2;c>0?i.sqrTo(s,y):(E=s,s=y,y=E),i.mulTo(y,a[A],s)}for(;m>=0&&!(t[m]&1<<o);)i.sqrTo(s,y),E=s,s=y,y=E,--o<0&&(o=this.DB-1,--m)}return i.revert(s)},n.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return n.ZERO;for(var r=t.clone(),i=this.clone(),o=u(1),s=u(0),a=u(0),c=u(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(t,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),e&&o.subTo(a,o),s.subTo(c,s)):(i.subTo(r,i),e&&a.subTo(o,a),c.subTo(s,c))}return 0!=i.compareTo(n.ONE)?n.ZERO:c.compareTo(t)>=0?c.subtract(t):c.signum()<0?(c.addTo(t,c),c.signum()<0?c.add(t):c):c},n.prototype.pow=function(t){return this.exp(t,new y)},n.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},n.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=D[D.length-1]){for(e=0;e<D.length;++e)if(n[0]==D[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<D.length;){for(var r=D[e],i=e+1;i<D.length&&r<v;)r*=D[i++];for(r=n.modInt(r);e<i;)if(r%D[e++]==0)return!1}return n.millerRabin(t)},n.prototype.square=function(){var t=r();return this.squareTo(t),t},n.prototype.Barrett=I,null==T){var N;if(T=new Array,b=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var S=new Uint8Array(32);for(window.crypto.getRandomValues(S),N=0;N<32;++N)T[b++]=S[N]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var _=window.crypto.random(32);for(N=0;N<_.length;++N)T[b++]=255&_.charCodeAt(N)}for(;b<F;)N=Math.floor(65536*Math.random()),T[b++]=N>>>8,T[b++]=255&N;b=0,M()}function L(){if(null==C){for(M(),(C=new R).init(T),b=0;b<T.length;++b)T[b]=0;b=0}return C.next()}function x(){}function R(){this.i=0,this.j=0,this.S=new Array}x.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=L()},R.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},R.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var F=256;t.exports={default:n,BigInteger:n,SecureRandom:x}}).call(this)},3349(t){function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},5606(t){var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],l=!1,u=-1;function h(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&d())}function d(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(a=c,c=[];++u<e;)a&&a[u].run();u=-1,e=c.length}a=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function f(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},152(t,e,n){"use strict";var r=n(8287).hp;class i{static isArrayBuffer(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){const n=i.toUint8Array(t),r=i.toUint8Array(e);if(n.length!==r.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==r[t])return!1;return!0}static concat(...t){let e;e=!Array.isArray(t[0])||t[1]instanceof Function?Array.isArray(t[0])&&t[1]instanceof Function?t[0]:t[t.length-1]instanceof Function?t.slice(0,t.length-1):t:t[0];let n=0;for(const t of e)n+=t.byteLength;const r=new Uint8Array(n);let i=0;for(const t of e){const e=this.toUint8Array(t);r.set(e,i),i+=e.length}return t[t.length-1]instanceof Function?this.toView(r,t[t.length-1]):r.buffer}}const o="string",s=/^[0-9a-f\s]+$/i,a=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c=/^[a-zA-Z0-9-_]+$/;class l{static fromString(t){const e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}static toString(t){const e=i.toUint8Array(t);let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return decodeURIComponent(escape(n))}}class u{static toString(t,e=!1){const n=i.toArrayBuffer(t),r=new DataView(n);let o="";for(let t=0;t<n.byteLength;t+=2){const n=r.getUint16(t,e);o+=String.fromCharCode(n)}return o}static fromString(t,e=!1){const n=new ArrayBuffer(2*t.length),r=new DataView(n);for(let n=0;n<t.length;n++)r.setUint16(2*n,t.charCodeAt(n),e);return n}}class h{static isHex(t){return typeof t===o&&s.test(t)}static isBase64(t){return typeof t===o&&a.test(t)}static isBase64Url(t){return typeof t===o&&c.test(t)}static ToString(t,e="utf8"){const n=i.toUint8Array(t);switch(e.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return u.toString(n,!0);case"utf16":case"utf16be":return u.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return u.fromString(t,!0);case"utf16":case"utf16be":return u.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){const e=i.toUint8Array(t);if("undefined"!=typeof btoa){const t=this.ToString(e,"binary");return btoa(t)}return r.from(e).toString("base64")}static FromBase64(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(e)):new Uint8Array(r.from(e,"base64")).buffer}static FromBase64Url(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=h.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return l.fromString(t);case"utf16":case"utf16be":return u.fromString(t);case"utf16le":case"usc2":return u.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=h.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return l.toString(t);case"utf16":case"utf16be":return u.toString(t);case"utf16le":case"usc2":return u.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;r++)n[r]=t.charCodeAt(r);return n.buffer}static ToBinary(t){const e=i.toUint8Array(t);let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return n}static ToHex(t){const e=i.toUint8Array(t);let n="";const r=e.length;for(let t=0;t<r;t++){const r=e[t];r<16&&(n+="0"),n+=r.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);const n=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const r=e.slice(t,t+2);n[t/2]=parseInt(r,16)}return n.buffer}static ToUtf16String(t,e=!1){return u.toString(t,e)}static FromUtf16String(t,e=!1){return u.fromString(t,e)}static Base64Padding(t){const e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return(null==t?void 0:t.replace(/[\n\r\t ]/g,""))||""}}h.DEFAULT_UTF8_ENCODING="utf8",e._H=i,e.U$=h,e.kg=function(...t){const e=t.map(t=>t.byteLength).reduce((t,e)=>t+e),n=new Uint8Array(e);let r=0;return t.map(t=>new Uint8Array(t)).forEach(t=>{for(const e of t)n[r++]=e}),n.buffer},e.n4=function(t,e){if(!t||!e)return!1;if(t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let e=0;e<t.byteLength;e++)if(n[e]!==r[e])return!1;return!0}},793(t){"use strict";function e(t){try{return JSON.stringify(t)}catch(t){return'"[Circular]"'}}t.exports=function(t,n,r){var i=r&&r.stringify||e;if("object"==typeof t&&null!==t){var o=n.length+1;if(1===o)return t;var s=new Array(o);s[0]=i(t);for(var a=1;a<o;a++)s[a]=i(n[a]);return s.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var l="",u=0,h=-1,d=t&&t.length||0,p=0;p<d;){if(37===t.charCodeAt(p)&&p+1<d){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(u>=c)break;if(null==n[u])break;h<p&&(l+=t.slice(h,p)),l+=Number(n[u]),h=p+2,p++;break;case 105:if(u>=c)break;if(null==n[u])break;h<p&&(l+=t.slice(h,p)),l+=Math.floor(Number(n[u])),h=p+2,p++;break;case 79:case 111:case 106:if(u>=c)break;if(void 0===n[u])break;h<p&&(l+=t.slice(h,p));var f=typeof n[u];if("string"===f){l+="'"+n[u]+"'",h=p+2,p++;break}if("function"===f){l+=n[u].name||"<anonymous>",h=p+2,p++;break}l+=i(n[u]),h=p+2,p++;break;case 115:if(u>=c)break;h<p&&(l+=t.slice(h,p)),l+=String(n[u]),h=p+2,p++;break;case 37:h<p&&(l+=t.slice(h,p)),l+="%",h=p+2,p++,u--}++u}++p}if(-1===h)return t;h<d&&(l+=t.slice(h));return l}},9983(t){"use strict";!function(){const e=2147483647;function n(t){const e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let n=1779033703,r=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,c=528734635,l=1541459225;const u=new Uint32Array(64);function h(t){let h=0,d=t.length;for(;d>=64;){let p,f,g,A,E,m=n,w=r,y=i,B=o,I=s,C=a,T=c,b=l;for(f=0;f<16;f++)g=h+4*f,u[f]=(255&t[g])<<24|(255&t[g+1])<<16|(255&t[g+2])<<8|255&t[g+3];for(f=16;f<64;f++)p=u[f-2],A=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,p=u[f-15],E=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,u[f]=(A+u[f-7]|0)+(E+u[f-16]|0)|0;for(f=0;f<64;f++)A=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&C^~I&T)|0)+(b+(e[f]+u[f]|0)|0)|0,E=((m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10))+(m&w^m&y^w&y)|0,b=T,T=C,C=I,I=B+A|0,B=y,y=w,w=m,m=A+E|0;n=n+m|0,r=r+w|0,i=i+y|0,o=o+B|0,s=s+I|0,a=a+C|0,c=c+T|0,l=l+b|0,h+=64,d-=64}}h(t);let d,p=t.length%64,f=t.length/536870912|0,g=t.length<<3,A=p<56?56:120,E=t.slice(t.length-p,t.length);for(E.push(128),d=p+1;d<A;d++)E.push(0);return E.push(f>>>24&255),E.push(f>>>16&255),E.push(f>>>8&255),E.push(f>>>0&255),E.push(g>>>24&255),E.push(g>>>16&255),E.push(g>>>8&255),E.push(g>>>0&255),h(E),[n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,l>>>24&255,l>>>16&255,l>>>8&255,l>>>0&255]}function r(t,e,r){t=t.length<=64?t:n(t);const i=64+e.length+4,o=new Array(i),s=new Array(64);let a,c=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a<t.length;a++)o[a]^=t[a];for(a=0;a<e.length;a++)o[64+a]=e[a];for(a=i-4;a<i;a++)o[a]=0;for(a=0;a<64;a++)s[a]=92;for(a=0;a<t.length;a++)s[a]^=t[a];function l(){for(let t=i-1;t>=i-4;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;r>=32;)l(),c=c.concat(n(s.concat(n(o)))),r-=32;return r>0&&(l(),c=c.concat(n(s.concat(n(o))).slice(0,r))),c}function i(t,e,n,r,i){let o;for(c(t,16*(2*n-1),i,0,16),o=0;o<2*n;o++)a(t,16*o,i,16),s(i,r),c(i,0,t,e+16*o,16);for(o=0;o<n;o++)c(t,e+2*o*16,t,16*o,16);for(o=0;o<n;o++)c(t,e+16*(2*o+1),t,16*(o+n),16)}function o(t,e){return t<<e|t>>>32-e}function s(t,e){c(t,0,e,0,16);for(let t=8;t>0;t-=2)e[4]^=o(e[0]+e[12],7),e[8]^=o(e[4]+e[0],9),e[12]^=o(e[8]+e[4],13),e[0]^=o(e[12]+e[8],18),e[9]^=o(e[5]+e[1],7),e[13]^=o(e[9]+e[5],9),e[1]^=o(e[13]+e[9],13),e[5]^=o(e[1]+e[13],18),e[14]^=o(e[10]+e[6],7),e[2]^=o(e[14]+e[10],9),e[6]^=o(e[2]+e[14],13),e[10]^=o(e[6]+e[2],18),e[3]^=o(e[15]+e[11],7),e[7]^=o(e[3]+e[15],9),e[11]^=o(e[7]+e[3],13),e[15]^=o(e[11]+e[7],18),e[1]^=o(e[0]+e[3],7),e[2]^=o(e[1]+e[0],9),e[3]^=o(e[2]+e[1],13),e[0]^=o(e[3]+e[2],18),e[6]^=o(e[5]+e[4],7),e[7]^=o(e[6]+e[5],9),e[4]^=o(e[7]+e[6],13),e[5]^=o(e[4]+e[7],18),e[11]^=o(e[10]+e[9],7),e[8]^=o(e[11]+e[10],9),e[9]^=o(e[8]+e[11],13),e[10]^=o(e[9]+e[8],18),e[12]^=o(e[15]+e[14],7),e[13]^=o(e[12]+e[15],9),e[14]^=o(e[13]+e[12],13),e[15]^=o(e[14]+e[13],18);for(let n=0;n<16;++n)t[n]+=e[n]}function a(t,e,n,r){for(let i=0;i<r;i++)n[i]^=t[e+i]}function c(t,e,n,r,i){for(;i--;)n[r++]=t[e++]}function l(t){if(!t||"number"!=typeof t.length)return!1;for(let e=0;e<t.length;e++){const n=t[e];if("number"!=typeof n||n%1||n<0||n>=256)return!1}return!0}function u(t,e){if("number"!=typeof t||t%1)throw new Error("invalid "+e);return t}function h(t,n,o,s,h,d,p){if(o=u(o,"N"),s=u(s,"r"),h=u(h,"p"),d=u(d,"dkLen"),0===o||o&o-1)throw new Error("N must be power of 2");if(o>e/128/s)throw new Error("N too large");if(s>e/128/h)throw new Error("r too large");if(!l(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!l(n))throw new Error("salt must be an array or buffer");n=Array.prototype.slice.call(n);let f=r(t,n,128*h*s);const g=new Uint32Array(32*h*s);for(let t=0;t<g.length;t++){const e=4*t;g[t]=(255&f[e+3])<<24|(255&f[e+2])<<16|(255&f[e+1])<<8|255&f[e+0]}const A=new Uint32Array(64*s),E=new Uint32Array(32*s*o),m=32*s,w=new Uint32Array(16),y=new Uint32Array(16),B=h*o*2;let I,C,T=0,b=null,D=!1,v=0,M=0;const N=p?parseInt(1e3/s):4294967295,S="undefined"!=typeof setImmediate?setImmediate:setTimeout,_=function(){if(D)return p(new Error("cancelled"),T/B);let e;switch(v){case 0:C=32*M*s,c(g,C,A,0,m),v=1,I=0;case 1:e=o-I,e>N&&(e=N);for(let t=0;t<e;t++)c(A,0,E,(I+t)*m,m),i(A,m,s,w,y);if(I+=e,T+=e,p){const t=parseInt(1e3*T/B);if(t!==b){if(D=p(null,T/B),D)break;b=t}}if(I<o)break;I=0,v=2;case 2:e=o-I,e>N&&(e=N);for(let t=0;t<e;t++){const t=A[16*(2*s-1)]&o-1;a(E,t*m,A,m),i(A,m,s,w,y)}if(I+=e,T+=e,p){const t=parseInt(1e3*T/B);if(t!==b){if(D=p(null,T/B),D)break;b=t}}if(I<o)break;if(c(A,0,g,C,m),M++,M<h){v=0;break}f=[];for(let t=0;t<g.length;t++)f.push(255&g[t]),f.push(g[t]>>8&255),f.push(g[t]>>16&255),f.push(g[t]>>24&255);const n=r(t,f,d);return p&&p(null,1,n),n}p&&S(_)};if(!p)for(;;){const t=_();if(null!=t)return t}_()}const d={scrypt:function(t,e,n,r,i,o,s){return new Promise(function(a,c){let l=0;s&&s(0),h(t,e,n,r,i,o,function(t,e,n){if(t)c(t);else if(n)s&&1!==l&&s(1),a(new Uint8Array(n));else if(s&&e!==l)return l=e,s(e)})})},syncScrypt:function(t,e,n,r,i,o){return new Uint8Array(h(t,e,n,r,i,o))}};t.exports=d}()},7770(t,e,n){"use strict";n.d(e,{y8:()=>I,Ow:()=>B});var r=n(3859);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function s(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==i(e)?e:e+""}var a=function(){function t(e){var n=e.sessionId,r=e.providerId,i=e.appId,o=e.logLine,s=e.type,a=e.eventType,c=e.logLevel,l=e.source,u=e.tabId,h=e.url,d=e.meta,p=e.time,f=void 0===p?null:p,g=e.deviceId;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sessionId=n,this.providerId=r,this.appId=i,this.logLine=o,this.type=s,this.eventType=a,this.logLevel=c,this.source=l,this.tabId=u,this.url=h,this.meta=d||void 0,this.time=f||new Date,this.deviceId=g}return e=t,r=[{key:"fromDateTimeToTimeStamp",value:function(t){return(1e6*t.getTime()).toString()}}],(n=[{key:"toJson",value:function(){var e={logLine:this.logLine,ts:t.fromDateTimeToTimeStamp(this.time),logLevel:this.logLevel,sessionId:this.sessionId,providerId:this.providerId,appId:this.appId,source:this.source,deviceId:this.deviceId};return this.type&&(e.type=this.type),this.eventType&&(e.eventType=this.eventType),this.tabId&&(e.tabId=this.tabId),this.url&&(e.url=this.url),this.meta&&(e.meta=this.meta),e}}])&&o(e.prototype,n),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function c(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return h(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var d=[][r]?e(e([][r]())):(h(e={},r,function(){return this}),e),p=l.prototype=a.prototype=Object.create(d);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,h(t,i,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=l,h(p,"constructor",l),h(l,"constructor",c),c.displayName="GeneratorFunction",h(l,i,"GeneratorFunction"),h(p),h(p,i,"Generator"),h(p,r,function(){return this}),h(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:o,m:f}})()}function h(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}h=function(t,e,n,r){function o(e,n){h(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},h(t,e,n,r)}function d(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function p(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){d(o,r,i,s,a,"next",t)}function a(t){d(o,r,i,s,a,"throw",t)}s(void 0)})}}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function A(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach(function(e){E(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function E(t,e,n){return(e=w(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,w(r.key),r)}}function w(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}var y=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.logs=[],this.isSending=!1,this.maxBatchSize=20,this.flushInterval=5e3,this.flushIntervalId=null,this.config=A({},r.DEFAULT_LOG_CONFIG),this.deviceId=null;try{var n;"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local&&(chrome.storage.local.get([r.LOG_CONFIG_STORAGE_KEY],function(t){var n=null==t?void 0:t[r.LOG_CONFIG_STORAGE_KEY];n&&"object"===f(n)&&e.setConfig(n)}),chrome.storage.onChanged.addListener(function(t,n){if("local"===n&&t[r.LOG_CONFIG_STORAGE_KEY]){var i=t[r.LOG_CONFIG_STORAGE_KEY].newValue||{};e.setConfig(i)}}))}catch(t){}this.startFlushInterval()},e=[{key:"setConfig",value:function(t){this.config=A(A({},this.config),t)}},{key:"startFlushInterval",value:function(){var t=this;this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flushIntervalId=setInterval(function(){return t.flush()},this.flushInterval)}},{key:"stopFlushInterval",value:function(){this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null)}},{key:"getDeviceLoggingId",value:(s=p(u().m(function t(){var e;return u().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.deviceId){t.n=1;break}return t.a(2,this.deviceId);case 1:if(t.p=1,"undefined"==typeof chrome||!chrome.storage){t.n=3;break}return t.n=2,chrome.storage.local.get(["reclaim_device_id"]);case 2:if(!(e=t.v).reclaim_device_id){t.n=3;break}return this.deviceId=e.reclaim_device_id,t.a(2,this.deviceId);case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:if(this.deviceId="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():String(Date.now()),t.p=6,"undefined"==typeof chrome||!chrome.storage){t.n=7;break}return t.n=7,chrome.storage.local.set({reclaim_device_id:this.deviceId});case 7:t.n=9;break;case 8:t.p=8,t.v;case 9:return t.a(2,this.deviceId)}},t,this,[[6,8],[1,4]])})),function(){return s.apply(this,arguments)})},{key:"addLog",value:function(t){this.logs.push(t),this.logs.length>=this.maxBatchSize&&this.flush()}},{key:"shouldLog",value:function(t){return t<=(r.LOG_LEVEL_MAP[this.config.logLevel]||r.LOG_LEVEL.INFO)}},{key:"emitToConsole",value:function(t,e,n){var r="[".concat(t,"]"),i="".concat(r," ").concat(e);n?console.log(i,n):console.log(i)}},{key:"log",value:function(t){var e=t.message,n=t.logLevel,r=t.type,i=t.eventType,o=t.meta,s=t.sessionId,c=t.providerId,l=t.appId,u=t.source,h=t.tabId,d=t.url;if(e&&n){if(this.shouldLog(n)){this.config.consoleEnabled&&this.emitToConsole(n,e,o);var p=new a({sessionId:s||"unknown",providerId:c||"unknown",appId:l||"unknown",logLine:e,type:r,eventType:i,logLevel:n,source:u||this.config.source,tabId:h,url:d,meta:o,time:new Date});this.addLog(p)}}else console.error("Logger: message and logLevel are required")}},{key:"flush",value:(o=p(u().m(function t(){var e,n;return u().w(function(t){for(;;)switch(t.p=t.n){case 0:if(0!==this.logs.length&&!this.isSending){t.n=1;break}return t.a(2);case 1:return e=c(this.logs),this.logs=[],t.p=2,this.isSending=!0,t.n=3,this.sendLogs(e);case 3:t.n=5;break;case 4:t.p=4,n=t.v,console.error("Error flushing logs:",n),this.logs=[].concat(c(this.logs),c(e));case 5:return t.p=5,this.isSending=!1,t.f(5);case 6:return t.a(2)}},t,this,[[2,4,5,6]])})),function(){return o.apply(this,arguments)})},{key:"sendLogs",value:(i=p(u().m(function t(e){var n,i,o,s,a,c;return u().w(function(t){for(;;)switch(t.n){case 0:if(null!=e&&e.length){t.n=1;break}return t.a(2);case 1:return t.n=2,this.getDeviceLoggingId();case 2:return n=t.v,i=e.map(function(t){var e=t.toJson();return e.deviceId=e.deviceId||n,e}),o=JSON.stringify({logs:i,source:this.config.source,deviceId:n}),t.n=3,fetch(r.LOGGING_ENDPOINTS.DIAGNOSTIC_LOGGING,{method:"POST",headers:{"Content-Type":"application/json"},body:o});case 3:if((s=t.v).ok){t.n=5;break}return a=console,c="Failed to send ".concat(e.length," logs"),t.n=4,s.text();case 4:a.error.call(a,c,t.v);case 5:return t.a(2)}},t,this)})),function(t){return i.apply(this,arguments)})}],e&&m(t.prototype,e),n&&m(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,i,o,s}(),B=new y,I=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=A({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:(null===(t=B.config)||void 0===t?void 0:t.source)||"reclaim-extension-sdk"},e);return{get context(){return A({},n)},setContext:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(n,t)},log:function(t){B.log(A(A({},n),t))},info:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"INFO"},t))},debug:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"DEBUG"},t))},all:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"ALL"},t))},error:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"ALL"},t))}}}},3859(t,e,n){"use strict";n.r(e),n.d(e,{DEFAULT_LOG_CONFIG:()=>l,EVENT_TYPES:()=>s,LOGGING_ENDPOINTS:()=>r,LOG_CONFIG_STORAGE_KEY:()=>u,LOG_LEVEL:()=>a,LOG_LEVEL_MAP:()=>c,LOG_SOURCES:()=>o,LOG_TYPES:()=>i});var r={DIAGNOSTIC_LOGGING:"http://localhost:8001/api/logs"},i={BACKGROUND:"reclaim_browser_extension.BackgroundProcess",CONTENT:"reclaim_browser_extension.ContentScript",POPUP:"reclaim_browser_extension.Popup",INIT:"reclaim_browser_extension.Initialization",VERIFICATION:"reclaim_browser_extension.Verification",FETCH_DATA:"reclaim_browser_extension.FetchData",PROVIDER_DATA:"reclaim_browser_extension.ProviderData",CLAIM_CREATION:"reclaim_browser_extension.ClaimCreation",PROOF_GENERATION:"reclaim_browser_extension.ProofGeneration",PROOF_SUBMISSION:"reclaim_browser_extension.ProofSubmission",PROOF_VERIFICATION:"reclaim_browser_extension.ProofVerification",OFFSCREEN:"reclaim_browser_extension.Offscreen"},o={BACKGROUND:"background",CONTENT:"content",OFFSCREEN:"offscreen",POPUP:"popup",INJECTION:"injection"},s={IS_RECLAIM_EXTENSION_SDK:"IS_RECLAIM_EXTENSION_SDK",VERIFICATION_FLOW_STARTED:"VERIFICATION_FLOW_STARTED",RECLAIM_VERIFICATION_DISMISSED:"RECLAIM_VERIFICATION_DISMISSED",RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION:"RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION",REQUEST_MATCHED:"REQUEST_MATCHED",RESPONSE_MATCH_FAILED:"RESPONSE_MATCH_FAILED",X_PATH_MATCH_REQUIREMENT_FAILED:"X_PATH_MATCH_REQUIREMENT_FAILED",JSON_PATH_MATCH_REQUIREMENT_FAILED:"JSON_PATH_MATCH_REQUIREMENT_FAILED",REGEX_MATCH_REQUIREMENT_FAILED:"REGEX_MATCH_REQUIREMENT_FAILED",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",FILTER_REQUEST_ERROR:"FILTER_REQUEST_ERROR",STARTING_CLAIM_CREATION:"STARTING_CLAIM_CREATION",CLAIM_CREATION_STARTED:"CLAIM_CREATION_STARTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION:"CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION:"OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_ABORTED:"PROOF_GENERATION_ABORTED",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",RESULT_RECEIVED:"RESULT_RECEIVED",SUBMITTING_PROOF:"SUBMITTING_PROOF",SUBMITTING_PROOF_TO_CALLBACK_URL:"SUBMITTING_PROOF_TO_CALLBACK_URL",SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS:"SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS",SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED:"SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",VERIFICATION_FLOW_FAILED:"VERIFICATION_FLOW_FAILED",TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION:"TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION",INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED:"INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED",VERIFICATION_POPUP_ERROR:"VERIFICATION_POPUP_ERROR",UPDATE_SESSION_STATUS_ERROR:"UPDATE_SESSION_STATUS_ERROR"},a={INFO:10,DEBUG:20,ALL:30},c={INFO:a.INFO,DEBUG:a.DEBUG,ALL:a.ALL},l={logLevel:"INFO",consoleEnabled:!1,source:"reclaim-extension-sdk"},u="reclaim_extension_sdk_log_config"},3153(t,e,n){"use strict";n.d(e,{Ey:()=>s,w9:()=>c});n(7770);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}var s=Object.freeze({BACKGROUND:"background",CONTENT:"content",POPUP:"popup",INIT:"init",VERIFICATION:"verification",FETCH:"fetch",PROVIDER:"provider",CLAIM:"claim",PROOF:"proof",OFFSCREEN:"offscreen",POLYFILLS:"polyfills",SESSION_TIMER:"session-timer"}),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.enabled=!0,this.allowedTypes=new Set}return e=t,n=[{key:"enable",value:function(){this.enabled=!0}},{key:"disable",value:function(){this.enabled=!1}},{key:"setTypes",value:function(t){Array.isArray(t)&&(this.allowedTypes=new Set(t))}},{key:"clearTypes",value:function(){this.allowedTypes.clear()}},{key:"log",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).log.apply(n,["%c[".concat(e,"][INFO]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"info",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).info.apply(n,["%c[".concat(e,"][INFO]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"warn",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e,"warn"),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).warn.apply(n,["%c[".concat(e,"][WARN]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"error",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e,"error"),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).error.apply(n,["%c[".concat(e,"][ERROR]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}}],r=[{key:"typeColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n={background:"#0074D9",content:"#2ECC40",popup:"#FF851B",init:"#B10DC9",verification:"#FF4136",fetch:"#39CCCC",provider:"#FFDC00",claim:"#7FDBFF",proof:"#85144b",offscreen:"#AAAAAA",polyfills:"#0074D9","session-timer":"#2ECC40"},r=n[Object.keys(n).find(function(e){return t.toLowerCase().includes(e)})]||"#888888";return"info"!==e&&(r={info:"",warn:"#FFA500",error:"#FF0000"}[e]||r),r}}],n&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}(),c=new a,l=(n(3859),n(5606));void 0!==l&&l.env?c.disable():c.enable()},3296(t,e,n){"use strict";n.r(e),n.d(e,{WebSocket:()=>f,default:()=>g});var r,i=n(3153);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function c(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}function u(t,e,n){return e=d(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,n||[],d(t).constructor):e.apply(t,n))}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}(t=n.hmd(t),"undefined"==typeof window)?(r=function(){return c(function t(e,n){var r=this;s(this,t),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating mock WebSocket for background context"),this.url=e,this.protocols=n,this.readyState=3,setTimeout(function(){"function"==typeof r.onclose&&r.onclose({code:1e3,reason:"WebSockets not supported in background context"})},0)},[{key:"send",value:function(){throw i.w9.warn(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Cannot use WebSockets in background context"),new Error("WebSockets are not available in background context")}},{key:"close",value:function(){}},{key:"sendPromise",value:function(){return Promise.reject(new Error("WebSockets are not available in background context"))}},{key:"addEventListener",value:function(){}},{key:"removeEventListener",value:function(){}}])}(),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using mock WebSocket implementation for background context")):(r=function(t){function e(t,n){var r;return s(this,e),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating WebSocket with URL:",t),(r=u(this,e,[t,n])).addEventListener("error",function(t){"function"==typeof r.onerror&&r.onerror(t)}),r.addEventListener("open",function(t){"function"==typeof r.onopen&&r.onopen(t)}),r.addEventListener("close",function(t){"function"==typeof r.onclose&&r.onclose(t)}),r.addEventListener("message",function(t){"function"==typeof r.onmessage&&r.onmessage(t)}),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),c(e,[{key:"sendPromise",value:function(t){var e=this;return new Promise(function(n,r){try{e.send(t),n()}catch(t){r(t)}})}}])}(window.WebSocket),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using browser WebSocket implementation"));var f=r;const g=r;t.exports&&(t.exports=r,t.exports.WebSocket=r,t.exports.default=r),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] WebSocket polyfill initialized")},7604(t,e,n){var r;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(t){return function(t,e){var n,r,s,a,c,l,u,h,d,p=1,f=t.length,g="";for(r=0;r<f;r++)if("string"==typeof t[r])g+=t[r];else if("object"==typeof t[r]){if((a=t[r]).keys)for(n=e[p],s=0;s<a.keys.length;s++){if(null==n)throw new Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[s],a.keys[s-1]));n=n[a.keys[s]]}else n=a.param_no?e[a.param_no]:e[p++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),i.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(o("[sprintf] expecting number but found %T",n));switch(i.number.test(a.type)&&(h=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?g+=n:(!i.number.test(a.type)||h&&!a.sign?d="":(d=h?"+":"-",n=n.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(d+n).length,c=a.width&&u>0?l.repeat(u):"",g+=a.align?d+n+c:"0"===l?d+c+n:c+d+n)}return g}(function(t){if(a[t])return a[t];var e,n=t,r=[],o=0;for(;n;){if(null!==(e=i.text.exec(n)))r.push(e[0]);else if(null!==(e=i.modulo.exec(n)))r.push("%");else{if(null===(e=i.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){o|=1;var s=[],c=e[2],l=[];if(null===(l=i.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(l[1]);""!==(c=c.substring(l[0].length));)if(null!==(l=i.key_access.exec(c)))s.push(l[1]);else{if(null===(l=i.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(l[1])}e[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}n=n.substring(e[0].length)}return a[t]=r}(t),arguments)}function s(t,e){return o.apply(null,[t].concat(e||[]))}var a=Object.create(null);e.sprintf=o,e.vsprintf=s,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(r=function(){return{sprintf:o,vsprintf:s}}.call(e,n,e,t))||(t.exports=r))}()},3631(t,e){!function(t){"use strict";var e="__namespace",n=function(t){return t&&((n=t.nodeType)===e||Number.isInteger(n)&&n>=1&&n<=11)&&"string"==typeof t.nodeName;var n};var r=function(t,e){for(var n=0;n<e.length;n+=1)t(e[n],n,e)},i=function(t,e,n){var i=e;return r(function(e,n){i=t(i,e,n)},n),i},o=function(t,e){var n=new Array(e.length);return r(function(e,r){n[r]=t(e)},e),n},s=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n]===e)return!0;return!1};function a(t){return t.toString()}var c=function(t,e){return e.join(t)},l=function(t,e,n){return t+n+e},u=Array.prototype.concat;function h(t,e){for(var n=Object(t),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}var d=1,p=2,f=3,g=4,A=7,E=8,m=9,w=10,y=11,B=e;function I(){this.init()}function C(t){this.expression=t}function T(t,e,n){e in t||(t[e]=n)}function b(){}function D(t){arguments.length>0&&this.init(t)}function v(t){arguments.length>0&&this.init(t)}function M(t,e){arguments.length>0&&this.init(t,e)}function N(t,e){arguments.length>0&&this.init(t,e)}function S(t,e){arguments.length>0&&this.init(t,e)}function _(t,e){arguments.length>0&&this.init(t,e)}function L(t,e){arguments.length>0&&this.init(t,e)}function x(t,e){arguments.length>0&&this.init(t,e)}function R(t,e){arguments.length>0&&this.init(t,e)}function F(t,e){arguments.length>0&&this.init(t,e)}function k(t,e){arguments.length>0&&this.init(t,e)}function O(t,e){arguments.length>0&&this.init(t,e)}function Q(t,e){arguments.length>0&&this.init(t,e)}function U(t,e){arguments.length>0&&this.init(t,e)}function P(t,e){arguments.length>0&&this.init(t,e)}function G(t,e){arguments.length>0&&this.init(t,e)}function V(t,e){arguments.length>0&&this.init(t,e)}function j(t,e,n){arguments.length>0&&this.init(t,e,n)}function H(t){for(;t&&t.parentNode;)t=t.parentNode;return t}I.prototype=new Object,I.prototype.constructor=I,I.superclass=Object.prototype,I.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(t){return new N(t[0],t[2])},this.reduceActions[5]=function(t){return new S(t[0],t[2])},this.reduceActions[7]=function(t){return new _(t[0],t[2])},this.reduceActions[8]=function(t){return new L(t[0],t[2])},this.reduceActions[10]=function(t){return new x(t[0],t[2])},this.reduceActions[11]=function(t){return new R(t[0],t[2])},this.reduceActions[12]=function(t){return new F(t[0],t[2])},this.reduceActions[13]=function(t){return new k(t[0],t[2])},this.reduceActions[15]=function(t){return new O(t[0],t[2])},this.reduceActions[16]=function(t){return new Q(t[0],t[2])},this.reduceActions[18]=function(t){return new U(t[0],t[2])},this.reduceActions[19]=function(t){return new P(t[0],t[2])},this.reduceActions[20]=function(t){return new G(t[0],t[2])},this.reduceActions[22]=function(t){return new v(t[1])},this.reduceActions[24]=function(t){return new V(t[0],t[2])},this.reduceActions[25]=function(t){return new j(void 0,void 0,t[0])},this.reduceActions[27]=function(t){return t[0].locationPath=t[2],t[0]},this.reduceActions[28]=function(t){return t[0].locationPath=t[2],t[0].locationPath.steps.unshift(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[0]},this.reduceActions[29]=function(t){return new j(t[0],[],void 0)},this.reduceActions[30]=function(t){return pt.instance_of(t[0],j)?(null==t[0].filterPredicates&&(t[0].filterPredicates=[]),t[0].filterPredicates.push(t[1]),t[0]):new j(t[0],[t[1]],void 0)},this.reduceActions[32]=function(t){return t[1]},this.reduceActions[33]=function(t){return new nt(t[0])},this.reduceActions[34]=function(t){return new rt(t[0])},this.reduceActions[36]=function(t){return new tt(t[0],[])},this.reduceActions[37]=function(t){return new tt(t[0],t[2])},this.reduceActions[38]=function(t){return[t[0]]},this.reduceActions[39]=function(t){return t[2].unshift(t[0]),t[2]},this.reduceActions[43]=function(t){return new q(!0,[])},this.reduceActions[44]=function(t){return t[1].absolute=!0,t[1]},this.reduceActions[46]=function(t){return new q(!1,[t[0]])},this.reduceActions[47]=function(t){return t[0].steps.push(t[2]),t[0]},this.reduceActions[49]=function(t){return new K(t[0],t[1],[])},this.reduceActions[50]=function(t){return new K(K.CHILD,t[0],[])},this.reduceActions[51]=function(t){return new K(t[0],t[1],t[2])},this.reduceActions[52]=function(t){return new K(K.CHILD,t[0],t[1])},this.reduceActions[54]=function(t){return[t[0]]},this.reduceActions[55]=function(t){return t[1].unshift(t[0]),t[1]},this.reduceActions[56]=function(t){return"ancestor"==t[0]?K.ANCESTOR:"ancestor-or-self"==t[0]?K.ANCESTORORSELF:"attribute"==t[0]?K.ATTRIBUTE:"child"==t[0]?K.CHILD:"descendant"==t[0]?K.DESCENDANT:"descendant-or-self"==t[0]?K.DESCENDANTORSELF:"following"==t[0]?K.FOLLOWING:"following-sibling"==t[0]?K.FOLLOWINGSIBLING:"namespace"==t[0]?K.NAMESPACE:"parent"==t[0]?K.PARENT:"preceding"==t[0]?K.PRECEDING:"preceding-sibling"==t[0]?K.PRECEDINGSIBLING:"self"==t[0]?K.SELF:-1},this.reduceActions[57]=function(t){return K.ATTRIBUTE},this.reduceActions[59]=function(t){return"comment"==t[0]?X.commentTest:"text"==t[0]?X.textTest:"processing-instruction"==t[0]?X.anyPiTest:"node"==t[0]?X.nodeTest:new X(-1,void 0)},this.reduceActions[60]=function(t){return new X.PITest(t[2])},this.reduceActions[61]=function(t){return t[1]},this.reduceActions[63]=function(t){return t[1].absolute=!0,t[1].steps.unshift(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[1]},this.reduceActions[64]=function(t){return t[0].steps.push(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[0].steps.push(t[2]),t[0]},this.reduceActions[65]=function(t){return new K(K.SELF,X.nodeTest,[])},this.reduceActions[66]=function(t){return new K(K.PARENT,X.nodeTest,[])},this.reduceActions[67]=function(t){return new $(t[1])},this.reduceActions[68]=function(t){return X.nameTestAny},this.reduceActions[69]=function(t){return new X.NameTestPrefixAny(t[0].split(":")[0])},this.reduceActions[70]=function(t){return new X.NameTestQName(t[0])}},I.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],I.actionTableNumber=[" 1 0 /.-,+*)(' & %$ # \"!"," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY "," 1 0 /.-,+*)(' & %$ # \"!","K1 KKKKKKKK . +*)('KKKKKK KK# K\" "," 1 0 /.-,+*)(' & %$ # \"!"," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q "," 1 . +*)(' # \" ","b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX "," 1 0 /.-,+*)(' & %$m # \"!","_ f________ ______e __ _ "," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 . +*)(' # \" "," 1 . +*)(' # \" ","> >>>>>>>>> >>>>>>> >> >> "," 1 . +*)(' # \" "," 1 . +*)(' # \" ","Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," "," F ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE "," 1 0 /.-,+*)(' & %$ # \"!","] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],I.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","456789:;<=>?@ AB CDEFGH IJ"," EFGH IJ "," EFGH IJ "," "," GH IJ ","
GH IJ "," i "," i "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABqCDEFGH IJ "," "," "],I.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],I.DOUBLEDOT=2,I.DOUBLECOLON=3,I.DOUBLESLASH=4,I.NOTEQUAL=5,I.LESSTHANOREQUAL=6,I.GREATERTHANOREQUAL=7,I.AND=8,I.OR=9,I.MOD=10,I.DIV=11,I.MULTIPLYOPERATOR=12,I.FUNCTIONNAME=13,I.AXISNAME=14,I.LITERAL=15,I.NUMBER=16,I.ASTERISKNAMETEST=17,I.QNAME=18,I.NCNAMECOLONASTERISK=19,I.NODETYPE=20,I.PROCESSINGINSTRUCTIONWITHLITERAL=21,I.EQUALS=22,I.LESSTHAN=23,I.GREATERTHAN=24,I.PLUS=25,I.MINUS=26,I.BAR=27,I.SLASH=28,I.LEFTPARENTHESIS=29,I.RIGHTPARENTHESIS=30,I.COMMA=31,I.AT=32,I.LEFTBRACKET=33,I.RIGHTBRACKET=34,I.DOT=35,I.DOLLAR=36,I.prototype.tokenize=function(t){for(var e=[],n=[],r=t+"\0",i=0,o=r.charAt(i++);;){for(;" "==o||"\t"==o||"\r"==o||"\n"==o;)o=r.charAt(i++);if("\0"==o||i>=r.length)break;if("("!=o)if(")"!=o)if("["!=o)if("]"!=o)if("@"!=o)if(","!=o)if("|"!=o)if("+"!=o)if("-"!=o)if("="!=o)if("$"!=o)if("."!=o)if("'"!=o&&'"'!=o)if(o>="0"&&o<="9"){u=o;for(o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);if("."==o&&r.charAt(i)>="0"&&r.charAt(i)<="9")for(u+=o,u+=r.charAt(i++),o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);e.push(I.NUMBER),n.push(u)}else if("*"!=o)if(":"!=o||":"!=r.charAt(i))if("/"!=o)if("!"!=o||"="!=r.charAt(i))if("<"!=o)if(">"!=o){if("_"!=o&&!pt.isLetter(o.charCodeAt(0)))throw new Error("Unexpected character "+o);var s=o;for(o=r.charAt(i++);pt.isNCNameChar(o.charCodeAt(0));)s+=o,o=r.charAt(i++);if(e.length>0&&(a=e[e.length-1])!=I.AT&&a!=I.DOUBLECOLON&&a!=I.LEFTPARENTHESIS&&a!=I.LEFTBRACKET&&a!=I.AND&&a!=I.OR&&a!=I.MOD&&a!=I.DIV&&a!=I.MULTIPLYOPERATOR&&a!=I.SLASH&&a!=I.DOUBLESLASH&&a!=I.BAR&&a!=I.PLUS&&a!=I.MINUS&&a!=I.EQUALS&&a!=I.NOTEQUAL&&a!=I.LESSTHAN&&a!=I.LESSTHANOREQUAL&&a!=I.GREATERTHAN&&a!=I.GREATERTHANOREQUAL){if("and"==s){e.push(I.AND),n.push(s);continue}if("or"==s){e.push(I.OR),n.push(s);continue}if("mod"==s){e.push(I.MOD),n.push(s);continue}if("div"==s){e.push(I.DIV),n.push(s);continue}}if(":"==o){if("*"==r.charAt(i)){e.push(I.NCNAMECOLONASTERISK),n.push(s+":*"),i++,o=r.charAt(i++);continue}if("_"==r.charAt(i)||pt.isLetter(r.charCodeAt(i))){for(s+=":",o=r.charAt(i++);pt.isNCNameChar(o.charCodeAt(0));)s+=o,o=r.charAt(i++);if("("==o){e.push(I.FUNCTIONNAME),n.push(s);continue}e.push(I.QNAME),n.push(s);continue}if(":"==r.charAt(i)){e.push(I.AXISNAME),n.push(s);continue}}if("("==o){if("comment"==s||"text"==s||"node"==s){e.push(I.NODETYPE),n.push(s);continue}if("processing-instruction"==s){")"==r.charAt(i)?e.push(I.NODETYPE):e.push(I.PROCESSINGINSTRUCTIONWITHLITERAL),n.push(s);continue}e.push(I.FUNCTIONNAME),n.push(s);continue}e.push(I.QNAME),n.push(s)}else{if("="==r.charAt(i)){e.push(I.GREATERTHANOREQUAL),n.push(">="),i++,o=r.charAt(i++);continue}e.push(I.GREATERTHAN),n.push(">"),o=r.charAt(i++)}else{if("="==r.charAt(i)){e.push(I.LESSTHANOREQUAL),n.push("<="),i++,o=r.charAt(i++);continue}e.push(I.LESSTHAN),n.push("<"),o=r.charAt(i++)}else e.push(I.NOTEQUAL),n.push("!="),i++,o=r.charAt(i++);else{if("/"==(o=r.charAt(i++))){e.push(I.DOUBLESLASH),n.push("//"),o=r.charAt(i++);continue}e.push(I.SLASH),n.push("/")}else e.push(I.DOUBLECOLON),n.push("::"),i++,o=r.charAt(i++);else{var a;if(e.length>0&&(a=e[e.length-1])!=I.AT&&a!=I.DOUBLECOLON&&a!=I.LEFTPARENTHESIS&&a!=I.LEFTBRACKET&&a!=I.AND&&a!=I.OR&&a!=I.MOD&&a!=I.DIV&&a!=I.MULTIPLYOPERATOR&&a!=I.SLASH&&a!=I.DOUBLESLASH&&a!=I.BAR&&a!=I.PLUS&&a!=I.MINUS&&a!=I.EQUALS&&a!=I.NOTEQUAL&&a!=I.LESSTHAN&&a!=I.LESSTHANOREQUAL&&a!=I.GREATERTHAN&&a!=I.GREATERTHANOREQUAL){e.push(I.MULTIPLYOPERATOR),n.push(o),o=r.charAt(i++);continue}e.push(I.ASTERISKNAMETEST),n.push(o),o=r.charAt(i++)}else{for(var c=o,l="";i<r.length&&(o=r.charAt(i))!==c;)l+=o,i+=1;if(o!==c)throw gt.fromMessage("Unterminated string literal: "+c+l);i+=1,e.push(I.LITERAL),n.push(l),o=r.charAt(i++)}else{if("."==(o=r.charAt(i++))){e.push(I.DOUBLEDOT),n.push(".."),o=r.charAt(i++);continue}if(o>="0"&&o<="9"){var u="."+o;for(o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);e.push(I.NUMBER),n.push(u);continue}e.push(I.DOT),n.push(".")}else e.push(I.DOLLAR),n.push(o),o=r.charAt(i++);else e.push(I.EQUALS),n.push(o),o=r.charAt(i++);else e.push(I.MINUS),n.push(o),o=r.charAt(i++);else e.push(I.PLUS),n.push(o),o=r.charAt(i++);else e.push(I.BAR),n.push(o),o=r.charAt(i++);else e.push(I.COMMA),n.push(o),o=r.charAt(i++);else e.push(I.AT),n.push(o),o=r.charAt(i++);else e.push(I.RIGHTBRACKET),n.push(o),o=r.charAt(i++);else e.push(I.LEFTBRACKET),n.push(o),o=r.charAt(i++);else e.push(I.RIGHTPARENTHESIS),n.push(o),o=r.charAt(i++);else e.push(I.LEFTPARENTHESIS),n.push(o),o=r.charAt(i++)}return e.push(1),n.push("[EOF]"),[e,n]},I.SHIFT="s",I.REDUCE="r",I.ACCEPT="a",I.prototype.parse=function(t){if(!t)throw new Error("XPath expression unspecified.");if("string"!=typeof t)throw new Error("XPath expression must be a string.");var e,n,r=this.tokenize(t);if(null!=r){e=r[0],n=r[1];var i,o,s=0,a=[],c=[],l=[];for(a.push(0),c.push(1),l.push("_S"),i=e[s],o=n[s++];;)switch(t=a[a.length-1],I.actionTable[t].charAt(i-1)){case I.SHIFT:c.push(-i),l.push(o),a.push(I.actionTableNumber[t].charCodeAt(i-1)-32),i=e[s],o=n[s++];break;case I.REDUCE:for(var u=I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][1],h=[],d=0;d<u;d++)c.pop(),h.unshift(l.pop()),a.pop();var p=a[a.length-1];c.push(I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][0]),null==this.reduceActions[I.actionTableNumber[t].charCodeAt(i-1)-32]?l.push(h[0]):l.push(this.reduceActions[I.actionTableNumber[t].charCodeAt(i-1)-32](h)),a.push(I.gotoTable[p].charCodeAt(I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][0]-2)-33);break;case I.ACCEPT:return new C(l.pop());default:throw new Error("XPath parse error")}}},C.prototype=new Object,C.prototype.constructor=C,C.superclass=Object.prototype,C.prototype.toString=function(){return this.expression.toString()},C.prototype.evaluate=function(t){var e=t.expressionContextNode;if(null!=e&&!n(e))throw new Error("Context node does not appear to be a valid DOM node.");return t.contextNode=t.expressionContextNode,t.contextSize=1,t.contextPosition=1,t.isHtml&&(T(t,"caseInsensitive",!0),T(t,"allowAnyNamespaceForNoPrefix",!0)),T(t,"caseInsensitive",!1),this.expression.evaluate(t)},C.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",C.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",b.prototype=new Object,b.prototype.constructor=b,b.superclass=Object.prototype,b.prototype.init=function(){},b.prototype.toString=function(){return"<Expression>"},b.prototype.evaluate=function(t){throw new Error("Could not evaluate expression.")},D.prototype=new b,D.prototype.constructor=D,D.superclass=b.prototype,D.prototype.init=function(t){this.rhs=t},v.prototype=new D,v.prototype.constructor=v,v.superclass=D.prototype,v.prototype.init=function(t){v.superclass.init.call(this,t)},v.prototype.evaluate=function(t){return this.rhs.evaluate(t).number().negate()},v.prototype.toString=function(){return"-"+this.rhs.toString()},M.prototype=new b,M.prototype.constructor=M,M.superclass=b.prototype,M.prototype.init=function(t,e){this.lhs=t,this.rhs=e},N.prototype=new M,N.prototype.constructor=N,N.superclass=M.prototype,N.prototype.init=function(t,e){N.superclass.init.call(this,t,e)},N.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},N.prototype.evaluate=function(t){var e=this.lhs.evaluate(t).bool();return e.booleanValue()?e:this.rhs.evaluate(t).bool()},S.prototype=new M,S.prototype.constructor=S,S.superclass=M.prototype,S.prototype.init=function(t,e){S.superclass.init.call(this,t,e)},S.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},S.prototype.evaluate=function(t){var e=this.lhs.evaluate(t).bool();return e.booleanValue()?this.rhs.evaluate(t).bool():e},_.prototype=new M,_.prototype.constructor=_,_.superclass=M.prototype,_.prototype.init=function(t,e){_.superclass.init.call(this,t,e)},_.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},_.prototype.evaluate=function(t){return this.lhs.evaluate(t).equals(this.rhs.evaluate(t))},L.prototype=new M,L.prototype.constructor=L,L.superclass=M.prototype,L.prototype.init=function(t,e){L.superclass.init.call(this,t,e)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(t){return this.lhs.evaluate(t).notequal(this.rhs.evaluate(t))},x.prototype=new M,x.prototype.constructor=x,x.superclass=M.prototype,x.prototype.init=function(t,e){x.superclass.init.call(this,t,e)},x.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthan(this.rhs.evaluate(t))},x.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},R.prototype=new M,R.prototype.constructor=R,R.superclass=M.prototype,R.prototype.init=function(t,e){R.superclass.init.call(this,t,e)},R.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthan(this.rhs.evaluate(t))},R.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},F.prototype=new M,F.prototype.constructor=F,F.superclass=M.prototype,F.prototype.init=function(t,e){F.superclass.init.call(this,t,e)},F.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthanorequal(this.rhs.evaluate(t))},F.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},k.prototype=new M,k.prototype.constructor=k,k.superclass=M.prototype,k.prototype.init=function(t,e){k.superclass.init.call(this,t,e)},k.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthanorequal(this.rhs.evaluate(t))},k.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},O.prototype=new M,O.prototype.constructor=O,O.superclass=M.prototype,O.prototype.init=function(t,e){O.superclass.init.call(this,t,e)},O.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().plus(this.rhs.evaluate(t).number())},O.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},Q.prototype=new M,Q.prototype.constructor=Q,Q.superclass=M.prototype,Q.prototype.init=function(t,e){Q.superclass.init.call(this,t,e)},Q.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().minus(this.rhs.evaluate(t).number())},Q.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},U.prototype=new M,U.prototype.constructor=U,U.superclass=M.prototype,U.prototype.init=function(t,e){U.superclass.init.call(this,t,e)},U.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().multiply(this.rhs.evaluate(t).number())},U.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},P.prototype=new M,P.prototype.constructor=P,P.superclass=M.prototype,P.prototype.init=function(t,e){P.superclass.init.call(this,t,e)},P.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().div(this.rhs.evaluate(t).number())},P.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},G.prototype=new M,G.prototype.constructor=G,G.superclass=M.prototype,G.prototype.init=function(t,e){G.superclass.init.call(this,t,e)},G.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().mod(this.rhs.evaluate(t).number())},G.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},V.prototype=new M,V.prototype.constructor=V,V.superclass=M.prototype,V.prototype.init=function(t,e){V.superclass.init.call(this,t,e)},V.prototype.evaluate=function(t){return this.lhs.evaluate(t).nodeset().union(this.rhs.evaluate(t).nodeset())},V.prototype.toString=function(){return o(a,[this.lhs,this.rhs]).join(" | ")},j.prototype=new b,j.prototype.constructor=j,j.superclass=b.prototype,j.prototype.init=function(t,e,n){j.superclass.init.call(this),this.filter=t,this.filterPredicates=e,this.locationPath=n};var Y=function(t,e,n,o){if(0===t.length)return n;var s=e.extend({});return i(function(t,e){return s.contextSize=t.length,n=function(t,n){return s.contextNode=t,s.contextPosition=n+1,j.predicateMatches(e,s)},i=[],r(function(t,e){n(t,e)&&i.push(t)},t),i;var n,i},function(t,e){var n=new st;n.addArray(t);var r=n.toArray();return e?r.reverse():r}(n,o),t)};j.getRoot=function(t,e){var n=e[0];if(n&&n.nodeType===m)return n;if(t.virtualRoot)return t.virtualRoot;if(!n)throw new Error("Context node not found when determining document root.");var r=n.ownerDocument;if(r)return r;for(var i=n;null!=i.parentNode;)i=i.parentNode;return i};var z=function(t){var e=String(t.name);return"xmlns"===e?"":"xmlns:"===e.substring(0,6)?e.substring(6,e.length):null};function J(t,e,n){return Y(t.predicates,e,j.applyStep(t,e,n),s(Z,t.axis))}function W(t,e,n){return function(t){for(var e=[],n=0;n<t.length;n+=32767){var r=t.slice(n,n+32767);e=u.apply(e,r)}return e}(o(J.bind(null,n,t),e))}function q(t,e){arguments.length>0&&this.init(t,e)}function K(t,e,n){arguments.length>0&&this.init(t,e,n)}j.applyStep=function(t,e,n){if(!n)throw new Error("Context node not found when evaluating XPath step: "+t);var r=[];switch(e.contextNode=n,t.axis){case K.ANCESTOR:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.nodeType==p?j.getOwnerElement(e.contextNode):e.contextNode.parentNode;null!=i&&(t.nodeTest.matches(i,e)&&r.push(i),i!==e.virtualRoot);)i=i.parentNode;break;case K.ANCESTORORSELF:for(var i=e.contextNode;null!=i&&(t.nodeTest.matches(i,e)&&r.push(i),i!==e.virtualRoot);i=i.nodeType==p?j.getOwnerElement(i):i.parentNode);break;case K.ATTRIBUTE:var o=e.contextNode.attributes;if(null!=o)for(var s=0;s<o.length;s++){i=o.item(s);t.nodeTest.matches(i,e)&&r.push(i)}break;case K.CHILD:for(i=e.contextNode.firstChild;null!=i;i=i.nextSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.DESCENDANT:for(var a=[e.contextNode.firstChild];a.length>0;)for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling;break;case K.DESCENDANTORSELF:t.nodeTest.matches(e.contextNode,e)&&r.push(e.contextNode);for(a=[e.contextNode.firstChild];a.length>0;)for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling;break;case K.FOLLOWING:if(e.contextNode===e.virtualRoot)break;a=[];null!=e.contextNode.firstChild?a.unshift(e.contextNode.firstChild):a.unshift(e.contextNode.nextSibling);for(i=e.contextNode.parentNode;null!=i&&i.nodeType!=m&&i!==e.virtualRoot;i=i.parentNode)a.unshift(i.nextSibling);do{for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling}while(a.length>0);break;case K.FOLLOWINGSIBLING:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.nextSibling;null!=i;i=i.nextSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.NAMESPACE:var c={};if(e.contextNode.nodeType==d){c.xml=new at("xml",null,C.XML_NAMESPACE_URI,e.contextNode);for(i=e.contextNode;null!=i&&i.nodeType==d;i=i.parentNode)for(s=0;s<i.attributes.length;s++){var l=i.attributes.item(s);null!=(u=z(l))&&null==c[u]&&(c[u]=new at(u,l,l.value,e.contextNode))}for(var u in c){n=c[u];t.nodeTest.matches(n,e)&&r.push(n)}}break;case K.PARENT:i=null,e.contextNode!==e.virtualRoot&&(i=e.contextNode.nodeType==p?j.getOwnerElement(e.contextNode):e.contextNode.parentNode),null!=i&&t.nodeTest.matches(i,e)&&r.push(i);break;case K.PRECEDING:a=null!=e.virtualRoot?[e.virtualRoot]:[H(e.contextNode)];t:for(;a.length>0;)for(i=a.pop();null!=i;){if(i==e.contextNode)break t;t.nodeTest.matches(i,e)&&r.unshift(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling}break;case K.PRECEDINGSIBLING:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.previousSibling;null!=i;i=i.previousSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.SELF:t.nodeTest.matches(e.contextNode,e)&&r.push(e.contextNode)}return r},j.applySteps=function(t,e,n){return i(W.bind(null,e),n,t)},j.prototype.applyFilter=function(t,e){if(!this.filter)return{nodes:[t.contextNode]};var n=this.filter.evaluate(t);if(!pt.instance_of(n,st)){if(null!=this.filterPredicates&&this.filterPredicates.length>0||null!=this.locationPath)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:n}}return{nodes:Y(this.filterPredicates||[],e,n.toUnsortedArray(),!1)}},j.applyLocationPath=function(t,e,n){if(!t)return n;var r=t.absolute?[j.getRoot(e,n)]:n;return j.applySteps(t.steps,e,r)},j.prototype.evaluate=function(t){var e=h(new ct,t),n=this.applyFilter(t,e);if("nonNodes"in n)return n.nonNodes;var r=new st;return r.addArray(j.applyLocationPath(this.locationPath,e,n.nodes)),r},j.predicateMatches=function(t,e){var n=t.evaluate(e);return pt.instance_of(n,rt)?e.contextPosition===n.numberValue():n.booleanValue()},j.predicateString=function(t){return l("[","]",t.toString())},j.predicatesString=function(t){return c("",o(j.predicateString,t))},j.prototype.toString=function(){if(null!=this.filter){var t=a(this.filter);return pt.instance_of(this.filter,nt)?l("'","'",t):null!=this.filterPredicates&&this.filterPredicates.length?l("(",")",t)+j.predicatesString(this.filterPredicates):null!=this.locationPath?t+(this.locationPath.absolute?"":"/")+a(this.locationPath):t}return a(this.locationPath)},j.getOwnerElement=function(t){if(t.ownerElement)return t.ownerElement;try{if(t.selectSingleNode)return t.selectSingleNode("..")}catch(t){}for(var e=(t.nodeType==m?t:t.ownerDocument).getElementsByTagName("*"),n=0;n<e.length;n++)for(var r=e.item(n),i=r.attributes,o=0;o<i.length;o++){if(i.item(o)===t)return r}return null},q.prototype=new Object,q.prototype.constructor=q,q.superclass=Object.prototype,q.prototype.init=function(t,e){this.absolute=t,this.steps=e},q.prototype.toString=function(){return(this.absolute?"/":"")+o(a,this.steps).join("/")},K.prototype=new Object,K.prototype.constructor=K,K.superclass=Object.prototype,K.prototype.init=function(t,e,n){this.axis=t,this.nodeTest=e,this.predicates=n},K.prototype.toString=function(){return K.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+j.predicatesString(this.predicates)},K.ANCESTOR=0,K.ANCESTORORSELF=1,K.ATTRIBUTE=2,K.CHILD=3,K.DESCENDANT=4,K.DESCENDANTORSELF=5,K.FOLLOWING=6,K.FOLLOWINGSIBLING=7,K.NAMESPACE=8,K.PARENT=9,K.PRECEDING=10,K.PRECEDINGSIBLING=11,K.SELF=12,K.STEPNAMES=i(function(t,e){return t[e[0]]=e[1],t},{},[[K.ANCESTOR,"ancestor"],[K.ANCESTORORSELF,"ancestor-or-self"],[K.ATTRIBUTE,"attribute"],[K.CHILD,"child"],[K.DESCENDANT,"descendant"],[K.DESCENDANTORSELF,"descendant-or-self"],[K.FOLLOWING,"following"],[K.FOLLOWINGSIBLING,"following-sibling"],[K.NAMESPACE,"namespace"],[K.PARENT,"parent"],[K.PRECEDING,"preceding"],[K.PRECEDINGSIBLING,"preceding-sibling"],[K.SELF,"self"]]);var Z=[K.ANCESTOR,K.ANCESTORORSELF,K.PARENT,K.PRECEDING,K.PRECEDINGSIBLING];function X(t,e){arguments.length>0&&this.init(t,e)}function $(t){arguments.length>0&&this.init(t)}function tt(t,e){arguments.length>0&&this.init(t,e)}X.prototype=new Object,X.prototype.constructor=X,X.superclass=Object.prototype,X.prototype.init=function(t,e){this.type=t,this.value=e},X.prototype.toString=function(){return"<unknown nodetest type>"},X.prototype.matches=function(t,e){console.warn("unknown node test type")},X.NAMETESTANY=0,X.NAMETESTPREFIXANY=1,X.NAMETESTQNAME=2,X.COMMENT=3,X.TEXT=4,X.PI=5,X.NODE=6,X.isNodeType=function(t){return function(e){return s(t,e.nodeType)}},X.makeNodeTestType=function(t,e,n){var r=n||function(){};return r.prototype=new X(t),r.prototype.constructor=r,h(r.prototype,e),r},X.makeNodeTypeTest=function(t,e,n){return new(X.makeNodeTestType(t,{matches:X.isNodeType(e),toString:(r=n,function(){return r})}));var r},X.hasPrefix=function(t){return t.prefix||-1!==(t.nodeName||t.tagName).indexOf(":")},X.isElementOrAttribute=X.isNodeType([1,2]),X.nameSpaceMatches=function(t,e,n){var r=n.namespaceURI||"";if(!t)return!r||e.allowAnyNamespaceForNoPrefix&&!X.hasPrefix(n);var i=e.namespaceResolver.getNamespace(t,e.expressionContextNode);if(null==i)throw new Error("Cannot resolve QName "+t);return i===r},X.localNameMatches=function(t,e,n){var r=n.localName||n.nodeName;return e.caseInsensitive?t.toLowerCase()===r.toLowerCase():t===r},X.NameTestPrefixAny=X.makeNodeTestType(X.NAMETESTPREFIXANY,{matches:function(t,e){return X.isElementOrAttribute(t)&&X.nameSpaceMatches(this.prefix,e,t)},toString:function(){return this.prefix+":*"}},function(t){this.prefix=t}),X.NameTestQName=X.makeNodeTestType(X.NAMETESTQNAME,{matches:function(t,e){return X.isNodeType([d,p,B])(t)&&X.nameSpaceMatches(this.prefix,e,t)&&X.localNameMatches(this.localName,e,t)},toString:function(){return this.name}},function(t){var e=t.split(":");this.name=t,this.prefix=e.length>1?e[0]:null,this.localName=e[e.length>1?1:0]}),X.PITest=X.makeNodeTestType(X.PI,{matches:function(t,e){return X.isNodeType([A])(t)&&(t.target||t.nodeName)===this.name},toString:function(){return l('processing-instruction("','")',this.name)}},function(t){this.name=t}),X.nameTestAny=X.makeNodeTypeTest(X.NAMETESTANY,[d,p,B],"*"),X.textTest=X.makeNodeTypeTest(X.TEXT,[f,g],"text()"),X.commentTest=X.makeNodeTypeTest(X.COMMENT,[E],"comment()"),X.nodeTest=X.makeNodeTypeTest(X.NODE,[d,p,f,g,A,E,m],"node()"),X.anyPiTest=X.makeNodeTypeTest(X.PI,[A],"processing-instruction()"),$.prototype=new b,$.prototype.constructor=$,$.superclass=b.prototype,$.prototype.init=function(t){this.variable=t},$.prototype.toString=function(){return"$"+this.variable},$.prototype.evaluate=function(t){var e=pt.resolveQName(this.variable,t.namespaceResolver,t.contextNode,!1);if(null==e[0])throw new Error("Cannot resolve QName "+fn);var n=t.variableResolver.getVariable(e[1],e[0]);if(!n)throw gt.fromMessage("Undeclared variable: "+this.toString());return n},tt.prototype=new b,tt.prototype.constructor=tt,tt.superclass=b.prototype,tt.prototype.init=function(t,e){this.functionName=t,this.arguments=e},tt.prototype.toString=function(){for(var t=this.functionName+"(",e=0;e<this.arguments.length;e++)e>0&&(t+=", "),t+=this.arguments[e].toString();return t+")"},tt.prototype.evaluate=function(t){var e=ut.getFunctionFromContext(this.functionName,t);if(!e)throw new Error("Unknown function "+this.functionName);var n=[t].concat(this.arguments);return e.apply(t.functionResolver.thisArg,n)};var et=new Object;function nt(t){arguments.length>0&&this.init(t)}function rt(t){arguments.length>0&&this.init(t)}function it(t){arguments.length>0&&this.init(t)}function ot(t){this.init(t)}function st(){this.init()}function at(t,e,n,r){this.isXPathNamespace=!0,this.baseNode=e,this.ownerDocument=r.ownerDocument,this.nodeName=t,this.prefix=t,this.localName=t,this.namespaceURI=null,this.nodeValue=n,this.ownerElement=r,this.nodeType=B}function ct(t,e,n){this.variableResolver=null!=t?t:new lt,this.namespaceResolver=null!=e?e:new ht,this.functionResolver=null!=n?n:new ut}function lt(){}function ut(t){this.thisArg=null!=t?t:dt,this.functions=new Object,this.addStandardFunctions()}function ht(){}et.equals=function(t,e){return t.equals(e)},et.notequal=function(t,e){return t.notequal(e)},et.lessthan=function(t,e){return t.lessthan(e)},et.greaterthan=function(t,e){return t.greaterthan(e)},et.lessthanorequal=function(t,e){return t.lessthanorequal(e)},et.greaterthanorequal=function(t,e){return t.greaterthanorequal(e)},nt.prototype=new b,nt.prototype.constructor=nt,nt.superclass=b.prototype,nt.prototype.init=function(t){this.str=String(t)},nt.prototype.toString=function(){return this.str},nt.prototype.evaluate=function(t){return this},nt.prototype.string=function(){return this},nt.prototype.number=function(){return new rt(this.str)},nt.prototype.bool=function(){return new it(this.str)},nt.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},nt.prototype.stringValue=function(){return this.str},nt.prototype.numberValue=function(){return this.number().numberValue()},nt.prototype.booleanValue=function(){return this.bool().booleanValue()},nt.prototype.equals=function(t){return pt.instance_of(t,it)?this.bool().equals(t):pt.instance_of(t,rt)?this.number().equals(t):pt.instance_of(t,st)?t.compareWithString(this,et.equals):new it(this.str==t.str)},nt.prototype.notequal=function(t){return pt.instance_of(t,it)?this.bool().notequal(t):pt.instance_of(t,rt)?this.number().notequal(t):pt.instance_of(t,st)?t.compareWithString(this,et.notequal):new it(this.str!=t.str)},nt.prototype.lessthan=function(t){return this.number().lessthan(t)},nt.prototype.greaterthan=function(t){return this.number().greaterthan(t)},nt.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},nt.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},rt.prototype=new b,rt.prototype.constructor=rt,rt.superclass=b.prototype,rt.prototype.init=function(t){this.num="string"==typeof t?this.parse(t):Number(t)},rt.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,rt.prototype.parse=function(t){return this.numberFormat.test(t)?parseFloat(t):Number.NaN},rt.prototype.toString=function(){var t=this.num.toString();return-1!==t.indexOf("e-")?function(t){for(var e=t.split("e-"),n=e[0].replace(".",""),r=Number(e[1]),i=0;i<r-1;i+=1)n="0"+n;return"0."+n}(t):-1!==t.indexOf("e")?function(t){for(var e=t.split("e"),n=e[0].replace(".",""),r=Number(e[1])+1-n.length,i=0;i<r;i+=1)n+="0";return n}(t):t},rt.prototype.evaluate=function(t){return this},rt.prototype.string=function(){return new nt(this.toString())},rt.prototype.number=function(){return this},rt.prototype.bool=function(){return new it(this.num)},rt.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},rt.prototype.stringValue=function(){return this.string().stringValue()},rt.prototype.numberValue=function(){return this.num},rt.prototype.booleanValue=function(){return this.bool().booleanValue()},rt.prototype.negate=function(){return new rt(-this.num)},rt.prototype.equals=function(t){return pt.instance_of(t,it)?this.bool().equals(t):pt.instance_of(t,nt)?this.equals(t.number()):pt.instance_of(t,st)?t.compareWithNumber(this,et.equals):new it(this.num==t.num)},rt.prototype.notequal=function(t){return pt.instance_of(t,it)?this.bool().notequal(t):pt.instance_of(t,nt)?this.notequal(t.number()):pt.instance_of(t,st)?t.compareWithNumber(this,et.notequal):new it(this.num!=t.num)},rt.prototype.lessthan=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.greaterthan):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.lessthan(t.number()):new it(this.num<t.num)},rt.prototype.greaterthan=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.lessthan):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.greaterthan(t.number()):new it(this.num>t.num)},rt.prototype.lessthanorequal=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.greaterthanorequal):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.lessthanorequal(t.number()):new it(this.num<=t.num)},rt.prototype.greaterthanorequal=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.lessthanorequal):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.greaterthanorequal(t.number()):new it(this.num>=t.num)},rt.prototype.plus=function(t){return new rt(this.num+t.num)},rt.prototype.minus=function(t){return new rt(this.num-t.num)},rt.prototype.multiply=function(t){return new rt(this.num*t.num)},rt.prototype.div=function(t){return new rt(this.num/t.num)},rt.prototype.mod=function(t){return new rt(this.num%t.num)},it.prototype=new b,it.prototype.constructor=it,it.superclass=b.prototype,it.prototype.init=function(t){this.b=Boolean(t)},it.prototype.toString=function(){return this.b.toString()},it.prototype.evaluate=function(t){return this},it.prototype.string=function(){return new nt(this.b)},it.prototype.number=function(){return new rt(this.b)},it.prototype.bool=function(){return this},it.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},it.prototype.stringValue=function(){return this.string().stringValue()},it.prototype.numberValue=function(){return this.number().numberValue()},it.prototype.booleanValue=function(){return this.b},it.prototype.not=function(){return new it(!this.b)},it.prototype.equals=function(t){return pt.instance_of(t,nt)||pt.instance_of(t,rt)?this.equals(t.bool()):pt.instance_of(t,st)?t.compareWithBoolean(this,et.equals):new it(this.b==t.b)},it.prototype.notequal=function(t){return pt.instance_of(t,nt)||pt.instance_of(t,rt)?this.notequal(t.bool()):pt.instance_of(t,st)?t.compareWithBoolean(this,et.notequal):new it(this.b!=t.b)},it.prototype.lessthan=function(t){return this.number().lessthan(t)},it.prototype.greaterthan=function(t){return this.number().greaterthan(t)},it.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},it.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},it.true_=new it(!0),it.false_=new it(!1),ot.prototype=new Object,ot.prototype.constructor=ot,ot.superclass=Object.prototype,ot.prototype.init=function(t){this.left=null,this.right=null,this.node=t,this.depth=1},ot.prototype.balance=function(){var t=null==this.left?0:this.left.depth,e=null==this.right?0:this.right.depth;if(t>e+1)(null==this.left.left?0:this.left.left.depth)<(null==this.left.right?0:this.left.right.depth)&&this.left.rotateRR(),this.rotateLL();else if(t+1<e){var n=null==this.right.right?0:this.right.right.depth;(null==this.right.left?0:this.right.left.depth)>n&&this.right.rotateLL(),this.rotateRR()}},ot.prototype.rotateLL=function(){var t=this.node,e=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=e,this.right.node=t,this.right.updateInNewLocation(),this.updateInNewLocation()},ot.prototype.rotateRR=function(){var t=this.node,e=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=e,this.left.node=t,this.left.updateInNewLocation(),this.updateInNewLocation()},ot.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},ot.prototype.getDepthFromChildren=function(){this.depth=null==this.node?0:1,null!=this.left&&(this.depth=this.left.depth+1),null!=this.right&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)},ot.prototype.add=function(t){if(t===this.node)return!1;var e=function(t,e){if(t===e)return 0;if(t.compareDocumentPosition){var n=t.compareDocumentPosition(e);return 1&n||10&n?1:20&n?-1:0}for(var r=0,i=0,o=t;null!=o;o=o.parentNode||o.ownerElement)r++;for(var s=e;null!=s;s=s.parentNode||s.ownerElement)i++;if(r>i){for(;r>i;)t=t.parentNode||t.ownerElement,r--;if(t===e)return 1}else if(i>r){for(;i>r;)e=e.parentNode||e.ownerElement,i--;if(t===e)return-1}for(var a=t.parentNode||t.ownerElement,c=e.parentNode||e.ownerElement;a!==c;)e=c,a=(t=a).parentNode||t.ownerElement,c=e.parentNode||e.ownerElement;var l=ft(t),u=ft(e);if(l&&!u)return-1;if(!l&&u)return 1;if(t.isXPathNamespace){if(t.nodeValue===C.XML_NAMESPACE_URI)return-1;if(!e.isXPathNamespace)return-1;if(e.nodeValue===C.XML_NAMESPACE_URI)return 1}else if(e.isXPathNamespace)return 1;if(a)for(var h=l?a.attributes:a.childNodes,d=h.length,p=t.baseNode||t,f=e.baseNode||e,g=0;g<d;g+=1){var A=h[g];if(A===p)return-1;if(A===f)return 1}throw new Error("Unexpected: could not determine node order")}(t,this.node),n=!1;return-1==e?null==this.left?(this.left=new ot(t),n=!0):(n=this.left.add(t))&&this.balance():1==e&&(null==this.right?(this.right=new ot(t),n=!0):(n=this.right.add(t))&&this.balance()),n&&this.getDepthFromChildren(),n},st.prototype=new b,st.prototype.constructor=st,st.superclass=b.prototype,st.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},st.prototype.toString=function(){var t=this.first();return null==t?"":this.stringForNode(t)},st.prototype.evaluate=function(t){return this},st.prototype.string=function(){return new nt(this.toString())},st.prototype.stringValue=function(){return this.toString()},st.prototype.number=function(){return new rt(this.string())},st.prototype.numberValue=function(){return Number(this.string())},st.prototype.bool=function(){return new it(this.booleanValue())},st.prototype.booleanValue=function(){return!!this.size},st.prototype.nodeset=function(){return this},st.prototype.stringForNode=function(t){return t.nodeType==m||t.nodeType==d||t.nodeType===y?this.stringForContainerNode(t):t.nodeType===p?t.value||t.nodeValue:t.isNamespaceNode?t.namespace:t.nodeValue},st.prototype.stringForContainerNode=function(t){for(var e="",n=t.firstChild;null!=n;n=n.nextSibling){var r=n.nodeType;1!==r&&3!==r&&4!==r&&9!==r&&11!==r||(e+=this.stringForNode(n))}return e},st.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new ot(this.nodes[0]);for(var t=1;t<this.nodes.length;t+=1)this.tree.add(this.nodes[t])}return this.tree},st.prototype.first=function(){var t=this.buildTree();if(null==t)return null;for(;null!=t.left;)t=t.left;return t.node},st.prototype.add=function(t){for(var e=0;e<this.nodes.length;e+=1)if(t===this.nodes[e])return;this.tree=null,this.nodes.push(t),this.size+=1},st.prototype.addArray=function(t){var e=this;r(function(t){e.add(t)},t)},st.prototype.toArray=function(){var t=[];return this.toArrayRec(this.buildTree(),t),t},st.prototype.toArrayRec=function(t,e){null!=t&&(this.toArrayRec(t.left,e),e.push(t.node),this.toArrayRec(t.right,e))},st.prototype.toUnsortedArray=function(){return this.nodes.slice()},st.prototype.compareWithString=function(t,e){for(var n=this.toUnsortedArray(),r=0;r<n.length;r++){var i=n[r],o=e(new nt(this.stringForNode(i)),t);if(o.booleanValue())return o}return new it(!1)},st.prototype.compareWithNumber=function(t,e){for(var n=this.toUnsortedArray(),r=0;r<n.length;r++){var i=n[r],o=e(new rt(this.stringForNode(i)),t);if(o.booleanValue())return o}return new it(!1)},st.prototype.compareWithBoolean=function(t,e){return e(this.bool(),t)},st.prototype.compareWithNodeSet=function(t,e){for(var n=this.toUnsortedArray(),r=function(t,n){return e(n,t)},i=0;i<n.length;i++){var o=new nt(this.stringForNode(n[i])),s=t.compareWithString(o,r);if(s.booleanValue())return s}return new it(!1)},st.compareWith=function(t){var e=Array.prototype.slice,n=t.length,r=function(){var i=e.call(arguments);return i.length<n?function(t,n){return function(){return n.apply(this,t.concat(e.call(arguments)))}}(i,r):t.apply(this,e.apply(arguments,[0,n]))};return r}(function(t,e){return pt.instance_of(e,nt)?this.compareWithString(e,t):pt.instance_of(e,rt)?this.compareWithNumber(e,t):pt.instance_of(e,it)?this.compareWithBoolean(e,t):this.compareWithNodeSet(e,t)}),st.prototype.equals=st.compareWith(et.equals),st.prototype.notequal=st.compareWith(et.notequal),st.prototype.lessthan=st.compareWith(et.lessthan),st.prototype.greaterthan=st.compareWith(et.greaterthan),st.prototype.lessthanorequal=st.compareWith(et.lessthanorequal),st.prototype.greaterthanorequal=st.compareWith(et.greaterthanorequal),st.prototype.union=function(t){var e=new st;return e.addArray(this.toUnsortedArray()),e.addArray(t.toUnsortedArray()),e},at.prototype=new Object,at.prototype.constructor=at,at.superclass=Object.prototype,at.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},ct.prototype=new Object,ct.prototype.constructor=ct,ct.superclass=Object.prototype,ct.prototype.extend=function(t){return h(new ct,this,t)},lt.prototype=new Object,lt.prototype.constructor=lt,lt.superclass=Object.prototype,lt.prototype.getVariable=function(t,e){return null},ut.prototype=new Object,ut.prototype.constructor=ut,ut.superclass=Object.prototype,ut.prototype.addStandardFunctions=function(){this.functions["{}last"]=dt.last,this.functions["{}position"]=dt.position,this.functions["{}count"]=dt.count,this.functions["{}id"]=dt.id,this.functions["{}local-name"]=dt.localName,this.functions["{}namespace-uri"]=dt.namespaceURI,this.functions["{}name"]=dt.name,this.functions["{}string"]=dt.string,this.functions["{}concat"]=dt.concat,this.functions["{}starts-with"]=dt.startsWith,this.functions["{}contains"]=dt.contains,this.functions["{}substring-before"]=dt.substringBefore,this.functions["{}substring-after"]=dt.substringAfter,this.functions["{}substring"]=dt.substring,this.functions["{}string-length"]=dt.stringLength,this.functions["{}normalize-space"]=dt.normalizeSpace,this.functions["{}translate"]=dt.translate,this.functions["{}boolean"]=dt.boolean_,this.functions["{}not"]=dt.not,this.functions["{}true"]=dt.true_,this.functions["{}false"]=dt.false_,this.functions["{}lang"]=dt.lang,this.functions["{}number"]=dt.number,this.functions["{}sum"]=dt.sum,this.functions["{}floor"]=dt.floor,this.functions["{}ceiling"]=dt.ceiling,this.functions["{}round"]=dt.round},ut.prototype.addFunction=function(t,e,n){this.functions["{"+t+"}"+e]=n},ut.getFunctionFromContext=function(t,e){var n=pt.resolveQName(t,e.namespaceResolver,e.contextNode,!1);if(null===n[0])throw new Error("Cannot resolve QName "+name);return e.functionResolver.getFunction(n[1],n[0])},ut.prototype.getFunction=function(t,e){return this.functions["{"+e+"}"+t]},ht.prototype=new Object,ht.prototype.constructor=ht,ht.superclass=Object.prototype,ht.prototype.getNamespace=function(t,e){if("xml"==t)return C.XML_NAMESPACE_URI;if("xmlns"==t)return C.XMLNS_NAMESPACE_URI;for(e.nodeType==m?e=e.documentElement:e.nodeType==p?e=j.getOwnerElement(e):e.nodeType!=d&&(e=e.parentNode);null!=e&&e.nodeType==d;){for(var n=e.attributes,r=0;r<n.length;r++){var i=n.item(r),o=i.name||i.nodeName;if("xmlns"===o&&""===t||o==="xmlns:"+t)return String(i.value||i.nodeValue)}e=e.parentNode}return null};var dt=new Object;dt.last=function(t){if(1!=arguments.length)throw new Error("Function last expects ()");return new rt(t.contextSize)},dt.position=function(t){if(1!=arguments.length)throw new Error("Function position expects ()");return new rt(t.contextPosition)},dt.count=function(){var t,e=arguments[0];if(2!=arguments.length||!pt.instance_of(t=arguments[1].evaluate(e),st))throw new Error("Function count expects (node-set)");return new rt(t.size)},dt.id=function(){var t,e=arguments[0];if(2!=arguments.length)throw new Error("Function id expects (object)");t=arguments[1].evaluate(e);for(var n=(t=pt.instance_of(t,st)?t.toArray().join(" "):t.stringValue()).split(/[\x0d\x0a\x09\x20]+/),r=new st,i=e.contextNode.nodeType==m?e.contextNode:e.contextNode.ownerDocument,o=0;o<n.length;o++){var s;null!=(s=i.getElementById?i.getElementById(n[o]):pt.getElementById(i,n[o]))&&r.add(s)}return r},dt.localName=function(t,e){var n;if(1==arguments.length)n=t.contextNode;else{if(2!=arguments.length)throw new Error("Function local-name expects (node-set?)");n=e.evaluate(t).first()}return new nt(null==n?"":n.localName||n.baseName||n.target||n.nodeName||"")},dt.namespaceURI=function(){var t,e=arguments[0];if(1==arguments.length)t=e.contextNode;else{if(2!=arguments.length)throw new Error("Function namespace-uri expects (node-set?)");t=arguments[1].evaluate(e).first()}return new nt(null==t?"":t.namespaceURI||"")},dt.name=function(){var t,e=arguments[0];if(1==arguments.length)t=e.contextNode;else{if(2!=arguments.length)throw new Error("Function name expects (node-set?)");t=arguments[1].evaluate(e).first()}return null==t?new nt(""):t.nodeType==d?new nt(t.nodeName):t.nodeType==p?new nt(t.name||t.nodeName):t.nodeType===A?new nt(t.target||t.nodeName):null==t.localName?new nt(""):new nt(t.localName)},dt.string=function(){var t=arguments[0];if(1==arguments.length)return new nt(st.prototype.stringForNode(t.contextNode));if(2==arguments.length)return arguments[1].evaluate(t).string();throw new Error("Function string expects (object?)")},dt.concat=function(t){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var e="",n=1;n<arguments.length;n++)e+=arguments[n].evaluate(t).stringValue();return new nt(e)},dt.startsWith=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function startsWith expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new it(e.substring(0,n.length)==n)},dt.contains=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function contains expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new it(-1!==e.indexOf(n))},dt.substringBefore=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function substring-before expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new nt(e.substring(0,e.indexOf(n)))},dt.substringAfter=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function substring-after expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();if(0==n.length)return new nt(e);var r=e.indexOf(n);return new nt(-1==r?"":e.substring(r+n.length))},dt.substring=function(){var t=arguments[0];if(3!=arguments.length&&4!=arguments.length)throw new Error("Function substring expects (string, number, number?)");var e=arguments[1].evaluate(t).stringValue(),n=Math.round(arguments[2].evaluate(t).numberValue())-1,r=4==arguments.length?n+Math.round(arguments[3].evaluate(t).numberValue()):void 0;return new nt(e.substring(n,r))},dt.stringLength=function(){var t,e=arguments[0];if(1==arguments.length)t=st.prototype.stringForNode(e.contextNode);else{if(2!=arguments.length)throw new Error("Function string-length expects (string?)");t=arguments[1].evaluate(e).stringValue()}return new rt(t.length)},dt.normalizeSpace=function(){var t,e=arguments[0];if(1==arguments.length)t=st.prototype.stringForNode(e.contextNode);else{if(2!=arguments.length)throw new Error("Function normalize-space expects (string?)");t=arguments[1].evaluate(e).stringValue()}for(var n=0,r=t.length-1;pt.isSpace(t.charCodeAt(r));)r--;for(var i="";n<=r&&pt.isSpace(t.charCodeAt(n));)n++;for(;n<=r;)if(pt.isSpace(t.charCodeAt(n)))for(i+=" ";n<=r&&pt.isSpace(t.charCodeAt(n));)n++;else i+=t.charAt(n),n++;return new nt(i)},dt.translate=function(t,e,n,r){if(4!=arguments.length)throw new Error("Function translate expects (string, string, string)");var s=e.evaluate(t).stringValue(),a=n.evaluate(t).stringValue(),l=r.evaluate(t).stringValue(),u=i(function(t,e,n){return e in t||(t[e]=n>l.length?"":l[n]),t},{},a);return new nt(c("",o(function(t){return t in u?u[t]:t},s)))},dt.boolean_=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(t).bool()},dt.not=function(t,e){if(2!=arguments.length)throw new Error("Function not expects (object)");return e.evaluate(t).bool().not()},dt.true_=function(){if(1!=arguments.length)throw new Error("Function true expects ()");return it.true_},dt.false_=function(){if(1!=arguments.length)throw new Error("Function false expects ()");return it.false_},dt.lang=function(){var t,e=arguments[0];if(2!=arguments.length)throw new Error("Function lang expects (string)");for(var n=e.contextNode;null!=n&&n.nodeType!=m;n=n.parentNode){var r=n.getAttributeNS(C.XML_NAMESPACE_URI,"lang");if(null!=r){t=String(r);break}}if(null==t)return it.false_;var i=arguments[1].evaluate(e).stringValue();return new it(t.substring(0,i.length)==i&&(t.length==i.length||"-"==t.charAt(i.length)))},dt.number=function(){var t=arguments[0];if(1!=arguments.length&&2!=arguments.length)throw new Error("Function number expects (object?)");return 1==arguments.length?new rt(st.prototype.stringForNode(t.contextNode)):arguments[1].evaluate(t).number()},dt.sum=function(){var t,e=arguments[0];if(2!=arguments.length||!pt.instance_of(t=arguments[1].evaluate(e),st))throw new Error("Function sum expects (node-set)");t=t.toUnsortedArray();for(var n=0,r=0;r<t.length;r++)n+=new rt(st.prototype.stringForNode(t[r])).numberValue();return new rt(n)},dt.floor=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function floor expects (number)");return new rt(Math.floor(arguments[1].evaluate(t).numberValue()))},dt.ceiling=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function ceiling expects (number)");return new rt(Math.ceil(arguments[1].evaluate(t).numberValue()))},dt.round=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function round expects (number)");return new rt(Math.round(arguments[1].evaluate(t).numberValue()))};var pt=new Object,ft=function(t){return t&&(t.nodeType===p||t.ownerElement||t.isXPathNamespace)};pt.splitQName=function(t){var e=t.indexOf(":");return-1==e?[null,t]:[t.substring(0,e),t.substring(e+1)]},pt.resolveQName=function(t,e,n,r){var i=pt.splitQName(t);return null!=i[0]?i[0]=e.getNamespace(i[0],n):r?(i[0]=e.getNamespace("",n),null==i[0]&&(i[0]="")):i[0]="",i},pt.isSpace=function(t){return 9==t||13==t||10==t||32==t},pt.isLetter=function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=255||t>=256&&t<=305||t>=308&&t<=318||t>=321&&t<=328||t>=330&&t<=382||t>=384&&t<=451||t>=461&&t<=496||t>=500&&t<=501||t>=506&&t<=535||t>=592&&t<=680||t>=699&&t<=705||902==t||t>=904&&t<=906||908==t||t>=910&&t<=929||t>=931&&t<=974||t>=976&&t<=982||986==t||988==t||990==t||992==t||t>=994&&t<=1011||t>=1025&&t<=1036||t>=1038&&t<=1103||t>=1105&&t<=1116||t>=1118&&t<=1153||t>=1168&&t<=1220||t>=1223&&t<=1224||t>=1227&&t<=1228||t>=1232&&t<=1259||t>=1262&&t<=1269||t>=1272&&t<=1273||t>=1329&&t<=1366||1369==t||t>=1377&&t<=1414||t>=1488&&t<=1514||t>=1520&&t<=1522||t>=1569&&t<=1594||t>=1601&&t<=1610||t>=1649&&t<=1719||t>=1722&&t<=1726||t>=1728&&t<=1742||t>=1744&&t<=1747||1749==t||t>=1765&&t<=1766||t>=2309&&t<=2361||2365==t||t>=2392&&t<=2401||t>=2437&&t<=2444||t>=2447&&t<=2448||t>=2451&&t<=2472||t>=2474&&t<=2480||2482==t||t>=2486&&t<=2489||t>=2524&&t<=2525||t>=2527&&t<=2529||t>=2544&&t<=2545||t>=2565&&t<=2570||t>=2575&&t<=2576||t>=2579&&t<=2600||t>=2602&&t<=2608||t>=2610&&t<=2611||t>=2613&&t<=2614||t>=2616&&t<=2617||t>=2649&&t<=2652||2654==t||t>=2674&&t<=2676||t>=2693&&t<=2699||2701==t||t>=2703&&t<=2705||t>=2707&&t<=2728||t>=2730&&t<=2736||t>=2738&&t<=2739||t>=2741&&t<=2745||2749==t||2784==t||t>=2821&&t<=2828||t>=2831&&t<=2832||t>=2835&&t<=2856||t>=2858&&t<=2864||t>=2866&&t<=2867||t>=2870&&t<=2873||2877==t||t>=2908&&t<=2909||t>=2911&&t<=2913||t>=2949&&t<=2954||t>=2958&&t<=2960||t>=2962&&t<=2965||t>=2969&&t<=2970||2972==t||t>=2974&&t<=2975||t>=2979&&t<=2980||t>=2984&&t<=2986||t>=2990&&t<=2997||t>=2999&&t<=3001||t>=3077&&t<=3084||t>=3086&&t<=3088||t>=3090&&t<=3112||t>=3114&&t<=3123||t>=3125&&t<=3129||t>=3168&&t<=3169||t>=3205&&t<=3212||t>=3214&&t<=3216||t>=3218&&t<=3240||t>=3242&&t<=3251||t>=3253&&t<=3257||3294==t||t>=3296&&t<=3297||t>=3333&&t<=3340||t>=3342&&t<=3344||t>=3346&&t<=3368||t>=3370&&t<=3385||t>=3424&&t<=3425||t>=3585&&t<=3630||3632==t||t>=3634&&t<=3635||t>=3648&&t<=3653||t>=3713&&t<=3714||3716==t||t>=3719&&t<=3720||3722==t||3725==t||t>=3732&&t<=3735||t>=3737&&t<=3743||t>=3745&&t<=3747||3749==t||3751==t||t>=3754&&t<=3755||t>=3757&&t<=3758||3760==t||t>=3762&&t<=3763||3773==t||t>=3776&&t<=3780||t>=3904&&t<=3911||t>=3913&&t<=3945||t>=4256&&t<=4293||t>=4304&&t<=4342||4352==t||t>=4354&&t<=4355||t>=4357&&t<=4359||4361==t||t>=4363&&t<=4364||t>=4366&&t<=4370||4412==t||4414==t||4416==t||4428==t||4430==t||4432==t||t>=4436&&t<=4437||4441==t||t>=4447&&t<=4449||4451==t||4453==t||4455==t||4457==t||t>=4461&&t<=4462||t>=4466&&t<=4467||4469==t||4510==t||4520==t||4523==t||t>=4526&&t<=4527||t>=4535&&t<=4536||4538==t||t>=4540&&t<=4546||4587==t||4592==t||4601==t||t>=7680&&t<=7835||t>=7840&&t<=7929||t>=7936&&t<=7957||t>=7960&&t<=7965||t>=7968&&t<=8005||t>=8008&&t<=8013||t>=8016&&t<=8023||8025==t||8027==t||8029==t||t>=8031&&t<=8061||t>=8064&&t<=8116||t>=8118&&t<=8124||8126==t||t>=8130&&t<=8132||t>=8134&&t<=8140||t>=8144&&t<=8147||t>=8150&&t<=8155||t>=8160&&t<=8172||t>=8178&&t<=8180||t>=8182&&t<=8188||8486==t||t>=8490&&t<=8491||8494==t||t>=8576&&t<=8578||t>=12353&&t<=12436||t>=12449&&t<=12538||t>=12549&&t<=12588||t>=44032&&t<=55203||t>=19968&&t<=40869||12295==t||t>=12321&&t<=12329},pt.isNCNameChar=function(t){return t>=48&&t<=57||t>=1632&&t<=1641||t>=1776&&t<=1785||t>=2406&&t<=2415||t>=2534&&t<=2543||t>=2662&&t<=2671||t>=2790&&t<=2799||t>=2918&&t<=2927||t>=3047&&t<=3055||t>=3174&&t<=3183||t>=3302&&t<=3311||t>=3430&&t<=3439||t>=3664&&t<=3673||t>=3792&&t<=3801||t>=3872&&t<=3881||46==t||45==t||95==t||pt.isLetter(t)||t>=768&&t<=837||t>=864&&t<=865||t>=1155&&t<=1158||t>=1425&&t<=1441||t>=1443&&t<=1465||t>=1467&&t<=1469||1471==t||t>=1473&&t<=1474||1476==t||t>=1611&&t<=1618||1648==t||t>=1750&&t<=1756||t>=1757&&t<=1759||t>=1760&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t>=2305&&t<=2307||2364==t||t>=2366&&t<=2380||2381==t||t>=2385&&t<=2388||t>=2402&&t<=2403||t>=2433&&t<=2435||2492==t||2494==t||2495==t||t>=2496&&t<=2500||t>=2503&&t<=2504||t>=2507&&t<=2509||2519==t||t>=2530&&t<=2531||2562==t||2620==t||2622==t||2623==t||t>=2624&&t<=2626||t>=2631&&t<=2632||t>=2635&&t<=2637||t>=2672&&t<=2673||t>=2689&&t<=2691||2748==t||t>=2750&&t<=2757||t>=2759&&t<=2761||t>=2763&&t<=2765||t>=2817&&t<=2819||2876==t||t>=2878&&t<=2883||t>=2887&&t<=2888||t>=2891&&t<=2893||t>=2902&&t<=2903||t>=2946&&t<=2947||t>=3006&&t<=3010||t>=3014&&t<=3016||t>=3018&&t<=3021||3031==t||t>=3073&&t<=3075||t>=3134&&t<=3140||t>=3142&&t<=3144||t>=3146&&t<=3149||t>=3157&&t<=3158||t>=3202&&t<=3203||t>=3262&&t<=3268||t>=3270&&t<=3272||t>=3274&&t<=3277||t>=3285&&t<=3286||t>=3330&&t<=3331||t>=3390&&t<=3395||t>=3398&&t<=3400||t>=3402&&t<=3405||3415==t||3633==t||t>=3636&&t<=3642||t>=3655&&t<=3662||3761==t||t>=3764&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=3864&&t<=3865||3893==t||3895==t||3897==t||3902==t||3903==t||t>=3953&&t<=3972||t>=3974&&t<=3979||t>=3984&&t<=3989||3991==t||t>=3993&&t<=4013||t>=4017&&t<=4023||4025==t||t>=8400&&t<=8412||8417==t||t>=12330&&t<=12335||12441==t||12442==t||183==t||720==t||721==t||903==t||1600==t||3654==t||3782==t||12293==t||t>=12337&&t<=12341||t>=12445&&t<=12446||t>=12540&&t<=12542},pt.coalesceText=function(t){for(var e=t.firstChild;null!=e;e=e.nextSibling)if(e.nodeType==f||e.nodeType==g){var n=e.nodeValue,r=e;for(e=e.nextSibling;null!=e&&(e.nodeType==f||e.nodeType==g);){n+=e.nodeValue;var i=e;e=e.nextSibling,i.parentNode.removeChild(i)}if(r.nodeType==g){var o=r.parentNode;if(null==r.nextSibling)o.removeChild(r),o.appendChild(o.ownerDocument.createTextNode(n));else{var s=r.nextSibling;o.removeChild(r),o.insertBefore(o.ownerDocument.createTextNode(n),s)}}else r.nodeValue=n;if(null==e)break}else e.nodeType==d&&pt.coalesceText(e)},pt.instance_of=function(t,e){for(;null!=t;){if(t.constructor===e)return!0;if(t===Object)return!1;t=t.constructor.superclass}return!1},pt.getElementById=function(t,e){if(t.nodeType==d&&(t.getAttribute("id")==e||t.getAttributeNS(null,"id")==e))return t;for(var n=t.firstChild;null!=n;n=n.nextSibling){var r=pt.getElementById(n,e);if(null!=r)return r}return null};var gt=function(){function t(e,n,r){var i=Error.call(this,function(e,n){var r=n?": "+n.toString():"";switch(e){case t.INVALID_EXPRESSION_ERR:return"Invalid expression"+r;case t.TYPE_ERR:return"Type error"+r}return null}(e,n)||r);return i.code=e,i.exception=n,i}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.superclass=Error,t.prototype.toString=function(){return this.message},t.fromMessage=function(e,n){return new t(null,n,e)},t.INVALID_EXPRESSION_ERR=51,t.TYPE_ERR=52,t}();function At(t,e,n){this.xpath=n.parse(t),this.context=new ct,this.context.namespaceResolver=new Et(e)}function Et(t){this.xpathNSResolver=t}function mt(t){this.node=t,this.namespaceResolver=new ht}function wt(t,e){switch(e==wt.ANY_TYPE&&(t.constructor===nt?e=wt.STRING_TYPE:t.constructor===rt?e=wt.NUMBER_TYPE:t.constructor===it?e=wt.BOOLEAN_TYPE:t.constructor===st&&(e=wt.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=e,e){case wt.NUMBER_TYPE:return void(this.numberValue=t.numberValue());case wt.STRING_TYPE:return void(this.stringValue=t.stringValue());case wt.BOOLEAN_TYPE:return void(this.booleanValue=t.booleanValue());case wt.ANY_UNORDERED_NODE_TYPE:case wt.FIRST_ORDERED_NODE_TYPE:if(t.constructor===st)return void(this.singleNodeValue=t.first());break;case wt.UNORDERED_NODE_ITERATOR_TYPE:case wt.ORDERED_NODE_ITERATOR_TYPE:if(t.constructor===st)return this.invalidIteratorState=!1,this.nodes=t.toArray(),void(this.iteratorIndex=0);break;case wt.UNORDERED_NODE_SNAPSHOT_TYPE:case wt.ORDERED_NODE_SNAPSHOT_TYPE:if(t.constructor===st)return this.nodes=t.toArray(),void(this.snapshotLength=this.nodes.length)}throw new gt(gt.TYPE_ERR)}function yt(t,e){t.createExpression=function(t,n){try{return new At(t,n,e)}catch(t){throw new gt(gt.INVALID_EXPRESSION_ERR,t)}},t.createNSResolver=function(t){return new mt(t)},t.evaluate=function(n,r,i,o,s){if(o<0||o>9)throw{code:0,toString:function(){return"Request type not supported"}};return t.createExpression(n,i,e).evaluate(r,o,s)}}At.prototype={},At.prototype.constructor=At,At.superclass=Object.prototype,At.getOwnerDocument=function(t){return t.nodeType===m?t:t.ownerDocument},At.detectHtmlDom=function(t){if(!t)return!1;var e=At.getOwnerDocument(t);try{return e.implementation.hasFeature("HTML","2.0")}catch(t){return!0}},At.prototype.evaluate=function(t,e,n){return this.context.expressionContextNode=t,this.context.caseInsensitive=At.detectHtmlDom(t),new wt(this.xpath.evaluate(this.context),e)},Et.prototype={},Et.prototype.constructor=Et,Et.superclass=Object.prototype,Et.prototype.getNamespace=function(t,e){return null==this.xpathNSResolver?null:this.xpathNSResolver.lookupNamespaceURI(t)},mt.prototype={},mt.prototype.constructor=mt,mt.superclass=Object.prototype,mt.prototype.lookupNamespaceURI=function(t){return this.namespaceResolver.getNamespace(t,this.node)},wt.prototype={},wt.prototype.constructor=wt,wt.superclass=Object.prototype,wt.prototype.iterateNext=function(){if(this.resultType!=wt.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=wt.ORDERED_NODE_ITERATOR_TYPE)throw new gt(gt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},wt.prototype.snapshotItem=function(t){if(this.resultType!=wt.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=wt.ORDERED_NODE_SNAPSHOT_TYPE)throw new gt(gt.TYPE_ERR);return this.nodes[t]},wt.ANY_TYPE=0,wt.NUMBER_TYPE=1,wt.STRING_TYPE=2,wt.BOOLEAN_TYPE=3,wt.UNORDERED_NODE_ITERATOR_TYPE=4,wt.ORDERED_NODE_ITERATOR_TYPE=5,wt.UNORDERED_NODE_SNAPSHOT_TYPE=6,wt.ORDERED_NODE_SNAPSHOT_TYPE=7,wt.ANY_UNORDERED_NODE_TYPE=8,wt.FIRST_ORDERED_NODE_TYPE=9;try{var Bt=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(Bt=!1)}catch(t){}Bt&&yt(document,new I)}catch(t){}yt(t,new I),function(){var e=new I,n=new ht,r=new ut,i=new lt;function o(t){return{getNamespace:function(e,r){return t(e,r)||n.getNamespace(e,r)}}}function s(t){return t&&"function"==typeof t.getNamespace?o((e=t).getNamespace.bind(e)):"function"==typeof t?o(t):"object"==typeof t?function(t){return o(function(e){return t[e]})}(t):n;var e}function a(t){if(null==t||t instanceof nt||t instanceof it||t instanceof rt||t instanceof st)return t;switch(typeof t){case"string":return new nt(t);case"boolean":return new it(t);case"number":return new rt(t)}var e=new st;return e.addArray([].concat(t)),e}function c(t){return{getFunction:function(e,n){var i=t(e,n);return i?function(t){return function(e){var n=Array.prototype.slice.call(arguments,1).map(function(t){return t.evaluate(e)});return a(t.apply(this,[].concat(e,n)))}}(i):r.getFunction(e,n)}}}function l(t){return t&&"function"==typeof t.getFunction?c((e=t).getFunction.bind(e)):"function"==typeof t?c(t):"object"==typeof t?function(t){return c(function(e){return t[e]})}(t):r;var e}function u(t){return{getVariable:function(e,n){return a(t(e,n))}}}function h(t,e,n){t in n&&(e[t]=n[t])}function d(t){var e=new ct;return t?(e.namespaceResolver=s(t.namespaces),e.functionResolver=l(t.functions),e.variableResolver=function(t){if(t){if("function"==typeof t.getVariable)return u(t.getVariable.bind(t));if("function"==typeof t)return u(t);if("object"==typeof t)return u(function(e){return t[e]})}return i}(t.variables),e.expressionContextNode=t.node,h("allowAnyNamespaceForNoPrefix",e,t),h("isHtml",e,t)):e.namespaceResolver=n,e}var p={evaluate:function(t){return function(t,e){var n=d(e);return t.evaluate(n)}(this.expression,t)},evaluateNumber:function(t){return this.evaluate(t).numberValue()},evaluateString:function(t){return this.evaluate(t).stringValue()},evaluateBoolean:function(t){return this.evaluate(t).booleanValue()},evaluateNodeSet:function(t){return this.evaluate(t).nodeset()},select:function(t){return this.evaluateNodeSet(t).toArray()},select1:function(t){return this.select(t)[0]}};t.parse=function(t){var n=e.parse(t);return Object.create(p,{expression:{value:n}})}}(),h(t,{XPath:C,XPathParser:I,XPathResult:wt,Step:K,PathExpr:j,NodeTest:X,LocationPath:q,OrOperation:N,AndOperation:S,BarOperation:V,EqualsOperation:_,NotEqualOperation:L,LessThanOperation:x,GreaterThanOperation:R,LessThanOrEqualOperation:F,GreaterThanOrEqualOperation:k,PlusOperation:O,MinusOperation:Q,MultiplyOperation:U,DivOperation:P,ModOperation:G,UnaryMinusOperation:v,FunctionCall:tt,VariableReference:$,XPathContext:ct,XNodeSet:st,XBoolean:it,XString:nt,XNumber:rt,NamespaceResolver:ht,FunctionResolver:ut,VariableResolver:lt,Utilities:pt}),t.select=function(e,n,r){return t.selectWithResolver(e,n,null,r)},t.useNamespaces=function(e){var n={mappings:e||{},lookupNamespaceURI:function(t){return this.mappings[t]}};return function(e,r,i){return t.selectWithResolver(e,r,n,i)}},t.selectWithResolver=function(t,e,n,r){var i=new At(t,n,new I),o=wt.ANY_TYPE,s=i.evaluate(e,o,null);return s.resultType==wt.STRING_TYPE?s=s.stringValue:s.resultType==wt.NUMBER_TYPE?s=s.numberValue:s.resultType==wt.BOOLEAN_TYPE?s=s.booleanValue:(s=s.nodes,r&&(s=s[0])),s},t.select1=function(e,n){return t.select(e,n,!0)};var It=function(t){return function(e){return n(e)&&e.nodeType===t}};h(t,{isNodeLike:n,isArrayOfNodes:function(t){return Array.isArray(t)&&t.every(n)},isElement:It(d),isAttribute:It(p),isTextNode:It(f),isCDATASection:It(g),isProcessingInstruction:It(A),isComment:It(E),isDocumentNode:It(m),isDocumentTypeNode:It(w),isDocumentFragment:It(y)})}(e)},928(){},2447(){},7790(){},4874(t,e,n){"use strict";const r=n(793);t.exports=h;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:E,mapHttpResponse:E,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:E,res:E,err:g,errWithCause:g};function s(t,e){return"silent"===t?1/0:e.levels.values[t]}const a=Symbol("pino.logFuncs"),c=Symbol("pino.hierarchy"),l={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function u(t,e){const n={logger:e,parent:t[c]};e[c]=n}function h(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){if(Array.isArray(t))return t.filter(function(t){return"!stdSerializers.err"!==t});return!0===t&&Object.keys(e)}(t.browser.serialize,r);let c=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(c=!1);const g=Object.keys(t.customLevels||{}),E=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof n&&E.forEach(function(t){n[t]=n}),(!1===t.enabled||t.browser.disabled)&&(t.level="silent");const m=t.level||"info",y=Object.create(n);y.log||(y.log=w),function(t,e,n){const r={};e.forEach(t=>{r[t]=n[t]?n[t]:i[t]||i[l[t]||"log"]||w}),t[a]=r}(y,E,n),u({},y),Object.defineProperty(y,"levelVal",{get:function(){return s(this.level,this)}}),Object.defineProperty(y,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,d(this,B,y,"error"),d(this,B,y,"fatal"),d(this,B,y,"warn"),d(this,B,y,"info"),d(this,B,y,"debug"),d(this,B,y,"trace"),g.forEach(t=>{d(this,B,y,t)})}});const B={transmit:e,serialize:o,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:E,timestamp:A(t),messageKey:t.messageKey||"msg",onChild:t.onChild||w};function I(n,i,s){if(!i)throw new Error("missing bindings for child Pino");s=s||{},o&&i.serializers&&(s.serializers=i.serializers);const a=s.serializers;if(o&&a){var c=Object.assign({},r,a),l=!0===t.browser.serialize?Object.keys(c):o;delete i.serializers,p([i],l,c,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.bindings=i,c&&(this.serializers=c,this._serialize=l),e&&(this._logEvent=f([].concat(t._logEvent.bindings,i)))}h.prototype=this;const d=new h(this);return u(this,d),d.child=function(...t){return I.call(this,n,...t)},d.level=s.level||this.level,n.onChild(d),d}return y.levels=function(t){const e=t.customLevels||{},n=Object.assign({},h.levels.values,e),r=Object.assign({},h.levels.labels,function(t){const e={};return Object.keys(t).forEach(function(n){e[t[n]]=n}),e}(e));return{values:n,labels:r}}(t),y.level=m,y.isLevelEnabled=function(t){return!!this.levels.values[t]&&this.levels.values[t]>=this.levels.values[this.level]},y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=w,y.serializers=r,y._serialize=o,y._stdErrSerialize=c,y.child=function(...t){return I.call(this,B,...t)},e&&(y._logEvent=f()),y}function d(t,e,n,o){if(Object.defineProperty(t,o,{value:s(t.level,n)>s(o,n)?w:n[a][o],writable:!0,enumerable:!0,configurable:!0}),t[o]===w){if(!e.transmit)return;const r=s(e.transmit.level||t.level,n);if(s(o,n)<r)return}t[o]=function(t,e,n,o){return c=t[a][o],function(){const a=e.timestamp(),l=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var h=0;h<l.length;h++)l[h]=arguments[h];var d=!1;if(e.serialize&&(p(l,this._serialize,this.serializers,this._stdErrSerialize),d=!0),e.asObject||e.formatters?c.call(u,...function(t,e,n,i,o){const{level:s,log:a=t=>t}=o.formatters||{},c=n.slice();let l=c[0];const u={};let h=1+(0|t._childLevel);if(h<1&&(h=1),i&&(u.time=i),s){const n=s(e,t.levels.values[e]);Object.assign(u,n)}else u.level=t.levels.values[e];if(o.asObjectBindingsOnly){if(null!==l&&"object"==typeof l)for(;h--&&"object"==typeof c[0];)Object.assign(u,c.shift());return[a(u),...c]}if(null!==l&&"object"==typeof l){for(;h--&&"object"==typeof c[0];)Object.assign(u,c.shift());l=c.length?r(c.shift(),c):void 0}else"string"==typeof l&&(l=r(c.shift(),c));return void 0!==l&&(u[o.messageKey]=l),[a(u)]}(this,o,l,a,e)):c.apply(u,l),e.transmit){const r=e.transmit.level||t._level,i=s(r,n),c=s(o,n);if(c<i)return;!function(t,e,n,r=!1){const i=e.send,o=e.ts,s=e.methodLevel,a=e.methodValue,c=e.val,l=t._logEvent.bindings;r||p(n,t._serialize||Object.keys(t.serializers),t.serializers,void 0===t._stdErrSerialize||t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(t){return-1===l.indexOf(t)}),t._logEvent.level.label=s,t._logEvent.level.value=a,i(s,t._logEvent,c),t._logEvent=f(l)}(this,{ts:a,methodLevel:o,methodValue:c,transmitLevel:r,transmitValue:n.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:s(t._level,n)},l,d)}};var c}(t,e,n,o);const l=function(t){const e=[];t.bindings&&e.push(t.bindings);let n=t[c];for(;n.parent;)n=n.parent,n.logger.bindings&&e.push(n.logger.bindings);return e.reverse()}(t);0!==l.length&&(t[o]=function(t,e){return function(){return e.apply(this,[...t,...arguments])}}(l,t[o]))}function p(t,e,n,r){for(const i in t)if(r&&t[i]instanceof Error)t[i]=h.stdSerializers.err(t[i]);else if("object"==typeof t[i]&&!Array.isArray(t[i])&&e)for(const r in t[i])e.indexOf(r)>-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function f(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function g(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}function A(t){return"function"==typeof t.timestamp?t.timestamp:!1===t.timestamp?y:B}function E(){return{}}function m(t){return t}function w(){}function y(){return!1}function B(){return Date.now()}h.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},h.stdSerializers=o,h.stdTimeFunctions=Object.assign({},{nullTime:y,epochTime:B,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),t.exports.default=h,t.exports.pino=h},8630(t,e,n){
|
|
19
|
+
!function(){"use strict";var o="input is invalid type",s="object"==typeof window,a=s?window:{};a.JS_SHA3_NO_WINDOW&&(s=!1);var c=!s&&"object"==typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node?a=n.g:c&&(a=self);var l=!a.JS_SHA3_NO_COMMON_JS&&t.exports,u=n.amdO,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,d="0123456789abcdef".split(""),p=[4,1024,262144,67108864],f=[0,8,16,24],g=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],A=[224,256,384,512],E=[128,256],m=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!h||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var y=function(t,e,n){return function(r){return new F(t,e,t).update(r)[n]()}},B=function(t,e,n){return function(r,i){return new F(t,e,i).update(r)[n]()}},I=function(t,e,n){return function(e,r,i,o){return v["cshake"+t].update(e,r,i,o)[n]()}},C=function(t,e,n){return function(e,r,i,o){return v["kmac"+t].update(e,r,i,o)[n]()}},T=function(t,e,n,r){for(var i=0;i<m.length;++i){var o=m[i];t[o]=e(n,r,o)}return t},b=function(t,e){var n=y(t,e,"hex");return n.create=function(){return new F(t,e,t)},n.update=function(t){return n.create().update(t)},T(n,y,t,e)},D=[{name:"keccak",padding:[1,256,65536,16777216],bits:A,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:A,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:E,createMethod:function(t,e){var n=B(t,e,"hex");return n.create=function(n){return new F(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},T(n,B,t,e)}},{name:"cshake",padding:p,bits:E,createMethod:function(t,e){var n=w[t],r=I(t,0,"hex");return r.create=function(r,i,o){return i||o?new F(t,e,r).bytepad([i,o],n):v["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},T(r,I,t,e)}},{name:"kmac",padding:p,bits:E,createMethod:function(t,e){var n=w[t],r=C(t,0,"hex");return r.create=function(r,i,o){return new k(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},T(r,C,t,e)}}],v={},M=[],N=0;N<D.length;++N)for(var S=D[N],_=S.bits,L=0;L<_.length;++L){var x=S.name+"_"+_[L];if(M.push(x),v[x]=S.createMethod(_[L],S.padding),"sha3"!==S.name){var R=S.name+_[L];M.push(R),v[R]=v[x]}}function F(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function k(t,e,n){F.call(this,t,e,n)}F.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(o);if(null===t)throw new Error(o);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(o);e=!0}for(var r,i,s=this.blocks,a=this.byteCount,c=t.length,l=this.blockCount,u=0,d=this.s;u<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,r=1;r<l+1;++r)s[r]=0;if(e)for(r=this.start;u<c&&r<a;++u)s[r>>2]|=t[u]<<f[3&r++];else for(r=this.start;u<c&&r<a;++u)(i=t.charCodeAt(u))<128?s[r>>2]|=i<<f[3&r++]:i<2048?(s[r>>2]|=(192|i>>6)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]):i<55296||i>=57344?(s[r>>2]|=(224|i>>12)<<f[3&r++],s[r>>2]|=(128|i>>6&63)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]):(i=65536+((1023&i)<<10|1023&t.charCodeAt(++u)),s[r>>2]|=(240|i>>18)<<f[3&r++],s[r>>2]|=(128|i>>12&63)<<f[3&r++],s[r>>2]|=(128|i>>6&63)<<f[3&r++],s[r>>2]|=(128|63&i)<<f[3&r++]);if(this.lastByteIndex=r,r>=a){for(this.start=r-a,this.block=s[l],r=0;r<l;++r)d[r]^=s[r];O(d),this.reset=!0}else this.start=r}return this},F.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},F.prototype.encodeString=function(t){var e,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(o);if(null===t)throw new Error(o);if(h&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||h&&ArrayBuffer.isView(t)))throw new Error(o);e=!0}var r=0,i=t.length;if(e)r=i;else for(var s=0;s<t.length;++s){var a=t.charCodeAt(s);a<128?r+=1:a<2048?r+=2:a<55296||a>=57344?r+=3:(a=65536+((1023&a)<<10|1023&t.charCodeAt(++s)),r+=4)}return r+=this.encode(8*r),this.update(t),r},F.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},F.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];O(r)}},F.prototype.toString=F.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<r;){for(o=0;o<e&&s<r;++o,++s)t=n[o],a+=d[t>>4&15]+d[15&t]+d[t>>12&15]+d[t>>8&15]+d[t>>20&15]+d[t>>16&15]+d[t>>28&15]+d[t>>24&15];s%e===0&&(O(n),o=0)}return i&&(t=n[o],a+=d[t>>4&15]+d[15&t],i>1&&(a+=d[t>>12&15]+d[t>>8&15]),i>2&&(a+=d[t>>20&15]+d[t>>16&15])),a},F.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(t);s<r;){for(o=0;o<e&&s<r;++o,++s)c[s]=n[o];s%e===0&&O(n)}return i&&(c[o]=n[o],t=t.slice(0,a)),t},F.prototype.buffer=F.prototype.arrayBuffer,F.prototype.digest=F.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<n&&a<i;++s,++a)t=a<<2,e=r[s],c[t]=255&e,c[t+1]=e>>8&255,c[t+2]=e>>16&255,c[t+3]=e>>24&255;a%n===0&&O(r)}return o&&(t=a<<2,e=r[s],c[t]=255&e,o>1&&(c[t+1]=e>>8&255),o>2&&(c[t+2]=e>>16&255)),c},k.prototype=new F,k.prototype.finalize=function(){return this.encode(this.outputBits,!0),F.prototype.finalize.call(this)};var O=function(t){var e,n,r,i,o,s,a,c,l,u,h,d,p,f,A,E,m,w,y,B,I,C,T,b,D,v,M,N,S,_,L,x,R,F,k,O,Q,U,P,G,V,j,H,Y,z,J,W,q,K,Z,X,$,tt,et,nt,rt,it,ot,st,at,ct,lt,ut;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],a=t[3]^t[13]^t[23]^t[33]^t[43],c=t[4]^t[14]^t[24]^t[34]^t[44],l=t[5]^t[15]^t[25]^t[35]^t[45],u=t[6]^t[16]^t[26]^t[36]^t[46],h=t[7]^t[17]^t[27]^t[37]^t[47],e=(d=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|a>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(a<<1|s>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(c<<1|l>>>31),n=o^(l<<1|c>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=s^(u<<1|h>>>31),n=a^(h<<1|u>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=c^(d<<1|p>>>31),n=l^(p<<1|d>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=u^(i<<1|o>>>31),n=h^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,f=t[0],A=t[1],J=t[11]<<4|t[10]>>>28,W=t[10]<<4|t[11]>>>28,N=t[20]<<3|t[21]>>>29,S=t[21]<<3|t[20]>>>29,at=t[31]<<9|t[30]>>>23,ct=t[30]<<9|t[31]>>>23,j=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,F=t[2]<<1|t[3]>>>31,k=t[3]<<1|t[2]>>>31,E=t[13]<<12|t[12]>>>20,m=t[12]<<12|t[13]>>>20,q=t[22]<<10|t[23]>>>22,K=t[23]<<10|t[22]>>>22,_=t[33]<<13|t[32]>>>19,L=t[32]<<13|t[33]>>>19,lt=t[42]<<2|t[43]>>>30,ut=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,O=t[14]<<6|t[15]>>>26,Q=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,y=t[24]<<11|t[25]>>>21,Z=t[34]<<15|t[35]>>>17,X=t[35]<<15|t[34]>>>17,x=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,b=t[6]<<28|t[7]>>>4,D=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,U=t[26]<<25|t[27]>>>7,P=t[27]<<25|t[26]>>>7,B=t[36]<<21|t[37]>>>11,I=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,Y=t[8]<<27|t[9]>>>5,z=t[9]<<27|t[8]>>>5,v=t[18]<<20|t[19]>>>12,M=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,st=t[28]<<7|t[29]>>>25,G=t[38]<<8|t[39]>>>24,V=t[39]<<8|t[38]>>>24,C=t[48]<<14|t[49]>>>18,T=t[49]<<14|t[48]>>>18,t[0]=f^~E&w,t[1]=A^~m&y,t[10]=b^~v&N,t[11]=D^~M&S,t[20]=F^~O&U,t[21]=k^~Q&P,t[30]=Y^~J&q,t[31]=z^~W&K,t[40]=et^~rt&ot,t[41]=nt^~it&st,t[2]=E^~w&B,t[3]=m^~y&I,t[12]=v^~N&_,t[13]=M^~S&L,t[22]=O^~U&G,t[23]=Q^~P&V,t[32]=J^~q&Z,t[33]=W^~K&X,t[42]=rt^~ot&at,t[43]=it^~st&ct,t[4]=w^~B&C,t[5]=y^~I&T,t[14]=N^~_&x,t[15]=S^~L&R,t[24]=U^~G&j,t[25]=P^~V&H,t[34]=q^~Z&$,t[35]=K^~X&tt,t[44]=ot^~at<,t[45]=st^~ct&ut,t[6]=B^~C&f,t[7]=I^~T&A,t[16]=_^~x&b,t[17]=L^~R&D,t[26]=G^~j&F,t[27]=V^~H&k,t[36]=Z^~$&Y,t[37]=X^~tt&z,t[46]=at^~lt&et,t[47]=ct^~ut&nt,t[8]=C^~f&E,t[9]=T^~A&m,t[18]=x^~b&v,t[19]=R^~D&M,t[28]=j^~F&O,t[29]=H^~k&Q,t[38]=$^~Y&J,t[39]=tt^~z&W,t[48]=lt^~et&rt,t[49]=ut^~nt&it,t[0]^=g[r],t[1]^=g[r+1]};if(l)t.exports=v;else{for(N=0;N<M.length;++N)a[M[N]]=v[M[N]];u&&(void 0===(r=function(){return v}.call(e,n,e,t))||(t.exports=r))}}()},9534(t,e){(function(){var e;function n(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function r(){return new n(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=function(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var c=32767&this[t],l=this[t++]>>15,u=a*c+l*s;i=((c=s*c+((32767&u)<<15)+n[r]+(1073741823&i))>>>30)+(u>>>15)+a*l+(i>>>30),n[r++]=1073741823&c}return i},e=30):i&&"Netscape"!=navigator.appName?(n.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},e=26):(n.prototype.am=function(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var c=16383&this[t],l=this[t++]>>14,u=a*c+l*s;i=((c=s*c+((16383&u)<<14)+n[r]+i)>>28)+(u>>14)+a*l,n[r++]=268435455&c}return i},e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e;n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-e,n.prototype.F2=2*e-52;var o,s,a=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)a[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)a[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)a[o++]=s;function c(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function l(t,e){var n=a[t.charCodeAt(e)];return null==n?-1:n}function u(t){var e=r();return e.fromInt(t),e}function h(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function d(t){this.m=t}function p(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function f(t,e){return t&e}function g(t,e){return t|e}function A(t,e){return t^e}function E(t,e){return t&~e}function m(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function w(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function y(){}function B(t){return t}function I(t){this.r2=r(),this.q3=r(),n.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}d.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},d.prototype.revert=function(t){return t},d.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},d.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},d.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},p.prototype.convert=function(t){var e=r();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(n.ZERO)>0&&this.m.subTo(e,e),e},p.prototype.revert=function(t){var e=r();return t.copyTo(e),this.reduce(e),e},p.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},p.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},p.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},n.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},n.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},n.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,o=!1,s=0;--i>=0;){var a=8==r?255&t[i]:l(t,i);a<0?"-"==t.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&n.ZERO.subTo(this,this)},n.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},n.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},n.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},n.prototype.lShiftTo=function(t,e){var n,r=t%this.DB,i=this.DB-r,o=(1<<i)-1,s=Math.floor(t/this.DB),a=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>i|a,a=(this[n]&o)<<r;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},n.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},n.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},n.prototype.multiplyTo=function(t,e){var r=this.abs(),i=t.abs(),o=r.t;for(e.t=o+i.t;--o>=0;)e[o]=0;for(o=0;o<i.t;++o)e[o+r.t]=r.am(0,i[o],e,o,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&n.ZERO.subTo(e,e)},n.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},n.prototype.divRemTo=function(t,e,i){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=e&&e.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=r());var a=r(),c=this.s,l=t.s,u=this.DB-h(o[o.t-1]);u>0?(o.lShiftTo(u,a),s.lShiftTo(u,i)):(o.copyTo(a),s.copyTo(i));var d=a.t,p=a[d-1];if(0!=p){var f=p*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),g=this.FV/f,A=(1<<this.F1)/f,E=1<<this.F2,m=i.t,w=m-d,y=null==e?r():e;for(a.dlShiftTo(w,y),i.compareTo(y)>=0&&(i[i.t++]=1,i.subTo(y,i)),n.ONE.dlShiftTo(d,y),y.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--w>=0;){var B=i[--m]==p?this.DM:Math.floor(i[m]*g+(i[m-1]+E)*A);if((i[m]+=a.am(0,B,i,w,0,d))<B)for(a.dlShiftTo(w,y),i.subTo(y,i);i[m]<--B;)i.subTo(y,i)}null!=e&&(i.drShiftTo(d,e),c!=l&&n.ZERO.subTo(e,e)),i.t=d,i.clamp(),u>0&&i.rShiftTo(u,i),c<0&&n.ZERO.subTo(i,i)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},n.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(t,e){if(t>4294967295||t<1)return n.ONE;var i=r(),o=r(),s=e.convert(this),a=h(t)-1;for(s.copyTo(i);--a>=0;)if(e.sqrTo(i,o),(t&1<<a)>0)e.mulTo(o,s,i);else{var c=i;i=o,o=c}return e.revert(i)},n.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=c(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=c(n));return i?o:"0"},n.prototype.negate=function(){var t=r();return n.ZERO.subTo(this,t),t},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(t){var e=r();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(n.ZERO)>0&&t.subTo(e,e),e},n.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new d(e):new p(e),this.exp(t,n)},n.ZERO=u(0),n.ONE=u(1),y.prototype.convert=B,y.prototype.revert=B,y.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},y.prototype.sqrTo=function(t,e){t.squareTo(e)},I.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=r();return t.copyTo(e),this.reduce(e),e},I.prototype.revert=function(t){return t},I.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},I.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},I.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var C,T,b,D=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],v=(1<<26)/D[D.length-1];function M(){var t;t=(new Date).getTime(),T[b++]^=255&t,T[b++]^=t>>8&255,T[b++]^=t>>16&255,T[b++]^=t>>24&255,b>=F&&(b-=F)}if(n.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},n.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),i=u(n),o=r(),s=r(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(t)+a},n.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),o=!1,s=0,a=0,c=0;c<t.length;++c){var u=l(t,c);u<0?"-"==t.charAt(c)&&0==this.signum()&&(o=!0):(a=e*a+u,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(n.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(n.ONE.shiftLeft(t-1),this);else{var i=new Array,o=7&t;i.length=1+(t>>3),e.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},n.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},n.prototype.changeBit=function(t,e){var r=n.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},n.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},n.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},n.prototype.multiplyLowerTo=function(t,e,n){var r,i=Math.min(this.t+t.t,e);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,t[i],n,i,0,this.t);for(r=Math.min(t.t,e);i<r;++i)this.am(0,t[i],n,i,0,e-i);n.clamp()},n.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},n.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},n.prototype.millerRabin=function(t){var e=this.subtract(n.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var o=e.shiftRight(i);(t=t+1>>1)>D.length&&(t=D.length);for(var s=r(),a=0;a<t;++a){s.fromInt(D[Math.floor(Math.random()*D.length)]);var c=s.modPow(o,this);if(0!=c.compareTo(n.ONE)&&0!=c.compareTo(e)){for(var l=1;l++<i&&0!=c.compareTo(e);)if(0==(c=c.modPowInt(2,this)).compareTo(n.ONE))return!1;if(0!=c.compareTo(e))return!1}}return!0},n.prototype.clone=function(){var t=r();return this.copyTo(t),t},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},n.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),128&n&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},n.prototype.equals=function(t){return 0==this.compareTo(t)},n.prototype.min=function(t){return this.compareTo(t)<0?this:t},n.prototype.max=function(t){return this.compareTo(t)>0?this:t},n.prototype.and=function(t){var e=r();return this.bitwiseTo(t,f,e),e},n.prototype.or=function(t){var e=r();return this.bitwiseTo(t,g,e),e},n.prototype.xor=function(t){var e=r();return this.bitwiseTo(t,A,e),e},n.prototype.andNot=function(t){var e=r();return this.bitwiseTo(t,E,e),e},n.prototype.not=function(){for(var t=r(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},n.prototype.shiftLeft=function(t){var e=r();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},n.prototype.shiftRight=function(t){var e=r();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},n.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+m(this[t]);return this.s<0?this.t*this.DB:-1},n.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=w(this[n]^e);return t},n.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},n.prototype.setBit=function(t){return this.changeBit(t,g)},n.prototype.clearBit=function(t){return this.changeBit(t,E)},n.prototype.flipBit=function(t){return this.changeBit(t,A)},n.prototype.add=function(t){var e=r();return this.addTo(t,e),e},n.prototype.subtract=function(t){var e=r();return this.subTo(t,e),e},n.prototype.multiply=function(t){var e=r();return this.multiplyTo(t,e),e},n.prototype.divide=function(t){var e=r();return this.divRemTo(t,e,null),e},n.prototype.remainder=function(t){var e=r();return this.divRemTo(t,null,e),e},n.prototype.divideAndRemainder=function(t){var e=r(),n=r();return this.divRemTo(t,e,n),new Array(e,n)},n.prototype.modPow=function(t,e){var n,i,o=t.bitLength(),s=u(1);if(o<=0)return s;n=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new d(e):e.isEven()?new I(e):new p(e);var a=new Array,c=3,l=n-1,f=(1<<n)-1;if(a[1]=i.convert(this),n>1){var g=r();for(i.sqrTo(a[1],g);c<=f;)a[c]=r(),i.mulTo(g,a[c-2],a[c]),c+=2}var A,E,m=t.t-1,w=!0,y=r();for(o=h(t[m])-1;m>=0;){for(o>=l?A=t[m]>>o-l&f:(A=(t[m]&(1<<o+1)-1)<<l-o,m>0&&(A|=t[m-1]>>this.DB+o-l)),c=n;!(1&A);)A>>=1,--c;if((o-=c)<0&&(o+=this.DB,--m),w)a[A].copyTo(s),w=!1;else{for(;c>1;)i.sqrTo(s,y),i.sqrTo(y,s),c-=2;c>0?i.sqrTo(s,y):(E=s,s=y,y=E),i.mulTo(y,a[A],s)}for(;m>=0&&!(t[m]&1<<o);)i.sqrTo(s,y),E=s,s=y,y=E,--o<0&&(o=this.DB-1,--m)}return i.revert(s)},n.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return n.ZERO;for(var r=t.clone(),i=this.clone(),o=u(1),s=u(0),a=u(0),c=u(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),e?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(t,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(i)>=0?(r.subTo(i,r),e&&o.subTo(a,o),s.subTo(c,s)):(i.subTo(r,i),e&&a.subTo(o,a),c.subTo(s,c))}return 0!=i.compareTo(n.ONE)?n.ZERO:c.compareTo(t)>=0?c.subtract(t):c.signum()<0?(c.addTo(t,c),c.signum()<0?c.add(t):c):c},n.prototype.pow=function(t){return this.exp(t,new y)},n.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},n.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=D[D.length-1]){for(e=0;e<D.length;++e)if(n[0]==D[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<D.length;){for(var r=D[e],i=e+1;i<D.length&&r<v;)r*=D[i++];for(r=n.modInt(r);e<i;)if(r%D[e++]==0)return!1}return n.millerRabin(t)},n.prototype.square=function(){var t=r();return this.squareTo(t),t},n.prototype.Barrett=I,null==T){var N;if(T=new Array,b=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var S=new Uint8Array(32);for(window.crypto.getRandomValues(S),N=0;N<32;++N)T[b++]=S[N]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var _=window.crypto.random(32);for(N=0;N<_.length;++N)T[b++]=255&_.charCodeAt(N)}for(;b<F;)N=Math.floor(65536*Math.random()),T[b++]=N>>>8,T[b++]=255&N;b=0,M()}function L(){if(null==C){for(M(),(C=new R).init(T),b=0;b<T.length;++b)T[b]=0;b=0}return C.next()}function x(){}function R(){this.i=0,this.j=0,this.S=new Array}x.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=L()},R.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},R.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var F=256;t.exports={default:n,BigInteger:n,SecureRandom:x}}).call(this)},3349(t){function e(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=e,e.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},5606(t){var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var a,c=[],l=!1,u=-1;function h(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&d())}function d(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(a=c,c=[];++u<e;)a&&a[u].run();u=-1,e=c.length}a=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function f(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},152(t,e,n){"use strict";var r=n(8287).hp;class i{static isArrayBuffer(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength||0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t.buffer).slice(t.byteOffset,t.byteOffset+t.byteLength).buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){const n=i.toUint8Array(t),r=i.toUint8Array(e);if(n.length!==r.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==r[t])return!1;return!0}static concat(...t){let e;e=!Array.isArray(t[0])||t[1]instanceof Function?Array.isArray(t[0])&&t[1]instanceof Function?t[0]:t[t.length-1]instanceof Function?t.slice(0,t.length-1):t:t[0];let n=0;for(const t of e)n+=t.byteLength;const r=new Uint8Array(n);let i=0;for(const t of e){const e=this.toUint8Array(t);r.set(e,i),i+=e.length}return t[t.length-1]instanceof Function?this.toView(r,t[t.length-1]):r.buffer}}const o="string",s=/^[0-9a-f\s]+$/i,a=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,c=/^[a-zA-Z0-9-_]+$/;class l{static fromString(t){const e=unescape(encodeURIComponent(t)),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n.buffer}static toString(t){const e=i.toUint8Array(t);let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return decodeURIComponent(escape(n))}}class u{static toString(t,e=!1){const n=i.toArrayBuffer(t),r=new DataView(n);let o="";for(let t=0;t<n.byteLength;t+=2){const n=r.getUint16(t,e);o+=String.fromCharCode(n)}return o}static fromString(t,e=!1){const n=new ArrayBuffer(2*t.length),r=new DataView(n);for(let n=0;n<t.length;n++)r.setUint16(2*n,t.charCodeAt(n),e);return n}}class h{static isHex(t){return typeof t===o&&s.test(t)}static isBase64(t){return typeof t===o&&a.test(t)}static isBase64Url(t){return typeof t===o&&c.test(t)}static ToString(t,e="utf8"){const n=i.toUint8Array(t);switch(e.toLowerCase()){case"utf8":return this.ToUtf8String(n);case"binary":return this.ToBinary(n);case"hex":return this.ToHex(n);case"base64":return this.ToBase64(n);case"base64url":return this.ToBase64Url(n);case"utf16le":return u.toString(n,!0);case"utf16":case"utf16be":return u.toString(n);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromString(t,e="utf8"){if(!t)return new ArrayBuffer(0);switch(e.toLowerCase()){case"utf8":return this.FromUtf8String(t);case"binary":return this.FromBinary(t);case"hex":return this.FromHex(t);case"base64":return this.FromBase64(t);case"base64url":return this.FromBase64Url(t);case"utf16le":return u.fromString(t,!0);case"utf16":case"utf16be":return u.fromString(t);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToBase64(t){const e=i.toUint8Array(t);if("undefined"!=typeof btoa){const t=this.ToString(e,"binary");return btoa(t)}return r.from(e).toString("base64")}static FromBase64(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isBase64(e))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return"undefined"!=typeof atob?this.FromBinary(atob(e)):new Uint8Array(r.from(e,"base64")).buffer}static FromBase64Url(t){const e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isBase64Url(e))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(e.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(t){return this.ToBase64(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(t,e=h.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.FromBinary(t);case"utf8":return l.fromString(t);case"utf16":case"utf16be":return u.fromString(t);case"utf16le":case"usc2":return u.fromString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static ToUtf8String(t,e=h.DEFAULT_UTF8_ENCODING){switch(e){case"ascii":return this.ToBinary(t);case"utf8":return l.toString(t);case"utf16":case"utf16be":return u.toString(t);case"utf16le":case"usc2":return u.toString(t,!0);default:throw new Error(`Unknown type of encoding '${e}'`)}}static FromBinary(t){const e=t.length,n=new Uint8Array(e);for(let r=0;r<e;r++)n[r]=t.charCodeAt(r);return n.buffer}static ToBinary(t){const e=i.toUint8Array(t);let n="";for(let t=0;t<e.length;t++)n+=String.fromCharCode(e[t]);return n}static ToHex(t){const e=i.toUint8Array(t);let n="";const r=e.length;for(let t=0;t<r;t++){const r=e[t];r<16&&(n+="0"),n+=r.toString(16)}return n}static FromHex(t){let e=this.formatString(t);if(!e)return new ArrayBuffer(0);if(!h.isHex(e))throw new TypeError("Argument 'hexString' is not HEX encoded");e.length%2&&(e=`0${e}`);const n=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const r=e.slice(t,t+2);n[t/2]=parseInt(r,16)}return n.buffer}static ToUtf16String(t,e=!1){return u.toString(t,e)}static FromUtf16String(t,e=!1){return u.fromString(t,e)}static Base64Padding(t){const e=4-t.length%4;if(e<4)for(let n=0;n<e;n++)t+="=";return t}static formatString(t){return(null==t?void 0:t.replace(/[\n\r\t ]/g,""))||""}}h.DEFAULT_UTF8_ENCODING="utf8",e._H=i,e.U$=h,e.kg=function(...t){const e=t.map(t=>t.byteLength).reduce((t,e)=>t+e),n=new Uint8Array(e);let r=0;return t.map(t=>new Uint8Array(t)).forEach(t=>{for(const e of t)n[r++]=e}),n.buffer},e.n4=function(t,e){if(!t||!e)return!1;if(t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let e=0;e<t.byteLength;e++)if(n[e]!==r[e])return!1;return!0}},793(t){"use strict";function e(t){try{return JSON.stringify(t)}catch(t){return'"[Circular]"'}}t.exports=function(t,n,r){var i=r&&r.stringify||e;if("object"==typeof t&&null!==t){var o=n.length+1;if(1===o)return t;var s=new Array(o);s[0]=i(t);for(var a=1;a<o;a++)s[a]=i(n[a]);return s.join(" ")}if("string"!=typeof t)return t;var c=n.length;if(0===c)return t;for(var l="",u=0,h=-1,d=t&&t.length||0,p=0;p<d;){if(37===t.charCodeAt(p)&&p+1<d){switch(h=h>-1?h:0,t.charCodeAt(p+1)){case 100:case 102:if(u>=c)break;if(null==n[u])break;h<p&&(l+=t.slice(h,p)),l+=Number(n[u]),h=p+2,p++;break;case 105:if(u>=c)break;if(null==n[u])break;h<p&&(l+=t.slice(h,p)),l+=Math.floor(Number(n[u])),h=p+2,p++;break;case 79:case 111:case 106:if(u>=c)break;if(void 0===n[u])break;h<p&&(l+=t.slice(h,p));var f=typeof n[u];if("string"===f){l+="'"+n[u]+"'",h=p+2,p++;break}if("function"===f){l+=n[u].name||"<anonymous>",h=p+2,p++;break}l+=i(n[u]),h=p+2,p++;break;case 115:if(u>=c)break;h<p&&(l+=t.slice(h,p)),l+=String(n[u]),h=p+2,p++;break;case 37:h<p&&(l+=t.slice(h,p)),l+="%",h=p+2,p++,u--}++u}++p}if(-1===h)return t;h<d&&(l+=t.slice(h));return l}},9983(t){"use strict";!function(){const e=2147483647;function n(t){const e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);let n=1779033703,r=3144134277,i=1013904242,o=2773480762,s=1359893119,a=2600822924,c=528734635,l=1541459225;const u=new Uint32Array(64);function h(t){let h=0,d=t.length;for(;d>=64;){let p,f,g,A,E,m=n,w=r,y=i,B=o,I=s,C=a,T=c,b=l;for(f=0;f<16;f++)g=h+4*f,u[f]=(255&t[g])<<24|(255&t[g+1])<<16|(255&t[g+2])<<8|255&t[g+3];for(f=16;f<64;f++)p=u[f-2],A=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,p=u[f-15],E=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,u[f]=(A+u[f-7]|0)+(E+u[f-16]|0)|0;for(f=0;f<64;f++)A=(((I>>>6|I<<26)^(I>>>11|I<<21)^(I>>>25|I<<7))+(I&C^~I&T)|0)+(b+(e[f]+u[f]|0)|0)|0,E=((m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10))+(m&w^m&y^w&y)|0,b=T,T=C,C=I,I=B+A|0,B=y,y=w,w=m,m=A+E|0;n=n+m|0,r=r+w|0,i=i+y|0,o=o+B|0,s=s+I|0,a=a+C|0,c=c+T|0,l=l+b|0,h+=64,d-=64}}h(t);let d,p=t.length%64,f=t.length/536870912|0,g=t.length<<3,A=p<56?56:120,E=t.slice(t.length-p,t.length);for(E.push(128),d=p+1;d<A;d++)E.push(0);return E.push(f>>>24&255),E.push(f>>>16&255),E.push(f>>>8&255),E.push(f>>>0&255),E.push(g>>>24&255),E.push(g>>>16&255),E.push(g>>>8&255),E.push(g>>>0&255),h(E),[n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,l>>>24&255,l>>>16&255,l>>>8&255,l>>>0&255]}function r(t,e,r){t=t.length<=64?t:n(t);const i=64+e.length+4,o=new Array(i),s=new Array(64);let a,c=[];for(a=0;a<64;a++)o[a]=54;for(a=0;a<t.length;a++)o[a]^=t[a];for(a=0;a<e.length;a++)o[64+a]=e[a];for(a=i-4;a<i;a++)o[a]=0;for(a=0;a<64;a++)s[a]=92;for(a=0;a<t.length;a++)s[a]^=t[a];function l(){for(let t=i-1;t>=i-4;t--){if(o[t]++,o[t]<=255)return;o[t]=0}}for(;r>=32;)l(),c=c.concat(n(s.concat(n(o)))),r-=32;return r>0&&(l(),c=c.concat(n(s.concat(n(o))).slice(0,r))),c}function i(t,e,n,r,i){let o;for(c(t,16*(2*n-1),i,0,16),o=0;o<2*n;o++)a(t,16*o,i,16),s(i,r),c(i,0,t,e+16*o,16);for(o=0;o<n;o++)c(t,e+2*o*16,t,16*o,16);for(o=0;o<n;o++)c(t,e+16*(2*o+1),t,16*(o+n),16)}function o(t,e){return t<<e|t>>>32-e}function s(t,e){c(t,0,e,0,16);for(let t=8;t>0;t-=2)e[4]^=o(e[0]+e[12],7),e[8]^=o(e[4]+e[0],9),e[12]^=o(e[8]+e[4],13),e[0]^=o(e[12]+e[8],18),e[9]^=o(e[5]+e[1],7),e[13]^=o(e[9]+e[5],9),e[1]^=o(e[13]+e[9],13),e[5]^=o(e[1]+e[13],18),e[14]^=o(e[10]+e[6],7),e[2]^=o(e[14]+e[10],9),e[6]^=o(e[2]+e[14],13),e[10]^=o(e[6]+e[2],18),e[3]^=o(e[15]+e[11],7),e[7]^=o(e[3]+e[15],9),e[11]^=o(e[7]+e[3],13),e[15]^=o(e[11]+e[7],18),e[1]^=o(e[0]+e[3],7),e[2]^=o(e[1]+e[0],9),e[3]^=o(e[2]+e[1],13),e[0]^=o(e[3]+e[2],18),e[6]^=o(e[5]+e[4],7),e[7]^=o(e[6]+e[5],9),e[4]^=o(e[7]+e[6],13),e[5]^=o(e[4]+e[7],18),e[11]^=o(e[10]+e[9],7),e[8]^=o(e[11]+e[10],9),e[9]^=o(e[8]+e[11],13),e[10]^=o(e[9]+e[8],18),e[12]^=o(e[15]+e[14],7),e[13]^=o(e[12]+e[15],9),e[14]^=o(e[13]+e[12],13),e[15]^=o(e[14]+e[13],18);for(let n=0;n<16;++n)t[n]+=e[n]}function a(t,e,n,r){for(let i=0;i<r;i++)n[i]^=t[e+i]}function c(t,e,n,r,i){for(;i--;)n[r++]=t[e++]}function l(t){if(!t||"number"!=typeof t.length)return!1;for(let e=0;e<t.length;e++){const n=t[e];if("number"!=typeof n||n%1||n<0||n>=256)return!1}return!0}function u(t,e){if("number"!=typeof t||t%1)throw new Error("invalid "+e);return t}function h(t,n,o,s,h,d,p){if(o=u(o,"N"),s=u(s,"r"),h=u(h,"p"),d=u(d,"dkLen"),0===o||o&o-1)throw new Error("N must be power of 2");if(o>e/128/s)throw new Error("N too large");if(s>e/128/h)throw new Error("r too large");if(!l(t))throw new Error("password must be an array or buffer");if(t=Array.prototype.slice.call(t),!l(n))throw new Error("salt must be an array or buffer");n=Array.prototype.slice.call(n);let f=r(t,n,128*h*s);const g=new Uint32Array(32*h*s);for(let t=0;t<g.length;t++){const e=4*t;g[t]=(255&f[e+3])<<24|(255&f[e+2])<<16|(255&f[e+1])<<8|255&f[e+0]}const A=new Uint32Array(64*s),E=new Uint32Array(32*s*o),m=32*s,w=new Uint32Array(16),y=new Uint32Array(16),B=h*o*2;let I,C,T=0,b=null,D=!1,v=0,M=0;const N=p?parseInt(1e3/s):4294967295,S="undefined"!=typeof setImmediate?setImmediate:setTimeout,_=function(){if(D)return p(new Error("cancelled"),T/B);let e;switch(v){case 0:C=32*M*s,c(g,C,A,0,m),v=1,I=0;case 1:e=o-I,e>N&&(e=N);for(let t=0;t<e;t++)c(A,0,E,(I+t)*m,m),i(A,m,s,w,y);if(I+=e,T+=e,p){const t=parseInt(1e3*T/B);if(t!==b){if(D=p(null,T/B),D)break;b=t}}if(I<o)break;I=0,v=2;case 2:e=o-I,e>N&&(e=N);for(let t=0;t<e;t++){const t=A[16*(2*s-1)]&o-1;a(E,t*m,A,m),i(A,m,s,w,y)}if(I+=e,T+=e,p){const t=parseInt(1e3*T/B);if(t!==b){if(D=p(null,T/B),D)break;b=t}}if(I<o)break;if(c(A,0,g,C,m),M++,M<h){v=0;break}f=[];for(let t=0;t<g.length;t++)f.push(255&g[t]),f.push(g[t]>>8&255),f.push(g[t]>>16&255),f.push(g[t]>>24&255);const n=r(t,f,d);return p&&p(null,1,n),n}p&&S(_)};if(!p)for(;;){const t=_();if(null!=t)return t}_()}const d={scrypt:function(t,e,n,r,i,o,s){return new Promise(function(a,c){let l=0;s&&s(0),h(t,e,n,r,i,o,function(t,e,n){if(t)c(t);else if(n)s&&1!==l&&s(1),a(new Uint8Array(n));else if(s&&e!==l)return l=e,s(e)})})},syncScrypt:function(t,e,n,r,i,o){return new Uint8Array(h(t,e,n,r,i,o))}};t.exports=d}()},7770(t,e,n){"use strict";n.d(e,{y8:()=>I,Ow:()=>B});var r=n(3859);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,s(r.key),r)}}function s(t){var e=function(t,e){if("object"!=i(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==i(e)?e:e+""}var a=function(){function t(e){var n=e.sessionId,r=e.providerId,i=e.appId,o=e.logLine,s=e.type,a=e.eventType,c=e.logLevel,l=e.source,u=e.tabId,h=e.url,d=e.meta,p=e.time,f=void 0===p?null:p,g=e.deviceId;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sessionId=n,this.providerId=r,this.appId=i,this.logLine=o,this.type=s,this.eventType=a,this.logLevel=c,this.source=l,this.tabId=u,this.url=h,this.meta=d||void 0,this.time=f||new Date,this.deviceId=g}return e=t,r=[{key:"fromDateTimeToTimeStamp",value:function(t){return(1e6*t.getTime()).toString()}}],(n=[{key:"toJson",value:function(){var e={logLine:this.logLine,ts:t.fromDateTimeToTimeStamp(this.time),logLevel:this.logLevel,sessionId:this.sessionId,providerId:this.providerId,appId:this.appId,source:this.source,deviceId:this.deviceId};return this.type&&(e.type=this.type),this.eventType&&(e.eventType=this.eventType),this.tabId&&(e.tabId=this.tabId),this.url&&(e.url=this.url),this.meta&&(e.meta=this.meta),e}}])&&o(e.prototype,n),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();function c(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return h(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var d=[][r]?e(e([][r]())):(h(e={},r,function(){return this}),e),p=l.prototype=a.prototype=Object.create(d);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,h(t,i,"GeneratorFunction")),t.prototype=Object.create(p),t}return c.prototype=l,h(p,"constructor",l),h(l,"constructor",c),c.displayName="GeneratorFunction",h(l,i,"GeneratorFunction"),h(p),h(p,i,"Generator"),h(p,r,function(){return this}),h(p,"toString",function(){return"[object Generator]"}),(u=function(){return{w:o,m:f}})()}function h(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}h=function(t,e,n,r){function o(e,n){h(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},h(t,e,n,r)}function d(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function p(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){d(o,r,i,s,a,"next",t)}function a(t){d(o,r,i,s,a,"throw",t)}s(void 0)})}}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function g(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function A(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?g(Object(n),!0).forEach(function(e){E(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function E(t,e,n){return(e=w(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,w(r.key),r)}}function w(t){var e=function(t,e){if("object"!=f(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==f(e)?e:e+""}var y=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.logs=[],this.isSending=!1,this.maxBatchSize=20,this.flushInterval=5e3,this.flushIntervalId=null,this.config=A({},r.DEFAULT_LOG_CONFIG),this.deviceId=null;try{var n;"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local&&(chrome.storage.local.get([r.LOG_CONFIG_STORAGE_KEY],function(t){var n=null==t?void 0:t[r.LOG_CONFIG_STORAGE_KEY];n&&"object"===f(n)&&e.setConfig(n)}),chrome.storage.onChanged.addListener(function(t,n){if("local"===n&&t[r.LOG_CONFIG_STORAGE_KEY]){var i=t[r.LOG_CONFIG_STORAGE_KEY].newValue||{};e.setConfig(i)}}))}catch(t){}this.startFlushInterval()},e=[{key:"setConfig",value:function(t){this.config=A(A({},this.config),t)}},{key:"startFlushInterval",value:function(){var t=this;this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flushIntervalId=setInterval(function(){return t.flush()},this.flushInterval)}},{key:"stopFlushInterval",value:function(){this.flushIntervalId&&(clearInterval(this.flushIntervalId),this.flushIntervalId=null)}},{key:"getDeviceLoggingId",value:(s=p(u().m(function t(){var e;return u().w(function(t){for(;;)switch(t.p=t.n){case 0:if(!this.deviceId){t.n=1;break}return t.a(2,this.deviceId);case 1:if(t.p=1,"undefined"==typeof chrome||!chrome.storage){t.n=3;break}return t.n=2,chrome.storage.local.get(["reclaim_device_id"]);case 2:if(!(e=t.v).reclaim_device_id){t.n=3;break}return this.deviceId=e.reclaim_device_id,t.a(2,this.deviceId);case 3:t.n=5;break;case 4:t.p=4,t.v;case 5:if(this.deviceId="undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():String(Date.now()),t.p=6,"undefined"==typeof chrome||!chrome.storage){t.n=7;break}return t.n=7,chrome.storage.local.set({reclaim_device_id:this.deviceId});case 7:t.n=9;break;case 8:t.p=8,t.v;case 9:return t.a(2,this.deviceId)}},t,this,[[6,8],[1,4]])})),function(){return s.apply(this,arguments)})},{key:"addLog",value:function(t){this.logs.push(t),this.logs.length>=this.maxBatchSize&&this.flush()}},{key:"shouldLog",value:function(t){return t<=(r.LOG_LEVEL_MAP[this.config.logLevel]||r.LOG_LEVEL.INFO)}},{key:"emitToConsole",value:function(t,e,n){var r="[".concat(t,"]"),i="".concat(r," ").concat(e);n?console.log(i,n):console.log(i)}},{key:"log",value:function(t){var e=t.message,n=t.logLevel,r=t.type,i=t.eventType,o=t.meta,s=t.sessionId,c=t.providerId,l=t.appId,u=t.source,h=t.tabId,d=t.url;if(e&&n){if(this.shouldLog(n)){this.config.consoleEnabled&&this.emitToConsole(n,e,o);var p=new a({sessionId:s||"unknown",providerId:c||"unknown",appId:l||"unknown",logLine:e,type:r,eventType:i,logLevel:n,source:u||this.config.source,tabId:h,url:d,meta:o,time:new Date});this.addLog(p)}}else console.error("Logger: message and logLevel are required")}},{key:"flush",value:(o=p(u().m(function t(){var e,n;return u().w(function(t){for(;;)switch(t.p=t.n){case 0:if(0!==this.logs.length&&!this.isSending){t.n=1;break}return t.a(2);case 1:return e=c(this.logs),this.logs=[],t.p=2,this.isSending=!0,t.n=3,this.sendLogs(e);case 3:t.n=5;break;case 4:t.p=4,n=t.v,console.error("Error flushing logs:",n),this.logs=[].concat(c(this.logs),c(e));case 5:return t.p=5,this.isSending=!1,t.f(5);case 6:return t.a(2)}},t,this,[[2,4,5,6]])})),function(){return o.apply(this,arguments)})},{key:"sendLogs",value:(i=p(u().m(function t(e){var n,i,o,s,a,c;return u().w(function(t){for(;;)switch(t.n){case 0:if(null!=e&&e.length){t.n=1;break}return t.a(2);case 1:return t.n=2,this.getDeviceLoggingId();case 2:return n=t.v,i=e.map(function(t){var e=t.toJson();return e.deviceId=e.deviceId||n,e}),o=JSON.stringify({logs:i,source:this.config.source,deviceId:n}),t.n=3,fetch(r.LOGGING_ENDPOINTS.DIAGNOSTIC_LOGGING,{method:"POST",headers:{"Content-Type":"application/json"},body:o});case 3:if((s=t.v).ok){t.n=5;break}return a=console,c="Failed to send ".concat(e.length," logs"),t.n=4,s.text();case 4:a.error.call(a,c,t.v);case 5:return t.a(2)}},t,this)})),function(t){return i.apply(this,arguments)})}],e&&m(t.prototype,e),n&&m(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,i,o,s}(),B=new y,I=function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=A({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:(null===(t=B.config)||void 0===t?void 0:t.source)||"reclaim-extension-sdk"},e);return{get context(){return A({},n)},setContext:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.assign(n,t)},log:function(t){B.log(A(A({},n),t))},info:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"INFO"},t))},debug:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"DEBUG"},t))},all:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"ALL"},t))},error:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};B.log(A(A({},n),{},{logLevel:"ALL"},t))}}}},3859(t,e,n){"use strict";n.r(e),n.d(e,{DEFAULT_LOG_CONFIG:()=>l,EVENT_TYPES:()=>s,LOGGING_ENDPOINTS:()=>r,LOG_CONFIG_STORAGE_KEY:()=>u,LOG_LEVEL:()=>a,LOG_LEVEL_MAP:()=>c,LOG_SOURCES:()=>o,LOG_TYPES:()=>i});var r={DIAGNOSTIC_LOGGING:"http://localhost:8001/api/logs"},i={BACKGROUND:"reclaim_browser_extension.BackgroundProcess",CONTENT:"reclaim_browser_extension.ContentScript",POPUP:"reclaim_browser_extension.Popup",INIT:"reclaim_browser_extension.Initialization",VERIFICATION:"reclaim_browser_extension.Verification",FETCH_DATA:"reclaim_browser_extension.FetchData",PROVIDER_DATA:"reclaim_browser_extension.ProviderData",CLAIM_CREATION:"reclaim_browser_extension.ClaimCreation",PROOF_GENERATION:"reclaim_browser_extension.ProofGeneration",PROOF_SUBMISSION:"reclaim_browser_extension.ProofSubmission",PROOF_VERIFICATION:"reclaim_browser_extension.ProofVerification",OFFSCREEN:"reclaim_browser_extension.Offscreen"},o={BACKGROUND:"background",CONTENT:"content",OFFSCREEN:"offscreen",POPUP:"popup",INJECTION:"injection"},s={IS_RECLAIM_EXTENSION_SDK:"IS_RECLAIM_EXTENSION_SDK",VERIFICATION_FLOW_STARTED:"VERIFICATION_FLOW_STARTED",RECLAIM_VERIFICATION_DISMISSED:"RECLAIM_VERIFICATION_DISMISSED",RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION:"RECLAIM_VERIFICATION_PROVIDER_LOAD_EXCEPTION",REQUEST_MATCHED:"REQUEST_MATCHED",RESPONSE_MATCH_FAILED:"RESPONSE_MATCH_FAILED",X_PATH_MATCH_REQUIREMENT_FAILED:"X_PATH_MATCH_REQUIREMENT_FAILED",JSON_PATH_MATCH_REQUIREMENT_FAILED:"JSON_PATH_MATCH_REQUIREMENT_FAILED",REGEX_MATCH_REQUIREMENT_FAILED:"REGEX_MATCH_REQUIREMENT_FAILED",FILTERED_REQUEST_FOUND:"FILTERED_REQUEST_FOUND",FILTER_REQUEST_ERROR:"FILTER_REQUEST_ERROR",STARTING_CLAIM_CREATION:"STARTING_CLAIM_CREATION",CLAIM_CREATION_STARTED:"CLAIM_CREATION_STARTED",CLAIM_CREATION_SUCCESS:"CLAIM_CREATION_SUCCESS",CLAIM_CREATION_FAILED:"CLAIM_CREATION_FAILED",CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION:"CLAIM_PARAMETER_VALIDATION_FAILED_EXCEPTION",OFFSCREEN_DOCUMENT_READY:"OFFSCREEN_DOCUMENT_READY",OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION:"OFFSCREEN_DOCUMENT_NOT_READY_EXCEPTION",PROOF_GENERATION_STARTED:"PROOF_GENERATION_STARTED",PROOF_GENERATION_SUCCESS:"PROOF_GENERATION_SUCCESS",PROOF_GENERATION_ABORTED:"PROOF_GENERATION_ABORTED",PROOF_GENERATION_FAILED:"PROOF_GENERATION_FAILED",RESULT_RECEIVED:"RESULT_RECEIVED",SUBMITTING_PROOF:"SUBMITTING_PROOF",SUBMITTING_PROOF_TO_CALLBACK_URL:"SUBMITTING_PROOF_TO_CALLBACK_URL",SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS:"SUBMITTING_PROOF_TO_CALLBACK_URL_SUCCESS",SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED:"SUBMITTING_PROOF_TO_CALLBACK_URL_FAILED",PROOF_SUBMISSION_FAILED:"PROOF_SUBMISSION_FAILED",PROOF_SUBMITTED:"PROOF_SUBMITTED",VERIFICATION_FLOW_FAILED:"VERIFICATION_FLOW_FAILED",TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION:"TAB_NOT_MANAGED_BY_EXTENSION_EXCEPTION",INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED:"INJECTION_SCRIPT_SET_IN_LOCAL_STORAGE_FAILED",VERIFICATION_POPUP_ERROR:"VERIFICATION_POPUP_ERROR",UPDATE_SESSION_STATUS_ERROR:"UPDATE_SESSION_STATUS_ERROR"},a={INFO:10,DEBUG:20,ALL:30},c={INFO:a.INFO,DEBUG:a.DEBUG,ALL:a.ALL},l={logLevel:"INFO",consoleEnabled:!1,source:"reclaim-extension-sdk"},u="reclaim_extension_sdk_log_config"},3153(t,e,n){"use strict";n.d(e,{Ey:()=>s,w9:()=>c});n(7770);function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,o(r.key),r)}}function o(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,e||"default");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}var s=Object.freeze({BACKGROUND:"background",CONTENT:"content",POPUP:"popup",INIT:"init",VERIFICATION:"verification",FETCH:"fetch",PROVIDER:"provider",CLAIM:"claim",PROOF:"proof",OFFSCREEN:"offscreen",POLYFILLS:"polyfills",SESSION_TIMER:"session-timer"}),a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.enabled=!0,this.allowedTypes=new Set}return e=t,n=[{key:"enable",value:function(){this.enabled=!0}},{key:"disable",value:function(){this.enabled=!1}},{key:"setTypes",value:function(t){Array.isArray(t)&&(this.allowedTypes=new Set(t))}},{key:"clearTypes",value:function(){this.allowedTypes.clear()}},{key:"log",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).log.apply(n,["%c[".concat(e,"][INFO]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"info",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).info.apply(n,["%c[".concat(e,"][INFO]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"warn",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e,"warn"),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).warn.apply(n,["%c[".concat(e,"][WARN]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}},{key:"error",value:function(e){var n;if(this.enabled&&(!(this.allowedTypes.size>0)||this.allowedTypes.has(e))){for(var r=t.typeColor(e,"error"),i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];(n=console).error.apply(n,["%c[".concat(e,"][ERROR]"),"color: ".concat(r,"; font-weight: bold;")].concat(o))}}}],r=[{key:"typeColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",n={background:"#0074D9",content:"#2ECC40",popup:"#FF851B",init:"#B10DC9",verification:"#FF4136",fetch:"#39CCCC",provider:"#FFDC00",claim:"#7FDBFF",proof:"#85144b",offscreen:"#AAAAAA",polyfills:"#0074D9","session-timer":"#2ECC40"},r=n[Object.keys(n).find(function(e){return t.toLowerCase().includes(e)})]||"#888888";return"info"!==e&&(r={info:"",warn:"#FFA500",error:"#FF0000"}[e]||r),r}}],n&&i(e.prototype,n),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}(),c=new a,l=(n(3859),n(5606));void 0!==l&&l.env?c.disable():c.enable()},3296(t,e,n){"use strict";n.r(e),n.d(e,{WebSocket:()=>f,default:()=>g});var r,i=n(3153);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,l(r.key),r)}}function c(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t){var e=function(t,e){if("object"!=o(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==o(e)?e:e+""}function u(t,e,n){return e=d(e),function(t,e){if(e&&("object"==o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,h()?Reflect.construct(e,n||[],d(t).constructor):e.apply(t,n))}function h(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(h=function(){return!!t})()}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}(t=n.hmd(t),"undefined"==typeof window)?(r=function(){return c(function t(e,n){var r=this;s(this,t),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating mock WebSocket for background context"),this.url=e,this.protocols=n,this.readyState=3,setTimeout(function(){"function"==typeof r.onclose&&r.onclose({code:1e3,reason:"WebSockets not supported in background context"})},0)},[{key:"send",value:function(){throw i.w9.warn(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Cannot use WebSockets in background context"),new Error("WebSockets are not available in background context")}},{key:"close",value:function(){}},{key:"sendPromise",value:function(){return Promise.reject(new Error("WebSockets are not available in background context"))}},{key:"addEventListener",value:function(){}},{key:"removeEventListener",value:function(){}}])}(),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using mock WebSocket implementation for background context")):(r=function(t){function e(t,n){var r;return s(this,e),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Creating WebSocket with URL:",t),(r=u(this,e,[t,n])).addEventListener("error",function(t){"function"==typeof r.onerror&&r.onerror(t)}),r.addEventListener("open",function(t){"function"==typeof r.onopen&&r.onopen(t)}),r.addEventListener("close",function(t){"function"==typeof r.onclose&&r.onclose(t)}),r.addEventListener("message",function(t){"function"==typeof r.onmessage&&r.onmessage(t)}),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(e,t),c(e,[{key:"sendPromise",value:function(t){var e=this;return new Promise(function(n,r){try{e.send(t),n()}catch(t){r(t)}})}}])}(window.WebSocket),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] Using browser WebSocket implementation"));var f=r;const g=r;t.exports&&(t.exports=r,t.exports.WebSocket=r,t.exports.default=r),i.w9.info(i.Ey.POLYFILLS,"[WEBSOCKET-POLYFILL] WebSocket polyfill initialized")},7604(t,e,n){var r;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(t){return function(t,e){var n,r,s,a,c,l,u,h,d,p=1,f=t.length,g="";for(r=0;r<f;r++)if("string"==typeof t[r])g+=t[r];else if("object"==typeof t[r]){if((a=t[r]).keys)for(n=e[p],s=0;s<a.keys.length;s++){if(null==n)throw new Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[s],a.keys[s-1]));n=n[a.keys[s]]}else n=a.param_no?e[a.param_no]:e[p++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&n instanceof Function&&(n=n()),i.numeric_arg.test(a.type)&&"number"!=typeof n&&isNaN(n))throw new TypeError(o("[sprintf] expecting number but found %T",n));switch(i.number.test(a.type)&&(h=n>=0),a.type){case"b":n=parseInt(n,10).toString(2);break;case"c":n=String.fromCharCode(parseInt(n,10));break;case"d":case"i":n=parseInt(n,10);break;case"j":n=JSON.stringify(n,null,a.width?parseInt(a.width):0);break;case"e":n=a.precision?parseFloat(n).toExponential(a.precision):parseFloat(n).toExponential();break;case"f":n=a.precision?parseFloat(n).toFixed(a.precision):parseFloat(n);break;case"g":n=a.precision?String(Number(n.toPrecision(a.precision))):parseFloat(n);break;case"o":n=(parseInt(n,10)>>>0).toString(8);break;case"s":n=String(n),n=a.precision?n.substring(0,a.precision):n;break;case"t":n=String(!!n),n=a.precision?n.substring(0,a.precision):n;break;case"T":n=Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),n=a.precision?n.substring(0,a.precision):n;break;case"u":n=parseInt(n,10)>>>0;break;case"v":n=n.valueOf(),n=a.precision?n.substring(0,a.precision):n;break;case"x":n=(parseInt(n,10)>>>0).toString(16);break;case"X":n=(parseInt(n,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?g+=n:(!i.number.test(a.type)||h&&!a.sign?d="":(d=h?"+":"-",n=n.toString().replace(i.sign,"")),l=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",u=a.width-(d+n).length,c=a.width&&u>0?l.repeat(u):"",g+=a.align?d+n+c:"0"===l?d+c+n:c+d+n)}return g}(function(t){if(a[t])return a[t];var e,n=t,r=[],o=0;for(;n;){if(null!==(e=i.text.exec(n)))r.push(e[0]);else if(null!==(e=i.modulo.exec(n)))r.push("%");else{if(null===(e=i.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){o|=1;var s=[],c=e[2],l=[];if(null===(l=i.key.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(l[1]);""!==(c=c.substring(l[0].length));)if(null!==(l=i.key_access.exec(c)))s.push(l[1]);else{if(null===(l=i.index_access.exec(c)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(l[1])}e[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:e[0],param_no:e[1],keys:e[2],sign:e[3],pad_char:e[4],align:e[5],width:e[6],precision:e[7],type:e[8]})}n=n.substring(e[0].length)}return a[t]=r}(t),arguments)}function s(t,e){return o.apply(null,[t].concat(e||[]))}var a=Object.create(null);e.sprintf=o,e.vsprintf=s,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(r=function(){return{sprintf:o,vsprintf:s}}.call(e,n,e,t))||(t.exports=r))}()},3631(t,e){!function(t){"use strict";var e="__namespace",n=function(t){return t&&((n=t.nodeType)===e||Number.isInteger(n)&&n>=1&&n<=11)&&"string"==typeof t.nodeName;var n};var r=function(t,e){for(var n=0;n<e.length;n+=1)t(e[n],n,e)},i=function(t,e,n){var i=e;return r(function(e,n){i=t(i,e,n)},n),i},o=function(t,e){var n=new Array(e.length);return r(function(e,r){n[r]=t(e)},e),n},s=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n]===e)return!0;return!1};function a(t){return t.toString()}var c=function(t,e){return e.join(t)},l=function(t,e,n){return t+n+e},u=Array.prototype.concat;function h(t,e){for(var n=Object(t),r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])}return n}var d=1,p=2,f=3,g=4,A=7,E=8,m=9,w=10,y=11,B=e;function I(){this.init()}function C(t){this.expression=t}function T(t,e,n){e in t||(t[e]=n)}function b(){}function D(t){arguments.length>0&&this.init(t)}function v(t){arguments.length>0&&this.init(t)}function M(t,e){arguments.length>0&&this.init(t,e)}function N(t,e){arguments.length>0&&this.init(t,e)}function S(t,e){arguments.length>0&&this.init(t,e)}function _(t,e){arguments.length>0&&this.init(t,e)}function L(t,e){arguments.length>0&&this.init(t,e)}function x(t,e){arguments.length>0&&this.init(t,e)}function R(t,e){arguments.length>0&&this.init(t,e)}function F(t,e){arguments.length>0&&this.init(t,e)}function k(t,e){arguments.length>0&&this.init(t,e)}function O(t,e){arguments.length>0&&this.init(t,e)}function Q(t,e){arguments.length>0&&this.init(t,e)}function U(t,e){arguments.length>0&&this.init(t,e)}function P(t,e){arguments.length>0&&this.init(t,e)}function G(t,e){arguments.length>0&&this.init(t,e)}function V(t,e){arguments.length>0&&this.init(t,e)}function j(t,e,n){arguments.length>0&&this.init(t,e,n)}function H(t){for(;t&&t.parentNode;)t=t.parentNode;return t}I.prototype=new Object,I.prototype.constructor=I,I.superclass=Object.prototype,I.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(t){return new N(t[0],t[2])},this.reduceActions[5]=function(t){return new S(t[0],t[2])},this.reduceActions[7]=function(t){return new _(t[0],t[2])},this.reduceActions[8]=function(t){return new L(t[0],t[2])},this.reduceActions[10]=function(t){return new x(t[0],t[2])},this.reduceActions[11]=function(t){return new R(t[0],t[2])},this.reduceActions[12]=function(t){return new F(t[0],t[2])},this.reduceActions[13]=function(t){return new k(t[0],t[2])},this.reduceActions[15]=function(t){return new O(t[0],t[2])},this.reduceActions[16]=function(t){return new Q(t[0],t[2])},this.reduceActions[18]=function(t){return new U(t[0],t[2])},this.reduceActions[19]=function(t){return new P(t[0],t[2])},this.reduceActions[20]=function(t){return new G(t[0],t[2])},this.reduceActions[22]=function(t){return new v(t[1])},this.reduceActions[24]=function(t){return new V(t[0],t[2])},this.reduceActions[25]=function(t){return new j(void 0,void 0,t[0])},this.reduceActions[27]=function(t){return t[0].locationPath=t[2],t[0]},this.reduceActions[28]=function(t){return t[0].locationPath=t[2],t[0].locationPath.steps.unshift(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[0]},this.reduceActions[29]=function(t){return new j(t[0],[],void 0)},this.reduceActions[30]=function(t){return pt.instance_of(t[0],j)?(null==t[0].filterPredicates&&(t[0].filterPredicates=[]),t[0].filterPredicates.push(t[1]),t[0]):new j(t[0],[t[1]],void 0)},this.reduceActions[32]=function(t){return t[1]},this.reduceActions[33]=function(t){return new nt(t[0])},this.reduceActions[34]=function(t){return new rt(t[0])},this.reduceActions[36]=function(t){return new tt(t[0],[])},this.reduceActions[37]=function(t){return new tt(t[0],t[2])},this.reduceActions[38]=function(t){return[t[0]]},this.reduceActions[39]=function(t){return t[2].unshift(t[0]),t[2]},this.reduceActions[43]=function(t){return new q(!0,[])},this.reduceActions[44]=function(t){return t[1].absolute=!0,t[1]},this.reduceActions[46]=function(t){return new q(!1,[t[0]])},this.reduceActions[47]=function(t){return t[0].steps.push(t[2]),t[0]},this.reduceActions[49]=function(t){return new K(t[0],t[1],[])},this.reduceActions[50]=function(t){return new K(K.CHILD,t[0],[])},this.reduceActions[51]=function(t){return new K(t[0],t[1],t[2])},this.reduceActions[52]=function(t){return new K(K.CHILD,t[0],t[1])},this.reduceActions[54]=function(t){return[t[0]]},this.reduceActions[55]=function(t){return t[1].unshift(t[0]),t[1]},this.reduceActions[56]=function(t){return"ancestor"==t[0]?K.ANCESTOR:"ancestor-or-self"==t[0]?K.ANCESTORORSELF:"attribute"==t[0]?K.ATTRIBUTE:"child"==t[0]?K.CHILD:"descendant"==t[0]?K.DESCENDANT:"descendant-or-self"==t[0]?K.DESCENDANTORSELF:"following"==t[0]?K.FOLLOWING:"following-sibling"==t[0]?K.FOLLOWINGSIBLING:"namespace"==t[0]?K.NAMESPACE:"parent"==t[0]?K.PARENT:"preceding"==t[0]?K.PRECEDING:"preceding-sibling"==t[0]?K.PRECEDINGSIBLING:"self"==t[0]?K.SELF:-1},this.reduceActions[57]=function(t){return K.ATTRIBUTE},this.reduceActions[59]=function(t){return"comment"==t[0]?X.commentTest:"text"==t[0]?X.textTest:"processing-instruction"==t[0]?X.anyPiTest:"node"==t[0]?X.nodeTest:new X(-1,void 0)},this.reduceActions[60]=function(t){return new X.PITest(t[2])},this.reduceActions[61]=function(t){return t[1]},this.reduceActions[63]=function(t){return t[1].absolute=!0,t[1].steps.unshift(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[1]},this.reduceActions[64]=function(t){return t[0].steps.push(new K(K.DESCENDANTORSELF,X.nodeTest,[])),t[0].steps.push(t[2]),t[0]},this.reduceActions[65]=function(t){return new K(K.SELF,X.nodeTest,[])},this.reduceActions[66]=function(t){return new K(K.PARENT,X.nodeTest,[])},this.reduceActions[67]=function(t){return new $(t[1])},this.reduceActions[68]=function(t){return X.nameTestAny},this.reduceActions[69]=function(t){return new X.NameTestPrefixAny(t[0].split(":")[0])},this.reduceActions[70]=function(t){return new X.NameTestQName(t[0])}},I.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],I.actionTableNumber=[" 1 0 /.-,+*)(' & %$ # \"!"," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY "," 1 0 /.-,+*)(' & %$ # \"!","K1 KKKKKKKK . +*)('KKKKKK KK# K\" "," 1 0 /.-,+*)(' & %$ # \"!"," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q "," 1 . +*)(' # \" ","b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX "," 1 0 /.-,+*)(' & %$m # \"!","_ f________ ______e __ _ "," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 0 /.-,+*)(' %$ # \"!"," 1 0 /.-,+*)(' & %$ # \"!"," 1 . +*)(' # \" "," 1 . +*)(' # \" ","> >>>>>>>>> >>>>>>> >> >> "," 1 . +*)(' # \" "," 1 . +*)(' # \" ","Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," "," F ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE "," 1 0 /.-,+*)(' & %$ # \"!","] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],I.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","456789:;<=>?@ AB CDEFGH IJ"," EFGH IJ "," EFGH IJ "," "," GH IJ ","
GH IJ "," i "," i "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABqCDEFGH IJ "," "," "],I.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],I.DOUBLEDOT=2,I.DOUBLECOLON=3,I.DOUBLESLASH=4,I.NOTEQUAL=5,I.LESSTHANOREQUAL=6,I.GREATERTHANOREQUAL=7,I.AND=8,I.OR=9,I.MOD=10,I.DIV=11,I.MULTIPLYOPERATOR=12,I.FUNCTIONNAME=13,I.AXISNAME=14,I.LITERAL=15,I.NUMBER=16,I.ASTERISKNAMETEST=17,I.QNAME=18,I.NCNAMECOLONASTERISK=19,I.NODETYPE=20,I.PROCESSINGINSTRUCTIONWITHLITERAL=21,I.EQUALS=22,I.LESSTHAN=23,I.GREATERTHAN=24,I.PLUS=25,I.MINUS=26,I.BAR=27,I.SLASH=28,I.LEFTPARENTHESIS=29,I.RIGHTPARENTHESIS=30,I.COMMA=31,I.AT=32,I.LEFTBRACKET=33,I.RIGHTBRACKET=34,I.DOT=35,I.DOLLAR=36,I.prototype.tokenize=function(t){for(var e=[],n=[],r=t+"\0",i=0,o=r.charAt(i++);;){for(;" "==o||"\t"==o||"\r"==o||"\n"==o;)o=r.charAt(i++);if("\0"==o||i>=r.length)break;if("("!=o)if(")"!=o)if("["!=o)if("]"!=o)if("@"!=o)if(","!=o)if("|"!=o)if("+"!=o)if("-"!=o)if("="!=o)if("$"!=o)if("."!=o)if("'"!=o&&'"'!=o)if(o>="0"&&o<="9"){u=o;for(o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);if("."==o&&r.charAt(i)>="0"&&r.charAt(i)<="9")for(u+=o,u+=r.charAt(i++),o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);e.push(I.NUMBER),n.push(u)}else if("*"!=o)if(":"!=o||":"!=r.charAt(i))if("/"!=o)if("!"!=o||"="!=r.charAt(i))if("<"!=o)if(">"!=o){if("_"!=o&&!pt.isLetter(o.charCodeAt(0)))throw new Error("Unexpected character "+o);var s=o;for(o=r.charAt(i++);pt.isNCNameChar(o.charCodeAt(0));)s+=o,o=r.charAt(i++);if(e.length>0&&(a=e[e.length-1])!=I.AT&&a!=I.DOUBLECOLON&&a!=I.LEFTPARENTHESIS&&a!=I.LEFTBRACKET&&a!=I.AND&&a!=I.OR&&a!=I.MOD&&a!=I.DIV&&a!=I.MULTIPLYOPERATOR&&a!=I.SLASH&&a!=I.DOUBLESLASH&&a!=I.BAR&&a!=I.PLUS&&a!=I.MINUS&&a!=I.EQUALS&&a!=I.NOTEQUAL&&a!=I.LESSTHAN&&a!=I.LESSTHANOREQUAL&&a!=I.GREATERTHAN&&a!=I.GREATERTHANOREQUAL){if("and"==s){e.push(I.AND),n.push(s);continue}if("or"==s){e.push(I.OR),n.push(s);continue}if("mod"==s){e.push(I.MOD),n.push(s);continue}if("div"==s){e.push(I.DIV),n.push(s);continue}}if(":"==o){if("*"==r.charAt(i)){e.push(I.NCNAMECOLONASTERISK),n.push(s+":*"),i++,o=r.charAt(i++);continue}if("_"==r.charAt(i)||pt.isLetter(r.charCodeAt(i))){for(s+=":",o=r.charAt(i++);pt.isNCNameChar(o.charCodeAt(0));)s+=o,o=r.charAt(i++);if("("==o){e.push(I.FUNCTIONNAME),n.push(s);continue}e.push(I.QNAME),n.push(s);continue}if(":"==r.charAt(i)){e.push(I.AXISNAME),n.push(s);continue}}if("("==o){if("comment"==s||"text"==s||"node"==s){e.push(I.NODETYPE),n.push(s);continue}if("processing-instruction"==s){")"==r.charAt(i)?e.push(I.NODETYPE):e.push(I.PROCESSINGINSTRUCTIONWITHLITERAL),n.push(s);continue}e.push(I.FUNCTIONNAME),n.push(s);continue}e.push(I.QNAME),n.push(s)}else{if("="==r.charAt(i)){e.push(I.GREATERTHANOREQUAL),n.push(">="),i++,o=r.charAt(i++);continue}e.push(I.GREATERTHAN),n.push(">"),o=r.charAt(i++)}else{if("="==r.charAt(i)){e.push(I.LESSTHANOREQUAL),n.push("<="),i++,o=r.charAt(i++);continue}e.push(I.LESSTHAN),n.push("<"),o=r.charAt(i++)}else e.push(I.NOTEQUAL),n.push("!="),i++,o=r.charAt(i++);else{if("/"==(o=r.charAt(i++))){e.push(I.DOUBLESLASH),n.push("//"),o=r.charAt(i++);continue}e.push(I.SLASH),n.push("/")}else e.push(I.DOUBLECOLON),n.push("::"),i++,o=r.charAt(i++);else{var a;if(e.length>0&&(a=e[e.length-1])!=I.AT&&a!=I.DOUBLECOLON&&a!=I.LEFTPARENTHESIS&&a!=I.LEFTBRACKET&&a!=I.AND&&a!=I.OR&&a!=I.MOD&&a!=I.DIV&&a!=I.MULTIPLYOPERATOR&&a!=I.SLASH&&a!=I.DOUBLESLASH&&a!=I.BAR&&a!=I.PLUS&&a!=I.MINUS&&a!=I.EQUALS&&a!=I.NOTEQUAL&&a!=I.LESSTHAN&&a!=I.LESSTHANOREQUAL&&a!=I.GREATERTHAN&&a!=I.GREATERTHANOREQUAL){e.push(I.MULTIPLYOPERATOR),n.push(o),o=r.charAt(i++);continue}e.push(I.ASTERISKNAMETEST),n.push(o),o=r.charAt(i++)}else{for(var c=o,l="";i<r.length&&(o=r.charAt(i))!==c;)l+=o,i+=1;if(o!==c)throw gt.fromMessage("Unterminated string literal: "+c+l);i+=1,e.push(I.LITERAL),n.push(l),o=r.charAt(i++)}else{if("."==(o=r.charAt(i++))){e.push(I.DOUBLEDOT),n.push(".."),o=r.charAt(i++);continue}if(o>="0"&&o<="9"){var u="."+o;for(o=r.charAt(i++);o>="0"&&o<="9";)u+=o,o=r.charAt(i++);e.push(I.NUMBER),n.push(u);continue}e.push(I.DOT),n.push(".")}else e.push(I.DOLLAR),n.push(o),o=r.charAt(i++);else e.push(I.EQUALS),n.push(o),o=r.charAt(i++);else e.push(I.MINUS),n.push(o),o=r.charAt(i++);else e.push(I.PLUS),n.push(o),o=r.charAt(i++);else e.push(I.BAR),n.push(o),o=r.charAt(i++);else e.push(I.COMMA),n.push(o),o=r.charAt(i++);else e.push(I.AT),n.push(o),o=r.charAt(i++);else e.push(I.RIGHTBRACKET),n.push(o),o=r.charAt(i++);else e.push(I.LEFTBRACKET),n.push(o),o=r.charAt(i++);else e.push(I.RIGHTPARENTHESIS),n.push(o),o=r.charAt(i++);else e.push(I.LEFTPARENTHESIS),n.push(o),o=r.charAt(i++)}return e.push(1),n.push("[EOF]"),[e,n]},I.SHIFT="s",I.REDUCE="r",I.ACCEPT="a",I.prototype.parse=function(t){if(!t)throw new Error("XPath expression unspecified.");if("string"!=typeof t)throw new Error("XPath expression must be a string.");var e,n,r=this.tokenize(t);if(null!=r){e=r[0],n=r[1];var i,o,s=0,a=[],c=[],l=[];for(a.push(0),c.push(1),l.push("_S"),i=e[s],o=n[s++];;)switch(t=a[a.length-1],I.actionTable[t].charAt(i-1)){case I.SHIFT:c.push(-i),l.push(o),a.push(I.actionTableNumber[t].charCodeAt(i-1)-32),i=e[s],o=n[s++];break;case I.REDUCE:for(var u=I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][1],h=[],d=0;d<u;d++)c.pop(),h.unshift(l.pop()),a.pop();var p=a[a.length-1];c.push(I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][0]),null==this.reduceActions[I.actionTableNumber[t].charCodeAt(i-1)-32]?l.push(h[0]):l.push(this.reduceActions[I.actionTableNumber[t].charCodeAt(i-1)-32](h)),a.push(I.gotoTable[p].charCodeAt(I.productions[I.actionTableNumber[t].charCodeAt(i-1)-32][0]-2)-33);break;case I.ACCEPT:return new C(l.pop());default:throw new Error("XPath parse error")}}},C.prototype=new Object,C.prototype.constructor=C,C.superclass=Object.prototype,C.prototype.toString=function(){return this.expression.toString()},C.prototype.evaluate=function(t){var e=t.expressionContextNode;if(null!=e&&!n(e))throw new Error("Context node does not appear to be a valid DOM node.");return t.contextNode=t.expressionContextNode,t.contextSize=1,t.contextPosition=1,t.isHtml&&(T(t,"caseInsensitive",!0),T(t,"allowAnyNamespaceForNoPrefix",!0)),T(t,"caseInsensitive",!1),this.expression.evaluate(t)},C.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",C.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",b.prototype=new Object,b.prototype.constructor=b,b.superclass=Object.prototype,b.prototype.init=function(){},b.prototype.toString=function(){return"<Expression>"},b.prototype.evaluate=function(t){throw new Error("Could not evaluate expression.")},D.prototype=new b,D.prototype.constructor=D,D.superclass=b.prototype,D.prototype.init=function(t){this.rhs=t},v.prototype=new D,v.prototype.constructor=v,v.superclass=D.prototype,v.prototype.init=function(t){v.superclass.init.call(this,t)},v.prototype.evaluate=function(t){return this.rhs.evaluate(t).number().negate()},v.prototype.toString=function(){return"-"+this.rhs.toString()},M.prototype=new b,M.prototype.constructor=M,M.superclass=b.prototype,M.prototype.init=function(t,e){this.lhs=t,this.rhs=e},N.prototype=new M,N.prototype.constructor=N,N.superclass=M.prototype,N.prototype.init=function(t,e){N.superclass.init.call(this,t,e)},N.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},N.prototype.evaluate=function(t){var e=this.lhs.evaluate(t).bool();return e.booleanValue()?e:this.rhs.evaluate(t).bool()},S.prototype=new M,S.prototype.constructor=S,S.superclass=M.prototype,S.prototype.init=function(t,e){S.superclass.init.call(this,t,e)},S.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},S.prototype.evaluate=function(t){var e=this.lhs.evaluate(t).bool();return e.booleanValue()?this.rhs.evaluate(t).bool():e},_.prototype=new M,_.prototype.constructor=_,_.superclass=M.prototype,_.prototype.init=function(t,e){_.superclass.init.call(this,t,e)},_.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},_.prototype.evaluate=function(t){return this.lhs.evaluate(t).equals(this.rhs.evaluate(t))},L.prototype=new M,L.prototype.constructor=L,L.superclass=M.prototype,L.prototype.init=function(t,e){L.superclass.init.call(this,t,e)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(t){return this.lhs.evaluate(t).notequal(this.rhs.evaluate(t))},x.prototype=new M,x.prototype.constructor=x,x.superclass=M.prototype,x.prototype.init=function(t,e){x.superclass.init.call(this,t,e)},x.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthan(this.rhs.evaluate(t))},x.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},R.prototype=new M,R.prototype.constructor=R,R.superclass=M.prototype,R.prototype.init=function(t,e){R.superclass.init.call(this,t,e)},R.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthan(this.rhs.evaluate(t))},R.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},F.prototype=new M,F.prototype.constructor=F,F.superclass=M.prototype,F.prototype.init=function(t,e){F.superclass.init.call(this,t,e)},F.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthanorequal(this.rhs.evaluate(t))},F.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},k.prototype=new M,k.prototype.constructor=k,k.superclass=M.prototype,k.prototype.init=function(t,e){k.superclass.init.call(this,t,e)},k.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthanorequal(this.rhs.evaluate(t))},k.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},O.prototype=new M,O.prototype.constructor=O,O.superclass=M.prototype,O.prototype.init=function(t,e){O.superclass.init.call(this,t,e)},O.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().plus(this.rhs.evaluate(t).number())},O.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},Q.prototype=new M,Q.prototype.constructor=Q,Q.superclass=M.prototype,Q.prototype.init=function(t,e){Q.superclass.init.call(this,t,e)},Q.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().minus(this.rhs.evaluate(t).number())},Q.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},U.prototype=new M,U.prototype.constructor=U,U.superclass=M.prototype,U.prototype.init=function(t,e){U.superclass.init.call(this,t,e)},U.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().multiply(this.rhs.evaluate(t).number())},U.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},P.prototype=new M,P.prototype.constructor=P,P.superclass=M.prototype,P.prototype.init=function(t,e){P.superclass.init.call(this,t,e)},P.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().div(this.rhs.evaluate(t).number())},P.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},G.prototype=new M,G.prototype.constructor=G,G.superclass=M.prototype,G.prototype.init=function(t,e){G.superclass.init.call(this,t,e)},G.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().mod(this.rhs.evaluate(t).number())},G.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},V.prototype=new M,V.prototype.constructor=V,V.superclass=M.prototype,V.prototype.init=function(t,e){V.superclass.init.call(this,t,e)},V.prototype.evaluate=function(t){return this.lhs.evaluate(t).nodeset().union(this.rhs.evaluate(t).nodeset())},V.prototype.toString=function(){return o(a,[this.lhs,this.rhs]).join(" | ")},j.prototype=new b,j.prototype.constructor=j,j.superclass=b.prototype,j.prototype.init=function(t,e,n){j.superclass.init.call(this),this.filter=t,this.filterPredicates=e,this.locationPath=n};var Y=function(t,e,n,o){if(0===t.length)return n;var s=e.extend({});return i(function(t,e){return s.contextSize=t.length,n=function(t,n){return s.contextNode=t,s.contextPosition=n+1,j.predicateMatches(e,s)},i=[],r(function(t,e){n(t,e)&&i.push(t)},t),i;var n,i},function(t,e){var n=new st;n.addArray(t);var r=n.toArray();return e?r.reverse():r}(n,o),t)};j.getRoot=function(t,e){var n=e[0];if(n&&n.nodeType===m)return n;if(t.virtualRoot)return t.virtualRoot;if(!n)throw new Error("Context node not found when determining document root.");var r=n.ownerDocument;if(r)return r;for(var i=n;null!=i.parentNode;)i=i.parentNode;return i};var z=function(t){var e=String(t.name);return"xmlns"===e?"":"xmlns:"===e.substring(0,6)?e.substring(6,e.length):null};function J(t,e,n){return Y(t.predicates,e,j.applyStep(t,e,n),s(Z,t.axis))}function W(t,e,n){return function(t){for(var e=[],n=0;n<t.length;n+=32767){var r=t.slice(n,n+32767);e=u.apply(e,r)}return e}(o(J.bind(null,n,t),e))}function q(t,e){arguments.length>0&&this.init(t,e)}function K(t,e,n){arguments.length>0&&this.init(t,e,n)}j.applyStep=function(t,e,n){if(!n)throw new Error("Context node not found when evaluating XPath step: "+t);var r=[];switch(e.contextNode=n,t.axis){case K.ANCESTOR:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.nodeType==p?j.getOwnerElement(e.contextNode):e.contextNode.parentNode;null!=i&&(t.nodeTest.matches(i,e)&&r.push(i),i!==e.virtualRoot);)i=i.parentNode;break;case K.ANCESTORORSELF:for(var i=e.contextNode;null!=i&&(t.nodeTest.matches(i,e)&&r.push(i),i!==e.virtualRoot);i=i.nodeType==p?j.getOwnerElement(i):i.parentNode);break;case K.ATTRIBUTE:var o=e.contextNode.attributes;if(null!=o)for(var s=0;s<o.length;s++){i=o.item(s);t.nodeTest.matches(i,e)&&r.push(i)}break;case K.CHILD:for(i=e.contextNode.firstChild;null!=i;i=i.nextSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.DESCENDANT:for(var a=[e.contextNode.firstChild];a.length>0;)for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling;break;case K.DESCENDANTORSELF:t.nodeTest.matches(e.contextNode,e)&&r.push(e.contextNode);for(a=[e.contextNode.firstChild];a.length>0;)for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling;break;case K.FOLLOWING:if(e.contextNode===e.virtualRoot)break;a=[];null!=e.contextNode.firstChild?a.unshift(e.contextNode.firstChild):a.unshift(e.contextNode.nextSibling);for(i=e.contextNode.parentNode;null!=i&&i.nodeType!=m&&i!==e.virtualRoot;i=i.parentNode)a.unshift(i.nextSibling);do{for(i=a.pop();null!=i;)t.nodeTest.matches(i,e)&&r.push(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling}while(a.length>0);break;case K.FOLLOWINGSIBLING:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.nextSibling;null!=i;i=i.nextSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.NAMESPACE:var c={};if(e.contextNode.nodeType==d){c.xml=new at("xml",null,C.XML_NAMESPACE_URI,e.contextNode);for(i=e.contextNode;null!=i&&i.nodeType==d;i=i.parentNode)for(s=0;s<i.attributes.length;s++){var l=i.attributes.item(s);null!=(u=z(l))&&null==c[u]&&(c[u]=new at(u,l,l.value,e.contextNode))}for(var u in c){n=c[u];t.nodeTest.matches(n,e)&&r.push(n)}}break;case K.PARENT:i=null,e.contextNode!==e.virtualRoot&&(i=e.contextNode.nodeType==p?j.getOwnerElement(e.contextNode):e.contextNode.parentNode),null!=i&&t.nodeTest.matches(i,e)&&r.push(i);break;case K.PRECEDING:a=null!=e.virtualRoot?[e.virtualRoot]:[H(e.contextNode)];t:for(;a.length>0;)for(i=a.pop();null!=i;){if(i==e.contextNode)break t;t.nodeTest.matches(i,e)&&r.unshift(i),null!=i.firstChild?(a.push(i.nextSibling),i=i.firstChild):i=i.nextSibling}break;case K.PRECEDINGSIBLING:if(e.contextNode===e.virtualRoot)break;for(i=e.contextNode.previousSibling;null!=i;i=i.previousSibling)t.nodeTest.matches(i,e)&&r.push(i);break;case K.SELF:t.nodeTest.matches(e.contextNode,e)&&r.push(e.contextNode)}return r},j.applySteps=function(t,e,n){return i(W.bind(null,e),n,t)},j.prototype.applyFilter=function(t,e){if(!this.filter)return{nodes:[t.contextNode]};var n=this.filter.evaluate(t);if(!pt.instance_of(n,st)){if(null!=this.filterPredicates&&this.filterPredicates.length>0||null!=this.locationPath)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:n}}return{nodes:Y(this.filterPredicates||[],e,n.toUnsortedArray(),!1)}},j.applyLocationPath=function(t,e,n){if(!t)return n;var r=t.absolute?[j.getRoot(e,n)]:n;return j.applySteps(t.steps,e,r)},j.prototype.evaluate=function(t){var e=h(new ct,t),n=this.applyFilter(t,e);if("nonNodes"in n)return n.nonNodes;var r=new st;return r.addArray(j.applyLocationPath(this.locationPath,e,n.nodes)),r},j.predicateMatches=function(t,e){var n=t.evaluate(e);return pt.instance_of(n,rt)?e.contextPosition===n.numberValue():n.booleanValue()},j.predicateString=function(t){return l("[","]",t.toString())},j.predicatesString=function(t){return c("",o(j.predicateString,t))},j.prototype.toString=function(){if(null!=this.filter){var t=a(this.filter);return pt.instance_of(this.filter,nt)?l("'","'",t):null!=this.filterPredicates&&this.filterPredicates.length?l("(",")",t)+j.predicatesString(this.filterPredicates):null!=this.locationPath?t+(this.locationPath.absolute?"":"/")+a(this.locationPath):t}return a(this.locationPath)},j.getOwnerElement=function(t){if(t.ownerElement)return t.ownerElement;try{if(t.selectSingleNode)return t.selectSingleNode("..")}catch(t){}for(var e=(t.nodeType==m?t:t.ownerDocument).getElementsByTagName("*"),n=0;n<e.length;n++)for(var r=e.item(n),i=r.attributes,o=0;o<i.length;o++){if(i.item(o)===t)return r}return null},q.prototype=new Object,q.prototype.constructor=q,q.superclass=Object.prototype,q.prototype.init=function(t,e){this.absolute=t,this.steps=e},q.prototype.toString=function(){return(this.absolute?"/":"")+o(a,this.steps).join("/")},K.prototype=new Object,K.prototype.constructor=K,K.superclass=Object.prototype,K.prototype.init=function(t,e,n){this.axis=t,this.nodeTest=e,this.predicates=n},K.prototype.toString=function(){return K.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+j.predicatesString(this.predicates)},K.ANCESTOR=0,K.ANCESTORORSELF=1,K.ATTRIBUTE=2,K.CHILD=3,K.DESCENDANT=4,K.DESCENDANTORSELF=5,K.FOLLOWING=6,K.FOLLOWINGSIBLING=7,K.NAMESPACE=8,K.PARENT=9,K.PRECEDING=10,K.PRECEDINGSIBLING=11,K.SELF=12,K.STEPNAMES=i(function(t,e){return t[e[0]]=e[1],t},{},[[K.ANCESTOR,"ancestor"],[K.ANCESTORORSELF,"ancestor-or-self"],[K.ATTRIBUTE,"attribute"],[K.CHILD,"child"],[K.DESCENDANT,"descendant"],[K.DESCENDANTORSELF,"descendant-or-self"],[K.FOLLOWING,"following"],[K.FOLLOWINGSIBLING,"following-sibling"],[K.NAMESPACE,"namespace"],[K.PARENT,"parent"],[K.PRECEDING,"preceding"],[K.PRECEDINGSIBLING,"preceding-sibling"],[K.SELF,"self"]]);var Z=[K.ANCESTOR,K.ANCESTORORSELF,K.PARENT,K.PRECEDING,K.PRECEDINGSIBLING];function X(t,e){arguments.length>0&&this.init(t,e)}function $(t){arguments.length>0&&this.init(t)}function tt(t,e){arguments.length>0&&this.init(t,e)}X.prototype=new Object,X.prototype.constructor=X,X.superclass=Object.prototype,X.prototype.init=function(t,e){this.type=t,this.value=e},X.prototype.toString=function(){return"<unknown nodetest type>"},X.prototype.matches=function(t,e){console.warn("unknown node test type")},X.NAMETESTANY=0,X.NAMETESTPREFIXANY=1,X.NAMETESTQNAME=2,X.COMMENT=3,X.TEXT=4,X.PI=5,X.NODE=6,X.isNodeType=function(t){return function(e){return s(t,e.nodeType)}},X.makeNodeTestType=function(t,e,n){var r=n||function(){};return r.prototype=new X(t),r.prototype.constructor=r,h(r.prototype,e),r},X.makeNodeTypeTest=function(t,e,n){return new(X.makeNodeTestType(t,{matches:X.isNodeType(e),toString:(r=n,function(){return r})}));var r},X.hasPrefix=function(t){return t.prefix||-1!==(t.nodeName||t.tagName).indexOf(":")},X.isElementOrAttribute=X.isNodeType([1,2]),X.nameSpaceMatches=function(t,e,n){var r=n.namespaceURI||"";if(!t)return!r||e.allowAnyNamespaceForNoPrefix&&!X.hasPrefix(n);var i=e.namespaceResolver.getNamespace(t,e.expressionContextNode);if(null==i)throw new Error("Cannot resolve QName "+t);return i===r},X.localNameMatches=function(t,e,n){var r=n.localName||n.nodeName;return e.caseInsensitive?t.toLowerCase()===r.toLowerCase():t===r},X.NameTestPrefixAny=X.makeNodeTestType(X.NAMETESTPREFIXANY,{matches:function(t,e){return X.isElementOrAttribute(t)&&X.nameSpaceMatches(this.prefix,e,t)},toString:function(){return this.prefix+":*"}},function(t){this.prefix=t}),X.NameTestQName=X.makeNodeTestType(X.NAMETESTQNAME,{matches:function(t,e){return X.isNodeType([d,p,B])(t)&&X.nameSpaceMatches(this.prefix,e,t)&&X.localNameMatches(this.localName,e,t)},toString:function(){return this.name}},function(t){var e=t.split(":");this.name=t,this.prefix=e.length>1?e[0]:null,this.localName=e[e.length>1?1:0]}),X.PITest=X.makeNodeTestType(X.PI,{matches:function(t,e){return X.isNodeType([A])(t)&&(t.target||t.nodeName)===this.name},toString:function(){return l('processing-instruction("','")',this.name)}},function(t){this.name=t}),X.nameTestAny=X.makeNodeTypeTest(X.NAMETESTANY,[d,p,B],"*"),X.textTest=X.makeNodeTypeTest(X.TEXT,[f,g],"text()"),X.commentTest=X.makeNodeTypeTest(X.COMMENT,[E],"comment()"),X.nodeTest=X.makeNodeTypeTest(X.NODE,[d,p,f,g,A,E,m],"node()"),X.anyPiTest=X.makeNodeTypeTest(X.PI,[A],"processing-instruction()"),$.prototype=new b,$.prototype.constructor=$,$.superclass=b.prototype,$.prototype.init=function(t){this.variable=t},$.prototype.toString=function(){return"$"+this.variable},$.prototype.evaluate=function(t){var e=pt.resolveQName(this.variable,t.namespaceResolver,t.contextNode,!1);if(null==e[0])throw new Error("Cannot resolve QName "+fn);var n=t.variableResolver.getVariable(e[1],e[0]);if(!n)throw gt.fromMessage("Undeclared variable: "+this.toString());return n},tt.prototype=new b,tt.prototype.constructor=tt,tt.superclass=b.prototype,tt.prototype.init=function(t,e){this.functionName=t,this.arguments=e},tt.prototype.toString=function(){for(var t=this.functionName+"(",e=0;e<this.arguments.length;e++)e>0&&(t+=", "),t+=this.arguments[e].toString();return t+")"},tt.prototype.evaluate=function(t){var e=ut.getFunctionFromContext(this.functionName,t);if(!e)throw new Error("Unknown function "+this.functionName);var n=[t].concat(this.arguments);return e.apply(t.functionResolver.thisArg,n)};var et=new Object;function nt(t){arguments.length>0&&this.init(t)}function rt(t){arguments.length>0&&this.init(t)}function it(t){arguments.length>0&&this.init(t)}function ot(t){this.init(t)}function st(){this.init()}function at(t,e,n,r){this.isXPathNamespace=!0,this.baseNode=e,this.ownerDocument=r.ownerDocument,this.nodeName=t,this.prefix=t,this.localName=t,this.namespaceURI=null,this.nodeValue=n,this.ownerElement=r,this.nodeType=B}function ct(t,e,n){this.variableResolver=null!=t?t:new lt,this.namespaceResolver=null!=e?e:new ht,this.functionResolver=null!=n?n:new ut}function lt(){}function ut(t){this.thisArg=null!=t?t:dt,this.functions=new Object,this.addStandardFunctions()}function ht(){}et.equals=function(t,e){return t.equals(e)},et.notequal=function(t,e){return t.notequal(e)},et.lessthan=function(t,e){return t.lessthan(e)},et.greaterthan=function(t,e){return t.greaterthan(e)},et.lessthanorequal=function(t,e){return t.lessthanorequal(e)},et.greaterthanorequal=function(t,e){return t.greaterthanorequal(e)},nt.prototype=new b,nt.prototype.constructor=nt,nt.superclass=b.prototype,nt.prototype.init=function(t){this.str=String(t)},nt.prototype.toString=function(){return this.str},nt.prototype.evaluate=function(t){return this},nt.prototype.string=function(){return this},nt.prototype.number=function(){return new rt(this.str)},nt.prototype.bool=function(){return new it(this.str)},nt.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},nt.prototype.stringValue=function(){return this.str},nt.prototype.numberValue=function(){return this.number().numberValue()},nt.prototype.booleanValue=function(){return this.bool().booleanValue()},nt.prototype.equals=function(t){return pt.instance_of(t,it)?this.bool().equals(t):pt.instance_of(t,rt)?this.number().equals(t):pt.instance_of(t,st)?t.compareWithString(this,et.equals):new it(this.str==t.str)},nt.prototype.notequal=function(t){return pt.instance_of(t,it)?this.bool().notequal(t):pt.instance_of(t,rt)?this.number().notequal(t):pt.instance_of(t,st)?t.compareWithString(this,et.notequal):new it(this.str!=t.str)},nt.prototype.lessthan=function(t){return this.number().lessthan(t)},nt.prototype.greaterthan=function(t){return this.number().greaterthan(t)},nt.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},nt.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},rt.prototype=new b,rt.prototype.constructor=rt,rt.superclass=b.prototype,rt.prototype.init=function(t){this.num="string"==typeof t?this.parse(t):Number(t)},rt.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,rt.prototype.parse=function(t){return this.numberFormat.test(t)?parseFloat(t):Number.NaN},rt.prototype.toString=function(){var t=this.num.toString();return-1!==t.indexOf("e-")?function(t){for(var e=t.split("e-"),n=e[0].replace(".",""),r=Number(e[1]),i=0;i<r-1;i+=1)n="0"+n;return"0."+n}(t):-1!==t.indexOf("e")?function(t){for(var e=t.split("e"),n=e[0].replace(".",""),r=Number(e[1])+1-n.length,i=0;i<r;i+=1)n+="0";return n}(t):t},rt.prototype.evaluate=function(t){return this},rt.prototype.string=function(){return new nt(this.toString())},rt.prototype.number=function(){return this},rt.prototype.bool=function(){return new it(this.num)},rt.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},rt.prototype.stringValue=function(){return this.string().stringValue()},rt.prototype.numberValue=function(){return this.num},rt.prototype.booleanValue=function(){return this.bool().booleanValue()},rt.prototype.negate=function(){return new rt(-this.num)},rt.prototype.equals=function(t){return pt.instance_of(t,it)?this.bool().equals(t):pt.instance_of(t,nt)?this.equals(t.number()):pt.instance_of(t,st)?t.compareWithNumber(this,et.equals):new it(this.num==t.num)},rt.prototype.notequal=function(t){return pt.instance_of(t,it)?this.bool().notequal(t):pt.instance_of(t,nt)?this.notequal(t.number()):pt.instance_of(t,st)?t.compareWithNumber(this,et.notequal):new it(this.num!=t.num)},rt.prototype.lessthan=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.greaterthan):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.lessthan(t.number()):new it(this.num<t.num)},rt.prototype.greaterthan=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.lessthan):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.greaterthan(t.number()):new it(this.num>t.num)},rt.prototype.lessthanorequal=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.greaterthanorequal):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.lessthanorequal(t.number()):new it(this.num<=t.num)},rt.prototype.greaterthanorequal=function(t){return pt.instance_of(t,st)?t.compareWithNumber(this,et.lessthanorequal):pt.instance_of(t,it)||pt.instance_of(t,nt)?this.greaterthanorequal(t.number()):new it(this.num>=t.num)},rt.prototype.plus=function(t){return new rt(this.num+t.num)},rt.prototype.minus=function(t){return new rt(this.num-t.num)},rt.prototype.multiply=function(t){return new rt(this.num*t.num)},rt.prototype.div=function(t){return new rt(this.num/t.num)},rt.prototype.mod=function(t){return new rt(this.num%t.num)},it.prototype=new b,it.prototype.constructor=it,it.superclass=b.prototype,it.prototype.init=function(t){this.b=Boolean(t)},it.prototype.toString=function(){return this.b.toString()},it.prototype.evaluate=function(t){return this},it.prototype.string=function(){return new nt(this.b)},it.prototype.number=function(){return new rt(this.b)},it.prototype.bool=function(){return this},it.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},it.prototype.stringValue=function(){return this.string().stringValue()},it.prototype.numberValue=function(){return this.number().numberValue()},it.prototype.booleanValue=function(){return this.b},it.prototype.not=function(){return new it(!this.b)},it.prototype.equals=function(t){return pt.instance_of(t,nt)||pt.instance_of(t,rt)?this.equals(t.bool()):pt.instance_of(t,st)?t.compareWithBoolean(this,et.equals):new it(this.b==t.b)},it.prototype.notequal=function(t){return pt.instance_of(t,nt)||pt.instance_of(t,rt)?this.notequal(t.bool()):pt.instance_of(t,st)?t.compareWithBoolean(this,et.notequal):new it(this.b!=t.b)},it.prototype.lessthan=function(t){return this.number().lessthan(t)},it.prototype.greaterthan=function(t){return this.number().greaterthan(t)},it.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},it.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},it.true_=new it(!0),it.false_=new it(!1),ot.prototype=new Object,ot.prototype.constructor=ot,ot.superclass=Object.prototype,ot.prototype.init=function(t){this.left=null,this.right=null,this.node=t,this.depth=1},ot.prototype.balance=function(){var t=null==this.left?0:this.left.depth,e=null==this.right?0:this.right.depth;if(t>e+1)(null==this.left.left?0:this.left.left.depth)<(null==this.left.right?0:this.left.right.depth)&&this.left.rotateRR(),this.rotateLL();else if(t+1<e){var n=null==this.right.right?0:this.right.right.depth;(null==this.right.left?0:this.right.left.depth)>n&&this.right.rotateLL(),this.rotateRR()}},ot.prototype.rotateLL=function(){var t=this.node,e=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=e,this.right.node=t,this.right.updateInNewLocation(),this.updateInNewLocation()},ot.prototype.rotateRR=function(){var t=this.node,e=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=e,this.left.node=t,this.left.updateInNewLocation(),this.updateInNewLocation()},ot.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},ot.prototype.getDepthFromChildren=function(){this.depth=null==this.node?0:1,null!=this.left&&(this.depth=this.left.depth+1),null!=this.right&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)},ot.prototype.add=function(t){if(t===this.node)return!1;var e=function(t,e){if(t===e)return 0;if(t.compareDocumentPosition){var n=t.compareDocumentPosition(e);return 1&n||10&n?1:20&n?-1:0}for(var r=0,i=0,o=t;null!=o;o=o.parentNode||o.ownerElement)r++;for(var s=e;null!=s;s=s.parentNode||s.ownerElement)i++;if(r>i){for(;r>i;)t=t.parentNode||t.ownerElement,r--;if(t===e)return 1}else if(i>r){for(;i>r;)e=e.parentNode||e.ownerElement,i--;if(t===e)return-1}for(var a=t.parentNode||t.ownerElement,c=e.parentNode||e.ownerElement;a!==c;)e=c,a=(t=a).parentNode||t.ownerElement,c=e.parentNode||e.ownerElement;var l=ft(t),u=ft(e);if(l&&!u)return-1;if(!l&&u)return 1;if(t.isXPathNamespace){if(t.nodeValue===C.XML_NAMESPACE_URI)return-1;if(!e.isXPathNamespace)return-1;if(e.nodeValue===C.XML_NAMESPACE_URI)return 1}else if(e.isXPathNamespace)return 1;if(a)for(var h=l?a.attributes:a.childNodes,d=h.length,p=t.baseNode||t,f=e.baseNode||e,g=0;g<d;g+=1){var A=h[g];if(A===p)return-1;if(A===f)return 1}throw new Error("Unexpected: could not determine node order")}(t,this.node),n=!1;return-1==e?null==this.left?(this.left=new ot(t),n=!0):(n=this.left.add(t))&&this.balance():1==e&&(null==this.right?(this.right=new ot(t),n=!0):(n=this.right.add(t))&&this.balance()),n&&this.getDepthFromChildren(),n},st.prototype=new b,st.prototype.constructor=st,st.superclass=b.prototype,st.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},st.prototype.toString=function(){var t=this.first();return null==t?"":this.stringForNode(t)},st.prototype.evaluate=function(t){return this},st.prototype.string=function(){return new nt(this.toString())},st.prototype.stringValue=function(){return this.toString()},st.prototype.number=function(){return new rt(this.string())},st.prototype.numberValue=function(){return Number(this.string())},st.prototype.bool=function(){return new it(this.booleanValue())},st.prototype.booleanValue=function(){return!!this.size},st.prototype.nodeset=function(){return this},st.prototype.stringForNode=function(t){return t.nodeType==m||t.nodeType==d||t.nodeType===y?this.stringForContainerNode(t):t.nodeType===p?t.value||t.nodeValue:t.isNamespaceNode?t.namespace:t.nodeValue},st.prototype.stringForContainerNode=function(t){for(var e="",n=t.firstChild;null!=n;n=n.nextSibling){var r=n.nodeType;1!==r&&3!==r&&4!==r&&9!==r&&11!==r||(e+=this.stringForNode(n))}return e},st.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new ot(this.nodes[0]);for(var t=1;t<this.nodes.length;t+=1)this.tree.add(this.nodes[t])}return this.tree},st.prototype.first=function(){var t=this.buildTree();if(null==t)return null;for(;null!=t.left;)t=t.left;return t.node},st.prototype.add=function(t){for(var e=0;e<this.nodes.length;e+=1)if(t===this.nodes[e])return;this.tree=null,this.nodes.push(t),this.size+=1},st.prototype.addArray=function(t){var e=this;r(function(t){e.add(t)},t)},st.prototype.toArray=function(){var t=[];return this.toArrayRec(this.buildTree(),t),t},st.prototype.toArrayRec=function(t,e){null!=t&&(this.toArrayRec(t.left,e),e.push(t.node),this.toArrayRec(t.right,e))},st.prototype.toUnsortedArray=function(){return this.nodes.slice()},st.prototype.compareWithString=function(t,e){for(var n=this.toUnsortedArray(),r=0;r<n.length;r++){var i=n[r],o=e(new nt(this.stringForNode(i)),t);if(o.booleanValue())return o}return new it(!1)},st.prototype.compareWithNumber=function(t,e){for(var n=this.toUnsortedArray(),r=0;r<n.length;r++){var i=n[r],o=e(new rt(this.stringForNode(i)),t);if(o.booleanValue())return o}return new it(!1)},st.prototype.compareWithBoolean=function(t,e){return e(this.bool(),t)},st.prototype.compareWithNodeSet=function(t,e){for(var n=this.toUnsortedArray(),r=function(t,n){return e(n,t)},i=0;i<n.length;i++){var o=new nt(this.stringForNode(n[i])),s=t.compareWithString(o,r);if(s.booleanValue())return s}return new it(!1)},st.compareWith=function(t){var e=Array.prototype.slice,n=t.length,r=function(){var i=e.call(arguments);return i.length<n?function(t,n){return function(){return n.apply(this,t.concat(e.call(arguments)))}}(i,r):t.apply(this,e.apply(arguments,[0,n]))};return r}(function(t,e){return pt.instance_of(e,nt)?this.compareWithString(e,t):pt.instance_of(e,rt)?this.compareWithNumber(e,t):pt.instance_of(e,it)?this.compareWithBoolean(e,t):this.compareWithNodeSet(e,t)}),st.prototype.equals=st.compareWith(et.equals),st.prototype.notequal=st.compareWith(et.notequal),st.prototype.lessthan=st.compareWith(et.lessthan),st.prototype.greaterthan=st.compareWith(et.greaterthan),st.prototype.lessthanorequal=st.compareWith(et.lessthanorequal),st.prototype.greaterthanorequal=st.compareWith(et.greaterthanorequal),st.prototype.union=function(t){var e=new st;return e.addArray(this.toUnsortedArray()),e.addArray(t.toUnsortedArray()),e},at.prototype=new Object,at.prototype.constructor=at,at.superclass=Object.prototype,at.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},ct.prototype=new Object,ct.prototype.constructor=ct,ct.superclass=Object.prototype,ct.prototype.extend=function(t){return h(new ct,this,t)},lt.prototype=new Object,lt.prototype.constructor=lt,lt.superclass=Object.prototype,lt.prototype.getVariable=function(t,e){return null},ut.prototype=new Object,ut.prototype.constructor=ut,ut.superclass=Object.prototype,ut.prototype.addStandardFunctions=function(){this.functions["{}last"]=dt.last,this.functions["{}position"]=dt.position,this.functions["{}count"]=dt.count,this.functions["{}id"]=dt.id,this.functions["{}local-name"]=dt.localName,this.functions["{}namespace-uri"]=dt.namespaceURI,this.functions["{}name"]=dt.name,this.functions["{}string"]=dt.string,this.functions["{}concat"]=dt.concat,this.functions["{}starts-with"]=dt.startsWith,this.functions["{}contains"]=dt.contains,this.functions["{}substring-before"]=dt.substringBefore,this.functions["{}substring-after"]=dt.substringAfter,this.functions["{}substring"]=dt.substring,this.functions["{}string-length"]=dt.stringLength,this.functions["{}normalize-space"]=dt.normalizeSpace,this.functions["{}translate"]=dt.translate,this.functions["{}boolean"]=dt.boolean_,this.functions["{}not"]=dt.not,this.functions["{}true"]=dt.true_,this.functions["{}false"]=dt.false_,this.functions["{}lang"]=dt.lang,this.functions["{}number"]=dt.number,this.functions["{}sum"]=dt.sum,this.functions["{}floor"]=dt.floor,this.functions["{}ceiling"]=dt.ceiling,this.functions["{}round"]=dt.round},ut.prototype.addFunction=function(t,e,n){this.functions["{"+t+"}"+e]=n},ut.getFunctionFromContext=function(t,e){var n=pt.resolveQName(t,e.namespaceResolver,e.contextNode,!1);if(null===n[0])throw new Error("Cannot resolve QName "+name);return e.functionResolver.getFunction(n[1],n[0])},ut.prototype.getFunction=function(t,e){return this.functions["{"+e+"}"+t]},ht.prototype=new Object,ht.prototype.constructor=ht,ht.superclass=Object.prototype,ht.prototype.getNamespace=function(t,e){if("xml"==t)return C.XML_NAMESPACE_URI;if("xmlns"==t)return C.XMLNS_NAMESPACE_URI;for(e.nodeType==m?e=e.documentElement:e.nodeType==p?e=j.getOwnerElement(e):e.nodeType!=d&&(e=e.parentNode);null!=e&&e.nodeType==d;){for(var n=e.attributes,r=0;r<n.length;r++){var i=n.item(r),o=i.name||i.nodeName;if("xmlns"===o&&""===t||o==="xmlns:"+t)return String(i.value||i.nodeValue)}e=e.parentNode}return null};var dt=new Object;dt.last=function(t){if(1!=arguments.length)throw new Error("Function last expects ()");return new rt(t.contextSize)},dt.position=function(t){if(1!=arguments.length)throw new Error("Function position expects ()");return new rt(t.contextPosition)},dt.count=function(){var t,e=arguments[0];if(2!=arguments.length||!pt.instance_of(t=arguments[1].evaluate(e),st))throw new Error("Function count expects (node-set)");return new rt(t.size)},dt.id=function(){var t,e=arguments[0];if(2!=arguments.length)throw new Error("Function id expects (object)");t=arguments[1].evaluate(e);for(var n=(t=pt.instance_of(t,st)?t.toArray().join(" "):t.stringValue()).split(/[\x0d\x0a\x09\x20]+/),r=new st,i=e.contextNode.nodeType==m?e.contextNode:e.contextNode.ownerDocument,o=0;o<n.length;o++){var s;null!=(s=i.getElementById?i.getElementById(n[o]):pt.getElementById(i,n[o]))&&r.add(s)}return r},dt.localName=function(t,e){var n;if(1==arguments.length)n=t.contextNode;else{if(2!=arguments.length)throw new Error("Function local-name expects (node-set?)");n=e.evaluate(t).first()}return new nt(null==n?"":n.localName||n.baseName||n.target||n.nodeName||"")},dt.namespaceURI=function(){var t,e=arguments[0];if(1==arguments.length)t=e.contextNode;else{if(2!=arguments.length)throw new Error("Function namespace-uri expects (node-set?)");t=arguments[1].evaluate(e).first()}return new nt(null==t?"":t.namespaceURI||"")},dt.name=function(){var t,e=arguments[0];if(1==arguments.length)t=e.contextNode;else{if(2!=arguments.length)throw new Error("Function name expects (node-set?)");t=arguments[1].evaluate(e).first()}return null==t?new nt(""):t.nodeType==d?new nt(t.nodeName):t.nodeType==p?new nt(t.name||t.nodeName):t.nodeType===A?new nt(t.target||t.nodeName):null==t.localName?new nt(""):new nt(t.localName)},dt.string=function(){var t=arguments[0];if(1==arguments.length)return new nt(st.prototype.stringForNode(t.contextNode));if(2==arguments.length)return arguments[1].evaluate(t).string();throw new Error("Function string expects (object?)")},dt.concat=function(t){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var e="",n=1;n<arguments.length;n++)e+=arguments[n].evaluate(t).stringValue();return new nt(e)},dt.startsWith=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function startsWith expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new it(e.substring(0,n.length)==n)},dt.contains=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function contains expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new it(-1!==e.indexOf(n))},dt.substringBefore=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function substring-before expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();return new nt(e.substring(0,e.indexOf(n)))},dt.substringAfter=function(){var t=arguments[0];if(3!=arguments.length)throw new Error("Function substring-after expects (string, string)");var e=arguments[1].evaluate(t).stringValue(),n=arguments[2].evaluate(t).stringValue();if(0==n.length)return new nt(e);var r=e.indexOf(n);return new nt(-1==r?"":e.substring(r+n.length))},dt.substring=function(){var t=arguments[0];if(3!=arguments.length&&4!=arguments.length)throw new Error("Function substring expects (string, number, number?)");var e=arguments[1].evaluate(t).stringValue(),n=Math.round(arguments[2].evaluate(t).numberValue())-1,r=4==arguments.length?n+Math.round(arguments[3].evaluate(t).numberValue()):void 0;return new nt(e.substring(n,r))},dt.stringLength=function(){var t,e=arguments[0];if(1==arguments.length)t=st.prototype.stringForNode(e.contextNode);else{if(2!=arguments.length)throw new Error("Function string-length expects (string?)");t=arguments[1].evaluate(e).stringValue()}return new rt(t.length)},dt.normalizeSpace=function(){var t,e=arguments[0];if(1==arguments.length)t=st.prototype.stringForNode(e.contextNode);else{if(2!=arguments.length)throw new Error("Function normalize-space expects (string?)");t=arguments[1].evaluate(e).stringValue()}for(var n=0,r=t.length-1;pt.isSpace(t.charCodeAt(r));)r--;for(var i="";n<=r&&pt.isSpace(t.charCodeAt(n));)n++;for(;n<=r;)if(pt.isSpace(t.charCodeAt(n)))for(i+=" ";n<=r&&pt.isSpace(t.charCodeAt(n));)n++;else i+=t.charAt(n),n++;return new nt(i)},dt.translate=function(t,e,n,r){if(4!=arguments.length)throw new Error("Function translate expects (string, string, string)");var s=e.evaluate(t).stringValue(),a=n.evaluate(t).stringValue(),l=r.evaluate(t).stringValue(),u=i(function(t,e,n){return e in t||(t[e]=n>l.length?"":l[n]),t},{},a);return new nt(c("",o(function(t){return t in u?u[t]:t},s)))},dt.boolean_=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(t).bool()},dt.not=function(t,e){if(2!=arguments.length)throw new Error("Function not expects (object)");return e.evaluate(t).bool().not()},dt.true_=function(){if(1!=arguments.length)throw new Error("Function true expects ()");return it.true_},dt.false_=function(){if(1!=arguments.length)throw new Error("Function false expects ()");return it.false_},dt.lang=function(){var t,e=arguments[0];if(2!=arguments.length)throw new Error("Function lang expects (string)");for(var n=e.contextNode;null!=n&&n.nodeType!=m;n=n.parentNode){var r=n.getAttributeNS(C.XML_NAMESPACE_URI,"lang");if(null!=r){t=String(r);break}}if(null==t)return it.false_;var i=arguments[1].evaluate(e).stringValue();return new it(t.substring(0,i.length)==i&&(t.length==i.length||"-"==t.charAt(i.length)))},dt.number=function(){var t=arguments[0];if(1!=arguments.length&&2!=arguments.length)throw new Error("Function number expects (object?)");return 1==arguments.length?new rt(st.prototype.stringForNode(t.contextNode)):arguments[1].evaluate(t).number()},dt.sum=function(){var t,e=arguments[0];if(2!=arguments.length||!pt.instance_of(t=arguments[1].evaluate(e),st))throw new Error("Function sum expects (node-set)");t=t.toUnsortedArray();for(var n=0,r=0;r<t.length;r++)n+=new rt(st.prototype.stringForNode(t[r])).numberValue();return new rt(n)},dt.floor=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function floor expects (number)");return new rt(Math.floor(arguments[1].evaluate(t).numberValue()))},dt.ceiling=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function ceiling expects (number)");return new rt(Math.ceil(arguments[1].evaluate(t).numberValue()))},dt.round=function(){var t=arguments[0];if(2!=arguments.length)throw new Error("Function round expects (number)");return new rt(Math.round(arguments[1].evaluate(t).numberValue()))};var pt=new Object,ft=function(t){return t&&(t.nodeType===p||t.ownerElement||t.isXPathNamespace)};pt.splitQName=function(t){var e=t.indexOf(":");return-1==e?[null,t]:[t.substring(0,e),t.substring(e+1)]},pt.resolveQName=function(t,e,n,r){var i=pt.splitQName(t);return null!=i[0]?i[0]=e.getNamespace(i[0],n):r?(i[0]=e.getNamespace("",n),null==i[0]&&(i[0]="")):i[0]="",i},pt.isSpace=function(t){return 9==t||13==t||10==t||32==t},pt.isLetter=function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=255||t>=256&&t<=305||t>=308&&t<=318||t>=321&&t<=328||t>=330&&t<=382||t>=384&&t<=451||t>=461&&t<=496||t>=500&&t<=501||t>=506&&t<=535||t>=592&&t<=680||t>=699&&t<=705||902==t||t>=904&&t<=906||908==t||t>=910&&t<=929||t>=931&&t<=974||t>=976&&t<=982||986==t||988==t||990==t||992==t||t>=994&&t<=1011||t>=1025&&t<=1036||t>=1038&&t<=1103||t>=1105&&t<=1116||t>=1118&&t<=1153||t>=1168&&t<=1220||t>=1223&&t<=1224||t>=1227&&t<=1228||t>=1232&&t<=1259||t>=1262&&t<=1269||t>=1272&&t<=1273||t>=1329&&t<=1366||1369==t||t>=1377&&t<=1414||t>=1488&&t<=1514||t>=1520&&t<=1522||t>=1569&&t<=1594||t>=1601&&t<=1610||t>=1649&&t<=1719||t>=1722&&t<=1726||t>=1728&&t<=1742||t>=1744&&t<=1747||1749==t||t>=1765&&t<=1766||t>=2309&&t<=2361||2365==t||t>=2392&&t<=2401||t>=2437&&t<=2444||t>=2447&&t<=2448||t>=2451&&t<=2472||t>=2474&&t<=2480||2482==t||t>=2486&&t<=2489||t>=2524&&t<=2525||t>=2527&&t<=2529||t>=2544&&t<=2545||t>=2565&&t<=2570||t>=2575&&t<=2576||t>=2579&&t<=2600||t>=2602&&t<=2608||t>=2610&&t<=2611||t>=2613&&t<=2614||t>=2616&&t<=2617||t>=2649&&t<=2652||2654==t||t>=2674&&t<=2676||t>=2693&&t<=2699||2701==t||t>=2703&&t<=2705||t>=2707&&t<=2728||t>=2730&&t<=2736||t>=2738&&t<=2739||t>=2741&&t<=2745||2749==t||2784==t||t>=2821&&t<=2828||t>=2831&&t<=2832||t>=2835&&t<=2856||t>=2858&&t<=2864||t>=2866&&t<=2867||t>=2870&&t<=2873||2877==t||t>=2908&&t<=2909||t>=2911&&t<=2913||t>=2949&&t<=2954||t>=2958&&t<=2960||t>=2962&&t<=2965||t>=2969&&t<=2970||2972==t||t>=2974&&t<=2975||t>=2979&&t<=2980||t>=2984&&t<=2986||t>=2990&&t<=2997||t>=2999&&t<=3001||t>=3077&&t<=3084||t>=3086&&t<=3088||t>=3090&&t<=3112||t>=3114&&t<=3123||t>=3125&&t<=3129||t>=3168&&t<=3169||t>=3205&&t<=3212||t>=3214&&t<=3216||t>=3218&&t<=3240||t>=3242&&t<=3251||t>=3253&&t<=3257||3294==t||t>=3296&&t<=3297||t>=3333&&t<=3340||t>=3342&&t<=3344||t>=3346&&t<=3368||t>=3370&&t<=3385||t>=3424&&t<=3425||t>=3585&&t<=3630||3632==t||t>=3634&&t<=3635||t>=3648&&t<=3653||t>=3713&&t<=3714||3716==t||t>=3719&&t<=3720||3722==t||3725==t||t>=3732&&t<=3735||t>=3737&&t<=3743||t>=3745&&t<=3747||3749==t||3751==t||t>=3754&&t<=3755||t>=3757&&t<=3758||3760==t||t>=3762&&t<=3763||3773==t||t>=3776&&t<=3780||t>=3904&&t<=3911||t>=3913&&t<=3945||t>=4256&&t<=4293||t>=4304&&t<=4342||4352==t||t>=4354&&t<=4355||t>=4357&&t<=4359||4361==t||t>=4363&&t<=4364||t>=4366&&t<=4370||4412==t||4414==t||4416==t||4428==t||4430==t||4432==t||t>=4436&&t<=4437||4441==t||t>=4447&&t<=4449||4451==t||4453==t||4455==t||4457==t||t>=4461&&t<=4462||t>=4466&&t<=4467||4469==t||4510==t||4520==t||4523==t||t>=4526&&t<=4527||t>=4535&&t<=4536||4538==t||t>=4540&&t<=4546||4587==t||4592==t||4601==t||t>=7680&&t<=7835||t>=7840&&t<=7929||t>=7936&&t<=7957||t>=7960&&t<=7965||t>=7968&&t<=8005||t>=8008&&t<=8013||t>=8016&&t<=8023||8025==t||8027==t||8029==t||t>=8031&&t<=8061||t>=8064&&t<=8116||t>=8118&&t<=8124||8126==t||t>=8130&&t<=8132||t>=8134&&t<=8140||t>=8144&&t<=8147||t>=8150&&t<=8155||t>=8160&&t<=8172||t>=8178&&t<=8180||t>=8182&&t<=8188||8486==t||t>=8490&&t<=8491||8494==t||t>=8576&&t<=8578||t>=12353&&t<=12436||t>=12449&&t<=12538||t>=12549&&t<=12588||t>=44032&&t<=55203||t>=19968&&t<=40869||12295==t||t>=12321&&t<=12329},pt.isNCNameChar=function(t){return t>=48&&t<=57||t>=1632&&t<=1641||t>=1776&&t<=1785||t>=2406&&t<=2415||t>=2534&&t<=2543||t>=2662&&t<=2671||t>=2790&&t<=2799||t>=2918&&t<=2927||t>=3047&&t<=3055||t>=3174&&t<=3183||t>=3302&&t<=3311||t>=3430&&t<=3439||t>=3664&&t<=3673||t>=3792&&t<=3801||t>=3872&&t<=3881||46==t||45==t||95==t||pt.isLetter(t)||t>=768&&t<=837||t>=864&&t<=865||t>=1155&&t<=1158||t>=1425&&t<=1441||t>=1443&&t<=1465||t>=1467&&t<=1469||1471==t||t>=1473&&t<=1474||1476==t||t>=1611&&t<=1618||1648==t||t>=1750&&t<=1756||t>=1757&&t<=1759||t>=1760&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t>=2305&&t<=2307||2364==t||t>=2366&&t<=2380||2381==t||t>=2385&&t<=2388||t>=2402&&t<=2403||t>=2433&&t<=2435||2492==t||2494==t||2495==t||t>=2496&&t<=2500||t>=2503&&t<=2504||t>=2507&&t<=2509||2519==t||t>=2530&&t<=2531||2562==t||2620==t||2622==t||2623==t||t>=2624&&t<=2626||t>=2631&&t<=2632||t>=2635&&t<=2637||t>=2672&&t<=2673||t>=2689&&t<=2691||2748==t||t>=2750&&t<=2757||t>=2759&&t<=2761||t>=2763&&t<=2765||t>=2817&&t<=2819||2876==t||t>=2878&&t<=2883||t>=2887&&t<=2888||t>=2891&&t<=2893||t>=2902&&t<=2903||t>=2946&&t<=2947||t>=3006&&t<=3010||t>=3014&&t<=3016||t>=3018&&t<=3021||3031==t||t>=3073&&t<=3075||t>=3134&&t<=3140||t>=3142&&t<=3144||t>=3146&&t<=3149||t>=3157&&t<=3158||t>=3202&&t<=3203||t>=3262&&t<=3268||t>=3270&&t<=3272||t>=3274&&t<=3277||t>=3285&&t<=3286||t>=3330&&t<=3331||t>=3390&&t<=3395||t>=3398&&t<=3400||t>=3402&&t<=3405||3415==t||3633==t||t>=3636&&t<=3642||t>=3655&&t<=3662||3761==t||t>=3764&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=3864&&t<=3865||3893==t||3895==t||3897==t||3902==t||3903==t||t>=3953&&t<=3972||t>=3974&&t<=3979||t>=3984&&t<=3989||3991==t||t>=3993&&t<=4013||t>=4017&&t<=4023||4025==t||t>=8400&&t<=8412||8417==t||t>=12330&&t<=12335||12441==t||12442==t||183==t||720==t||721==t||903==t||1600==t||3654==t||3782==t||12293==t||t>=12337&&t<=12341||t>=12445&&t<=12446||t>=12540&&t<=12542},pt.coalesceText=function(t){for(var e=t.firstChild;null!=e;e=e.nextSibling)if(e.nodeType==f||e.nodeType==g){var n=e.nodeValue,r=e;for(e=e.nextSibling;null!=e&&(e.nodeType==f||e.nodeType==g);){n+=e.nodeValue;var i=e;e=e.nextSibling,i.parentNode.removeChild(i)}if(r.nodeType==g){var o=r.parentNode;if(null==r.nextSibling)o.removeChild(r),o.appendChild(o.ownerDocument.createTextNode(n));else{var s=r.nextSibling;o.removeChild(r),o.insertBefore(o.ownerDocument.createTextNode(n),s)}}else r.nodeValue=n;if(null==e)break}else e.nodeType==d&&pt.coalesceText(e)},pt.instance_of=function(t,e){for(;null!=t;){if(t.constructor===e)return!0;if(t===Object)return!1;t=t.constructor.superclass}return!1},pt.getElementById=function(t,e){if(t.nodeType==d&&(t.getAttribute("id")==e||t.getAttributeNS(null,"id")==e))return t;for(var n=t.firstChild;null!=n;n=n.nextSibling){var r=pt.getElementById(n,e);if(null!=r)return r}return null};var gt=function(){function t(e,n,r){var i=Error.call(this,function(e,n){var r=n?": "+n.toString():"";switch(e){case t.INVALID_EXPRESSION_ERR:return"Invalid expression"+r;case t.TYPE_ERR:return"Type error"+r}return null}(e,n)||r);return i.code=e,i.exception=n,i}return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t.superclass=Error,t.prototype.toString=function(){return this.message},t.fromMessage=function(e,n){return new t(null,n,e)},t.INVALID_EXPRESSION_ERR=51,t.TYPE_ERR=52,t}();function At(t,e,n){this.xpath=n.parse(t),this.context=new ct,this.context.namespaceResolver=new Et(e)}function Et(t){this.xpathNSResolver=t}function mt(t){this.node=t,this.namespaceResolver=new ht}function wt(t,e){switch(e==wt.ANY_TYPE&&(t.constructor===nt?e=wt.STRING_TYPE:t.constructor===rt?e=wt.NUMBER_TYPE:t.constructor===it?e=wt.BOOLEAN_TYPE:t.constructor===st&&(e=wt.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=e,e){case wt.NUMBER_TYPE:return void(this.numberValue=t.numberValue());case wt.STRING_TYPE:return void(this.stringValue=t.stringValue());case wt.BOOLEAN_TYPE:return void(this.booleanValue=t.booleanValue());case wt.ANY_UNORDERED_NODE_TYPE:case wt.FIRST_ORDERED_NODE_TYPE:if(t.constructor===st)return void(this.singleNodeValue=t.first());break;case wt.UNORDERED_NODE_ITERATOR_TYPE:case wt.ORDERED_NODE_ITERATOR_TYPE:if(t.constructor===st)return this.invalidIteratorState=!1,this.nodes=t.toArray(),void(this.iteratorIndex=0);break;case wt.UNORDERED_NODE_SNAPSHOT_TYPE:case wt.ORDERED_NODE_SNAPSHOT_TYPE:if(t.constructor===st)return this.nodes=t.toArray(),void(this.snapshotLength=this.nodes.length)}throw new gt(gt.TYPE_ERR)}function yt(t,e){t.createExpression=function(t,n){try{return new At(t,n,e)}catch(t){throw new gt(gt.INVALID_EXPRESSION_ERR,t)}},t.createNSResolver=function(t){return new mt(t)},t.evaluate=function(n,r,i,o,s){if(o<0||o>9)throw{code:0,toString:function(){return"Request type not supported"}};return t.createExpression(n,i,e).evaluate(r,o,s)}}At.prototype={},At.prototype.constructor=At,At.superclass=Object.prototype,At.getOwnerDocument=function(t){return t.nodeType===m?t:t.ownerDocument},At.detectHtmlDom=function(t){if(!t)return!1;var e=At.getOwnerDocument(t);try{return e.implementation.hasFeature("HTML","2.0")}catch(t){return!0}},At.prototype.evaluate=function(t,e,n){return this.context.expressionContextNode=t,this.context.caseInsensitive=At.detectHtmlDom(t),new wt(this.xpath.evaluate(this.context),e)},Et.prototype={},Et.prototype.constructor=Et,Et.superclass=Object.prototype,Et.prototype.getNamespace=function(t,e){return null==this.xpathNSResolver?null:this.xpathNSResolver.lookupNamespaceURI(t)},mt.prototype={},mt.prototype.constructor=mt,mt.superclass=Object.prototype,mt.prototype.lookupNamespaceURI=function(t){return this.namespaceResolver.getNamespace(t,this.node)},wt.prototype={},wt.prototype.constructor=wt,wt.superclass=Object.prototype,wt.prototype.iterateNext=function(){if(this.resultType!=wt.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=wt.ORDERED_NODE_ITERATOR_TYPE)throw new gt(gt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},wt.prototype.snapshotItem=function(t){if(this.resultType!=wt.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=wt.ORDERED_NODE_SNAPSHOT_TYPE)throw new gt(gt.TYPE_ERR);return this.nodes[t]},wt.ANY_TYPE=0,wt.NUMBER_TYPE=1,wt.STRING_TYPE=2,wt.BOOLEAN_TYPE=3,wt.UNORDERED_NODE_ITERATOR_TYPE=4,wt.ORDERED_NODE_ITERATOR_TYPE=5,wt.UNORDERED_NODE_SNAPSHOT_TYPE=6,wt.ORDERED_NODE_SNAPSHOT_TYPE=7,wt.ANY_UNORDERED_NODE_TYPE=8,wt.FIRST_ORDERED_NODE_TYPE=9;try{var Bt=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(Bt=!1)}catch(t){}Bt&&yt(document,new I)}catch(t){}yt(t,new I),function(){var e=new I,n=new ht,r=new ut,i=new lt;function o(t){return{getNamespace:function(e,r){return t(e,r)||n.getNamespace(e,r)}}}function s(t){return t&&"function"==typeof t.getNamespace?o((e=t).getNamespace.bind(e)):"function"==typeof t?o(t):"object"==typeof t?function(t){return o(function(e){return t[e]})}(t):n;var e}function a(t){if(null==t||t instanceof nt||t instanceof it||t instanceof rt||t instanceof st)return t;switch(typeof t){case"string":return new nt(t);case"boolean":return new it(t);case"number":return new rt(t)}var e=new st;return e.addArray([].concat(t)),e}function c(t){return{getFunction:function(e,n){var i=t(e,n);return i?function(t){return function(e){var n=Array.prototype.slice.call(arguments,1).map(function(t){return t.evaluate(e)});return a(t.apply(this,[].concat(e,n)))}}(i):r.getFunction(e,n)}}}function l(t){return t&&"function"==typeof t.getFunction?c((e=t).getFunction.bind(e)):"function"==typeof t?c(t):"object"==typeof t?function(t){return c(function(e){return t[e]})}(t):r;var e}function u(t){return{getVariable:function(e,n){return a(t(e,n))}}}function h(t,e,n){t in n&&(e[t]=n[t])}function d(t){var e=new ct;return t?(e.namespaceResolver=s(t.namespaces),e.functionResolver=l(t.functions),e.variableResolver=function(t){if(t){if("function"==typeof t.getVariable)return u(t.getVariable.bind(t));if("function"==typeof t)return u(t);if("object"==typeof t)return u(function(e){return t[e]})}return i}(t.variables),e.expressionContextNode=t.node,h("allowAnyNamespaceForNoPrefix",e,t),h("isHtml",e,t)):e.namespaceResolver=n,e}var p={evaluate:function(t){return function(t,e){var n=d(e);return t.evaluate(n)}(this.expression,t)},evaluateNumber:function(t){return this.evaluate(t).numberValue()},evaluateString:function(t){return this.evaluate(t).stringValue()},evaluateBoolean:function(t){return this.evaluate(t).booleanValue()},evaluateNodeSet:function(t){return this.evaluate(t).nodeset()},select:function(t){return this.evaluateNodeSet(t).toArray()},select1:function(t){return this.select(t)[0]}};t.parse=function(t){var n=e.parse(t);return Object.create(p,{expression:{value:n}})}}(),h(t,{XPath:C,XPathParser:I,XPathResult:wt,Step:K,PathExpr:j,NodeTest:X,LocationPath:q,OrOperation:N,AndOperation:S,BarOperation:V,EqualsOperation:_,NotEqualOperation:L,LessThanOperation:x,GreaterThanOperation:R,LessThanOrEqualOperation:F,GreaterThanOrEqualOperation:k,PlusOperation:O,MinusOperation:Q,MultiplyOperation:U,DivOperation:P,ModOperation:G,UnaryMinusOperation:v,FunctionCall:tt,VariableReference:$,XPathContext:ct,XNodeSet:st,XBoolean:it,XString:nt,XNumber:rt,NamespaceResolver:ht,FunctionResolver:ut,VariableResolver:lt,Utilities:pt}),t.select=function(e,n,r){return t.selectWithResolver(e,n,null,r)},t.useNamespaces=function(e){var n={mappings:e||{},lookupNamespaceURI:function(t){return this.mappings[t]}};return function(e,r,i){return t.selectWithResolver(e,r,n,i)}},t.selectWithResolver=function(t,e,n,r){var i=new At(t,n,new I),o=wt.ANY_TYPE,s=i.evaluate(e,o,null);return s.resultType==wt.STRING_TYPE?s=s.stringValue:s.resultType==wt.NUMBER_TYPE?s=s.numberValue:s.resultType==wt.BOOLEAN_TYPE?s=s.booleanValue:(s=s.nodes,r&&(s=s[0])),s},t.select1=function(e,n){return t.select(e,n,!0)};var It=function(t){return function(e){return n(e)&&e.nodeType===t}};h(t,{isNodeLike:n,isArrayOfNodes:function(t){return Array.isArray(t)&&t.every(n)},isElement:It(d),isAttribute:It(p),isTextNode:It(f),isCDATASection:It(g),isProcessingInstruction:It(A),isComment:It(E),isDocumentNode:It(m),isDocumentTypeNode:It(w),isDocumentFragment:It(y)})}(e)},2447(){},7790(){},4874(t,e,n){"use strict";const r=n(793);t.exports=h;const i=function(){function t(t){return void 0!==t&&t}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(e){return t(self)||t(window)||t(this)||{}}}().console||{},o={mapHttpRequest:E,mapHttpResponse:E,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:E,res:E,err:g,errWithCause:g};function s(t,e){return"silent"===t?1/0:e.levels.values[t]}const a=Symbol("pino.logFuncs"),c=Symbol("pino.hierarchy"),l={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function u(t,e){const n={logger:e,parent:t[c]};e[c]=n}function h(t){(t=t||{}).browser=t.browser||{};const e=t.browser.transmit;if(e&&"function"!=typeof e.send)throw Error("pino: transmit option must have a send function");const n=t.browser.write||i;t.browser.write&&(t.browser.asObject=!0);const r=t.serializers||{},o=function(t,e){if(Array.isArray(t))return t.filter(function(t){return"!stdSerializers.err"!==t});return!0===t&&Object.keys(e)}(t.browser.serialize,r);let c=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(c=!1);const g=Object.keys(t.customLevels||{}),E=["error","fatal","warn","info","debug","trace"].concat(g);"function"==typeof n&&E.forEach(function(t){n[t]=n}),(!1===t.enabled||t.browser.disabled)&&(t.level="silent");const m=t.level||"info",y=Object.create(n);y.log||(y.log=w),function(t,e,n){const r={};e.forEach(t=>{r[t]=n[t]?n[t]:i[t]||i[l[t]||"log"]||w}),t[a]=r}(y,E,n),u({},y),Object.defineProperty(y,"levelVal",{get:function(){return s(this.level,this)}}),Object.defineProperty(y,"level",{get:function(){return this._level},set:function(t){if("silent"!==t&&!this.levels.values[t])throw Error("unknown level "+t);this._level=t,d(this,B,y,"error"),d(this,B,y,"fatal"),d(this,B,y,"warn"),d(this,B,y,"info"),d(this,B,y,"debug"),d(this,B,y,"trace"),g.forEach(t=>{d(this,B,y,t)})}});const B={transmit:e,serialize:o,asObject:t.browser.asObject,asObjectBindingsOnly:t.browser.asObjectBindingsOnly,formatters:t.browser.formatters,levels:E,timestamp:A(t),messageKey:t.messageKey||"msg",onChild:t.onChild||w};function I(n,i,s){if(!i)throw new Error("missing bindings for child Pino");s=s||{},o&&i.serializers&&(s.serializers=i.serializers);const a=s.serializers;if(o&&a){var c=Object.assign({},r,a),l=!0===t.browser.serialize?Object.keys(c):o;delete i.serializers,p([i],l,c,this._stdErrSerialize)}function h(t){this._childLevel=1+(0|t._childLevel),this.bindings=i,c&&(this.serializers=c,this._serialize=l),e&&(this._logEvent=f([].concat(t._logEvent.bindings,i)))}h.prototype=this;const d=new h(this);return u(this,d),d.child=function(...t){return I.call(this,n,...t)},d.level=s.level||this.level,n.onChild(d),d}return y.levels=function(t){const e=t.customLevels||{},n=Object.assign({},h.levels.values,e),r=Object.assign({},h.levels.labels,function(t){const e={};return Object.keys(t).forEach(function(n){e[t[n]]=n}),e}(e));return{values:n,labels:r}}(t),y.level=m,y.isLevelEnabled=function(t){return!!this.levels.values[t]&&this.levels.values[t]>=this.levels.values[this.level]},y.setMaxListeners=y.getMaxListeners=y.emit=y.addListener=y.on=y.prependListener=y.once=y.prependOnceListener=y.removeListener=y.removeAllListeners=y.listeners=y.listenerCount=y.eventNames=y.write=y.flush=w,y.serializers=r,y._serialize=o,y._stdErrSerialize=c,y.child=function(...t){return I.call(this,B,...t)},e&&(y._logEvent=f()),y}function d(t,e,n,o){if(Object.defineProperty(t,o,{value:s(t.level,n)>s(o,n)?w:n[a][o],writable:!0,enumerable:!0,configurable:!0}),t[o]===w){if(!e.transmit)return;const r=s(e.transmit.level||t.level,n);if(s(o,n)<r)return}t[o]=function(t,e,n,o){return c=t[a][o],function(){const a=e.timestamp(),l=new Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var h=0;h<l.length;h++)l[h]=arguments[h];var d=!1;if(e.serialize&&(p(l,this._serialize,this.serializers,this._stdErrSerialize),d=!0),e.asObject||e.formatters?c.call(u,...function(t,e,n,i,o){const{level:s,log:a=t=>t}=o.formatters||{},c=n.slice();let l=c[0];const u={};let h=1+(0|t._childLevel);if(h<1&&(h=1),i&&(u.time=i),s){const n=s(e,t.levels.values[e]);Object.assign(u,n)}else u.level=t.levels.values[e];if(o.asObjectBindingsOnly){if(null!==l&&"object"==typeof l)for(;h--&&"object"==typeof c[0];)Object.assign(u,c.shift());return[a(u),...c]}if(null!==l&&"object"==typeof l){for(;h--&&"object"==typeof c[0];)Object.assign(u,c.shift());l=c.length?r(c.shift(),c):void 0}else"string"==typeof l&&(l=r(c.shift(),c));return void 0!==l&&(u[o.messageKey]=l),[a(u)]}(this,o,l,a,e)):c.apply(u,l),e.transmit){const r=e.transmit.level||t._level,i=s(r,n),c=s(o,n);if(c<i)return;!function(t,e,n,r=!1){const i=e.send,o=e.ts,s=e.methodLevel,a=e.methodValue,c=e.val,l=t._logEvent.bindings;r||p(n,t._serialize||Object.keys(t.serializers),t.serializers,void 0===t._stdErrSerialize||t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(t){return-1===l.indexOf(t)}),t._logEvent.level.label=s,t._logEvent.level.value=a,i(s,t._logEvent,c),t._logEvent=f(l)}(this,{ts:a,methodLevel:o,methodValue:c,transmitLevel:r,transmitValue:n.levels.values[e.transmit.level||t._level],send:e.transmit.send,val:s(t._level,n)},l,d)}};var c}(t,e,n,o);const l=function(t){const e=[];t.bindings&&e.push(t.bindings);let n=t[c];for(;n.parent;)n=n.parent,n.logger.bindings&&e.push(n.logger.bindings);return e.reverse()}(t);0!==l.length&&(t[o]=function(t,e){return function(){return e.apply(this,[...t,...arguments])}}(l,t[o]))}function p(t,e,n,r){for(const i in t)if(r&&t[i]instanceof Error)t[i]=h.stdSerializers.err(t[i]);else if("object"==typeof t[i]&&!Array.isArray(t[i])&&e)for(const r in t[i])e.indexOf(r)>-1&&r in n&&(t[i][r]=n[r](t[i][r]))}function f(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function g(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)void 0===e[n]&&(e[n]=t[n]);return e}function A(t){return"function"==typeof t.timestamp?t.timestamp:!1===t.timestamp?y:B}function E(){return{}}function m(t){return t}function w(){}function y(){return!1}function B(){return Date.now()}h.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},h.stdSerializers=o,h.stdTimeFunctions=Object.assign({},{nullTime:y,epochTime:B,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),t.exports.default=h,t.exports.pino=h},8630(t,e,n){
|
|
20
20
|
/*! *****************************************************************************
|
|
21
21
|
Copyright (C) Microsoft. All rights reserved.
|
|
22
22
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -110,5 +110,5 @@ const su="crypto.algorithm";const au="crypto.algorithmProvider";var cu;nl.regist
|
|
|
110
110
|
function Jd(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function Wd(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function qd(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Kd(t,...e){if(!Jd(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 Zd(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 Xd(t,e){Kd(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function $d(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function tp(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function ep(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}const np=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function rp(t){if("string"==typeof t)t=function(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}(t);else{if(!Jd(t))throw new Error("Uint8Array expected, got "+typeof t);t=dp(t)}return t}function ip(t,e){return t.buffer===e.buffer&&t.byteOffset<e.byteOffset+e.byteLength&&e.byteOffset<t.byteOffset+t.byteLength}function op(t,e){if(ip(t,e)&&t.byteOffset<e.byteOffset)throw new Error("complex overlap of input and output is not supported")}function sp(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n}const ap=(t,e)=>{function n(n,...r){if(Kd(n),!np)throw new Error("Non little-endian hardware is not yet supported");if(void 0!==t.nonceLength){const e=r[0];if(!e)throw new Error("nonce / iv required");t.varSizeNonce?Kd(e):Kd(e,t.nonceLength)}const i=t.tagLength;i&&void 0!==r[1]&&Kd(r[1]);const o=e(n,...r),s=(t,e)=>{if(void 0!==e){if(2!==t)throw new Error("cipher output not supported");Kd(e)}};let a=!1;const c={encrypt(t,e){if(a)throw new Error("cannot encrypt() twice with same key + nonce");return a=!0,Kd(t),s(o.encrypt.length,e),o.encrypt(t,e)},decrypt(t,e){if(Kd(t),i&&t.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return s(o.decrypt.length,e),o.decrypt(t,e)}};return c}return Object.assign(n,t),n};function cp(t,e,n=!0){if(void 0===e)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(n&&!hp(e))throw new Error("invalid output, must be aligned");return e}function lp(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;t.setUint32(e+c,s,r),t.setUint32(e+l,a,r)}function up(t,e,n){Wd(n);const r=new Uint8Array(16),i=ep(r);return lp(i,0,BigInt(e),n),lp(i,8,BigInt(t),n),r}function hp(t){return t.byteOffset%4==0}function dp(t){return Uint8Array.from(t)}const pp=16,fp=new Uint8Array(16),gp=$d(fp),Ap=(t,e,n,r)=>({s3:n<<31|r>>>1,s2:e<<31|n>>>1,s1:t<<31|e>>>1,s0:t>>>1^225<<24&-(1&(1&r))}),Ep=t=>(t>>>0&255)<<24|(t>>>8&255)<<16|(t>>>16&255)<<8|t>>>24&255;class mp{constructor(t,e){this.blockLen=pp,this.outputLen=pp,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,Kd(t=rp(t),16);const n=ep(t);let r=n.getUint32(0,!1),i=n.getUint32(4,!1),o=n.getUint32(8,!1),s=n.getUint32(12,!1);const a=[];for(let t=0;t<128;t++)a.push({s0:Ep(r),s1:Ep(i),s2:Ep(o),s3:Ep(s)}),({s0:r,s1:i,s2:o,s3:s}=Ap(r,i,o,s));const c=(t=>t>65536?8:t>1024?4:2)(e||1024);if(![1,2,4,8].includes(c))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=c;const l=128/c,u=this.windowSize=2**c,h=[];for(let t=0;t<l;t++)for(let e=0;e<u;e++){let n=0,r=0,i=0,o=0;for(let s=0;s<c;s++){if(!(e>>>c-s-1&1))continue;const{s0:l,s1:u,s2:h,s3:d}=a[c*t+s];n^=l,r^=u,i^=h,o^=d}h.push({s0:n,s1:r,s2:i,s3:o})}this.t=h}_updateBlock(t,e,n,r){t^=this.s0,e^=this.s1,n^=this.s2,r^=this.s3;const{W:i,t:o,windowSize:s}=this;let a=0,c=0,l=0,u=0;const h=(1<<i)-1;let d=0;for(const p of[t,e,n,r])for(let t=0;t<4;t++){const e=p>>>8*t&255;for(let t=8/i-1;t>=0;t--){const n=e>>>i*t&h,{s0:r,s1:p,s2:f,s3:g}=o[d*s+n];a^=r,c^=p,l^=f,u^=g,d+=1}}this.s0=a,this.s1=c,this.s2=l,this.s3=u}update(t){Zd(this),Kd(t=rp(t));const e=$d(t),n=Math.floor(t.length/pp),r=t.length%pp;for(let t=0;t<n;t++)this._updateBlock(e[4*t+0],e[4*t+1],e[4*t+2],e[4*t+3]);return r&&(fp.set(t.subarray(n*pp)),this._updateBlock(gp[0],gp[1],gp[2],gp[3]),tp(gp)),this}destroy(){const{t}=this;for(const e of t)e.s0=0,e.s1=0,e.s2=0,e.s3=0}digestInto(t){Zd(this),Xd(t,this),this.finished=!0;const{s0:e,s1:n,s2:r,s3:i}=this,o=$d(t);return o[0]=e,o[1]=n,o[2]=r,o[3]=i,t}digest(){const t=new Uint8Array(pp);return this.digestInto(t),this.destroy(),t}}class wp extends mp{constructor(t,e){Kd(t=rp(t));const n=function(t){t.reverse();const e=1&t[15];let n=0;for(let e=0;e<t.length;e++){const r=t[e];t[e]=r>>>1|n,n=(1&r)<<7}return t[0]^=225&-e,t}(dp(t));super(n,e),tp(n)}update(t){t=rp(t),Zd(this);const e=$d(t),n=t.length%pp,r=Math.floor(t.length/pp);for(let t=0;t<r;t++)this._updateBlock(Ep(e[4*t+3]),Ep(e[4*t+2]),Ep(e[4*t+1]),Ep(e[4*t+0]));return n&&(fp.set(t.subarray(r*pp)),this._updateBlock(Ep(gp[3]),Ep(gp[2]),Ep(gp[1]),Ep(gp[0])),tp(gp)),this}digestInto(t){Zd(this),Xd(t,this),this.finished=!0;const{s0:e,s1:n,s2:r,s3:i}=this,o=$d(t);return o[0]=e,o[1]=n,o[2]=r,o[3]=i,t.reverse()}}function yp(t){const e=(e,n)=>t(n,e.length).update(rp(e)).digest(),n=t(new Uint8Array(16),0);return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=(e,n)=>t(e,n),e}yp((t,e)=>new mp(t,e)),yp((t,e)=>new wp(t,e));const Bp=16;function Ip(t){return t<<1^283&-(t>>7)}function Cp(t,e){let n=0;for(;e>0;e>>=1)n^=t&-(1&e),t=Ip(t);return n}const Tp=(()=>{const t=new Uint8Array(256);for(let e=0,n=1;e<256;e++,n^=Ip(n))t[e]=n;const e=new Uint8Array(256);e[0]=99;for(let n=0;n<255;n++){let r=t[255-n];r|=r<<8,e[t[n]]=255&(r^r>>4^r>>5^r>>6^r>>7^99)}return tp(t),e})(),bp=Tp.map((t,e)=>Tp.indexOf(e)),Dp=t=>t<<24|t>>>8,vp=t=>t<<8|t>>>24;function Mp(t,e){if(256!==t.length)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((n,r)=>e(t[r])),r=n.map(vp),i=r.map(vp),o=i.map(vp),s=new Uint32Array(65536),a=new Uint32Array(65536),c=new Uint16Array(65536);for(let e=0;e<256;e++)for(let l=0;l<256;l++){const u=256*e+l;s[u]=n[e]^r[l],a[u]=i[e]^o[l],c[u]=t[e]<<8|t[l]}return{sbox:t,sbox2:c,T0:n,T1:r,T2:i,T3:o,T01:s,T23:a}}const Np=Mp(Tp,t=>Cp(t,3)<<24|t<<16|t<<8|Cp(t,2)),Sp=Mp(bp,t=>Cp(t,11)<<24|Cp(t,13)<<16|Cp(t,9)<<8|Cp(t,14)),_p=(()=>{const t=new Uint8Array(16);for(let e=0,n=1;e<16;e++,n=Ip(n))t[e]=n;return t})();function Lp(t){Kd(t);const e=t.length;if(![16,24,32].includes(e))throw new Error("aes: invalid key size, should be 16, 24 or 32, got "+e);const{sbox2:n}=Np,r=[];hp(t)||r.push(t=dp(t));const i=$d(t),o=i.length,s=t=>Fp(n,t,t,t,t),a=new Uint32Array(e+28);a.set(i);for(let t=o;t<a.length;t++){let e=a[t-1];t%o===0?e=s(Dp(e))^_p[t/o-1]:o>6&&t%o===4&&(e=s(e)),a[t]=a[t-o]^e}return tp(...r),a}function xp(t){const e=Lp(t),n=e.slice(),r=e.length,{sbox2:i}=Np,{T0:o,T1:s,T2:a,T3:c}=Sp;for(let t=0;t<r;t+=4)for(let i=0;i<4;i++)n[t+i]=e[r-t-4+i];tp(e);for(let t=4;t<r-4;t++){const e=n[t],r=Fp(i,e,e,e,e);n[t]=o[255&r]^s[r>>>8&255]^a[r>>>16&255]^c[r>>>24]}return n}function Rp(t,e,n,r,i,o){return t[n<<8&65280|r>>>8&255]^e[i>>>8&65280|o>>>24&255]}function Fp(t,e,n,r,i){return t[255&e|65280&n]|t[r>>>16&255|i>>>16&65280]<<16}function kp(t,e,n,r,i){const{sbox2:o,T01:s,T23:a}=Np;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let o=0;o<l;o++){const o=t[c++]^Rp(s,a,e,n,r,i),l=t[c++]^Rp(s,a,n,r,i,e),u=t[c++]^Rp(s,a,r,i,e,n),h=t[c++]^Rp(s,a,i,e,n,r);e=o,n=l,r=u,i=h}return{s0:t[c++]^Fp(o,e,n,r,i),s1:t[c++]^Fp(o,n,r,i,e),s2:t[c++]^Fp(o,r,i,e,n),s3:t[c++]^Fp(o,i,e,n,r)}}function Op(t,e,n,r,i){const{sbox2:o,T01:s,T23:a}=Sp;let c=0;e^=t[c++],n^=t[c++],r^=t[c++],i^=t[c++];const l=t.length/4-2;for(let o=0;o<l;o++){const o=t[c++]^Rp(s,a,e,i,r,n),l=t[c++]^Rp(s,a,n,e,i,r),u=t[c++]^Rp(s,a,r,n,e,i),h=t[c++]^Rp(s,a,i,r,n,e);e=o,n=l,r=u,i=h}return{s0:t[c++]^Fp(o,e,i,r,n),s1:t[c++]^Fp(o,n,e,i,r),s2:t[c++]^Fp(o,r,n,e,i),s3:t[c++]^Fp(o,i,r,n,e)}}function Qp(t){if(Kd(t),t.length%Bp!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size 16")}function Up(t,e,n){Kd(t);let r=t.length;const i=r%Bp;if(!e&&0!==i)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");hp(t)||(t=dp(t));const o=$d(t);if(e){let t=Bp-i;t||(t=Bp),r+=t}op(t,n=cp(r,n));return{b:o,o:$d(n),out:n}}function Pp(t,e){if(!e)return t;const n=t.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=t[n-1];if(r<=0||r>16)throw new Error("aes/pcks5: wrong padding");const i=t.subarray(0,-r);for(let e=0;e<r;e++)if(t[n-e-1]!==r)throw new Error("aes/pcks5: wrong padding");return i}function Gp(t){const e=new Uint8Array(16),n=$d(e);e.set(t);const r=Bp-t.length;for(let t=Bp-r;t<Bp;t++)e[t]=r;return n}const Vp=ap({blockSize:16,nonceLength:16},function(t,e,n={}){const r=!n.disablePadding;return{encrypt(n,i){const o=Lp(t),{b:s,o:a,out:c}=Up(n,r,i);let l=e;const u=[o];hp(l)||u.push(l=dp(l));const h=$d(l);let d=h[0],p=h[1],f=h[2],g=h[3],A=0;for(;A+4<=s.length;)d^=s[A+0],p^=s[A+1],f^=s[A+2],g^=s[A+3],({s0:d,s1:p,s2:f,s3:g}=kp(o,d,p,f,g)),a[A++]=d,a[A++]=p,a[A++]=f,a[A++]=g;if(r){const t=Gp(n.subarray(4*A));d^=t[0],p^=t[1],f^=t[2],g^=t[3],({s0:d,s1:p,s2:f,s3:g}=kp(o,d,p,f,g)),a[A++]=d,a[A++]=p,a[A++]=f,a[A++]=g}return tp(...u),c},decrypt(n,i){Qp(n);const o=xp(t);let s=e;const a=[o];hp(s)||a.push(s=dp(s));const c=$d(s);i=cp(n.length,i),hp(n)||a.push(n=dp(n)),op(n,i);const l=$d(n),u=$d(i);let h=c[0],d=c[1],p=c[2],f=c[3];for(let t=0;t+4<=l.length;){const e=h,n=d,r=p,i=f;h=l[t+0],d=l[t+1],p=l[t+2],f=l[t+3];const{s0:s,s1:a,s2:c,s3:g}=Op(o,h,d,p,f);u[t++]=s^e,u[t++]=a^n,u[t++]=c^r,u[t++]=g^i}return tp(...a),Pp(i,r)}}});const jp=t=>Uint8Array.from(t.split("").map(t=>t.charCodeAt(0))),Hp=jp("expand 16-byte k"),Yp=jp("expand 32-byte k"),zp=$d(Hp),Jp=$d(Yp);function Wp(t,e){return t<<e|t>>>32-e}function qp(t){return t.byteOffset%4==0}const Kp=2**32-1,Zp=new Uint32Array;function Xp(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=function(t,e){if(null==e||"object"!=typeof e)throw new Error("options must be defined");return Object.assign(t,e)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if("function"!=typeof t)throw new Error("core must be a function");return qd(i),qd(s),Wd(o),Wd(n),(e,a,c,l,u=0)=>{Kd(e),Kd(a),Kd(c);const h=c.length;if(void 0===l&&(l=new Uint8Array(h)),Kd(l),qd(u),u<0||u>=Kp)throw new Error("arx: counter overflow");if(l.length<h)throw new Error(`arx: output (${l.length}) is shorter than data (${h})`);const d=[];let p,f,g=e.length;if(32===g)d.push(p=dp(e)),f=Jp;else{if(16!==g||!n)throw new Error(`arx: invalid 32-byte key, got length=${g}`);p=new Uint8Array(32),p.set(e),p.set(e,16),f=zp,d.push(p)}qp(a)||d.push(a=dp(a));const A=$d(p);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(f,A,$d(a.subarray(0,16)),A),a=a.subarray(16)}const E=16-i;if(E!==a.length)throw new Error(`arx: nonce must be ${E} or 16 bytes`);if(12!==E){const t=new Uint8Array(12);t.set(a,o?0:12-a.length),a=t,d.push(a)}const m=$d(a);return function(t,e,n,r,i,o,s,a){const c=i.length,l=new Uint8Array(64),u=$d(l),h=qp(i)&&qp(o),d=h?$d(i):Zp,p=h?$d(o):Zp;for(let f=0;f<c;s++){if(t(e,n,r,u,s,a),s>=Kp)throw new Error("arx: counter overflow");const g=Math.min(64,c-f);if(h&&64===g){const t=f/4;if(f%4!=0)throw new Error("arx: invalid block position");for(let e,n=0;n<16;n++)e=t+n,p[e]=d[e]^u[n];f+=64;continue}for(let t,e=0;e<g;e++)t=f+e,o[t]=i[t]^l[e];f+=g}}(t,f,A,m,c,l,u,s),tp(...d),l}}const $p=(t,e)=>255&t[e++]|(255&t[e++])<<8;class tf{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,Kd(t=rp(t),32);const e=$p(t,0),n=$p(t,2),r=$p(t,4),i=$p(t,6),o=$p(t,8),s=$p(t,10),a=$p(t,12),c=$p(t,14);this.r[0]=8191&e,this.r[1]=8191&(e>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127;for(let e=0;e<8;e++)this.pad[e]=$p(t,16+2*e)}process(t,e,n=!1){const r=n?0:2048,{h:i,r:o}=this,s=o[0],a=o[1],c=o[2],l=o[3],u=o[4],h=o[5],d=o[6],p=o[7],f=o[8],g=o[9],A=$p(t,e+0),E=$p(t,e+2),m=$p(t,e+4),w=$p(t,e+6),y=$p(t,e+8),B=$p(t,e+10),I=$p(t,e+12),C=$p(t,e+14);let T=i[0]+(8191&A),b=i[1]+(8191&(A>>>13|E<<3)),D=i[2]+(8191&(E>>>10|m<<6)),v=i[3]+(8191&(m>>>7|w<<9)),M=i[4]+(8191&(w>>>4|y<<12)),N=i[5]+(y>>>1&8191),S=i[6]+(8191&(y>>>14|B<<2)),_=i[7]+(8191&(B>>>11|I<<5)),L=i[8]+(8191&(I>>>8|C<<8)),x=i[9]+(C>>>5|r),R=0,F=R+T*s+b*(5*g)+D*(5*f)+v*(5*p)+M*(5*d);R=F>>>13,F&=8191,F+=N*(5*h)+S*(5*u)+_*(5*l)+L*(5*c)+x*(5*a),R+=F>>>13,F&=8191;let k=R+T*a+b*s+D*(5*g)+v*(5*f)+M*(5*p);R=k>>>13,k&=8191,k+=N*(5*d)+S*(5*h)+_*(5*u)+L*(5*l)+x*(5*c),R+=k>>>13,k&=8191;let O=R+T*c+b*a+D*s+v*(5*g)+M*(5*f);R=O>>>13,O&=8191,O+=N*(5*p)+S*(5*d)+_*(5*h)+L*(5*u)+x*(5*l),R+=O>>>13,O&=8191;let Q=R+T*l+b*c+D*a+v*s+M*(5*g);R=Q>>>13,Q&=8191,Q+=N*(5*f)+S*(5*p)+_*(5*d)+L*(5*h)+x*(5*u),R+=Q>>>13,Q&=8191;let U=R+T*u+b*l+D*c+v*a+M*s;R=U>>>13,U&=8191,U+=N*(5*g)+S*(5*f)+_*(5*p)+L*(5*d)+x*(5*h),R+=U>>>13,U&=8191;let P=R+T*h+b*u+D*l+v*c+M*a;R=P>>>13,P&=8191,P+=N*s+S*(5*g)+_*(5*f)+L*(5*p)+x*(5*d),R+=P>>>13,P&=8191;let G=R+T*d+b*h+D*u+v*l+M*c;R=G>>>13,G&=8191,G+=N*a+S*s+_*(5*g)+L*(5*f)+x*(5*p),R+=G>>>13,G&=8191;let V=R+T*p+b*d+D*h+v*u+M*l;R=V>>>13,V&=8191,V+=N*c+S*a+_*s+L*(5*g)+x*(5*f),R+=V>>>13,V&=8191;let j=R+T*f+b*p+D*d+v*h+M*u;R=j>>>13,j&=8191,j+=N*l+S*c+_*a+L*s+x*(5*g),R+=j>>>13,j&=8191;let H=R+T*g+b*f+D*p+v*d+M*h;R=H>>>13,H&=8191,H+=N*u+S*l+_*c+L*a+x*s,R+=H>>>13,H&=8191,R=(R<<2)+R|0,R=R+F|0,F=8191&R,R>>>=13,k+=R,i[0]=F,i[1]=k,i[2]=O,i[3]=Q,i[4]=U,i[5]=P,i[6]=G,i[7]=V,i[8]=j,i[9]=H}finalize(){const{h:t,pad:e}=this,n=new Uint16Array(10);let r=t[1]>>>13;t[1]&=8191;for(let e=2;e<10;e++)t[e]+=r,r=t[e]>>>13,t[e]&=8191;t[0]+=5*r,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,n[0]=t[0]+5,r=n[0]>>>13,n[0]&=8191;for(let e=1;e<10;e++)n[e]=t[e]+r,r=n[e]>>>13,n[e]&=8191;n[9]-=8192;let i=(1^r)-1;for(let t=0;t<10;t++)n[t]&=i;i=~i;for(let e=0;e<10;e++)t[e]=t[e]&i|n[e];t[0]=65535&(t[0]|t[1]<<13),t[1]=65535&(t[1]>>>3|t[2]<<10),t[2]=65535&(t[2]>>>6|t[3]<<7),t[3]=65535&(t[3]>>>9|t[4]<<4),t[4]=65535&(t[4]>>>12|t[5]<<1|t[6]<<14),t[5]=65535&(t[6]>>>2|t[7]<<11),t[6]=65535&(t[7]>>>5|t[8]<<8),t[7]=65535&(t[8]>>>8|t[9]<<5);let o=t[0]+e[0];t[0]=65535&o;for(let n=1;n<8;n++)o=(t[n]+e[n]|0)+(o>>>16)|0,t[n]=65535&o;tp(n)}update(t){Zd(this),Kd(t=rp(t));const{buffer:e,blockLen:n}=this,r=t.length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);if(o!==n)e.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(t,i)}return this}destroy(){tp(this.h,this.r,this.buffer,this.pad)}digestInto(t){Zd(this),Xd(t,this),this.finished=!0;const{buffer:e,h:n}=this;let{pos:r}=this;if(r){for(e[r++]=1;r<16;r++)e[r]=0;this.process(e,0,!0)}this.finalize();let i=0;for(let e=0;e<8;e++)t[i++]=n[e]>>>0,t[i++]=n[e]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}}const ef=function(t){const e=(e,n)=>t(n).update(rp(e)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}(t=>new tf(t));function nf(t,e,n,r,i,o=20){let s=t[0],a=t[1],c=t[2],l=t[3],u=e[0],h=e[1],d=e[2],p=e[3],f=e[4],g=e[5],A=e[6],E=e[7],m=i,w=n[0],y=n[1],B=n[2],I=s,C=a,T=c,b=l,D=u,v=h,M=d,N=p,S=f,_=g,L=A,x=E,R=m,F=w,k=y,O=B;for(let t=0;t<o;t+=2)I=I+D|0,R=Wp(R^I,16),S=S+R|0,D=Wp(D^S,12),I=I+D|0,R=Wp(R^I,8),S=S+R|0,D=Wp(D^S,7),C=C+v|0,F=Wp(F^C,16),_=_+F|0,v=Wp(v^_,12),C=C+v|0,F=Wp(F^C,8),_=_+F|0,v=Wp(v^_,7),T=T+M|0,k=Wp(k^T,16),L=L+k|0,M=Wp(M^L,12),T=T+M|0,k=Wp(k^T,8),L=L+k|0,M=Wp(M^L,7),b=b+N|0,O=Wp(O^b,16),x=x+O|0,N=Wp(N^x,12),b=b+N|0,O=Wp(O^b,8),x=x+O|0,N=Wp(N^x,7),I=I+v|0,O=Wp(O^I,16),L=L+O|0,v=Wp(v^L,12),I=I+v|0,O=Wp(O^I,8),L=L+O|0,v=Wp(v^L,7),C=C+M|0,R=Wp(R^C,16),x=x+R|0,M=Wp(M^x,12),C=C+M|0,R=Wp(R^C,8),x=x+R|0,M=Wp(M^x,7),T=T+N|0,F=Wp(F^T,16),S=S+F|0,N=Wp(N^S,12),T=T+N|0,F=Wp(F^T,8),S=S+F|0,N=Wp(N^S,7),b=b+D|0,k=Wp(k^b,16),_=_+k|0,D=Wp(D^_,12),b=b+D|0,k=Wp(k^b,8),_=_+k|0,D=Wp(D^_,7);let Q=0;r[Q++]=s+I|0,r[Q++]=a+C|0,r[Q++]=c+T|0,r[Q++]=l+b|0,r[Q++]=u+D|0,r[Q++]=h+v|0,r[Q++]=d+M|0,r[Q++]=p+N|0,r[Q++]=f+S|0,r[Q++]=g+_|0,r[Q++]=A+L|0,r[Q++]=E+x|0,r[Q++]=m+R|0,r[Q++]=w+F|0,r[Q++]=y+k|0,r[Q++]=B+O|0}const rf=Xp(nf,{counterRight:!1,counterLength:4,allowShortKeys:!1}),of=Xp(nf,{counterRight:!1,counterLength:8,extendNonceFn:function(t,e,n,r){let i=t[0],o=t[1],s=t[2],a=t[3],c=e[0],l=e[1],u=e[2],h=e[3],d=e[4],p=e[5],f=e[6],g=e[7],A=n[0],E=n[1],m=n[2],w=n[3];for(let t=0;t<20;t+=2)i=i+c|0,A=Wp(A^i,16),d=d+A|0,c=Wp(c^d,12),i=i+c|0,A=Wp(A^i,8),d=d+A|0,c=Wp(c^d,7),o=o+l|0,E=Wp(E^o,16),p=p+E|0,l=Wp(l^p,12),o=o+l|0,E=Wp(E^o,8),p=p+E|0,l=Wp(l^p,7),s=s+u|0,m=Wp(m^s,16),f=f+m|0,u=Wp(u^f,12),s=s+u|0,m=Wp(m^s,8),f=f+m|0,u=Wp(u^f,7),a=a+h|0,w=Wp(w^a,16),g=g+w|0,h=Wp(h^g,12),a=a+h|0,w=Wp(w^a,8),g=g+w|0,h=Wp(h^g,7),i=i+l|0,w=Wp(w^i,16),f=f+w|0,l=Wp(l^f,12),i=i+l|0,w=Wp(w^i,8),f=f+w|0,l=Wp(l^f,7),o=o+u|0,A=Wp(A^o,16),g=g+A|0,u=Wp(u^g,12),o=o+u|0,A=Wp(A^o,8),g=g+A|0,u=Wp(u^g,7),s=s+h|0,E=Wp(E^s,16),d=d+E|0,h=Wp(h^d,12),s=s+h|0,E=Wp(E^s,8),d=d+E|0,h=Wp(h^d,7),a=a+c|0,m=Wp(m^a,16),p=p+m|0,c=Wp(c^p,12),a=a+c|0,m=Wp(m^a,8),p=p+m|0,c=Wp(c^p,7);let y=0;r[y++]=i,r[y++]=o,r[y++]=s,r[y++]=a,r[y++]=A,r[y++]=E,r[y++]=m,r[y++]=w},allowShortKeys:!1}),sf=new Uint8Array(16),af=(t,e)=>{t.update(e);const n=e.length%16;n&&t.update(sf.subarray(n))},cf=new Uint8Array(32);function lf(t,e,n,r,i){const o=t(e,n,cf),s=ef.create(o);i&&af(s,i),af(s,r);const a=up(r.length,i?i.length:0,!0);s.update(a);const c=s.digest();return tp(o,a),c}const uf=t=>(e,n,r)=>{const i=16;return{encrypt(o,s){const a=o.length;(s=cp(a+i,s,!1)).set(o);const c=s.subarray(0,-16);t(e,n,c,c,1);const l=lf(t,e,n,c,r);return s.set(l,a),tp(l),s},decrypt(o,s){s=cp(o.length-i,s,!1);const a=o.subarray(0,-16),c=o.subarray(-16),l=lf(t,e,n,a,r);if(!sp(c,l))throw new Error("invalid tag");return s.set(o.subarray(0,-16)),t(e,n,s,s,1),tp(l),s}}},hf=ap({blockSize:64,nonceLength:12,tagLength:16},uf(rf)),df=(uf(of),"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0);function pf(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}new Uint8Array(new Uint32Array([287454020]).buffer)[0];const ff=48,gf=57,Af=65,Ef=70,mf=97,wf=102;function yf(t){return t>=ff&&t<=gf?t-ff:t>=Af&&t<=Ef?t-(Af-10):t>=mf&&t<=wf?t-(mf-10):void 0}function Bf(t=32){if(df&&"function"==typeof df.getRandomValues)return df.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function If(t,e,n){let r;if("string"==typeof e)try{r=function(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let e=0,i=0;e<n;e++,i+=2){const n=yf(t.charCodeAt(i)),o=yf(t.charCodeAt(i+1));if(void 0===n||void 0===o){const e=t[i]+t[i+1];throw new Error('hex string expected, got non-hex character "'+e+'" at index '+i)}r[e]=16*n+o}return r}(e)}catch(n){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${n}`)}else{if(!((i=e)instanceof Uint8Array||null!=i&&"object"==typeof i&&"Uint8Array"===i.constructor.name))throw new Error(`${t} must be hex string or Uint8Array`);r=Uint8Array.from(e)}
|
|
111
111
|
/*! micro-rsa-dsa-dh - MIT License (c) 2024 Paul Miller (paulmillr.com) */
|
|
112
112
|
var i;const o=r.length;if("number"==typeof n&&o!==n)throw new Error(`${t} expected ${n} bytes, got ${o}`);return r}function Cf(t,e){if(t>=256n**BigInt(e))throw new Error("integer too large");const n=new Uint8Array(e);for(let r=e-1;r>=0;r--)n[r]=Number(0xffn&t),t>>=8n;return n}function Tf(t){let e=0n;for(let n=0;n<t.length;n++)e=(e<<8n)+BigInt(t[n]);return e}function bf(t,e,n){if(n<=0n||e<0n)throw new Error("Expected power/modulo > 0");if(1n===n)return 0n;let r=1n;for(;e>0n;)1n&e&&(r=r*t%n),t=t*t%n,e>>=1n;return r}const Df=t=>{if(null===t||"object"!=typeof t||"bigint"!=typeof t.n||"bigint"!=typeof t.e)throw new Error("wrong private key")},vf=t=>{if(null===t||"object"!=typeof t||"bigint"!=typeof t.n||"bigint"!=typeof t.d)throw new Error("wrong private key")};function Mf(t,e){const{n,e:r}=t;if(e<0n||e>=n)throw new Error("message representative out of range");return bf(e,r,n)}function Nf(t,e){const{n}=t;if(e<0n||e>=n)throw new Error("ciphertext representative out of range");return bf(e,t.d,n)}const Sf={encrypt(t,e){Df(t),e=If("message",e);const{n}=t,r=Math.ceil(n.toString(16).length/2),i=e.length;if(i>r-11)throw new Error("message too long");const o=r-i-3,s=new Uint8Array(o);for(let t=0;t<o;t++){let e=0;for(;0===e;)e=Bf(1)[0];s[t]=e}return Cf(Mf(t,Tf(function(...t){let e=0;for(let n=0;n<t.length;n++){const r=t[n];pf(r),e+=r.length}const n=new Uint8Array(e);for(let e=0,r=0;e<t.length;e++){const i=t[e];n.set(i,r),r+=i.length}return n}(new Uint8Array([0,2]),s,new Uint8Array([0]),e))),r)},decrypt(t,e){vf(t),e=If("ciphertext",e);const{n}=t,r=Math.ceil(n.toString(16).length/2);if(e.length!==r||r<11)throw new Error("decryption error");const i=Nf(t,Tf(e));if(i>=n)throw new Error("decryption error");const o=Cf(i,r);if(0!==o[0]||2!==o[1])throw new Error("decryption error");let s=-1;for(let t=2;t<o.length;t++)if(0===o[t]){s=t;break}if(-1===s||s<10)throw new Error("decryption error");return o.subarray(s+1)}};function _f(t){return t instanceof Uint8Array?t:new Uint8Array(t)}const Lf=8n;function xf(t){let e=0n;for(const n of t.values()){const t=BigInt(n);e=(e<<Lf)+t}return e}const Rf=globalThis.crypto,Ff=Rf.subtle,kf=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),Of=new Uint8Array([48,129,182,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,129,158,48,129,155,2,1,1,4,48]),Qf=new Uint8Array([48,129,182,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,129,158,48,129,155,2,1,1,4,48]),Uf={X25519:32,"P-384":48,"P-256":32},Pf={importKey(t,e,...n){let r,i,o="raw";switch(t){case"AES-256-GCM":case"AES-128-GCM":r={name:"AES-GCM",length:"AES-256-GCM"===t?256:128},i=["encrypt","decrypt"];break;case"AES-128-CBC":r={name:"AES-CBC",length:128},i=["encrypt","decrypt"];break;case"CHACHA20-POLY1305":return e;case"SHA-1":case"SHA-256":case"SHA-384":r={name:"HMAC",hash:{name:t}},i=["sign","verify"];break;case"P-384":case"P-256":if(r={name:"ECDH",namedCurve:t},i=[],"private"===n[0]){i=["deriveBits"],o="pkcs8";e=K(["P-256"===t?Qf:Of,e])}break;case"X25519":r={name:"X25519"},i=[],"private"===n[0]&&(i=["deriveBits"],o="pkcs8",e=K([kf,e]));break;case"RSA-PSS-SHA256":o="spki",i=["verify"],r={name:"RSA-PSS",hash:"SHA-256"};break;case"RSA-PKCS1-SHA512":case"RSA-PKCS1-SHA256":case"RSA-PKCS1-SHA384":case"RSA-PKCS1-SHA1":o="spki",i=["verify"],r={name:"RSASSA-PKCS1-v1_5",hash:jf(t)};break;case"RSA-PCKS1_5":return function(t){const e=Jr.parse(t,aa),n=Jr.parse(e.publicKey,Nc);return{e:xf(_f(n.publicExponent)),n:xf(_f(n.modulus))}}(e);case"ECDSA-SECP256R1-SHA256":case"ECDSA-SECP256R1-SHA384":case"ECDSA-SECP384R1-SHA384":case"ECDSA-SECP384R1-SHA256":o="spki",i=["verify"],r={name:"ECDSA",namedCurve:t.includes("P256")?"P-256":"P-384"};break;default:throw new Error(`Unsupported algorithm ${t}`)}return Ff.importKey(o,e,r,!0,i)},async exportKey(t){if(t instanceof Uint8Array)return t;if("private"===t.type&&("X25519"===t.algorithm.name||"ECDH"===t.algorithm.name)){const e=Gf(await Ff.exportKey("pkcs8",t)),n="X25519"===t.algorithm.name?kf:Of;return e.slice(n.length)}return Gf(await Ff.exportKey("raw",t))},async generateKeyPair(t){let e;switch(t){case"P-384":case"P-256":e={name:"ECDH",namedCurve:t};break;case"X25519":e={name:"X25519"};break;default:throw new Error(`Unsupported algorithm ${t}`)}const n=await Ff.generateKey(e,!0,["deriveBits"]);return{pubKey:n.publicKey,privKey:n.privateKey}},async calculateSharedSecret(t,e,n){const r="X25519"===t?"X25519":"ECDH";return Gf(await Ff.deriveBits({name:r,public:n},e,8*Uf[t]))},randomBytes(t){const e=new Uint8Array(t);return Rf.getRandomValues(e)},asymmetricEncrypt(t,{publicKey:e,data:n}){if("RSA-PCKS1_5"!==t)throw new Error(`Unsupported cipher suite ${t}`);return Sf.encrypt(e,n)},async encrypt(t,{iv:e,data:n,key:r}){const i="AES-128-CBC"===t?"AES-CBC":"";return Gf(await Ff.encrypt({name:i,iv:e},r,n)).slice(0,n.length)},async decrypt(t,{key:e,iv:n,data:r}){if("AES-128-CBC"!==t)throw new Error(`Unsupported cipher suite: ${t}`);const i=e instanceof Uint8Array?e:await this.exportKey(e);return Vp(i,n,{disablePadding:!0}).decrypt(r)},async authenticatedEncrypt(t,{iv:e,aead:n,key:r,data:i}){let o;if("CHACHA20-POLY1305"===t){const t=r instanceof Uint8Array?r:await this.exportKey(r);o=hf(t,e,n).encrypt(i)}else o=Gf(await Ff.encrypt({name:"AES-GCM",iv:e,additionalData:n},r,i));return{ciphertext:o.slice(0,-16),authTag:o.slice(-16)}},async authenticatedDecrypt(t,{iv:e,aead:n,key:r,data:i,authTag:o}){if(!o)throw new Error("authTag is required");const s=K([i,o]);let a;if("CHACHA20-POLY1305"===t){const t=r instanceof Uint8Array?r:await this.exportKey(r);a=hf(t,e,n).decrypt(s)}else a=Gf(await Ff.decrypt({name:"AES-GCM",iv:e,additionalData:n},r,s));return{plaintext:a}},async verify(t,{data:e,signature:n,publicKey:r}){let i;switch(t){case"RSA-PSS-SHA256":i={name:"RSA-PSS",saltLength:32};break;case"RSA-PKCS1-SHA512":case"RSA-PKCS1-SHA256":case"RSA-PKCS1-SHA384":case"RSA-PKCS1-SHA1":i={name:"RSASSA-PKCS1-v1_5"};break;case"ECDSA-SECP256R1-SHA256":case"ECDSA-SECP256R1-SHA384":case"ECDSA-SECP384R1-SHA256":case"ECDSA-SECP384R1-SHA384":n=function(t){const e=Jr.parse(t,Za),n=Vf(new Uint8Array(e.r)),r=Vf(new Uint8Array(e.s));return K([n,r])}(n),i={name:"ECDSA",hash:jf(t)};break;default:throw new Error(`Unsupported algorithm ${t}`)}return Ff.verify(i,r,n,e)},hash:async(t,e)=>Gf(await Ff.digest(t,e)),hmac:async(t,e,n)=>Gf(await Ff.sign({name:"HMAC",hash:t},e,n)),async extract(t,e,n,r){(r="string"==typeof r?$(r):r).length||(r=new Uint8Array(e));const i=await this.importKey(t,r);return this.hmac(t,i,n)}};function Gf(t){return new Uint8Array(t)}function Vf(t){return t.length>32&&0===t[0]?t=t.slice(1):t.length<32&&(t=K([new Uint8Array(32-t.length).fill(0),t])),t}function jf(t){if(t.endsWith("SHA256"))return"SHA-256";if(t.endsWith("SHA384"))return"SHA-384";if(t.endsWith("SHA512"))return"SHA-512";if(t.endsWith("SHA1"))return"SHA-1";throw new Error(`Unsupported signature algorithm: ${t}`)}var Hf="http://localhost:8001",Yf=function(){return"".concat(Hf,"/api/sdk/update/session/")},zf="PROOF_GENERATION_STARTED",Jf="PROOF_GENERATION_SUCCESS",Wf="PROOF_GENERATION_FAILED",qf="background",Kf="offscreen",Zf="GENERATE_PROOF",Xf="GET_PRIVATE_KEY",$f="GET_PRIVATE_KEY_RESPONSE",tg="OFFSCREEN_DOCUMENT_READY",eg="GENERATE_PROOF_RESPONSE",ng="PING_OFFSCREEN";let rg=!1,ig=!1;const og={debug:1,default:2,info:2,warning:3,error:4,off:5};let sg=og.default,ag=null;const cg=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var lg,ug;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(lg||(lg={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(ug||(ug={}));const hg="0123456789abcdef";class dg{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==og[n]&&this.throwArgumentError("invalid log level name","logLevel",t),sg>og[n]||console.log.apply(console,e)}debug(...t){this._log(dg.levels.DEBUG,t)}info(...t){this._log(dg.levels.INFO,t)}warn(...t){this._log(dg.levels.WARNING,t)}makeError(t,e,n){if(ig)return this.makeError("censored error",e,{});e||(e=dg.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach(t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=hg[e[t]>>4],n+=hg[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}}),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case ug.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case ug.CALL_EXCEPTION:case ug.INSUFFICIENT_FUNDS:case ug.MISSING_NEW:case ug.NONCE_EXPIRED:case ug.REPLACEMENT_UNDERPRICED:case ug.TRANSACTION_REPLACED:case ug.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const s=new Error(t);return s.reason=i,s.code=e,Object.keys(n).forEach(function(t){s[t]=n[t]}),s}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,dg.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){null==t&&(t="platform missing String.prototype.normalize"),cg&&this.throwError("platform missing String.prototype.normalize",dg.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:cg})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,dg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,dg.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,dg.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,dg.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",dg.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",dg.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",dg.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return ag||(ag=new dg("logger/5.8.0")),ag}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",dg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),rg){if(!t)return;this.globalLogger().throwError("error censorship permanent",dg.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ig=!!t,rg=!!e}static setLogLevel(t){const e=og[t.toLowerCase()];null!=e?sg=e:dg.globalLogger().warn("invalid log level - "+t)}static from(t){return new dg(t)}}dg.errors=ug,dg.levels=lg;const pg=new dg("bytes/5.8.0");function fg(t){return!!t.toHexString}function gg(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return gg(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ag(t){return Ig(t)&&!(t.length%2)||mg(t)}function Eg(t){return"number"==typeof t&&t==t&&t%1==0}function mg(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Eg(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!Eg(n)||n<0||n>=256)return!1}return!0}function wg(t,e){if(e||(e={}),"number"==typeof t){pg.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),gg(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),fg(t)&&(t=t.toHexString()),Ig(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":pg.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return gg(new Uint8Array(r))}return mg(t)?gg(new Uint8Array(t)):pg.throwArgumentError("invalid arrayify value","value",t)}function yg(t){const e=t.map(t=>wg(t)),n=e.reduce((t,e)=>t+e.length,0),r=new Uint8Array(n);return e.reduce((t,e)=>(r.set(e,t),t+e.length),0),gg(r)}function Bg(t){let e=wg(t);if(0===e.length)return e;let n=0;for(;n<e.length&&0===e[n];)n++;return n&&(e=e.slice(n)),e}function Ig(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Cg="0123456789abcdef";function Tg(t,e){if(e||(e={}),"number"==typeof t){pg.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Cg[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),fg(t))return t.toHexString();if(Ig(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":pg.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(mg(t)){let e="0x";for(let n=0;n<t.length;n++){let r=t[n];e+=Cg[(240&r)>>4]+Cg[15&r]}return e}return pg.throwArgumentError("invalid hexlify value","value",t)}function bg(t){if("string"!=typeof t)t=Tg(t);else if(!Ig(t)||t.length%2)return null;return(t.length-2)/2}function Dg(t,e,n){return"string"!=typeof t?t=Tg(t):(!Ig(t)||t.length%2)&&pg.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function vg(t){let e="0x";return t.forEach(t=>{e+=Tg(t).substring(2)}),e}function Mg(t,e){for("string"!=typeof t?t=Tg(t):Ig(t)||pg.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&pg.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ng(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Ag(t)){let n=wg(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Tg(n.slice(0,32)),e.s=Tg(n.slice(32,64))):65===n.length?(e.r=Tg(n.slice(0,32)),e.s=Tg(n.slice(32,64)),e.v=n[64]):pg.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:pg.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Tg(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=function(t,e){(t=wg(t)).length>e&&pg.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),gg(n)}(wg(e._vs),32);e._vs=Tg(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&pg.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=Tg(n);null==e.s?e.s=i:e.s!==i&&pg.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?pg.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&pg.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Ig(e.r)?e.r=Mg(e.r,32):pg.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Ig(e.s)?e.s=Mg(e.s,32):pg.throwArgumentError("signature missing or invalid s","signature",t);const n=wg(e.s);n[0]>=128&&pg.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=Tg(n);e._vs&&(Ig(e._vs)||pg.throwArgumentError("signature invalid _vs","signature",t),e._vs=Mg(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&pg.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function Sg(t){return Tg(yg([(t=Ng(t)).r,t.s,t.recoveryParam?"0x1c":"0x1b"]))}function _g(t){t=atob(t);const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return wg(e)}function Lg(t){t=wg(t);let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}var xg=s(9404),Rg=s.n(xg),Fg=s(7952),kg=s.n(Fg);"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==s.g?s.g:"undefined"!=typeof self&&self;function Og(t,e,n){return n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},t(n,n.exports),n.exports}var Qg=Ug;function Ug(t,e){if(!t)throw new Error(e||"Assertion failed")}Ug.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var Pg=Og(function(t,e){var n=e;function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n<t.length;n++)e+=r(t[n].toString(16));return e}n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,s=255&i;o?n.push(o,s):n.push(s)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}}),Gg=Og(function(t,e){var n=e;n.assert=Qg,n.toArray=Pg.toArray,n.zero2=Pg.zero2,n.toHex=Pg.toHex,n.encode=Pg.encode,n.getNAF=function(t,e,n){var r,i=new Array(Math.max(t.bitLength(),n)+1);for(r=0;r<i.length;r+=1)i[r]=0;var o=1<<e+1,s=t.clone();for(r=0;r<i.length;r++){var a,c=s.andln(o-1);s.isOdd()?(a=c>(o>>1)-1?(o>>1)-c:c,s.isubn(a)):a=0,i[r]=a,s.iushrn(1)}return i},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var s,a,c=t.andln(3)+i&3,l=e.andln(3)+o&3;3===c&&(c=-1),3===l&&(l=-1),s=1&c?3!==(r=t.andln(7)+i&7)&&5!==r||2!==l?c:-c:0,n[0].push(s),a=1&l?3!==(r=e.andln(7)+o&7)&&5!==r||2!==c?l:-l:0,n[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new(Rg())(t,"hex","le")}}),Vg=Gg.getNAF,jg=Gg.getJSF,Hg=Gg.assert;function Yg(t,e){this.type=t,this.p=new(Rg())(e.p,16),this.red=e.prime?Rg().red(e.prime):Rg().mont(this.p),this.zero=new(Rg())(0).toRed(this.red),this.one=new(Rg())(1).toRed(this.red),this.two=new(Rg())(2).toRed(this.red),this.n=e.n&&new(Rg())(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zg=Yg;function Jg(t,e){this.curve=t,this.type=e,this.precomputed=null}Yg.prototype.point=function(){throw new Error("Not implemented")},Yg.prototype.validate=function(){throw new Error("Not implemented")},Yg.prototype._fixedNafMul=function(t,e){Hg(t.precomputed);var n=t._getDoubles(),r=Vg(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,s,a=[];for(o=0;o<r.length;o+=n.step){s=0;for(var c=o+n.step-1;c>=o;c--)s=(s<<1)+r[c];a.push(s)}for(var l=this.jpoint(null,null,null),u=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<a.length;o++)(s=a[o])===h?u=u.mixedAdd(n.points[o]):s===-h&&(u=u.mixedAdd(n.points[o].neg()));l=l.add(u)}return l.toP()},Yg.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=Vg(e,n,this._bitLength),s=this.jpoint(null,null,null),a=o.length-1;a>=0;a--){for(var c=0;a>=0&&0===o[a];a--)c++;if(a>=0&&c++,s=s.dblp(c),a<0)break;var l=o[a];Hg(0!==l),s="affine"===t.type?l>0?s.mixedAdd(i[l-1>>1]):s.mixedAdd(i[-l-1>>1].neg()):l>0?s.add(i[l-1>>1]):s.add(i[-l-1>>1].neg())}return"affine"===t.type?s.toP():s},Yg.prototype._wnafMulAdd=function(t,e,n,r,i){var o,s,a,c=this._wnafT1,l=this._wnafT2,u=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(a=e[o])._getNAFPoints(t);c[o]=d.wnd,l[o]=d.points}for(o=r-1;o>=1;o-=2){var p=o-1,f=o;if(1===c[p]&&1===c[f]){var g=[e[p],null,null,e[f]];0===e[p].y.cmp(e[f].y)?(g[1]=e[p].add(e[f]),g[2]=e[p].toJ().mixedAdd(e[f].neg())):0===e[p].y.cmp(e[f].y.redNeg())?(g[1]=e[p].toJ().mixedAdd(e[f]),g[2]=e[p].add(e[f].neg())):(g[1]=e[p].toJ().mixedAdd(e[f]),g[2]=e[p].toJ().mixedAdd(e[f].neg()));var A=[-3,-1,-5,-7,0,7,5,1,3],E=jg(n[p],n[f]);for(h=Math.max(E[0].length,h),u[p]=new Array(h),u[f]=new Array(h),s=0;s<h;s++){var m=0|E[0][s],w=0|E[1][s];u[p][s]=A[3*(m+1)+(w+1)],u[f][s]=0,l[p]=g}}else u[p]=Vg(n[p],c[p],this._bitLength),u[f]=Vg(n[f],c[f],this._bitLength),h=Math.max(u[p].length,h),h=Math.max(u[f].length,h)}var y=this.jpoint(null,null,null),B=this._wnafT4;for(o=h;o>=0;o--){for(var I=0;o>=0;){var C=!0;for(s=0;s<r;s++)B[s]=0|u[s][o],0!==B[s]&&(C=!1);if(!C)break;I++,o--}if(o>=0&&I++,y=y.dblp(I),o<0)break;for(s=0;s<r;s++){var T=B[s];0!==T&&(T>0?a=l[s][T-1>>1]:T<0&&(a=l[s][-T-1>>1].neg()),y="affine"===a.type?y.mixedAdd(a):y.add(a))}}for(o=0;o<r;o++)l[o]=null;return i?y:y.toP()},Yg.BasePoint=Jg,Jg.prototype.eq=function(){throw new Error("Not implemented")},Jg.prototype.validate=function(){return this.curve.validate(this)},Yg.prototype.decodePoint=function(t,e){t=Gg.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?Hg(t[t.length-1]%2==0):7===t[0]&&Hg(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},Jg.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Jg.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},Jg.prototype.encode=function(t,e){return Gg.encode(this._encode(e),t)},Jg.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Jg.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},Jg.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},Jg.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},Jg.prototype._getBeta=function(){return null},Jg.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var Wg=Og(function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}}),qg=Gg.assert;function Kg(t){zg.call(this,"short",t),this.a=new(Rg())(t.a,16).toRed(this.red),this.b=new(Rg())(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Wg(Kg,zg);var Zg=Kg;function Xg(t,e,n,r){zg.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new(Rg())(e,16),this.y=new(Rg())(n,16),r&&(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)}function $g(t,e,n,r){zg.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new(Rg())(0)):(this.x=new(Rg())(e,16),this.y=new(Rg())(n,16),this.z=new(Rg())(r,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}Kg.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n;if(t.beta)e=new(Rg())(t.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);e=(e=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(t.lambda)n=new(Rg())(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?n=i[0]:(n=i[1],qg(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:n,basis:t.basis?t.basis.map(function(t){return{a:new(Rg())(t.a,16),b:new(Rg())(t.b,16)}}):this._getEndoBasis(n)}}},Kg.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:Rg().mont(t),n=new(Rg())(2).toRed(e).redInvm(),r=n.redNeg(),i=new(Rg())(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Kg.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,s,a,c,l,u=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),p=new(Rg())(1),f=new(Rg())(0),g=new(Rg())(0),A=new(Rg())(1),E=0;0!==h.cmpn(0);){var m=d.div(h);c=d.sub(m.mul(h)),l=g.sub(m.mul(p));var w=A.sub(m.mul(f));if(!r&&c.cmp(u)<0)e=a.neg(),n=p,r=c.neg(),i=l;else if(r&&2===++E)break;a=c,d=h,h=c,g=p,p=l,A=f,f=w}o=c.neg(),s=l;var y=r.sqr().add(i.sqr());return o.sqr().add(s.sqr()).cmp(y)>=0&&(o=e,s=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:r,b:i},{a:o,b:s}]},Kg.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),s=i.mul(n.a),a=o.mul(r.a),c=i.mul(n.b),l=o.mul(r.b);return{k1:t.sub(s).sub(a),k2:c.add(l).neg()}},Kg.prototype.pointFromX=function(t,e){(t=new(Rg())(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},Kg.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Kg.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var s=this._endoSplit(e[o]),a=t[o],c=a._getBeta();s.k1.negative&&(s.k1.ineg(),a=a.neg(!0)),s.k2.negative&&(s.k2.ineg(),c=c.neg(!0)),r[2*o]=a,r[2*o+1]=c,i[2*o]=s.k1,i[2*o+1]=s.k2}for(var l=this._wnafMulAdd(1,r,i,2*o,n),u=0;u<2*o;u++)r[u]=null,i[u]=null;return l},Wg(Xg,zg.BasePoint),Kg.prototype.point=function(t,e,n){return new Xg(this,t,e,n)},Kg.prototype.pointFromJSON=function(t,e){return Xg.fromJSON(this,t,e)},Xg.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},Xg.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]},Xg.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},Xg.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)+">"},Xg.prototype.isInfinity=function(){return this.inf},Xg.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Xg.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},Xg.prototype.getX=function(){return this.x.fromRed()},Xg.prototype.getY=function(){return this.y.fromRed()},Xg.prototype.mul=function(t){return t=new(Rg())(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Xg.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Xg.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Xg.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Xg.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},Xg.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Wg($g,zg.BasePoint),Kg.prototype.jpoint=function(t,e,n){return new $g(this,t,e,n)},$g.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},$g.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$g.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),s=t.y.redMul(n.redMul(this.z)),a=r.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var l=a.redSqr(),u=l.redMul(a),h=r.redMul(l),d=c.redSqr().redIAdd(u).redISub(h).redISub(h),p=c.redMul(h.redISub(d)).redISub(o.redMul(u)),f=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,f)},$g.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),s=n.redSub(r),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),u=n.redMul(c),h=a.redSqr().redIAdd(l).redISub(u).redISub(u),d=a.redMul(u.redISub(h)).redISub(i.redMul(l)),p=this.z.redMul(s);return this.curve.jpoint(h,d,p)},$g.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,s=this.y,a=this.z,c=a.redSqr().redSqr(),l=s.redAdd(s);for(e=0;e<t;e++){var u=o.redSqr(),h=l.redSqr(),d=h.redSqr(),p=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(c)),f=o.redMul(h),g=p.redSqr().redISub(f.redAdd(f)),A=f.redISub(g),E=p.redMul(A);E=E.redIAdd(E).redISub(d);var m=l.redMul(a);e+1<t&&(c=c.redMul(d)),o=g,a=m,l=E}return this.curve.jpoint(o,l.redMul(i),a)},$g.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},$g.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(r).redISub(o);s=s.redIAdd(s);var a=r.redAdd(r).redIAdd(r),c=a.redSqr().redISub(s).redISub(s),l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),t=c,e=a.redMul(s.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),p=this.x.redAdd(h).redSqr().redISub(u).redISub(d);p=p.redIAdd(p);var f=u.redAdd(u).redIAdd(u),g=f.redSqr(),A=d.redIAdd(d);A=(A=A.redIAdd(A)).redIAdd(A),t=g.redISub(p).redISub(p),e=f.redMul(p.redISub(t)).redISub(A),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},$g.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),s=this.x.redAdd(i).redSqr().redISub(r).redISub(o);s=s.redIAdd(s);var a=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=a.redSqr().redISub(s).redISub(s);t=c;var l=o.redIAdd(o);l=(l=l.redIAdd(l)).redIAdd(l),e=a.redMul(s.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),p=this.x.redSub(u).redMul(this.x.redAdd(u));p=p.redAdd(p).redIAdd(p);var f=d.redIAdd(d),g=(f=f.redIAdd(f)).redAdd(f);t=p.redSqr().redISub(g),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(u);var A=h.redSqr();A=(A=(A=A.redIAdd(A)).redIAdd(A)).redIAdd(A),e=p.redMul(f.redISub(t)).redISub(A)}return this.curve.jpoint(t,e,n)},$g.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),s=n.redSqr(),a=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),c=e.redAdd(e),l=(c=c.redIAdd(c)).redMul(s),u=a.redSqr().redISub(l.redAdd(l)),h=l.redISub(u),d=s.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=a.redMul(h).redISub(d),f=n.redAdd(n).redMul(r);return this.curve.jpoint(u,p,f)},$g.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),s=this.x.redAdd(e).redSqr().redISub(t).redISub(r),a=(s=(s=(s=s.redIAdd(s)).redAdd(s).redIAdd(s)).redISub(o)).redSqr(),c=r.redIAdd(r);c=(c=(c=c.redIAdd(c)).redIAdd(c)).redIAdd(c);var l=i.redIAdd(s).redSqr().redISub(o).redISub(a).redISub(c),u=e.redMul(l);u=(u=u.redIAdd(u)).redIAdd(u);var h=this.x.redMul(a).redISub(u);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(l.redMul(c.redISub(l)).redISub(s.redMul(a)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=this.z.redAdd(s).redSqr().redISub(n).redISub(a);return this.curve.jpoint(h,d,p)},$g.prototype.mul=function(t,e){return t=new(Rg())(t,e),this.curve._wnafMul(this,t)},$g.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},$g.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$g.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)+">"},$g.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var tA=Og(function(t,e){var n=e;n.base=zg,n.short=Zg,n.mont=null,n.edwards=null}),eA=Og(function(t,e){var n,r=e,i=Gg.assert;function o(t){"short"===t.type?this.curve=new tA.short(t):"edwards"===t.type?this.curve=new tA.edwards(t):this.curve=new tA.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,s("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:kg().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("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:kg().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("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:kg().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("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:kg().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"]}),s("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:kg().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"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:kg().sha256,gRed:!1,g:["9"]}),s("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:kg().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}s("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:kg().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})});function nA(t){if(!(this instanceof nA))return new nA(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Pg.toArray(t.entropy,t.entropyEnc||"hex"),n=Pg.toArray(t.nonce,t.nonceEnc||"hex"),r=Pg.toArray(t.pers,t.persEnc||"hex");Qg(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var rA=nA;nA.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},nA.prototype._hmac=function(){return new(kg().hmac)(this.hash,this.K)},nA.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},nA.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=Pg.toArray(t,e),n=Pg.toArray(n,r),Qg(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},nA.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=Pg.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,Pg.encode(o,e)};var iA=Gg.assert;function oA(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var sA=oA;oA.fromPublic=function(t,e,n){return e instanceof oA?e:new oA(t,{pub:e,pubEnc:n})},oA.fromPrivate=function(t,e,n){return e instanceof oA?e:new oA(t,{priv:e,privEnc:n})},oA.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.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"}},oA.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},oA.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},oA.prototype._importPrivate=function(t,e){this.priv=new(Rg())(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},oA.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?iA(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||iA(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},oA.prototype.derive=function(t){return t.validate()||iA(t.validate(),"public point not validated"),t.mul(this.priv).getX()},oA.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},oA.prototype.verify=function(t,e,n){return this.ec.verify(t,e,this,void 0,n)},oA.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var aA=Gg.assert;function cA(t,e){if(t instanceof cA)return t;this._importDER(t,e)||(aA(t.r&&t.s,"Signature without r or s"),this.r=new(Rg())(t.r,16),this.s=new(Rg())(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var lA=cA;function uA(){this.place=0}function hA(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;if(0===t[e.place])return!1;for(var i=0,o=0,s=e.place;o<r;o++,s++)i<<=8,i|=t[s],i>>>=0;return!(i<=127)&&(e.place=s,i)}function dA(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function pA(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}cA.prototype._importDER=function(t,e){t=Gg.toArray(t,e);var n=new uA;if(48!==t[n.place++])return!1;var r=hA(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=hA(t,n);if(!1===i)return!1;if(128&t[n.place])return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var s=hA(t,n);if(!1===s)return!1;if(t.length!==s+n.place)return!1;if(128&t[n.place])return!1;var a=t.slice(n.place,s+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}return this.r=new(Rg())(o),this.s=new(Rg())(a),this.recoveryParam=null,!0},cA.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=dA(e),n=dA(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];pA(r,e.length),(r=r.concat(e)).push(2),pA(r,n.length);var i=r.concat(n),o=[48];return pA(o,i.length),o=o.concat(i),Gg.encode(o,t)};var fA=function(){throw new Error("unsupported")},gA=Gg.assert;function AA(t){if(!(this instanceof AA))return new AA(t);"string"==typeof t&&(gA(Object.prototype.hasOwnProperty.call(eA,t),"Unknown curve "+t),t=eA[t]),t instanceof eA.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var EA=AA;AA.prototype.keyPair=function(t){return new sA(this,t)},AA.prototype.keyFromPrivate=function(t,e){return sA.fromPrivate(this,t,e)},AA.prototype.keyFromPublic=function(t,e){return sA.fromPublic(this,t,e)},AA.prototype.genKeyPair=function(t){t||(t={});for(var e=new rA({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||fA(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new(Rg())(2));;){var i=new(Rg())(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},AA.prototype._truncateToN=function(t,e,n){var r;if(Rg().isBN(t)||"number"==typeof t)r=(t=new(Rg())(t,16)).byteLength();else if("object"==typeof t)r=t.length,t=new(Rg())(t,16);else{var i=t.toString();r=i.length+1>>>1,t=new(Rg())(i,16)}"number"!=typeof n&&(n=8*r);var o=n-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},AA.prototype.sign=function(t,e,n,r){if("object"==typeof n&&(r=n,n=null),r||(r={}),"string"!=typeof t&&"number"!=typeof t&&!Rg().isBN(t)){gA("object"==typeof t&&t&&"number"==typeof t.length,"Expected message to be an array-like, a hex string, or a BN instance"),gA(t.length>>>0===t.length);for(var i=0;i<t.length;i++)gA((255&t[i])===t[i])}e=this.keyFromPrivate(e,n),t=this._truncateToN(t,!1,r.msgBitLength),gA(!t.isNeg(),"Can not sign a negative message");var o=this.n.byteLength(),s=e.getPrivate().toArray("be",o),a=t.toArray("be",o);gA(new(Rg())(a).eq(t),"Can not sign message");for(var c=new rA({hash:this.hash,entropy:s,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),l=this.n.sub(new(Rg())(1)),u=0;;u++){var h=r.k?r.k(u):new(Rg())(c.generate(this.n.byteLength()));if(!((h=this._truncateToN(h,!0)).cmpn(1)<=0||h.cmp(l)>=0)){var d=this.g.mul(h);if(!d.isInfinity()){var p=d.getX(),f=p.umod(this.n);if(0!==f.cmpn(0)){var g=h.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(g=g.umod(this.n)).cmpn(0)){var A=(d.getY().isOdd()?1:0)|(0!==p.cmp(f)?2:0);return r.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g),A^=1),new lA({r:f,s:g,recoveryParam:A})}}}}}},AA.prototype.verify=function(t,e,n,r,i){i||(i={}),t=this._truncateToN(t,!1,i.msgBitLength),n=this.keyFromPublic(n,r);var o=(e=new lA(e,"hex")).r,s=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),l=c.mul(t).umod(this.n),u=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(l,n.getPublic(),u)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(l,n.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},AA.prototype.recoverPubKey=function(t,e,n,r){gA((3&n)===n,"The recovery param is more than two bits"),e=new lA(e,r);var i=this.n,o=new(Rg())(t),s=e.r,a=e.s,c=1&n,l=n>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var u=e.r.invm(i),h=i.sub(o).mul(u).umod(i),d=a.mul(u).umod(i);return this.g.mulAdd(h,s,d)},AA.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new lA(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var mA=Og(function(t,e){var n=e;n.version="6.6.1",n.utils=Gg,n.rand=function(){throw new Error("unsupported")},n.curve=tA,n.curves=eA,n.ec=EA,n.eddsa=null}).ec;var wA=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const yA=new dg("properties/5.8.0");function BA(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function IA(t){return wA(this,void 0,void 0,function*(){const e=Object.keys(t).map(e=>{const n=t[e];return Promise.resolve(n).then(t=>({key:e,value:t}))});return(yield Promise.all(e)).reduce((t,e)=>(t[e.key]=e.value,t),{})})}function CA(t){const e={};for(const n in t)e[n]=t[n];return e}const TA={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function bA(t){if(null==t||TA[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;n<e.length;n++){let r=null;try{r=t[e[n]]}catch(t){continue}if(!bA(r))return!1}return!0}return yA.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function DA(t){if(bA(t))return t;if(Array.isArray(t))return Object.freeze(t.map(t=>vA(t)));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&BA(e,n,vA(r))}return e}return yA.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function vA(t){return DA(t)}class MA{constructor(t){for(const e in t)this[e]=vA(t[e])}}const NA=new dg("signing-key/5.8.0");let SA=null;function _A(){return SA||(SA=new mA("secp256k1")),SA}class LA{constructor(t){BA(this,"curve","secp256k1"),BA(this,"privateKey",Tg(t)),32!==bg(this.privateKey)&&NA.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=_A().keyFromPrivate(wg(this.privateKey));BA(this,"publicKey","0x"+e.getPublic(!1,"hex")),BA(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),BA(this,"_isSigningKey",!0)}_addPoint(t){const e=_A().keyFromPublic(wg(this.publicKey)),n=_A().keyFromPublic(wg(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=_A().keyFromPrivate(wg(this.privateKey)),n=wg(t);32!==n.length&&NA.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return Ng({recoveryParam:r.recoveryParam,r:Mg("0x"+r.r.toString(16),32),s:Mg("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=_A().keyFromPrivate(wg(this.privateKey)),n=_A().keyFromPublic(wg(xA(t)));return Mg("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function xA(t,e){const n=wg(t);if(32===n.length){const t=new LA(n);return e?"0x"+_A().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?Tg(n):"0x"+_A().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+_A().keyFromPublic(n).getPublic(!0,"hex"):Tg(n):NA.throwArgumentError("invalid public or private key","key","[REDACTED]")}var RA=Rg().BN;const FA=new dg("bignumber/5.8.0"),kA={},OA=9007199254740991;let QA=!1;class UA{constructor(t,e){t!==kA&&FA.throwError("cannot call constructor directly; use BigNumber.from",dg.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return GA(VA(this).fromTwos(t))}toTwos(t){return GA(VA(this).toTwos(t))}abs(){return"-"===this._hex[0]?UA.from(this._hex.substring(1)):this}add(t){return GA(VA(this).add(VA(t)))}sub(t){return GA(VA(this).sub(VA(t)))}div(t){return UA.from(t).isZero()&&jA("division-by-zero","div"),GA(VA(this).div(VA(t)))}mul(t){return GA(VA(this).mul(VA(t)))}mod(t){const e=VA(t);return e.isNeg()&&jA("division-by-zero","mod"),GA(VA(this).umod(e))}pow(t){const e=VA(t);return e.isNeg()&&jA("negative-power","pow"),GA(VA(this).pow(e))}and(t){const e=VA(t);return(this.isNegative()||e.isNeg())&&jA("unbound-bitwise-result","and"),GA(VA(this).and(e))}or(t){const e=VA(t);return(this.isNegative()||e.isNeg())&&jA("unbound-bitwise-result","or"),GA(VA(this).or(e))}xor(t){const e=VA(t);return(this.isNegative()||e.isNeg())&&jA("unbound-bitwise-result","xor"),GA(VA(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&jA("negative-width","mask"),GA(VA(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&jA("negative-width","shl"),GA(VA(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&jA("negative-width","shr"),GA(VA(this).shrn(t))}eq(t){return VA(this).eq(VA(t))}lt(t){return VA(this).lt(VA(t))}lte(t){return VA(this).lte(VA(t))}gt(t){return VA(this).gt(VA(t))}gte(t){return VA(this).gte(VA(t))}isNegative(){return"-"===this._hex[0]}isZero(){return VA(this).isZero()}toNumber(){try{return VA(this).toNumber()}catch(t){jA("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return FA.throwError("this platform does not support BigInt",dg.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?QA||(QA=!0,FA.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?FA.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",dg.errors.UNEXPECTED_ARGUMENT,{}):FA.throwError("BigNumber.toString does not accept parameters",dg.errors.UNEXPECTED_ARGUMENT,{})),VA(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof UA)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new UA(kA,PA(t)):t.match(/^-?[0-9]+$/)?new UA(kA,PA(new RA(t))):FA.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&jA("underflow","BigNumber.from",t),(t>=OA||t<=-OA)&&jA("overflow","BigNumber.from",t),UA.from(String(t));const e=t;if("bigint"==typeof e)return UA.from(e.toString());if(mg(e))return UA.from(Tg(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return UA.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Ig(t)||"-"===t[0]&&Ig(t.substring(1))))return UA.from(t)}return FA.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function PA(t){if("string"!=typeof t)return PA(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&FA.throwArgumentError("invalid hex","value",t),"0x00"===(t=PA(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function GA(t){return UA.from(PA(t))}function VA(t){const e=UA.from(t).toHexString();return"-"===e[0]?new RA("-"+e.substring(3),16):new RA(e.substring(2),16)}function jA(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),FA.throwError(t,dg.errors.NUMERIC_FAULT,r)}var HA=s(1176),YA=s.n(HA);function zA(t){return"0x"+YA().keccak_256(wg(t))}const JA=new dg("address/5.8.0");function WA(t){Ig(t,20)||JA.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=wg(zA(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const qA={};for(let t=0;t<10;t++)qA[String(t)]=String(t);for(let t=0;t<26;t++)qA[String.fromCharCode(65+t)]=String(10+t);const KA=Math.floor((ZA=9007199254740991,Math.log10?Math.log10(ZA):Math.log(ZA)/Math.LN10));var ZA;function XA(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map(t=>qA[t]).join("");for(;e.length>=KA;){let t=e.substring(0,KA);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}function $A(t){let e=null;if("string"!=typeof t&&JA.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=WA(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&JA.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==XA(t)&&JA.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new RA(n,36).toString(16);e.length<40;)e="0"+e;e=WA("0x"+e)}else JA.throwArgumentError("invalid address","address",t);var n;return e}const tE=new dg("rlp/5.8.0");function eE(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function nE(t){if(Array.isArray(t)){let e=[];if(t.forEach(function(t){e=e.concat(nE(t))}),e.length<=55)return e.unshift(192+e.length),e;const n=eE(e.length);return n.unshift(247+n.length),n.concat(e)}Ag(t)||tE.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(wg(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=eE(e.length);return n.unshift(183+n.length),n.concat(e)}function rE(t){return Tg(nE(t))}const iE=new dg("transactions/5.8.0");var oE;!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(oE||(oE={}));const sE=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],aE={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function cE(t){return $A(Dg(zA(Dg(xA(t),1)),12))}function lE(t,e){return cE(function(t,e){const n=Ng(e),r={r:wg(n.r),s:wg(n.s)};return"0x"+_A().recoverPubKey(wg(t),r,n.recoveryParam).encode("hex",!1)}(wg(t),e))}function uE(t,e){const n=Bg(UA.from(t).toHexString());return n.length>32&&iE.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function hE(t,e){return{address:$A(t),storageKeys:(e||[]).map((e,n)=>(32!==bg(e)&&iE.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase()))}}function dE(t){if(Array.isArray(t))return t.map((t,e)=>Array.isArray(t)?(t.length>2&&iE.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),hE(t[0],t[1])):hE(t.address,t.storageKeys));const e=Object.keys(t).map(e=>{const n=t[e].reduce((t,e)=>(t[e]=!0,t),{});return hE(e,Object.keys(n).sort())});return e.sort((t,e)=>t.address.localeCompare(e.address)),e}function pE(t){return dE(t).map(t=>[t.address,t.storageKeys])}function fE(t,e){if(null!=t.gasPrice){const e=UA.from(t.gasPrice),n=UA.from(t.maxFeePerGas||0);e.eq(n)||iE.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[uE(t.chainId||0,"chainId"),uE(t.nonce||0,"nonce"),uE(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),uE(t.maxFeePerGas||0,"maxFeePerGas"),uE(t.gasLimit||0,"gasLimit"),null!=t.to?$A(t.to):"0x",uE(t.value||0,"value"),t.data||"0x",pE(t.accessList||[])];if(e){const t=Ng(e);n.push(uE(t.recoveryParam,"recoveryParam")),n.push(Bg(t.r)),n.push(Bg(t.s))}return vg(["0x02",rE(n)])}function gE(t,e){const n=[uE(t.chainId||0,"chainId"),uE(t.nonce||0,"nonce"),uE(t.gasPrice||0,"gasPrice"),uE(t.gasLimit||0,"gasLimit"),null!=t.to?$A(t.to):"0x",uE(t.value||0,"value"),t.data||"0x",pE(t.accessList||[])];if(e){const t=Ng(e);n.push(uE(t.recoveryParam,"recoveryParam")),n.push(Bg(t.r)),n.push(Bg(t.s))}return vg(["0x01",rE(n)])}function AE(t,e){var n,r;r=aE,(n=t)&&"object"==typeof n||yA.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{r[t]||yA.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)});const i=[];sE.forEach(function(e){let n=t[e.name]||[];const r={};e.numeric&&(r.hexPad="left"),n=wg(Tg(n,r)),e.length&&n.length!==e.length&&n.length>0&&iE.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n),e.maxLength&&(n=Bg(n),n.length>e.maxLength&&iE.throwArgumentError("invalid length for "+e.name,"transaction:"+e.name,n)),i.push(Tg(n))});let o=0;if(null!=t.chainId?(o=t.chainId,"number"!=typeof o&&iE.throwArgumentError("invalid transaction.chainId","transaction",t)):e&&!Ag(e)&&e.v>28&&(o=Math.floor((e.v-35)/2)),0!==o&&(i.push(Tg(o)),i.push("0x"),i.push("0x")),!e)return rE(i);const s=Ng(e);let a=27+s.recoveryParam;return 0!==o?(i.pop(),i.pop(),i.pop(),a+=2*o+8,s.v>28&&s.v!==a&&iE.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e)):s.v!==a&&iE.throwArgumentError("transaction.chainId/signature.v mismatch","signature",e),i.push(Tg(a)),i.push(Bg(wg(s.r))),i.push(Bg(wg(s.s))),rE(i)}function EE(t,e){if(null==t.type||0===t.type)return null!=t.accessList&&iE.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",t),AE(t,e);switch(t.type){case 1:return gE(t,e);case 2:return fE(t,e)}return iE.throwError(`unsupported transaction type: ${t.type}`,dg.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:t.type})}function mE(){let t=0,e=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<n,!(128&r))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(15&n)<<28,e=(112&n)>>4,!(128&n))return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<n,!(128&r))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function wE(t,e,n){for(let r=0;r<28;r+=7){const i=t>>>r,o=!(i>>>7==0&&0==e),s=255&(o?128|i:i);if(n.push(s),!o)return}const r=t>>>28&15|(7&e)<<4,i=!!(e>>3);if(n.push(255&(i?128|r:r)),i){for(let t=3;t<31;t+=7){const r=e>>>t,i=!(r>>>7==0),o=255&(i?128|r:r);if(n.push(o),!i)return}n.push(e>>>31&1)}}const yE=4294967296;function BE(t){const e="-"===t[0];e&&(t=t.slice(1));const n=1e6;let r=0,i=0;function o(e,o){const s=Number(t.slice(e,o));i*=n,r=r*n+s,r>=yE&&(i+=r/yE|0,r%=yE)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),e?TE(r,i):CE(r,i)}function IE(t,e){if(({lo:t,hi:e}=function(t,e){return{lo:t>>>0,hi:e>>>0}}(t,e)),e<=2097151)return String(yE*e+t);const n=16777215&(t>>>24|e<<8),r=e>>16&65535;let i=(16777215&t)+6777216*n+6710656*r,o=n+8147497*r,s=2*r;const a=1e7;return i>=a&&(o+=Math.floor(i/a),i%=a),o>=a&&(s+=Math.floor(o/a),o%=a),s.toString()+bE(o)+bE(i)}function CE(t,e){return{lo:0|t,hi:0|e}}function TE(t,e){return e=~e,t?t=1+~t:e+=1,CE(t,e)}const bE=t=>{const e=String(t);return"0000000".slice(e.length)+e};function DE(t,e){if(t>=0){for(;t>127;)e.push(127&t|128),t>>>=7;e.push(t)}else{for(let n=0;n<9;n++)e.push(127&t|128),t>>=7;e.push(1)}}function vE(){let t=this.buf[this.pos++],e=127&t;if(!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<7,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<14,!(128&t))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(127&t)<<21,!(128&t))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(15&t)<<28;for(let e=5;128&t&&e<10;e++)t=this.buf[this.pos++];if(128&t)throw new Error("invalid varint");return this.assertBounds(),e>>>0}var ME=s(5606);const NE=SE();function SE(){const t=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof t.getBigInt64&&"function"==typeof t.getBigUint64&&"function"==typeof t.setBigInt64&&"function"==typeof t.setBigUint64&&(!!globalThis.Deno||"object"!=typeof ME||"object"!=typeof ME.env||"1"!==ME.env.BUF_BIGINT_DISABLE)){const e=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(t){const r="bigint"==typeof t?t:BigInt(t);if(r>n||r<e)throw new Error(`invalid int64: ${t}`);return r},uParse(t){const e="bigint"==typeof t?t:BigInt(t);if(e>i||e<r)throw new Error(`invalid uint64: ${t}`);return e},enc(e){return t.setBigInt64(0,this.parse(e),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(e){return t.setBigInt64(0,this.uParse(e),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec:(e,n)=>(t.setInt32(0,e,!0),t.setInt32(4,n,!0),t.getBigInt64(0,!0)),uDec:(e,n)=>(t.setInt32(0,e,!0),t.setInt32(4,n,!0),t.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:t=>("string"!=typeof t&&(t=t.toString()),_E(t),t),uParse:t=>("string"!=typeof t&&(t=t.toString()),LE(t),t),enc:t=>("string"!=typeof t&&(t=t.toString()),_E(t),BE(t)),uEnc:t=>("string"!=typeof t&&(t=t.toString()),LE(t),BE(t)),dec:(t,e)=>function(t,e){let n=CE(t,e);const r=2147483648&n.hi;r&&(n=TE(n.lo,n.hi));const i=IE(n.lo,n.hi);return r?"-"+i:i}(t,e),uDec:(t,e)=>IE(t,e)}}function _E(t){if(!/^-?[0-9]+$/.test(t))throw new Error("invalid int64: "+t)}function LE(t){if(!/^[0-9]+$/.test(t))throw new Error("invalid uint64: "+t)}const xE=Symbol.for("@bufbuild/protobuf/text-encoding");function RE(){if(null==globalThis[xE]){const t=new globalThis.TextEncoder,e=new globalThis.TextDecoder;globalThis[xE]={encodeUtf8:e=>t.encode(e),decodeUtf8:t=>e.decode(t),checkUtf8(t){try{return encodeURIComponent(t),!0}catch(t){return!1}}}}return globalThis[xE]}var FE;!function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"}(FE||(FE={}));const kE=34028234663852886e22,OE=-34028234663852886e22;class QE{constructor(t=RE().encodeUtf8){this.encodeUtf8=t,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let t=0;for(let e=0;e<this.chunks.length;e++)t+=this.chunks[e].length;let e=new Uint8Array(t),n=0;for(let t=0;t<this.chunks.length;t++)e.set(this.chunks[t],n),n+=this.chunks[t].length;return this.chunks=[],e}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let t=this.finish(),e=this.stack.pop();if(!e)throw new Error("invalid state, fork stack empty");return this.chunks=e.chunks,this.buf=e.buf,this.uint32(t.byteLength),this.raw(t)}tag(t,e){return this.uint32((t<<3|e)>>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(GE(t);t>127;)this.buf.push(127&t|128),t>>>=7;return this.buf.push(t),this}int32(t){return PE(t),DE(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let e=this.encodeUtf8(t);return this.uint32(e.byteLength),this.raw(e)}float(t){!function(t){if("string"==typeof t){const e=t;if(t=Number(t),Number.isNaN(t)&&"NaN"!==e)throw new Error("invalid float32: "+e)}else if("number"!=typeof t)throw new Error("invalid float32: "+typeof t);if(Number.isFinite(t)&&(t>kE||t<OE))throw new Error("invalid float32: "+t)}(t);let e=new Uint8Array(4);return new DataView(e.buffer).setFloat32(0,t,!0),this.raw(e)}double(t){let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,t,!0),this.raw(e)}fixed32(t){GE(t);let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t,!0),this.raw(e)}sfixed32(t){PE(t);let e=new Uint8Array(4);return new DataView(e.buffer).setInt32(0,t,!0),this.raw(e)}sint32(t){return PE(t),DE(t=(t<<1^t>>31)>>>0,this.buf),this}sfixed64(t){let e=new Uint8Array(8),n=new DataView(e.buffer),r=NE.enc(t);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(e)}fixed64(t){let e=new Uint8Array(8),n=new DataView(e.buffer),r=NE.uEnc(t);return n.setInt32(0,r.lo,!0),n.setInt32(4,r.hi,!0),this.raw(e)}int64(t){let e=NE.enc(t);return wE(e.lo,e.hi,this.buf),this}sint64(t){const e=NE.enc(t),n=e.hi>>31;return wE(e.lo<<1^n,(e.hi<<1|e.lo>>>31)^n,this.buf),this}uint64(t){const e=NE.uEnc(t);return wE(e.lo,e.hi,this.buf),this}}class UE{constructor(t,e=RE().decodeUtf8){this.decodeUtf8=e,this.varint64=mE,this.uint32=vE,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength)}tag(){let t=this.uint32(),e=t>>>3,n=7&t;if(e<=0||n<0||n>5)throw new Error("illegal tag: field no "+e+" wire type "+n);return[e,n]}skip(t,e){let n=this.pos;switch(t){case FE.Varint:for(;128&this.buf[this.pos++];);break;case FE.Bit64:this.pos+=4;case FE.Bit32:this.pos+=4;break;case FE.LengthDelimited:let n=this.uint32();this.pos+=n;break;case FE.StartGroup:for(;;){const[t,n]=this.tag();if(n===FE.EndGroup){if(void 0!==e&&t!==e)throw new Error("invalid end group tag");break}this.skip(n,t)}break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let t=this.uint32();return t>>>1^-(1&t)}int64(){return NE.dec(...this.varint64())}uint64(){return NE.uDec(...this.varint64())}sint64(){let[t,e]=this.varint64(),n=-(1&t);return t=(t>>>1|(1&e)<<31)^n,e=e>>>1^n,NE.dec(t,e)}bool(){let[t,e]=this.varint64();return 0!==t||0!==e}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return NE.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return NE.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),e=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(e,e+t)}string(){return this.decodeUtf8(this.bytes())}}function PE(t){if("string"==typeof t)t=Number(t);else if("number"!=typeof t)throw new Error("invalid int32: "+typeof t);if(!Number.isInteger(t)||t>2147483647||t<-2147483648)throw new Error("invalid int32: "+t)}function GE(t){if("string"==typeof t)t=Number(t);else if("number"!=typeof t)throw new Error("invalid uint32: "+typeof t);if(!Number.isInteger(t)||t>4294967295||t<0)throw new Error("invalid uint32: "+t)}const VE=0,jE=1,HE=2,YE=-1;function zE(t){switch(t){case 0:case"TRANSCRIPT_MESSAGE_SENDER_TYPE_UNKNOWN":return VE;case 1:case"TRANSCRIPT_MESSAGE_SENDER_TYPE_CLIENT":return jE;case 2:case"TRANSCRIPT_MESSAGE_SENDER_TYPE_SERVER":return HE;default:return YE}}const JE=0,WE=1,qE=-1;function KE(t){switch(t){case 0:case"SERVICE_SIGNATURE_TYPE_UNKNOWN":return JE;case 1:case"SERVICE_SIGNATURE_TYPE_ETH":return WE;default:return qE}}const ZE=0,XE=1,$E=2,tm=3,em=4,nm=5,rm=-1;function im(t){switch(t){case 0:case"ATTESTOR_VERSION_UNKNOWN":return ZE;case 1:case"ATTESTOR_VERSION_1_0_0":return XE;case 2:case"ATTESTOR_VERSION_1_1_0":return $E;case 3:case"ATTESTOR_VERSION_2_0_0":return tm;case 4:case"ATTESTOR_VERSION_2_0_1":return em;case 5:case"ATTESTOR_VERSION_3_0_0":return nm;default:return rm}}const om={ERROR_NO_ERROR:0,ERROR_INTERNAL:1,ERROR_BAD_REQUEST:2,ERROR_NOT_FOUND:3,ERROR_PROXY_ERROR:4,ERROR_INVALID_CLAIM:5,ERROR_NETWORK_ERROR:6,ERROR_PAYMENT_REFUSED:7,ERROR_BGP_ANNOUNCEMENT_OVERLAP:8,ERROR_AUTHENTICATION_FAILED:9,ERROR_TIMEOUT:10,ERROR_TOPRF_OUT_OF_BOUNDS:11,ERROR_CERTIFICATE_FETCH_FAILED:12,UNRECOGNIZED:-1};function sm(t){switch(t){case 0:case"ERROR_NO_ERROR":return om.ERROR_NO_ERROR;case 1:case"ERROR_INTERNAL":return om.ERROR_INTERNAL;case 2:case"ERROR_BAD_REQUEST":return om.ERROR_BAD_REQUEST;case 3:case"ERROR_NOT_FOUND":return om.ERROR_NOT_FOUND;case 4:case"ERROR_PROXY_ERROR":return om.ERROR_PROXY_ERROR;case 5:case"ERROR_INVALID_CLAIM":return om.ERROR_INVALID_CLAIM;case 6:case"ERROR_NETWORK_ERROR":return om.ERROR_NETWORK_ERROR;case 7:case"ERROR_PAYMENT_REFUSED":return om.ERROR_PAYMENT_REFUSED;case 8:case"ERROR_BGP_ANNOUNCEMENT_OVERLAP":return om.ERROR_BGP_ANNOUNCEMENT_OVERLAP;case 9:case"ERROR_AUTHENTICATION_FAILED":return om.ERROR_AUTHENTICATION_FAILED;case 10:case"ERROR_TIMEOUT":return om.ERROR_TIMEOUT;case 11:case"ERROR_TOPRF_OUT_OF_BOUNDS":return om.ERROR_TOPRF_OUT_OF_BOUNDS;case 12:case"ERROR_CERTIFICATE_FETCH_FAILED":return om.ERROR_CERTIFICATE_FETCH_FAILED;default:return om.UNRECOGNIZED}}const am=0,cm=1,lm=-1;function um(t){switch(t){case 0:case"ZK_ENGINE_SNARKJS":return am;case 1:case"ZK_ENGINE_GNARK":return cm;default:return lm}}function hm(t){switch(t){case am:return"ZK_ENGINE_SNARKJS";case cm:return"ZK_ENGINE_GNARK";default:return"UNRECOGNIZED"}}const dm={encode:(t,e=new QE)=>(""!==t.provider&&e.uint32(10).string(t.provider),""!==t.parameters&&e.uint32(18).string(t.parameters),""!==t.owner&&e.uint32(26).string(t.owner),0!==t.timestampS&&e.uint32(32).uint32(t.timestampS),""!==t.context&&e.uint32(50).string(t.context),""!==t.identifier&&e.uint32(66).string(t.identifier),0!==t.epoch&&e.uint32(72).uint32(t.epoch),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={provider:"",parameters:"",owner:"",timestampS:0,context:"",identifier:"",epoch:0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.provider=n.string();continue;case 2:if(18!==t)break;i.parameters=n.string();continue;case 3:if(26!==t)break;i.owner=n.string();continue;case 4:if(32!==t)break;i.timestampS=n.uint32();continue;case 6:if(50!==t)break;i.context=n.string();continue;case 8:if(66!==t)break;i.identifier=n.string();continue;case 9:if(72!==t)break;i.epoch=n.uint32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({provider:ww(t.provider)?globalThis.String(t.provider):"",parameters:ww(t.parameters)?globalThis.String(t.parameters):"",owner:ww(t.owner)?globalThis.String(t.owner):"",timestampS:ww(t.timestampS)?globalThis.Number(t.timestampS):0,context:ww(t.context)?globalThis.String(t.context):"",identifier:ww(t.identifier)?globalThis.String(t.identifier):"",epoch:ww(t.epoch)?globalThis.Number(t.epoch):0}),toJSON(t){const e={};return""!==t.provider&&(e.provider=t.provider),""!==t.parameters&&(e.parameters=t.parameters),""!==t.owner&&(e.owner=t.owner),0!==t.timestampS&&(e.timestampS=Math.round(t.timestampS)),""!==t.context&&(e.context=t.context),""!==t.identifier&&(e.identifier=t.identifier),0!==t.epoch&&(e.epoch=Math.round(t.epoch)),e},create:t=>dm.fromPartial(t??{}),fromPartial(t){const e={provider:"",parameters:"",owner:"",timestampS:0,context:"",identifier:"",epoch:0};return e.provider=t.provider??"",e.parameters=t.parameters??"",e.owner=t.owner??"",e.timestampS=t.timestampS??0,e.context=t.context??"",e.identifier=t.identifier??"",e.epoch=t.epoch??0,e}};const pm={encode:(t,e=new QE)=>(0!==t.code&&e.uint32(8).int32(t.code),""!==t.message&&e.uint32(18).string(t.message),""!==t.data&&e.uint32(26).string(t.data),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={code:0,message:"",data:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.code=n.int32();continue;case 2:if(18!==t)break;i.message=n.string();continue;case 3:if(26!==t)break;i.data=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({code:ww(t.code)?sm(t.code):0,message:ww(t.message)?globalThis.String(t.message):"",data:ww(t.data)?globalThis.String(t.data):""}),toJSON(t){const e={};return 0!==t.code&&(e.code=function(t){switch(t){case om.ERROR_NO_ERROR:return"ERROR_NO_ERROR";case om.ERROR_INTERNAL:return"ERROR_INTERNAL";case om.ERROR_BAD_REQUEST:return"ERROR_BAD_REQUEST";case om.ERROR_NOT_FOUND:return"ERROR_NOT_FOUND";case om.ERROR_PROXY_ERROR:return"ERROR_PROXY_ERROR";case om.ERROR_INVALID_CLAIM:return"ERROR_INVALID_CLAIM";case om.ERROR_NETWORK_ERROR:return"ERROR_NETWORK_ERROR";case om.ERROR_PAYMENT_REFUSED:return"ERROR_PAYMENT_REFUSED";case om.ERROR_BGP_ANNOUNCEMENT_OVERLAP:return"ERROR_BGP_ANNOUNCEMENT_OVERLAP";case om.ERROR_AUTHENTICATION_FAILED:return"ERROR_AUTHENTICATION_FAILED";case om.ERROR_TIMEOUT:return"ERROR_TIMEOUT";case om.ERROR_TOPRF_OUT_OF_BOUNDS:return"ERROR_TOPRF_OUT_OF_BOUNDS";case om.ERROR_CERTIFICATE_FETCH_FAILED:return"ERROR_CERTIFICATE_FETCH_FAILED";default:return"UNRECOGNIZED"}}(t.code)),""!==t.message&&(e.message=t.message),""!==t.data&&(e.data=t.data),e},create:t=>pm.fromPartial(t??{}),fromPartial(t){const e={code:0,message:"",data:""};return e.code=t.code??0,e.message=t.message??"",e.data=t.data??"",e}};const fm={encode:(t,e=new QE)=>(0!==t.id&&e.uint32(8).uint32(t.id),""!==t.host&&e.uint32(18).string(t.host),0!==t.port&&e.uint32(24).uint32(t.port),""!==t.geoLocation&&e.uint32(34).string(t.geoLocation),""!==t.proxySessionId&&e.uint32(42).string(t.proxySessionId),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={id:0,host:"",port:0,geoLocation:"",proxySessionId:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.id=n.uint32();continue;case 2:if(18!==t)break;i.host=n.string();continue;case 3:if(24!==t)break;i.port=n.uint32();continue;case 4:if(34!==t)break;i.geoLocation=n.string();continue;case 5:if(42!==t)break;i.proxySessionId=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({id:ww(t.id)?globalThis.Number(t.id):0,host:ww(t.host)?globalThis.String(t.host):"",port:ww(t.port)?globalThis.Number(t.port):0,geoLocation:ww(t.geoLocation)?globalThis.String(t.geoLocation):"",proxySessionId:ww(t.proxySessionId)?globalThis.String(t.proxySessionId):""}),toJSON(t){const e={};return 0!==t.id&&(e.id=Math.round(t.id)),""!==t.host&&(e.host=t.host),0!==t.port&&(e.port=Math.round(t.port)),""!==t.geoLocation&&(e.geoLocation=t.geoLocation),""!==t.proxySessionId&&(e.proxySessionId=t.proxySessionId),e},create:t=>fm.fromPartial(t??{}),fromPartial(t){const e={id:0,host:"",port:0,geoLocation:"",proxySessionId:""};return e.id=t.id??0,e.host=t.host??"",e.port=t.port??0,e.geoLocation=t.geoLocation??"",e.proxySessionId=t.proxySessionId??"",e}};const gm={encode:(t,e=new QE)=>(""!==t.url&&e.uint32(10).string(t.url),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={url:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.url=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({url:ww(t.url)?globalThis.String(t.url):""}),toJSON(t){const e={};return""!==t.url&&(e.url=t.url),e},create:t=>gm.fromPartial(t??{}),fromPartial(t){const e={url:""};return e.url=t.url??"",e}};function Am(){return{bytes:new Uint8Array(0)}}const Em={encode:(t,e=new QE)=>(0!==t.bytes.length&&e.uint32(10).bytes(t.bytes),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Am();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.bytes=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({bytes:ww(t.bytes)?Aw(t.bytes):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.bytes.length&&(e.bytes=Ew(t.bytes)),e},create:t=>Em.fromPartial(t??{}),fromPartial(t){const e=Am();return e.bytes=t.bytes??new Uint8Array(0),e}};const mm={encode:(t,e=new QE)=>(0!==t.id&&e.uint32(8).uint32(t.id),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={id:0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.id=n.uint32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({id:ww(t.id)?globalThis.Number(t.id):0}),toJSON(t){const e={};return 0!==t.id&&(e.id=Math.round(t.id)),e},create:t=>mm.fromPartial(t??{}),fromPartial(t){const e={id:0};return e.id=t.id??0,e}};const wm={encode:(t,e=new QE)=>e,decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={};for(;n.pos<r;){const t=n.uint32();if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({}),toJSON:t=>({}),create:t=>wm.fromPartial(t??{}),fromPartial:t=>({})};function ym(){return{tunnelId:0,message:new Uint8Array(0)}}const Bm={encode:(t,e=new QE)=>(0!==t.tunnelId&&e.uint32(8).uint32(t.tunnelId),0!==t.message.length&&e.uint32(18).bytes(t.message),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=ym();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.tunnelId=n.uint32();continue;case 2:if(18!==t)break;i.message=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({tunnelId:ww(t.tunnelId)?globalThis.Number(t.tunnelId):0,message:ww(t.message)?Aw(t.message):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.tunnelId&&(e.tunnelId=Math.round(t.tunnelId)),0!==t.message.length&&(e.message=Ew(t.message)),e},create:t=>Bm.fromPartial(t??{}),fromPartial(t){const e=ym();return e.tunnelId=t.tunnelId??0,e.message=t.message??new Uint8Array(0),e}};const Im={encode:(t,e=new QE)=>(0!==t.tunnelId&&e.uint32(8).uint32(t.tunnelId),void 0!==t.error&&pm.encode(t.error,e.uint32(18).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={tunnelId:0,error:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.tunnelId=n.uint32();continue;case 2:if(18!==t)break;i.error=pm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({tunnelId:ww(t.tunnelId)?globalThis.Number(t.tunnelId):0,error:ww(t.error)?pm.fromJSON(t.error):void 0}),toJSON(t){const e={};return 0!==t.tunnelId&&(e.tunnelId=Math.round(t.tunnelId)),void 0!==t.error&&(e.error=pm.toJSON(t.error)),e},create:t=>Im.fromPartial(t??{}),fromPartial(t){const e={tunnelId:0,error:void 0};return e.tunnelId=t.tunnelId??0,e.error=void 0!==t.error&&null!==t.error?pm.fromPartial(t.error):void 0,e}};const Cm={encode:(t,e=new QE)=>(void 0!==t.directReveal&&bm.encode(t.directReveal,e.uint32(10).fork()).join(),void 0!==t.zkReveal&&Dm.encode(t.zkReveal,e.uint32(18).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={directReveal:void 0,zkReveal:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.directReveal=bm.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.zkReveal=Dm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({directReveal:ww(t.directReveal)?bm.fromJSON(t.directReveal):void 0,zkReveal:ww(t.zkReveal)?Dm.fromJSON(t.zkReveal):void 0}),toJSON(t){const e={};return void 0!==t.directReveal&&(e.directReveal=bm.toJSON(t.directReveal)),void 0!==t.zkReveal&&(e.zkReveal=Dm.toJSON(t.zkReveal)),e},create:t=>Cm.fromPartial(t??{}),fromPartial(t){const e={directReveal:void 0,zkReveal:void 0};return e.directReveal=void 0!==t.directReveal&&null!==t.directReveal?bm.fromPartial(t.directReveal):void 0,e.zkReveal=void 0!==t.zkReveal&&null!==t.zkReveal?Dm.fromPartial(t.zkReveal):void 0,e}};function Tm(){return{key:new Uint8Array(0),iv:new Uint8Array(0),recordNumber:0}}const bm={encode:(t,e=new QE)=>(0!==t.key.length&&e.uint32(10).bytes(t.key),0!==t.iv.length&&e.uint32(18).bytes(t.iv),0!==t.recordNumber&&e.uint32(24).uint32(t.recordNumber),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Tm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.key=n.bytes();continue;case 2:if(18!==t)break;i.iv=n.bytes();continue;case 3:if(24!==t)break;i.recordNumber=n.uint32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({key:ww(t.key)?Aw(t.key):new Uint8Array(0),iv:ww(t.iv)?Aw(t.iv):new Uint8Array(0),recordNumber:ww(t.recordNumber)?globalThis.Number(t.recordNumber):0}),toJSON(t){const e={};return 0!==t.key.length&&(e.key=Ew(t.key)),0!==t.iv.length&&(e.iv=Ew(t.iv)),0!==t.recordNumber&&(e.recordNumber=Math.round(t.recordNumber)),e},create:t=>bm.fromPartial(t??{}),fromPartial(t){const e=Tm();return e.key=t.key??new Uint8Array(0),e.iv=t.iv??new Uint8Array(0),e.recordNumber=t.recordNumber??0,e}};const Dm={encode(t,e=new QE){for(const n of t.proofs)Mm.encode(n,e.uint32(10).fork()).join();for(const n of t.toprfs)Sm.encode(n,e.uint32(18).fork()).join();return e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={proofs:[],toprfs:[]};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.proofs.push(Mm.decode(n,n.uint32()));continue;case 2:if(18!==t)break;i.toprfs.push(Sm.decode(n,n.uint32()));continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({proofs:globalThis.Array.isArray(t?.proofs)?t.proofs.map(t=>Mm.fromJSON(t)):[],toprfs:globalThis.Array.isArray(t?.toprfs)?t.toprfs.map(t=>Sm.fromJSON(t)):[]}),toJSON(t){const e={};return t.proofs?.length&&(e.proofs=t.proofs.map(t=>Mm.toJSON(t))),t.toprfs?.length&&(e.toprfs=t.toprfs.map(t=>Sm.toJSON(t))),e},create:t=>Dm.fromPartial(t??{}),fromPartial(t){const e={proofs:[],toprfs:[]};return e.proofs=t.proofs?.map(t=>Mm.fromPartial(t))||[],e.toprfs=t.toprfs?.map(t=>Sm.fromPartial(t))||[],e}};function vm(){return{decryptedRedactedCiphertext:new Uint8Array(0),redactedPlaintext:new Uint8Array(0),startIdx:0,proofData:new Uint8Array(0)}}const Mm={encode:(t,e=new QE)=>(0!==t.decryptedRedactedCiphertext.length&&e.uint32(18).bytes(t.decryptedRedactedCiphertext),0!==t.redactedPlaintext.length&&e.uint32(26).bytes(t.redactedPlaintext),0!==t.startIdx&&e.uint32(32).uint32(t.startIdx),0!==t.proofData.length&&e.uint32(42).bytes(t.proofData),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=vm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 2:if(18!==t)break;i.decryptedRedactedCiphertext=n.bytes();continue;case 3:if(26!==t)break;i.redactedPlaintext=n.bytes();continue;case 4:if(32!==t)break;i.startIdx=n.uint32();continue;case 5:if(42!==t)break;i.proofData=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({decryptedRedactedCiphertext:ww(t.decryptedRedactedCiphertext)?Aw(t.decryptedRedactedCiphertext):new Uint8Array(0),redactedPlaintext:ww(t.redactedPlaintext)?Aw(t.redactedPlaintext):new Uint8Array(0),startIdx:ww(t.startIdx)?globalThis.Number(t.startIdx):0,proofData:ww(t.proofData)?Aw(t.proofData):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.decryptedRedactedCiphertext.length&&(e.decryptedRedactedCiphertext=Ew(t.decryptedRedactedCiphertext)),0!==t.redactedPlaintext.length&&(e.redactedPlaintext=Ew(t.redactedPlaintext)),0!==t.startIdx&&(e.startIdx=Math.round(t.startIdx)),0!==t.proofData.length&&(e.proofData=Ew(t.proofData)),e},create:t=>Mm.fromPartial(t??{}),fromPartial(t){const e=vm();return e.decryptedRedactedCiphertext=t.decryptedRedactedCiphertext??new Uint8Array(0),e.redactedPlaintext=t.redactedPlaintext??new Uint8Array(0),e.startIdx=t.startIdx??0,e.proofData=t.proofData??new Uint8Array(0),e}};function Nm(){return{startIdx:0,proofData:new Uint8Array(0),payload:void 0}}const Sm={encode:(t,e=new QE)=>(0!==t.startIdx&&e.uint32(8).uint32(t.startIdx),0!==t.proofData.length&&e.uint32(18).bytes(t.proofData),void 0!==t.payload&&Lm.encode(t.payload,e.uint32(26).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Nm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.startIdx=n.uint32();continue;case 2:if(18!==t)break;i.proofData=n.bytes();continue;case 3:if(26!==t)break;i.payload=Lm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({startIdx:ww(t.startIdx)?globalThis.Number(t.startIdx):0,proofData:ww(t.proofData)?Aw(t.proofData):new Uint8Array(0),payload:ww(t.payload)?Lm.fromJSON(t.payload):void 0}),toJSON(t){const e={};return 0!==t.startIdx&&(e.startIdx=Math.round(t.startIdx)),0!==t.proofData.length&&(e.proofData=Ew(t.proofData)),void 0!==t.payload&&(e.payload=Lm.toJSON(t.payload)),e},create:t=>Sm.fromPartial(t??{}),fromPartial(t){const e=Nm();return e.startIdx=t.startIdx??0,e.proofData=t.proofData??new Uint8Array(0),e.payload=void 0!==t.payload&&null!==t.payload?Lm.fromPartial(t.payload):void 0,e}};function _m(){return{dataLocation:void 0,nullifier:new Uint8Array(0),responses:[]}}const Lm={encode(t,e=new QE){void 0!==t.dataLocation&&xm.encode(t.dataLocation,e.uint32(10).fork()).join(),0!==t.nullifier.length&&e.uint32(18).bytes(t.nullifier);for(const n of t.responses)pw.encode(n,e.uint32(26).fork()).join();return e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=_m();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.dataLocation=xm.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.nullifier=n.bytes();continue;case 3:if(26!==t)break;i.responses.push(pw.decode(n,n.uint32()));continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({dataLocation:ww(t.dataLocation)?xm.fromJSON(t.dataLocation):void 0,nullifier:ww(t.nullifier)?Aw(t.nullifier):new Uint8Array(0),responses:globalThis.Array.isArray(t?.responses)?t.responses.map(t=>pw.fromJSON(t)):[]}),toJSON(t){const e={};return void 0!==t.dataLocation&&(e.dataLocation=xm.toJSON(t.dataLocation)),0!==t.nullifier.length&&(e.nullifier=Ew(t.nullifier)),t.responses?.length&&(e.responses=t.responses.map(t=>pw.toJSON(t))),e},create:t=>Lm.fromPartial(t??{}),fromPartial(t){const e=_m();return e.dataLocation=void 0!==t.dataLocation&&null!==t.dataLocation?xm.fromPartial(t.dataLocation):void 0,e.nullifier=t.nullifier??new Uint8Array(0),e.responses=t.responses?.map(t=>pw.fromPartial(t))||[],e}};const xm={encode:(t,e=new QE)=>(0!==t.fromIndex&&e.uint32(8).uint32(t.fromIndex),0!==t.length&&e.uint32(16).uint32(t.length),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={fromIndex:0,length:0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.fromIndex=n.uint32();continue;case 2:if(16!==t)break;i.length=n.uint32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({fromIndex:ww(t.fromIndex)?globalThis.Number(t.fromIndex):0,length:ww(t.length)?globalThis.Number(t.length):0}),toJSON(t){const e={};return 0!==t.fromIndex&&(e.fromIndex=Math.round(t.fromIndex)),0!==t.length&&(e.length=Math.round(t.length)),e},create:t=>xm.fromPartial(t??{}),fromPartial(t){const e={fromIndex:0,length:0};return e.fromIndex=t.fromIndex??0,e.length=t.length??0,e}};const Rm={encode:(t,e=new QE)=>(""!==t.provider&&e.uint32(10).string(t.provider),""!==t.parameters&&e.uint32(18).string(t.parameters),""!==t.owner&&e.uint32(26).string(t.owner),0!==t.timestampS&&e.uint32(32).uint32(t.timestampS),""!==t.context&&e.uint32(42).string(t.context),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={provider:"",parameters:"",owner:"",timestampS:0,context:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.provider=n.string();continue;case 2:if(18!==t)break;i.parameters=n.string();continue;case 3:if(26!==t)break;i.owner=n.string();continue;case 4:if(32!==t)break;i.timestampS=n.uint32();continue;case 5:if(42!==t)break;i.context=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({provider:ww(t.provider)?globalThis.String(t.provider):"",parameters:ww(t.parameters)?globalThis.String(t.parameters):"",owner:ww(t.owner)?globalThis.String(t.owner):"",timestampS:ww(t.timestampS)?globalThis.Number(t.timestampS):0,context:ww(t.context)?globalThis.String(t.context):""}),toJSON(t){const e={};return""!==t.provider&&(e.provider=t.provider),""!==t.parameters&&(e.parameters=t.parameters),""!==t.owner&&(e.owner=t.owner),0!==t.timestampS&&(e.timestampS=Math.round(t.timestampS)),""!==t.context&&(e.context=t.context),e},create:t=>Rm.fromPartial(t??{}),fromPartial(t){const e={provider:"",parameters:"",owner:"",timestampS:0,context:""};return e.provider=t.provider??"",e.parameters=t.parameters??"",e.owner=t.owner??"",e.timestampS=t.timestampS??0,e.context=t.context??"",e}};function Fm(){return{verificationBundle:new Uint8Array(0),data:void 0,signatures:void 0}}const km={encode:(t,e=new QE)=>(0!==t.verificationBundle.length&&e.uint32(10).bytes(t.verificationBundle),void 0!==t.data&&Rm.encode(t.data,e.uint32(18).fork()).join(),void 0!==t.signatures&&Qm.encode(t.signatures,e.uint32(26).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Fm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.verificationBundle=n.bytes();continue;case 2:if(18!==t)break;i.data=Rm.decode(n,n.uint32());continue;case 3:if(26!==t)break;i.signatures=Qm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({verificationBundle:ww(t.verificationBundle)?Aw(t.verificationBundle):new Uint8Array(0),data:ww(t.data)?Rm.fromJSON(t.data):void 0,signatures:ww(t.signatures)?Qm.fromJSON(t.signatures):void 0}),toJSON(t){const e={};return 0!==t.verificationBundle.length&&(e.verificationBundle=Ew(t.verificationBundle)),void 0!==t.data&&(e.data=Rm.toJSON(t.data)),void 0!==t.signatures&&(e.signatures=Qm.toJSON(t.signatures)),e},create:t=>km.fromPartial(t??{}),fromPartial(t){const e=Fm();return e.verificationBundle=t.verificationBundle??new Uint8Array(0),e.data=void 0!==t.data&&null!==t.data?Rm.fromPartial(t.data):void 0,e.signatures=void 0!==t.signatures&&null!==t.signatures?Qm.fromPartial(t.signatures):void 0,e}};function Om(){return{requestSignature:new Uint8Array(0)}}const Qm={encode:(t,e=new QE)=>(0!==t.requestSignature.length&&e.uint32(10).bytes(t.requestSignature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Om();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.requestSignature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({requestSignature:ww(t.requestSignature)?Aw(t.requestSignature):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.requestSignature.length&&(e.requestSignature=Ew(t.requestSignature)),e},create:t=>Qm.fromPartial(t??{}),fromPartial(t){const e=Om();return e.requestSignature=t.requestSignature??new Uint8Array(0),e}};const Um={encode:(t,e=new QE)=>(void 0!==t.request&&km.encode(t.request,e.uint32(10).fork()).join(),void 0!==t.claim&&dm.encode(t.claim,e.uint32(18).fork()).join(),void 0!==t.error&&pm.encode(t.error,e.uint32(26).fork()).join(),void 0!==t.signatures&&Gm.encode(t.signatures,e.uint32(34).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={request:void 0,claim:void 0,error:void 0,signatures:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.request=km.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.claim=dm.decode(n,n.uint32());continue;case 3:if(26!==t)break;i.error=pm.decode(n,n.uint32());continue;case 4:if(34!==t)break;i.signatures=Gm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({request:ww(t.request)?km.fromJSON(t.request):void 0,claim:ww(t.claim)?dm.fromJSON(t.claim):void 0,error:ww(t.error)?pm.fromJSON(t.error):void 0,signatures:ww(t.signatures)?Gm.fromJSON(t.signatures):void 0}),toJSON(t){const e={};return void 0!==t.request&&(e.request=km.toJSON(t.request)),void 0!==t.claim&&(e.claim=dm.toJSON(t.claim)),void 0!==t.error&&(e.error=pm.toJSON(t.error)),void 0!==t.signatures&&(e.signatures=Gm.toJSON(t.signatures)),e},create:t=>Um.fromPartial(t??{}),fromPartial(t){const e={request:void 0,claim:void 0,error:void 0,signatures:void 0};return e.request=void 0!==t.request&&null!==t.request?km.fromPartial(t.request):void 0,e.claim=void 0!==t.claim&&null!==t.claim?dm.fromPartial(t.claim):void 0,e.error=void 0!==t.error&&null!==t.error?pm.fromPartial(t.error):void 0,e.signatures=void 0!==t.signatures&&null!==t.signatures?Gm.fromPartial(t.signatures):void 0,e}};function Pm(){return{attestorAddress:"",claimSignature:new Uint8Array(0),resultSignature:new Uint8Array(0)}}const Gm={encode:(t,e=new QE)=>(""!==t.attestorAddress&&e.uint32(10).string(t.attestorAddress),0!==t.claimSignature.length&&e.uint32(18).bytes(t.claimSignature),0!==t.resultSignature.length&&e.uint32(26).bytes(t.resultSignature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Pm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.attestorAddress=n.string();continue;case 2:if(18!==t)break;i.claimSignature=n.bytes();continue;case 3:if(26!==t)break;i.resultSignature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({attestorAddress:ww(t.attestorAddress)?globalThis.String(t.attestorAddress):"",claimSignature:ww(t.claimSignature)?Aw(t.claimSignature):new Uint8Array(0),resultSignature:ww(t.resultSignature)?Aw(t.resultSignature):new Uint8Array(0)}),toJSON(t){const e={};return""!==t.attestorAddress&&(e.attestorAddress=t.attestorAddress),0!==t.claimSignature.length&&(e.claimSignature=Ew(t.claimSignature)),0!==t.resultSignature.length&&(e.resultSignature=Ew(t.resultSignature)),e},create:t=>Gm.fromPartial(t??{}),fromPartial(t){const e=Pm();return e.attestorAddress=t.attestorAddress??"",e.claimSignature=t.claimSignature??new Uint8Array(0),e.resultSignature=t.resultSignature??new Uint8Array(0),e}};function Vm(){return{request:void 0,data:void 0,transcript:[],signatures:void 0,zkEngine:0,fixedServerIV:new Uint8Array(0),fixedClientIV:new Uint8Array(0)}}const jm={encode(t,e=new QE){void 0!==t.request&&fm.encode(t.request,e.uint32(10).fork()).join(),void 0!==t.data&&Rm.encode(t.data,e.uint32(18).fork()).join();for(const n of t.transcript)Jm.encode(n,e.uint32(26).fork()).join();return void 0!==t.signatures&&Ym.encode(t.signatures,e.uint32(34).fork()).join(),0!==t.zkEngine&&e.uint32(40).int32(t.zkEngine),0!==t.fixedServerIV.length&&e.uint32(50).bytes(t.fixedServerIV),0!==t.fixedClientIV.length&&e.uint32(58).bytes(t.fixedClientIV),e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Vm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.request=fm.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.data=Rm.decode(n,n.uint32());continue;case 3:if(26!==t)break;i.transcript.push(Jm.decode(n,n.uint32()));continue;case 4:if(34!==t)break;i.signatures=Ym.decode(n,n.uint32());continue;case 5:if(40!==t)break;i.zkEngine=n.int32();continue;case 6:if(50!==t)break;i.fixedServerIV=n.bytes();continue;case 7:if(58!==t)break;i.fixedClientIV=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({request:ww(t.request)?fm.fromJSON(t.request):void 0,data:ww(t.data)?Rm.fromJSON(t.data):void 0,transcript:globalThis.Array.isArray(t?.transcript)?t.transcript.map(t=>Jm.fromJSON(t)):[],signatures:ww(t.signatures)?Ym.fromJSON(t.signatures):void 0,zkEngine:ww(t.zkEngine)?um(t.zkEngine):0,fixedServerIV:ww(t.fixedServerIV)?Aw(t.fixedServerIV):new Uint8Array(0),fixedClientIV:ww(t.fixedClientIV)?Aw(t.fixedClientIV):new Uint8Array(0)}),toJSON(t){const e={};return void 0!==t.request&&(e.request=fm.toJSON(t.request)),void 0!==t.data&&(e.data=Rm.toJSON(t.data)),t.transcript?.length&&(e.transcript=t.transcript.map(t=>Jm.toJSON(t))),void 0!==t.signatures&&(e.signatures=Ym.toJSON(t.signatures)),0!==t.zkEngine&&(e.zkEngine=hm(t.zkEngine)),0!==t.fixedServerIV.length&&(e.fixedServerIV=Ew(t.fixedServerIV)),0!==t.fixedClientIV.length&&(e.fixedClientIV=Ew(t.fixedClientIV)),e},create:t=>jm.fromPartial(t??{}),fromPartial(t){const e=Vm();return e.request=void 0!==t.request&&null!==t.request?fm.fromPartial(t.request):void 0,e.data=void 0!==t.data&&null!==t.data?Rm.fromPartial(t.data):void 0,e.transcript=t.transcript?.map(t=>Jm.fromPartial(t))||[],e.signatures=void 0!==t.signatures&&null!==t.signatures?Ym.fromPartial(t.signatures):void 0,e.zkEngine=t.zkEngine??0,e.fixedServerIV=t.fixedServerIV??new Uint8Array(0),e.fixedClientIV=t.fixedClientIV??new Uint8Array(0),e}};function Hm(){return{requestSignature:new Uint8Array(0)}}const Ym={encode:(t,e=new QE)=>(0!==t.requestSignature.length&&e.uint32(10).bytes(t.requestSignature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Hm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.requestSignature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({requestSignature:ww(t.requestSignature)?Aw(t.requestSignature):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.requestSignature.length&&(e.requestSignature=Ew(t.requestSignature)),e},create:t=>Ym.fromPartial(t??{}),fromPartial(t){const e=Hm();return e.requestSignature=t.requestSignature??new Uint8Array(0),e}};function zm(){return{sender:0,message:new Uint8Array(0),reveal:void 0}}const Jm={encode:(t,e=new QE)=>(0!==t.sender&&e.uint32(8).int32(t.sender),0!==t.message.length&&e.uint32(18).bytes(t.message),void 0!==t.reveal&&Cm.encode(t.reveal,e.uint32(26).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=zm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.sender=n.int32();continue;case 2:if(18!==t)break;i.message=n.bytes();continue;case 3:if(26!==t)break;i.reveal=Cm.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({sender:ww(t.sender)?zE(t.sender):0,message:ww(t.message)?Aw(t.message):new Uint8Array(0),reveal:ww(t.reveal)?Cm.fromJSON(t.reveal):void 0}),toJSON(t){const e={};return 0!==t.sender&&(e.sender=function(t){switch(t){case VE:return"TRANSCRIPT_MESSAGE_SENDER_TYPE_UNKNOWN";case jE:return"TRANSCRIPT_MESSAGE_SENDER_TYPE_CLIENT";case HE:return"TRANSCRIPT_MESSAGE_SENDER_TYPE_SERVER";default:return"UNRECOGNIZED"}}(t.sender)),0!==t.message.length&&(e.message=Ew(t.message)),void 0!==t.reveal&&(e.reveal=Cm.toJSON(t.reveal)),e},create:t=>Jm.fromPartial(t??{}),fromPartial(t){const e=zm();return e.sender=t.sender??0,e.message=t.message??new Uint8Array(0),e.reveal=void 0!==t.reveal&&null!==t.reveal?Cm.fromPartial(t.reveal):void 0,e}};const Wm={encode:(t,e=new QE)=>(void 0!==t.request&&jm.encode(t.request,e.uint32(10).fork()).join(),void 0!==t.claim&&dm.encode(t.claim,e.uint32(18).fork()).join(),void 0!==t.error&&pm.encode(t.error,e.uint32(26).fork()).join(),void 0!==t.signatures&&Km.encode(t.signatures,e.uint32(34).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={request:void 0,claim:void 0,error:void 0,signatures:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.request=jm.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.claim=dm.decode(n,n.uint32());continue;case 3:if(26!==t)break;i.error=pm.decode(n,n.uint32());continue;case 4:if(34!==t)break;i.signatures=Km.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({request:ww(t.request)?jm.fromJSON(t.request):void 0,claim:ww(t.claim)?dm.fromJSON(t.claim):void 0,error:ww(t.error)?pm.fromJSON(t.error):void 0,signatures:ww(t.signatures)?Km.fromJSON(t.signatures):void 0}),toJSON(t){const e={};return void 0!==t.request&&(e.request=jm.toJSON(t.request)),void 0!==t.claim&&(e.claim=dm.toJSON(t.claim)),void 0!==t.error&&(e.error=pm.toJSON(t.error)),void 0!==t.signatures&&(e.signatures=Km.toJSON(t.signatures)),e},create:t=>Wm.fromPartial(t??{}),fromPartial(t){const e={request:void 0,claim:void 0,error:void 0,signatures:void 0};return e.request=void 0!==t.request&&null!==t.request?jm.fromPartial(t.request):void 0,e.claim=void 0!==t.claim&&null!==t.claim?dm.fromPartial(t.claim):void 0,e.error=void 0!==t.error&&null!==t.error?pm.fromPartial(t.error):void 0,e.signatures=void 0!==t.signatures&&null!==t.signatures?Km.fromPartial(t.signatures):void 0,e}};function qm(){return{attestorAddress:"",claimSignature:new Uint8Array(0),resultSignature:new Uint8Array(0)}}const Km={encode:(t,e=new QE)=>(""!==t.attestorAddress&&e.uint32(10).string(t.attestorAddress),0!==t.claimSignature.length&&e.uint32(18).bytes(t.claimSignature),0!==t.resultSignature.length&&e.uint32(26).bytes(t.resultSignature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=qm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.attestorAddress=n.string();continue;case 2:if(18!==t)break;i.claimSignature=n.bytes();continue;case 3:if(26!==t)break;i.resultSignature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({attestorAddress:ww(t.attestorAddress)?globalThis.String(t.attestorAddress):"",claimSignature:ww(t.claimSignature)?Aw(t.claimSignature):new Uint8Array(0),resultSignature:ww(t.resultSignature)?Aw(t.resultSignature):new Uint8Array(0)}),toJSON(t){const e={};return""!==t.attestorAddress&&(e.attestorAddress=t.attestorAddress),0!==t.claimSignature.length&&(e.claimSignature=Ew(t.claimSignature)),0!==t.resultSignature.length&&(e.resultSignature=Ew(t.resultSignature)),e},create:t=>Km.fromPartial(t??{}),fromPartial(t){const e=qm();return e.attestorAddress=t.attestorAddress??"",e.claimSignature=t.claimSignature??new Uint8Array(0),e.resultSignature=t.resultSignature??new Uint8Array(0),e}};function Zm(){return{chainId:0,jsonCreateClaimRequest:"",requestSignature:new Uint8Array(0)}}const Xm={encode:(t,e=new QE)=>(0!==t.chainId&&e.uint32(8).uint32(t.chainId),""!==t.jsonCreateClaimRequest&&e.uint32(18).string(t.jsonCreateClaimRequest),0!==t.requestSignature.length&&e.uint32(26).bytes(t.requestSignature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=Zm();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.chainId=n.uint32();continue;case 2:if(18!==t)break;i.jsonCreateClaimRequest=n.string();continue;case 3:if(26!==t)break;i.requestSignature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({chainId:ww(t.chainId)?globalThis.Number(t.chainId):0,jsonCreateClaimRequest:ww(t.jsonCreateClaimRequest)?globalThis.String(t.jsonCreateClaimRequest):"",requestSignature:ww(t.requestSignature)?Aw(t.requestSignature):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.chainId&&(e.chainId=Math.round(t.chainId)),""!==t.jsonCreateClaimRequest&&(e.jsonCreateClaimRequest=t.jsonCreateClaimRequest),0!==t.requestSignature.length&&(e.requestSignature=Ew(t.requestSignature)),e},create:t=>Xm.fromPartial(t??{}),fromPartial(t){const e=Zm();return e.chainId=t.chainId??0,e.jsonCreateClaimRequest=t.jsonCreateClaimRequest??"",e.requestSignature=t.requestSignature??new Uint8Array(0),e}};const $m={encode:(t,e=new QE)=>(""!==t.txHash&&e.uint32(10).string(t.txHash),0!==t.taskIndex&&e.uint32(16).uint32(t.taskIndex),""!==t.jsonTask&&e.uint32(26).string(t.jsonTask),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={txHash:"",taskIndex:0,jsonTask:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.txHash=n.string();continue;case 2:if(16!==t)break;i.taskIndex=n.uint32();continue;case 3:if(26!==t)break;i.jsonTask=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({txHash:ww(t.txHash)?globalThis.String(t.txHash):"",taskIndex:ww(t.taskIndex)?globalThis.Number(t.taskIndex):0,jsonTask:ww(t.jsonTask)?globalThis.String(t.jsonTask):""}),toJSON(t){const e={};return""!==t.txHash&&(e.txHash=t.txHash),0!==t.taskIndex&&(e.taskIndex=Math.round(t.taskIndex)),""!==t.jsonTask&&(e.jsonTask=t.jsonTask),e},create:t=>$m.fromPartial(t??{}),fromPartial(t){const e={txHash:"",taskIndex:0,jsonTask:""};return e.txHash=t.txHash??"",e.taskIndex=t.taskIndex??0,e.jsonTask=t.jsonTask??"",e}};const tw={encode:(t,e=new QE)=>(0!==t.chainId&&e.uint32(8).uint32(t.chainId),0!==t.taskIndex&&e.uint32(16).uint32(t.taskIndex),""!==t.completedTaskJson&&e.uint32(26).string(t.completedTaskJson),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={chainId:0,taskIndex:0,completedTaskJson:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.chainId=n.uint32();continue;case 2:if(16!==t)break;i.taskIndex=n.uint32();continue;case 3:if(26!==t)break;i.completedTaskJson=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({chainId:ww(t.chainId)?globalThis.Number(t.chainId):0,taskIndex:ww(t.taskIndex)?globalThis.Number(t.taskIndex):0,completedTaskJson:ww(t.completedTaskJson)?globalThis.String(t.completedTaskJson):""}),toJSON(t){const e={};return 0!==t.chainId&&(e.chainId=Math.round(t.chainId)),0!==t.taskIndex&&(e.taskIndex=Math.round(t.taskIndex)),""!==t.completedTaskJson&&(e.completedTaskJson=t.completedTaskJson),e},create:t=>tw.fromPartial(t??{}),fromPartial(t){const e={chainId:0,taskIndex:0,completedTaskJson:""};return e.chainId=t.chainId??0,e.taskIndex=t.taskIndex??0,e.completedTaskJson=t.completedTaskJson??"",e}};const ew={encode:(t,e=new QE)=>(""!==t.txHash&&e.uint32(10).string(t.txHash),""!==t.taskCompletedObjectJson&&e.uint32(18).string(t.taskCompletedObjectJson),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={txHash:"",taskCompletedObjectJson:""};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.txHash=n.string();continue;case 2:if(18!==t)break;i.taskCompletedObjectJson=n.string();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({txHash:ww(t.txHash)?globalThis.String(t.txHash):"",taskCompletedObjectJson:ww(t.taskCompletedObjectJson)?globalThis.String(t.taskCompletedObjectJson):""}),toJSON(t){const e={};return""!==t.txHash&&(e.txHash=t.txHash),""!==t.taskCompletedObjectJson&&(e.taskCompletedObjectJson=t.taskCompletedObjectJson),e},create:t=>ew.fromPartial(t??{}),fromPartial(t){const e={txHash:"",taskCompletedObjectJson:""};return e.txHash=t.txHash??"",e.taskCompletedObjectJson=t.taskCompletedObjectJson??"",e}};const nw={encode:(t,e=new QE)=>(0!==t.timestamp&&e.uint32(8).uint32(t.timestamp),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={timestamp:0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.timestamp=n.uint32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({timestamp:ww(t.timestamp)?globalThis.Number(t.timestamp):0}),toJSON(t){const e={};return 0!==t.timestamp&&(e.timestamp=Math.round(t.timestamp)),e},create:t=>nw.fromPartial(t??{}),fromPartial(t){const e={timestamp:0};return e.timestamp=t.timestamp??0,e}};const rw={encode(t,e=new QE){0!==t.taskId&&e.uint32(8).uint32(t.taskId),0!==t.requiredAttestors&&e.uint32(16).uint32(t.requiredAttestors);for(const n of t.hosts)e.uint32(26).string(n);return e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={taskId:0,requiredAttestors:0,hosts:[]};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.taskId=n.uint32();continue;case 2:if(16!==t)break;i.requiredAttestors=n.uint32();continue;case 3:if(26!==t)break;i.hosts.push(n.string());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({taskId:ww(t.taskId)?globalThis.Number(t.taskId):0,requiredAttestors:ww(t.requiredAttestors)?globalThis.Number(t.requiredAttestors):0,hosts:globalThis.Array.isArray(t?.hosts)?t.hosts.map(t=>globalThis.String(t)):[]}),toJSON(t){const e={};return 0!==t.taskId&&(e.taskId=Math.round(t.taskId)),0!==t.requiredAttestors&&(e.requiredAttestors=Math.round(t.requiredAttestors)),t.hosts?.length&&(e.hosts=t.hosts),e},create:t=>rw.fromPartial(t??{}),fromPartial(t){const e={taskId:0,requiredAttestors:0,hosts:[]};return e.taskId=t.taskId??0,e.requiredAttestors=t.requiredAttestors??0,e.hosts=t.hosts?.map(t=>t)||[],e}};const iw={encode(t,e=new QE){""!==t.id&&e.uint32(10).string(t.id),0!==t.createdAt&&e.uint32(16).uint32(t.createdAt),0!==t.expiresAt&&e.uint32(24).uint32(t.expiresAt);for(const n of t.hostWhitelist)e.uint32(34).string(n);return e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={id:"",createdAt:0,expiresAt:0,hostWhitelist:[]};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.id=n.string();continue;case 2:if(16!==t)break;i.createdAt=n.uint32();continue;case 3:if(24!==t)break;i.expiresAt=n.uint32();continue;case 4:if(34!==t)break;i.hostWhitelist.push(n.string());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({id:ww(t.id)?globalThis.String(t.id):"",createdAt:ww(t.createdAt)?globalThis.Number(t.createdAt):0,expiresAt:ww(t.expiresAt)?globalThis.Number(t.expiresAt):0,hostWhitelist:globalThis.Array.isArray(t?.hostWhitelist)?t.hostWhitelist.map(t=>globalThis.String(t)):[]}),toJSON(t){const e={};return""!==t.id&&(e.id=t.id),0!==t.createdAt&&(e.createdAt=Math.round(t.createdAt)),0!==t.expiresAt&&(e.expiresAt=Math.round(t.expiresAt)),t.hostWhitelist?.length&&(e.hostWhitelist=t.hostWhitelist),e},create:t=>iw.fromPartial(t??{}),fromPartial(t){const e={id:"",createdAt:0,expiresAt:0,hostWhitelist:[]};return e.id=t.id??"",e.createdAt=t.createdAt??0,e.expiresAt=t.expiresAt??0,e.hostWhitelist=t.hostWhitelist?.map(t=>t)||[],e}};function ow(){return{data:void 0,signature:new Uint8Array(0)}}const sw={encode:(t,e=new QE)=>(void 0!==t.data&&iw.encode(t.data,e.uint32(10).fork()).join(),0!==t.signature.length&&e.uint32(18).bytes(t.signature),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=ow();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.data=iw.decode(n,n.uint32());continue;case 2:if(18!==t)break;i.signature=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({data:ww(t.data)?iw.fromJSON(t.data):void 0,signature:ww(t.signature)?Aw(t.signature):new Uint8Array(0)}),toJSON(t){const e={};return void 0!==t.data&&(e.data=iw.toJSON(t.data)),0!==t.signature.length&&(e.signature=Ew(t.signature)),e},create:t=>sw.fromPartial(t??{}),fromPartial(t){const e=ow();return e.data=void 0!==t.data&&null!==t.data?iw.fromPartial(t.data):void 0,e.signature=t.signature??new Uint8Array(0),e}};const aw={encode:(t,e=new QE)=>(0!==t.clientVersion&&e.uint32(16).int32(t.clientVersion),0!==t.signatureType&&e.uint32(24).int32(t.signatureType),void 0!==t.auth&&sw.encode(t.auth,e.uint32(34).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={clientVersion:0,signatureType:0,auth:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 2:if(16!==t)break;i.clientVersion=n.int32();continue;case 3:if(24!==t)break;i.signatureType=n.int32();continue;case 4:if(34!==t)break;i.auth=sw.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({clientVersion:ww(t.clientVersion)?im(t.clientVersion):0,signatureType:ww(t.signatureType)?KE(t.signatureType):0,auth:ww(t.auth)?sw.fromJSON(t.auth):void 0}),toJSON(t){const e={};return 0!==t.clientVersion&&(e.clientVersion=function(t){switch(t){case ZE:return"ATTESTOR_VERSION_UNKNOWN";case XE:return"ATTESTOR_VERSION_1_0_0";case $E:return"ATTESTOR_VERSION_1_1_0";case tm:return"ATTESTOR_VERSION_2_0_0";case em:return"ATTESTOR_VERSION_2_0_1";case nm:return"ATTESTOR_VERSION_3_0_0";default:return"UNRECOGNIZED"}}(t.clientVersion)),0!==t.signatureType&&(e.signatureType=function(t){switch(t){case JE:return"SERVICE_SIGNATURE_TYPE_UNKNOWN";case WE:return"SERVICE_SIGNATURE_TYPE_ETH";default:return"UNRECOGNIZED"}}(t.signatureType)),void 0!==t.auth&&(e.auth=sw.toJSON(t.auth)),e},create:t=>aw.fromPartial(t??{}),fromPartial(t){const e={clientVersion:0,signatureType:0,auth:void 0};return e.clientVersion=t.clientVersion??0,e.signatureType=t.signatureType??0,e.auth=void 0!==t.auth&&null!==t.auth?sw.fromPartial(t.auth):void 0,e}};function cw(){return{toprfPublicKey:new Uint8Array(0)}}const lw={encode:(t,e=new QE)=>(0!==t.toprfPublicKey.length&&e.uint32(10).bytes(t.toprfPublicKey),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=cw();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.toprfPublicKey=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({toprfPublicKey:ww(t.toprfPublicKey)?Aw(t.toprfPublicKey):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.toprfPublicKey.length&&(e.toprfPublicKey=Ew(t.toprfPublicKey)),e},create:t=>lw.fromPartial(t??{}),fromPartial(t){const e=cw();return e.toprfPublicKey=t.toprfPublicKey??new Uint8Array(0),e}};function uw(){return{maskedData:new Uint8Array(0),engine:0}}const hw={encode:(t,e=new QE)=>(0!==t.maskedData.length&&e.uint32(10).bytes(t.maskedData),0!==t.engine&&e.uint32(16).int32(t.engine),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=uw();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.maskedData=n.bytes();continue;case 2:if(16!==t)break;i.engine=n.int32();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({maskedData:ww(t.maskedData)?Aw(t.maskedData):new Uint8Array(0),engine:ww(t.engine)?um(t.engine):0}),toJSON(t){const e={};return 0!==t.maskedData.length&&(e.maskedData=Ew(t.maskedData)),0!==t.engine&&(e.engine=hm(t.engine)),e},create:t=>hw.fromPartial(t??{}),fromPartial(t){const e=uw();return e.maskedData=t.maskedData??new Uint8Array(0),e.engine=t.engine??0,e}};function dw(){return{publicKeyShare:new Uint8Array(0),evaluated:new Uint8Array(0),c:new Uint8Array(0),r:new Uint8Array(0)}}const pw={encode:(t,e=new QE)=>(0!==t.publicKeyShare.length&&e.uint32(10).bytes(t.publicKeyShare),0!==t.evaluated.length&&e.uint32(18).bytes(t.evaluated),0!==t.c.length&&e.uint32(26).bytes(t.c),0!==t.r.length&&e.uint32(34).bytes(t.r),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i=dw();for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.publicKeyShare=n.bytes();continue;case 2:if(18!==t)break;i.evaluated=n.bytes();continue;case 3:if(26!==t)break;i.c=n.bytes();continue;case 4:if(34!==t)break;i.r=n.bytes();continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({publicKeyShare:ww(t.publicKeyShare)?Aw(t.publicKeyShare):new Uint8Array(0),evaluated:ww(t.evaluated)?Aw(t.evaluated):new Uint8Array(0),c:ww(t.c)?Aw(t.c):new Uint8Array(0),r:ww(t.r)?Aw(t.r):new Uint8Array(0)}),toJSON(t){const e={};return 0!==t.publicKeyShare.length&&(e.publicKeyShare=Ew(t.publicKeyShare)),0!==t.evaluated.length&&(e.evaluated=Ew(t.evaluated)),0!==t.c.length&&(e.c=Ew(t.c)),0!==t.r.length&&(e.r=Ew(t.r)),e},create:t=>pw.fromPartial(t??{}),fromPartial(t){const e=dw();return e.publicKeyShare=t.publicKeyShare??new Uint8Array(0),e.evaluated=t.evaluated??new Uint8Array(0),e.c=t.c??new Uint8Array(0),e.r=t.r??new Uint8Array(0),e}};const fw={encode:(t,e=new QE)=>(0!==t.id&&e.uint32(8).uint64(t.id),void 0!==t.initRequest&&aw.encode(t.initRequest,e.uint32(18).fork()).join(),void 0!==t.initResponse&&lw.encode(t.initResponse,e.uint32(26).fork()).join(),void 0!==t.connectionTerminationAlert&&pm.encode(t.connectionTerminationAlert,e.uint32(34).fork()).join(),void 0!==t.requestError&&pm.encode(t.requestError,e.uint32(42).fork()).join(),void 0!==t.createTunnelRequest&&fm.encode(t.createTunnelRequest,e.uint32(50).fork()).join(),void 0!==t.createTunnelResponse&&wm.encode(t.createTunnelResponse,e.uint32(58).fork()).join(),void 0!==t.disconnectTunnelRequest&&mm.encode(t.disconnectTunnelRequest,e.uint32(66).fork()).join(),void 0!==t.disconnectTunnelResponse&&wm.encode(t.disconnectTunnelResponse,e.uint32(74).fork()).join(),void 0!==t.tunnelMessage&&Bm.encode(t.tunnelMessage,e.uint32(82).fork()).join(),void 0!==t.tunnelDisconnectEvent&&Im.encode(t.tunnelDisconnectEvent,e.uint32(90).fork()).join(),void 0!==t.claimTunnelRequest&&jm.encode(t.claimTunnelRequest,e.uint32(98).fork()).join(),void 0!==t.claimTunnelResponse&&Wm.encode(t.claimTunnelResponse,e.uint32(106).fork()).join(),void 0!==t.createClaimOnChainRequest&&Xm.encode(t.createClaimOnChainRequest,e.uint32(114).fork()).join(),void 0!==t.createClaimOnChainResponse&&$m.encode(t.createClaimOnChainResponse,e.uint32(122).fork()).join(),void 0!==t.completeClaimOnChainRequest&&tw.encode(t.completeClaimOnChainRequest,e.uint32(130).fork()).join(),void 0!==t.completeClaimOnChainResponse&&ew.encode(t.completeClaimOnChainResponse,e.uint32(138).fork()).join(),void 0!==t.toprfRequest&&hw.encode(t.toprfRequest,e.uint32(146).fork()).join(),void 0!==t.toprfResponse&&pw.encode(t.toprfResponse,e.uint32(154).fork()).join(),void 0!==t.createTaskOnMechainRequest&&nw.encode(t.createTaskOnMechainRequest,e.uint32(162).fork()).join(),void 0!==t.createTaskOnMechainResponse&&rw.encode(t.createTaskOnMechainResponse,e.uint32(170).fork()).join(),void 0!==t.claimTeeBundleRequest&&km.encode(t.claimTeeBundleRequest,e.uint32(178).fork()).join(),void 0!==t.claimTeeBundleResponse&&Um.encode(t.claimTeeBundleResponse,e.uint32(186).fork()).join(),void 0!==t.fetchCertificateBytesRequest&&gm.encode(t.fetchCertificateBytesRequest,e.uint32(194).fork()).join(),void 0!==t.fetchCertificateBytesResponse&&Em.encode(t.fetchCertificateBytesResponse,e.uint32(202).fork()).join(),e),decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={id:0,initRequest:void 0,initResponse:void 0,connectionTerminationAlert:void 0,requestError:void 0,createTunnelRequest:void 0,createTunnelResponse:void 0,disconnectTunnelRequest:void 0,disconnectTunnelResponse:void 0,tunnelMessage:void 0,tunnelDisconnectEvent:void 0,claimTunnelRequest:void 0,claimTunnelResponse:void 0,createClaimOnChainRequest:void 0,createClaimOnChainResponse:void 0,completeClaimOnChainRequest:void 0,completeClaimOnChainResponse:void 0,toprfRequest:void 0,toprfResponse:void 0,createTaskOnMechainRequest:void 0,createTaskOnMechainResponse:void 0,claimTeeBundleRequest:void 0,claimTeeBundleResponse:void 0,fetchCertificateBytesRequest:void 0,fetchCertificateBytesResponse:void 0};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(8!==t)break;i.id=mw(n.uint64());continue;case 2:if(18!==t)break;i.initRequest=aw.decode(n,n.uint32());continue;case 3:if(26!==t)break;i.initResponse=lw.decode(n,n.uint32());continue;case 4:if(34!==t)break;i.connectionTerminationAlert=pm.decode(n,n.uint32());continue;case 5:if(42!==t)break;i.requestError=pm.decode(n,n.uint32());continue;case 6:if(50!==t)break;i.createTunnelRequest=fm.decode(n,n.uint32());continue;case 7:if(58!==t)break;i.createTunnelResponse=wm.decode(n,n.uint32());continue;case 8:if(66!==t)break;i.disconnectTunnelRequest=mm.decode(n,n.uint32());continue;case 9:if(74!==t)break;i.disconnectTunnelResponse=wm.decode(n,n.uint32());continue;case 10:if(82!==t)break;i.tunnelMessage=Bm.decode(n,n.uint32());continue;case 11:if(90!==t)break;i.tunnelDisconnectEvent=Im.decode(n,n.uint32());continue;case 12:if(98!==t)break;i.claimTunnelRequest=jm.decode(n,n.uint32());continue;case 13:if(106!==t)break;i.claimTunnelResponse=Wm.decode(n,n.uint32());continue;case 14:if(114!==t)break;i.createClaimOnChainRequest=Xm.decode(n,n.uint32());continue;case 15:if(122!==t)break;i.createClaimOnChainResponse=$m.decode(n,n.uint32());continue;case 16:if(130!==t)break;i.completeClaimOnChainRequest=tw.decode(n,n.uint32());continue;case 17:if(138!==t)break;i.completeClaimOnChainResponse=ew.decode(n,n.uint32());continue;case 18:if(146!==t)break;i.toprfRequest=hw.decode(n,n.uint32());continue;case 19:if(154!==t)break;i.toprfResponse=pw.decode(n,n.uint32());continue;case 20:if(162!==t)break;i.createTaskOnMechainRequest=nw.decode(n,n.uint32());continue;case 21:if(170!==t)break;i.createTaskOnMechainResponse=rw.decode(n,n.uint32());continue;case 22:if(178!==t)break;i.claimTeeBundleRequest=km.decode(n,n.uint32());continue;case 23:if(186!==t)break;i.claimTeeBundleResponse=Um.decode(n,n.uint32());continue;case 24:if(194!==t)break;i.fetchCertificateBytesRequest=gm.decode(n,n.uint32());continue;case 25:if(202!==t)break;i.fetchCertificateBytesResponse=Em.decode(n,n.uint32());continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({id:ww(t.id)?globalThis.Number(t.id):0,initRequest:ww(t.initRequest)?aw.fromJSON(t.initRequest):void 0,initResponse:ww(t.initResponse)?lw.fromJSON(t.initResponse):void 0,connectionTerminationAlert:ww(t.connectionTerminationAlert)?pm.fromJSON(t.connectionTerminationAlert):void 0,requestError:ww(t.requestError)?pm.fromJSON(t.requestError):void 0,createTunnelRequest:ww(t.createTunnelRequest)?fm.fromJSON(t.createTunnelRequest):void 0,createTunnelResponse:ww(t.createTunnelResponse)?wm.fromJSON(t.createTunnelResponse):void 0,disconnectTunnelRequest:ww(t.disconnectTunnelRequest)?mm.fromJSON(t.disconnectTunnelRequest):void 0,disconnectTunnelResponse:ww(t.disconnectTunnelResponse)?wm.fromJSON(t.disconnectTunnelResponse):void 0,tunnelMessage:ww(t.tunnelMessage)?Bm.fromJSON(t.tunnelMessage):void 0,tunnelDisconnectEvent:ww(t.tunnelDisconnectEvent)?Im.fromJSON(t.tunnelDisconnectEvent):void 0,claimTunnelRequest:ww(t.claimTunnelRequest)?jm.fromJSON(t.claimTunnelRequest):void 0,claimTunnelResponse:ww(t.claimTunnelResponse)?Wm.fromJSON(t.claimTunnelResponse):void 0,createClaimOnChainRequest:ww(t.createClaimOnChainRequest)?Xm.fromJSON(t.createClaimOnChainRequest):void 0,createClaimOnChainResponse:ww(t.createClaimOnChainResponse)?$m.fromJSON(t.createClaimOnChainResponse):void 0,completeClaimOnChainRequest:ww(t.completeClaimOnChainRequest)?tw.fromJSON(t.completeClaimOnChainRequest):void 0,completeClaimOnChainResponse:ww(t.completeClaimOnChainResponse)?ew.fromJSON(t.completeClaimOnChainResponse):void 0,toprfRequest:ww(t.toprfRequest)?hw.fromJSON(t.toprfRequest):void 0,toprfResponse:ww(t.toprfResponse)?pw.fromJSON(t.toprfResponse):void 0,createTaskOnMechainRequest:ww(t.createTaskOnMechainRequest)?nw.fromJSON(t.createTaskOnMechainRequest):void 0,createTaskOnMechainResponse:ww(t.createTaskOnMechainResponse)?rw.fromJSON(t.createTaskOnMechainResponse):void 0,claimTeeBundleRequest:ww(t.claimTeeBundleRequest)?km.fromJSON(t.claimTeeBundleRequest):void 0,claimTeeBundleResponse:ww(t.claimTeeBundleResponse)?Um.fromJSON(t.claimTeeBundleResponse):void 0,fetchCertificateBytesRequest:ww(t.fetchCertificateBytesRequest)?gm.fromJSON(t.fetchCertificateBytesRequest):void 0,fetchCertificateBytesResponse:ww(t.fetchCertificateBytesResponse)?Em.fromJSON(t.fetchCertificateBytesResponse):void 0}),toJSON(t){const e={};return 0!==t.id&&(e.id=Math.round(t.id)),void 0!==t.initRequest&&(e.initRequest=aw.toJSON(t.initRequest)),void 0!==t.initResponse&&(e.initResponse=lw.toJSON(t.initResponse)),void 0!==t.connectionTerminationAlert&&(e.connectionTerminationAlert=pm.toJSON(t.connectionTerminationAlert)),void 0!==t.requestError&&(e.requestError=pm.toJSON(t.requestError)),void 0!==t.createTunnelRequest&&(e.createTunnelRequest=fm.toJSON(t.createTunnelRequest)),void 0!==t.createTunnelResponse&&(e.createTunnelResponse=wm.toJSON(t.createTunnelResponse)),void 0!==t.disconnectTunnelRequest&&(e.disconnectTunnelRequest=mm.toJSON(t.disconnectTunnelRequest)),void 0!==t.disconnectTunnelResponse&&(e.disconnectTunnelResponse=wm.toJSON(t.disconnectTunnelResponse)),void 0!==t.tunnelMessage&&(e.tunnelMessage=Bm.toJSON(t.tunnelMessage)),void 0!==t.tunnelDisconnectEvent&&(e.tunnelDisconnectEvent=Im.toJSON(t.tunnelDisconnectEvent)),void 0!==t.claimTunnelRequest&&(e.claimTunnelRequest=jm.toJSON(t.claimTunnelRequest)),void 0!==t.claimTunnelResponse&&(e.claimTunnelResponse=Wm.toJSON(t.claimTunnelResponse)),void 0!==t.createClaimOnChainRequest&&(e.createClaimOnChainRequest=Xm.toJSON(t.createClaimOnChainRequest)),void 0!==t.createClaimOnChainResponse&&(e.createClaimOnChainResponse=$m.toJSON(t.createClaimOnChainResponse)),void 0!==t.completeClaimOnChainRequest&&(e.completeClaimOnChainRequest=tw.toJSON(t.completeClaimOnChainRequest)),void 0!==t.completeClaimOnChainResponse&&(e.completeClaimOnChainResponse=ew.toJSON(t.completeClaimOnChainResponse)),void 0!==t.toprfRequest&&(e.toprfRequest=hw.toJSON(t.toprfRequest)),void 0!==t.toprfResponse&&(e.toprfResponse=pw.toJSON(t.toprfResponse)),void 0!==t.createTaskOnMechainRequest&&(e.createTaskOnMechainRequest=nw.toJSON(t.createTaskOnMechainRequest)),void 0!==t.createTaskOnMechainResponse&&(e.createTaskOnMechainResponse=rw.toJSON(t.createTaskOnMechainResponse)),void 0!==t.claimTeeBundleRequest&&(e.claimTeeBundleRequest=km.toJSON(t.claimTeeBundleRequest)),void 0!==t.claimTeeBundleResponse&&(e.claimTeeBundleResponse=Um.toJSON(t.claimTeeBundleResponse)),void 0!==t.fetchCertificateBytesRequest&&(e.fetchCertificateBytesRequest=gm.toJSON(t.fetchCertificateBytesRequest)),void 0!==t.fetchCertificateBytesResponse&&(e.fetchCertificateBytesResponse=Em.toJSON(t.fetchCertificateBytesResponse)),e},create:t=>fw.fromPartial(t??{}),fromPartial(t){const e={id:0,initRequest:void 0,initResponse:void 0,connectionTerminationAlert:void 0,requestError:void 0,createTunnelRequest:void 0,createTunnelResponse:void 0,disconnectTunnelRequest:void 0,disconnectTunnelResponse:void 0,tunnelMessage:void 0,tunnelDisconnectEvent:void 0,claimTunnelRequest:void 0,claimTunnelResponse:void 0,createClaimOnChainRequest:void 0,createClaimOnChainResponse:void 0,completeClaimOnChainRequest:void 0,completeClaimOnChainResponse:void 0,toprfRequest:void 0,toprfResponse:void 0,createTaskOnMechainRequest:void 0,createTaskOnMechainResponse:void 0,claimTeeBundleRequest:void 0,claimTeeBundleResponse:void 0,fetchCertificateBytesRequest:void 0,fetchCertificateBytesResponse:void 0};return e.id=t.id??0,e.initRequest=void 0!==t.initRequest&&null!==t.initRequest?aw.fromPartial(t.initRequest):void 0,e.initResponse=void 0!==t.initResponse&&null!==t.initResponse?lw.fromPartial(t.initResponse):void 0,e.connectionTerminationAlert=void 0!==t.connectionTerminationAlert&&null!==t.connectionTerminationAlert?pm.fromPartial(t.connectionTerminationAlert):void 0,e.requestError=void 0!==t.requestError&&null!==t.requestError?pm.fromPartial(t.requestError):void 0,e.createTunnelRequest=void 0!==t.createTunnelRequest&&null!==t.createTunnelRequest?fm.fromPartial(t.createTunnelRequest):void 0,e.createTunnelResponse=void 0!==t.createTunnelResponse&&null!==t.createTunnelResponse?wm.fromPartial(t.createTunnelResponse):void 0,e.disconnectTunnelRequest=void 0!==t.disconnectTunnelRequest&&null!==t.disconnectTunnelRequest?mm.fromPartial(t.disconnectTunnelRequest):void 0,e.disconnectTunnelResponse=void 0!==t.disconnectTunnelResponse&&null!==t.disconnectTunnelResponse?wm.fromPartial(t.disconnectTunnelResponse):void 0,e.tunnelMessage=void 0!==t.tunnelMessage&&null!==t.tunnelMessage?Bm.fromPartial(t.tunnelMessage):void 0,e.tunnelDisconnectEvent=void 0!==t.tunnelDisconnectEvent&&null!==t.tunnelDisconnectEvent?Im.fromPartial(t.tunnelDisconnectEvent):void 0,e.claimTunnelRequest=void 0!==t.claimTunnelRequest&&null!==t.claimTunnelRequest?jm.fromPartial(t.claimTunnelRequest):void 0,e.claimTunnelResponse=void 0!==t.claimTunnelResponse&&null!==t.claimTunnelResponse?Wm.fromPartial(t.claimTunnelResponse):void 0,e.createClaimOnChainRequest=void 0!==t.createClaimOnChainRequest&&null!==t.createClaimOnChainRequest?Xm.fromPartial(t.createClaimOnChainRequest):void 0,e.createClaimOnChainResponse=void 0!==t.createClaimOnChainResponse&&null!==t.createClaimOnChainResponse?$m.fromPartial(t.createClaimOnChainResponse):void 0,e.completeClaimOnChainRequest=void 0!==t.completeClaimOnChainRequest&&null!==t.completeClaimOnChainRequest?tw.fromPartial(t.completeClaimOnChainRequest):void 0,e.completeClaimOnChainResponse=void 0!==t.completeClaimOnChainResponse&&null!==t.completeClaimOnChainResponse?ew.fromPartial(t.completeClaimOnChainResponse):void 0,e.toprfRequest=void 0!==t.toprfRequest&&null!==t.toprfRequest?hw.fromPartial(t.toprfRequest):void 0,e.toprfResponse=void 0!==t.toprfResponse&&null!==t.toprfResponse?pw.fromPartial(t.toprfResponse):void 0,e.createTaskOnMechainRequest=void 0!==t.createTaskOnMechainRequest&&null!==t.createTaskOnMechainRequest?nw.fromPartial(t.createTaskOnMechainRequest):void 0,e.createTaskOnMechainResponse=void 0!==t.createTaskOnMechainResponse&&null!==t.createTaskOnMechainResponse?rw.fromPartial(t.createTaskOnMechainResponse):void 0,e.claimTeeBundleRequest=void 0!==t.claimTeeBundleRequest&&null!==t.claimTeeBundleRequest?km.fromPartial(t.claimTeeBundleRequest):void 0,e.claimTeeBundleResponse=void 0!==t.claimTeeBundleResponse&&null!==t.claimTeeBundleResponse?Um.fromPartial(t.claimTeeBundleResponse):void 0,e.fetchCertificateBytesRequest=void 0!==t.fetchCertificateBytesRequest&&null!==t.fetchCertificateBytesRequest?gm.fromPartial(t.fetchCertificateBytesRequest):void 0,e.fetchCertificateBytesResponse=void 0!==t.fetchCertificateBytesResponse&&null!==t.fetchCertificateBytesResponse?Em.fromPartial(t.fetchCertificateBytesResponse):void 0,e}};const gw={encode(t,e=new QE){for(const n of t.messages)fw.encode(n,e.uint32(10).fork()).join();return e},decode(t,e){const n=t instanceof UE?t:new UE(t);let r=void 0===e?n.len:n.pos+e;const i={messages:[]};for(;n.pos<r;){const t=n.uint32();switch(t>>>3){case 1:if(10!==t)break;i.messages.push(fw.decode(n,n.uint32()));continue}if(4==(7&t)||0===t)break;n.skip(7&t)}return i},fromJSON:t=>({messages:globalThis.Array.isArray(t?.messages)?t.messages.map(t=>fw.fromJSON(t)):[]}),toJSON(t){const e={};return t.messages?.length&&(e.messages=t.messages.map(t=>fw.toJSON(t))),e},create:t=>gw.fromPartial(t??{}),fromPartial(t){const e={messages:[]};return e.messages=t.messages?.map(t=>fw.fromPartial(t))||[],e}};function Aw(t){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(t,"base64"));{const e=globalThis.atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;++t)n[t]=e.charCodeAt(t);return n}}function Ew(t){if(globalThis.Buffer)return globalThis.Buffer.from(t).toString("base64");{const e=[];return t.forEach(t=>{e.push(globalThis.String.fromCharCode(t))}),globalThis.btoa(e.join(""))}}function mw(t){const e=globalThis.Number(t.toString());if(e>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(e<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return e}function ww(t){return null!=t}const yw=443,Bw="/browser-rpc/resources",Iw={signatureType:WE,clientVersion:nm,auth:void 0},Cw={version:nm},Tw=9e4,bw="reclaim-toprf";s(8287).hp;const Dw="*".charCodeAt(0);function vw(t){return"number"==typeof t?new Uint32Array(t):Uint32Array.from(t)}function Mw(t){const e=[];for(const n of t)for(let t=0;t<8;t++)n>>7-t&1?e.push(1):e.push(0);return e}function Nw(t){const e=new Uint8Array(t.length/8);for(let n=0;n<t.length;n+=8)e[n/8]=xw(t.slice(n,n+8));return e}function Sw(t,...e){const{uint8ArrayToBits:n}=Ow[t],r=[];for(const i of e)"number"==typeof i?r.push(..._w(t,i)):r.push(...n(i));return r}function _w(t,e){const{uint8ArrayToBits:n,isLittleEndian:r}=Ow[t],i=new Uint8Array(4);return new DataView(i.buffer).setUint32(0,e,r),n(function(t,e){const{isLittleEndian:n}=Ow[t],r=new Uint8Array(4),i=new DataView(r.buffer);return i.setUint32(0,e,n),r}(t,e)).flat()}function Lw(t,e=32){const n=[];for(let r=2**(e-1);r>=1;r/=2){const e=t>=r?1:0;n.push(e),t-=e*r}return n}function xw(t){let e=0,n=2**(t.length-1);for(const r of t)e+=r*n,n/=2;return e}function Rw(t){const{chunkSize:e,bitsPerWord:n,blocksPerChunk:r}=Ow[t];return e*n/(8*r)}function Fw(t,e,n){const r=Rw(t),i=[];for(let t=0;t<e.length;t+=r)i.push({iv:n,ciphertext:e.slice(t,t+r),offsetBytes:t});return i}function kw(t,e){const n=Rw(e);return Math.ceil(t/n)*n}const Ow={chacha20:{index:0,chunkSize:32,bitsPerWord:32,keySizeBytes:32,ivSizeBytes:12,startCounter:1,blocksPerChunk:2,isLittleEndian:!0,uint8ArrayToBits:t=>function(t){const e=[];for(const n of t)e.push(Lw(n));return e}(function(t){const e=vw(t.length/4),n=new DataView(t.buffer,t.byteOffset,t.byteLength);for(let t=0;t<e.length;t++)e[t]=n.getUint32(4*t,!0);return e}(t)).flat(),bitsToUint8Array:t=>{const e=function(t){const e=new Uint32Array(t.length/32);for(let n=0;n<t.length;n+=32)e[n/32]=xw(t.slice(n,n+32));return e}(t);return function(t){const e=new Uint8Array(4*t.length),n=new DataView(e.buffer,e.byteOffset,e.byteLength);for(const[e,r]of t.entries())n.setUint32(4*e,r,!0);return e}(e)},encrypt:Qw("CHACHA20-POLY1305")},"aes-256-ctr":{index:2,chunkSize:80,bitsPerWord:8,keySizeBytes:32,ivSizeBytes:12,startCounter:2,blocksPerChunk:5,isLittleEndian:!1,uint8ArrayToBits:Mw,bitsToUint8Array:Nw,encrypt:Qw("AES-256-GCM")},"aes-128-ctr":{index:1,chunkSize:80,bitsPerWord:8,keySizeBytes:16,ivSizeBytes:12,startCounter:2,blocksPerChunk:5,isLittleEndian:!1,uint8ArrayToBits:Mw,bitsToUint8Array:Nw,encrypt:Qw("AES-128-GCM")}};function Qw(t){return async({key:e,iv:n,in:r})=>{const i=await C.importKey(t,e),{ciphertext:o}=await C.authenticatedEncrypt(t,{key:i,iv:n,data:r,aead:new Uint8Array(0)});return o.slice(0,r.length)}}async function Uw(t){const{algorithm:e,operator:n,logger:r}=t,{witness:i,plaintextArray:o}=await async function({algorithm:t,privateInput:{key:e},publicInput:n}){const{keySizeBytes:r}=Ow[t];if(e.length!==r)throw new Error(`key must be ${r} bytes`);const i={key:e,...await Pw({publicInput:n,algorithm:t,key:e})};return{witness:i,plaintextArray:i.out}}(t);let s;s="mask"in t?await n.generateWitness({...i,toprf:t.toprf,mask:t.mask}):await n.generateWitness(i);const{proof:a}=await n.groth16Prove(s,r);return{algorithm:e,proofData:a,plaintext:"mask"in t?void 0:o}}async function Pw({publicInput:t,algorithm:e,...n}){const{ivSizeBytes:r}=Ow[e],i=[],o=[],s=[],a=Rw(e),c=Gw(e);if(!(t=Array.isArray(t)?t:[t]).length)throw new Error("at least one public input is required");for(const[n,{ciphertext:r,iv:o,offsetBytes:s=0}]of t.entries()){const l=Fw(e,r,o);for(const t of l)await u({...t,offsetBytes:s+(t.offsetBytes||0)});if(n<t.length-1)continue;const h=i.reduce((t,e)=>t+e.length,0);if(h>=c)continue;const d=c-h,p=s+kw(r.length,e);for(let t=0;t<d;t+=a)await u({ciphertext:new Uint8Array,iv:o,offsetBytes:p+t})}const l={noncesAndCounters:s,in:K(i),out:"plaintext"in n&&n.plaintext?n.plaintext:K(o)};if(l.in.length!==Gw(e))throw new Error(`Ciphertext must be exactly ${c}b, got ${l.in.length}b`);return l;async function u({ciphertext:t,iv:c,offsetBytes:l=0}){if(c.length!==r)throw new Error(`iv must be ${r} bytes`);const u=function(t,e){const{startCounter:n}=Ow[t],r=Rw(t);if(e%r!==0)throw new Error(`offset(${e}) must be a multiple of block size(${r})`);return n+e/r}(e,l);if(s.push({nonce:c,counter:u,boundary:void 0}),t=function(t,e){if(t.length>e)throw new Error(`ciphertext must be <= ${e}b`);if(t.length<e){const n=new Uint8Array(e);n.set(t),t=n}return t}(t,a),i.push(t),"key"in n){const r=await async function({algorithm:t,key:e,iv:n,startOffset:r,ciphertext:i}){const{encrypt:o}=Ow[t],s=new Uint8Array(r+i.length);s.set(i,r);const a=await o({key:e,iv:n,in:s});return a.slice(r)}({algorithm:e,key:n.key,iv:c,startOffset:l,ciphertext:t});o.push(r)}}}function Gw(t){const{blocksPerChunk:e}=Ow[t];return Rw(t)*e}function Vw({baseUrl:t="http://localhost:8001/browser-rpc/resources/"}={}){return{async fetch(e,n){const r=`${t}/${e}/${n}`,i=await fetch(r);if(!i.ok)throw new Error(`${e}-${n} fetch failed with code: ${i.status}`);const o=await i.arrayBuffer();return new Uint8Array(o)}}}function jw({basePath:t="../resources"}={}){return{async fetch(e,n){const r=`${t}/${e}/${n}`,{readFile:i}=await s.e(174).then(s.t.bind(s,7174,19)),{join:o,dirname:a}=await s.e(975).then(s.t.bind(s,7975,19)),c=o(a("file:///Users/joseph/code/github/joclaim/reclaim-browser-extension-sdk/node_modules/@joclaim/zk-symmetric-crypto/lib/file-fetch.js".replace("file://","")),r);return await i(c)}}}new Uint8Array(4).fill(Dw);function Hw(t){return(new TextDecoder).decode(t)}function Yw(t){return(new TextEncoder).encode(t)}const zw=()=>Math.floor(Date.now()/1e3);function Jw(t,e){for(let n=0;n<t.length;n++)if(Z(t.slice(n,n+e.length),e))return n;return-1}function Ww(t){if(t.includes("CHACHA20"))return"chacha20";if(t.includes("AES_256_GCM"))return"aes-256-ctr";if(t.includes("AES_128_GCM"))return"aes-128-ctr";throw new Error(`${t} not supported for ZK ops`)}function qw(t,e,n){return"function"==typeof e?e(t,n):e}function Kw(){return X(C.randomBytes(4)).getUint32(0)}function Zw(){return Kw()}function Xw(t){return t.endsWith("Request")?{type:t.slice(0,-7),direction:"request"}:t.endsWith("Response")?{type:t.slice(0,-8),direction:"response"}:void 0}function $w(t){return`${t}Request`}function ty(t,e){return"ciphertext"===t.type&&("APPLICATION_DATA"===t.contentType||t.data[0]===J.WRAPPED_RECORD&&"TLS1_2"===e)}function ey(...t){return gw.create({messages:t.map(t=>fw.create({...t,id:t.id||Kw()}))})}var ny=s(4874),ry=s(5606);function iy(){return"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"undefined"!=typeof window?"browser":"node"}function oy(t){if(void 0!==ry)return ry?.env[t]}const sy=["ownerPrivateKey","secretParams"],ay=oy("LOG_LEVEL");let cy,ly,uy=(0,ny.pino)();function hy(t){return"object"==typeof t&&!Array.isArray(t)&&null!==t}function dy(t){if(!hy(t)&&!Array.isArray(t))return t;const e=JSON.parse(JSON.stringify(t,function(){const t=new WeakSet;return function(e,n){if("object"==typeof n&&null!==n){if(t.has(n))return"[CIRCULAR]";t.add(n)}return n}}()));for(const t in e)if(sy.includes(t)&&(e[t]="[REDACTED]"),Array.isArray(e[t]))for(const[n,r]of e[t].entries())e[t][n]=dy(r);else hy(e[t])&&(e[t]=dy(e[t]));return e}function py(t){return cy||(cy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ly=cy.slice(0,-2).concat("-","_")),"url"==t?ly:cy}!function(t,e,n){const r={timestamp:ny.stdTimeFunctions.isoTime};t&&(r.formatters={log:dy},r.serializers={redact:dy},r.browser={write:{fatal:t=>o("fatal",t),error:t=>o("error",t),warn:t=>o("warn",t),info:t=>o("info",t),debug:t=>o("debug",t),trace:t=>o("trace",t)}});const i=(0,ny.pino)(r);return i.level=e||"info",uy=i,i;function o(t,e){e=dy(e);const{msg:r,...i}=e;console[t]?console[t](i,r):console.log(i,r),n?.(t,e)}}(!1,ay);const fy="*".charCodeAt(0);function gy(t){for(const e of t)if("*"!==e&&e!==fy)return!1;return!0}function Ay(t,e){const n=new Uint8Array(t);for(const t of e)for(let e=t.fromIndex;e<t.toIndex;e++)n[e]=fy;return n}function Ey(t,e){return function(t,e="std"){const n=py(e),r="std"==e;let i,o="",s=0,a=0;for(let e=0;e<t.length;e++)switch(i=t[e],s){case 0:o+=n[i>>2],a=(3&i)<<4,s=1;break;case 1:o+=n[a|i>>4],a=(15&i)<<2,s=2;break;case 2:o+=n[a|i>>6],o+=n[63&i],s=0}return s&&(o+=n[a],r&&(o+="=",1==s&&(o+="="))),o}(t).padEnd(e,"0").slice(0,e)}const my=$("\r\n");function wy(){const t={statusCode:0,statusMessage:"",headers:{},body:new Uint8Array,complete:!1,headersComplete:!1,headerIndices:new Map,headerEndIdx:0};let e=0,n=!1,r=new Uint8Array,i=0;return{res:t,onChunk(a){if(r=K([r,a]),!t.headersComplete)for(let r=s();void 0!==r;r=s())if(t.statusCode){if(""===r){if(t.headersComplete=!0,t.headerEndIdx=i-4,t.headers["transfer-encoding"]?.includes("chunked")){n=!0,t.chunks=[];break}if(t.headers["content-length"]){e=Number(t.headers["content-length"]);break}e=-1;break}if(t.complete)throw new Error("got more data after response was complete");{const[e,n]=r.split(": ");t.headers[e.toLowerCase()]=n,t.headerIndices[e.toLowerCase()]={fromIndex:i-r.length-my.length,toIndex:i-my.length}}}else{const[,e,n]=r.match(/HTTP\/\d\.\d (\d+) (.*)/)||[];t.statusCode=Number(e),t.statusMessage=n,t.statusLineEndIndex=i-my.length}if(t.headersComplete&&(e&&(o(),e||n||(t.complete=!0)),"0"===t.headers["content-length"]&&(t.complete=!0),n))for(let n=s();void 0!==n;n=s()){if(""===n)continue;const r=Number.parseInt(n,16);if(r){if(t.chunks?.push({fromIndex:i,toIndex:i+r}),e=r,o(),e)break}else t.complete=!0}},streamEnded(){if(!t.headersComplete)throw new Error("stream ended before headers were complete");if(r.length)throw new Error("stream ended before remaining data arrived");if(e>0)throw new Error("stream ended before all body bytes were received");t.complete=!0}};function o(){if(t.complete)throw new Error("got more data after response was complete");let n;t.bodyStartIndex||(t.bodyStartIndex=i),-1===e?n=r.length:(n=Math.min(e,r.length),e-=n),t.body=K([t.body,r.slice(0,n)]),r=r.slice(n),i+=n}function s(){const t=Jw(r,my);if(-1===t)return;const e=Hw(r.slice(0,t));return r=r.slice(t+my.length),i+=t+my.length,e}}var yy=s(8287).hp;const By="function"==typeof yy,Iy=("function"==typeof TextDecoder&&new TextDecoder,"function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),Cy=(t=>{let e={};return t.forEach((t,n)=>e[t]=n),e})(Iy),Ty=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,by=String.fromCharCode.bind(String),Dy="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):t=>new Uint8Array(Array.prototype.slice.call(t,0)),vy=t=>t.replace(/=/g,"").replace(/[+\/]/g,t=>"+"==t?"-":"_"),My=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),Ny=t=>{let e,n,r,i,o="";const s=t.length%3;for(let s=0;s<t.length;){if((n=t.charCodeAt(s++))>255||(r=t.charCodeAt(s++))>255||(i=t.charCodeAt(s++))>255)throw new TypeError("invalid character found");e=n<<16|r<<8|i,o+=Iy[e>>18&63]+Iy[e>>12&63]+Iy[e>>6&63]+Iy[63&e]}return s?o.slice(0,s-3)+"===".substring(s):o},Sy="function"==typeof btoa?t=>btoa(t):By?t=>yy.from(t,"binary").toString("base64"):Ny,_y=By?t=>yy.from(t).toString("base64"):t=>{let e=[];for(let n=0,r=t.length;n<r;n+=4096)e.push(by.apply(null,t.subarray(n,n+4096)));return Sy(e.join(""))},Ly=(t,e=!1)=>e?vy(_y(t)):_y(t),xy=t=>{if(t=t.replace(/\s+/g,""),!Ty.test(t))throw new TypeError("malformed base64.");let e,n,r;t+="==".slice(2-(3&t.length));let i=[];for(let o=0;o<t.length;)e=Cy[t.charAt(o++)]<<18|Cy[t.charAt(o++)]<<12|(n=Cy[t.charAt(o++)])<<6|(r=Cy[t.charAt(o++)]),64===n?i.push(by(e>>16&255)):64===r?i.push(by(e>>16&255,e>>8&255)):i.push(by(e>>16&255,e>>8&255,255&e));return i.join("")},Ry="function"==typeof atob?t=>atob(My(t)):By?t=>yy.from(t,"base64").toString("binary"):xy,Fy=By?t=>Dy(yy.from(t,"base64")):t=>Dy(Ry(t).split("").map(t=>t.charCodeAt(0))),ky=t=>Fy(Oy(t)),Oy=t=>My(t.replace(/[-_]/g,t=>"-"==t?"+":"/")),Qy=Ly,Uy=ky;var Py=s(5606),Gy=s(8287).hp;const Vy="../../bin/gnark";let jy;const Hy={x64:"x86_64"},Yy={};async function zy(t,e,n,r){jy??=async function(){const t=await Promise.resolve().then(s.t.bind(s,2447,19)).catch(()=>{});if(!t)throw new Error("Koffi not available, cannot use gnark");const{join:e,dirname:n}=await s.e(975).then(s.t.bind(s,7975,19)),r=n("file:///Users/joseph/code/github/joclaim/reclaim-browser-extension-sdk/node_modules/@joclaim/zk-symmetric-crypto/lib/gnark/utils.js".replace("file://","")),{default:i}=t;i.reset();const o=i.struct("GoSlice",{data:"void *",len:"longlong",cap:"longlong"}),a=i.struct("ProveReturn",{r0:"void *",r1:"longlong"}),c=i.struct("LibReturn",{r0:"void *",r1:"longlong"}),l=Hy[Py.arch]||Py.arch,u=Py.platform,h=e(r,`${Vy}/${u}-${l}-libverify.so`),d=e(r,`${Vy}/${u}-${l}-libprove.so`);try{const t=i.load(h),e=i.load(d);return{verify:t.func("Verify","unsigned char",[o]),free:e.func("Free","void",["void *"]),vfree:t.func("VFree","void",["void *"]),prove:e.func("Prove",a,[o]),initAlgorithm:e.func("InitAlgorithm","unsigned char",["unsigned char",o,o]),generateThresholdKeys:t.func("GenerateThresholdKeys",c,[o]),oprfEvaluate:t.func("OPRFEvaluate",c,[o]),generateOPRFRequest:e.func("GenerateOPRFRequestData",c,[o]),toprfFinalize:e.func("TOPRFFinalize",c,[o]),koffi:i}}catch(t){if(t.message.includes("not a mach-o"))throw new Error(`Gnark library not compatible with OS/arch (${u}/${l})`);if(t.message.toLowerCase().includes("no such file"))throw new Error(`Gnark library not built for OS/arch (${u}/${l})`);throw t}}();const i=await jy;if(Yy[t])return i;const[o,a]=await Promise.all([n.fetch("gnark",`pk.${e}`,r),n.fetch("gnark",`r1cs.${e}`,r)]),c={data:o,len:o.length,cap:o.length},l={data:a,len:a.length,cap:a.length};return await i.initAlgorithm(t,c,l),Yy[t]=!0,i}function Jy(t){return(new TextEncoder).encode(t)}function Wy(t,e){const n=qy(t,e);return Jy(JSON.stringify(n))}function qy(t,e){return{cipher:t+("toprf"in e?"-toprf":""),key:"key"in e?Qy(e.key):void 0,ciphertext:"out"in e&&e.out?.length?Qy(e.out):void 0,blocks:e.noncesAndCounters.map(t=>({nonce:Qy(t.nonce),counter:t.counter,boundary:t.boundary||null})),input:Qy(e.in),toprf:function(){if(!("toprf"in e))return{};const{locations:t,domainSeparator:n,output:r,responses:i}=e.toprf;return{locations:t,domainSeparator:Qy(Jy(n)),output:Qy(r),responses:i.map(Ky),mask:"mask"in e?Qy(e.mask):""}}()}}function Ky({publicKeyShare:t,evaluated:e,c:n,r}){return{publicKeyShare:Qy(t),evaluated:Qy(e),c:Qy(n),r:Qy(r)}}function Zy(t,e){return t({data:"string"==typeof e?Gy.from(e):e,len:e.length,cap:e.length})}async function Xy(t,e){const{free:n,koffi:r}=await jy,i=Zy(t,e),o=Gy.from(r.decode(i.r0,"unsigned char",i.r1)).toString();return n(i.r0),JSON.parse(o)}const $y={chacha20:{ext:"chacha20"},"aes-128-ctr":{ext:"aes128"},"aes-256-ctr":{ext:"aes256"}};async function tB(t,e,n){const{ext:r}=$y[t],{index:i}=Ow[t];return zy(i,r,e,n)}var eB=s(2447),nB=s(8287).hp;const rB={chacha20:{ext:"chacha20_oprf",id:3},"aes-128-ctr":{ext:"aes128_oprf",id:4},"aes-256-ctr":{ext:"aes256_oprf",id:5}};var iB=s(228);class oB extends Error{constructor(t){super(t),this.name="TimeoutError"}}class sB extends Error{constructor(t){super(),this.name="AbortError",this.message=t}}const aB=t=>void 0===globalThis.DOMException?new sB(t):new DOMException(t),cB=t=>{const e=void 0===t.reason?aB("This operation was aborted."):t.reason;return e instanceof Error?e:aB(e)};class lB{#t=[];enqueue(t,e){const n={priority:(e={priority:0,...e}).priority,id:e.id,run:t};if(0===this.size||this.#t[this.size-1].priority>=e.priority)return void this.#t.push(n);const r=function(t,e,n){let r=0,i=t.length;for(;i>0;){const o=Math.trunc(i/2);let s=r+o;n(t[s],e)<=0?(r=++s,i-=o+1):i=o}return r}(this.#t,n,(t,e)=>e.priority-t.priority);this.#t.splice(r,0,n)}setPriority(t,e){const n=this.#t.findIndex(e=>e.id===t);if(-1===n)throw new ReferenceError(`No promise function with the id "${t}" exists in the queue.`);const[r]=this.#t.splice(n,1);this.enqueue(r.run,{priority:e,id:t})}dequeue(){const t=this.#t.shift();return t?.run}filter(t){return this.#t.filter(e=>e.priority===t.priority).map(t=>t.run)}get size(){return this.#t.length}}class uB extends iB{#e;#n;#r=0;#i;#o;#s=0;#a;#c;#t;#l;#u=0;#h;#d;#p;#f=1n;timeout;constructor(t){if(super(),!("number"==typeof(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:lB,...t}).intervalCap&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(void 0===t.interval||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#n=t.intervalCap===Number.POSITIVE_INFINITY||0===t.interval,this.#i=t.intervalCap,this.#o=t.interval,this.#t=new t.queueClass,this.#l=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#p=!0===t.throwOnTimeout,this.#d=!1===t.autoStart}get#g(){return this.#n||this.#r<this.#i}get#A(){return this.#u<this.#h}#E(){this.#u--,this.#m(),this.emit("next")}#w(){this.#y(),this.#B(),this.#c=void 0}get#I(){const t=Date.now();if(void 0===this.#a){const e=this.#s-t;if(!(e<0))return void 0===this.#c&&(this.#c=setTimeout(()=>{this.#w()},e)),!0;this.#r=this.#e?this.#u:0}return!1}#m(){if(0===this.#t.size)return this.#a&&clearInterval(this.#a),this.#a=void 0,this.emit("empty"),0===this.#u&&this.emit("idle"),!1;if(!this.#d){const t=!this.#I;if(this.#g&&this.#A){const e=this.#t.dequeue();return!!e&&(this.emit("active"),e(),t&&this.#B(),!0)}}return!1}#B(){this.#n||void 0!==this.#a||(this.#a=setInterval(()=>{this.#y()},this.#o),this.#s=Date.now()+this.#o)}#y(){0===this.#r&&0===this.#u&&this.#a&&(clearInterval(this.#a),this.#a=void 0),this.#r=this.#e?this.#u:0,this.#C()}#C(){for(;this.#m(););}get concurrency(){return this.#h}set concurrency(t){if(!("number"==typeof t&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#h=t,this.#C()}async#T(t){return new Promise((e,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0})})}setPriority(t,e){this.#t.setPriority(t,e)}async add(t,e={}){return e.id??=(this.#f++).toString(),e={timeout:this.timeout,throwOnTimeout:this.#p,...e},new Promise((n,r)=>{this.#t.enqueue(async()=>{this.#u++;try{e.signal?.throwIfAborted(),this.#r++;let r=t({signal:e.signal});e.timeout&&(r=function(t,e){const{milliseconds:n,fallback:r,message:i,customTimers:o={setTimeout,clearTimeout}}=e;let s,a;const c=new Promise((c,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(e.signal){const{signal:t}=e;t.aborted&&l(cB(t)),a=()=>{l(cB(t))},t.addEventListener("abort",a,{once:!0})}if(n===Number.POSITIVE_INFINITY)return void t.then(c,l);const u=new oB;s=o.setTimeout.call(void 0,()=>{if(r)try{c(r())}catch(t){l(t)}else"function"==typeof t.cancel&&t.cancel(),!1===i?c():i instanceof Error?l(i):(u.message=i??`Promise timed out after ${n} milliseconds`,l(u))},n),(async()=>{try{c(await t)}catch(t){l(t)}})()}).finally(()=>{c.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return c.clear=()=>{o.clearTimeout.call(void 0,s),s=void 0},c}(Promise.resolve(r),{milliseconds:e.timeout})),e.signal&&(r=Promise.race([r,this.#T(e.signal)]));const i=await r;n(i),this.emit("completed",i)}catch(t){if(t instanceof oB&&!e.throwOnTimeout)return void n();r(t),this.emit("error",t)}finally{this.#E()}},e),this.emit("add"),this.#m()})}async addAll(t,e){return Promise.all(t.map(async t=>this.add(t,e)))}start(){return this.#d?(this.#d=!1,this.#C(),this):this}pause(){this.#d=!0}clear(){this.#t=new this.#l}async onEmpty(){0!==this.#t.size&&await this.#b("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#b("next",()=>this.#t.size<t)}async onIdle(){0===this.#u&&0===this.#t.size||await this.#b("idle")}async#b(t,e){return new Promise(n=>{const r=()=>{e&&!e()||(this.off(t,r),n())};this.on(t,r)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#u}get isPaused(){return this.#d}}const hB=[0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4];function dB(t,e){return e&&10!=e?16==e?"0x"==t.slice(0,2)?BigInt(t):BigInt("0x"+t):void 0:BigInt(t)}const pB=dB;function fB(t){const e=t.toString(16);return 4*(e.length-1)+hB[parseInt(e[0],16)]}function gB(t){return BigInt(t)<BigInt(0)}function AB(t){return!t}function EB(t,e){return BigInt(t)<<BigInt(e)}function mB(t,e){return BigInt(t)>>BigInt(e)}const wB=EB,yB=mB;function BB(t){return(BigInt(t)&BigInt(1))==BigInt(1)}function IB(t){let e=BigInt(t);const n=[];for(;e;){if(e&BigInt(1)){const t=2-Number(e%BigInt(4));n.push(t),e-=BigInt(t)}else n.push(0);e>>=BigInt(1)}return n}function CB(t){let e=BigInt(t);const n=[];for(;e;)e&BigInt(1)?n.push(1):n.push(0),e>>=BigInt(1);return n}function TB(t){if(t>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("Number too big");return Number(t)}function bB(t,e){return BigInt(t)+BigInt(e)}function DB(t,e){return BigInt(t)-BigInt(e)}function vB(t){return-BigInt(t)}function MB(t,e){return BigInt(t)*BigInt(e)}function NB(t,e){return BigInt(t)**BigInt(e)}function SB(t,e){return BigInt(t)/BigInt(e)}function _B(t,e){return BigInt(t)%BigInt(e)}function LB(t,e){return BigInt(t)==BigInt(e)}function xB(t,e){return BigInt(t)>BigInt(e)}function RB(t,e){return BigInt(t)>=BigInt(e)}function FB(t,e){return BigInt(t)&BigInt(e)}function kB(t,e,n,r){const i="0000000"+n.toString(16),o=new Uint32Array(t.buffer,t.byteOffset+e,r/4),s=1+(4*(i.length-7)-1>>5);for(let t=0;t<s;t++)o[t]=parseInt(i.substring(i.length-8*t-8,i.length-8*t),16);for(let t=s;t<o.length;t++)o[t]=0;for(let e=4*o.length;e<r;e++)t[e]=TB(FB(mB(n,8*e),255))}function OB(t,e,n,r){const i="0000000"+n.toString(16),o=new DataView(t.buffer,t.byteOffset+e,r),s=1+(4*(i.length-7)-1>>5);for(let t=0;t<s;t++)o.setUint32(r-4*t-4,parseInt(i.substring(i.length-8*t-8,i.length-8*t),16),!1);for(let t=0;t<r/4-s;t++)o[t]=0}function QB(t,e,n){n=n||t.byteLength,e=e||0;const r=new Uint32Array(t.buffer,t.byteOffset+e,n/4),i=new Array(n/4);return r.forEach((t,e)=>i[i.length-e-1]=t.toString(16).padStart(8,"0")),dB(i.join(""),16)}function UB(t,e,n){n=n||t.byteLength,e=e||0;const r=new DataView(t.buffer,t.byteOffset+e,n),i=new Array(n/4);for(let t=0;t<n/4;t++)i[t]=r.getUint32(4*t,!1).toString(16).padStart(8,"0");return dB(i.join(""),16)}function PB(t,e){return t.toString(e)}function GB(t){const e=new Uint8Array(Math.floor((fB(t)-1)/8)+1);return kB(e,0,t,e.byteLength),e}const VB=pB(0),jB=pB(1);var HB=Object.freeze({__proto__:null,abs:function(t){return BigInt(t)>=0?BigInt(t):-BigInt(t)},add:bB,band:FB,bitLength:fB,bits:CB,bor:function(t,e){return BigInt(t)|BigInt(e)},bxor:function(t,e){return BigInt(t)^BigInt(e)},div:SB,e:pB,eq:LB,exp:function(t,e){return BigInt(t)**BigInt(e)},fromArray:function(t,e){let n=BigInt(0);e=BigInt(e);for(let r=0;r<t.length;r++)n=n*e+BigInt(t[r]);return n},fromRprBE:UB,fromRprLE:QB,fromString:dB,geq:RB,gt:xB,isNegative:gB,isOdd:BB,isZero:AB,land:function(t,e){return BigInt(t)&&BigInt(e)},leq:function(t,e){return BigInt(t)<=BigInt(e)},lnot:function(t){return!BigInt(t)},lor:function(t,e){return BigInt(t)||BigInt(e)},lt:function(t,e){return BigInt(t)<BigInt(e)},mod:_B,mul:MB,naf:IB,neg:vB,neq:function(t,e){return BigInt(t)!=BigInt(e)},one:jB,pow:NB,shiftLeft:EB,shiftRight:mB,shl:wB,shr:yB,square:function(t){return BigInt(t)*BigInt(t)},sub:DB,toArray:function(t,e){const n=[];let r=BigInt(t);for(e=BigInt(e);r;)n.unshift(Number(r%e)),r/=e;return n},toLEBuff:GB,toNumber:TB,toRprBE:OB,toRprLE:kB,toString:PB,zero:VB});const YB=[];for(let t=0;t<256;t++)YB[t]=zB(t,8);function zB(t,e){let n=0,r=t;for(let t=0;t<e;t++)n<<=1,n|=1&r,r>>=1;return n}function JB(t,e,n){if(AB(n))return t.one;const r=CB(n);if(0==r.length)return t.one;let i=e;for(let n=r.length-2;n>=0;n--)i=t.square(i),r[n]&&(i=t.mul(i,e));return i}function WB(t){if(t.m%2==1)if(LB(_B(t.p,4),1))if(LB(_B(t.p,8),1))if(LB(_B(t.p,16),1))!function(t){t.sqrt_q=NB(t.p,t.m),t.sqrt_s=0,t.sqrt_t=DB(t.sqrt_q,1);for(;!BB(t.sqrt_t);)t.sqrt_s=t.sqrt_s+1,t.sqrt_t=SB(t.sqrt_t,2);let e=t.one;for(;t.eq(e,t.one);){const n=t.random();t.sqrt_z=t.pow(n,t.sqrt_t),e=t.pow(t.sqrt_z,2**(t.sqrt_s-1))}t.sqrt_tm1d2=SB(DB(t.sqrt_t,1),2),t.sqrt=function(t){const e=this;if(e.isZero(t))return e.zero;let n=e.pow(t,e.sqrt_tm1d2);const r=e.pow(e.mul(e.square(n),t),2**(e.sqrt_s-1));if(e.eq(r,e.negone))return null;let i=e.sqrt_s,o=e.mul(t,n),s=e.mul(o,n),a=e.sqrt_z;for(;!e.eq(s,e.one);){let t=e.square(s),r=1;for(;!e.eq(t,e.one);)t=e.square(t),r++;n=a;for(let t=0;t<i-r-1;t++)n=e.square(n);a=e.square(n),s=e.mul(s,a),o=e.mul(o,n),i=r}return e.geq(o,e.zero)?o:e.neg(o)}}(t);else{if(!LB(_B(t.p,16),9))throw new Error("Field withot sqrt");!function(t){t.sqrt=function(){throw new Error("Sqrt alg 4 not implemented")}}(t)}else{if(!LB(_B(t.p,8),5))throw new Error("Field withot sqrt");!function(t){t.sqrt=function(){throw new Error("Sqrt alg 3 not implemented")}}(t)}else LB(_B(t.p,4),3)&&function(t){t.sqrt_q=NB(t.p,t.m),t.sqrt_e1=SB(DB(t.sqrt_q,3),4),t.sqrt=function(e){if(this.isZero(e))return this.zero;const n=this.pow(e,this.sqrt_e1),r=this.mul(this.square(n),e);if(this.eq(r,this.negone))return null;const i=this.mul(n,e);return t.geq(i,t.zero)?i:t.neg(i)}}(t);else{const e=_B(NB(t.p,t.m/2),4);1==e?function(t){t.sqrt=function(){throw new Error("Sqrt alg 10 not implemented")}}(t):3==e?function(t){t.sqrt_q=NB(t.p,t.m/2),t.sqrt_e34=SB(DB(t.sqrt_q,3),4),t.sqrt_e12=SB(DB(t.sqrt_q,1),2),t.frobenius=function(e,n){return e%2==1?t.conjugate(n):n},t.sqrt=function(t){const e=this,n=e.pow(t,e.sqrt_e34),r=e.mul(e.square(n),t),i=e.mul(e.frobenius(1,r),r);if(e.eq(i,e.negone))return null;const o=e.mul(n,t);let s;if(e.eq(r,e.negone))s=e.mul(o,[e.F.zero,e.F.one]);else{const t=e.pow(e.add(e.one,r),e.sqrt_e12);s=e.mul(t,o)}return e.geq(s,e.zero)?s:e.neg(s)}}(t):function(t){t.sqrt=function(){throw new Error("Sqrt alg 8 not implemented")}}(t)}}function qB(t,e,n,r,i){t[e]=t[e]+t[n]>>>0,t[i]=(t[i]^t[e])>>>0,t[i]=(t[i]<<16|t[i]>>>16&65535)>>>0,t[r]=t[r]+t[i]>>>0,t[n]=(t[n]^t[r])>>>0,t[n]=(t[n]<<12|t[n]>>>20&4095)>>>0,t[e]=t[e]+t[n]>>>0,t[i]=(t[i]^t[e])>>>0,t[i]=(t[i]<<8|t[i]>>>24&255)>>>0,t[r]=t[r]+t[i]>>>0,t[n]=(t[n]^t[r])>>>0,t[n]=(t[n]<<7|t[n]>>>25&127)>>>0}function KB(t){qB(t,0,4,8,12),qB(t,1,5,9,13),qB(t,2,6,10,14),qB(t,3,7,11,15),qB(t,0,5,10,15),qB(t,1,6,11,12),qB(t,2,7,8,13),qB(t,3,4,9,14)}class ZB{constructor(t){t=t||[0,0,0,0,0,0,0,0],this.state=[1634760805,857760878,2036477234,1797285236,t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],0,0,0,0],this.idx=16,this.buff=new Array(16)}nextU32(){return 16==this.idx&&this.update(),this.buff[this.idx++]}nextU64(){return bB(MB(this.nextU32(),4294967296),this.nextU32())}nextBool(){return!(1&~this.nextU32())}update(){for(let t=0;t<16;t++)this.buff[t]=this.state[t];for(let t=0;t<10;t++)KB(this.buff);for(let t=0;t<16;t++)this.buff[t]=this.buff[t]+this.state[t]>>>0;this.idx=0,this.state[12]=this.state[12]+1>>>0,0==this.state[12]&&(this.state[13]=this.state[13]+1>>>0,0==this.state[13]&&(this.state[14]=this.state[14]+1>>>0,0==this.state[14]&&(this.state[15]=this.state[15]+1>>>0)))}}function XB(t){let e=new Uint8Array(t);if(void 0!==globalThis.crypto)globalThis.crypto.getRandomValues(e);else for(let n=0;n<t;n++)e[n]=4294967296*Math.random()>>>0;return e}let $B=null;function tI(){return $B||($B=new ZB(function(){const t=XB(32),e=new Uint32Array(t.buffer),n=[];for(let t=0;t<8;t++)n.push(e[t]);return n}()),$B)}class eI{constructor(t,e,n){this.F=e,this.G=t,this.opMulGF=n;let r=e.sqrt_t||e.t,i=e.sqrt_s||e.s,o=e.one;for(;e.eq(e.pow(o,e.half),e.one);)o=e.add(o,e.one);this.w=new Array(i+1),this.wi=new Array(i+1),this.w[i]=this.F.pow(o,r),this.wi[i]=this.F.inv(this.w[i]);let s=i-1;for(;s>=0;)this.w[s]=this.F.square(this.w[s+1]),this.wi[s]=this.F.square(this.wi[s+1]),s--;this.roots=[],this._setRoots(Math.min(i,15))}_setRoots(t){for(let e=t;e>=0&&!this.roots[e];e--){let t=this.F.one;const n=1<<e,r=new Array(n);for(let i=0;i<n;i++)r[i]=t,t=this.F.mul(t,this.w[e]);this.roots[e]=r}}fft(t){if(t.length<=1)return t;const e=nI(t.length-1)+1;this._setRoots(e);const n=1<<e;if(t.length!=n)throw new Error("Size must be multiple of 2");return rI(this,t,e,0,1)}ifft(t){if(t.length<=1)return t;const e=nI(t.length-1)+1;this._setRoots(e);const n=1<<e;if(t.length!=n)throw new Error("Size must be multiple of 2");const r=rI(this,t,e,0,1),i=this.F.inv(this.F.mulScalar(this.F.one,n)),o=new Array(n);for(let t=0;t<n;t++)o[t]=this.opMulGF(r[(n-t)%n],i);return o}}function nI(t){return(4294901760&t?(t&=4294901760,16):0)|(4278255360&t?(t&=4278255360,8):0)|(4042322160&t?(t&=4042322160,4):0)|(3435973836&t?(t&=3435973836,2):0)|!!(2863311530&t)}function rI(t,e,n,r,i){const o=1<<n;if(1==o)return[e[r]];if(2==o)return[t.G.add(e[r],e[r+i]),t.G.sub(e[r],e[r+i])];const s=o>>1,a=rI(t,e,n-1,r,2*i),c=rI(t,e,n-1,r+i,2*i),l=new Array(o);for(let e=0;e<s;e++)l[e]=t.G.add(a[e],t.opMulGF(c[e],t.roots[n][e])),l[e+s]=t.G.sub(a[e],t.opMulGF(c[e],t.roots[n][e]));return l}class iI{constructor(t){this.type="F1",this.one=BigInt(1),this.zero=BigInt(0),this.p=BigInt(t),this.m=1,this.negone=this.p-this.one,this.two=BigInt(2),this.half=this.p>>this.one,this.bitLength=fB(this.p),this.mask=(this.one<<BigInt(this.bitLength))-this.one,this.n64=Math.floor((this.bitLength-1)/64)+1,this.n32=2*this.n64,this.n8=8*this.n64,this.R=this.e(this.one<<BigInt(64*this.n64)),this.Ri=this.inv(this.R);const e=this.negone>>this.one;this.nqr=this.two;let n=this.pow(this.nqr,e);for(;!this.eq(n,this.negone);)this.nqr=this.nqr+this.one,n=this.pow(this.nqr,e);for(this.s=0,this.t=this.negone;(this.t&this.one)==this.zero;)this.s=this.s+1,this.t=this.t>>this.one;this.nqr_to_t=this.pow(this.nqr,this.t),WB(this),this.FFT=new eI(this,this,this.mul.bind(this)),this.fft=this.FFT.fft.bind(this.FFT),this.ifft=this.FFT.ifft.bind(this.FFT),this.w=this.FFT.w,this.wi=this.FFT.wi,this.shift=this.square(this.nqr),this.k=this.exp(this.nqr,2**this.s)}e(t,e){let n;if(e?16==e&&(n=BigInt("0x"+t)):n=BigInt(t),n<0){let t=-n;return t>=this.p&&(t%=this.p),this.p-t}return n>=this.p?n%this.p:n}add(t,e){const n=t+e;return n>=this.p?n-this.p:n}sub(t,e){return t>=e?t-e:this.p-e+t}neg(t){return t?this.p-t:t}mul(t,e){return t*e%this.p}mulScalar(t,e){return t*this.e(e)%this.p}square(t){return t*t%this.p}eq(t,e){return t==e}neq(t,e){return t!=e}lt(t,e){return(t>this.half?t-this.p:t)<(e>this.half?e-this.p:e)}gt(t,e){return(t>this.half?t-this.p:t)>(e>this.half?e-this.p:e)}leq(t,e){return(t>this.half?t-this.p:t)<=(e>this.half?e-this.p:e)}geq(t,e){return(t>this.half?t-this.p:t)>=(e>this.half?e-this.p:e)}div(t,e){return this.mul(t,this.inv(e))}idiv(t,e){if(!e)throw new Error("Division by zero");return t/e}inv(t){if(!t)throw new Error("Division by zero");let e=this.zero,n=this.p,r=this.one,i=t%this.p;for(;i;){let t=n/i;[e,r]=[r,e-t*r],[n,i]=[i,n-t*i]}return e<this.zero&&(e+=this.p),e}mod(t,e){return t%e}pow(t,e){return JB(this,t,e)}exp(t,e){return JB(this,t,e)}band(t,e){const n=t&e&this.mask;return n>=this.p?n-this.p:n}bor(t,e){const n=(t|e)&this.mask;return n>=this.p?n-this.p:n}bxor(t,e){const n=(t^e)&this.mask;return n>=this.p?n-this.p:n}bnot(t){const e=t^this.mask;return e>=this.p?e-this.p:e}shl(t,e){if(Number(e)<this.bitLength){const n=t<<e&this.mask;return n>=this.p?n-this.p:n}{const n=this.p-e;return Number(n)<this.bitLength?t>>n:this.zero}}shr(t,e){if(Number(e)<this.bitLength)return t>>e;{const n=this.p-e;if(Number(n)<this.bitLength){const e=t<<n&this.mask;return e>=this.p?e-this.p:e}return 0}}land(t,e){return t&&e?this.one:this.zero}lor(t,e){return t||e?this.one:this.zero}lnot(t){return t?this.zero:this.one}sqrt_old(t){if(t==this.zero)return this.zero;if(this.pow(t,this.negone>>this.one)!=this.one)return null;let e=this.s,n=this.nqr_to_t,r=this.pow(t,this.t),i=this.pow(t,this.add(this.t,this.one)>>this.one);for(;r!=this.one;){let t=this.square(r),o=1;for(;t!=this.one;)o++,t=this.square(t);let s=n;for(let t=0;t<e-o-1;t++)s=this.square(s);e=o,n=this.square(s),r=this.mul(r,n),i=this.mul(i,s)}return i>this.p>>this.one&&(i=this.neg(i)),i}normalize(t,e){if((t=BigInt(t,e))<0){let e=-t;return e>=this.p&&(e%=this.p),this.p-e}return t>=this.p?t%this.p:t}random(){const t=2*this.bitLength/8;let e=this.zero;for(let n=0;n<t;n++)e=(e<<BigInt(8))+BigInt(XB(1)[0]);return e%this.p}toString(t,e){let n;if(e=e||10,t>this.half&&10==e){n="-"+(this.p-t).toString(e)}else n=t.toString(e);return n}isZero(t){return t==this.zero}fromRng(t){let e;do{e=this.zero;for(let n=0;n<this.n64;n++)e+=t.nextU64()<<BigInt(64*n);e&=this.mask}while(e>=this.p);return e=e*this.Ri%this.p,e}fft(t){return this.FFT.fft(t)}ifft(t){return this.FFT.ifft(t)}toRprLE(t,e,n){kB(t,e,n,8*this.n64)}toRprBE(t,e,n){OB(t,e,n,8*this.n64)}toRprBEM(t,e,n){return this.toRprBE(t,e,this.mul(this.R,n))}toRprLEM(t,e,n){return this.toRprLE(t,e,this.mul(this.R,n))}fromRprLE(t,e){return QB(t,e,this.n8)}fromRprBE(t,e){return UB(t,e,this.n8)}fromRprLEM(t,e){return this.mul(this.fromRprLE(t,e),this.Ri)}fromRprBEM(t,e){return this.mul(this.fromRprBE(t,e),this.Ri)}toObject(t){return t}}var oI={bigInt2BytesLE:function(t,e){const n=Array(e);let r=BigInt(t);for(let t=0;t<e;t++)n[t]=Number(0xFFn&r),r>>=8n;return n},bigInt2U32LE:function(t,e){const n=Array(e);let r=BigInt(t);for(let t=0;t<e;t++)n[t]=Number(0xFFFFFFFFn&r),r>>=32n;return n},isOcamNum:function(t){return!!Array.isArray(t)&&(3==t.length&&("number"==typeof t[0]&&("number"==typeof t[1]&&!!Array.isArray(t[2]))))}},sI=function(t,e,n,r,i,o,s){const a=t.addFunction(e);a.addParam("base","i32"),a.addParam("scalar","i32"),a.addParam("scalarLength","i32"),a.addParam("r","i32"),a.addLocal("i","i32"),a.addLocal("b","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(n));a.addCode(c.if(c.i32_eqz(c.getLocal("scalarLength")),[...c.call(s,c.getLocal("r")),...c.ret([])])),a.addCode(c.call(o,c.getLocal("base"),l)),a.addCode(c.call(s,c.getLocal("r"))),a.addCode(c.setLocal("i",c.getLocal("scalarLength"))),a.addCode(c.block(c.loop(c.setLocal("i",c.i32_sub(c.getLocal("i"),c.i32_const(1))),c.setLocal("b",c.i32_load8_u(c.i32_add(c.getLocal("scalar"),c.getLocal("i")))),...function(){const t=[];for(let e=0;e<8;e++)t.push(...c.call(i,c.getLocal("r"),c.getLocal("r")),...c.if(c.i32_ge_u(c.getLocal("b"),c.i32_const(128>>e)),[...c.setLocal("b",c.i32_sub(c.getLocal("b"),c.i32_const(128>>e))),...c.call(r,c.getLocal("r"),l,c.getLocal("r"))]));return t}(),c.br_if(1,c.i32_eqz(c.getLocal("i"))),c.br(0))))},aI=function(t,e){const n=8*t.modules[e].n64,r=t.addFunction(e+"_batchInverse");r.addParam("pIn","i32"),r.addParam("inStep","i32"),r.addParam("n","i32"),r.addParam("pOut","i32"),r.addParam("outStep","i32"),r.addLocal("itAux","i32"),r.addLocal("itIn","i32"),r.addLocal("itOut","i32"),r.addLocal("i","i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(n));r.addCode(i.setLocal("itAux",i.i32_load(i.i32_const(0))),i.i32_store(i.i32_const(0),i.i32_add(i.getLocal("itAux"),i.i32_mul(i.i32_add(i.getLocal("n"),i.i32_const(1)),i.i32_const(n))))),r.addCode(i.call(e+"_one",i.getLocal("itAux")),i.setLocal("itIn",i.getLocal("pIn")),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(n))),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.if(i.call(e+"_isZero",i.getLocal("itIn")),i.call(e+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(n)),i.getLocal("itAux")),i.call(e+"_mul",i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(n)),i.getLocal("itAux"))),i.setLocal("itIn",i.i32_add(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(n))),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(n))),i.setLocal("itOut",i.i32_add(i.getLocal("pOut"),i.i32_mul(i.i32_sub(i.getLocal("n"),i.i32_const(1)),i.getLocal("outStep")))),i.call(e+"_inverse",i.getLocal("itAux"),i.getLocal("itAux")),i.block(i.loop(i.br_if(1,i.i32_eqz(i.getLocal("i"))),i.if(i.call(e+"_isZero",i.getLocal("itIn")),[...i.call(e+"_copy",i.getLocal("itAux"),i.i32_sub(i.getLocal("itAux"),i.i32_const(n))),...i.call(e+"_zero",i.getLocal("itOut"))],[...i.call(e+"_copy",i.i32_sub(i.getLocal("itAux"),i.i32_const(n)),o),...i.call(e+"_mul",i.getLocal("itAux"),i.getLocal("itIn"),i.i32_sub(i.getLocal("itAux"),i.i32_const(n))),...i.call(e+"_mul",i.getLocal("itAux"),o,i.getLocal("itOut"))]),i.setLocal("itIn",i.i32_sub(i.getLocal("itIn"),i.getLocal("inStep"))),i.setLocal("itOut",i.i32_sub(i.getLocal("itOut"),i.getLocal("outStep"))),i.setLocal("itAux",i.i32_sub(i.getLocal("itAux"),i.i32_const(n))),i.setLocal("i",i.i32_sub(i.getLocal("i"),i.i32_const(1))),i.br(0)))),r.addCode(i.i32_store(i.i32_const(0),i.getLocal("itAux")))};var cI=function(t,e,n,r,i,o){void 0===o&&(o=r<i);const s=t.addFunction(e);s.addParam("pIn","i32"),s.addParam("n","i32"),s.addParam("pOut","i32"),s.addLocal("i","i32"),s.addLocal("itIn","i32"),s.addLocal("itOut","i32");const a=s.getCodeBuilder();o?s.addCode(a.setLocal("itIn",a.i32_add(a.getLocal("pIn"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.i32_const(1)),a.i32_const(r)))),a.setLocal("itOut",a.i32_add(a.getLocal("pOut"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.i32_const(1)),a.i32_const(i)))),a.setLocal("i",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("i"),a.getLocal("n"))),a.call(n,a.getLocal("itIn"),a.getLocal("itOut")),a.setLocal("itIn",a.i32_sub(a.getLocal("itIn"),a.i32_const(r))),a.setLocal("itOut",a.i32_sub(a.getLocal("itOut"),a.i32_const(i))),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0)))):s.addCode(a.setLocal("itIn",a.getLocal("pIn")),a.setLocal("itOut",a.getLocal("pOut")),a.setLocal("i",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("i"),a.getLocal("n"))),a.call(n,a.getLocal("itIn"),a.getLocal("itOut")),a.setLocal("itIn",a.i32_add(a.getLocal("itIn"),a.i32_const(r))),a.setLocal("itOut",a.i32_add(a.getLocal("itOut"),a.i32_const(i))),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0))))};var lI=function(t,e,n,r,i,o){void 0===o&&(o=r<i);const s=t.addFunction(e);s.addParam("pIn1","i32"),s.addParam("pIn2","i32"),s.addParam("n","i32"),s.addParam("pOut","i32"),s.addLocal("i","i32"),s.addLocal("itIn1","i32"),s.addLocal("itIn2","i32"),s.addLocal("itOut","i32");const a=s.getCodeBuilder();o?s.addCode(a.setLocal("itIn1",a.i32_add(a.getLocal("pIn1"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.i32_const(1)),a.i32_const(r)))),a.setLocal("itIn2",a.i32_add(a.getLocal("pIn2"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.i32_const(1)),a.i32_const(r)))),a.setLocal("itOut",a.i32_add(a.getLocal("pOut"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.i32_const(1)),a.i32_const(i)))),a.setLocal("i",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("i"),a.getLocal("n"))),a.call(n,a.getLocal("itIn1"),a.getLocal("itIn2"),a.getLocal("itOut")),a.setLocal("itIn1",a.i32_sub(a.getLocal("itIn1"),a.i32_const(r))),a.setLocal("itIn2",a.i32_sub(a.getLocal("itIn2"),a.i32_const(r))),a.setLocal("itOut",a.i32_sub(a.getLocal("itOut"),a.i32_const(i))),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0)))):s.addCode(a.setLocal("itIn1",a.getLocal("pIn1")),a.setLocal("itIn2",a.getLocal("pIn2")),a.setLocal("itOut",a.getLocal("pOut")),a.setLocal("i",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("i"),a.getLocal("n"))),a.call(n,a.getLocal("itIn1"),a.getLocal("itIn2"),a.getLocal("itOut")),a.setLocal("itIn1",a.i32_add(a.getLocal("itIn1"),a.i32_const(r))),a.setLocal("itIn2",a.i32_add(a.getLocal("itIn2"),a.i32_const(r))),a.setLocal("itOut",a.i32_add(a.getLocal("itOut"),a.i32_const(i))),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0))))};var uI={};function hI(t,e){return t===e?0:t>e?1:-1}function dI(t){return t*t}function pI(t){return t%2n!=0n}function fI(t){return t%2n==0n}function gI(t){return t<0n}function AI(t){return t>0n}function EI(t){return gI(t)?t.toString(2).length-1:t.toString(2).length}function mI(t){return t<0n?-t:t}function wI(t){return 1n===mI(t)}function yI(t,e){for(var n,r,i,o=0n,s=1n,a=e,c=mI(t);0n!==c;)n=a/c,r=o,i=a,o=s,a=c,s=r-n*s,c=i-n*c;if(!wI(a))throw new Error(t.toString()+" and "+e.toString()+" are not co-prime");return-1===hI(o,0n)&&(o+=e),gI(t)?-o:o}function BI(t,e,n){if(0n===n)throw new Error("Cannot take modPow with modulus 0");var r=1n,i=t%n;for(gI(e)&&(e*=-1n,i=yI(i,n));AI(e);){if(0n===i)return 0n;pI(e)&&(r=r*i%n),e/=2n,i=dI(i)%n}return r}function II(t,e){return 0n!==e&&(!!wI(e)||(0===function(t,e){return(t=t>=0n?t:-t)===(e=e>=0n?e:-e)?0:t>e?1:-1}(e,2n)?fI(t):t%e===0n))}function CI(t,e){for(var n,r,i,o=function(t){return t-1n}(t),s=o,a=0;fI(s);)s/=2n,a++;t:for(r=0;r<e.length;r++)if(!(t<e[r]||wI(i=BI(BigInt(e[r]),s,t))||i===o)){for(n=a-1;0!=n;n--){if(wI(i=dI(i)%t))return!1;if(i===o)continue t}return!1}return!0}uI.bitLength=EI,uI.isOdd=pI,uI.isNegative=gI,uI.abs=mI,uI.isUnit=wI,uI.compare=hI,uI.modInv=yI,uI.modPow=BI,uI.isPrime=function(t){var e=function(t){var e=mI(t);return!wI(e)&&(2n===e||3n===e||5n===e||!(fI(e)||II(e,3n)||II(e,5n))&&(e<49n||void 0))}(t);if(void 0!==e)return e;var n=mI(t),r=EI(n);if(r<=64)return CI(n,[2,3,5,7,11,13,17,19,23,29,31,37]);for(var i=Math.log(2)*Number(r),o=Math.ceil(i),s=[],a=0;a<o;a++)s.push(BigInt(a+2));return CI(n,s)},uI.square=dI;const TI=function(t,e,n){const r=n||"int";if(t.modules[r])return r;t.modules[r]={};const i=2*e,o=8*e;return function(){const n=t.addFunction(r+"_copy");n.addParam("px","i32"),n.addParam("pr","i32");const i=n.getCodeBuilder();for(let t=0;t<e;t++)n.addCode(i.i64_store(i.getLocal("pr"),8*t,i.i64_load(i.getLocal("px"),8*t)))}(),function(){const n=t.addFunction(r+"_zero");n.addParam("pr","i32");const i=n.getCodeBuilder();for(let t=0;t<e;t++)n.addCode(i.i64_store(i.getLocal("pr"),8*t,i.i64_const(0)))}(),function(){const n=t.addFunction(r+"_isZero");n.addParam("px","i32"),n.setReturnType("i32");const i=n.getCodeBuilder();n.addCode(function t(e){return 0==e?i.ret(i.i64_eqz(i.i64_load(i.getLocal("px")))):i.if(i.i64_eqz(i.i64_load(i.getLocal("px"),8*e)),t(e-1),i.ret(i.i32_const(0)))}(e-1)),n.addCode(i.ret(i.i32_const(0)))}(),function(){const n=t.addFunction(r+"_one");n.addParam("pr","i32");const i=n.getCodeBuilder();n.addCode(i.i64_store(i.getLocal("pr"),0,i.i64_const(1)));for(let t=1;t<e;t++)n.addCode(i.i64_store(i.getLocal("pr"),8*t,i.i64_const(0)))}(),function(){const n=t.addFunction(r+"_eq");n.addParam("px","i32"),n.addParam("py","i32"),n.setReturnType("i32");const i=n.getCodeBuilder();n.addCode(function t(e){return 0==e?i.ret(i.i64_eq(i.i64_load(i.getLocal("px")),i.i64_load(i.getLocal("py")))):i.if(i.i64_eq(i.i64_load(i.getLocal("px"),8*e),i.i64_load(i.getLocal("py"),8*e)),t(e-1),i.ret(i.i32_const(0)))}(e-1)),n.addCode(i.ret(i.i32_const(0)))}(),function(){const n=t.addFunction(r+"_gte");n.addParam("px","i32"),n.addParam("py","i32"),n.setReturnType("i32");const i=n.getCodeBuilder();n.addCode(function t(e){return 0==e?i.ret(i.i64_ge_u(i.i64_load(i.getLocal("px")),i.i64_load(i.getLocal("py")))):i.if(i.i64_lt_u(i.i64_load(i.getLocal("px"),8*e),i.i64_load(i.getLocal("py"),8*e)),i.ret(i.i32_const(0)),i.if(i.i64_gt_u(i.i64_load(i.getLocal("px"),8*e),i.i64_load(i.getLocal("py"),8*e)),i.ret(i.i32_const(1)),t(e-1)))}(e-1)),n.addCode(i.ret(i.i32_const(0)))}(),function(){const e=t.addFunction(r+"_add");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32"),e.setReturnType("i32"),e.addLocal("c","i64");const n=e.getCodeBuilder();e.addCode(n.setLocal("c",n.i64_add(n.i64_load32_u(n.getLocal("x")),n.i64_load32_u(n.getLocal("y"))))),e.addCode(n.i64_store32(n.getLocal("r"),n.getLocal("c")));for(let t=1;t<i;t++)e.addCode(n.setLocal("c",n.i64_add(n.i64_add(n.i64_load32_u(n.getLocal("x"),4*t),n.i64_load32_u(n.getLocal("y"),4*t)),n.i64_shr_u(n.getLocal("c"),n.i64_const(32))))),e.addCode(n.i64_store32(n.getLocal("r"),4*t,n.getLocal("c")));e.addCode(n.i32_wrap_i64(n.i64_shr_u(n.getLocal("c"),n.i64_const(32))))}(),function(){const e=t.addFunction(r+"_sub");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32"),e.setReturnType("i32"),e.addLocal("c","i64");const n=e.getCodeBuilder();e.addCode(n.setLocal("c",n.i64_sub(n.i64_load32_u(n.getLocal("x")),n.i64_load32_u(n.getLocal("y"))))),e.addCode(n.i64_store32(n.getLocal("r"),n.i64_and(n.getLocal("c"),n.i64_const("0xFFFFFFFF"))));for(let t=1;t<i;t++)e.addCode(n.setLocal("c",n.i64_add(n.i64_sub(n.i64_load32_u(n.getLocal("x"),4*t),n.i64_load32_u(n.getLocal("y"),4*t)),n.i64_shr_s(n.getLocal("c"),n.i64_const(32))))),e.addCode(n.i64_store32(n.getLocal("r"),4*t,n.i64_and(n.getLocal("c"),n.i64_const("0xFFFFFFFF"))));e.addCode(n.i32_wrap_i64(n.i64_shr_s(n.getLocal("c"),n.i64_const(32))))}(),function(){const e=t.addFunction(r+"_mul");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32"),e.addLocal("c0","i64"),e.addLocal("c1","i64");for(let t=0;t<i;t++)e.addLocal("x"+t,"i64"),e.addLocal("y"+t,"i64");const n=e.getCodeBuilder(),o=[],s=[];function a(t,e){let r,i;return o[t]?r=n.getLocal("x"+t):(r=n.teeLocal("x"+t,n.i64_load32_u(n.getLocal("x"),4*t)),o[t]=!0),s[e]?i=n.getLocal("y"+e):(i=n.teeLocal("y"+e,n.i64_load32_u(n.getLocal("y"),4*e)),s[e]=!0),n.i64_mul(r,i)}let c="c0",l="c1";for(let t=0;t<2*i-1;t++){for(let r=Math.max(0,t-i+1);r<=t&&r<i;r++){const i=t-r;e.addCode(n.setLocal(c,n.i64_add(n.i64_and(n.getLocal(c),n.i64_const(4294967295)),a(r,i)))),e.addCode(n.setLocal(l,n.i64_add(n.getLocal(l),n.i64_shr_u(n.getLocal(c),n.i64_const(32)))))}e.addCode(n.i64_store32(n.getLocal("r"),4*t,n.getLocal(c))),[c,l]=[l,c],e.addCode(n.setLocal(l,n.i64_shr_u(n.getLocal(c),n.i64_const(32))))}e.addCode(n.i64_store32(n.getLocal("r"),4*i*2-4,n.getLocal(c)))}(),function(){const e=t.addFunction(r+"_square");e.addParam("x","i32"),e.addParam("r","i32"),e.addLocal("c0","i64"),e.addLocal("c1","i64"),e.addLocal("c0_old","i64"),e.addLocal("c1_old","i64");for(let t=0;t<i;t++)e.addLocal("x"+t,"i64");const n=e.getCodeBuilder(),o=[];function s(t,e){let r,i;return o[t]?r=n.getLocal("x"+t):(r=n.teeLocal("x"+t,n.i64_load32_u(n.getLocal("x"),4*t)),o[t]=!0),o[e]?i=n.getLocal("x"+e):(i=n.teeLocal("x"+e,n.i64_load32_u(n.getLocal("x"),4*e)),o[e]=!0),n.i64_mul(r,i)}let a="c0",c="c1",l="c0_old",u="c1_old";for(let t=0;t<2*i-1;t++){e.addCode(n.setLocal(a,n.i64_const(0)),n.setLocal(c,n.i64_const(0)));for(let r=Math.max(0,t-i+1);r<t+1>>1&&r<i;r++){const i=t-r;e.addCode(n.setLocal(a,n.i64_add(n.i64_and(n.getLocal(a),n.i64_const(4294967295)),s(r,i)))),e.addCode(n.setLocal(c,n.i64_add(n.getLocal(c),n.i64_shr_u(n.getLocal(a),n.i64_const(32)))))}e.addCode(n.setLocal(a,n.i64_shl(n.i64_and(n.getLocal(a),n.i64_const(4294967295)),n.i64_const(1)))),e.addCode(n.setLocal(c,n.i64_add(n.i64_shl(n.getLocal(c),n.i64_const(1)),n.i64_shr_u(n.getLocal(a),n.i64_const(32))))),t%2==0&&(e.addCode(n.setLocal(a,n.i64_add(n.i64_and(n.getLocal(a),n.i64_const(4294967295)),s(t>>1,t>>1)))),e.addCode(n.setLocal(c,n.i64_add(n.getLocal(c),n.i64_shr_u(n.getLocal(a),n.i64_const(32)))))),t>0&&(e.addCode(n.setLocal(a,n.i64_add(n.i64_and(n.getLocal(a),n.i64_const(4294967295)),n.i64_and(n.getLocal(l),n.i64_const(4294967295))))),e.addCode(n.setLocal(c,n.i64_add(n.i64_add(n.getLocal(c),n.i64_shr_u(n.getLocal(a),n.i64_const(32))),n.getLocal(u))))),e.addCode(n.i64_store32(n.getLocal("r"),4*t,n.getLocal(a))),e.addCode(n.setLocal(l,n.getLocal(c)),n.setLocal(u,n.i64_shr_u(n.getLocal(l),n.i64_const(32))))}e.addCode(n.i64_store32(n.getLocal("r"),4*i*2-4,n.getLocal(l)))}(),function(){const e=t.addFunction(r+"_squareOld");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(r+"_mul",n.getLocal("x"),n.getLocal("x"),n.getLocal("r")))}(),function(){!function(){const e=t.addFunction(r+"__mul1");e.addParam("px","i32"),e.addParam("y","i64"),e.addParam("pr","i32"),e.addLocal("c","i64");const n=e.getCodeBuilder();e.addCode(n.setLocal("c",n.i64_mul(n.i64_load32_u(n.getLocal("px"),0,0),n.getLocal("y")))),e.addCode(n.i64_store32(n.getLocal("pr"),0,0,n.getLocal("c")));for(let t=1;t<i;t++)e.addCode(n.setLocal("c",n.i64_add(n.i64_mul(n.i64_load32_u(n.getLocal("px"),4*t,0),n.getLocal("y")),n.i64_shr_u(n.getLocal("c"),n.i64_const(32))))),e.addCode(n.i64_store32(n.getLocal("pr"),4*t,0,n.getLocal("c")))}(),function(){const e=t.addFunction(r+"__add1");e.addParam("x","i32"),e.addParam("y","i64"),e.addLocal("c","i64"),e.addLocal("px","i32");const n=e.getCodeBuilder();e.addCode(n.setLocal("px",n.getLocal("x"))),e.addCode(n.setLocal("c",n.i64_add(n.i64_load32_u(n.getLocal("px"),0,0),n.getLocal("y")))),e.addCode(n.i64_store32(n.getLocal("px"),0,0,n.getLocal("c"))),e.addCode(n.setLocal("c",n.i64_shr_u(n.getLocal("c"),n.i64_const(32)))),e.addCode(n.block(n.loop(n.br_if(1,n.i64_eqz(n.getLocal("c"))),n.setLocal("px",n.i32_add(n.getLocal("px"),n.i32_const(4))),n.setLocal("c",n.i64_add(n.i64_load32_u(n.getLocal("px"),0,0),n.getLocal("c"))),n.i64_store32(n.getLocal("px"),0,0,n.getLocal("c")),n.setLocal("c",n.i64_shr_u(n.getLocal("c"),n.i64_const(32))),n.br(0))))}();const e=t.addFunction(r+"_div");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("c","i32"),e.addParam("r","i32"),e.addLocal("rr","i32"),e.addLocal("cc","i32"),e.addLocal("eX","i32"),e.addLocal("eY","i32"),e.addLocal("sy","i64"),e.addLocal("sx","i64"),e.addLocal("ec","i32");const n=e.getCodeBuilder(),s=n.i32_const(t.alloc(o)),a=n.i32_const(t.alloc(o)),c=n.i32_const(t.alloc(o)),l=n.getLocal("cc"),u=n.getLocal("rr"),h=t.alloc(2*o),d=n.i32_const(h),p=n.i32_const(h+o);e.addCode(n.if(n.getLocal("c"),n.setLocal("cc",n.getLocal("c")),n.setLocal("cc",a))),e.addCode(n.if(n.getLocal("r"),n.setLocal("rr",n.getLocal("r")),n.setLocal("rr",c))),e.addCode(n.call(r+"_copy",n.getLocal("x"),u)),e.addCode(n.call(r+"_copy",n.getLocal("y"),s)),e.addCode(n.call(r+"_zero",l)),e.addCode(n.call(r+"_zero",d)),e.addCode(n.setLocal("eX",n.i32_const(o-1))),e.addCode(n.setLocal("eY",n.i32_const(o-1))),e.addCode(n.block(n.loop(n.br_if(1,n.i32_or(n.i32_load8_u(n.i32_add(s,n.getLocal("eY")),0,0),n.i32_eq(n.getLocal("eY"),n.i32_const(3)))),n.setLocal("eY",n.i32_sub(n.getLocal("eY"),n.i32_const(1))),n.br(0)))),e.addCode(n.setLocal("sy",n.i64_add(n.i64_load32_u(n.i32_sub(n.i32_add(s,n.getLocal("eY")),n.i32_const(3)),0,0),n.i64_const(1)))),e.addCode(n.if(n.i64_eq(n.getLocal("sy"),n.i64_const(1)),n.drop(n.i64_div_u(n.i64_const(0),n.i64_const(0))))),e.addCode(n.block(n.loop(n.block(n.loop(n.br_if(1,n.i32_or(n.i32_load8_u(n.i32_add(u,n.getLocal("eX")),0,0),n.i32_eq(n.getLocal("eX"),n.i32_const(7)))),n.setLocal("eX",n.i32_sub(n.getLocal("eX"),n.i32_const(1))),n.br(0))),n.setLocal("sx",n.i64_load(n.i32_sub(n.i32_add(u,n.getLocal("eX")),n.i32_const(7)),0,0)),n.setLocal("sx",n.i64_div_u(n.getLocal("sx"),n.getLocal("sy"))),n.setLocal("ec",n.i32_sub(n.i32_sub(n.getLocal("eX"),n.getLocal("eY")),n.i32_const(4))),n.block(n.loop(n.br_if(1,n.i32_and(n.i64_eqz(n.i64_and(n.getLocal("sx"),n.i64_const("0xFFFFFFFF00000000"))),n.i32_ge_s(n.getLocal("ec"),n.i32_const(0)))),n.setLocal("sx",n.i64_shr_u(n.getLocal("sx"),n.i64_const(8))),n.setLocal("ec",n.i32_add(n.getLocal("ec"),n.i32_const(1))),n.br(0))),n.if(n.i64_eqz(n.getLocal("sx")),[...n.br_if(2,n.i32_eqz(n.call(r+"_gte",u,s))),...n.setLocal("sx",n.i64_const(1)),...n.setLocal("ec",n.i32_const(0))]),n.call(r+"__mul1",s,n.getLocal("sx"),p),n.drop(n.call(r+"_sub",u,n.i32_sub(p,n.getLocal("ec")),u)),n.call(r+"__add1",n.i32_add(l,n.getLocal("ec")),n.getLocal("sx")),n.br(0))))}(),function(){const e=t.addFunction(r+"_inverseMod");e.addParam("px","i32"),e.addParam("pm","i32"),e.addParam("pr","i32"),e.addLocal("t","i32"),e.addLocal("newt","i32"),e.addLocal("r","i32"),e.addLocal("qq","i32"),e.addLocal("qr","i32"),e.addLocal("newr","i32"),e.addLocal("swp","i32"),e.addLocal("x","i32"),e.addLocal("signt","i32"),e.addLocal("signnewt","i32"),e.addLocal("signx","i32");const n=e.getCodeBuilder(),i=n.i32_const(t.alloc(o)),s=n.i32_const(t.alloc(o)),a=n.i32_const(t.alloc(o)),c=n.i32_const(t.alloc(o)),l=n.i32_const(t.alloc(o)),u=n.i32_const(t.alloc(o)),h=n.i32_const(t.alloc(2*o)),d=n.i32_const(t.alloc(o));e.addCode(n.setLocal("t",i),n.call(r+"_zero",i),n.setLocal("signt",n.i32_const(0))),e.addCode(n.setLocal("r",s),n.call(r+"_copy",n.getLocal("pm"),s)),e.addCode(n.setLocal("newt",a),n.call(r+"_one",a),n.setLocal("signnewt",n.i32_const(0))),e.addCode(n.setLocal("newr",c),n.call(r+"_copy",n.getLocal("px"),c)),e.addCode(n.setLocal("qq",l)),e.addCode(n.setLocal("qr",u)),e.addCode(n.setLocal("x",d)),e.addCode(n.block(n.loop(n.br_if(1,n.call(r+"_isZero",n.getLocal("newr"))),n.call(r+"_div",n.getLocal("r"),n.getLocal("newr"),n.getLocal("qq"),n.getLocal("qr")),n.call(r+"_mul",n.getLocal("qq"),n.getLocal("newt"),h),n.if(n.getLocal("signt"),n.if(n.getLocal("signnewt"),n.if(n.call(r+"_gte",h,n.getLocal("t")),[...n.drop(n.call(r+"_sub",h,n.getLocal("t"),n.getLocal("x"))),...n.setLocal("signx",n.i32_const(0))],[...n.drop(n.call(r+"_sub",n.getLocal("t"),h,n.getLocal("x"))),...n.setLocal("signx",n.i32_const(1))]),[...n.drop(n.call(r+"_add",h,n.getLocal("t"),n.getLocal("x"))),...n.setLocal("signx",n.i32_const(1))]),n.if(n.getLocal("signnewt"),[...n.drop(n.call(r+"_add",h,n.getLocal("t"),n.getLocal("x"))),...n.setLocal("signx",n.i32_const(0))],n.if(n.call(r+"_gte",n.getLocal("t"),h),[...n.drop(n.call(r+"_sub",n.getLocal("t"),h,n.getLocal("x"))),...n.setLocal("signx",n.i32_const(0))],[...n.drop(n.call(r+"_sub",h,n.getLocal("t"),n.getLocal("x"))),...n.setLocal("signx",n.i32_const(1))]))),n.setLocal("swp",n.getLocal("t")),n.setLocal("t",n.getLocal("newt")),n.setLocal("newt",n.getLocal("x")),n.setLocal("x",n.getLocal("swp")),n.setLocal("signt",n.getLocal("signnewt")),n.setLocal("signnewt",n.getLocal("signx")),n.setLocal("swp",n.getLocal("r")),n.setLocal("r",n.getLocal("newr")),n.setLocal("newr",n.getLocal("qr")),n.setLocal("qr",n.getLocal("swp")),n.br(0)))),e.addCode(n.if(n.getLocal("signt"),n.drop(n.call(r+"_sub",n.getLocal("pm"),n.getLocal("t"),n.getLocal("pr"))),n.call(r+"_copy",n.getLocal("t"),n.getLocal("pr"))))}(),t.exportFunction(r+"_copy"),t.exportFunction(r+"_zero"),t.exportFunction(r+"_one"),t.exportFunction(r+"_isZero"),t.exportFunction(r+"_eq"),t.exportFunction(r+"_gte"),t.exportFunction(r+"_add"),t.exportFunction(r+"_sub"),t.exportFunction(r+"_mul"),t.exportFunction(r+"_square"),t.exportFunction(r+"_squareOld"),t.exportFunction(r+"_div"),t.exportFunction(r+"_inverseMod"),r},bI=oI,DI=sI,vI=aI,MI=cI,NI=lI,{bitLength:SI,modInv:_I,modPow:LI,isPrime:xI,isOdd:RI,square:FI}=uI;var kI=function(t,e,n,r){const i=BigInt(e),o=Math.floor((SI(i-1n)-1)/64)+1,s=2*o,a=8*o,c=n||"f1m";if(t.modules[c])return c;const l=TI(t,o,r),u=t.alloc(a,bI.bigInt2BytesLE(i,a)),h=t.alloc(bI.bigInt2BytesLE(FI(1n<<BigInt(64*o))%i,a)),d=t.alloc(bI.bigInt2BytesLE((1n<<BigInt(64*o))%i,a)),p=t.alloc(bI.bigInt2BytesLE(0n,a)),f=i-1n,g=f>>1n,A=t.alloc(a,bI.bigInt2BytesLE(g,a)),E=g+1n,m=t.alloc(a,bI.bigInt2BytesLE(E,a));t.modules[c]={pq:u,pR2:h,n64:o,q:i,pOne:d,pZero:p,pePlusOne:m};let w=2n;if(xI(i))for(;LI(w,g,i)!==f;)w+=1n;let y=0,B=f;for(;!RI(B)&&0n!==B;)y++,B>>=1n;const I=t.alloc(a,bI.bigInt2BytesLE(B,a)),C=LI(w,B,i),T=t.alloc(bI.bigInt2BytesLE((C<<BigInt(64*o))%i,a)),b=B+1n>>1n,D=t.alloc(a,bI.bigInt2BytesLE(b,a));return t.exportFunction(l+"_copy",c+"_copy"),t.exportFunction(l+"_zero",c+"_zero"),t.exportFunction(l+"_isZero",c+"_isZero"),t.exportFunction(l+"_eq",c+"_eq"),function(){const e=t.addFunction(c+"_isOne");e.addParam("x","i32"),e.setReturnType("i32");const n=e.getCodeBuilder();e.addCode(n.ret(n.call(l+"_eq",n.getLocal("x"),n.i32_const(d))))}(),function(){const e=t.addFunction(c+"_add");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.if(n.call(l+"_add",n.getLocal("x"),n.getLocal("y"),n.getLocal("r")),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))),n.if(n.call(l+"_gte",n.getLocal("r"),n.i32_const(u)),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))))))}(),function(){const e=t.addFunction(c+"_sub");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.if(n.call(l+"_sub",n.getLocal("x"),n.getLocal("y"),n.getLocal("r")),n.drop(n.call(l+"_add",n.getLocal("r"),n.i32_const(u),n.getLocal("r")))))}(),function(){const e=t.addFunction(c+"_neg");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(c+"_sub",n.i32_const(p),n.getLocal("x"),n.getLocal("r")))}(),function(){const e=t.alloc(s*s*8),n=t.addFunction(c+"_mReduct");n.addParam("t","i32"),n.addParam("r","i32"),n.addLocal("np32","i64"),n.addLocal("c","i64"),n.addLocal("m","i64");const r=n.getCodeBuilder(),o=Number(0x100000000n-_I(i,0x100000000n));n.addCode(r.setLocal("np32",r.i64_const(o)));for(let t=0;t<s;t++){n.addCode(r.setLocal("c",r.i64_const(0))),n.addCode(r.setLocal("m",r.i64_and(r.i64_mul(r.i64_load32_u(r.getLocal("t"),4*t),r.getLocal("np32")),r.i64_const("0xFFFFFFFF"))));for(let e=0;e<s;e++)n.addCode(r.setLocal("c",r.i64_add(r.i64_add(r.i64_load32_u(r.getLocal("t"),4*(t+e)),r.i64_shr_u(r.getLocal("c"),r.i64_const(32))),r.i64_mul(r.i64_load32_u(r.i32_const(u),4*e),r.getLocal("m"))))),n.addCode(r.i64_store32(r.getLocal("t"),4*(t+e),r.getLocal("c")));n.addCode(r.i64_store32(r.i32_const(e),4*t,r.i64_shr_u(r.getLocal("c"),r.i64_const(32))))}n.addCode(r.call(c+"_add",r.i32_const(e),r.i32_add(r.getLocal("t"),r.i32_const(4*s)),r.getLocal("r")))}(),function(){const e=t.addFunction(c+"_mul");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32"),e.addLocal("c0","i64"),e.addLocal("c1","i64"),e.addLocal("np32","i64");for(let t=0;t<s;t++)e.addLocal("x"+t,"i64"),e.addLocal("y"+t,"i64"),e.addLocal("m"+t,"i64"),e.addLocal("q"+t,"i64");const n=e.getCodeBuilder(),r=Number(0x100000000n-_I(i,0x100000000n));e.addCode(n.setLocal("np32",n.i64_const(r)));const o=[],a=[],h=[];function d(t,e){let r,i;return o[t]?r=n.getLocal("x"+t):(r=n.teeLocal("x"+t,n.i64_load32_u(n.getLocal("x"),4*t)),o[t]=!0),a[e]?i=n.getLocal("y"+e):(i=n.teeLocal("y"+e,n.i64_load32_u(n.getLocal("y"),4*e)),a[e]=!0),n.i64_mul(r,i)}function p(t,e){let r,i;return h[t]?r=n.getLocal("q"+t):(r=n.teeLocal("q"+t,n.i64_load32_u(n.i32_const(0),u+4*t)),h[t]=!0),i=n.getLocal("m"+e),n.i64_mul(r,i)}let f="c0",g="c1";for(let t=0;t<2*s-1;t++){for(let r=Math.max(0,t-s+1);r<=t&&r<s;r++){const i=t-r;e.addCode(n.setLocal(f,n.i64_add(n.i64_and(n.getLocal(f),n.i64_const(4294967295)),d(r,i)))),e.addCode(n.setLocal(g,n.i64_add(n.getLocal(g),n.i64_shr_u(n.getLocal(f),n.i64_const(32)))))}for(let r=Math.max(1,t-s+1);r<=t&&r<s;r++){const i=t-r;e.addCode(n.setLocal(f,n.i64_add(n.i64_and(n.getLocal(f),n.i64_const(4294967295)),p(r,i)))),e.addCode(n.setLocal(g,n.i64_add(n.getLocal(g),n.i64_shr_u(n.getLocal(f),n.i64_const(32)))))}t<s&&(e.addCode(n.setLocal("m"+t,n.i64_and(n.i64_mul(n.i64_and(n.getLocal(f),n.i64_const(4294967295)),n.getLocal("np32")),n.i64_const("0xFFFFFFFF")))),e.addCode(n.setLocal(f,n.i64_add(n.i64_and(n.getLocal(f),n.i64_const(4294967295)),p(0,t)))),e.addCode(n.setLocal(g,n.i64_add(n.getLocal(g),n.i64_shr_u(n.getLocal(f),n.i64_const(32)))))),t>=s&&e.addCode(n.i64_store32(n.getLocal("r"),4*(t-s),n.getLocal(f))),[f,g]=[g,f],e.addCode(n.setLocal(g,n.i64_shr_u(n.getLocal(f),n.i64_const(32))))}e.addCode(n.i64_store32(n.getLocal("r"),4*s-4,n.getLocal(f))),e.addCode(n.if(n.i32_wrap_i64(n.getLocal(g)),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))),n.if(n.call(l+"_gte",n.getLocal("r"),n.i32_const(u)),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))))))}(),function(){const e=t.addFunction(c+"_square");e.addParam("x","i32"),e.addParam("r","i32"),e.addLocal("c0","i64"),e.addLocal("c1","i64"),e.addLocal("c0_old","i64"),e.addLocal("c1_old","i64"),e.addLocal("np32","i64");for(let t=0;t<s;t++)e.addLocal("x"+t,"i64"),e.addLocal("m"+t,"i64"),e.addLocal("q"+t,"i64");const n=e.getCodeBuilder(),r=Number(0x100000000n-_I(i,0x100000000n));e.addCode(n.setLocal("np32",n.i64_const(r)));const o=[],a=[];function h(t,e){let r,i;return o[t]?r=n.getLocal("x"+t):(r=n.teeLocal("x"+t,n.i64_load32_u(n.getLocal("x"),4*t)),o[t]=!0),o[e]?i=n.getLocal("x"+e):(i=n.teeLocal("x"+e,n.i64_load32_u(n.getLocal("x"),4*e)),o[e]=!0),n.i64_mul(r,i)}function d(t,e){let r,i;return a[t]?r=n.getLocal("q"+t):(r=n.teeLocal("q"+t,n.i64_load32_u(n.i32_const(0),u+4*t)),a[t]=!0),i=n.getLocal("m"+e),n.i64_mul(r,i)}let p="c0",f="c1",g="c0_old",A="c1_old";for(let t=0;t<2*s-1;t++){e.addCode(n.setLocal(p,n.i64_const(0)),n.setLocal(f,n.i64_const(0)));for(let r=Math.max(0,t-s+1);r<t+1>>1&&r<s;r++){const i=t-r;e.addCode(n.setLocal(p,n.i64_add(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),h(r,i)))),e.addCode(n.setLocal(f,n.i64_add(n.getLocal(f),n.i64_shr_u(n.getLocal(p),n.i64_const(32)))))}e.addCode(n.setLocal(p,n.i64_shl(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),n.i64_const(1)))),e.addCode(n.setLocal(f,n.i64_add(n.i64_shl(n.getLocal(f),n.i64_const(1)),n.i64_shr_u(n.getLocal(p),n.i64_const(32))))),t%2==0&&(e.addCode(n.setLocal(p,n.i64_add(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),h(t>>1,t>>1)))),e.addCode(n.setLocal(f,n.i64_add(n.getLocal(f),n.i64_shr_u(n.getLocal(p),n.i64_const(32)))))),t>0&&(e.addCode(n.setLocal(p,n.i64_add(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),n.i64_and(n.getLocal(g),n.i64_const(4294967295))))),e.addCode(n.setLocal(f,n.i64_add(n.i64_add(n.getLocal(f),n.i64_shr_u(n.getLocal(p),n.i64_const(32))),n.getLocal(A)))));for(let r=Math.max(1,t-s+1);r<=t&&r<s;r++){const i=t-r;e.addCode(n.setLocal(p,n.i64_add(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),d(r,i)))),e.addCode(n.setLocal(f,n.i64_add(n.getLocal(f),n.i64_shr_u(n.getLocal(p),n.i64_const(32)))))}t<s&&(e.addCode(n.setLocal("m"+t,n.i64_and(n.i64_mul(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),n.getLocal("np32")),n.i64_const("0xFFFFFFFF")))),e.addCode(n.setLocal(p,n.i64_add(n.i64_and(n.getLocal(p),n.i64_const(4294967295)),d(0,t)))),e.addCode(n.setLocal(f,n.i64_add(n.getLocal(f),n.i64_shr_u(n.getLocal(p),n.i64_const(32)))))),t>=s&&e.addCode(n.i64_store32(n.getLocal("r"),4*(t-s),n.getLocal(p))),e.addCode(n.setLocal(g,n.getLocal(f)),n.setLocal(A,n.i64_shr_u(n.getLocal(g),n.i64_const(32))))}e.addCode(n.i64_store32(n.getLocal("r"),4*s-4,n.getLocal(g))),e.addCode(n.if(n.i32_wrap_i64(n.getLocal(A)),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))),n.if(n.call(l+"_gte",n.getLocal("r"),n.i32_const(u)),n.drop(n.call(l+"_sub",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))))))}(),function(){const e=t.addFunction(c+"_squareOld");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(c+"_mul",n.getLocal("x"),n.getLocal("x"),n.getLocal("r")))}(),function(){const e=t.addFunction(c+"_toMontgomery");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(c+"_mul",n.getLocal("x"),n.i32_const(h),n.getLocal("r")))}(),function(){const e=t.alloc(2*a),n=t.addFunction(c+"_fromMontgomery");n.addParam("x","i32"),n.addParam("r","i32");const r=n.getCodeBuilder();n.addCode(r.call(l+"_copy",r.getLocal("x"),r.i32_const(e))),n.addCode(r.call(l+"_zero",r.i32_const(e+a))),n.addCode(r.call(c+"_mReduct",r.i32_const(e),r.getLocal("r")))}(),function(){const e=t.addFunction(c+"_isNegative");e.addParam("x","i32"),e.setReturnType("i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(a));e.addCode(n.call(c+"_fromMontgomery",n.getLocal("x"),r),n.call(l+"_gte",r,n.i32_const(m)))}(),function(){const e=t.addFunction(c+"_sign");e.addParam("x","i32"),e.setReturnType("i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(a));e.addCode(n.if(n.call(l+"_isZero",n.getLocal("x")),n.ret(n.i32_const(0))),n.call(c+"_fromMontgomery",n.getLocal("x"),r),n.if(n.call(l+"_gte",r,n.i32_const(m)),n.ret(n.i32_const(-1))),n.ret(n.i32_const(1)))}(),function(){const e=t.addFunction(c+"_inverse");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(c+"_fromMontgomery",n.getLocal("x"),n.getLocal("r"))),e.addCode(n.call(l+"_inverseMod",n.getLocal("r"),n.i32_const(u),n.getLocal("r"))),e.addCode(n.call(c+"_toMontgomery",n.getLocal("r"),n.getLocal("r")))}(),function(){const e=t.addFunction(c+"_one");e.addParam("pr","i32");const n=e.getCodeBuilder();e.addCode(n.call(l+"_copy",n.i32_const(d),n.getLocal("pr")))}(),function(){const e=t.addFunction(c+"_load");e.addParam("scalar","i32"),e.addParam("scalarLen","i32"),e.addParam("r","i32"),e.addLocal("p","i32"),e.addLocal("l","i32"),e.addLocal("i","i32"),e.addLocal("j","i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(a)),i=t.alloc(a),o=n.i32_const(i);e.addCode(n.call(l+"_zero",n.getLocal("r")),n.setLocal("i",n.i32_const(a)),n.setLocal("p",n.getLocal("scalar")),n.block(n.loop(n.br_if(1,n.i32_gt_u(n.getLocal("i"),n.getLocal("scalarLen"))),n.if(n.i32_eq(n.getLocal("i"),n.i32_const(a)),n.call(c+"_one",r),n.call(c+"_mul",r,n.i32_const(h),r)),n.call(c+"_mul",n.getLocal("p"),r,o),n.call(c+"_add",n.getLocal("r"),o,n.getLocal("r")),n.setLocal("p",n.i32_add(n.getLocal("p"),n.i32_const(a))),n.setLocal("i",n.i32_add(n.getLocal("i"),n.i32_const(a))),n.br(0))),n.setLocal("l",n.i32_rem_u(n.getLocal("scalarLen"),n.i32_const(a))),n.if(n.i32_eqz(n.getLocal("l")),n.ret([])),n.call(l+"_zero",o),n.setLocal("j",n.i32_const(0)),n.block(n.loop(n.br_if(1,n.i32_eq(n.getLocal("j"),n.getLocal("l"))),n.i32_store8(n.getLocal("j"),i,n.i32_load8_u(n.getLocal("p"))),n.setLocal("p",n.i32_add(n.getLocal("p"),n.i32_const(1))),n.setLocal("j",n.i32_add(n.getLocal("j"),n.i32_const(1))),n.br(0))),n.if(n.i32_eq(n.getLocal("i"),n.i32_const(a)),n.call(c+"_one",r),n.call(c+"_mul",r,n.i32_const(h),r)),n.call(c+"_mul",o,r,o),n.call(c+"_add",n.getLocal("r"),o,n.getLocal("r")))}(),function(){const e=t.addFunction(c+"_timesScalar");e.addParam("x","i32"),e.addParam("scalar","i32"),e.addParam("scalarLen","i32"),e.addParam("r","i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(a));e.addCode(n.call(c+"_load",n.getLocal("scalar"),n.getLocal("scalarLen"),r),n.call(c+"_toMontgomery",r,r),n.call(c+"_mul",n.getLocal("x"),r,n.getLocal("r")))}(),vI(t,c),MI(t,c+"_batchToMontgomery",c+"_toMontgomery",a,a),MI(t,c+"_batchFromMontgomery",c+"_fromMontgomery",a,a),MI(t,c+"_batchNeg",c+"_neg",a,a),NI(t,c+"_batchAdd",c+"_add",a,a),NI(t,c+"_batchSub",c+"_sub",a,a),NI(t,c+"_batchMul",c+"_mul",a,a),t.exportFunction(c+"_add"),t.exportFunction(c+"_sub"),t.exportFunction(c+"_neg"),t.exportFunction(c+"_isNegative"),t.exportFunction(c+"_isOne"),t.exportFunction(c+"_sign"),t.exportFunction(c+"_mReduct"),t.exportFunction(c+"_mul"),t.exportFunction(c+"_square"),t.exportFunction(c+"_squareOld"),t.exportFunction(c+"_fromMontgomery"),t.exportFunction(c+"_toMontgomery"),t.exportFunction(c+"_inverse"),t.exportFunction(c+"_one"),t.exportFunction(c+"_load"),t.exportFunction(c+"_timesScalar"),DI(t,c+"_exp",a,c+"_mul",c+"_square",l+"_copy",c+"_one"),t.exportFunction(c+"_exp"),t.exportFunction(c+"_batchInverse"),xI(i)&&(!function(){const e=t.addFunction(c+"_sqrt");e.addParam("n","i32"),e.addParam("r","i32"),e.addLocal("m","i32"),e.addLocal("i","i32"),e.addLocal("j","i32");const n=e.getCodeBuilder(),r=n.i32_const(d),i=n.i32_const(t.alloc(a)),o=n.i32_const(t.alloc(a)),s=n.i32_const(t.alloc(a)),l=n.i32_const(t.alloc(a)),u=n.i32_const(t.alloc(a));e.addCode(n.if(n.call(c+"_isZero",n.getLocal("n")),n.ret(n.call(c+"_zero",n.getLocal("r")))),n.setLocal("m",n.i32_const(y)),n.call(c+"_copy",n.i32_const(T),i),n.call(c+"_exp",n.getLocal("n"),n.i32_const(I),n.i32_const(a),o),n.call(c+"_exp",n.getLocal("n"),n.i32_const(D),n.i32_const(a),s),n.block(n.loop(n.br_if(1,n.call(c+"_eq",o,r)),n.call(c+"_square",o,l),n.setLocal("i",n.i32_const(1)),n.block(n.loop(n.br_if(1,n.call(c+"_eq",l,r)),n.call(c+"_square",l,l),n.setLocal("i",n.i32_add(n.getLocal("i"),n.i32_const(1))),n.br(0))),n.call(c+"_copy",i,u),n.setLocal("j",n.i32_sub(n.i32_sub(n.getLocal("m"),n.getLocal("i")),n.i32_const(1))),n.block(n.loop(n.br_if(1,n.i32_eqz(n.getLocal("j"))),n.call(c+"_square",u,u),n.setLocal("j",n.i32_sub(n.getLocal("j"),n.i32_const(1))),n.br(0))),n.setLocal("m",n.getLocal("i")),n.call(c+"_square",u,i),n.call(c+"_mul",o,i,o),n.call(c+"_mul",s,u,s),n.br(0))),n.if(n.call(c+"_isNegative",s),n.call(c+"_neg",s,n.getLocal("r")),n.call(c+"_copy",s,n.getLocal("r"))))}(),function(){const e=t.addFunction(c+"_isSquare");e.addParam("n","i32"),e.setReturnType("i32");const n=e.getCodeBuilder(),r=n.i32_const(d),i=n.i32_const(t.alloc(a));e.addCode(n.if(n.call(c+"_isZero",n.getLocal("n")),n.ret(n.i32_const(1))),n.call(c+"_exp",n.getLocal("n"),n.i32_const(A),n.i32_const(a),i),n.call(c+"_eq",i,r))}(),t.exportFunction(c+"_sqrt"),t.exportFunction(c+"_isSquare")),t.exportFunction(c+"_batchToMontgomery"),t.exportFunction(c+"_batchFromMontgomery"),c};const OI=kI,{bitLength:QI}=uI;var UI=function(t,e,n,r,i){const o=BigInt(e),s=Math.floor((QI(o-1n)-1)/64)+1,a=8*s,c=n||"f1";if(t.modules[c])return c;t.modules[c]={n64:s};const l=i||"int",u=OI(t,o,r,l),h=t.modules[u].pR2,d=t.modules[u].pq,p=t.modules[u].pePlusOne;return function(){const e=t.alloc(a),n=t.addFunction(c+"_mul");n.addParam("x","i32"),n.addParam("y","i32"),n.addParam("r","i32");const r=n.getCodeBuilder();n.addCode(r.call(u+"_mul",r.getLocal("x"),r.getLocal("y"),r.i32_const(e))),n.addCode(r.call(u+"_mul",r.i32_const(e),r.i32_const(h),r.getLocal("r")))}(),function(){const e=t.addFunction(c+"_square");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(c+"_mul",n.getLocal("x"),n.getLocal("x"),n.getLocal("r")))}(),function(){const e=t.addFunction(c+"_inverse");e.addParam("x","i32"),e.addParam("r","i32");const n=e.getCodeBuilder();e.addCode(n.call(l+"_inverseMod",n.getLocal("x"),n.i32_const(d),n.getLocal("r")))}(),function(){const e=t.addFunction(c+"_isNegative");e.addParam("x","i32"),e.setReturnType("i32");const n=e.getCodeBuilder();e.addCode(n.call(l+"_gte",n.getLocal("x"),n.i32_const(p)))}(),t.exportFunction(u+"_add",c+"_add"),t.exportFunction(u+"_sub",c+"_sub"),t.exportFunction(u+"_neg",c+"_neg"),t.exportFunction(c+"_mul"),t.exportFunction(c+"_square"),t.exportFunction(c+"_inverse"),t.exportFunction(c+"_isNegative"),t.exportFunction(u+"_copy",c+"_copy"),t.exportFunction(u+"_zero",c+"_zero"),t.exportFunction(u+"_one",c+"_one"),t.exportFunction(u+"_isZero",c+"_isZero"),t.exportFunction(u+"_eq",c+"_eq"),c};const PI=sI,GI=aI,VI=oI;var jI=function(t,e,n,r){if(t.modules[n])return n;const i=8*t.modules[r].n64,o=t.modules[r].q;return t.modules[n]={n64:2*t.modules[r].n64},function(){const e=t.addFunction(n+"_isZero");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.i32_and(o.call(r+"_isZero",s),o.call(r+"_isZero",a)))}(),function(){const e=t.addFunction(n+"_isOne");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.ret(o.i32_and(o.call(r+"_isOne",s),o.call(r+"_isZero",a))))}(),function(){const e=t.addFunction(n+"_zero");e.addParam("x","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.call(r+"_zero",s),o.call(r+"_zero",a))}(),function(){const e=t.addFunction(n+"_one");e.addParam("x","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.call(r+"_one",s),o.call(r+"_zero",a))}(),function(){const e=t.addFunction(n+"_copy");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_copy",s,c),o.call(r+"_copy",a,l))}(),function(){const o=t.addFunction(n+"_mul");o.addParam("x","i32"),o.addParam("y","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.getLocal("y"),u=s.i32_add(s.getLocal("y"),s.i32_const(i)),h=s.getLocal("r"),d=s.i32_add(s.getLocal("r"),s.i32_const(i)),p=s.i32_const(t.alloc(i)),f=s.i32_const(t.alloc(i)),g=s.i32_const(t.alloc(i)),A=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_mul",a,l,p),s.call(r+"_mul",c,u,f),s.call(r+"_add",a,c,g),s.call(r+"_add",l,u,A),s.call(r+"_mul",g,A,g),s.call(e,f,h),s.call(r+"_add",p,h,h),s.call(r+"_add",p,f,d),s.call(r+"_sub",g,d,d))}(),function(){const e=t.addFunction(n+"_mul1");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("y"),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_mul",s,c,l),o.call(r+"_mul",a,c,u))}(),function(){const o=t.addFunction(n+"_square");o.addParam("x","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.getLocal("r"),u=s.i32_add(s.getLocal("r"),s.i32_const(i)),h=s.i32_const(t.alloc(i)),d=s.i32_const(t.alloc(i)),p=s.i32_const(t.alloc(i)),f=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_mul",a,c,h),s.call(r+"_add",a,c,d),s.call(e,c,p),s.call(r+"_add",a,p,p),s.call(e,h,f),s.call(r+"_add",f,h,f),s.call(r+"_mul",d,p,l),s.call(r+"_sub",l,f,l),s.call(r+"_add",h,h,u))}(),function(){const e=t.addFunction(n+"_add");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("y"),l=o.i32_add(o.getLocal("y"),o.i32_const(i)),u=o.getLocal("r"),h=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_add",s,c,u),o.call(r+"_add",a,l,h))}(),function(){const e=t.addFunction(n+"_sub");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("y"),l=o.i32_add(o.getLocal("y"),o.i32_const(i)),u=o.getLocal("r"),h=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_sub",s,c,u),o.call(r+"_sub",a,l,h))}(),function(){const e=t.addFunction(n+"_neg");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_neg",s,c),o.call(r+"_neg",a,l))}(),function(){const e=t.addFunction(n+"_conjugate");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_copy",s,c),o.call(r+"_neg",a,l))}(),function(){const e=t.addFunction(n+"_toMontgomery");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_toMontgomery",s,c),o.call(r+"_toMontgomery",a,l))}(),function(){const e=t.addFunction(n+"_fromMontgomery");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_fromMontgomery",s,c),o.call(r+"_fromMontgomery",a,l))}(),function(){const e=t.addFunction(n+"_eq");e.addParam("x","i32"),e.addParam("y","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("y"),l=o.i32_add(o.getLocal("y"),o.i32_const(i));e.addCode(o.i32_and(o.call(r+"_eq",s,c),o.call(r+"_eq",a,l)))}(),function(){const o=t.addFunction(n+"_inverse");o.addParam("x","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.getLocal("r"),u=s.i32_add(s.getLocal("r"),s.i32_const(i)),h=s.i32_const(t.alloc(i)),d=s.i32_const(t.alloc(i)),p=s.i32_const(t.alloc(i)),f=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_square",a,h),s.call(r+"_square",c,d),s.call(e,d,p),s.call(r+"_sub",h,p,p),s.call(r+"_inverse",p,f),s.call(r+"_mul",a,f,l),s.call(r+"_mul",c,f,u),s.call(r+"_neg",u,u))}(),function(){const e=t.addFunction(n+"_timesScalar");e.addParam("x","i32"),e.addParam("scalar","i32"),e.addParam("scalarLen","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.getLocal("r"),l=o.i32_add(o.getLocal("r"),o.i32_const(i));e.addCode(o.call(r+"_timesScalar",s,o.getLocal("scalar"),o.getLocal("scalarLen"),c),o.call(r+"_timesScalar",a,o.getLocal("scalar"),o.getLocal("scalarLen"),l))}(),function(){const e=t.addFunction(n+"_sign");e.addParam("x","i32"),e.addLocal("s","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.setLocal("s",o.call(r+"_sign",a)),o.if(o.getLocal("s"),o.ret(o.getLocal("s"))),o.ret(o.call(r+"_sign",s)))}(),function(){const e=t.addFunction(n+"_isNegative");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i));e.addCode(o.if(o.call(r+"_isZero",a),o.ret(o.call(r+"_isNegative",s))),o.ret(o.call(r+"_isNegative",a)))}(),t.exportFunction(n+"_isZero"),t.exportFunction(n+"_isOne"),t.exportFunction(n+"_zero"),t.exportFunction(n+"_one"),t.exportFunction(n+"_copy"),t.exportFunction(n+"_mul"),t.exportFunction(n+"_mul1"),t.exportFunction(n+"_square"),t.exportFunction(n+"_add"),t.exportFunction(n+"_sub"),t.exportFunction(n+"_neg"),t.exportFunction(n+"_sign"),t.exportFunction(n+"_conjugate"),t.exportFunction(n+"_fromMontgomery"),t.exportFunction(n+"_toMontgomery"),t.exportFunction(n+"_eq"),t.exportFunction(n+"_inverse"),GI(t,n),PI(t,n+"_exp",2*i,n+"_mul",n+"_square",n+"_copy",n+"_one"),function(){const e=t.addFunction(n+"_sqrt");e.addParam("a","i32"),e.addParam("pr","i32");const s=e.getCodeBuilder(),a=s.i32_const(t.alloc(VI.bigInt2BytesLE((BigInt(o||0)-3n)/4n,i))),c=s.i32_const(t.alloc(VI.bigInt2BytesLE((BigInt(o||0)-1n)/2n,i))),l=s.getLocal("a"),u=s.i32_const(t.alloc(2*i)),h=s.i32_const(t.alloc(2*i)),d=s.i32_const(t.alloc(2*i)),p=t.alloc(2*i),f=s.i32_const(p),g=s.i32_const(p),A=s.i32_const(p+i),E=s.i32_const(t.alloc(2*i)),m=s.i32_const(t.alloc(2*i));e.addCode(s.call(n+"_one",f),s.call(n+"_neg",f,f),s.call(n+"_exp",l,a,s.i32_const(i),u),s.call(n+"_square",u,h),s.call(n+"_mul",l,h,h),s.call(n+"_conjugate",h,d),s.call(n+"_mul",d,h,d),s.if(s.call(n+"_eq",d,f),s.unreachable()),s.call(n+"_mul",u,l,E),s.if(s.call(n+"_eq",h,f),[...s.call(r+"_zero",g),...s.call(r+"_one",A),...s.call(n+"_mul",f,E,s.getLocal("pr"))],[...s.call(n+"_one",m),...s.call(n+"_add",m,h,m),...s.call(n+"_exp",m,c,s.i32_const(i),m),...s.call(n+"_mul",m,E,s.getLocal("pr"))]))}(),function(){const e=t.addFunction(n+"_isSquare");e.addParam("a","i32"),e.setReturnType("i32");const r=e.getCodeBuilder(),s=r.i32_const(t.alloc(VI.bigInt2BytesLE((BigInt(o||0)-3n)/4n,i))),a=r.getLocal("a"),c=r.i32_const(t.alloc(2*i)),l=r.i32_const(t.alloc(2*i)),u=r.i32_const(t.alloc(2*i)),h=t.alloc(2*i),d=r.i32_const(h);e.addCode(r.call(n+"_one",d),r.call(n+"_neg",d,d),r.call(n+"_exp",a,s,r.i32_const(i),c),r.call(n+"_square",c,l),r.call(n+"_mul",a,l,l),r.call(n+"_conjugate",l,u),r.call(n+"_mul",u,l,u),r.if(r.call(n+"_eq",u,d),r.ret(r.i32_const(0))),r.ret(r.i32_const(1)))}(),t.exportFunction(n+"_exp"),t.exportFunction(n+"_timesScalar"),t.exportFunction(n+"_batchInverse"),t.exportFunction(n+"_sqrt"),t.exportFunction(n+"_isSquare"),t.exportFunction(n+"_isNegative"),n};const HI=sI,YI=aI;var zI=function(t,e,n,r){if(t.modules[n])return n;const i=8*t.modules[r].n64;return t.modules[n]={n64:3*t.modules[r].n64},function(){const e=t.addFunction(n+"_isZero");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.i32_and(o.i32_and(o.call(r+"_isZero",s),o.call(r+"_isZero",a)),o.call(r+"_isZero",c)))}(),function(){const e=t.addFunction(n+"_isOne");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.ret(o.i32_and(o.i32_and(o.call(r+"_isOne",s),o.call(r+"_isZero",a)),o.call(r+"_isZero",c))))}(),function(){const e=t.addFunction(n+"_zero");e.addParam("x","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.call(r+"_zero",s),o.call(r+"_zero",a),o.call(r+"_zero",c))}(),function(){const e=t.addFunction(n+"_one");e.addParam("x","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.call(r+"_one",s),o.call(r+"_zero",a),o.call(r+"_zero",c))}(),function(){const e=t.addFunction(n+"_copy");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i)),h=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_copy",s,l),o.call(r+"_copy",a,u),o.call(r+"_copy",c,h))}(),function(){const o=t.addFunction(n+"_mul");o.addParam("x","i32"),o.addParam("y","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.i32_add(s.getLocal("x"),s.i32_const(2*i)),u=s.getLocal("y"),h=s.i32_add(s.getLocal("y"),s.i32_const(i)),d=s.i32_add(s.getLocal("y"),s.i32_const(2*i)),p=s.getLocal("r"),f=s.i32_add(s.getLocal("r"),s.i32_const(i)),g=s.i32_add(s.getLocal("r"),s.i32_const(2*i)),A=s.i32_const(t.alloc(i)),E=s.i32_const(t.alloc(i)),m=s.i32_const(t.alloc(i)),w=s.i32_const(t.alloc(i)),y=s.i32_const(t.alloc(i)),B=s.i32_const(t.alloc(i)),I=s.i32_const(t.alloc(i)),C=s.i32_const(t.alloc(i)),T=s.i32_const(t.alloc(i)),b=s.i32_const(t.alloc(i)),D=s.i32_const(t.alloc(i)),v=s.i32_const(t.alloc(i)),M=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_mul",a,u,A),s.call(r+"_mul",c,h,E),s.call(r+"_mul",l,d,m),s.call(r+"_add",a,c,w),s.call(r+"_add",u,h,y),s.call(r+"_add",a,l,B),s.call(r+"_add",u,d,I),s.call(r+"_add",c,l,C),s.call(r+"_add",h,d,T),s.call(r+"_add",A,E,b),s.call(r+"_add",A,m,D),s.call(r+"_add",E,m,v),s.call(r+"_mul",C,T,p),s.call(r+"_sub",p,v,p),s.call(e,p,p),s.call(r+"_add",A,p,p),s.call(r+"_mul",w,y,f),s.call(r+"_sub",f,b,f),s.call(e,m,M),s.call(r+"_add",f,M,f),s.call(r+"_mul",B,I,g),s.call(r+"_sub",g,D,g),s.call(r+"_add",g,E,g))}(),function(){const o=t.addFunction(n+"_square");o.addParam("x","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.i32_add(s.getLocal("x"),s.i32_const(2*i)),u=s.getLocal("r"),h=s.i32_add(s.getLocal("r"),s.i32_const(i)),d=s.i32_add(s.getLocal("r"),s.i32_const(2*i)),p=s.i32_const(t.alloc(i)),f=s.i32_const(t.alloc(i)),g=s.i32_const(t.alloc(i)),A=s.i32_const(t.alloc(i)),E=s.i32_const(t.alloc(i)),m=s.i32_const(t.alloc(i)),w=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_square",a,p),s.call(r+"_mul",a,c,f),s.call(r+"_add",f,f,g),s.call(r+"_sub",a,c,A),s.call(r+"_add",A,l,A),s.call(r+"_square",A,A),s.call(r+"_mul",c,l,E),s.call(r+"_add",E,E,m),s.call(r+"_square",l,w),s.call(e,m,u),s.call(r+"_add",p,u,u),s.call(e,w,h),s.call(r+"_add",g,h,h),s.call(r+"_add",p,w,d),s.call(r+"_sub",m,d,d),s.call(r+"_add",A,d,d),s.call(r+"_add",g,d,d))}(),function(){const e=t.addFunction(n+"_add");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("y"),u=o.i32_add(o.getLocal("y"),o.i32_const(i)),h=o.i32_add(o.getLocal("y"),o.i32_const(2*i)),d=o.getLocal("r"),p=o.i32_add(o.getLocal("r"),o.i32_const(i)),f=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_add",s,l,d),o.call(r+"_add",a,u,p),o.call(r+"_add",c,h,f))}(),function(){const e=t.addFunction(n+"_sub");e.addParam("x","i32"),e.addParam("y","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("y"),u=o.i32_add(o.getLocal("y"),o.i32_const(i)),h=o.i32_add(o.getLocal("y"),o.i32_const(2*i)),d=o.getLocal("r"),p=o.i32_add(o.getLocal("r"),o.i32_const(i)),f=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_sub",s,l,d),o.call(r+"_sub",a,u,p),o.call(r+"_sub",c,h,f))}(),function(){const e=t.addFunction(n+"_neg");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i)),h=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_neg",s,l),o.call(r+"_neg",a,u),o.call(r+"_neg",c,h))}(),function(){const e=t.addFunction(n+"_sign");e.addParam("x","i32"),e.addLocal("s","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.setLocal("s",o.call(r+"_sign",c)),o.if(o.getLocal("s"),o.ret(o.getLocal("s"))),o.setLocal("s",o.call(r+"_sign",a)),o.if(o.getLocal("s"),o.ret(o.getLocal("s"))),o.ret(o.call(r+"_sign",s)))}(),function(){const e=t.addFunction(n+"_toMontgomery");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i)),h=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_toMontgomery",s,l),o.call(r+"_toMontgomery",a,u),o.call(r+"_toMontgomery",c,h))}(),function(){const e=t.addFunction(n+"_fromMontgomery");e.addParam("x","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i)),h=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_fromMontgomery",s,l),o.call(r+"_fromMontgomery",a,u),o.call(r+"_fromMontgomery",c,h))}(),function(){const e=t.addFunction(n+"_eq");e.addParam("x","i32"),e.addParam("y","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("y"),u=o.i32_add(o.getLocal("y"),o.i32_const(i)),h=o.i32_add(o.getLocal("y"),o.i32_const(2*i));e.addCode(o.i32_and(o.i32_and(o.call(r+"_eq",s,l),o.call(r+"_eq",a,u)),o.call(r+"_eq",c,h)))}(),function(){const o=t.addFunction(n+"_inverse");o.addParam("x","i32"),o.addParam("r","i32");const s=o.getCodeBuilder(),a=s.getLocal("x"),c=s.i32_add(s.getLocal("x"),s.i32_const(i)),l=s.i32_add(s.getLocal("x"),s.i32_const(2*i)),u=s.getLocal("r"),h=s.i32_add(s.getLocal("r"),s.i32_const(i)),d=s.i32_add(s.getLocal("r"),s.i32_const(2*i)),p=s.i32_const(t.alloc(i)),f=s.i32_const(t.alloc(i)),g=s.i32_const(t.alloc(i)),A=s.i32_const(t.alloc(i)),E=s.i32_const(t.alloc(i)),m=s.i32_const(t.alloc(i)),w=s.i32_const(t.alloc(i)),y=s.i32_const(t.alloc(i)),B=s.i32_const(t.alloc(i)),I=s.i32_const(t.alloc(i)),C=s.i32_const(t.alloc(i));o.addCode(s.call(r+"_square",a,p),s.call(r+"_square",c,f),s.call(r+"_square",l,g),s.call(r+"_mul",a,c,A),s.call(r+"_mul",a,l,E),s.call(r+"_mul",c,l,m),s.call(e,m,w),s.call(r+"_sub",p,w,w),s.call(e,g,y),s.call(r+"_sub",y,A,y),s.call(r+"_sub",f,E,B),s.call(r+"_mul",l,y,I),s.call(r+"_mul",c,B,C),s.call(r+"_add",I,C,I),s.call(e,I,I),s.call(r+"_mul",a,w,C),s.call(r+"_add",C,I,I),s.call(r+"_inverse",I,I),s.call(r+"_mul",I,w,u),s.call(r+"_mul",I,y,h),s.call(r+"_mul",I,B,d))}(),function(){const e=t.addFunction(n+"_timesScalar");e.addParam("x","i32"),e.addParam("scalar","i32"),e.addParam("scalarLen","i32"),e.addParam("r","i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i)),l=o.getLocal("r"),u=o.i32_add(o.getLocal("r"),o.i32_const(i)),h=o.i32_add(o.getLocal("r"),o.i32_const(2*i));e.addCode(o.call(r+"_timesScalar",s,o.getLocal("scalar"),o.getLocal("scalarLen"),l),o.call(r+"_timesScalar",a,o.getLocal("scalar"),o.getLocal("scalarLen"),u),o.call(r+"_timesScalar",c,o.getLocal("scalar"),o.getLocal("scalarLen"),h))}(),function(){const e=t.addFunction(n+"_isNegative");e.addParam("x","i32"),e.setReturnType("i32");const o=e.getCodeBuilder(),s=o.getLocal("x"),a=o.i32_add(o.getLocal("x"),o.i32_const(i)),c=o.i32_add(o.getLocal("x"),o.i32_const(2*i));e.addCode(o.if(o.call(r+"_isZero",c),o.if(o.call(r+"_isZero",a),o.ret(o.call(r+"_isNegative",s)),o.ret(o.call(r+"_isNegative",a)))),o.ret(o.call(r+"_isNegative",c)))}(),t.exportFunction(n+"_isZero"),t.exportFunction(n+"_isOne"),t.exportFunction(n+"_zero"),t.exportFunction(n+"_one"),t.exportFunction(n+"_copy"),t.exportFunction(n+"_mul"),t.exportFunction(n+"_square"),t.exportFunction(n+"_add"),t.exportFunction(n+"_sub"),t.exportFunction(n+"_neg"),t.exportFunction(n+"_sign"),t.exportFunction(n+"_fromMontgomery"),t.exportFunction(n+"_toMontgomery"),t.exportFunction(n+"_eq"),t.exportFunction(n+"_inverse"),YI(t,n),HI(t,n+"_exp",3*i,n+"_mul",n+"_square",n+"_copy",n+"_one"),t.exportFunction(n+"_exp"),t.exportFunction(n+"_timesScalar"),t.exportFunction(n+"_batchInverse"),t.exportFunction(n+"_isNegative"),n};const JI=function(t,e,n,r,i,o,s,a){const c=t.addFunction(e);c.addParam("base","i32"),c.addParam("scalar","i32"),c.addParam("scalarLength","i32"),c.addParam("r","i32"),c.addLocal("old0","i32"),c.addLocal("nbits","i32"),c.addLocal("i","i32"),c.addLocal("last","i32"),c.addLocal("cur","i32"),c.addLocal("carry","i32"),c.addLocal("p","i32");const l=c.getCodeBuilder(),u=l.i32_const(t.alloc(n));function h(t){return l.i32_and(l.i32_shr_u(l.i32_load(l.i32_add(l.getLocal("scalar"),l.i32_and(l.i32_shr_u(t,l.i32_const(3)),l.i32_const(4294967292)))),l.i32_and(t,l.i32_const(31))),l.i32_const(1))}function d(t){return[...l.i32_store8(l.getLocal("p"),l.i32_const(t)),...l.setLocal("p",l.i32_add(l.getLocal("p"),l.i32_const(1)))]}c.addCode(l.if(l.i32_eqz(l.getLocal("scalarLength")),[...l.call(a,l.getLocal("r")),...l.ret([])]),l.setLocal("nbits",l.i32_shl(l.getLocal("scalarLength"),l.i32_const(3))),l.setLocal("old0",l.i32_load(l.i32_const(0))),l.setLocal("p",l.getLocal("old0")),l.i32_store(l.i32_const(0),l.i32_and(l.i32_add(l.i32_add(l.getLocal("old0"),l.i32_const(32)),l.getLocal("nbits")),l.i32_const(4294967288))),l.setLocal("i",l.i32_const(1)),l.setLocal("last",h(l.i32_const(0))),l.setLocal("carry",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("nbits"))),l.setLocal("cur",h(l.getLocal("i"))),l.if(l.getLocal("last"),l.if(l.getLocal("cur"),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...d(1)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...d(255)]),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...d(255)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(0)),...d(1)])),l.if(l.getLocal("cur"),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(1)),...d(0)],[...l.setLocal("last",l.i32_const(1)),...l.setLocal("carry",l.i32_const(0)),...d(0)]),l.if(l.getLocal("carry"),[...l.setLocal("last",l.i32_const(1)),...l.setLocal("carry",l.i32_const(0)),...d(0)],[...l.setLocal("last",l.i32_const(0)),...l.setLocal("carry",l.i32_const(0)),...d(0)]))),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0))),l.if(l.getLocal("last"),l.if(l.getLocal("carry"),[...d(255),...d(0),...d(1)],[...d(1)]),l.if(l.getLocal("carry"),[...d(0),...d(1)])),l.setLocal("p",l.i32_sub(l.getLocal("p"),l.i32_const(1))),l.call(s,l.getLocal("base"),u),l.call(a,l.getLocal("r")),l.block(l.loop(l.call(i,l.getLocal("r"),l.getLocal("r")),l.setLocal("cur",l.i32_load8_u(l.getLocal("p"))),l.if(l.getLocal("cur"),l.if(l.i32_eq(l.getLocal("cur"),l.i32_const(1)),l.call(r,l.getLocal("r"),u,l.getLocal("r")),l.call(o,l.getLocal("r"),u,l.getLocal("r")))),l.br_if(1,l.i32_eq(l.getLocal("old0"),l.getLocal("p"))),l.setLocal("p",l.i32_sub(l.getLocal("p"),l.i32_const(1))),l.br(0))),l.i32_store(l.i32_const(0),l.getLocal("old0")))},WI=cI,qI=function(t,e,n,r,i){const o=8*t.modules[e].n64;function s(){const r=t.addFunction(n);r.addParam("pBases","i32"),r.addParam("pScalars","i32"),r.addParam("scalarSize","i32"),r.addParam("n","i32"),r.addParam("pr","i32"),r.addLocal("chunkSize","i32"),r.addLocal("nChunks","i32"),r.addLocal("itScalar","i32"),r.addLocal("endScalar","i32"),r.addLocal("itBase","i32"),r.addLocal("itBit","i32"),r.addLocal("i","i32"),r.addLocal("j","i32"),r.addLocal("nTable","i32"),r.addLocal("pTable","i32"),r.addLocal("idx","i32"),r.addLocal("pIdxTable","i32");const i=r.getCodeBuilder(),s=i.i32_const(t.alloc(o)),a=t.alloc([17,17,17,17,17,17,17,17,17,17,16,16,15,14,13,13,12,11,10,9,8,7,7,6,5,4,3,2,1,1,1,1]);r.addCode(i.call(e+"_zero",i.getLocal("pr")),i.if(i.i32_eqz(i.getLocal("n")),i.ret([])),i.setLocal("chunkSize",i.i32_load8_u(i.i32_clz(i.getLocal("n")),a)),i.setLocal("nChunks",i.i32_add(i.i32_div_u(i.i32_sub(i.i32_shl(i.getLocal("scalarSize"),i.i32_const(3)),i.i32_const(1)),i.getLocal("chunkSize")),i.i32_const(1))),i.setLocal("itBit",i.i32_mul(i.i32_sub(i.getLocal("nChunks"),i.i32_const(1)),i.getLocal("chunkSize"))),i.block(i.loop(i.br_if(1,i.i32_lt_s(i.getLocal("itBit"),i.i32_const(0))),i.if(i.i32_eqz(i.call(e+"_isZero",i.getLocal("pr"))),[...i.setLocal("j",i.i32_const(0)),...i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("j"),i.getLocal("chunkSize"))),i.call(e+"_double",i.getLocal("pr"),i.getLocal("pr")),i.setLocal("j",i.i32_add(i.getLocal("j"),i.i32_const(1))),i.br(0)))]),i.call(n+"_chunk",i.getLocal("pBases"),i.getLocal("pScalars"),i.getLocal("scalarSize"),i.getLocal("n"),i.getLocal("itBit"),i.getLocal("chunkSize"),s),i.call(e+"_add",i.getLocal("pr"),s,i.getLocal("pr")),i.setLocal("itBit",i.i32_sub(i.getLocal("itBit"),i.getLocal("chunkSize"))),i.br(0))))}!function(){const e=t.addFunction(n+"_getChunk");e.addParam("pScalar","i32"),e.addParam("scalarSize","i32"),e.addParam("startBit","i32"),e.addParam("chunkSize","i32"),e.addLocal("bitsToEnd","i32"),e.addLocal("mask","i32"),e.setReturnType("i32");const r=e.getCodeBuilder();e.addCode(r.setLocal("bitsToEnd",r.i32_sub(r.i32_mul(r.getLocal("scalarSize"),r.i32_const(8)),r.getLocal("startBit"))),r.if(r.i32_gt_s(r.getLocal("chunkSize"),r.getLocal("bitsToEnd")),r.setLocal("mask",r.i32_sub(r.i32_shl(r.i32_const(1),r.getLocal("bitsToEnd")),r.i32_const(1))),r.setLocal("mask",r.i32_sub(r.i32_shl(r.i32_const(1),r.getLocal("chunkSize")),r.i32_const(1)))),r.i32_and(r.i32_shr_u(r.i32_load(r.i32_add(r.getLocal("pScalar"),r.i32_shr_u(r.getLocal("startBit"),r.i32_const(3))),0,0),r.i32_and(r.getLocal("startBit"),r.i32_const(7))),r.getLocal("mask")))}(),function(){const r=t.addFunction(n+"_reduceTable");r.addParam("pTable","i32"),r.addParam("p","i32"),r.addLocal("half","i32"),r.addLocal("it1","i32"),r.addLocal("it2","i32"),r.addLocal("pAcc","i32");const i=r.getCodeBuilder();r.addCode(i.if(i.i32_eq(i.getLocal("p"),i.i32_const(1)),i.ret([])),i.setLocal("half",i.i32_shl(i.i32_const(1),i.i32_sub(i.getLocal("p"),i.i32_const(1)))),i.setLocal("it1",i.getLocal("pTable")),i.setLocal("it2",i.i32_add(i.getLocal("pTable"),i.i32_mul(i.getLocal("half"),i.i32_const(o)))),i.setLocal("pAcc",i.i32_sub(i.getLocal("it2"),i.i32_const(o))),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("it1"),i.getLocal("pAcc"))),i.call(e+"_add",i.getLocal("it1"),i.getLocal("it2"),i.getLocal("it1")),i.call(e+"_add",i.getLocal("pAcc"),i.getLocal("it2"),i.getLocal("pAcc")),i.setLocal("it1",i.i32_add(i.getLocal("it1"),i.i32_const(o))),i.setLocal("it2",i.i32_add(i.getLocal("it2"),i.i32_const(o))),i.br(0))),i.call(n+"_reduceTable",i.getLocal("pTable"),i.i32_sub(i.getLocal("p"),i.i32_const(1))),i.setLocal("p",i.i32_sub(i.getLocal("p"),i.i32_const(1))),i.block(i.loop(i.br_if(1,i.i32_eqz(i.getLocal("p"))),i.call(e+"_double",i.getLocal("pAcc"),i.getLocal("pAcc")),i.setLocal("p",i.i32_sub(i.getLocal("p"),i.i32_const(1))),i.br(0))),i.call(e+"_add",i.getLocal("pTable"),i.getLocal("pAcc"),i.getLocal("pTable")))}(),function(){const s=t.addFunction(n+"_chunk");s.addParam("pBases","i32"),s.addParam("pScalars","i32"),s.addParam("scalarSize","i32"),s.addParam("n","i32"),s.addParam("startBit","i32"),s.addParam("chunkSize","i32"),s.addParam("pr","i32"),s.addLocal("nChunks","i32"),s.addLocal("itScalar","i32"),s.addLocal("endScalar","i32"),s.addLocal("itBase","i32"),s.addLocal("i","i32"),s.addLocal("j","i32"),s.addLocal("nTable","i32"),s.addLocal("pTable","i32"),s.addLocal("idx","i32"),s.addLocal("pIdxTable","i32");const a=s.getCodeBuilder();s.addCode(a.if(a.i32_eqz(a.getLocal("n")),[...a.call(e+"_zero",a.getLocal("pr")),...a.ret([])]),a.setLocal("nTable",a.i32_shl(a.i32_const(1),a.getLocal("chunkSize"))),a.setLocal("pTable",a.i32_load(a.i32_const(0))),a.i32_store(a.i32_const(0),a.i32_add(a.getLocal("pTable"),a.i32_mul(a.getLocal("nTable"),a.i32_const(o)))),a.setLocal("j",a.i32_const(0)),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("j"),a.getLocal("nTable"))),a.call(e+"_zero",a.i32_add(a.getLocal("pTable"),a.i32_mul(a.getLocal("j"),a.i32_const(o)))),a.setLocal("j",a.i32_add(a.getLocal("j"),a.i32_const(1))),a.br(0))),a.setLocal("itBase",a.getLocal("pBases")),a.setLocal("itScalar",a.getLocal("pScalars")),a.setLocal("endScalar",a.i32_add(a.getLocal("pScalars"),a.i32_mul(a.getLocal("n"),a.getLocal("scalarSize")))),a.block(a.loop(a.br_if(1,a.i32_eq(a.getLocal("itScalar"),a.getLocal("endScalar"))),a.setLocal("idx",a.call(n+"_getChunk",a.getLocal("itScalar"),a.getLocal("scalarSize"),a.getLocal("startBit"),a.getLocal("chunkSize"))),a.if(a.getLocal("idx"),[...a.setLocal("pIdxTable",a.i32_add(a.getLocal("pTable"),a.i32_mul(a.i32_sub(a.getLocal("idx"),a.i32_const(1)),a.i32_const(o)))),...a.call(r,a.getLocal("pIdxTable"),a.getLocal("itBase"),a.getLocal("pIdxTable"))]),a.setLocal("itScalar",a.i32_add(a.getLocal("itScalar"),a.getLocal("scalarSize"))),a.setLocal("itBase",a.i32_add(a.getLocal("itBase"),a.i32_const(i))),a.br(0))),a.call(n+"_reduceTable",a.getLocal("pTable"),a.getLocal("chunkSize")),a.call(e+"_copy",a.getLocal("pTable"),a.getLocal("pr")),a.i32_store(a.i32_const(0),a.getLocal("pTable")))}(),s(),t.exportFunction(n),t.exportFunction(n+"_chunk")};var KI=function(t,e,n,r){const i=t.modules[n].n64,o=8*i;if(t.modules[e])return e;return t.modules[e]={n64:3*i},function(){const r=t.addFunction(e+"_isZeroAffine");r.addParam("p1","i32"),r.setReturnType("i32");const i=r.getCodeBuilder();r.addCode(i.i32_and(i.call(n+"_isZero",i.getLocal("p1")),i.call(n+"_isZero",i.i32_add(i.getLocal("p1"),i.i32_const(o)))))}(),function(){const r=t.addFunction(e+"_isZero");r.addParam("p1","i32"),r.setReturnType("i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_isZero",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))))}(),function(){const r=t.addFunction(e+"_zeroAffine");r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_zero",i.getLocal("pr"))),r.addCode(i.call(n+"_zero",i.i32_add(i.getLocal("pr"),i.i32_const(o))))}(),function(){const r=t.addFunction(e+"_zero");r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_zero",i.getLocal("pr"))),r.addCode(i.call(n+"_one",i.i32_add(i.getLocal("pr"),i.i32_const(o)))),r.addCode(i.call(n+"_zero",i.i32_add(i.getLocal("pr"),i.i32_const(2*o))))}(),function(){const n=t.addFunction(e+"_copyAffine");n.addParam("ps","i32"),n.addParam("pd","i32");const r=n.getCodeBuilder();for(let t=0;t<2*i;t++)n.addCode(r.i64_store(r.getLocal("pd"),8*t,r.i64_load(r.getLocal("ps"),8*t)))}(),function(){const n=t.addFunction(e+"_copy");n.addParam("ps","i32"),n.addParam("pd","i32");const r=n.getCodeBuilder();for(let t=0;t<3*i;t++)n.addCode(r.i64_store(r.getLocal("pd"),8*t,r.i64_load(r.getLocal("ps"),8*t)))}(),function(){const r=t.addFunction(e+"_toJacobian");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.getLocal("pr"),l=i.i32_add(i.getLocal("pr"),i.i32_const(o)),u=i.i32_add(i.getLocal("pr"),i.i32_const(2*o));r.addCode(i.if(i.call(e+"_isZeroAffine",i.getLocal("p1")),i.call(e+"_zero",i.getLocal("pr")),[...i.call(n+"_one",u),...i.call(n+"_copy",a,l),...i.call(n+"_copy",s,c)]))}(),function(){const r=t.addFunction(e+"_eqAffine");r.addParam("p1","i32"),r.addParam("p2","i32"),r.setReturnType("i32"),r.addLocal("z1","i32");const i=r.getCodeBuilder();r.addCode(i.ret(i.i32_and(i.call(n+"_eq",i.getLocal("p1"),i.getLocal("p2")),i.call(n+"_eq",i.i32_add(i.getLocal("p1"),i.i32_const(o)),i.i32_add(i.getLocal("p2"),i.i32_const(o))))))}(),function(){const r=t.addFunction(e+"_eqMixed");r.addParam("p1","i32"),r.addParam("p2","i32"),r.setReturnType("i32"),r.addLocal("z1","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o));r.addCode(i.setLocal("z1",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))));const c=i.getLocal("z1"),l=i.getLocal("p2"),u=i.i32_add(i.getLocal("p2"),i.i32_const(o)),h=i.i32_const(t.alloc(o)),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),i.ret(i.call(e+"_isZeroAffine",i.getLocal("p2")))),i.if(i.call(e+"_isZeroAffine",i.getLocal("p2")),i.ret(i.i32_const(0))),i.if(i.call(n+"_isOne",c),i.ret(i.call(e+"_eqAffine",i.getLocal("p1"),i.getLocal("p2")))),i.call(n+"_square",c,h),i.call(n+"_mul",l,h,d),i.call(n+"_mul",c,h,p),i.call(n+"_mul",u,p,f),i.if(i.call(n+"_eq",s,d),i.if(i.call(n+"_eq",a,f),i.ret(i.i32_const(1)))),i.ret(i.i32_const(0)))}(),function(){const r=t.addFunction(e+"_eq");r.addParam("p1","i32"),r.addParam("p2","i32"),r.setReturnType("i32"),r.addLocal("z1","i32"),r.addLocal("z2","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o));r.addCode(i.setLocal("z1",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))));const c=i.getLocal("z1"),l=i.getLocal("p2"),u=i.i32_add(i.getLocal("p2"),i.i32_const(o));r.addCode(i.setLocal("z2",i.i32_add(i.getLocal("p2"),i.i32_const(2*o))));const h=i.getLocal("z2"),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o)),E=i.i32_const(t.alloc(o)),m=i.i32_const(t.alloc(o)),w=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),i.ret(i.call(e+"_isZero",i.getLocal("p2")))),i.if(i.call(e+"_isZero",i.getLocal("p2")),i.ret(i.i32_const(0))),i.if(i.call(n+"_isOne",c),i.ret(i.call(e+"_eqMixed",i.getLocal("p2"),i.getLocal("p1")))),i.if(i.call(n+"_isOne",h),i.ret(i.call(e+"_eqMixed",i.getLocal("p1"),i.getLocal("p2")))),i.call(n+"_square",c,d),i.call(n+"_square",h,p),i.call(n+"_mul",s,p,f),i.call(n+"_mul",l,d,g),i.call(n+"_mul",c,d,A),i.call(n+"_mul",h,p,E),i.call(n+"_mul",a,E,m),i.call(n+"_mul",u,A,w),i.if(i.call(n+"_eq",f,g),i.if(i.call(n+"_eq",m,w),i.ret(i.i32_const(1)))),i.ret(i.i32_const(0)))}(),function(){const r=t.addFunction(e+"_doubleAffine");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.getLocal("pr"),l=i.i32_add(i.getLocal("pr"),i.i32_const(o)),u=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),h=i.i32_const(t.alloc(o)),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZeroAffine",i.getLocal("p1")),[...i.call(e+"_toJacobian",i.getLocal("p1"),i.getLocal("pr")),...i.ret([])]),i.call(n+"_square",s,h),i.call(n+"_square",a,d),i.call(n+"_square",d,p),i.call(n+"_add",s,d,f),i.call(n+"_square",f,f),i.call(n+"_sub",f,h,f),i.call(n+"_sub",f,p,f),i.call(n+"_add",f,f,f),i.call(n+"_add",h,h,g),i.call(n+"_add",g,h,g),i.call(n+"_add",a,a,u),i.call(n+"_square",g,c),i.call(n+"_sub",c,f,c),i.call(n+"_sub",c,f,c),i.call(n+"_add",p,p,A),i.call(n+"_add",A,A,A),i.call(n+"_add",A,A,A),i.call(n+"_sub",f,c,l),i.call(n+"_mul",l,g,l),i.call(n+"_sub",l,A,l))}(),function(){const r=t.addFunction(e+"_double");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.i32_add(i.getLocal("p1"),i.i32_const(2*o)),l=i.getLocal("pr"),u=i.i32_add(i.getLocal("pr"),i.i32_const(o)),h=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o)),E=i.i32_const(t.alloc(o)),m=i.i32_const(t.alloc(o)),w=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),[...i.call(e+"_copy",i.getLocal("p1"),i.getLocal("pr")),...i.ret([])]),i.if(i.call(n+"_isOne",c),[...i.ret(i.call(e+"_doubleAffine",i.getLocal("p1"),i.getLocal("pr"))),...i.ret([])]),i.call(n+"_square",s,d),i.call(n+"_square",a,p),i.call(n+"_square",p,f),i.call(n+"_add",s,p,g),i.call(n+"_square",g,g),i.call(n+"_sub",g,d,g),i.call(n+"_sub",g,f,g),i.call(n+"_add",g,g,g),i.call(n+"_add",d,d,A),i.call(n+"_add",A,d,A),i.call(n+"_square",A,E),i.call(n+"_mul",a,c,m),i.call(n+"_add",g,g,l),i.call(n+"_sub",E,l,l),i.call(n+"_add",f,f,w),i.call(n+"_add",w,w,w),i.call(n+"_add",w,w,w),i.call(n+"_sub",g,l,u),i.call(n+"_mul",u,A,u),i.call(n+"_sub",u,w,u),i.call(n+"_add",m,m,h))}(),function(){const r=t.addFunction(e+"_addAffine");r.addParam("p1","i32"),r.addParam("p2","i32"),r.addParam("pr","i32"),r.addLocal("z1","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o));r.addCode(i.setLocal("z1",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))));const c=i.getLocal("p2"),l=i.i32_add(i.getLocal("p2"),i.i32_const(o)),u=i.getLocal("pr"),h=i.i32_add(i.getLocal("pr"),i.i32_const(o)),d=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o)),E=i.i32_const(t.alloc(o)),m=i.i32_const(t.alloc(o)),w=i.i32_const(t.alloc(o)),y=i.i32_const(t.alloc(o)),B=i.i32_const(t.alloc(o)),I=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZeroAffine",i.getLocal("p1")),[...i.call(e+"_copyAffine",i.getLocal("p2"),i.getLocal("pr")),...i.call(n+"_one",i.i32_add(i.getLocal("pr"),i.i32_const(2*o))),...i.ret([])]),i.if(i.call(e+"_isZeroAffine",i.getLocal("p2")),[...i.call(e+"_copyAffine",i.getLocal("p1"),i.getLocal("pr")),...i.call(n+"_one",i.i32_add(i.getLocal("pr"),i.i32_const(2*o))),...i.ret([])]),i.if(i.call(n+"_eq",s,c),i.if(i.call(n+"_eq",a,l),[...i.call(e+"_doubleAffine",i.getLocal("p2"),i.getLocal("pr")),...i.ret([])])),i.call(n+"_sub",c,s,p),i.call(n+"_sub",l,a,g),i.call(n+"_square",p,f),i.call(n+"_add",f,f,A),i.call(n+"_add",A,A,A),i.call(n+"_mul",p,A,E),i.call(n+"_add",g,g,m),i.call(n+"_mul",s,A,y),i.call(n+"_square",m,w),i.call(n+"_add",y,y,B),i.call(n+"_sub",w,E,u),i.call(n+"_sub",u,B,u),i.call(n+"_mul",a,E,I),i.call(n+"_add",I,I,I),i.call(n+"_sub",y,u,h),i.call(n+"_mul",h,m,h),i.call(n+"_sub",h,I,h),i.call(n+"_add",p,p,d))}(),function(){const r=t.addFunction(e+"_addMixed");r.addParam("p1","i32"),r.addParam("p2","i32"),r.addParam("pr","i32"),r.addLocal("z1","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o));r.addCode(i.setLocal("z1",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))));const c=i.getLocal("z1"),l=i.getLocal("p2"),u=i.i32_add(i.getLocal("p2"),i.i32_const(o)),h=i.getLocal("pr"),d=i.i32_add(i.getLocal("pr"),i.i32_const(o)),p=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),f=i.i32_const(t.alloc(o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o)),E=i.i32_const(t.alloc(o)),m=i.i32_const(t.alloc(o)),w=i.i32_const(t.alloc(o)),y=i.i32_const(t.alloc(o)),B=i.i32_const(t.alloc(o)),I=i.i32_const(t.alloc(o)),C=i.i32_const(t.alloc(o)),T=i.i32_const(t.alloc(o)),b=i.i32_const(t.alloc(o)),D=i.i32_const(t.alloc(o)),v=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),[...i.call(e+"_copyAffine",i.getLocal("p2"),i.getLocal("pr")),...i.call(n+"_one",i.i32_add(i.getLocal("pr"),i.i32_const(2*o))),...i.ret([])]),i.if(i.call(e+"_isZeroAffine",i.getLocal("p2")),[...i.call(e+"_copy",i.getLocal("p1"),i.getLocal("pr")),...i.ret([])]),i.if(i.call(n+"_isOne",c),[...i.call(e+"_addAffine",s,l,h),...i.ret([])]),i.call(n+"_square",c,f),i.call(n+"_mul",l,f,g),i.call(n+"_mul",c,f,A),i.call(n+"_mul",u,A,E),i.if(i.call(n+"_eq",s,g),i.if(i.call(n+"_eq",a,E),[...i.call(e+"_doubleAffine",i.getLocal("p2"),i.getLocal("pr")),...i.ret([])])),i.call(n+"_sub",g,s,m),i.call(n+"_sub",E,a,y),i.call(n+"_square",m,w),i.call(n+"_add",w,w,B),i.call(n+"_add",B,B,B),i.call(n+"_mul",m,B,I),i.call(n+"_add",y,y,C),i.call(n+"_mul",s,B,b),i.call(n+"_square",C,T),i.call(n+"_add",b,b,D),i.call(n+"_sub",T,I,h),i.call(n+"_sub",h,D,h),i.call(n+"_mul",a,I,v),i.call(n+"_add",v,v,v),i.call(n+"_sub",b,h,d),i.call(n+"_mul",d,C,d),i.call(n+"_sub",d,v,d),i.call(n+"_add",c,m,p),i.call(n+"_square",p,p),i.call(n+"_sub",p,f,p),i.call(n+"_sub",p,w,p))}(),function(){const r=t.addFunction(e+"_add");r.addParam("p1","i32"),r.addParam("p2","i32"),r.addParam("pr","i32"),r.addLocal("z1","i32"),r.addLocal("z2","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o));r.addCode(i.setLocal("z1",i.i32_add(i.getLocal("p1"),i.i32_const(2*o))));const c=i.getLocal("z1"),l=i.getLocal("p2"),u=i.i32_add(i.getLocal("p2"),i.i32_const(o));r.addCode(i.setLocal("z2",i.i32_add(i.getLocal("p2"),i.i32_const(2*o))));const h=i.getLocal("z2"),d=i.getLocal("pr"),p=i.i32_add(i.getLocal("pr"),i.i32_const(o)),f=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),g=i.i32_const(t.alloc(o)),A=i.i32_const(t.alloc(o)),E=i.i32_const(t.alloc(o)),m=i.i32_const(t.alloc(o)),w=i.i32_const(t.alloc(o)),y=i.i32_const(t.alloc(o)),B=i.i32_const(t.alloc(o)),I=i.i32_const(t.alloc(o)),C=i.i32_const(t.alloc(o)),T=i.i32_const(t.alloc(o)),b=i.i32_const(t.alloc(o)),D=i.i32_const(t.alloc(o)),v=i.i32_const(t.alloc(o)),M=i.i32_const(t.alloc(o)),N=i.i32_const(t.alloc(o)),S=i.i32_const(t.alloc(o)),_=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),[...i.call(e+"_copy",i.getLocal("p2"),i.getLocal("pr")),...i.ret([])]),i.if(i.call(e+"_isZero",i.getLocal("p2")),[...i.call(e+"_copy",i.getLocal("p1"),i.getLocal("pr")),...i.ret([])]),i.if(i.call(n+"_isOne",c),[...i.call(e+"_addMixed",l,s,d),...i.ret([])]),i.if(i.call(n+"_isOne",h),[...i.call(e+"_addMixed",s,l,d),...i.ret([])]),i.call(n+"_square",c,g),i.call(n+"_square",h,A),i.call(n+"_mul",s,A,E),i.call(n+"_mul",l,g,m),i.call(n+"_mul",c,g,w),i.call(n+"_mul",h,A,y),i.call(n+"_mul",a,y,B),i.call(n+"_mul",u,w,I),i.if(i.call(n+"_eq",E,m),i.if(i.call(n+"_eq",B,I),[...i.call(e+"_double",i.getLocal("p1"),i.getLocal("pr")),...i.ret([])])),i.call(n+"_sub",m,E,C),i.call(n+"_sub",I,B,T),i.call(n+"_add",C,C,b),i.call(n+"_square",b,b),i.call(n+"_mul",C,b,D),i.call(n+"_add",T,T,v),i.call(n+"_mul",E,b,N),i.call(n+"_square",v,M),i.call(n+"_add",N,N,S),i.call(n+"_sub",M,D,d),i.call(n+"_sub",d,S,d),i.call(n+"_mul",B,D,_),i.call(n+"_add",_,_,_),i.call(n+"_sub",N,d,p),i.call(n+"_mul",p,v,p),i.call(n+"_sub",p,_,p),i.call(n+"_add",c,h,f),i.call(n+"_square",f,f),i.call(n+"_sub",f,g,f),i.call(n+"_sub",f,A,f),i.call(n+"_mul",f,C,f))}(),function(){const r=t.addFunction(e+"_negAffine");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.getLocal("pr"),l=i.i32_add(i.getLocal("pr"),i.i32_const(o));r.addCode(i.call(n+"_copy",s,c),i.call(n+"_neg",a,l))}(),function(){const r=t.addFunction(e+"_neg");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.i32_add(i.getLocal("p1"),i.i32_const(2*o)),l=i.getLocal("pr"),u=i.i32_add(i.getLocal("pr"),i.i32_const(o)),h=i.i32_add(i.getLocal("pr"),i.i32_const(2*o));r.addCode(i.call(n+"_copy",s,l),i.call(n+"_neg",a,u),i.call(n+"_copy",c,h))}(),function(){const n=t.addFunction(e+"_subAffine");n.addParam("p1","i32"),n.addParam("p2","i32"),n.addParam("pr","i32");const r=n.getCodeBuilder(),i=r.i32_const(t.alloc(3*o));n.addCode(r.call(e+"_negAffine",r.getLocal("p2"),i),r.call(e+"_addAffine",r.getLocal("p1"),i,r.getLocal("pr")))}(),function(){const n=t.addFunction(e+"_subMixed");n.addParam("p1","i32"),n.addParam("p2","i32"),n.addParam("pr","i32");const r=n.getCodeBuilder(),i=r.i32_const(t.alloc(3*o));n.addCode(r.call(e+"_negAffine",r.getLocal("p2"),i),r.call(e+"_addMixed",r.getLocal("p1"),i,r.getLocal("pr")))}(),function(){const n=t.addFunction(e+"_sub");n.addParam("p1","i32"),n.addParam("p2","i32"),n.addParam("pr","i32");const r=n.getCodeBuilder(),i=r.i32_const(t.alloc(3*o));n.addCode(r.call(e+"_neg",r.getLocal("p2"),i),r.call(e+"_add",r.getLocal("p1"),i,r.getLocal("pr")))}(),function(){const r=t.addFunction(e+"_fromMontgomeryAffine");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_fromMontgomery",i.getLocal("p1"),i.getLocal("pr")));for(let t=1;t<2;t++)r.addCode(i.call(n+"_fromMontgomery",i.i32_add(i.getLocal("p1"),i.i32_const(t*o)),i.i32_add(i.getLocal("pr"),i.i32_const(t*o))))}(),function(){const r=t.addFunction(e+"_fromMontgomery");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_fromMontgomery",i.getLocal("p1"),i.getLocal("pr")));for(let t=1;t<3;t++)r.addCode(i.call(n+"_fromMontgomery",i.i32_add(i.getLocal("p1"),i.i32_const(t*o)),i.i32_add(i.getLocal("pr"),i.i32_const(t*o))))}(),function(){const r=t.addFunction(e+"_toMontgomeryAffine");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_toMontgomery",i.getLocal("p1"),i.getLocal("pr")));for(let t=1;t<2;t++)r.addCode(i.call(n+"_toMontgomery",i.i32_add(i.getLocal("p1"),i.i32_const(t*o)),i.i32_add(i.getLocal("pr"),i.i32_const(t*o))))}(),function(){const r=t.addFunction(e+"_toMontgomery");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder();r.addCode(i.call(n+"_toMontgomery",i.getLocal("p1"),i.getLocal("pr")));for(let t=1;t<3;t++)r.addCode(i.call(n+"_toMontgomery",i.i32_add(i.getLocal("p1"),i.i32_const(t*o)),i.i32_add(i.getLocal("pr"),i.i32_const(t*o))))}(),function(){const r=t.addFunction(e+"_toAffine");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.i32_add(i.getLocal("p1"),i.i32_const(2*o)),l=i.getLocal("pr"),u=i.i32_add(i.getLocal("pr"),i.i32_const(o)),h=i.i32_const(t.alloc(o)),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),[...i.call(n+"_zero",l),...i.call(n+"_zero",u)],[...i.call(n+"_inverse",c,h),...i.call(n+"_square",h,d),...i.call(n+"_mul",h,d,p),...i.call(n+"_mul",s,d,l),...i.call(n+"_mul",a,p,u)]))}(),function(){const i=t.addFunction(e+"_inCurveAffine");i.addParam("pIn","i32"),i.setReturnType("i32");const s=i.getCodeBuilder(),a=s.getLocal("pIn"),c=s.i32_add(s.getLocal("pIn"),s.i32_const(o)),l=s.i32_const(t.alloc(o)),u=s.i32_const(t.alloc(o));i.addCode(s.call(n+"_square",c,l),s.call(n+"_square",a,u),s.call(n+"_mul",a,u,u),s.call(n+"_add",u,s.i32_const(r),u),s.ret(s.call(n+"_eq",l,u)))}(),function(){const n=t.addFunction(e+"_inCurve");n.addParam("pIn","i32"),n.setReturnType("i32");const r=n.getCodeBuilder(),i=r.i32_const(t.alloc(2*o));n.addCode(r.call(e+"_toAffine",r.getLocal("pIn"),i),r.ret(r.call(e+"_inCurveAffine",i)))}(),function(){const r=t.addFunction(e+"_batchToAffine");r.addParam("pIn","i32"),r.addParam("n","i32"),r.addParam("pOut","i32"),r.addLocal("pAux","i32"),r.addLocal("itIn","i32"),r.addLocal("itAux","i32"),r.addLocal("itOut","i32"),r.addLocal("i","i32");const i=r.getCodeBuilder(),s=i.i32_const(t.alloc(o));r.addCode(i.setLocal("pAux",i.i32_load(i.i32_const(0))),i.i32_store(i.i32_const(0),i.i32_add(i.getLocal("pAux"),i.i32_mul(i.getLocal("n"),i.i32_const(o)))),i.call(n+"_batchInverse",i.i32_add(i.getLocal("pIn"),i.i32_const(2*o)),i.i32_const(3*o),i.getLocal("n"),i.getLocal("pAux"),i.i32_const(o)),i.setLocal("itIn",i.getLocal("pIn")),i.setLocal("itAux",i.getLocal("pAux")),i.setLocal("itOut",i.getLocal("pOut")),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.if(i.call(n+"_isZero",i.getLocal("itAux")),[...i.call(n+"_zero",i.getLocal("itOut")),...i.call(n+"_zero",i.i32_add(i.getLocal("itOut"),i.i32_const(o)))],[...i.call(n+"_mul",i.getLocal("itAux"),i.i32_add(i.getLocal("itIn"),i.i32_const(o)),s),...i.call(n+"_square",i.getLocal("itAux"),i.getLocal("itAux")),...i.call(n+"_mul",i.getLocal("itAux"),i.getLocal("itIn"),i.getLocal("itOut")),...i.call(n+"_mul",i.getLocal("itAux"),s,i.i32_add(i.getLocal("itOut"),i.i32_const(o)))]),i.setLocal("itIn",i.i32_add(i.getLocal("itIn"),i.i32_const(3*o))),i.setLocal("itOut",i.i32_add(i.getLocal("itOut"),i.i32_const(2*o))),i.setLocal("itAux",i.i32_add(i.getLocal("itAux"),i.i32_const(o))),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))),i.i32_store(i.i32_const(0),i.getLocal("pAux")))}(),function(){const r=t.addFunction(e+"_normalize");r.addParam("p1","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),s=i.getLocal("p1"),a=i.i32_add(i.getLocal("p1"),i.i32_const(o)),c=i.i32_add(i.getLocal("p1"),i.i32_const(2*o)),l=i.getLocal("pr"),u=i.i32_add(i.getLocal("pr"),i.i32_const(o)),h=i.i32_add(i.getLocal("pr"),i.i32_const(2*o)),d=i.i32_const(t.alloc(o)),p=i.i32_const(t.alloc(o)),f=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZero",i.getLocal("p1")),i.call(e+"_zero",i.getLocal("pr")),[...i.call(n+"_inverse",c,d),...i.call(n+"_square",d,p),...i.call(n+"_mul",d,p,f),...i.call(n+"_mul",s,p,l),...i.call(n+"_mul",a,f,u),...i.call(n+"_one",h)]))}(),function(){const n=t.addFunction(e+"__reverseBytes");n.addParam("pIn","i32"),n.addParam("n","i32"),n.addParam("pOut","i32"),n.addLocal("itOut","i32"),n.addLocal("itIn","i32");const r=n.getCodeBuilder();n.addCode(r.setLocal("itOut",r.i32_sub(r.i32_add(r.getLocal("pOut"),r.getLocal("n")),r.i32_const(1))),r.setLocal("itIn",r.getLocal("pIn")),r.block(r.loop(r.br_if(1,r.i32_lt_s(r.getLocal("itOut"),r.getLocal("pOut"))),r.i32_store8(r.getLocal("itOut"),r.i32_load8_u(r.getLocal("itIn"))),r.setLocal("itOut",r.i32_sub(r.getLocal("itOut"),r.i32_const(1))),r.setLocal("itIn",r.i32_add(r.getLocal("itIn"),r.i32_const(1))),r.br(0))))}(),function(){const n=t.addFunction(e+"_LEMtoU");n.addParam("pIn","i32"),n.addParam("pOut","i32");const r=n.getCodeBuilder(),i=t.alloc(2*o),s=r.i32_const(i),a=r.i32_const(i),c=r.i32_const(i+o);n.addCode(r.if(r.call(e+"_isZeroAffine",r.getLocal("pIn")),[...r.call(e+"_zeroAffine",r.getLocal("pOut")),...r.ret([])]),r.call(e+"_fromMontgomeryAffine",r.getLocal("pIn"),s),r.call(e+"__reverseBytes",a,r.i32_const(o),r.getLocal("pOut")),r.call(e+"__reverseBytes",c,r.i32_const(o),r.i32_add(r.getLocal("pOut"),r.i32_const(o))))}(),function(){const r=t.addFunction(e+"_LEMtoC");r.addParam("pIn","i32"),r.addParam("pOut","i32");const i=r.getCodeBuilder(),s=i.i32_const(t.alloc(o));r.addCode(i.if(i.call(e+"_isZeroAffine",i.getLocal("pIn")),[...i.call(n+"_zero",i.getLocal("pOut")),...i.i32_store8(i.getLocal("pOut"),i.i32_const(64)),...i.ret([])]),i.call(n+"_fromMontgomery",i.getLocal("pIn"),s),i.call(e+"__reverseBytes",s,i.i32_const(o),i.getLocal("pOut")),i.if(i.i32_eq(i.call(n+"_sign",i.i32_add(i.getLocal("pIn"),i.i32_const(o))),i.i32_const(-1)),i.i32_store8(i.getLocal("pOut"),i.i32_or(i.i32_load8_u(i.getLocal("pOut")),i.i32_const(128)))))}(),function(){const n=t.addFunction(e+"_UtoLEM");n.addParam("pIn","i32"),n.addParam("pOut","i32");const r=n.getCodeBuilder(),i=t.alloc(2*o),s=r.i32_const(i),a=r.i32_const(i),c=r.i32_const(i+o);n.addCode(r.if(r.i32_and(r.i32_load8_u(r.getLocal("pIn")),r.i32_const(64)),[...r.call(e+"_zeroAffine",r.getLocal("pOut")),...r.ret([])]),r.call(e+"__reverseBytes",r.getLocal("pIn"),r.i32_const(o),a),r.call(e+"__reverseBytes",r.i32_add(r.getLocal("pIn"),r.i32_const(o)),r.i32_const(o),c),r.call(e+"_toMontgomeryAffine",s,r.getLocal("pOut")))}(),function(){const i=t.addFunction(e+"_CtoLEM");i.addParam("pIn","i32"),i.addParam("pOut","i32"),i.addLocal("firstByte","i32"),i.addLocal("greatest","i32");const s=i.getCodeBuilder(),a=t.alloc(2*o),c=s.i32_const(a),l=s.i32_const(a+o);i.addCode(s.setLocal("firstByte",s.i32_load8_u(s.getLocal("pIn"))),s.if(s.i32_and(s.getLocal("firstByte"),s.i32_const(64)),[...s.call(e+"_zeroAffine",s.getLocal("pOut")),...s.ret([])]),s.setLocal("greatest",s.i32_and(s.getLocal("firstByte"),s.i32_const(128))),s.call(n+"_copy",s.getLocal("pIn"),l),s.i32_store8(l,s.i32_and(s.getLocal("firstByte"),s.i32_const(63))),s.call(e+"__reverseBytes",l,s.i32_const(o),c),s.call(n+"_toMontgomery",c,s.getLocal("pOut")),s.call(n+"_square",s.getLocal("pOut"),l),s.call(n+"_mul",s.getLocal("pOut"),l,l),s.call(n+"_add",l,s.i32_const(r),l),s.call(n+"_sqrt",l,l),s.call(n+"_neg",l,c),s.if(s.i32_eq(s.call(n+"_sign",l),s.i32_const(-1)),s.if(s.getLocal("greatest"),s.call(n+"_copy",l,s.i32_add(s.getLocal("pOut"),s.i32_const(o))),s.call(n+"_neg",l,s.i32_add(s.getLocal("pOut"),s.i32_const(o)))),s.if(s.getLocal("greatest"),s.call(n+"_neg",l,s.i32_add(s.getLocal("pOut"),s.i32_const(o))),s.call(n+"_copy",l,s.i32_add(s.getLocal("pOut"),s.i32_const(o))))))}(),WI(t,e+"_batchLEMtoU",e+"_LEMtoU",2*o,2*o),WI(t,e+"_batchLEMtoC",e+"_LEMtoC",2*o,o),WI(t,e+"_batchUtoLEM",e+"_UtoLEM",2*o,2*o),WI(t,e+"_batchCtoLEM",e+"_CtoLEM",o,2*o,!0),WI(t,e+"_batchToJacobian",e+"_toJacobian",2*o,3*o,!0),qI(t,e,e+"_multiexp",e+"_add",3*o),qI(t,e,e+"_multiexpAffine",e+"_addMixed",2*o),JI(t,e+"_timesScalar",3*o,e+"_add",e+"_double",e+"_sub",e+"_copy",e+"_zero"),JI(t,e+"_timesScalarAffine",2*o,e+"_addMixed",e+"_double",e+"_subMixed",e+"_copyAffine",e+"_zero"),t.exportFunction(e+"_isZero"),t.exportFunction(e+"_isZeroAffine"),t.exportFunction(e+"_eq"),t.exportFunction(e+"_eqMixed"),t.exportFunction(e+"_eqAffine"),t.exportFunction(e+"_copy"),t.exportFunction(e+"_copyAffine"),t.exportFunction(e+"_zero"),t.exportFunction(e+"_zeroAffine"),t.exportFunction(e+"_double"),t.exportFunction(e+"_doubleAffine"),t.exportFunction(e+"_add"),t.exportFunction(e+"_addMixed"),t.exportFunction(e+"_addAffine"),t.exportFunction(e+"_neg"),t.exportFunction(e+"_negAffine"),t.exportFunction(e+"_sub"),t.exportFunction(e+"_subMixed"),t.exportFunction(e+"_subAffine"),t.exportFunction(e+"_fromMontgomery"),t.exportFunction(e+"_fromMontgomeryAffine"),t.exportFunction(e+"_toMontgomery"),t.exportFunction(e+"_toMontgomeryAffine"),t.exportFunction(e+"_timesScalar"),t.exportFunction(e+"_timesScalarAffine"),t.exportFunction(e+"_normalize"),t.exportFunction(e+"_LEMtoU"),t.exportFunction(e+"_LEMtoC"),t.exportFunction(e+"_UtoLEM"),t.exportFunction(e+"_CtoLEM"),t.exportFunction(e+"_batchLEMtoU"),t.exportFunction(e+"_batchLEMtoC"),t.exportFunction(e+"_batchUtoLEM"),t.exportFunction(e+"_batchCtoLEM"),t.exportFunction(e+"_toAffine"),t.exportFunction(e+"_toJacobian"),t.exportFunction(e+"_batchToAffine"),t.exportFunction(e+"_batchToJacobian"),t.exportFunction(e+"_inCurve"),t.exportFunction(e+"_inCurveAffine"),e};const{isOdd:ZI,modInv:XI,modPow:$I}=uI,tC=oI;var eC=function(t,e,n,r,i){const o=8*t.modules[r].n64,s=8*t.modules[n].n64,a=t.modules[r].q;let c=a-1n,l=0;for(;!ZI(c);)l++,c>>=1n;let u=2n;for(;1n===$I(u,a>>1n,a);)u+=1n;const h=new Array(l+1);h[l]=$I(u,c,a);let d=l-1;for(;d>=0;)h[d]=$I(h[d+1],2n,a),d--;const p=[],f=(1n<<BigInt(8*o))%a;for(let t=0;t<h.length;t++){const e=h[t]*f%a;p.push(...tC.bigInt2BytesLE(e,o))}const g=t.alloc(p),A=new Array(l+1);A[0]=1n;for(let t=1;t<=l;t++)A[t]=2n*A[t-1];const E=[];for(let t=0;t<=l;t++){const e=XI(A[t],a)*f%a;E.push(...tC.bigInt2BytesLE(e,o))}const m=t.alloc(E),w=$I(u,2n,a),y=[],B=[];for(let t=0;t<=l;t++){const e=$I(w,2n**BigInt(t),a),n=XI(a+1n-e,a);y.push(...tC.bigInt2BytesLE(e*f%a,o)),B.push(...tC.bigInt2BytesLE(n*f%a,o))}const I=t.alloc(y),C=t.alloc(B);function T(t){let e=0;for(let n=0;n<8;n++)t&1<<n&&(e|=128>>n);return e}const b=Array(256);for(let t=0;t<256;t++)b[t]=T(t);const D=t.alloc(b);function v(){const n=t.addFunction(e+"_fft");n.addParam("px","i32"),n.addParam("n","i32"),n.addLocal("bits","i32");const i=n.getCodeBuilder(),s=i.i32_const(t.alloc(o));n.addCode(i.setLocal("bits",i.call(e+"__log2",i.getLocal("n"))),i.call(r+"_one",s),i.call(e+"_rawfft",i.getLocal("px"),i.getLocal("bits"),i.i32_const(0),s))}!function(){const n=t.addFunction(e+"__rev");n.addParam("x","i32"),n.addParam("bits","i32"),n.setReturnType("i32");const r=n.getCodeBuilder();n.addCode(r.i32_rotl(r.i32_add(r.i32_add(r.i32_shl(r.i32_load8_u(r.i32_and(r.getLocal("x"),r.i32_const(255)),D,0),r.i32_const(24)),r.i32_shl(r.i32_load8_u(r.i32_and(r.i32_shr_u(r.getLocal("x"),r.i32_const(8)),r.i32_const(255)),D,0),r.i32_const(16))),r.i32_add(r.i32_shl(r.i32_load8_u(r.i32_and(r.i32_shr_u(r.getLocal("x"),r.i32_const(16)),r.i32_const(255)),D,0),r.i32_const(8)),r.i32_load8_u(r.i32_and(r.i32_shr_u(r.getLocal("x"),r.i32_const(24)),r.i32_const(255)),D,0))),r.getLocal("bits")))}(),function(){const r=t.addFunction(e+"__reversePermutation");r.addParam("px","i32"),r.addParam("bits","i32"),r.addLocal("n","i32"),r.addLocal("i","i32"),r.addLocal("ri","i32"),r.addLocal("idx1","i32"),r.addLocal("idx2","i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(s));r.addCode(i.setLocal("n",i.i32_shl(i.i32_const(1),i.getLocal("bits"))),i.setLocal("i",i.i32_const(0)),i.block(i.loop(i.br_if(1,i.i32_eq(i.getLocal("i"),i.getLocal("n"))),i.setLocal("idx1",i.i32_add(i.getLocal("px"),i.i32_mul(i.getLocal("i"),i.i32_const(s)))),i.setLocal("ri",i.call(e+"__rev",i.getLocal("i"),i.getLocal("bits"))),i.setLocal("idx2",i.i32_add(i.getLocal("px"),i.i32_mul(i.getLocal("ri"),i.i32_const(s)))),i.if(i.i32_lt_u(i.getLocal("i"),i.getLocal("ri")),[...i.call(n+"_copy",i.getLocal("idx1"),o),...i.call(n+"_copy",i.getLocal("idx2"),i.getLocal("idx1")),...i.call(n+"_copy",o,i.getLocal("idx2"))]),i.setLocal("i",i.i32_add(i.getLocal("i"),i.i32_const(1))),i.br(0))))}(),function(){const o=t.addFunction(e+"__fftFinal");o.addParam("px","i32"),o.addParam("bits","i32"),o.addParam("reverse","i32"),o.addParam("mulFactor","i32"),o.addLocal("n","i32"),o.addLocal("ndiv2","i32"),o.addLocal("pInv2","i32"),o.addLocal("i","i32"),o.addLocal("mask","i32"),o.addLocal("idx1","i32"),o.addLocal("idx2","i32");const a=o.getCodeBuilder(),c=a.i32_const(t.alloc(s));o.addCode(a.if(a.i32_and(a.i32_eqz(a.getLocal("reverse")),a.call(r+"_isOne",a.getLocal("mulFactor"))),a.ret([])),a.setLocal("n",a.i32_shl(a.i32_const(1),a.getLocal("bits"))),a.setLocal("mask",a.i32_sub(a.getLocal("n"),a.i32_const(1))),a.setLocal("i",a.i32_const(1)),a.setLocal("ndiv2",a.i32_shr_u(a.getLocal("n"),a.i32_const(1))),a.block(a.loop(a.br_if(1,a.i32_ge_u(a.getLocal("i"),a.getLocal("ndiv2"))),a.setLocal("idx1",a.i32_add(a.getLocal("px"),a.i32_mul(a.getLocal("i"),a.i32_const(s)))),a.setLocal("idx2",a.i32_add(a.getLocal("px"),a.i32_mul(a.i32_sub(a.getLocal("n"),a.getLocal("i")),a.i32_const(s)))),a.if(a.getLocal("reverse"),a.if(a.call(r+"_isOne",a.getLocal("mulFactor")),[...a.call(n+"_copy",a.getLocal("idx1"),c),...a.call(n+"_copy",a.getLocal("idx2"),a.getLocal("idx1")),...a.call(n+"_copy",c,a.getLocal("idx2"))],[...a.call(n+"_copy",a.getLocal("idx1"),c),...a.call(i,a.getLocal("idx2"),a.getLocal("mulFactor"),a.getLocal("idx1")),...a.call(i,c,a.getLocal("mulFactor"),a.getLocal("idx2"))]),a.if(a.call(r+"_isOne",a.getLocal("mulFactor")),[],[...a.call(i,a.getLocal("idx1"),a.getLocal("mulFactor"),a.getLocal("idx1")),...a.call(i,a.getLocal("idx2"),a.getLocal("mulFactor"),a.getLocal("idx2"))])),a.setLocal("i",a.i32_add(a.getLocal("i"),a.i32_const(1))),a.br(0))),a.if(a.call(r+"_isOne",a.getLocal("mulFactor")),[],[...a.call(i,a.getLocal("px"),a.getLocal("mulFactor"),a.getLocal("px")),...a.setLocal("idx2",a.i32_add(a.getLocal("px"),a.i32_mul(a.getLocal("ndiv2"),a.i32_const(s)))),...a.call(i,a.getLocal("idx2"),a.getLocal("mulFactor"),a.getLocal("idx2"))]))}(),function(){const a=t.addFunction(e+"_rawfft");a.addParam("px","i32"),a.addParam("bits","i32"),a.addParam("reverse","i32"),a.addParam("mulFactor","i32"),a.addLocal("s","i32"),a.addLocal("k","i32"),a.addLocal("j","i32"),a.addLocal("m","i32"),a.addLocal("mdiv2","i32"),a.addLocal("n","i32"),a.addLocal("pwm","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s)),h=c.i32_const(t.alloc(s));a.addCode(c.call(e+"__reversePermutation",c.getLocal("px"),c.getLocal("bits")),c.setLocal("n",c.i32_shl(c.i32_const(1),c.getLocal("bits"))),c.setLocal("s",c.i32_const(1)),c.block(c.loop(c.br_if(1,c.i32_gt_u(c.getLocal("s"),c.getLocal("bits"))),c.setLocal("m",c.i32_shl(c.i32_const(1),c.getLocal("s"))),c.setLocal("pwm",c.i32_add(c.i32_const(g),c.i32_mul(c.getLocal("s"),c.i32_const(o)))),c.setLocal("k",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("k"),c.getLocal("n"))),c.call(r+"_one",l),c.setLocal("mdiv2",c.i32_shr_u(c.getLocal("m"),c.i32_const(1))),c.setLocal("j",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_ge_u(c.getLocal("j"),c.getLocal("mdiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("px"),c.i32_mul(c.i32_add(c.getLocal("k"),c.getLocal("j")),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("idx1"),c.i32_mul(c.getLocal("mdiv2"),c.i32_const(s)))),c.call(i,c.getLocal("idx2"),l,u),c.call(n+"_copy",c.getLocal("idx1"),h),c.call(n+"_add",h,u,c.getLocal("idx1")),c.call(n+"_sub",h,u,c.getLocal("idx2")),c.call(r+"_mul",l,c.getLocal("pwm"),l),c.setLocal("j",c.i32_add(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.setLocal("k",c.i32_add(c.getLocal("k"),c.getLocal("m"))),c.br(0))),c.setLocal("s",c.i32_add(c.getLocal("s"),c.i32_const(1))),c.br(0))),c.call(e+"__fftFinal",c.getLocal("px"),c.getLocal("bits"),c.getLocal("reverse"),c.getLocal("mulFactor")))}(),function(){const n=t.addFunction(e+"__log2");n.addParam("n","i32"),n.setReturnType("i32"),n.addLocal("bits","i32"),n.addLocal("aux","i32");const r=n.getCodeBuilder();n.addCode(r.setLocal("aux",r.i32_shr_u(r.getLocal("n"),r.i32_const(1)))),n.addCode(r.setLocal("bits",r.i32_const(0))),n.addCode(r.block(r.loop(r.br_if(1,r.i32_eqz(r.getLocal("aux"))),r.setLocal("aux",r.i32_shr_u(r.getLocal("aux"),r.i32_const(1))),r.setLocal("bits",r.i32_add(r.getLocal("bits"),r.i32_const(1))),r.br(0)))),n.addCode(r.if(r.i32_ne(r.getLocal("n"),r.i32_shl(r.i32_const(1),r.getLocal("bits"))),r.unreachable())),n.addCode(r.if(r.i32_gt_u(r.getLocal("bits"),r.i32_const(l)),r.unreachable())),n.addCode(r.getLocal("bits"))}(),v(),function(){const n=t.addFunction(e+"_ifft");n.addParam("px","i32"),n.addParam("n","i32"),n.addLocal("bits","i32"),n.addLocal("pInv2","i32");const r=n.getCodeBuilder();n.addCode(r.setLocal("bits",r.call(e+"__log2",r.getLocal("n"))),r.setLocal("pInv2",r.i32_add(r.i32_const(m),r.i32_mul(r.getLocal("bits"),r.i32_const(o)))),r.call(e+"_rawfft",r.getLocal("px"),r.getLocal("bits"),r.i32_const(1),r.getLocal("pInv2")))}(),function(){const a=t.addFunction(e+"_fftJoin");a.addParam("pBuff1","i32"),a.addParam("pBuff2","i32"),a.addParam("n","i32"),a.addParam("first","i32"),a.addParam("inc","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32"),a.addLocal("i","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s)),h=c.i32_const(t.alloc(s));a.addCode(c.call(r+"_copy",c.getLocal("first"),l),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.call(i,c.getLocal("idx2"),l,u),c.call(n+"_copy",c.getLocal("idx1"),h),c.call(n+"_add",h,u,c.getLocal("idx1")),c.call(n+"_sub",h,u,c.getLocal("idx2")),c.call(r+"_mul",l,c.getLocal("inc"),l),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}(),function(){const a=t.addFunction(e+"_fftJoinExt");a.addParam("pBuff1","i32"),a.addParam("pBuff2","i32"),a.addParam("n","i32"),a.addParam("first","i32"),a.addParam("inc","i32"),a.addParam("totalBits","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32"),a.addLocal("i","i32"),a.addLocal("pShiftToM","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s));a.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(I),c.i32_mul(c.getLocal("totalBits"),c.i32_const(o)))),c.call(r+"_copy",c.getLocal("first"),l),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.call(n+"_add",c.getLocal("idx1"),c.getLocal("idx2"),u),c.call(i,c.getLocal("idx2"),c.getLocal("pShiftToM"),c.getLocal("idx2")),c.call(n+"_add",c.getLocal("idx1"),c.getLocal("idx2"),c.getLocal("idx2")),c.call(i,c.getLocal("idx2"),l,c.getLocal("idx2")),c.call(n+"_copy",u,c.getLocal("idx1")),c.call(r+"_mul",l,c.getLocal("inc"),l),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}(),function(){const a=t.addFunction(e+"_fftJoinExtInv");a.addParam("pBuff1","i32"),a.addParam("pBuff2","i32"),a.addParam("n","i32"),a.addParam("first","i32"),a.addParam("inc","i32"),a.addParam("totalBits","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32"),a.addLocal("i","i32"),a.addLocal("pShiftToM","i32"),a.addLocal("pSConst","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s));a.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(I),c.i32_mul(c.getLocal("totalBits"),c.i32_const(o)))),c.setLocal("pSConst",c.i32_add(c.i32_const(C),c.i32_mul(c.getLocal("totalBits"),c.i32_const(o)))),c.call(r+"_copy",c.getLocal("first"),l),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.call(i,c.getLocal("idx2"),l,u),c.call(n+"_sub",c.getLocal("idx1"),u,c.getLocal("idx2")),c.call(i,c.getLocal("idx2"),c.getLocal("pSConst"),c.getLocal("idx2")),c.call(i,c.getLocal("idx1"),c.getLocal("pShiftToM"),c.getLocal("idx1")),c.call(n+"_sub",u,c.getLocal("idx1"),c.getLocal("idx1")),c.call(i,c.getLocal("idx1"),c.getLocal("pSConst"),c.getLocal("idx1")),c.call(r+"_mul",l,c.getLocal("inc"),l),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}(),function(){const a=t.addFunction(e+"_fftMix");a.addParam("pBuff","i32"),a.addParam("n","i32"),a.addParam("exp","i32"),a.addLocal("nGroups","i32"),a.addLocal("nPerGroup","i32"),a.addLocal("nPerGroupDiv2","i32"),a.addLocal("pairOffset","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32"),a.addLocal("i","i32"),a.addLocal("j","i32"),a.addLocal("pwm","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s)),h=c.i32_const(t.alloc(s));a.addCode(c.setLocal("nPerGroup",c.i32_shl(c.i32_const(1),c.getLocal("exp"))),c.setLocal("nPerGroupDiv2",c.i32_shr_u(c.getLocal("nPerGroup"),c.i32_const(1))),c.setLocal("nGroups",c.i32_shr_u(c.getLocal("n"),c.getLocal("exp"))),c.setLocal("pairOffset",c.i32_mul(c.getLocal("nPerGroupDiv2"),c.i32_const(s))),c.setLocal("pwm",c.i32_add(c.i32_const(g),c.i32_mul(c.getLocal("exp"),c.i32_const(o)))),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("nGroups"))),c.call(r+"_one",l),c.setLocal("j",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("j"),c.getLocal("nPerGroupDiv2"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff"),c.i32_mul(c.i32_add(c.i32_mul(c.getLocal("i"),c.getLocal("nPerGroup")),c.getLocal("j")),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("idx1"),c.getLocal("pairOffset"))),c.call(i,c.getLocal("idx2"),l,u),c.call(n+"_copy",c.getLocal("idx1"),h),c.call(n+"_add",h,u,c.getLocal("idx1")),c.call(n+"_sub",h,u,c.getLocal("idx2")),c.call(r+"_mul",l,c.getLocal("pwm"),l),c.setLocal("j",c.i32_add(c.getLocal("j"),c.i32_const(1))),c.br(0))),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}(),function(){const r=t.addFunction(e+"_fftFinal");r.addParam("pBuff","i32"),r.addParam("n","i32"),r.addParam("factor","i32"),r.addLocal("idx1","i32"),r.addLocal("idx2","i32"),r.addLocal("i","i32"),r.addLocal("ndiv2","i32");const o=r.getCodeBuilder(),a=o.i32_const(t.alloc(s));r.addCode(o.setLocal("ndiv2",o.i32_shr_u(o.getLocal("n"),o.i32_const(1))),o.if(o.i32_and(o.getLocal("n"),o.i32_const(1)),o.call(i,o.i32_add(o.getLocal("pBuff"),o.i32_mul(o.getLocal("ndiv2"),o.i32_const(s))),o.getLocal("factor"),o.i32_add(o.getLocal("pBuff"),o.i32_mul(o.getLocal("ndiv2"),o.i32_const(s))))),o.setLocal("i",o.i32_const(0)),o.block(o.loop(o.br_if(1,o.i32_ge_u(o.getLocal("i"),o.getLocal("ndiv2"))),o.setLocal("idx1",o.i32_add(o.getLocal("pBuff"),o.i32_mul(o.getLocal("i"),o.i32_const(s)))),o.setLocal("idx2",o.i32_add(o.getLocal("pBuff"),o.i32_mul(o.i32_sub(o.i32_sub(o.getLocal("n"),o.i32_const(1)),o.getLocal("i")),o.i32_const(s)))),o.call(i,o.getLocal("idx2"),o.getLocal("factor"),a),o.call(i,o.getLocal("idx1"),o.getLocal("factor"),o.getLocal("idx2")),o.call(n+"_copy",a,o.getLocal("idx1")),o.setLocal("i",o.i32_add(o.getLocal("i"),o.i32_const(1))),o.br(0))))}(),function(){const a=t.addFunction(e+"_prepareLagrangeEvaluation");a.addParam("pBuff1","i32"),a.addParam("pBuff2","i32"),a.addParam("n","i32"),a.addParam("first","i32"),a.addParam("inc","i32"),a.addParam("totalBits","i32"),a.addLocal("idx1","i32"),a.addLocal("idx2","i32"),a.addLocal("i","i32"),a.addLocal("pShiftToM","i32"),a.addLocal("pSConst","i32");const c=a.getCodeBuilder(),l=c.i32_const(t.alloc(o)),u=c.i32_const(t.alloc(s));a.addCode(c.setLocal("pShiftToM",c.i32_add(c.i32_const(I),c.i32_mul(c.getLocal("totalBits"),c.i32_const(o)))),c.setLocal("pSConst",c.i32_add(c.i32_const(C),c.i32_mul(c.getLocal("totalBits"),c.i32_const(o)))),c.call(r+"_copy",c.getLocal("first"),l),c.setLocal("i",c.i32_const(0)),c.block(c.loop(c.br_if(1,c.i32_eq(c.getLocal("i"),c.getLocal("n"))),c.setLocal("idx1",c.i32_add(c.getLocal("pBuff1"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.setLocal("idx2",c.i32_add(c.getLocal("pBuff2"),c.i32_mul(c.getLocal("i"),c.i32_const(s)))),c.call(i,c.getLocal("idx1"),c.getLocal("pShiftToM"),u),c.call(n+"_sub",c.getLocal("idx2"),u,u),c.call(n+"_sub",c.getLocal("idx1"),c.getLocal("idx2"),c.getLocal("idx2")),c.call(i,u,c.getLocal("pSConst"),c.getLocal("idx1")),c.call(i,c.getLocal("idx2"),l,c.getLocal("idx2")),c.call(r+"_mul",l,c.getLocal("inc"),l),c.setLocal("i",c.i32_add(c.getLocal("i"),c.i32_const(1))),c.br(0))))}(),t.exportFunction(e+"_fft"),t.exportFunction(e+"_ifft"),t.exportFunction(e+"_rawfft"),t.exportFunction(e+"_fftJoin"),t.exportFunction(e+"_fftJoinExt"),t.exportFunction(e+"_fftJoinExtInv"),t.exportFunction(e+"_fftMix"),t.exportFunction(e+"_fftFinal"),t.exportFunction(e+"_prepareLagrangeEvaluation")},nC=function(t,e,n){const r=8*t.modules[n].n64;return function(){const i=t.addFunction(e+"_zero");i.addParam("px","i32"),i.addParam("n","i32"),i.addLocal("lastp","i32"),i.addLocal("p","i32");const o=i.getCodeBuilder();i.addCode(o.setLocal("p",o.getLocal("px")),o.setLocal("lastp",o.i32_add(o.getLocal("px"),o.i32_mul(o.getLocal("n"),o.i32_const(r)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("p"),o.getLocal("lastp"))),o.call(n+"_zero",o.getLocal("p")),o.setLocal("p",o.i32_add(o.getLocal("p"),o.i32_const(r))),o.br(0))))}(),function(){const i=t.addFunction(e+"_constructLC");i.addParam("ppolynomials","i32"),i.addParam("psignals","i32"),i.addParam("nSignals","i32"),i.addParam("pres","i32"),i.addLocal("i","i32"),i.addLocal("j","i32"),i.addLocal("pp","i32"),i.addLocal("ps","i32"),i.addLocal("pd","i32"),i.addLocal("ncoefs","i32");const o=i.getCodeBuilder(),s=o.i32_const(t.alloc(r));i.addCode(o.setLocal("i",o.i32_const(0)),o.setLocal("pp",o.getLocal("ppolynomials")),o.setLocal("ps",o.getLocal("psignals")),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("i"),o.getLocal("nSignals"))),o.setLocal("ncoefs",o.i32_load(o.getLocal("pp"))),o.setLocal("pp",o.i32_add(o.getLocal("pp"),o.i32_const(4))),o.setLocal("j",o.i32_const(0)),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("j"),o.getLocal("ncoefs"))),o.setLocal("pd",o.i32_add(o.getLocal("pres"),o.i32_mul(o.i32_load(o.getLocal("pp")),o.i32_const(r)))),o.setLocal("pp",o.i32_add(o.getLocal("pp"),o.i32_const(4))),o.call(n+"_mul",o.getLocal("ps"),o.getLocal("pp"),s),o.call(n+"_add",s,o.getLocal("pd"),o.getLocal("pd")),o.setLocal("pp",o.i32_add(o.getLocal("pp"),o.i32_const(r))),o.setLocal("j",o.i32_add(o.getLocal("j"),o.i32_const(1))),o.br(0))),o.setLocal("ps",o.i32_add(o.getLocal("ps"),o.i32_const(r))),o.setLocal("i",o.i32_add(o.getLocal("i"),o.i32_const(1))),o.br(0))))}(),t.exportFunction(e+"_zero"),t.exportFunction(e+"_constructLC"),e},rC=function(t,e,n){const r=8*t.modules[n].n64;return function(){const i=t.addFunction(e+"_buildABC");i.addParam("pCoefs","i32"),i.addParam("nCoefs","i32"),i.addParam("pWitness","i32"),i.addParam("pA","i32"),i.addParam("pB","i32"),i.addParam("pC","i32"),i.addParam("offsetOut","i32"),i.addParam("nOut","i32"),i.addParam("offsetWitness","i32"),i.addParam("nWitness","i32"),i.addLocal("it","i32"),i.addLocal("ita","i32"),i.addLocal("itb","i32"),i.addLocal("last","i32"),i.addLocal("m","i32"),i.addLocal("c","i32"),i.addLocal("s","i32"),i.addLocal("pOut","i32");const o=i.getCodeBuilder(),s=o.i32_const(t.alloc(r));i.addCode(o.setLocal("ita",o.getLocal("pA")),o.setLocal("itb",o.getLocal("pB")),o.setLocal("last",o.i32_add(o.getLocal("pA"),o.i32_mul(o.getLocal("nOut"),o.i32_const(r)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("ita"),o.getLocal("last"))),o.call(n+"_zero",o.getLocal("ita")),o.call(n+"_zero",o.getLocal("itb")),o.setLocal("ita",o.i32_add(o.getLocal("ita"),o.i32_const(r))),o.setLocal("itb",o.i32_add(o.getLocal("itb"),o.i32_const(r))),o.br(0))),o.setLocal("it",o.getLocal("pCoefs")),o.setLocal("last",o.i32_add(o.getLocal("pCoefs"),o.i32_mul(o.getLocal("nCoefs"),o.i32_const(r+12)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("it"),o.getLocal("last"))),o.setLocal("s",o.i32_load(o.getLocal("it"),8)),o.if(o.i32_or(o.i32_lt_u(o.getLocal("s"),o.getLocal("offsetWitness")),o.i32_ge_u(o.getLocal("s"),o.i32_add(o.getLocal("offsetWitness"),o.getLocal("nWitness")))),[...o.setLocal("it",o.i32_add(o.getLocal("it"),o.i32_const(r+12))),...o.br(1)]),o.setLocal("m",o.i32_load(o.getLocal("it"))),o.if(o.i32_eq(o.getLocal("m"),o.i32_const(0)),o.setLocal("pOut",o.getLocal("pA")),o.if(o.i32_eq(o.getLocal("m"),o.i32_const(1)),o.setLocal("pOut",o.getLocal("pB")),[...o.setLocal("it",o.i32_add(o.getLocal("it"),o.i32_const(r+12))),...o.br(1)])),o.setLocal("c",o.i32_load(o.getLocal("it"),4)),o.if(o.i32_or(o.i32_lt_u(o.getLocal("c"),o.getLocal("offsetOut")),o.i32_ge_u(o.getLocal("c"),o.i32_add(o.getLocal("offsetOut"),o.getLocal("nOut")))),[...o.setLocal("it",o.i32_add(o.getLocal("it"),o.i32_const(r+12))),...o.br(1)]),o.setLocal("pOut",o.i32_add(o.getLocal("pOut"),o.i32_mul(o.i32_sub(o.getLocal("c"),o.getLocal("offsetOut")),o.i32_const(r)))),o.call(n+"_mul",o.i32_add(o.getLocal("pWitness"),o.i32_mul(o.i32_sub(o.getLocal("s"),o.getLocal("offsetWitness")),o.i32_const(r))),o.i32_add(o.getLocal("it"),o.i32_const(12)),s),o.call(n+"_add",o.getLocal("pOut"),s,o.getLocal("pOut")),o.setLocal("it",o.i32_add(o.getLocal("it"),o.i32_const(r+12))),o.br(0))),o.setLocal("ita",o.getLocal("pA")),o.setLocal("itb",o.getLocal("pB")),o.setLocal("it",o.getLocal("pC")),o.setLocal("last",o.i32_add(o.getLocal("pA"),o.i32_mul(o.getLocal("nOut"),o.i32_const(r)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("ita"),o.getLocal("last"))),o.call(n+"_mul",o.getLocal("ita"),o.getLocal("itb"),o.getLocal("it")),o.setLocal("ita",o.i32_add(o.getLocal("ita"),o.i32_const(r))),o.setLocal("itb",o.i32_add(o.getLocal("itb"),o.i32_const(r))),o.setLocal("it",o.i32_add(o.getLocal("it"),o.i32_const(r))),o.br(0))))}(),function(){const i=t.addFunction(e+"_joinABC");i.addParam("pA","i32"),i.addParam("pB","i32"),i.addParam("pC","i32"),i.addParam("n","i32"),i.addParam("pP","i32"),i.addLocal("ita","i32"),i.addLocal("itb","i32"),i.addLocal("itc","i32"),i.addLocal("itp","i32"),i.addLocal("last","i32");const o=i.getCodeBuilder(),s=o.i32_const(t.alloc(r));i.addCode(o.setLocal("ita",o.getLocal("pA")),o.setLocal("itb",o.getLocal("pB")),o.setLocal("itc",o.getLocal("pC")),o.setLocal("itp",o.getLocal("pP")),o.setLocal("last",o.i32_add(o.getLocal("pA"),o.i32_mul(o.getLocal("n"),o.i32_const(r)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("ita"),o.getLocal("last"))),o.call(n+"_mul",o.getLocal("ita"),o.getLocal("itb"),s),o.call(n+"_sub",s,o.getLocal("itc"),o.getLocal("itp")),o.setLocal("ita",o.i32_add(o.getLocal("ita"),o.i32_const(r))),o.setLocal("itb",o.i32_add(o.getLocal("itb"),o.i32_const(r))),o.setLocal("itc",o.i32_add(o.getLocal("itc"),o.i32_const(r))),o.setLocal("itp",o.i32_add(o.getLocal("itp"),o.i32_const(r))),o.br(0))))}(),function(){const i=t.addFunction(e+"_batchAdd");i.addParam("pa","i32"),i.addParam("pb","i32"),i.addParam("n","i32"),i.addParam("pr","i32"),i.addLocal("ita","i32"),i.addLocal("itb","i32"),i.addLocal("itr","i32"),i.addLocal("last","i32");const o=i.getCodeBuilder();i.addCode(o.setLocal("ita",o.getLocal("pa")),o.setLocal("itb",o.getLocal("pb")),o.setLocal("itr",o.getLocal("pr")),o.setLocal("last",o.i32_add(o.getLocal("pa"),o.i32_mul(o.getLocal("n"),o.i32_const(r)))),o.block(o.loop(o.br_if(1,o.i32_eq(o.getLocal("ita"),o.getLocal("last"))),o.call(n+"_add",o.getLocal("ita"),o.getLocal("itb"),o.getLocal("itr")),o.setLocal("ita",o.i32_add(o.getLocal("ita"),o.i32_const(r))),o.setLocal("itb",o.i32_add(o.getLocal("itb"),o.i32_const(r))),o.setLocal("itr",o.i32_add(o.getLocal("itr"),o.i32_const(r))),o.br(0))))}(),t.exportFunction(e+"_buildABC"),t.exportFunction(e+"_joinABC"),t.exportFunction(e+"_batchAdd"),e},iC=function(t,e,n,r,i,o,s,a){const c=t.addFunction(e);c.addParam("pIn","i32"),c.addParam("n","i32"),c.addParam("pFirst","i32"),c.addParam("pInc","i32"),c.addParam("pOut","i32"),c.addLocal("pOldFree","i32"),c.addLocal("i","i32"),c.addLocal("pFrom","i32"),c.addLocal("pTo","i32");const l=c.getCodeBuilder(),u=l.i32_const(t.alloc(s));c.addCode(l.setLocal("pFrom",l.getLocal("pIn")),l.setLocal("pTo",l.getLocal("pOut"))),c.addCode(l.call(r+"_copy",l.getLocal("pFirst"),u)),c.addCode(l.setLocal("i",l.i32_const(0)),l.block(l.loop(l.br_if(1,l.i32_eq(l.getLocal("i"),l.getLocal("n"))),l.call(a,l.getLocal("pFrom"),u,l.getLocal("pTo")),l.setLocal("pFrom",l.i32_add(l.getLocal("pFrom"),l.i32_const(i))),l.setLocal("pTo",l.i32_add(l.getLocal("pTo"),l.i32_const(o))),l.call(r+"_mul",u,l.getLocal("pInc"),u),l.setLocal("i",l.i32_add(l.getLocal("i"),l.i32_const(1))),l.br(0)))),t.exportFunction(e)};const oC=oI,sC=kI,aC=UI,cC=jI,lC=zI,uC=KI,hC=eC,dC=nC,pC=rC,fC=iC,{bitLength:gC,modInv:AC,isOdd:EC,isNegative:mC}=uI;const wC=oI,yC=kI,BC=UI,IC=jI,CC=zI,TC=KI,bC=eC,DC=nC,vC=rC,MC=iC,{bitLength:NC,isOdd:SC,isNegative:_C}=uI;var LC=function(t,e){const n=e||"bn128";if(t.modules[n])return n;const r=21888242871839275222246405745257275088696311157297823662689037894645226208583n,i=21888242871839275222246405745257275088548364400416034343698204186575808495617n,o=Math.floor((gC(r-1n)-1)/64)+1,s=8*o,a=s,c=s,l=2*c,u=12*c,h=t.alloc(oC.bigInt2BytesLE(i,a)),d=sC(t,r,"f1m");aC(t,i,"fr","frm");const p=t.alloc(oC.bigInt2BytesLE(w(3n),c)),f=uC(t,"g1m","f1m",p);hC(t,"frm","frm","frm","frm_mul"),dC(t,"pol","frm"),pC(t,"qap","frm");const g=cC(t,"f1m_neg","f2m","f1m"),A=t.alloc([...oC.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n),c),...oC.bigInt2BytesLE(w(266929791119991161246907387137283842545076965332900288569378510910307636690n),c)]),E=uC(t,"g2m","f2m",A);function m(e,n){const r=t.addFunction(e);r.addParam("pG","i32"),r.addParam("pFr","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(s));r.addCode(i.call("frm_fromMontgomery",i.getLocal("pFr"),o),i.call(n,i.getLocal("pG"),o,i.i32_const(s),i.getLocal("pr"))),t.exportFunction(e)}function w(t){return BigInt(t)*(1n<<BigInt(8*c))%r}m("g1m_timesFr","g1m_timesScalar"),hC(t,"g1m","g1m","frm","g1m_timesFr"),m("g2m_timesFr","g2m_timesScalar"),hC(t,"g2m","g2m","frm","g2m_timesFr"),m("g1m_timesFrAffine","g1m_timesScalarAffine"),m("g2m_timesFrAffine","g2m_timesScalarAffine"),fC(t,"frm_batchApplyKey","fmr","frm",s,s,s,"frm_mul"),fC(t,"g1m_batchApplyKey","g1m","frm",3*s,3*s,s,"g1m_timesFr"),fC(t,"g1m_batchApplyKeyMixed","g1m","frm",2*s,3*s,s,"g1m_timesFrAffine"),fC(t,"g2m_batchApplyKey","g2m","frm",2*s*3,3*s*2,s,"g2m_timesFr"),fC(t,"g2m_batchApplyKeyMixed","g2m","frm",2*s*2,3*s*2,s,"g2m_timesFrAffine");const y=[1n,2n,1n],B=t.alloc([...oC.bigInt2BytesLE(w(y[0]),c),...oC.bigInt2BytesLE(w(y[1]),c),...oC.bigInt2BytesLE(w(y[2]),c)]),I=[0n,1n,0n],C=t.alloc([...oC.bigInt2BytesLE(w(I[0]),c),...oC.bigInt2BytesLE(w(I[1]),c),...oC.bigInt2BytesLE(w(I[2]),c)]),T=[[10857046999023057135944570762232829481370756359578518086990519993285655852781n,11559732032986387107991004021392285783925812861821192530917403151452391805634n],[8495653923123431417604973247489272438418190587263600148770280649306958101930n,4082367875863433681332203403145435568316851327593401208105741076214120093531n],[1n,0n]],b=t.alloc([...oC.bigInt2BytesLE(w(T[0][0]),c),...oC.bigInt2BytesLE(w(T[0][1]),c),...oC.bigInt2BytesLE(w(T[1][0]),c),...oC.bigInt2BytesLE(w(T[1][1]),c),...oC.bigInt2BytesLE(w(T[2][0]),c),...oC.bigInt2BytesLE(w(T[2][1]),c)]),D=[[0n,0n],[1n,0n],[0n,0n]],v=t.alloc([...oC.bigInt2BytesLE(w(D[0][0]),c),...oC.bigInt2BytesLE(w(D[0][1]),c),...oC.bigInt2BytesLE(w(D[1][0]),c),...oC.bigInt2BytesLE(w(D[1][1]),c),...oC.bigInt2BytesLE(w(D[2][0]),c),...oC.bigInt2BytesLE(w(D[2][1]),c)]),M=t.alloc([...oC.bigInt2BytesLE(w(1),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c),...oC.bigInt2BytesLE(w(0),c)]),N=t.alloc([...oC.bigInt2BytesLE(w(9),c),...oC.bigInt2BytesLE(w(1),c)]),S=t.alloc([...oC.bigInt2BytesLE(w(AC(2n,r)),c),...oC.bigInt2BytesLE(0n,c)]),_=N,L=t.alloc([...oC.bigInt2BytesLE(w(19485874751759354771024239261021720505790618469301721065564631296452457478373n),c),...oC.bigInt2BytesLE(w(266929791119991161246907387137283842545076965332900288569378510910307636690n),c)]);!function(){const e=t.addFunction(n+"_mulNR6");e.addParam("x","i32"),e.addParam("pr","i32");const r=e.getCodeBuilder();e.addCode(r.call(g+"_mul",r.i32_const(N),r.getLocal("x"),r.getLocal("pr")))}();const x=lC(t,n+"_mulNR6","f6m","f2m");!function(){const e=t.addFunction(n+"_mulNR12");e.addParam("x","i32"),e.addParam("pr","i32");const r=e.getCodeBuilder();e.addCode(r.call(g+"_mul",r.i32_const(N),r.i32_add(r.getLocal("x"),r.i32_const(4*s)),r.getLocal("pr")),r.call(g+"_copy",r.getLocal("x"),r.i32_add(r.getLocal("pr"),r.i32_const(2*s))),r.call(g+"_copy",r.i32_add(r.getLocal("x"),r.i32_const(2*s)),r.i32_add(r.getLocal("pr"),r.i32_const(4*s))))}();const R=cC(t,n+"_mulNR12","ftm",x),F=function(t){let e=t;const n=[];for(;e>0n;)EC(e)?n.push(1):n.push(0),e>>=1n;return n}(29793968203157093288n),k=t.alloc(F),O=3*l,Q=F.length-1,U=F.reduce((t,e)=>t+(0!=e?1:0),0),P=6*s,G=3*s*2+(U+Q+1)*O;t.modules[n]={n64:o,pG1gen:B,pG1zero:C,pG1b:p,pG2gen:b,pG2zero:v,pG2b:A,pq:t.modules.f1m.pq,pr:h,pOneT:M,prePSize:P,preQSize:G,r:i.toString(),q:r.toString()};function V(e){const i=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[8376118865763821496583973867626364092589906065868298776909617916018768340080n,16469823323077808223889137241176536799009286646108169935659301613961712198316n],[21888242871839275220042445260109153167277707414472061641714758635765020556617n,0n],[11697423496358154304825782922584725312912383441159505038794027105778954184319n,303847389135065887422783454877609941456349188919719272345083954437860409601n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3321304630594332808241809054958361220322477375291206261884409189760185844239n,5722266937896532885780051958958348231143373700109372999374820235121374419868n],[21888242871839275222246405745257275088696311157297823662689037894645226208582n,0n],[13512124006075453725662431877630910996106405091429524885779419978626457868503n,5418419548761466998357268504080738289687024511189653727029736280683514010267n],[2203960485148121921418603742825762020974279258880205651966n,0n],[10190819375481120917420622822672549775783927716138318623895010788866272024264n,21584395482704209334823622290379665147239961968378104390343953940207365798982n],[2203960485148121921418603742825762020974279258880205651967n,0n],[18566938241244942414004596690298913868373833782006617400804628704885040364344n,16165975933942742336466353786298926857552937457188450663314217659523851788715n]]],o=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[21575463638280843010398324269430826099269044274347216827212613867836435027261n,10307601595873709700152284273816112264069230130616436755625194854815875713954n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[3772000881919853776433695186713858239009073593817195771773381919316419345261n,2236595495967245188281701248203181795121068902605861227855261137820944008926n],[2203960485148121921418603742825762020974279258880205651966n,0n],[18429021223477853657660792034369865839114504446431234726392080002137598044644n,9344045779998320333812420223237981029506012124075525679208581902008406485703n]],[[1n,0n],[2581911344467009335267311115468803099551665605076196740867805258568234346338n,19937756971775647987995932169929341994314640652964949448313374472400716661030n],[2203960485148121921418603742825762020974279258880205651966n,0n],[5324479202449903542726783395506214481928257762400643279780343368557297135718n,16208900380737693084919495127334387981393726419856888799917914180988844123039n],[21888242871839275220042445260109153167277707414472061641714758635765020556616n,0n],[13981852324922362344252311234282257507216387789820983642040889267519694726527n,7629828391165209371577384193250820201684255241773809077146787135900891633097n]]],s=t.addFunction(n+"__frobeniusMap"+e);s.addParam("x","i32"),s.addParam("r","i32");const a=s.getCodeBuilder();for(let n=0;n<6;n++){const r=0==n?a.getLocal("x"):a.i32_add(a.getLocal("x"),a.i32_const(n*l)),h=r,p=a.i32_add(a.getLocal("x"),a.i32_const(n*l+c)),f=0==n?a.getLocal("r"):a.i32_add(a.getLocal("r"),a.i32_const(n*l)),A=f,E=a.i32_add(a.getLocal("r"),a.i32_const(n*l+c)),m=u(i[Math.floor(n/3)][e%12],o[n%3][e%6]),y=t.alloc([...oC.bigInt2BytesLE(w(m[0]),32),...oC.bigInt2BytesLE(w(m[1]),32)]);e%2==1?s.addCode(a.call(d+"_copy",h,A),a.call(d+"_neg",p,E),a.call(g+"_mul",f,a.i32_const(y),f)):s.addCode(a.call(g+"_mul",r,a.i32_const(y),f))}function u(t,e){const n=BigInt(t[0]),i=BigInt(t[1]),o=BigInt(e[0]),s=BigInt(e[1]),a=[(n*o-i*s)%r,(n*s+i*o)%r];return mC(a[0])&&(a[0]=a[0]+r),a}}function j(e,r){const i=function(t){let e=t;const n=[];for(;e>0n;){if(EC(e)){const t=2-Number(e%4n);n.push(t),e-=BigInt(t)}else n.push(0);e>>=1n}return n}(e).map(t=>-1==t?255:t),o=t.alloc(i),s=t.addFunction(n+"__cyclotomicExp_"+r);s.addParam("x","i32"),s.addParam("r","i32"),s.addLocal("bit","i32"),s.addLocal("i","i32");const a=s.getCodeBuilder(),c=a.getLocal("x"),l=a.getLocal("r"),h=a.i32_const(t.alloc(u));s.addCode(a.call(R+"_conjugate",c,h),a.call(R+"_one",l),a.if(a.teeLocal("bit",a.i32_load8_s(a.i32_const(i.length-1),o)),a.if(a.i32_eq(a.getLocal("bit"),a.i32_const(1)),a.call(R+"_mul",l,c,l),a.call(R+"_mul",l,h,l))),a.setLocal("i",a.i32_const(i.length-2)),a.block(a.loop(a.call(n+"__cyclotomicSquare",l,l),a.if(a.teeLocal("bit",a.i32_load8_s(a.getLocal("i"),o)),a.if(a.i32_eq(a.getLocal("bit"),a.i32_const(1)),a.call(R+"_mul",l,c,l),a.call(R+"_mul",l,h,l))),a.br_if(1,a.i32_eqz(a.getLocal("i"))),a.setLocal("i",a.i32_sub(a.getLocal("i"),a.i32_const(1))),a.br(0))))}function H(){!function(){const e=t.addFunction(n+"__cyclotomicSquare");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=r.i32_add(r.getLocal("x"),r.i32_const(l)),s=r.i32_add(r.getLocal("x"),r.i32_const(2*l)),a=r.i32_add(r.getLocal("x"),r.i32_const(3*l)),c=r.i32_add(r.getLocal("x"),r.i32_const(4*l)),u=r.i32_add(r.getLocal("x"),r.i32_const(5*l)),h=r.getLocal("r"),d=r.i32_add(r.getLocal("r"),r.i32_const(l)),p=r.i32_add(r.getLocal("r"),r.i32_const(2*l)),f=r.i32_add(r.getLocal("r"),r.i32_const(3*l)),A=r.i32_add(r.getLocal("r"),r.i32_const(4*l)),E=r.i32_add(r.getLocal("r"),r.i32_const(5*l)),m=r.i32_const(t.alloc(l)),w=r.i32_const(t.alloc(l)),y=r.i32_const(t.alloc(l)),B=r.i32_const(t.alloc(l)),I=r.i32_const(t.alloc(l)),C=r.i32_const(t.alloc(l)),T=r.i32_const(t.alloc(l)),b=r.i32_const(t.alloc(l));e.addCode(r.call(g+"_mul",i,c,T),r.call(g+"_mul",c,r.i32_const(N),m),r.call(g+"_add",i,m,m),r.call(g+"_add",i,c,b),r.call(g+"_mul",b,m,m),r.call(g+"_mul",r.i32_const(N),T,b),r.call(g+"_add",T,b,b),r.call(g+"_sub",m,b,m),r.call(g+"_add",T,T,w),r.call(g+"_mul",a,s,T),r.call(g+"_mul",s,r.i32_const(N),y),r.call(g+"_add",a,y,y),r.call(g+"_add",a,s,b),r.call(g+"_mul",b,y,y),r.call(g+"_mul",r.i32_const(N),T,b),r.call(g+"_add",T,b,b),r.call(g+"_sub",y,b,y),r.call(g+"_add",T,T,B),r.call(g+"_mul",o,u,T),r.call(g+"_mul",u,r.i32_const(N),I),r.call(g+"_add",o,I,I),r.call(g+"_add",o,u,b),r.call(g+"_mul",b,I,I),r.call(g+"_mul",r.i32_const(N),T,b),r.call(g+"_add",T,b,b),r.call(g+"_sub",I,b,I),r.call(g+"_add",T,T,C),r.call(g+"_sub",m,i,h),r.call(g+"_add",h,h,h),r.call(g+"_add",m,h,h),r.call(g+"_add",w,c,A),r.call(g+"_add",A,A,A),r.call(g+"_add",w,A,A),r.call(g+"_mul",C,r.i32_const(_),b),r.call(g+"_add",b,a,f),r.call(g+"_add",f,f,f),r.call(g+"_add",b,f,f),r.call(g+"_sub",I,s,p),r.call(g+"_add",p,p,p),r.call(g+"_add",I,p,p),r.call(g+"_sub",y,o,d),r.call(g+"_add",d,d,d),r.call(g+"_add",y,d,d),r.call(g+"_add",B,u,E),r.call(g+"_add",E,E,E),r.call(g+"_add",B,E,E))}(),j(4965661367192848881n,"w0");const e=t.addFunction(n+"__finalExponentiationLastChunk");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=r.getLocal("r"),s=r.i32_const(t.alloc(u)),a=r.i32_const(t.alloc(u)),c=r.i32_const(t.alloc(u)),h=r.i32_const(t.alloc(u)),d=r.i32_const(t.alloc(u)),p=r.i32_const(t.alloc(u)),f=r.i32_const(t.alloc(u)),A=r.i32_const(t.alloc(u)),E=r.i32_const(t.alloc(u)),m=r.i32_const(t.alloc(u)),w=r.i32_const(t.alloc(u)),y=r.i32_const(t.alloc(u)),B=r.i32_const(t.alloc(u)),I=r.i32_const(t.alloc(u)),C=r.i32_const(t.alloc(u)),T=r.i32_const(t.alloc(u)),b=r.i32_const(t.alloc(u)),D=r.i32_const(t.alloc(u)),v=r.i32_const(t.alloc(u)),M=r.i32_const(t.alloc(u)),S=r.i32_const(t.alloc(u));e.addCode(r.call(n+"__cyclotomicExp_w0",i,s),r.call(R+"_conjugate",s,s),r.call(n+"__cyclotomicSquare",s,a),r.call(n+"__cyclotomicSquare",a,c),r.call(R+"_mul",c,a,h),r.call(n+"__cyclotomicExp_w0",h,d),r.call(R+"_conjugate",d,d),r.call(n+"__cyclotomicSquare",d,p),r.call(n+"__cyclotomicExp_w0",p,f),r.call(R+"_conjugate",f,f),r.call(R+"_conjugate",h,A),r.call(R+"_conjugate",f,E),r.call(R+"_mul",E,d,m),r.call(R+"_mul",m,A,w),r.call(R+"_mul",w,a,y),r.call(R+"_mul",w,d,B),r.call(R+"_mul",B,i,I),r.call(n+"__frobeniusMap1",y,C),r.call(R+"_mul",C,I,T),r.call(n+"__frobeniusMap2",w,b),r.call(R+"_mul",b,T,D),r.call(R+"_conjugate",i,v),r.call(R+"_mul",v,y,M),r.call(n+"__frobeniusMap3",M,S),r.call(R+"_mul",S,D,o))}const Y=t.alloc(P),z=t.alloc(G);function J(e){const r=t.addFunction(n+"_pairingEq"+e);for(let t=0;t<e;t++)r.addParam("p_"+t,"i32"),r.addParam("q_"+t,"i32");r.addParam("c","i32"),r.setReturnType("i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(u)),s=i.i32_const(t.alloc(u));r.addCode(i.call(R+"_one",o));for(let t=0;t<e;t++)r.addCode(i.call(n+"_prepareG1",i.getLocal("p_"+t),i.i32_const(Y))),r.addCode(i.call(n+"_prepareG2",i.getLocal("q_"+t),i.i32_const(z))),r.addCode(i.call(n+"_millerLoop",i.i32_const(Y),i.i32_const(z),s)),r.addCode(i.call(R+"_mul",o,s,o));r.addCode(i.call(n+"_finalExponentiation",o,o)),r.addCode(i.call(R+"_eq",o,i.getLocal("c")))}!function(){const e=t.addFunction(n+"_prepAddStep");e.addParam("pQ","i32"),e.addParam("pR","i32"),e.addParam("pCoef","i32");const r=e.getCodeBuilder(),i=r.getLocal("pQ"),o=r.i32_add(r.getLocal("pQ"),r.i32_const(l)),s=r.getLocal("pR"),a=r.i32_add(r.getLocal("pR"),r.i32_const(l)),c=r.i32_add(r.getLocal("pR"),r.i32_const(2*l)),u=r.getLocal("pCoef"),h=r.i32_add(r.getLocal("pCoef"),r.i32_const(l)),d=r.i32_add(r.getLocal("pCoef"),r.i32_const(2*l)),p=h,f=r.i32_const(t.alloc(l)),A=r.i32_const(t.alloc(l)),E=r.i32_const(t.alloc(l)),m=r.i32_const(t.alloc(l)),w=r.i32_const(t.alloc(l)),y=r.i32_const(t.alloc(l)),B=r.i32_const(t.alloc(l));e.addCode(r.call(g+"_mul",i,c,p),r.call(g+"_sub",s,p,p),r.call(g+"_mul",o,c,f),r.call(g+"_sub",a,f,f),r.call(g+"_square",p,A),r.call(g+"_square",f,E),r.call(g+"_mul",p,A,m),r.call(g+"_mul",s,A,w),r.call(g+"_add",w,w,B),r.call(g+"_mul",c,E,y),r.call(g+"_add",m,y,y),r.call(g+"_sub",y,B,y),r.call(g+"_mul",p,y,s),r.call(g+"_mul",m,a,a),r.call(g+"_sub",w,y,B),r.call(g+"_mul",f,B,B),r.call(g+"_sub",B,a,a),r.call(g+"_mul",c,m,c),r.call(g+"_mul",p,o,B),r.call(g+"_mul",f,i,u),r.call(g+"_sub",u,B,u),r.call(g+"_mul",u,r.i32_const(_),u),r.call(g+"_neg",f,d))}(),function(){const e=t.addFunction(n+"_prepDblStep");e.addParam("pR","i32"),e.addParam("pCoef","i32");const r=e.getCodeBuilder(),i=r.getLocal("pR"),o=r.i32_add(r.getLocal("pR"),r.i32_const(l)),s=r.i32_add(r.getLocal("pR"),r.i32_const(2*l)),a=r.getLocal("pCoef"),c=r.i32_add(r.getLocal("pCoef"),r.i32_const(l)),u=r.i32_add(r.getLocal("pCoef"),r.i32_const(2*l)),h=r.i32_const(t.alloc(l)),d=r.i32_const(t.alloc(l)),p=r.i32_const(t.alloc(l)),f=r.i32_const(t.alloc(l)),A=r.i32_const(t.alloc(l)),E=r.i32_const(t.alloc(l)),m=r.i32_const(t.alloc(l)),w=r.i32_const(t.alloc(l)),y=r.i32_const(t.alloc(l)),B=r.i32_const(t.alloc(l)),I=r.i32_const(t.alloc(l)),C=r.i32_const(t.alloc(l));e.addCode(r.call(g+"_mul",o,r.i32_const(S),h),r.call(g+"_mul",i,h,h),r.call(g+"_square",o,d),r.call(g+"_square",s,p),r.call(g+"_add",p,p,f),r.call(g+"_add",f,p,f),r.call(g+"_mul",r.i32_const(L),f,A),r.call(g+"_add",A,A,E),r.call(g+"_add",A,E,E),r.call(g+"_add",d,E,m),r.call(g+"_mul",m,r.i32_const(S),m),r.call(g+"_add",d,p,C),r.call(g+"_add",o,s,w),r.call(g+"_square",w,w),r.call(g+"_sub",w,C,w),r.call(g+"_sub",A,d,y),r.call(g+"_square",i,B),r.call(g+"_square",A,I),r.call(g+"_sub",d,E,C),r.call(g+"_mul",h,C,i),r.call(g+"_add",I,I,C),r.call(g+"_add",I,C,C),r.call(g+"_square",m,o),r.call(g+"_sub",o,C,o),r.call(g+"_mul",d,w,s),r.call(g+"_mul",r.i32_const(_),y,a),r.call(g+"_neg",w,c),r.call(g+"_add",B,B,u),r.call(g+"_add",B,u,u))}(),function(){const e=t.addFunction(n+"_prepareG1");e.addParam("pP","i32"),e.addParam("ppreP","i32");const r=e.getCodeBuilder();e.addCode(r.call(f+"_normalize",r.getLocal("pP"),r.getLocal("ppreP")))}(),function(){!function(){const e=t.addFunction(n+"_mulByQ");e.addParam("p1","i32"),e.addParam("pr","i32");const r=e.getCodeBuilder(),i=r.getLocal("p1"),o=r.i32_add(r.getLocal("p1"),r.i32_const(l)),s=r.i32_add(r.getLocal("p1"),r.i32_const(2*l)),a=r.getLocal("pr"),u=r.i32_add(r.getLocal("pr"),r.i32_const(l)),h=r.i32_add(r.getLocal("pr"),r.i32_const(2*l)),d=r.i32_const(t.alloc([...oC.bigInt2BytesLE(w("21575463638280843010398324269430826099269044274347216827212613867836435027261"),c),...oC.bigInt2BytesLE(w("10307601595873709700152284273816112264069230130616436755625194854815875713954"),c)])),p=r.i32_const(t.alloc([...oC.bigInt2BytesLE(w("2821565182194536844548159561693502659359617185244120367078079554186484126554"),c),...oC.bigInt2BytesLE(w("3505843767911556378687030309984248845540243509899259641013678093033130930403"),c)]));e.addCode(r.call(g+"_conjugate",i,a),r.call(g+"_mul",d,a,a),r.call(g+"_conjugate",o,u),r.call(g+"_mul",p,u,u),r.call(g+"_conjugate",s,h))}();const e=t.addFunction(n+"_prepareG2");e.addParam("pQ","i32"),e.addParam("ppreQ","i32"),e.addLocal("pCoef","i32"),e.addLocal("i","i32");const r=e.getCodeBuilder(),i=r.getLocal("pQ"),o=t.alloc(3*l),s=r.i32_const(o),a=r.i32_const(o),u=r.i32_const(o+l),h=r.i32_const(o+2*l),d=r.i32_add(r.getLocal("ppreQ"),r.i32_const(0)),p=r.i32_add(r.getLocal("ppreQ"),r.i32_const(l)),f=t.alloc(3*l),A=r.i32_const(f),m=t.alloc(3*l),y=r.i32_const(m),B=r.i32_const(m+l);e.addCode(r.call(E+"_normalize",i,d),r.call(g+"_copy",d,a),r.call(g+"_copy",p,u),r.call(g+"_one",h)),e.addCode(r.setLocal("pCoef",r.i32_add(r.getLocal("ppreQ"),r.i32_const(3*l))),r.setLocal("i",r.i32_const(F.length-2)),r.block(r.loop(r.call(n+"_prepDblStep",s,r.getLocal("pCoef")),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))),r.if(r.i32_load8_s(r.getLocal("i"),k),[...r.call(n+"_prepAddStep",d,s,r.getLocal("pCoef")),...r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O)))]),r.br_if(1,r.i32_eqz(r.getLocal("i"))),r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.br(0)))),e.addCode(r.call(n+"_mulByQ",d,A),r.call(n+"_mulByQ",A,y)),e.addCode(r.call(g+"_neg",B,B),r.call(n+"_prepAddStep",A,s,r.getLocal("pCoef")),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))),r.call(n+"_prepAddStep",y,s,r.getLocal("pCoef")),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))))}(),function(){const e=t.addFunction(n+"__mulBy024");e.addParam("pEll0","i32"),e.addParam("pEllVW","i32"),e.addParam("pEllVV","i32"),e.addParam("pR","i32");const r=e.getCodeBuilder(),i=r.getLocal("pEll0"),o=r.getLocal("pEllVV"),a=r.getLocal("pEllVW"),c=r.getLocal("pR"),u=r.i32_add(r.getLocal("pR"),r.i32_const(2*s)),h=r.i32_add(r.getLocal("pR"),r.i32_const(4*s)),d=r.i32_add(r.getLocal("pR"),r.i32_const(6*s)),p=r.i32_add(r.getLocal("pR"),r.i32_const(8*s)),f=r.i32_add(r.getLocal("pR"),r.i32_const(10*s)),A=r.i32_const(t.alloc(l)),E=r.i32_const(t.alloc(l)),m=r.i32_const(t.alloc(l)),w=r.i32_const(t.alloc(l)),y=r.i32_const(t.alloc(l)),B=r.i32_const(t.alloc(l)),I=r.i32_const(t.alloc(l)),C=r.i32_const(t.alloc(l)),T=r.i32_const(t.alloc(l)),b=r.i32_const(t.alloc(l)),D=r.i32_const(t.alloc(l));e.addCode(r.call(g+"_mul",c,i,I),r.call(g+"_mul",h,o,C),r.call(g+"_mul",p,a,T),r.call(g+"_add",c,p,m),r.call(g+"_add",c,h,E),r.call(g+"_add",u,d,w),r.call(g+"_add",w,f,w),r.call(g+"_mul",u,o,b),r.call(g+"_add",b,T,y),r.call(g+"_mul",r.i32_const(N),y,B),r.call(g+"_add",B,I,c),r.call(g+"_mul",f,a,y),r.call(g+"_add",b,y,b),r.call(g+"_add",y,C,y),r.call(g+"_mul",r.i32_const(N),y,B),r.call(g+"_mul",u,i,y),r.call(g+"_add",b,y,b),r.call(g+"_add",B,y,u),r.call(g+"_add",i,o,A),r.call(g+"_mul",E,A,y),r.call(g+"_add",I,C,D),r.call(g+"_sub",y,D,y),r.call(g+"_mul",d,a,B),r.call(g+"_add",b,B,b),r.call(g+"_add",h,p,A),r.call(g+"_add",y,B,h),r.call(g+"_add",o,a,E),r.call(g+"_mul",E,A,y),r.call(g+"_add",C,T,D),r.call(g+"_sub",y,D,y),r.call(g+"_mul",r.i32_const(N),y,B),r.call(g+"_mul",d,i,y),r.call(g+"_add",b,y,b),r.call(g+"_add",B,y,d),r.call(g+"_mul",f,o,y),r.call(g+"_add",b,y,b),r.call(g+"_mul",r.i32_const(N),y,B),r.call(g+"_add",i,a,A),r.call(g+"_mul",m,A,y),r.call(g+"_add",I,T,D),r.call(g+"_sub",y,D,y),r.call(g+"_add",B,y,p),r.call(g+"_add",i,o,A),r.call(g+"_add",A,a,A),r.call(g+"_mul",w,A,y),r.call(g+"_sub",y,b,f))}(),function(){const e=t.addFunction(n+"__mulBy024Old");e.addParam("pEll0","i32"),e.addParam("pEllVW","i32"),e.addParam("pEllVV","i32"),e.addParam("pR","i32");const r=e.getCodeBuilder(),i=r.getLocal("pEll0"),o=r.getLocal("pEllVV"),s=r.getLocal("pEllVW"),a=r.getLocal("pR"),c=t.alloc(u),h=r.i32_const(c),d=r.i32_const(c),p=r.i32_const(c+l),f=r.i32_const(c+2*l),A=r.i32_const(c+3*l),E=r.i32_const(c+4*l),m=r.i32_const(c+5*l);e.addCode(r.call(g+"_copy",i,d),r.call(g+"_zero",p),r.call(g+"_copy",o,f),r.call(g+"_zero",A),r.call(g+"_copy",s,E),r.call(g+"_zero",m),r.call(R+"_mul",h,a,a))}(),function(){const e=t.addFunction(n+"_millerLoop");e.addParam("ppreP","i32"),e.addParam("ppreQ","i32"),e.addParam("r","i32"),e.addLocal("pCoef","i32"),e.addLocal("i","i32");const r=e.getCodeBuilder(),i=r.getLocal("ppreP"),o=r.i32_add(r.getLocal("ppreP"),r.i32_const(c)),s=r.getLocal("pCoef"),a=r.i32_add(r.getLocal("pCoef"),r.i32_const(l)),u=r.i32_add(r.getLocal("pCoef"),r.i32_const(2*l)),h=t.alloc(l),d=r.i32_const(h),p=t.alloc(l),f=r.i32_const(p),A=r.getLocal("r");e.addCode(r.call(R+"_one",A),r.setLocal("pCoef",r.i32_add(r.getLocal("ppreQ"),r.i32_const(3*l))),r.setLocal("i",r.i32_const(F.length-2)),r.block(r.loop(r.call(R+"_square",A,A),r.call(g+"_mul1",a,o,d),r.call(g+"_mul1",u,i,f),r.call(n+"__mulBy024",s,d,f,A),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))),r.if(r.i32_load8_s(r.getLocal("i"),k),[...r.call(g+"_mul1",a,o,d),...r.call(g+"_mul1",u,i,f),...r.call(n+"__mulBy024",s,d,f,A),...r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O)))]),r.br_if(1,r.i32_eqz(r.getLocal("i"))),r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.br(0)))),e.addCode(r.call(g+"_mul1",a,o,d),r.call(g+"_mul1",u,i,f),r.call(n+"__mulBy024",s,d,f,A),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))),r.call(g+"_mul1",a,o,d),r.call(g+"_mul1",u,i,f),r.call(n+"__mulBy024",s,d,f,A),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(O))))}();for(let e=0;e<10;e++)V(e),t.exportFunction(n+"__frobeniusMap"+e);!function(){const e=t.addFunction(n+"_finalExponentiationOld");e.addParam("x","i32"),e.addParam("r","i32");const r=t.alloc(oC.bigInt2BytesLE(552484233613224096312617126783173147097382103762957654188882734314196910839907541213974502761540629817009608548654680343627701153829446747810907373256841551006201639677726139946029199968412598804882391702273019083653272047566316584365559776493027495458238373902875937659943504873220554161550525926302303331747463515644711876653177129578303191095900909191624817826566688241804408081892785725967931714097716709526092261278071952560171111444072049229123565057483750161460024353346284167282452756217662335528813519139808291170539072125381230815729071544861602750936964829313608137325426383735122175229541155376346436093930287402089517426973178917569713384748081827255472576937471496195752727188261435633271238710131736096299798168852925540549342330775279877006784354801422249722573783561685179618816480037695005515426162362431072245638324744480n,352)),i=e.getCodeBuilder();e.addCode(i.call(R+"_exp",i.getLocal("x"),i.i32_const(r),i.i32_const(352),i.getLocal("r")))}(),function(){!function(){const e=t.addFunction(n+"__finalExponentiationFirstChunk");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=i,a=r.i32_add(i,r.i32_const(6*s)),c=r.getLocal("r"),l=t.alloc(u),h=r.i32_const(l),d=h,p=r.i32_const(l+6*s),f=r.i32_const(t.alloc(u)),g=r.i32_const(t.alloc(u)),A=r.i32_const(t.alloc(u));e.addCode(r.call(x+"_copy",o,d),r.call(x+"_neg",a,p),r.call(R+"_inverse",i,f),r.call(R+"_mul",h,f,g),r.call(n+"__frobeniusMap2",g,A),r.call(R+"_mul",g,A,c))}(),H();const e=t.addFunction(n+"_finalExponentiation");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=r.getLocal("r"),a=r.i32_const(t.alloc(u));e.addCode(r.call(n+"__finalExponentiationFirstChunk",i,a),r.call(n+"__finalExponentiationLastChunk",a,o))}();for(let e=1;e<=5;e++)J(e),t.exportFunction(n+"_pairingEq"+e);!function(){const e=t.addFunction(n+"_pairing");e.addParam("p","i32"),e.addParam("q","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.i32_const(t.alloc(u));e.addCode(r.call(n+"_prepareG1",r.getLocal("p"),r.i32_const(Y))),e.addCode(r.call(n+"_prepareG2",r.getLocal("q"),r.i32_const(z))),e.addCode(r.call(n+"_millerLoop",r.i32_const(Y),r.i32_const(z),i)),e.addCode(r.call(n+"_finalExponentiation",i,r.getLocal("r")))}(),t.exportFunction(n+"_pairing"),t.exportFunction(n+"_prepareG1"),t.exportFunction(n+"_prepareG2"),t.exportFunction(n+"_millerLoop"),t.exportFunction(n+"_finalExponentiation"),t.exportFunction(n+"_finalExponentiationOld"),t.exportFunction(n+"__mulBy024"),t.exportFunction(n+"__mulBy024Old"),t.exportFunction(n+"__cyclotomicSquare"),t.exportFunction(n+"__cyclotomicExp_w0")},xC=function(t,e){const n=e||"bls12381";if(t.modules[n])return n;const r=0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn,i=0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001n,o=Math.floor((NC(r-1n)-1)/64)+1,s=8*o,a=s,c=2*a,l=12*a,u=Math.floor((NC(i-1n)-1)/64)+1,h=8*u,d=h,p=t.alloc(wC.bigInt2BytesLE(i,d)),f=yC(t,r,"f1m","intq");BC(t,i,"fr","frm","intr");const g=t.alloc(wC.bigInt2BytesLE(B(4n),a)),A=TC(t,"g1m","f1m",g);bC(t,"frm","frm","frm","frm_mul"),DC(t,"pol","frm"),vC(t,"qap","frm");const E=IC(t,"f1m_neg","f2m","f1m"),m=t.alloc([...wC.bigInt2BytesLE(B(4n),a),...wC.bigInt2BytesLE(B(4n),a)]),w=TC(t,"g2m","f2m",m);function y(e,n){const r=t.addFunction(e);r.addParam("pG","i32"),r.addParam("pFr","i32"),r.addParam("pr","i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(h));r.addCode(i.call("frm_fromMontgomery",i.getLocal("pFr"),o),i.call(n,i.getLocal("pG"),o,i.i32_const(h),i.getLocal("pr"))),t.exportFunction(e)}function B(t){return BigInt(t)*(1n<<BigInt(8*a))%r}y("g1m_timesFr","g1m_timesScalar"),bC(t,"g1m","g1m","frm","g1m_timesFr"),y("g2m_timesFr","g2m_timesScalar"),bC(t,"g2m","g2m","frm","g2m_timesFr"),y("g1m_timesFrAffine","g1m_timesScalarAffine"),y("g2m_timesFrAffine","g2m_timesScalarAffine"),MC(t,"frm_batchApplyKey","fmr","frm",h,h,h,"frm_mul"),MC(t,"g1m_batchApplyKey","g1m","frm",3*s,3*s,h,"g1m_timesFr"),MC(t,"g1m_batchApplyKeyMixed","g1m","frm",2*s,3*s,h,"g1m_timesFrAffine"),MC(t,"g2m_batchApplyKey","g2m","frm",2*s*3,3*s*2,h,"g2m_timesFr"),MC(t,"g2m_batchApplyKeyMixed","g2m","frm",2*s*2,3*s*2,h,"g2m_timesFrAffine");const I=[3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507n,1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569n,1n],C=t.alloc([...wC.bigInt2BytesLE(B(I[0]),a),...wC.bigInt2BytesLE(B(I[1]),a),...wC.bigInt2BytesLE(B(I[2]),a)]),T=[0n,1n,0n],b=t.alloc([...wC.bigInt2BytesLE(B(T[0]),a),...wC.bigInt2BytesLE(B(T[1]),a),...wC.bigInt2BytesLE(B(T[2]),a)]),D=[[352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160n,3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758n],[1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905n,927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582n],[1n,0n]],v=t.alloc([...wC.bigInt2BytesLE(B(D[0][0]),a),...wC.bigInt2BytesLE(B(D[0][1]),a),...wC.bigInt2BytesLE(B(D[1][0]),a),...wC.bigInt2BytesLE(B(D[1][1]),a),...wC.bigInt2BytesLE(B(D[2][0]),a),...wC.bigInt2BytesLE(B(D[2][1]),a)]),M=[[0n,0n],[1n,0n],[0n,0n]],N=t.alloc([...wC.bigInt2BytesLE(B(M[0][0]),a),...wC.bigInt2BytesLE(B(M[0][1]),a),...wC.bigInt2BytesLE(B(M[1][0]),a),...wC.bigInt2BytesLE(B(M[1][1]),a),...wC.bigInt2BytesLE(B(M[2][0]),a),...wC.bigInt2BytesLE(B(M[2][1]),a)]),S=t.alloc([...wC.bigInt2BytesLE(B(1n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a),...wC.bigInt2BytesLE(B(0n),a)]),_=t.alloc([...wC.bigInt2BytesLE(B(1n),a),...wC.bigInt2BytesLE(B(1n),a)]);!function(){const e=t.addFunction(E+"_mulNR");e.addParam("x","i32"),e.addParam("pr","i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(a)),i=n.getLocal("x"),o=n.i32_add(n.getLocal("x"),n.i32_const(a)),s=n.getLocal("pr"),c=n.i32_add(n.getLocal("pr"),n.i32_const(a));e.addCode(n.call(f+"_copy",i,r),n.call(f+"_sub",i,o,s),n.call(f+"_add",r,o,c))}();const L=CC(t,E+"_mulNR","f6m","f2m");!function(){const e=t.addFunction(L+"_mulNR");e.addParam("x","i32"),e.addParam("pr","i32");const n=e.getCodeBuilder(),r=n.i32_const(t.alloc(2*a));e.addCode(n.call(E+"_copy",n.getLocal("x"),r),n.call(E+"_mulNR",n.i32_add(n.getLocal("x"),n.i32_const(4*s)),n.getLocal("pr")),n.call(E+"_copy",n.i32_add(n.getLocal("x"),n.i32_const(2*s)),n.i32_add(n.getLocal("pr"),n.i32_const(4*s))),n.call(E+"_copy",r,n.i32_add(n.getLocal("pr"),n.i32_const(2*s))))}();const x=IC(t,L+"_mulNR","ftm",L),R=function(t){let e=t;const n=[];for(;e>0n;)SC(e)?n.push(1):n.push(0),e>>=1n;return n}(0xd201000000010000n),F=t.alloc(R),k=3*c,O=R.length-1,Q=R.reduce((t,e)=>t+(0!=e?1:0),0),U=6*s,P=3*s*2+(Q+O+1)*k,G=15132376222941642752n;function V(e){const n=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n,151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n],[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n,877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[151655185184498381465642749684540099398075398968325446656007613510403227271200139370504932015952886146304766135027n,3850754370037169011952147076051364057158807420970682438676050522613628423219637725072182697113062777891589506424760n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[1028732146235106349975324479215795277384839936929757896155643118032610843298655225875571310552543014690878354869257n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[877076961050607968509681729531255177986764537961432449499635504522207616027455086505066378536590128544573588734230n,3125332594171059424908108096204648978570118281977575435832422631601824034463382777937621250592425535493320683825557n]]],i=[[[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n],[1n,0n]],[[1n,0n],[0n,4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[0n,1n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[0n,793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n]],[[1n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437n,0n],[4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n,0n],[4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n,0n],[793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351n,0n]]],o=t.addFunction(x+"_frobeniusMap"+e);o.addParam("x","i32"),o.addParam("r","i32");const l=o.getCodeBuilder();for(let r=0;r<6;r++){const h=0==r?l.getLocal("x"):l.i32_add(l.getLocal("x"),l.i32_const(r*c)),d=h,p=l.i32_add(l.getLocal("x"),l.i32_const(r*c+a)),g=0==r?l.getLocal("r"):l.i32_add(l.getLocal("r"),l.i32_const(r*c)),A=g,m=l.i32_add(l.getLocal("r"),l.i32_const(r*c+a)),w=u(n[Math.floor(r/3)][e%12],i[r%3][e%6]),y=t.alloc([...wC.bigInt2BytesLE(B(w[0]),s),...wC.bigInt2BytesLE(B(w[1]),s)]);e%2==1?o.addCode(l.call(f+"_copy",d,A),l.call(f+"_neg",p,m),l.call(E+"_mul",g,l.i32_const(y),g)):o.addCode(l.call(E+"_mul",h,l.i32_const(y),g))}function u(t,e){const n=t[0],i=t[1],o=e[0],s=e[1],a=[(n*o-i*s)%r,(n*s+i*o)%r];return _C(a[0])&&(a[0]=a[0]+r),a}}function j(e,r,i){const o=function(t){let e=t;const n=[];for(;e>0n;){if(SC(e)){const t=2-Number(e%4n);n.push(t),e-=BigInt(t)}else n.push(0);e>>=1n}return n}(e).map(t=>-1==t?255:t),s=t.alloc(o),a=t.addFunction(n+"__cyclotomicExp_"+i);a.addParam("x","i32"),a.addParam("r","i32"),a.addLocal("bit","i32"),a.addLocal("i","i32");const c=a.getCodeBuilder(),u=c.getLocal("x"),h=c.getLocal("r"),d=c.i32_const(t.alloc(l));a.addCode(c.call(x+"_conjugate",u,d),c.call(x+"_one",h),c.if(c.teeLocal("bit",c.i32_load8_s(c.i32_const(o.length-1),s)),c.if(c.i32_eq(c.getLocal("bit"),c.i32_const(1)),c.call(x+"_mul",h,u,h),c.call(x+"_mul",h,d,h))),c.setLocal("i",c.i32_const(o.length-2)),c.block(c.loop(c.call(n+"__cyclotomicSquare",h,h),c.if(c.teeLocal("bit",c.i32_load8_s(c.getLocal("i"),s)),c.if(c.i32_eq(c.getLocal("bit"),c.i32_const(1)),c.call(x+"_mul",h,u,h),c.call(x+"_mul",h,d,h))),c.br_if(1,c.i32_eqz(c.getLocal("i"))),c.setLocal("i",c.i32_sub(c.getLocal("i"),c.i32_const(1))),c.br(0)))),r&&a.addCode(c.call(x+"_conjugate",h,h))}t.modules[n]={n64q:o,n64r:u,n8q:s,n8r:h,pG1gen:C,pG1zero:b,pG1b:g,pG2gen:v,pG2zero:N,pG2b:m,pq:t.modules.f1m.pq,pr:p,pOneT:S,r:i,q:r,prePSize:U,preQSize:P},function(){const e=t.addFunction(L+"_mul1");e.addParam("pA","i32"),e.addParam("pC1","i32"),e.addParam("pR","i32");const n=e.getCodeBuilder(),r=n.getLocal("pA"),i=n.i32_add(n.getLocal("pA"),n.i32_const(2*a)),o=n.i32_add(n.getLocal("pA"),n.i32_const(4*a)),s=n.getLocal("pC1"),c=n.getLocal("pR"),l=n.i32_add(n.getLocal("pR"),n.i32_const(2*a)),u=n.i32_add(n.getLocal("pR"),n.i32_const(4*a)),h=n.i32_const(t.alloc(2*a)),d=n.i32_const(t.alloc(2*a));e.addCode(n.call(E+"_add",r,i,h),n.call(E+"_add",i,o,d),n.call(E+"_mul",i,s,u),n.call(E+"_mul",d,s,c),n.call(E+"_sub",c,u,c),n.call(E+"_mulNR",c,c),n.call(E+"_mul",h,s,l),n.call(E+"_sub",l,u,l))}(),function(){const e=t.addFunction(L+"_mul01");e.addParam("pA","i32"),e.addParam("pC0","i32"),e.addParam("pC1","i32"),e.addParam("pR","i32");const n=e.getCodeBuilder(),r=n.getLocal("pA"),i=n.i32_add(n.getLocal("pA"),n.i32_const(2*a)),o=n.i32_add(n.getLocal("pA"),n.i32_const(4*a)),s=n.getLocal("pC0"),c=n.getLocal("pC1"),l=n.getLocal("pR"),u=n.i32_add(n.getLocal("pR"),n.i32_const(2*a)),h=n.i32_add(n.getLocal("pR"),n.i32_const(4*a)),d=n.i32_const(t.alloc(2*a)),p=n.i32_const(t.alloc(2*a)),f=n.i32_const(t.alloc(2*a)),g=n.i32_const(t.alloc(2*a));e.addCode(n.call(E+"_mul",r,s,d),n.call(E+"_mul",i,c,p),n.call(E+"_add",r,i,f),n.call(E+"_add",r,o,g),n.call(E+"_add",i,o,l),n.call(E+"_mul",l,c,l),n.call(E+"_sub",l,p,l),n.call(E+"_mulNR",l,l),n.call(E+"_add",l,d,l),n.call(E+"_add",s,c,u),n.call(E+"_mul",u,f,u),n.call(E+"_sub",u,d,u),n.call(E+"_sub",u,p,u),n.call(E+"_mul",g,s,h),n.call(E+"_sub",h,d,h),n.call(E+"_add",h,p,h))}(),function(){const e=t.addFunction(x+"_mul014");e.addParam("pA","i32"),e.addParam("pC0","i32"),e.addParam("pC1","i32"),e.addParam("pC4","i32"),e.addParam("pR","i32");const n=e.getCodeBuilder(),r=n.getLocal("pA"),i=n.i32_add(n.getLocal("pA"),n.i32_const(6*a)),o=n.getLocal("pC0"),s=n.getLocal("pC1"),c=n.getLocal("pC4"),l=n.i32_const(t.alloc(6*a)),u=n.i32_const(t.alloc(6*a)),h=n.i32_const(t.alloc(2*a)),d=n.getLocal("pR"),p=n.i32_add(n.getLocal("pR"),n.i32_const(6*a));e.addCode(n.call(L+"_mul01",r,o,s,l),n.call(L+"_mul1",i,c,u),n.call(E+"_add",s,c,h),n.call(L+"_add",i,r,p),n.call(L+"_mul01",p,o,h,p),n.call(L+"_sub",p,l,p),n.call(L+"_sub",p,u,p),n.call(L+"_copy",u,d),n.call(L+"_mulNR",d,d),n.call(L+"_add",d,l,d))}(),function(){const e=t.addFunction(n+"_ell");e.addParam("pP","i32"),e.addParam("pCoefs","i32"),e.addParam("pF","i32");const r=e.getCodeBuilder(),i=r.getLocal("pP"),o=r.i32_add(r.getLocal("pP"),r.i32_const(s)),c=r.getLocal("pF"),l=r.getLocal("pCoefs"),u=r.i32_add(r.getLocal("pCoefs"),r.i32_const(a)),h=r.i32_add(r.getLocal("pCoefs"),r.i32_const(2*a)),d=r.i32_add(r.getLocal("pCoefs"),r.i32_const(3*a)),p=r.i32_add(r.getLocal("pCoefs"),r.i32_const(4*a)),g=t.alloc(2*a),A=r.i32_const(g),E=r.i32_const(g),m=r.i32_const(g+a),w=t.alloc(2*a),y=r.i32_const(w),B=r.i32_const(w),I=r.i32_const(w+a);e.addCode(r.call(f+"_mul",l,o,E),r.call(f+"_mul",u,o,m),r.call(f+"_mul",h,i,B),r.call(f+"_mul",d,i,I),r.call(x+"_mul014",c,p,y,A,c))}();const H=t.alloc(U),Y=t.alloc(P);function z(e){const r=t.addFunction(n+"_pairingEq"+e);for(let t=0;t<e;t++)r.addParam("p_"+t,"i32"),r.addParam("q_"+t,"i32");r.addParam("c","i32"),r.setReturnType("i32");const i=r.getCodeBuilder(),o=i.i32_const(t.alloc(l)),s=i.i32_const(t.alloc(l));r.addCode(i.call(x+"_one",o));for(let t=0;t<e;t++)r.addCode(i.call(n+"_prepareG1",i.getLocal("p_"+t),i.i32_const(H))),r.addCode(i.call(n+"_prepareG2",i.getLocal("q_"+t),i.i32_const(Y))),r.addCode(i.if(i.i32_eqz(i.call(A+"_inGroupAffine",i.i32_const(H))),i.ret(i.i32_const(0))),i.if(i.i32_eqz(i.call(w+"_inGroupAffine",i.i32_const(Y))),i.ret(i.i32_const(0)))),r.addCode(i.call(n+"_millerLoop",i.i32_const(H),i.i32_const(Y),s)),r.addCode(i.call(x+"_mul",o,s,o));r.addCode(i.call(n+"_finalExponentiation",o,o)),r.addCode(i.call(x+"_eq",o,i.getLocal("c")))}for(let e=0;e<10;e++)V(e),t.exportFunction(x+"_frobeniusMap"+e);!function(){const e=t.addFunction(A+"_inGroupAffine");e.addParam("p","i32"),e.setReturnType("i32");const n=e.getCodeBuilder(),r=(G*G-1n)/3n,i=n.i32_const(t.alloc(wC.bigInt2BytesLE(B(4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n),s))),o=n.i32_const(t.alloc(wC.bigInt2BytesLE(B(793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350n),s))),c=n.i32_const(t.alloc(wC.bigInt2BytesLE(r,16))),l=n.getLocal("p"),u=n.i32_add(n.getLocal("p"),n.i32_const(a)),h=t.alloc(3*a),d=n.i32_const(h),p=n.i32_const(h),g=n.i32_const(h+a),E=t.alloc(2*a),m=n.i32_const(E),w=n.i32_const(E),y=n.i32_const(E+a);e.addCode(n.if(n.call(A+"_isZeroAffine",n.getLocal("p")),n.ret(n.i32_const(1))),n.if(n.i32_eqz(n.call(A+"_inCurveAffine",n.getLocal("p"))),n.ret(n.i32_const(0))),n.call(f+"_mul",l,i,p),n.call(f+"_copy",u,g),n.call(f+"_mul",l,o,w),n.call(f+"_copy",u,y),n.call(A+"_doubleAffine",d,d),n.call(A+"_subMixed",d,n.getLocal("p"),d),n.call(A+"_subMixed",d,m,d),n.call(A+"_timesScalar",d,c,n.i32_const(16),d),n.ret(n.call(A+"_eqMixed",d,m)));const I=t.addFunction(A+"_inGroup");I.addParam("pIn","i32"),I.setReturnType("i32");const C=I.getCodeBuilder(),T=C.i32_const(t.alloc(2*a));I.addCode(C.call(A+"_toAffine",C.getLocal("pIn"),T),C.ret(C.call(A+"_inGroupAffine",T)))}(),function(){const e=t.addFunction(w+"_inGroupAffine");e.addParam("p","i32"),e.setReturnType("i32");const n=e.getCodeBuilder(),r=[2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279894n,2001204777610833696708894912867952078278441409969503942666029068062015825245418932221343814564507832018947136279893n],i=[2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n,2973677408986561043442465346520108879172042883009249989176415018091420807192182638567116318576472649347015917690530n],o=n.i32_const(t.alloc([...wC.bigInt2BytesLE(B(r[0]),s),...wC.bigInt2BytesLE(B(r[1]),s)])),l=n.i32_const(t.alloc(wC.bigInt2BytesLE(B(4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436n),s))),u=n.i32_const(t.alloc([...wC.bigInt2BytesLE(B(i[0]),s),...wC.bigInt2BytesLE(B(i[1]),s)])),h=n.i32_const(t.alloc(wC.bigInt2BytesLE(G,8))),d=n.getLocal("p"),p=n.i32_add(n.getLocal("p"),n.i32_const(c)),g=n.i32_const(t.alloc(a)),A=n.i32_const(t.alloc(c)),m=n.i32_const(t.alloc(c)),y=t.alloc(2*c),I=n.i32_const(y),C=n.i32_const(y),T=n.i32_const(y),b=n.i32_const(y+a),D=n.i32_const(y+c),v=n.i32_const(y+c),M=n.i32_const(y+c+a),N=t.alloc(3*c),S=n.i32_const(N),_=n.i32_const(N),L=n.i32_const(N),x=n.i32_const(N+a),R=n.i32_const(N+c),F=n.i32_const(N+c),k=n.i32_const(N+c+a),O=n.i32_const(N+2*c);e.addCode(n.if(n.call(w+"_isZeroAffine",n.getLocal("p")),n.ret(n.i32_const(1))),n.if(n.i32_eqz(n.call(w+"_inCurveAffine",n.getLocal("p"))),n.ret(n.i32_const(0))),n.call(E+"_mul",d,o,A),n.call(E+"_mul",p,o,m),n.call(E+"_mul1",A,l,C),n.call(E+"_neg",m,D),n.call(E+"_neg",A,_),n.call(E+"_mul",m,u,R),n.call(f+"_sub",T,b,g),n.call(f+"_add",T,b,b),n.call(f+"_copy",g,T),n.call(f+"_sub",v,M,g),n.call(f+"_add",v,M,M),n.call(f+"_copy",g,v),n.call(f+"_add",L,x,g),n.call(f+"_sub",L,x,x),n.call(f+"_copy",g,L),n.call(f+"_sub",k,F,g),n.call(f+"_add",F,k,k),n.call(f+"_copy",g,F),n.call(E+"_one",O),n.call(w+"_timesScalar",S,h,n.i32_const(8),S),n.call(w+"_addMixed",S,I,S),n.ret(n.call(w+"_eqMixed",S,n.getLocal("p"))));const Q=t.addFunction(w+"_inGroup");Q.addParam("pIn","i32"),Q.setReturnType("i32");const U=Q.getCodeBuilder(),P=U.i32_const(t.alloc(2*c));Q.addCode(U.call(w+"_toAffine",U.getLocal("pIn"),P),U.ret(U.call(w+"_inGroupAffine",P)))}(),function(){const e=t.addFunction(n+"_prepAddStep");e.addParam("R","i32"),e.addParam("Q","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("R"),o=r.i32_add(r.getLocal("R"),r.i32_const(2*s)),a=r.i32_add(r.getLocal("R"),r.i32_const(4*s)),l=r.getLocal("Q"),u=r.i32_add(r.getLocal("Q"),r.i32_const(2*s)),h=r.getLocal("r"),d=r.i32_add(r.getLocal("r"),r.i32_const(2*s)),p=r.i32_add(r.getLocal("r"),r.i32_const(4*s)),f=r.i32_const(t.alloc(c)),g=r.i32_const(t.alloc(c)),A=r.i32_const(t.alloc(c)),m=r.i32_const(t.alloc(c)),w=r.i32_const(t.alloc(c)),y=r.i32_const(t.alloc(c)),B=r.i32_const(t.alloc(c)),I=r.i32_const(t.alloc(c)),C=r.i32_const(t.alloc(c)),T=r.i32_const(t.alloc(c)),b=r.i32_const(t.alloc(c));e.addCode(r.call(E+"_square",a,f),r.call(E+"_square",u,g),r.call(E+"_mul",f,l,m),r.call(E+"_add",u,a,d),r.call(E+"_square",d,d),r.call(E+"_sub",d,g,d),r.call(E+"_sub",d,f,d),r.call(E+"_mul",d,f,d),r.call(E+"_sub",m,i,w),r.call(E+"_square",w,y),r.call(E+"_add",y,y,B),r.call(E+"_add",B,B,B),r.call(E+"_mul",B,w,I),r.call(E+"_sub",d,o,C),r.call(E+"_sub",C,o,C),r.call(E+"_mul",C,l,p),r.call(E+"_mul",B,i,T),r.call(E+"_square",C,i),r.call(E+"_sub",i,I,i),r.call(E+"_sub",i,T,i),r.call(E+"_sub",i,T,i),r.call(E+"_add",a,w,a),r.call(E+"_square",a,a),r.call(E+"_sub",a,f,a),r.call(E+"_sub",a,y,a),r.call(E+"_add",u,a,h),r.call(E+"_sub",T,i,b),r.call(E+"_mul",b,C,b),r.call(E+"_mul",o,I,m),r.call(E+"_add",m,m,m),r.call(E+"_sub",b,m,o),r.call(E+"_square",h,h),r.call(E+"_sub",h,g,h),r.call(E+"_square",a,A),r.call(E+"_sub",h,A,h),r.call(E+"_add",p,p,p),r.call(E+"_sub",p,h,p),r.call(E+"_add",a,a,h),r.call(E+"_neg",C,C),r.call(E+"_add",C,C,d))}(),function(){const e=t.addFunction(n+"_prepDblStep");e.addParam("R","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("R"),o=r.i32_add(r.getLocal("R"),r.i32_const(2*s)),a=r.i32_add(r.getLocal("R"),r.i32_const(4*s)),l=r.getLocal("r"),u=r.i32_add(r.getLocal("r"),r.i32_const(2*s)),h=r.i32_add(r.getLocal("r"),r.i32_const(4*s)),d=r.i32_const(t.alloc(c)),p=r.i32_const(t.alloc(c)),f=r.i32_const(t.alloc(c)),g=r.i32_const(t.alloc(c)),A=r.i32_const(t.alloc(c));e.addCode(r.call(E+"_square",i,l),r.call(E+"_square",o,p),r.call(E+"_square",p,f),r.call(E+"_add",p,i,u),r.call(E+"_square",u,u),r.call(E+"_sub",u,l,u),r.call(E+"_sub",u,f,u),r.call(E+"_add",u,u,u),r.call(E+"_add",l,l,g),r.call(E+"_add",g,l,g),r.call(E+"_add",i,g,h),r.call(E+"_square",g,A),r.call(E+"_square",a,d),r.call(E+"_sub",A,u,i),r.call(E+"_sub",i,u,i),r.call(E+"_add",a,o,a),r.call(E+"_square",a,a),r.call(E+"_sub",a,p,a),r.call(E+"_sub",a,d,a),r.call(E+"_sub",u,i,o),r.call(E+"_mul",o,g,o),r.call(E+"_add",f,f,f),r.call(E+"_add",f,f,f),r.call(E+"_add",f,f,f),r.call(E+"_sub",o,f,o),r.call(E+"_mul",g,d,u),r.call(E+"_add",u,u,u),r.call(E+"_neg",u,u),r.call(E+"_square",h,h),r.call(E+"_sub",h,l,h),r.call(E+"_sub",h,A,h),r.call(E+"_add",p,p,p),r.call(E+"_add",p,p,p),r.call(E+"_sub",h,p,h),r.call(E+"_mul",a,d,l),r.call(E+"_add",l,l,l))}(),function(){const e=t.addFunction(n+"_prepareG1");e.addParam("pP","i32"),e.addParam("ppreP","i32");const r=e.getCodeBuilder();e.addCode(r.call(A+"_normalize",r.getLocal("pP"),r.getLocal("ppreP")))}(),function(){const e=t.addFunction(n+"_prepareG2");e.addParam("pQ","i32"),e.addParam("ppreQ","i32"),e.addLocal("pCoef","i32"),e.addLocal("i","i32");const r=e.getCodeBuilder(),i=r.getLocal("pQ"),o=t.alloc(3*c),s=r.i32_const(o),a=r.getLocal("ppreQ");e.addCode(r.call(w+"_normalize",i,a),r.if(r.call(w+"_isZero",a),r.ret([])),r.call(w+"_copy",a,s),r.setLocal("pCoef",r.i32_add(r.getLocal("ppreQ"),r.i32_const(3*c)))),e.addCode(r.setLocal("i",r.i32_const(R.length-2)),r.block(r.loop(r.call(n+"_prepDblStep",s,r.getLocal("pCoef")),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(k))),r.if(r.i32_load8_s(r.getLocal("i"),F),[...r.call(n+"_prepAddStep",s,a,r.getLocal("pCoef")),...r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(k)))]),r.br_if(1,r.i32_eqz(r.getLocal("i"))),r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.br(0))))}(),function(){const e=t.addFunction(n+"_millerLoop");e.addParam("ppreP","i32"),e.addParam("ppreQ","i32"),e.addParam("r","i32"),e.addLocal("pCoef","i32"),e.addLocal("i","i32");const r=e.getCodeBuilder(),i=r.getLocal("ppreP"),o=r.getLocal("pCoef"),s=r.getLocal("r");e.addCode(r.call(x+"_one",s),r.if(r.call(A+"_isZero",i),r.ret([])),r.if(r.call(A+"_isZero",r.getLocal("ppreQ")),r.ret([])),r.setLocal("pCoef",r.i32_add(r.getLocal("ppreQ"),r.i32_const(3*c))),r.setLocal("i",r.i32_const(R.length-2)),r.block(r.loop(r.call(n+"_ell",i,o,s),r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(k))),r.if(r.i32_load8_s(r.getLocal("i"),F),[...r.call(n+"_ell",i,o,s),...r.setLocal("pCoef",r.i32_add(r.getLocal("pCoef"),r.i32_const(k)))]),r.call(x+"_square",s,s),r.br_if(1,r.i32_eq(r.getLocal("i"),r.i32_const(1))),r.setLocal("i",r.i32_sub(r.getLocal("i"),r.i32_const(1))),r.br(0))),r.call(n+"_ell",i,o,s)),e.addCode(r.call(x+"_conjugate",s,s))}(),function(){const e=t.addFunction(n+"_finalExponentiationOld");e.addParam("x","i32"),e.addParam("r","i32");const r=t.alloc(wC.bigInt2BytesLE(322277361516934140462891564586510139908379969514828494218366688025288661041104682794998680497580008899973249814104447692778988208376779573819485263026159588510513834876303014016798809919343532899164848730280942609956670917565618115867287399623286813270357901731510188149934363360381614501334086825442271920079363289954510565375378443704372994881406797882676971082200626541916413184642520269678897559532260949334760604962086348898118982248842634379637598665468817769075878555493752214492790122785850202957575200176084204422751485957336465472324810982833638490904279282696134323072515220044451592646885410572234451732790590013479358343841220074174848221722017083597872017638514103174122784843925578370430843522959600095676285723737049438346544753168912974976791528535276317256904336520179281145394686565050419250614107803233314658825463117900250701199181529205942363159325765991819433914303908860460720581408201373164047773794825411011922305820065611121544561808414055302212057471395719432072209245600258134364584636810093520285711072578721435517884103526483832733289802426157301542744476740008494780363354305116978805620671467071400711358839553375340724899735460480144599782014906586543813292157922220645089192130209334926661588737007768565838519456601560804957985667880395221049249803753582637708560n,544)),i=e.getCodeBuilder();e.addCode(i.call(x+"_exp",i.getLocal("x"),i.i32_const(r),i.i32_const(544),i.getLocal("r")))}(),function(){!function(){const e=t.addFunction(n+"__cyclotomicSquare");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=r.i32_add(r.getLocal("x"),r.i32_const(c)),s=r.i32_add(r.getLocal("x"),r.i32_const(2*c)),a=r.i32_add(r.getLocal("x"),r.i32_const(3*c)),l=r.i32_add(r.getLocal("x"),r.i32_const(4*c)),u=r.i32_add(r.getLocal("x"),r.i32_const(5*c)),h=r.getLocal("r"),d=r.i32_add(r.getLocal("r"),r.i32_const(c)),p=r.i32_add(r.getLocal("r"),r.i32_const(2*c)),f=r.i32_add(r.getLocal("r"),r.i32_const(3*c)),g=r.i32_add(r.getLocal("r"),r.i32_const(4*c)),A=r.i32_add(r.getLocal("r"),r.i32_const(5*c)),m=r.i32_const(t.alloc(c)),w=r.i32_const(t.alloc(c)),y=r.i32_const(t.alloc(c)),B=r.i32_const(t.alloc(c)),I=r.i32_const(t.alloc(c)),C=r.i32_const(t.alloc(c)),T=r.i32_const(t.alloc(c)),b=r.i32_const(t.alloc(c));e.addCode(r.call(E+"_mul",i,l,T),r.call(E+"_mulNR",l,m),r.call(E+"_add",i,m,m),r.call(E+"_add",i,l,b),r.call(E+"_mul",b,m,m),r.call(E+"_mulNR",T,b),r.call(E+"_add",T,b,b),r.call(E+"_sub",m,b,m),r.call(E+"_add",T,T,w),r.call(E+"_mul",a,s,T),r.call(E+"_mulNR",s,y),r.call(E+"_add",a,y,y),r.call(E+"_add",a,s,b),r.call(E+"_mul",b,y,y),r.call(E+"_mulNR",T,b),r.call(E+"_add",T,b,b),r.call(E+"_sub",y,b,y),r.call(E+"_add",T,T,B),r.call(E+"_mul",o,u,T),r.call(E+"_mulNR",u,I),r.call(E+"_add",o,I,I),r.call(E+"_add",o,u,b),r.call(E+"_mul",b,I,I),r.call(E+"_mulNR",T,b),r.call(E+"_add",T,b,b),r.call(E+"_sub",I,b,I),r.call(E+"_add",T,T,C),r.call(E+"_sub",m,i,h),r.call(E+"_add",h,h,h),r.call(E+"_add",m,h,h),r.call(E+"_add",w,l,g),r.call(E+"_add",g,g,g),r.call(E+"_add",w,g,g),r.call(E+"_mul",C,r.i32_const(_),b),r.call(E+"_add",b,a,f),r.call(E+"_add",f,f,f),r.call(E+"_add",b,f,f),r.call(E+"_sub",I,s,p),r.call(E+"_add",p,p,p),r.call(E+"_add",I,p,p),r.call(E+"_sub",y,o,d),r.call(E+"_add",d,d,d),r.call(E+"_add",y,d,d),r.call(E+"_add",B,u,A),r.call(E+"_add",A,A,A),r.call(E+"_add",B,A,A))}(),j(G,true,"w0");const e=t.addFunction(n+"_finalExponentiation");e.addParam("x","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.getLocal("x"),o=r.getLocal("r"),s=r.i32_const(t.alloc(l)),a=r.i32_const(t.alloc(l)),u=r.i32_const(t.alloc(l)),h=r.i32_const(t.alloc(l)),d=r.i32_const(t.alloc(l)),p=r.i32_const(t.alloc(l)),f=r.i32_const(t.alloc(l));e.addCode(r.call(x+"_frobeniusMap6",i,s),r.call(x+"_inverse",i,a),r.call(x+"_mul",s,a,u),r.call(x+"_copy",u,a),r.call(x+"_frobeniusMap2",u,u),r.call(x+"_mul",u,a,u),r.call(n+"__cyclotomicSquare",u,a),r.call(x+"_conjugate",a,a),r.call(n+"__cyclotomicExp_w0",u,h),r.call(n+"__cyclotomicSquare",h,d),r.call(x+"_mul",a,h,p),r.call(n+"__cyclotomicExp_w0",p,a),r.call(n+"__cyclotomicExp_w0",a,s),r.call(n+"__cyclotomicExp_w0",s,f),r.call(x+"_mul",f,d,f),r.call(n+"__cyclotomicExp_w0",f,d),r.call(x+"_conjugate",p,p),r.call(x+"_mul",d,p,d),r.call(x+"_mul",d,u,d),r.call(x+"_conjugate",u,p),r.call(x+"_mul",a,u,a),r.call(x+"_frobeniusMap3",a,a),r.call(x+"_mul",f,p,f),r.call(x+"_frobeniusMap1",f,f),r.call(x+"_mul",h,s,h),r.call(x+"_frobeniusMap2",h,h),r.call(x+"_mul",h,a,h),r.call(x+"_mul",h,f,h),r.call(x+"_mul",h,d,o))}();for(let e=1;e<=5;e++)z(e),t.exportFunction(n+"_pairingEq"+e);!function(){const e=t.addFunction(n+"_pairing");e.addParam("p","i32"),e.addParam("q","i32"),e.addParam("r","i32");const r=e.getCodeBuilder(),i=r.i32_const(t.alloc(l));e.addCode(r.call(n+"_prepareG1",r.getLocal("p"),r.i32_const(H))),e.addCode(r.call(n+"_prepareG2",r.getLocal("q"),r.i32_const(Y))),e.addCode(r.call(n+"_millerLoop",r.i32_const(H),r.i32_const(Y),i)),e.addCode(r.call(n+"_finalExponentiation",i,r.getLocal("r")))}(),t.exportFunction(n+"_pairing"),t.exportFunction(n+"_prepareG1"),t.exportFunction(n+"_prepareG2"),t.exportFunction(n+"_millerLoop"),t.exportFunction(n+"_finalExponentiation"),t.exportFunction(n+"_finalExponentiationOld"),t.exportFunction(n+"__cyclotomicSquare"),t.exportFunction(n+"__cyclotomicExp_w0"),t.exportFunction(L+"_mul1"),t.exportFunction(L+"_mul01"),t.exportFunction(x+"_mul014"),t.exportFunction(A+"_inGroupAffine"),t.exportFunction(A+"_inGroup"),t.exportFunction(w+"_inGroupAffine"),t.exportFunction(w+"_inGroup")};function RC(t,e){let n=t;void 0===e&&0==(e=Math.floor((fB(t)-1)/8)+1)&&(e=1);const r=new Uint8Array(e),i=new DataView(r.buffer);let o=0;for(;o<e;)o+4<=e?(i.setUint32(o,Number(n&BigInt(4294967295)),!0),o+=4,n>>=BigInt(32)):o+2<=e?(i.setUint16(o,Number(n&BigInt(65535)),!0),o+=2,n>>=BigInt(16)):(i.setUint8(o,Number(n&BigInt(255)),!0),o+=1,n>>=BigInt(8));if(n)throw new Error("Number does not fit in this length");return r}const FC=[];for(let t=0;t<256;t++)FC[t]=kC(t,8);function kC(t,e){let n=0,r=t;for(let t=0;t<e;t++)n<<=1,n|=1&r,r>>=1;return n}function OC(t,e){return(FC[t>>>24]|FC[t>>>16&255]<<8|FC[t>>>8&255]<<16|FC[255&t]<<24)>>>32-e}function QC(t){return(4294901760&t?(t&=4294901760,16):0)|(4278255360&t?(t&=4278255360,8):0)|(4042322160&t?(t&=4042322160,4):0)|(3435973836&t?(t&=3435973836,2):0)|!!(2863311530&t)}function UC(t,e){const n=t.byteLength/e,r=QC(n);if(n!=1<<r)throw new Error("Invalid number of pointers");for(let i=0;i<n;i++){const n=OC(i,r);if(i>n){const r=t.slice(i*e,(i+1)*e);t.set(t.slice(n*e,(n+1)*e),i*e),t.set(r,n*e)}}}function PC(t,e){const n=new Uint8Array(e*t.length);for(let r=0;r<t.length;r++)n.set(t[r],r*e);return n}function GC(t,e){const n=t.byteLength/e,r=new Array(n);for(let i=0;i<n;i++)r[i]=t.slice(i*e,i*e+e);return r}var VC=Object.freeze({__proto__:null,array2buffer:PC,beBuff2int:function(t){let e=BigInt(0),n=t.length,r=0;const i=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n>0;)n>=4?(n-=4,e+=BigInt(i.getUint32(n))<<BigInt(8*r),r+=4):n>=2?(n-=2,e+=BigInt(i.getUint16(n))<<BigInt(8*r),r+=2):(n-=1,e+=BigInt(i.getUint8(n))<<BigInt(8*r),r+=1);return e},beInt2Buff:function(t,e){let n=t;const r=new Uint8Array(e),i=new DataView(r.buffer);let o=e;for(;o>0;)o-4>=0?(o-=4,i.setUint32(o,Number(n&BigInt(4294967295))),n>>=BigInt(32)):o-2>=0?(o-=2,i.setUint16(o,Number(n&BigInt(65535))),n>>=BigInt(16)):(o-=1,i.setUint8(o,Number(n&BigInt(255))),n>>=BigInt(8));if(n)throw new Error("Number does not fit in this length");return r},bitReverse:OC,buffReverseBits:UC,buffer2array:GC,leBuff2int:function(t){let e=BigInt(0),n=0;const r=new DataView(t.buffer,t.byteOffset,t.byteLength);for(;n<t.length;)n+4<=t.length?(e+=BigInt(r.getUint32(n,!0))<<BigInt(8*n),n+=4):n+2<=t.length?(e+=BigInt(r.getUint16(n,!0))<<BigInt(8*n),n+=2):(e+=BigInt(r.getUint8(n,!0))<<BigInt(8*n),n+=1);return e},leInt2Buff:RC,log2:QC,stringifyBigInts:function t(e){if("bigint"==typeof e||void 0!==e.eq)return e.toString(10);if(e instanceof Uint8Array)return QB(e,0);if(Array.isArray(e))return e.map(t);if("object"==typeof e){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}return e},stringifyFElements:function t(e,n){if("bigint"==typeof n||void 0!==n.eq)return n.toString(10);if(n instanceof Uint8Array)return e.toString(e.e(n));if(Array.isArray(n))return n.map(t.bind(this,e));if("object"==typeof n){const r={};return Object.keys(n).forEach(i=>{r[i]=t(e,n[i])}),r}return n},unstringifyBigInts:function t(e){if("string"==typeof e&&/^[0-9]+$/.test(e))return BigInt(e);if("string"==typeof e&&/^0x[0-9a-fA-F]+$/.test(e))return BigInt(e);if(Array.isArray(e))return e.map(t);if("object"==typeof e){if(null===e)return null;const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}return e},unstringifyFElements:function t(e,n){if("string"==typeof n&&/^[0-9]+$/.test(n))return e.e(n);if("string"==typeof n&&/^0x[0-9a-fA-F]+$/.test(n))return e.e(n);if(Array.isArray(n))return n.map(t.bind(this,e));if("object"==typeof n){if(null===n)return null;const r={};return Object.keys(n).forEach(i=>{r[i]=t(e,n[i])}),r}return n}});const jC=1<<30;class HC{constructor(t){this.buffers=[],this.byteLength=t;for(let e=0;e<t;e+=jC){const n=Math.min(t-e,jC);this.buffers.push(new Uint8Array(n))}}slice(t,e){void 0===e&&(e=this.byteLength),void 0===t&&(t=0);const n=e-t,r=Math.floor(t/jC);if(r==Math.floor((t+n-1)/jC)||0==n)return this.buffers[r].slice(t%jC,t%jC+n);let i,o=r,s=t%jC,a=n;for(;a>0;){const t=s+a>jC?jC-s:a,e=new Uint8Array(this.buffers[o].buffer,this.buffers[o].byteOffset+s,t);if(t==n)return e.slice();i||(i=n<=jC?new Uint8Array(n):new HC(n)),i.set(e,n-a),a-=t,o++,s=0}return i}set(t,e){void 0===e&&(e=0);const n=t.byteLength;if(0==n)return;const r=Math.floor(e/jC);if(r==Math.floor((e+n-1)/jC))return t instanceof HC&&1==t.buffers.length?this.buffers[r].set(t.buffers[0],e%jC):this.buffers[r].set(t,e%jC);let i=r,o=e%jC,s=n;for(;s>0;){const e=o+s>jC?jC-o:s,r=t.slice(n-s,n-s+e);new Uint8Array(this.buffers[i].buffer,this.buffers[i].byteOffset+o,e).set(r),s-=e,i++,o=0}}}function YC(t,e,n,r){return async function(i){const o=Math.floor(i.byteLength/n);if(o*n!==i.byteLength)throw new Error("Invalid buffer size");const s=Math.floor(o/t.concurrency),a=[];for(let c=0;c<t.concurrency;c++){let l;if(l=c<t.concurrency-1?s:o-c*s,0==l)continue;const u=[{cmd:"ALLOCSET",var:0,buff:i.slice(c*s*n,c*s*n+l*n)},{cmd:"ALLOC",var:1,len:r*l},{cmd:"CALL",fnName:e,params:[{var:0},{val:l},{var:1}]},{cmd:"GET",out:0,var:1,len:r*l}];a.push(t.queueAction(u))}const c=await Promise.all(a);let l;l=i instanceof HC?new HC(o*r):new Uint8Array(o*r);let u=0;for(let t=0;t<c.length;t++)l.set(c[t][0],u),u+=c[t][0].byteLength;return l}}class zC{constructor(t,e,n,r){if(this.tm=t,this.prefix=e,this.p=r,this.n8=n,this.type="F1",this.m=1,this.half=mB(r,jB),this.bitLength=fB(r),this.mask=DB(EB(jB,this.bitLength),jB),this.pOp1=t.alloc(n),this.pOp2=t.alloc(n),this.pOp3=t.alloc(n),this.tm.instance.exports[e+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+"_one"](this.pOp1),this.one=this.tm.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.n64=Math.floor(n/8),this.n32=Math.floor(n/4),8*this.n64!=this.n8)throw new Error("n8 must be a multiple of 8");this.half=mB(this.p,jB),this.nqr=this.two;let i=this.exp(this.nqr,this.half);for(;!this.eq(i,this.negone);)this.nqr=this.add(this.nqr,this.one),i=this.exp(this.nqr,this.half);this.shift=this.mul(this.nqr,this.nqr),this.shiftInv=this.inv(this.shift),this.s=0;let o=DB(this.p,jB);for(;!BB(o);)this.s=this.s+1,o=mB(o,jB);this.w=[],this.w[this.s]=this.exp(this.nqr,o);for(let t=this.s-1;t>=0;t--)this.w[t]=this.square(this.w[t+1]);if(!this.eq(this.w[0],this.one))throw new Error("Error calculating roots of unity");this.batchToMontgomery=YC(t,e+"_batchToMontgomery",this.n8,this.n8),this.batchFromMontgomery=YC(t,e+"_batchFromMontgomery",this.n8,this.n8)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){return this.op2("_add",t,e)}eq(t,e){return this.op2Bool("_eq",t,e)}isZero(t){return this.op1Bool("_isZero",t)}sub(t,e){return this.op2("_sub",t,e)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,e){return this.op2("_mul",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,e){return e instanceof Uint8Array||(e=GB(pB(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}isNegative(t){return this.op1Bool("_isNegative",t)}e(t,e){if(t instanceof Uint8Array)return t;let n=pB(t,e);gB(n)?(n=vB(n),xB(n,this.p)&&(n=_B(n,this.p)),n=DB(this.p,n)):xB(n,this.p)&&(n=_B(n,this.p));const r=RC(n,this.n8);return this.toMontgomery(r)}toString(t,e){return PB(QB(this.fromMontgomery(t),0),e)}fromRng(t){let e;const n=new Uint8Array(this.n8);do{e=VB;for(let n=0;n<this.n64;n++)e=bB(e,EB(t.nextU64(),64*n));e=FB(e,this.mask)}while(RB(e,this.p));return kB(n,0,e,this.n8),n}random(){return this.fromRng(tI())}toObject(t){return QB(this.fromMontgomery(t),0)}fromObject(t){const e=new Uint8Array(this.n8);return kB(e,0,t,this.n8),this.toMontgomery(e)}toRprLE(t,e,n){t.set(this.fromMontgomery(n),e)}toRprBE(t,e,n){const r=this.fromMontgomery(n);for(let t=0;t<this.n8/2;t++){const e=r[t];r[t]=r[this.n8-1-t],r[this.n8-1-t]=e}t.set(r,e)}fromRprLE(t,e){e=e||0;const n=t.slice(e,e+this.n8);return this.toMontgomery(n)}async batchInverse(t){let e=!1;const n=this.n8,r=this.n8;Array.isArray(t)?(t=PC(t,n),e=!0):t=t.slice(0,t.byteLength);const i=Math.floor(t.byteLength/n);if(i*n!==t.byteLength)throw new Error("Invalid buffer size");const o=Math.floor(i/this.tm.concurrency),s=[];for(let e=0;e<this.tm.concurrency;e++){let a;if(a=e<this.tm.concurrency-1?o:i-e*o,0==a)continue;const c=[{cmd:"ALLOCSET",var:0,buff:t.slice(e*o*n,e*o*n+a*n)},{cmd:"ALLOC",var:1,len:r*a},{cmd:"CALL",fnName:this.prefix+"_batchInverse",params:[{var:0},{val:n},{val:a},{var:1},{val:r}]},{cmd:"GET",out:0,var:1,len:r*a}];s.push(this.tm.queueAction(c))}const a=await Promise.all(s);let c;c=t instanceof HC?new HC(i*r):new Uint8Array(i*r);let l=0;for(let t=0;t<a.length;t++)c.set(a[t][0],l),l+=a[t][0].byteLength;return e?GC(c,r):c}}class JC{constructor(t,e,n){this.tm=t,this.prefix=e,this.F=n,this.type="F2",this.m=2*n.m,this.n8=2*this.F.n8,this.n32=2*this.F.n32,this.n64=2*this.F.n64,this.pOp1=t.alloc(2*n.n8),this.pOp2=t.alloc(2*n.n8),this.pOp3=t.alloc(2*n.n8),this.tm.instance.exports[e+"_zero"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+"_one"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){return this.op2("_add",t,e)}eq(t,e){return this.op2Bool("_eq",t,e)}isZero(t){return this.op1Bool("_isZero",t)}sub(t,e){return this.op2("_sub",t,e)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}isNegative(t){return this.op1Bool("_isNegative",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,e){return this.op2("_mul",t,e)}mul1(t,e){return this.op2("_mul1",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,e){return e instanceof Uint8Array||(e=GB(pB(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}e(t,e){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&2==t.length){const n=this.F.e(t[0],e),r=this.F.e(t[1],e),i=new Uint8Array(2*this.F.n8);return i.set(n),i.set(r,2*this.F.n8),i}throw new Error("invalid F2")}toString(t,e){return`[${this.F.toString(t.slice(0,this.F.n8),e)}, ${this.F.toString(t.slice(this.F.n8),e)}]`}fromRng(t){const e=this.F.fromRng(t),n=this.F.fromRng(t),r=new Uint8Array(2*this.F.n8);return r.set(e),r.set(n,this.F.n8),r}random(){return this.fromRng(tI())}toObject(t){return[this.F.toObject(t.slice(0,this.F.n8)),this.F.toObject(t.slice(this.F.n8,2*this.F.n8))]}fromObject(t){const e=new Uint8Array(2*this.F.n8),n=this.F.fromObject(t[0]),r=this.F.fromObject(t[1]);return e.set(n),e.set(r,this.F.n8),e}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8)}}class WC{constructor(t,e,n){this.tm=t,this.prefix=e,this.F=n,this.type="F3",this.m=3*n.m,this.n8=3*this.F.n8,this.n32=3*this.F.n32,this.n64=3*this.F.n64,this.pOp1=t.alloc(3*n.n8),this.pOp2=t.alloc(3*n.n8),this.pOp3=t.alloc(3*n.n8),this.tm.instance.exports[e+"_zero"](this.pOp1),this.zero=t.getBuff(this.pOp1,this.n8),this.tm.instance.exports[e+"_one"](this.pOp1),this.one=t.getBuff(this.pOp1,this.n8),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op2Bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}eq(t,e){return this.op2Bool("_eq",t,e)}isZero(t){return this.op1Bool("_isZero",t)}add(t,e){return this.op2("_add",t,e)}sub(t,e){return this.op2("_sub",t,e)}neg(t){return this.op1("_neg",t)}inv(t){return this.op1("_inverse",t)}isNegative(t){return this.op1Bool("_isNegative",t)}toMontgomery(t){return this.op1("_toMontgomery",t)}fromMontgomery(t){return this.op1("_fromMontgomery",t)}mul(t,e){return this.op2("_mul",t,e)}div(t,e){return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_inverse"](this.pOp2,this.pOp2),this.tm.instance.exports[this.prefix+"_mul"](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,this.n8)}square(t){return this.op1("_square",t)}isSquare(t){return this.op1Bool("_isSquare",t)}sqrt(t){return this.op1("_sqrt",t)}exp(t,e){return e instanceof Uint8Array||(e=GB(pB(e))),this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[this.prefix+"_exp"](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.getBuff(this.pOp3,this.n8)}e(t,e){if(t instanceof Uint8Array)return t;if(Array.isArray(t)&&3==t.length){const n=this.F.e(t[0],e),r=this.F.e(t[1],e),i=this.F.e(t[2],e),o=new Uint8Array(3*this.F.n8);return o.set(n),o.set(r,this.F.n8),o.set(i,2*this.F.n8),o}throw new Error("invalid F3")}toString(t,e){return`[${this.F.toString(t.slice(0,this.F.n8),e)}, ${this.F.toString(t.slice(this.F.n8,2*this.F.n8),e)}, ${this.F.toString(t.slice(2*this.F.n8),e)}]`}fromRng(t){const e=this.F.fromRng(t),n=this.F.fromRng(t),r=this.F.fromRng(t),i=new Uint8Array(3*this.F.n8);return i.set(e),i.set(n,this.F.n8),i.set(r,2*this.F.n8),i}random(){return this.fromRng(tI())}toObject(t){return[this.F.toObject(t.slice(0,this.F.n8)),this.F.toObject(t.slice(this.F.n8,2*this.F.n8)),this.F.toObject(t.slice(2*this.F.n8,3*this.F.n8))]}fromObject(t){const e=new Uint8Array(3*this.F.n8),n=this.F.fromObject(t[0]),r=this.F.fromObject(t[1]),i=this.F.fromObject(t[2]);return e.set(n),e.set(r,this.F.n8),e.set(i,2*this.F.n8),e}c1(t){return t.slice(0,this.F.n8)}c2(t){return t.slice(this.F.n8,2*this.F.n8)}c3(t){return t.slice(2*this.F.n8)}}class qC{constructor(t,e,n,r,i,o){this.tm=t,this.prefix=e,this.F=n,this.pOp1=t.alloc(3*n.n8),this.pOp2=t.alloc(3*n.n8),this.pOp3=t.alloc(3*n.n8),this.tm.instance.exports[e+"_zero"](this.pOp1),this.zero=this.tm.getBuff(this.pOp1,3*n.n8),this.tm.instance.exports[e+"_zeroAffine"](this.pOp1),this.zeroAffine=this.tm.getBuff(this.pOp1,2*n.n8),this.one=this.tm.getBuff(r,3*n.n8),this.g=this.one,this.oneAffine=this.tm.getBuff(r,2*n.n8),this.gAffine=this.oneAffine,this.b=this.tm.getBuff(i,n.n8),o&&(this.cofactor=GB(o)),this.negone=this.neg(this.one),this.two=this.add(this.one,this.one),this.batchLEMtoC=YC(t,e+"_batchLEMtoC",2*n.n8,n.n8),this.batchLEMtoU=YC(t,e+"_batchLEMtoU",2*n.n8,2*n.n8),this.batchCtoLEM=YC(t,e+"_batchCtoLEM",n.n8,2*n.n8),this.batchUtoLEM=YC(t,e+"_batchUtoLEM",2*n.n8,2*n.n8),this.batchToJacobian=YC(t,e+"_batchToJacobian",2*n.n8,3*n.n8),this.batchToAffine=YC(t,e+"_batchToAffine",3*n.n8,2*n.n8)}op2(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,3*this.F.n8)}op2bool(t,e,n){return this.tm.setBuff(this.pOp1,e),this.tm.setBuff(this.pOp2,n),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp2,this.pOp3)}op1(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,3*this.F.n8)}op1Affine(t,e){return this.tm.setBuff(this.pOp1,e),this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3),this.tm.getBuff(this.pOp3,2*this.F.n8)}op1Bool(t,e){return this.tm.setBuff(this.pOp1,e),!!this.tm.instance.exports[this.prefix+t](this.pOp1,this.pOp3)}add(t,e){if(t.byteLength==3*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2("_add",t,e);if(e.byteLength==2*this.F.n8)return this.op2("_addMixed",t,e);throw new Error("invalid point size")}if(t.byteLength==2*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2("_addMixed",e,t);if(e.byteLength==2*this.F.n8)return this.op2("_addAffine",t,e);throw new Error("invalid point size")}throw new Error("invalid point size")}sub(t,e){if(t.byteLength==3*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2("_sub",t,e);if(e.byteLength==2*this.F.n8)return this.op2("_subMixed",t,e);throw new Error("invalid point size")}if(t.byteLength==2*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2("_subMixed",e,t);if(e.byteLength==2*this.F.n8)return this.op2("_subAffine",t,e);throw new Error("invalid point size")}throw new Error("invalid point size")}neg(t){if(t.byteLength==3*this.F.n8)return this.op1("_neg",t);if(t.byteLength==2*this.F.n8)return this.op1Affine("_negAffine",t);throw new Error("invalid point size")}double(t){if(t.byteLength==3*this.F.n8)return this.op1("_double",t);if(t.byteLength==2*this.F.n8)return this.op1("_doubleAffine",t);throw new Error("invalid point size")}isZero(t){if(t.byteLength==3*this.F.n8)return this.op1Bool("_isZero",t);if(t.byteLength==2*this.F.n8)return this.op1Bool("_isZeroAffine",t);throw new Error("invalid point size")}timesScalar(t,e){let n;if(e instanceof Uint8Array||(e=GB(pB(e))),t.byteLength==3*this.F.n8)n=this.prefix+"_timesScalar";else{if(t.byteLength!=2*this.F.n8)throw new Error("invalid point size");n=this.prefix+"_timesScalarAffine"}return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[n](this.pOp1,this.pOp2,e.byteLength,this.pOp3),this.tm.getBuff(this.pOp3,3*this.F.n8)}timesFr(t,e){let n;if(t.byteLength==3*this.F.n8)n=this.prefix+"_timesFr";else{if(t.byteLength!=2*this.F.n8)throw new Error("invalid point size");n=this.prefix+"_timesFrAffine"}return this.tm.setBuff(this.pOp1,t),this.tm.setBuff(this.pOp2,e),this.tm.instance.exports[n](this.pOp1,this.pOp2,this.pOp3),this.tm.getBuff(this.pOp3,3*this.F.n8)}eq(t,e){if(t.byteLength==3*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2bool("_eq",t,e);if(e.byteLength==2*this.F.n8)return this.op2bool("_eqMixed",t,e);throw new Error("invalid point size")}if(t.byteLength==2*this.F.n8){if(e.byteLength==3*this.F.n8)return this.op2bool("_eqMixed",e,t);if(e.byteLength==2*this.F.n8)return this.op2bool("_eqAffine",t,e);throw new Error("invalid point size")}throw new Error("invalid point size")}toAffine(t){if(t.byteLength==3*this.F.n8)return this.op1Affine("_toAffine",t);if(t.byteLength==2*this.F.n8)return t;throw new Error("invalid point size")}toJacobian(t){if(t.byteLength==3*this.F.n8)return t;if(t.byteLength==2*this.F.n8)return this.op1("_toJacobian",t);throw new Error("invalid point size")}toRprUncompressed(t,e,n){if(this.tm.setBuff(this.pOp1,n),n.byteLength==3*this.F.n8)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(n.byteLength!=2*this.F.n8)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoU"](this.pOp1,this.pOp1);const r=this.tm.getBuff(this.pOp1,2*this.F.n8);t.set(r,e)}fromRprUncompressed(t,e){const n=t.slice(e,e+2*this.F.n8);return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+"_UtoLEM"](this.pOp1,this.pOp1),this.tm.getBuff(this.pOp1,2*this.F.n8)}toRprCompressed(t,e,n){if(this.tm.setBuff(this.pOp1,n),n.byteLength==3*this.F.n8)this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);else if(n.byteLength!=2*this.F.n8)throw new Error("invalid point size");this.tm.instance.exports[this.prefix+"_LEMtoC"](this.pOp1,this.pOp1);const r=this.tm.getBuff(this.pOp1,this.F.n8);t.set(r,e)}fromRprCompressed(t,e){const n=t.slice(e,e+this.F.n8);return this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+"_CtoLEM"](this.pOp1,this.pOp2),this.tm.getBuff(this.pOp2,2*this.F.n8)}toUncompressed(t){const e=new Uint8Array(2*this.F.n8);return this.toRprUncompressed(e,0,t),e}toRprLEM(t,e,n){if(n.byteLength!=2*this.F.n8){if(n.byteLength!=3*this.F.n8)throw new Error("invalid point size");{this.tm.setBuff(this.pOp1,n),this.tm.instance.exports[this.prefix+"_toAffine"](this.pOp1,this.pOp1);const r=this.tm.getBuff(this.pOp1,2*this.F.n8);t.set(r,e)}}else t.set(n,e)}fromRprLEM(t,e){return e=e||0,t.slice(e,e+2*this.F.n8)}toString(t,e){if(t.byteLength==3*this.F.n8){return`[ ${this.F.toString(t.slice(0,this.F.n8),e)}, ${this.F.toString(t.slice(this.F.n8,2*this.F.n8),e)}, ${this.F.toString(t.slice(2*this.F.n8),e)} ]`}if(t.byteLength==2*this.F.n8){return`[ ${this.F.toString(t.slice(0,this.F.n8),e)}, ${this.F.toString(t.slice(this.F.n8),e)} ]`}throw new Error("invalid point size")}isValid(t){if(this.isZero(t))return!0;const e=this.F,n=this.toAffine(t),r=n.slice(0,this.F.n8),i=n.slice(this.F.n8,2*this.F.n8),o=e.add(e.mul(e.square(r),r),this.b),s=e.square(i);return e.eq(o,s)}fromRng(t){const e=this.F;let n,r,i=[];do{i[0]=e.fromRng(t),n=t.nextBool(),r=e.add(e.mul(e.square(i[0]),i[0]),this.b)}while(!e.isSquare(r));i[1]=e.sqrt(r);n^e.isNegative(i[1])&&(i[1]=e.neg(i[1]));let o=new Uint8Array(2*this.F.n8);return o.set(i[0]),o.set(i[1],this.F.n8),this.cofactor&&(o=this.timesScalar(o,this.cofactor)),o}toObject(t){if(this.isZero(t))return[this.F.toObject(this.F.zero),this.F.toObject(this.F.one),this.F.toObject(this.F.zero)];const e=this.F.toObject(t.slice(0,this.F.n8)),n=this.F.toObject(t.slice(this.F.n8,2*this.F.n8));let r;return r=t.byteLength==3*this.F.n8?this.F.toObject(t.slice(2*this.F.n8,3*this.F.n8)):this.F.toObject(this.F.one),[e,n,r]}fromObject(t){const e=this.F.fromObject(t[0]),n=this.F.fromObject(t[1]);let r;if(r=3==t.length?this.F.fromObject(t[2]):this.F.one,this.F.isZero(r,this.F.one))return this.zeroAffine;if(this.F.eq(r,this.F.one)){const t=new Uint8Array(2*this.F.n8);return t.set(e),t.set(n,this.F.n8),t}{const t=new Uint8Array(3*this.F.n8);return t.set(e),t.set(n,this.F.n8),t.set(r,2*this.F.n8),t}}e(t){return t instanceof Uint8Array?t:this.fromObject(t)}x(t){return this.toAffine(t).slice(0,this.F.n8)}y(t){return this.toAffine(t).slice(this.F.n8)}}class KC{constructor(){this.promise=new Promise((t,e)=>{this.reject=e,this.resolve=t})}}let ZC;const XC='(function thread(self) {\n const MAXMEM = 32767;\n let instance;\n let memory;\n\n if (self) {\n self.onmessage = function(e) {\n let data;\n if (e.data) {\n data = e.data;\n } else {\n data = e;\n }\n\n if (data[0].cmd == "INIT") {\n init(data[0]).then(function() {\n self.postMessage(data.result);\n });\n } else if (data[0].cmd == "TERMINATE") {\n self.close();\n } else {\n const res = runTask(data);\n self.postMessage(res);\n }\n };\n }\n\n async function init(data) {\n const code = new Uint8Array(data.code);\n const wasmModule = await WebAssembly.compile(code);\n memory = new WebAssembly.Memory({initial:data.init, maximum: MAXMEM});\n\n instance = await WebAssembly.instantiate(wasmModule, {\n env: {\n "memory": memory\n }\n });\n }\n\n\n\n function alloc(length) {\n const u32 = new Uint32Array(memory.buffer, 0, 1);\n while (u32[0] & 3) u32[0]++; // Return always aligned pointers\n const res = u32[0];\n u32[0] += length;\n if (u32[0] + length > memory.buffer.byteLength) {\n const currentPages = memory.buffer.byteLength / 0x10000;\n let requiredPages = Math.floor((u32[0] + length) / 0x10000)+1;\n if (requiredPages>MAXMEM) requiredPages=MAXMEM;\n memory.grow(requiredPages-currentPages);\n }\n return res;\n }\n\n function allocBuffer(buffer) {\n const p = alloc(buffer.byteLength);\n setBuffer(p, buffer);\n return p;\n }\n\n function getBuffer(pointer, length) {\n const u8 = new Uint8Array(memory.buffer);\n return new Uint8Array(u8.buffer, u8.byteOffset + pointer, length);\n }\n\n function setBuffer(pointer, buffer) {\n const u8 = new Uint8Array(memory.buffer);\n u8.set(new Uint8Array(buffer), pointer);\n }\n\n function runTask(task) {\n if (task[0].cmd == "INIT") {\n return init(task[0]);\n }\n const ctx = {\n vars: [],\n out: []\n };\n const u32a = new Uint32Array(memory.buffer, 0, 1);\n const oldAlloc = u32a[0];\n for (let i=0; i<task.length; i++) {\n switch (task[i].cmd) {\n case "ALLOCSET":\n ctx.vars[task[i].var] = allocBuffer(task[i].buff);\n break;\n case "ALLOC":\n ctx.vars[task[i].var] = alloc(task[i].len);\n break;\n case "SET":\n setBuffer(ctx.vars[task[i].var], task[i].buff);\n break;\n case "CALL": {\n const params = [];\n for (let j=0; j<task[i].params.length; j++) {\n const p = task[i].params[j];\n if (typeof p.var !== "undefined") {\n params.push(ctx.vars[p.var] + (p.offset || 0));\n } else if (typeof p.val != "undefined") {\n params.push(p.val);\n }\n }\n instance.exports[task[i].fnName](...params);\n break;\n }\n case "GET":\n ctx.out[task[i].out] = getBuffer(ctx.vars[task[i].var], task[i].len).slice();\n break;\n default:\n throw new Error("Invalid cmd");\n }\n }\n const u32b = new Uint32Array(memory.buffer, 0, 1);\n u32b[0] = oldAlloc;\n return ctx.out;\n }\n\n\n return runTask;\n})(self)';if(globalThis?.Blob){const t=(new TextEncoder).encode(XC),e=new Blob([t],{type:"application/javascript"});ZC=URL.createObjectURL(e)}else ZC="data:application/javascript;base64,"+globalThis.btoa(XC);async function $C(t,e){const n=new tT;n.memory=new WebAssembly.Memory({initial:25}),n.u8=new Uint8Array(n.memory.buffer),n.u32=new Uint32Array(n.memory.buffer);const r=await WebAssembly.compile(t.code);if(n.instance=await WebAssembly.instantiate(r,{env:{memory:n.memory}}),globalThis?.Worker||(e=!0),n.singleThread=e,n.initalPFree=n.u32[0],n.pq=t.pq,n.pr=t.pr,n.pG1gen=t.pG1gen,n.pG1zero=t.pG1zero,n.pG2gen=t.pG2gen,n.pG2zero=t.pG2zero,n.pOneT=t.pOneT,e)n.code=t.code,n.taskManager=function(t){const e=32767;let n,r;async function i(t){const i=new Uint8Array(t.code),o=await WebAssembly.compile(i);r=new WebAssembly.Memory({initial:t.init,maximum:e}),n=await WebAssembly.instantiate(o,{env:{memory:r}})}function o(t){const n=new Uint32Array(r.buffer,0,1);for(;3&n[0];)n[0]++;const i=n[0];if(n[0]+=t,n[0]+t>r.buffer.byteLength){const i=r.buffer.byteLength/65536;let o=Math.floor((n[0]+t)/65536)+1;o>e&&(o=e),r.grow(o-i)}return i}function s(t){const e=o(t.byteLength);return c(e,t),e}function a(t,e){const n=new Uint8Array(r.buffer);return new Uint8Array(n.buffer,n.byteOffset+t,e)}function c(t,e){new Uint8Array(r.buffer).set(new Uint8Array(e),t)}function l(t){if("INIT"==t[0].cmd)return i(t[0]);const e={vars:[],out:[]},l=new Uint32Array(r.buffer,0,1)[0];for(let r=0;r<t.length;r++)switch(t[r].cmd){case"ALLOCSET":e.vars[t[r].var]=s(t[r].buff);break;case"ALLOC":e.vars[t[r].var]=o(t[r].len);break;case"SET":c(e.vars[t[r].var],t[r].buff);break;case"CALL":{const i=[];for(let n=0;n<t[r].params.length;n++){const o=t[r].params[n];void 0!==o.var?i.push(e.vars[o.var]+(o.offset||0)):void 0!==o.val&&i.push(o.val)}n.exports[t[r].fnName](...i);break}case"GET":e.out[t[r].out]=a(e.vars[t[r].var],t[r].len).slice();break;default:throw new Error("Invalid cmd")}return new Uint32Array(r.buffer,0,1)[0]=l,e.out}return t&&(t.onmessage=function(e){let n;if(n=e.data?e.data:e,"INIT"==n[0].cmd)i(n[0]).then(function(){t.postMessage(n.result)});else if("TERMINATE"==n[0].cmd)t.close();else{const e=l(n);t.postMessage(e)}}),l}(),await n.taskManager([{cmd:"INIT",init:25,code:n.code.slice()}]),n.concurrency=1;else{n.workers=[],n.pendingDeferreds=[],n.working=[];let e=2;"object"==typeof navigator&&navigator.hardwareConcurrency&&(e=navigator.hardwareConcurrency),0==e&&(e=2),e>64&&(e=64),n.concurrency=e;for(let t=0;t<e;t++)n.workers[t]=new Worker(ZC),n.workers[t].addEventListener("message",i(t)),n.working[t]=!1;const r=[];for(let e=0;e<n.workers.length;e++){const i=t.code.slice();r.push(n.postAction(e,[{cmd:"INIT",init:25,code:i}],[i.buffer]))}await Promise.all(r)}return n;function i(t){return function(e){let r;r=e&&e.data?e.data:e,n.working[t]=!1,n.pendingDeferreds[t].resolve(r),n.processWorks()}}}class tT{constructor(){this.actionQueue=[],this.oldPFree=0}startSyncOp(){if(0!=this.oldPFree)throw new Error("Sync operation in progress");this.oldPFree=this.u32[0]}endSyncOp(){if(0==this.oldPFree)throw new Error("No sync operation in progress");this.u32[0]=this.oldPFree,this.oldPFree=0}postAction(t,e,n,r){if(this.working[t])throw new Error("Posting a job t a working worker");return this.working[t]=!0,this.pendingDeferreds[t]=r||new KC,this.workers[t].postMessage(e,n),this.pendingDeferreds[t].promise}processWorks(){for(let t=0;t<this.workers.length&&this.actionQueue.length>0;t++)if(0==this.working[t]){const e=this.actionQueue.shift();this.postAction(t,e.data,e.transfers,e.deferred)}}queueAction(t,e){const n=new KC;if(this.singleThread){const e=this.taskManager(t);n.resolve(e)}else this.actionQueue.push({data:t,transfers:e,deferred:n}),this.processWorks();return n.promise}resetMemory(){this.u32[0]=this.initalPFree}allocBuff(t){const e=this.alloc(t.byteLength);return this.setBuff(e,t),e}getBuff(t,e){return this.u8.slice(t,t+e)}setBuff(t,e){this.u8.set(new Uint8Array(e),t)}alloc(t){for(;3&this.u32[0];)this.u32[0]++;const e=this.u32[0];return this.u32[0]+=t,e}async terminate(){for(let t=0;t<this.workers.length;t++)this.workers[t].postMessage([{cmd:"TERMINATE"}]);var t;await(t=200,new Promise(e=>setTimeout(e,t)))}}function eT(t,e){const n=t[e],r=t.Fr,i=t.tm;t[e].batchApplyKey=async function(t,o,s,a,c){let l,u,h,d,p;if(a=a||"affine",c=c||"affine","G1"==e)"jacobian"==a?(h=3*n.F.n8,l="g1m_batchApplyKey"):(h=2*n.F.n8,l="g1m_batchApplyKeyMixed"),d=3*n.F.n8,"jacobian"==c?p=3*n.F.n8:(u="g1m_batchToAffine",p=2*n.F.n8);else if("G2"==e)"jacobian"==a?(h=3*n.F.n8,l="g2m_batchApplyKey"):(h=2*n.F.n8,l="g2m_batchApplyKeyMixed"),d=3*n.F.n8,"jacobian"==c?p=3*n.F.n8:(u="g2m_batchToAffine",p=2*n.F.n8);else{if("Fr"!=e)throw new Error("Invalid group: "+e);l="frm_batchApplyKey",h=n.n8,d=n.n8,p=n.n8}const f=Math.floor(t.byteLength/h),g=Math.floor(f/i.concurrency),A=[];s=r.e(s);let E=r.e(o);for(let e=0;e<i.concurrency;e++){let n;if(n=e<i.concurrency-1?g:f-e*g,0==n)continue;const o=[];o.push({cmd:"ALLOCSET",var:0,buff:t.slice(e*g*h,e*g*h+n*h)}),o.push({cmd:"ALLOCSET",var:1,buff:E}),o.push({cmd:"ALLOCSET",var:2,buff:s}),o.push({cmd:"ALLOC",var:3,len:n*Math.max(d,p)}),o.push({cmd:"CALL",fnName:l,params:[{var:0},{val:n},{var:1},{var:2},{var:3}]}),u&&o.push({cmd:"CALL",fnName:u,params:[{var:3},{val:n},{var:3}]}),o.push({cmd:"GET",out:0,var:3,len:n*p}),A.push(i.queueAction(o)),E=r.mul(E,r.exp(s,n))}const m=await Promise.all(A);let w;w=t instanceof HC?new HC(f*p):new Uint8Array(f*p);let y=0;for(let t=0;t<m.length;t++)w.set(m[t][0],y),y+=m[t][0].byteLength;return w}}const nT=[1,1,1,1,2,3,4,5,6,7,7,8,9,10,11,12,13,13,14,15,16,16,17,17,17,17,17,17,17,17,17,17];function rT(t,e){const n=t[e],r=n.tm;async function i(t,r,i,o,s){if(!(t instanceof Uint8Array))throw o&&o.error(`${s} _multiExpChunk buffBases is not Uint8Array`),new Error(`${s} _multiExpChunk buffBases is not Uint8Array`);if(!(r instanceof Uint8Array))throw o&&o.error(`${s} _multiExpChunk buffScalars is not Uint8Array`),new Error(`${s} _multiExpChunk buffScalars is not Uint8Array`);let a,c;if(i=i||"affine","G1"==e)"affine"==i?(c="g1m_multiexpAffine_chunk",a=2*n.F.n8):(c="g1m_multiexp_chunk",a=3*n.F.n8);else{if("G2"!=e)throw new Error("Invalid group");"affine"==i?(c="g2m_multiexpAffine_chunk",a=2*n.F.n8):(c="g2m_multiexp_chunk",a=3*n.F.n8)}const l=Math.floor(t.byteLength/a);if(0==l)return n.zero;const u=Math.floor(r.byteLength/l);if(u*l!=r.byteLength)throw new Error("Scalar size does not match");const h=nT[QC(l)],d=Math.floor((8*u-1)/h)+1,p=[];for(let e=0;e<d;e++){const i=[{cmd:"ALLOCSET",var:0,buff:t},{cmd:"ALLOCSET",var:1,buff:r},{cmd:"ALLOC",var:2,len:3*n.F.n8},{cmd:"CALL",fnName:c,params:[{var:0},{var:1},{val:u},{val:l},{val:e*h},{val:Math.min(8*u-e*h,h)},{var:2}]},{cmd:"GET",out:0,var:2,len:3*n.F.n8}];p.push(n.tm.queueAction(i))}const f=await Promise.all(p);let g=n.zero;for(let t=f.length-1;t>=0;t--){if(!n.isZero(g))for(let t=0;t<h;t++)g=n.double(g);g=n.add(g,f[t][0])}return g}async function o(t,o,s,a,c){const l=1<<22;let u;if("G1"==e)u="affine"==s?2*n.F.n8:3*n.F.n8;else{if("G2"!=e)throw new Error("Invalid group");u="affine"==s?2*n.F.n8:3*n.F.n8}const h=Math.floor(t.byteLength/u);if(0==h)return n.zero;const d=Math.floor(o.byteLength/h);if(d*h!=o.byteLength)throw new Error("Scalar size does not match");const p=nT[QC(h)],f=Math.floor((8*d-1)/p)+1;let g;g=Math.floor(h/(r.concurrency/f)),g>l&&(g=l),g<1024&&(g=1024);const A=[];for(let e=0;e<h;e+=g){a&&a.debug(`Multiexp start: ${c}: ${e}/${h}`);const n=Math.min(h-e,g),r=t.slice(e*u,(e+n)*u),l=o.slice(e*d,(e+n)*d);A.push(i(r,l,s,a,c).then(t=>(a&&a.debug(`Multiexp end: ${c}: ${e}/${h}`),t)))}const E=await Promise.all(A);let m=n.zero;for(let t=E.length-1;t>=0;t--)m=n.add(m,E[t]);return m}n.multiExp=async function(t,e,n,r){return await o(t,e,"jacobian",n,r)},n.multiExpAffine=async function(t,e,n,r){return await o(t,e,"affine",n,r)}}function iT(t,e){const n=t[e],r=t.Fr,i=n.tm;async function o(t,a,c,l,u,h){c=c||"affine",l=l||"affine";let d,p,f,g,A,E,m,w;"G1"==e?("affine"==c?(d=2*n.F.n8,g="g1m_batchToJacobian"):d=3*n.F.n8,p=3*n.F.n8,a&&(w="g1m_fftFinal"),m="g1m_fftJoin",E="g1m_fftMix","affine"==l?(f=2*n.F.n8,A="g1m_batchToAffine"):f=3*n.F.n8):"G2"==e?("affine"==c?(d=2*n.F.n8,g="g2m_batchToJacobian"):d=3*n.F.n8,p=3*n.F.n8,a&&(w="g2m_fftFinal"),m="g2m_fftJoin",E="g2m_fftMix","affine"==l?(f=2*n.F.n8,A="g2m_batchToAffine"):f=3*n.F.n8):"Fr"==e&&(d=n.n8,p=n.n8,f=n.n8,a&&(w="frm_fftFinal"),E="frm_fftMix",m="frm_fftJoin");let y=!1;Array.isArray(t)?(t=PC(t,d),y=!0):t=t.slice(0,t.byteLength);const B=t.byteLength/d,I=QC(B);if(1<<I!=B)throw new Error("fft must be multiple of 2");if(I==r.s+1){let e;return e=a?await async function(t,e,n,i,a){let c,l;c=t.slice(0,t.byteLength/2),l=t.slice(t.byteLength/2,t.byteLength);const u=[];u.push(o(c,!0,e,"jacobian",i,a)),u.push(o(l,!0,e,"jacobian",i,a)),[c,l]=await Promise.all(u);const h=await s(c,l,"fftJoinExtInv",r.one,r.shiftInv,"jacobian",n,i,a);let d;d=h[0].byteLength>1<<28?new HC(2*h[0].byteLength):new Uint8Array(2*h[0].byteLength);return d.set(h[0]),d.set(h[1],h[0].byteLength),d}(t,c,l,u,h):await async function(t,e,n,i,a){let c,l;c=t.slice(0,t.byteLength/2),l=t.slice(t.byteLength/2,t.byteLength);const u=[];[c,l]=await s(c,l,"fftJoinExt",r.one,r.shift,e,"jacobian",i,a),u.push(o(c,!1,"jacobian",n,i,a)),u.push(o(l,!1,"jacobian",n,i,a));const h=await Promise.all(u);let d;d=h[0].byteLength>1<<28?new HC(2*h[0].byteLength):new Uint8Array(2*h[0].byteLength);return d.set(h[0]),d.set(h[1],h[0].byteLength),d}(t,c,l,u,h),y?GC(e,f):e}let C,T,b;a&&(C=r.inv(r.e(B))),UC(t,d);let D=Math.min(16384,B),v=B/D;for(;v<i.concurrency&&D>=16;)v*=2,D/=2;const M=QC(D),N=[];for(let e=0;e<v;e++){u&&u.debug(`${h}: fft ${I} mix start: ${e}/${v}`);const n=[];n.push({cmd:"ALLOC",var:0,len:p*D});const r=t.slice(D*e*d,D*(e+1)*d);n.push({cmd:"SET",var:0,buff:r}),g&&n.push({cmd:"CALL",fnName:g,params:[{var:0},{val:D},{var:0}]});for(let t=1;t<=M;t++)n.push({cmd:"CALL",fnName:E,params:[{var:0},{val:D},{val:t}]});M==I?(w&&(n.push({cmd:"ALLOCSET",var:1,buff:C}),n.push({cmd:"CALL",fnName:w,params:[{var:0},{val:D},{var:1}]})),A&&n.push({cmd:"CALL",fnName:A,params:[{var:0},{val:D},{var:0}]}),n.push({cmd:"GET",out:0,var:0,len:D*f})):n.push({cmd:"GET",out:0,var:0,len:p*D}),N.push(i.queueAction(n).then(t=>(u&&u.debug(`${h}: fft ${I} mix end: ${e}/${v}`),t)))}b=await Promise.all(N);for(let t=0;t<v;t++)b[t]=b[t][0];for(let t=M+1;t<=I;t++){u&&u.debug(`${h}: fft ${I} join: ${t}/${I}`);const e=1<<I-t,n=v/e,o=[];for(let s=0;s<e;s++)for(let a=0;a<n/2;a++){const c=r.exp(r.w[t],a*D),l=r.w[t],d=s*n+a,g=s*n+a+n/2,E=[];E.push({cmd:"ALLOCSET",var:0,buff:b[d]}),E.push({cmd:"ALLOCSET",var:1,buff:b[g]}),E.push({cmd:"ALLOCSET",var:2,buff:c}),E.push({cmd:"ALLOCSET",var:3,buff:l}),E.push({cmd:"CALL",fnName:m,params:[{var:0},{var:1},{val:D},{var:2},{var:3}]}),t==I?(w&&(E.push({cmd:"ALLOCSET",var:4,buff:C}),E.push({cmd:"CALL",fnName:w,params:[{var:0},{val:D},{var:4}]}),E.push({cmd:"CALL",fnName:w,params:[{var:1},{val:D},{var:4}]})),A&&(E.push({cmd:"CALL",fnName:A,params:[{var:0},{val:D},{var:0}]}),E.push({cmd:"CALL",fnName:A,params:[{var:1},{val:D},{var:1}]})),E.push({cmd:"GET",out:0,var:0,len:D*f}),E.push({cmd:"GET",out:1,var:1,len:D*f})):(E.push({cmd:"GET",out:0,var:0,len:D*p}),E.push({cmd:"GET",out:1,var:1,len:D*p})),o.push(i.queueAction(E).then(r=>(u&&u.debug(`${h}: fft ${I} join ${t}/${I} ${s+1}/${e} ${a}/${n/2}`),r)))}const s=await Promise.all(o);for(let t=0;t<e;t++)for(let e=0;e<n/2;e++){const r=t*n+e,i=t*n+e+n/2,o=s.shift();b[r]=o[0],b[i]=o[1]}}if(T=t instanceof HC?new HC(B*f):new Uint8Array(B*f),a){T.set(b[0].slice((D-1)*f));let t=f;for(let e=v-1;e>0;e--)T.set(b[e],t),t+=D*f,delete b[e];T.set(b[0].slice(0,(D-1)*f),t),delete b[0]}else for(let t=0;t<v;t++)T.set(b[t],D*f*t),delete b[t];return y?GC(T,f):T}async function s(t,o,s,a,c,l,u,h,d){let p,f,g,A,E,m;if("G1"==e)"affine"==l?(E=2*n.F.n8,f="g1m_batchToJacobian"):E=3*n.F.n8,m=3*n.F.n8,p="g1m_"+s,"affine"==u?(g="g1m_batchToAffine",A=2*n.F.n8):A=3*n.F.n8;else if("G2"==e)"affine"==l?(E=2*n.F.n8,f="g2m_batchToJacobian"):E=3*n.F.n8,p="g2m_"+s,m=3*n.F.n8,"affine"==u?(g="g2m_batchToAffine",A=2*n.F.n8):A=3*n.F.n8;else{if("Fr"!=e)throw new Error("Invalid group");E=r.n8,A=r.n8,m=r.n8,p="frm_"+s}if(t.byteLength!=o.byteLength)throw new Error("Invalid buffer size");const w=Math.floor(t.byteLength/E);if(w!=1<<QC(w))throw new Error("Invalid number of points");let y=Math.floor(w/i.concurrency);y<16&&(y=16),y>65536&&(y=65536);const B=[];for(let e=0;e<w;e+=y){h&&h.debug(`${d}: fftJoinExt Start: ${e}/${w}`);const n=Math.min(w-e,y),s=r.mul(a,r.exp(c,e)),l=[],u=t.slice(e*E,(e+n)*E),I=o.slice(e*E,(e+n)*E);l.push({cmd:"ALLOC",var:0,len:m*n}),l.push({cmd:"SET",var:0,buff:u}),l.push({cmd:"ALLOC",var:1,len:m*n}),l.push({cmd:"SET",var:1,buff:I}),l.push({cmd:"ALLOCSET",var:2,buff:s}),l.push({cmd:"ALLOCSET",var:3,buff:c}),f&&(l.push({cmd:"CALL",fnName:f,params:[{var:0},{val:n},{var:0}]}),l.push({cmd:"CALL",fnName:f,params:[{var:1},{val:n},{var:1}]})),l.push({cmd:"CALL",fnName:p,params:[{var:0},{var:1},{val:n},{var:2},{var:3},{val:r.s}]}),g&&(l.push({cmd:"CALL",fnName:g,params:[{var:0},{val:n},{var:0}]}),l.push({cmd:"CALL",fnName:g,params:[{var:1},{val:n},{var:1}]})),l.push({cmd:"GET",out:0,var:0,len:n*A}),l.push({cmd:"GET",out:1,var:1,len:n*A}),B.push(i.queueAction(l).then(t=>(h&&h.debug(`${d}: fftJoinExt End: ${e}/${w}`),t)))}const I=await Promise.all(B);let C,T;w*A>1<<28?(C=new HC(w*A),T=new HC(w*A)):(C=new Uint8Array(w*A),T=new Uint8Array(w*A));let b=0;for(let t=0;t<I.length;t++)C.set(I[t][0],b),T.set(I[t][1],b),b+=I[t][0].byteLength;return[C,T]}n.fft=async function(t,e,n,r,i){return await o(t,!1,e,n,r,i)},n.ifft=async function(t,e,n,r,i){return await o(t,!0,e,n,r,i)},n.lagrangeEvaluations=async function(t,i,a,c,l){let u;if(i=i||"affine",a=a||"affine","G1"==e)u="affine"==i?2*n.F.n8:3*n.F.n8;else if("G2"==e)u="affine"==i?2*n.F.n8:3*n.F.n8;else{if("Fr"!=e)throw new Error("Invalid group");u=r.n8}const h=t.byteLength/u,d=QC(h);if(2**d*u!=t.byteLength)throw c&&c.error("lagrangeEvaluations iinvalid input size"),new Error("lagrangeEvaluations invalid Input size");if(d<=r.s)return await n.ifft(t,i,a,c,l);if(d>r.s+1)throw c&&c.error("lagrangeEvaluations input too big"),new Error("lagrangeEvaluations input too big");let p=t.slice(0,t.byteLength/2),f=t.slice(t.byteLength/2,t.byteLength);const g=r.exp(r.shift,h/2),A=r.inv(r.sub(r.one,g));[p,f]=await s(p,f,"prepareLagrangeEvaluation",A,r.shiftInv,i,"jacobian",c,l+" prep");const E=[];let m;return E.push(o(p,!0,"jacobian",a,c,l+" t0")),E.push(o(f,!0,"jacobian",a,c,l+" t1")),[p,f]=await Promise.all(E),m=p.byteLength>1<<28?new HC(2*p.byteLength):new Uint8Array(2*p.byteLength),m.set(p),m.set(f,p.byteLength),m},n.fftMix=async function(t){const o=3*n.F.n8;let s,a;if("G1"==e)s="g1m_fftMix",a="g1m_fftJoin";else if("G2"==e)s="g2m_fftMix",a="g2m_fftJoin";else{if("Fr"!=e)throw new Error("Invalid group");s="frm_fftMix",a="frm_fftJoin"}const c=Math.floor(t.byteLength/o),l=QC(c);let u=1<<QC(i.concurrency);c<=2*u&&(u=1);const h=c/u,d=QC(h),p=[];for(let e=0;e<u;e++){const n=[],r=t.slice(e*h*o,(e+1)*h*o);n.push({cmd:"ALLOCSET",var:0,buff:r});for(let t=1;t<=d;t++)n.push({cmd:"CALL",fnName:s,params:[{var:0},{val:h},{val:t}]});n.push({cmd:"GET",out:0,var:0,len:h*o}),p.push(i.queueAction(n))}const f=await Promise.all(p),g=[];for(let t=0;t<f.length;t++)g[t]=f[t][0];for(let t=d+1;t<=l;t++){const e=1<<l-t,n=u/e,s=[];for(let c=0;c<e;c++)for(let e=0;e<n/2;e++){const l=r.exp(r.w[t],e*h),u=r.w[t],d=c*n+e,p=c*n+e+n/2,f=[];f.push({cmd:"ALLOCSET",var:0,buff:g[d]}),f.push({cmd:"ALLOCSET",var:1,buff:g[p]}),f.push({cmd:"ALLOCSET",var:2,buff:l}),f.push({cmd:"ALLOCSET",var:3,buff:u}),f.push({cmd:"CALL",fnName:a,params:[{var:0},{var:1},{val:h},{var:2},{var:3}]}),f.push({cmd:"GET",out:0,var:0,len:h*o}),f.push({cmd:"GET",out:1,var:1,len:h*o}),s.push(i.queueAction(f))}const c=await Promise.all(s);for(let t=0;t<e;t++)for(let e=0;e<n/2;e++){const r=t*n+e,i=t*n+e+n/2,o=c.shift();g[r]=o[0],g[i]=o[1]}}let A;A=t instanceof HC?new HC(c*o):new Uint8Array(c*o);let E=0;for(let t=0;t<u;t++)A.set(g[t],E),E+=g[t].byteLength;return A},n.fftJoin=async function(t,o,s,a){const c=3*n.F.n8;let l;if("G1"==e)l="g1m_fftJoin";else if("G2"==e)l="g2m_fftJoin";else{if("Fr"!=e)throw new Error("Invalid group");l="frm_fftJoin"}if(t.byteLength!=o.byteLength)throw new Error("Invalid buffer size");const u=Math.floor(t.byteLength/c);if(u!=1<<QC(u))throw new Error("Invalid number of points");let h=1<<QC(i.concurrency);u<=2*h&&(h=1);const d=u/h,p=[];for(let e=0;e<h;e++){const n=[],u=r.mul(s,r.exp(a,e*d)),h=t.slice(e*d*c,(e+1)*d*c),f=o.slice(e*d*c,(e+1)*d*c);n.push({cmd:"ALLOCSET",var:0,buff:h}),n.push({cmd:"ALLOCSET",var:1,buff:f}),n.push({cmd:"ALLOCSET",var:2,buff:u}),n.push({cmd:"ALLOCSET",var:3,buff:a}),n.push({cmd:"CALL",fnName:l,params:[{var:0},{var:1},{val:d},{var:2},{var:3}]}),n.push({cmd:"GET",out:0,var:0,len:d*c}),n.push({cmd:"GET",out:1,var:1,len:d*c}),p.push(i.queueAction(n))}const f=await Promise.all(p);let g,A;t instanceof HC?(g=new HC(u*c),A=new HC(u*c)):(g=new Uint8Array(u*c),A=new Uint8Array(u*c));let E=0;for(let t=0;t<f.length;t++)g.set(f[t][0],E),A.set(f[t][1],E),E+=f[t][0].byteLength;return[g,A]},n.fftFinal=async function(t,r){const o=3*n.F.n8,s=2*n.F.n8;let a,c;if("G1"==e)a="g1m_fftFinal",c="g1m_batchToAffine";else{if("G2"!=e)throw new Error("Invalid group");a="g2m_fftFinal",c="g2m_batchToAffine"}const l=Math.floor(t.byteLength/o);if(l!=1<<QC(l))throw new Error("Invalid number of points");const u=Math.floor(l/i.concurrency),h=[];for(let e=0;e<i.concurrency;e++){let n;if(n=e<i.concurrency-1?u:l-e*u,0==n)continue;const d=[],p=t.slice(e*u*o,(e*u+n)*o);d.push({cmd:"ALLOCSET",var:0,buff:p}),d.push({cmd:"ALLOCSET",var:1,buff:r}),d.push({cmd:"CALL",fnName:a,params:[{var:0},{val:n},{var:1}]}),d.push({cmd:"CALL",fnName:c,params:[{var:0},{val:n},{var:0}]}),d.push({cmd:"GET",out:0,var:0,len:n*s}),h.push(i.queueAction(d))}const d=await Promise.all(h);let p;p=t instanceof HC?new HC(l*s):new Uint8Array(l*s);let f=0;for(let t=d.length-1;t>=0;t--)p.set(d[t][0],f),f+=d[t][0].byteLength;return p}}async function oT(t){const e=await $C(t.wasm,t.singleThread),n={};return n.q=pB(t.wasm.q.toString()),n.r=pB(t.wasm.r.toString()),n.name=t.name,n.tm=e,n.prePSize=t.wasm.prePSize,n.preQSize=t.wasm.preQSize,n.Fr=new zC(e,"frm",t.n8r,t.r),n.F1=new zC(e,"f1m",t.n8q,t.q),n.F2=new JC(e,"f2m",n.F1),n.G1=new qC(e,"g1m",n.F1,t.wasm.pG1gen,t.wasm.pG1b,t.cofactorG1),n.G2=new qC(e,"g2m",n.F2,t.wasm.pG2gen,t.wasm.pG2b,t.cofactorG2),n.F6=new WC(e,"f6m",n.F2),n.F12=new JC(e,"ftm",n.F6),n.Gt=n.F12,eT(n,"G1"),eT(n,"G2"),eT(n,"Fr"),rT(n,"G1"),rT(n,"G2"),iT(n,"G1"),iT(n,"G2"),iT(n,"Fr"),function(t){const e=t.tm;t.pairing=function(n,r){e.startSyncOp();const i=e.allocBuff(t.G1.toJacobian(n)),o=e.allocBuff(t.G2.toJacobian(r)),s=e.alloc(t.Gt.n8);e.instance.exports[t.name+"_pairing"](i,o,s);const a=e.getBuff(s,t.Gt.n8);return e.endSyncOp(),a},t.pairingEq=async function(){let n,r;arguments.length%2==1?(n=arguments[arguments.length-1],r=(arguments.length-1)/2):(n=t.Gt.one,r=arguments.length/2);const i=[];for(let n=0;n<r;n++){const r=[],o=t.G1.toJacobian(arguments[2*n]);r.push({cmd:"ALLOCSET",var:0,buff:o}),r.push({cmd:"ALLOC",var:1,len:t.prePSize});const s=t.G2.toJacobian(arguments[2*n+1]);r.push({cmd:"ALLOCSET",var:2,buff:s}),r.push({cmd:"ALLOC",var:3,len:t.preQSize}),r.push({cmd:"ALLOC",var:4,len:t.Gt.n8}),r.push({cmd:"CALL",fnName:t.name+"_prepareG1",params:[{var:0},{var:1}]}),r.push({cmd:"CALL",fnName:t.name+"_prepareG2",params:[{var:2},{var:3}]}),r.push({cmd:"CALL",fnName:t.name+"_millerLoop",params:[{var:1},{var:3},{var:4}]}),r.push({cmd:"GET",out:0,var:4,len:t.Gt.n8}),i.push(e.queueAction(r))}const o=await Promise.all(i);e.startSyncOp();const s=e.alloc(t.Gt.n8);e.instance.exports.ftm_one(s);for(let t=0;t<o.length;t++){const n=e.allocBuff(o[t][0]);e.instance.exports.ftm_mul(s,n,s)}e.instance.exports[t.name+"_finalExponentiation"](s,s);const a=e.allocBuff(n),c=!!e.instance.exports.ftm_eq(s,a);return e.endSyncOp(),c},t.prepareG1=function(t){this.tm.startSyncOp();const e=this.tm.allocBuff(t),n=this.tm.alloc(this.prePSize);this.tm.instance.exports[this.name+"_prepareG1"](e,n);const r=this.tm.getBuff(n,this.prePSize);return this.tm.endSyncOp(),r},t.prepareG2=function(t){this.tm.startSyncOp();const e=this.tm.allocBuff(t),n=this.tm.alloc(this.preQSize);this.tm.instance.exports[this.name+"_prepareG2"](e,n);const r=this.tm.getBuff(n,this.preQSize);return this.tm.endSyncOp(),r},t.millerLoop=function(t,e){this.tm.startSyncOp();const n=this.tm.allocBuff(t),r=this.tm.allocBuff(e),i=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_millerLoop"](n,r,i);const o=this.tm.getBuff(i,this.Gt.n8);return this.tm.endSyncOp(),o},t.finalExponentiation=function(t){this.tm.startSyncOp();const e=this.tm.allocBuff(t),n=this.tm.alloc(this.Gt.n8);this.tm.instance.exports[this.name+"_finalExponentiation"](e,n);const r=this.tm.getBuff(n,this.Gt.n8);return this.tm.endSyncOp(),r}}(n),n.array2buffer=function(t,e){const n=new Uint8Array(e*t.length);for(let r=0;r<t.length;r++)n.set(t[r],r*e);return n},n.buffer2array=function(t,e){const n=t.byteLength/e,r=new Array(n);for(let i=0;i<n;i++)r[i]=t.slice(i*e,i*e+e);return r},n}function sT(t){return BigInt(t)}function aT(t){return t<0n}function cT(t){return 0n===t}function lT(t){const e=[],n=sT(t);return e.push(Number(0xFFn&n)),e.push(Number(n>>8n&0xFFn)),e.push(Number(n>>16n&0xFFn)),e.push(Number(n>>24n&0xFFn)),e}function uT(t){const e=function(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e.push(r):r<2048?e.push(192|r>>6,128|63&r):r<55296||r>=57344?e.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&t.charCodeAt(n)),e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return e}(t);return[...gT(e.length),...e]}function hT(t){const e=[];let n=sT(t);if(aT(n))throw new Error("Number cannot be negative");for(;!cT(n);)e.push(Number(0x7Fn&n)),n>>=7n;0==e.length&&e.push(0);for(let t=0;t<e.length-1;t++)e[t]=128|e[t];return e}function dT(t){let e,n;const r=function(t){return aT(t)?t.toString(2).length-1:t.toString(2).length}(t);t<0?(n=!0,e=(1n<<BigInt(r))+t):(n=!1,e=sT(t));const i=7-r%7,o=(1<<7-i)-1|128,s=hT(e+((1n<<BigInt(i))-1n<<BigInt(r)));return n||(s[s.length-1]=s[s.length-1]&o),s}function pT(t){let e=sT(t);if(e>0xFFFFFFFFn)throw new Error("Number too big");if(e>0x7FFFFFFFn&&(e-=0x100000000n),e<-2147483648n)throw new Error("Number too small");return dT(e)}function fT(t){let e=sT(t);if(e>0xFFFFFFFFFFFFFFFFn)throw new Error("Number too big");if(e>0x7FFFFFFFFFFFFFFFn&&(e-=0x10000000000000000n),e<-9223372036854775808n)throw new Error("Number too small");return dT(e)}function gT(t){let e=sT(t);if(e>0xFFFFFFFFn)throw new Error("Number too big");return hT(e)}function AT(t){return Array.from(t,function(t){return("0"+(255&t).toString(16)).slice(-2)}).join("")}class ET{constructor(t){this.func=t,this.functionName=t.functionName,this.module=t.module}setLocal(t,e){const n=this.func.localIdxByName[t];if(void 0===n)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...e,33,...gT(n)]}teeLocal(t,e){const n=this.func.localIdxByName[t];if(void 0===n)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[...e,34,...gT(n)]}getLocal(t){const e=this.func.localIdxByName[t];if(void 0===e)throw new Error(`Local Variable not defined: Function: ${this.functionName} local: ${t} `);return[32,...gT(e)]}i64_load8_s(t,e,n){return[...t,48,void 0===n?0:n,...gT(e||0)]}i64_load8_u(t,e,n){return[...t,49,void 0===n?0:n,...gT(e||0)]}i64_load16_s(t,e,n){return[...t,50,void 0===n?1:n,...gT(e||0)]}i64_load16_u(t,e,n){return[...t,51,void 0===n?1:n,...gT(e||0)]}i64_load32_s(t,e,n){return[...t,52,void 0===n?2:n,...gT(e||0)]}i64_load32_u(t,e,n){return[...t,53,void 0===n?2:n,...gT(e||0)]}i64_load(t,e,n){return[...t,41,void 0===n?3:n,...gT(e||0)]}i64_store(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=3,s=e):Array.isArray(n)?(i=e,o=3,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,55,o,...gT(i)]}i64_store32(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=2,s=e):Array.isArray(n)?(i=e,o=2,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,62,o,...gT(i)]}i64_store16(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=1,s=e):Array.isArray(n)?(i=e,o=1,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,61,o,...gT(i)]}i64_store8(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=0,s=e):Array.isArray(n)?(i=e,o=0,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,60,o,...gT(i)]}i32_load8_s(t,e,n){return[...t,44,void 0===n?0:n,...gT(e||0)]}i32_load8_u(t,e,n){return[...t,45,void 0===n?0:n,...gT(e||0)]}i32_load16_s(t,e,n){return[...t,46,void 0===n?1:n,...gT(e||0)]}i32_load16_u(t,e,n){return[...t,47,void 0===n?1:n,...gT(e||0)]}i32_load(t,e,n){return[...t,40,void 0===n?2:n,...gT(e||0)]}i32_store(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=2,s=e):Array.isArray(n)?(i=e,o=2,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,54,o,...gT(i)]}i32_store16(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=1,s=e):Array.isArray(n)?(i=e,o=1,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,59,o,...gT(i)]}i32_store8(t,e,n,r){let i,o,s;return Array.isArray(e)?(i=0,o=0,s=e):Array.isArray(n)?(i=e,o=0,s=n):Array.isArray(r)&&(i=e,o=n,s=r),[...t,...s,58,o,...gT(i)]}call(t,...e){const n=this.module.functionIdxByName[t];if(void 0===n)throw new Error(`Function not defined: Function: ${t}`);return[...[].concat(...e),16,...gT(n)]}call_indirect(t,...e){return[...[].concat(...e),...t,17,0,0]}if(t,e,n){return n?[...t,4,64,...e,5,...n,11]:[...t,4,64,...e,11]}block(t){return[2,64,...t,11]}loop(...t){return[3,64,...[].concat(...t),11]}br_if(t,e){return[...e,13,...gT(t)]}br(t){return[12,...gT(t)]}ret(t){return[...t,15]}drop(t){return[...t,26]}i64_const(t){return[66,...fT(t)]}i32_const(t){return[65,...pT(t)]}i64_eqz(t){return[...t,80]}i64_eq(t,e){return[...t,...e,81]}i64_ne(t,e){return[...t,...e,82]}i64_lt_s(t,e){return[...t,...e,83]}i64_lt_u(t,e){return[...t,...e,84]}i64_gt_s(t,e){return[...t,...e,85]}i64_gt_u(t,e){return[...t,...e,86]}i64_le_s(t,e){return[...t,...e,87]}i64_le_u(t,e){return[...t,...e,88]}i64_ge_s(t,e){return[...t,...e,89]}i64_ge_u(t,e){return[...t,...e,90]}i64_add(t,e){return[...t,...e,124]}i64_sub(t,e){return[...t,...e,125]}i64_mul(t,e){return[...t,...e,126]}i64_div_s(t,e){return[...t,...e,127]}i64_div_u(t,e){return[...t,...e,128]}i64_rem_s(t,e){return[...t,...e,129]}i64_rem_u(t,e){return[...t,...e,130]}i64_and(t,e){return[...t,...e,131]}i64_or(t,e){return[...t,...e,132]}i64_xor(t,e){return[...t,...e,133]}i64_shl(t,e){return[...t,...e,134]}i64_shr_s(t,e){return[...t,...e,135]}i64_shr_u(t,e){return[...t,...e,136]}i64_extend_i32_s(t){return[...t,172]}i64_extend_i32_u(t){return[...t,173]}i64_clz(t){return[...t,121]}i64_ctz(t){return[...t,122]}i32_eqz(t){return[...t,69]}i32_eq(t,e){return[...t,...e,70]}i32_ne(t,e){return[...t,...e,71]}i32_lt_s(t,e){return[...t,...e,72]}i32_lt_u(t,e){return[...t,...e,73]}i32_gt_s(t,e){return[...t,...e,74]}i32_gt_u(t,e){return[...t,...e,75]}i32_le_s(t,e){return[...t,...e,76]}i32_le_u(t,e){return[...t,...e,77]}i32_ge_s(t,e){return[...t,...e,78]}i32_ge_u(t,e){return[...t,...e,79]}i32_add(t,e){return[...t,...e,106]}i32_sub(t,e){return[...t,...e,107]}i32_mul(t,e){return[...t,...e,108]}i32_div_s(t,e){return[...t,...e,109]}i32_div_u(t,e){return[...t,...e,110]}i32_rem_s(t,e){return[...t,...e,111]}i32_rem_u(t,e){return[...t,...e,112]}i32_and(t,e){return[...t,...e,113]}i32_or(t,e){return[...t,...e,114]}i32_xor(t,e){return[...t,...e,115]}i32_shl(t,e){return[...t,...e,116]}i32_shr_s(t,e){return[...t,...e,117]}i32_shr_u(t,e){return[...t,...e,118]}i32_rotl(t,e){return[...t,...e,119]}i32_rotr(t,e){return[...t,...e,120]}i32_wrap_i64(t){return[...t,167]}i32_clz(t){return[...t,103]}i32_ctz(t){return[...t,104]}unreachable(){return[0]}current_memory(){return[63,0]}comment(){return[]}}const mT={i32:127,i64:126,f32:125,f64:124,anyfunc:112,func:96,emptyblock:64};class wT{constructor(t,e,n,r,i){if("import"==n)this.fnType="import",this.moduleName=r,this.fieldName=i;else{if("internal"!=n)throw new Error("Invalid function fnType: "+n);this.fnType="internal"}this.module=t,this.fnName=e,this.params=[],this.locals=[],this.localIdxByName={},this.code=[],this.returnType=null,this.nextLocal=0}addParam(t,e){if(this.localIdxByName[t])throw new Error(`param already exists. Function: ${this.fnName}, Param: ${t} `);const n=this.nextLocal++;this.localIdxByName[t]=n,this.params.push({type:e})}addLocal(t,e,n){const r=n||1;if(this.localIdxByName[t])throw new Error(`local already exists. Function: ${this.fnName}, Param: ${t} `);const i=this.nextLocal++;this.localIdxByName[t]=i,this.locals.push({type:e,length:r})}setReturnType(t){if(this.returnType)throw new Error(`returnType already defined. Function: ${this.fnName}`);this.returnType=t}getSignature(){return[96,...[...gT(this.params.length),...this.params.map(t=>mT[t.type])],...this.returnType?[1,mT[this.returnType]]:[0]]}getBody(){const t=this.locals.map(t=>[...gT(t.length),mT[t.type]]),e=[...gT(this.locals.length),...[].concat(...t),...this.code,11];return[...gT(e.length),...e]}addCode(...t){this.code.push(...[].concat(...t))}getCodeBuilder(){return new ET(this)}}class yT{constructor(){this.functions=[],this.functionIdxByName={},this.nImportFunctions=0,this.nInternalFunctions=0,this.memory={pagesSize:1,moduleName:"env",fieldName:"memory"},this.free=8,this.datas=[],this.modules={},this.exports=[],this.functionsTable=[]}build(){return this._setSignatures(),new Uint8Array([...lT(1836278016),...lT(1),...this._buildType(),...this._buildImport(),...this._buildFunctionDeclarations(),...this._buildFunctionsTable(),...this._buildExports(),...this._buildElements(),...this._buildCode(),...this._buildData()])}addFunction(t){if(void 0!==this.functionIdxByName[t])throw new Error(`Function already defined: ${t}`);const e=this.functions.length;return this.functionIdxByName[t]=e,this.functions.push(new wT(this,t,"internal")),this.nInternalFunctions++,this.functions[e]}addIimportFunction(t,e,n){if(void 0!==this.functionIdxByName[t])throw new Error(`Function already defined: ${t}`);if(this.functions.length>0&&"internal"==this.functions[this.functions.length-1].type)throw new Error(`Import functions must be declared before internal: ${t}`);let r=n||t;const i=this.functions.length;return this.functionIdxByName[t]=i,this.functions.push(new wT(this,t,"import",e,r)),this.nImportFunctions++,this.functions[i]}setMemory(t,e,n){this.memory={pagesSize:t,moduleName:e||"env",fieldName:n||"memory"}}exportFunction(t,e){const n=e||t;if(void 0===this.functionIdxByName[t])throw new Error(`Function not defined: ${t}`);const r=this.functionIdxByName[t];n!=t&&(this.functionIdxByName[n]=r),this.exports.push({exportName:n,idx:r})}addFunctionToTable(t){const e=this.functionIdxByName[t];this.functionsTable.push(e)}addData(t,e){this.datas.push({offset:t,bytes:e})}alloc(t,e){let n,r;(Array.isArray(t)||ArrayBuffer.isView(t))&&void 0===e?(n=t.length,r=t):(n=t,r=e),n=1+(n-1>>3)<<3;const i=this.free;return this.free+=n,r&&this.addData(i,r),i}allocString(t){const e=(new globalThis.TextEncoder).encode(t);return this.alloc([...e,0])}_setSignatures(){this.signatures=[];const t={};if(this.functionsTable.length>0){const e=this.functions[this.functionsTable[0]].getSignature();t["s_"+AT(e)]=0,this.signatures.push(e)}for(let e=0;e<this.functions.length;e++){const n=this.functions[e].getSignature(),r="s_"+AT(n);void 0===t[r]&&(t[r]=this.signatures.length,this.signatures.push(n)),this.functions[e].signatureIdx=t[r]}}_buildSection(t,e){return[t,...gT(e.length),...e]}_buildType(){return this._buildSection(1,[...gT(this.signatures.length),...[].concat(...this.signatures)])}_buildImport(){const t=[];t.push([...uT(this.memory.moduleName),...uT(this.memory.fieldName),2,0,...gT(this.memory.pagesSize)]);for(let e=0;e<this.nImportFunctions;e++)t.push([...uT(this.functions[e].moduleName),...uT(this.functions[e].fieldName),0,...gT(this.functions[e].signatureIdx)]);return this._buildSection(2,gT(t.length).concat(...t))}_buildFunctionDeclarations(){const t=[];for(let e=this.nImportFunctions;e<this.nImportFunctions+this.nInternalFunctions;e++)t.push(...gT(this.functions[e].signatureIdx));return this._buildSection(3,[...gT(t.length),...t])}_buildFunctionsTable(){return 0==this.functionsTable.length?[]:this._buildSection(4,[...gT(1),112,0,...gT(this.functionsTable.length)])}_buildElements(){if(0==this.functionsTable.length)return[];const t=[];for(let e=0;e<this.functionsTable.length;e++)t.push(...gT(this.functionsTable[e]));return this._buildSection(9,[...gT(1),...gT(0),65,...pT(0),11,...gT(this.functionsTable.length),...t])}_buildExports(){const t=[];for(let e=0;e<this.exports.length;e++)t.push([...uT(this.exports[e].exportName),0,...gT(this.exports[e].idx)]);return this._buildSection(7,gT(t.length).concat(...t))}_buildCode(){const t=[];for(let e=this.nImportFunctions;e<this.nImportFunctions+this.nInternalFunctions;e++)t.push(this.functions[e].getBody());return this._buildSection(10,gT(t.length).concat(...t))}_buildData(){const t=[];t.push([0,65,0,11,4,...lT(this.free)]);for(let e=0;e<this.datas.length;e++)t.push([0,65,...pT(this.datas[e].offset),11,...gT(this.datas[e].bytes.length),...this.datas[e].bytes]);return this._buildSection(11,gT(t.length).concat(...t))}}async function BT(t,e){if(!t&&globalThis.curve_bn128)return globalThis.curve_bn128;const n=new yT;n.setMemory(25),LC(n),e&&e(n);const r={};r.code=n.build(),r.pq=n.modules.f1m.pq,r.pr=n.modules.frm.pq,r.pG1gen=n.modules.bn128.pG1gen,r.pG1zero=n.modules.bn128.pG1zero,r.pG1b=n.modules.bn128.pG1b,r.pG2gen=n.modules.bn128.pG2gen,r.pG2zero=n.modules.bn128.pG2zero,r.pG2b=n.modules.bn128.pG2b,r.pOneT=n.modules.bn128.pOneT,r.prePSize=n.modules.bn128.prePSize,r.preQSize=n.modules.bn128.preQSize,r.n8q=32,r.n8r=32,r.q=n.modules.bn128.q,r.r=n.modules.bn128.r;const i={name:"bn128",wasm:r,q:pB("21888242871839275222246405745257275088696311157297823662689037894645226208583"),r:pB("21888242871839275222246405745257275088548364400416034343698204186575808495617"),n8q:32,n8r:32,cofactorG2:pB("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d",16),singleThread:!!t},o=await oT(i);return o.terminate=async function(){i.singleThread||(globalThis.curve_bn128=null,await this.tm.terminate())},t||(globalThis.curve_bn128=o),o}async function IT(t,e){if(!t&&globalThis.curve_bls12381)return globalThis.curve_bls12381;const n=new yT;n.setMemory(25),xC(n),e&&e(n);const r={};r.code=n.build(),r.pq=n.modules.f1m.pq,r.pr=n.modules.frm.pq,r.pG1gen=n.modules.bls12381.pG1gen,r.pG1zero=n.modules.bls12381.pG1zero,r.pG1b=n.modules.bls12381.pG1b,r.pG2gen=n.modules.bls12381.pG2gen,r.pG2zero=n.modules.bls12381.pG2zero,r.pG2b=n.modules.bls12381.pG2b,r.pOneT=n.modules.bls12381.pOneT,r.prePSize=n.modules.bls12381.prePSize,r.preQSize=n.modules.bls12381.preQSize,r.n8q=48,r.n8r=32,r.q=n.modules.bls12381.q,r.r=n.modules.bls12381.r;const i={name:"bls12381",wasm:r,q:pB("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),r:pB("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),n8q:48,n8r:32,cofactorG1:pB("0x396c8c005555e1568c00aaab0000aaab",16),cofactorG2:pB("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5",16),singleThread:!!t},o=await oT(i);return o.terminate=async function(){i.singleThread||(globalThis.curve_bls12381=null,await this.tm.terminate())},t||(globalThis.curve_bls12381=o),o}globalThis.curve_bn128=null,globalThis.curve_bls12381=null;const CT=pB("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),TT=pB("21888242871839275222246405745257275088548364400416034343698204186575808495617");pB("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),pB("21888242871839275222246405745257275088696311157297823662689037894645226208583");const bT=HB,DT=VC;var vT={};async function MT(t,e,n,r){if(n=n||262144,"number"!=typeof e&&["w+","wx+","r","ax+","a+"].indexOf(e)<0)throw new Error("Invalid open option");const i=await vT.promises.open(t,e),o=await i.stat();return new NT(i,o,n,r,t)}class NT{constructor(t,e,n,r,i){for(this.fileName=i,this.fd=t,this.pos=0,this.pageSize=r||256;this.pageSize<e.blksize;)this.pageSize*=2;this.totalSize=e.size,this.totalPages=Math.floor((e.size-1)/this.pageSize)+1,this.maxPagesLoaded=Math.floor(n/this.pageSize)+1,this.pages={},this.pendingLoads=[],this.writing=!1,this.reading=!1,this.avBuffs=[],this.history={}}_loadPage(t){const e=this,n=new Promise((n,r)=>{e.pendingLoads.push({page:t,resolve:n,reject:r})});return e.__statusPage("After Load request: ",t),n}__statusPage(t,e){const n=[],r=this;if(!r.logHistory)return;n.push("=="+t+" "+e);let i="";for(let t=0;t<r.pendingLoads.length;t++)r.pendingLoads[t].page==e&&(i=i+" "+t);if(i&&n.push("Pending loads:"+i),void 0!==r.pages[e]){const t=r.pages[e];n.push("Loaded"),n.push("pendingOps: "+t.pendingOps),t.loading&&n.push("loading: "+t.loading),t.writing&&n.push("writing"),t.dirty&&n.push("dirty")}n.push("=="),r.history[e]||(r.history[e]=[]),r.history[e].push(n)}__printHistory(t){const e=this;e.history[t]||console.log("Empty History ",t),console.log("History "+t);for(let n=0;n<e.history[t].length;n++)for(let r=0;r<e.history[t][n].length;r++)console.log("-> "+e.history[t][n][r])}_triggerLoad(){const t=this;if(t.reading)return;if(0==t.pendingLoads.length)return;const e=Object.keys(t.pages),n=[];for(let r=0;r<e.length;r++){const i=t.pages[parseInt(e[r])];0!=i.dirty||0!=i.pendingOps||i.writing||i.loading||n.push(parseInt(e[r]))}let r=t.maxPagesLoaded-e.length;const i=[];for(;t.pendingLoads.length>0&&(void 0!==t.pages[t.pendingLoads[0].page]||r>0||n.length>0);){const e=t.pendingLoads.shift();if(void 0!==t.pages[e.page]){t.pages[e.page].pendingOps++;const r=n.indexOf(e.page);r>=0&&n.splice(r,1),t.pages[e.page].loading?t.pages[e.page].loading.push(e):e.resolve(),t.__statusPage("After Load (cached): ",e.page)}else{if(r)r--;else{const e=n.shift();t.__statusPage("Before Unload: ",e),t.avBuffs.unshift(t.pages[e]),delete t.pages[e],t.__statusPage("After Unload: ",e)}e.page>=t.totalPages?(t.pages[e.page]=o(),e.resolve(),t.__statusPage("After Load (new): ",e.page)):(t.reading=!0,t.pages[e.page]=o(),t.pages[e.page].loading=[e],i.push(t.fd.read(t.pages[e.page].buff,0,t.pageSize,e.page*t.pageSize).then(n=>{t.pages[e.page].size=n.bytesRead;const r=t.pages[e.page].loading;delete t.pages[e.page].loading;for(let t=0;t<r.length;t++)r[t].resolve();return t.__statusPage("After Load (loaded): ",e.page),n},t=>{e.reject(t)})),t.__statusPage("After Load (loading): ",e.page))}}function o(){if(t.avBuffs.length>0){const e=t.avBuffs.shift();return e.dirty=!1,e.pendingOps=1,e.size=0,e}return{dirty:!1,buff:new Uint8Array(t.pageSize),pendingOps:1,size:0}}Promise.all(i).then(()=>{t.reading=!1,t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t)),t._tryClose()})}_triggerWrite(){const t=this;if(t.writing)return;const e=Object.keys(t.pages),n=[];for(let r=0;r<e.length;r++){const i=t.pages[parseInt(e[r])];i.dirty&&(i.dirty=!1,i.writing=!0,t.writing=!0,n.push(t.fd.write(i.buff,0,i.size,parseInt(e[r])*t.pageSize).then(()=>{i.writing=!1},e=>{console.log("ERROR Writing: "+e),t.error=e,t._tryClose()})))}t.writing&&Promise.all(n).then(()=>{t.writing=!1,setImmediate(t._triggerWrite.bind(t)),t._tryClose(),t.pendingLoads.length>0&&setImmediate(t._triggerLoad.bind(t))})}_getDirtyPage(){for(let t in this.pages)if(this.pages[t].dirty)return t;return-1}async write(t,e){if(0==t.byteLength)return;const n=this;if(void 0===e&&(e=n.pos),n.pos=e+t.byteLength,n.totalSize<e+t.byteLength&&(n.totalSize=e+t.byteLength),n.pendingClose)throw new Error("Writing a closing file");const r=Math.floor(e/n.pageSize),i=Math.floor((e+t.byteLength-1)/n.pageSize),o=[];for(let t=r;t<=i;t++)o.push(n._loadPage(t));n._triggerLoad();let s=r,a=e%n.pageSize,c=t.byteLength;for(;c>0;){await o[s-r];const e=a+c>n.pageSize?n.pageSize-a:c,i=t.slice(t.byteLength-c,t.byteLength-c+e);new Uint8Array(n.pages[s].buff.buffer,a,e).set(i),n.pages[s].dirty=!0,n.pages[s].pendingOps--,n.pages[s].size=Math.max(a+e,n.pages[s].size),s>=n.totalPages&&(n.totalPages=s+1),c-=e,s++,a=0,n.writing||setImmediate(n._triggerWrite.bind(n))}}async read(t,e){let n=new Uint8Array(t);return await this.readToBuffer(n,0,t,e),n}async readToBuffer(t,e,n,r){if(0==n)return;const i=this;if(n>i.pageSize*i.maxPagesLoaded*.8){const t=Math.floor(1.1*n);this.maxPagesLoaded=Math.floor(t/i.pageSize)+1}if(void 0===r&&(r=i.pos),i.pos=r+n,i.pendingClose)throw new Error("Reading a closing file");const o=Math.floor(r/i.pageSize),s=Math.floor((r+n-1)/i.pageSize),a=[];for(let t=o;t<=s;t++)a.push(i._loadPage(t));i._triggerLoad();let c=o,l=r%i.pageSize,u=r+n>i.totalSize?n-(r+n-i.totalSize):n;for(;u>0;){await a[c-o],i.__statusPage("After Await (read): ",c);const r=l+u>i.pageSize?i.pageSize-l:u,s=new Uint8Array(i.pages[c].buff.buffer,i.pages[c].buff.byteOffset+l,r);t.set(s,e+n-u),i.pages[c].pendingOps--,i.__statusPage("After Op done: ",c),u-=r,c++,l=0,i.pendingLoads.length>0&&setImmediate(i._triggerLoad.bind(i))}this.pos=r+n}_tryClose(){const t=this;if(!t.pendingClose)return;t.error&&t.pendingCloseReject(t.error);t._getDirtyPage()>=0||t.writing||t.reading||t.pendingLoads.length>0||t.pendingClose()}close(){const t=this;if(t.pendingClose)throw new Error("Closing the file twice");return new Promise((e,n)=>{t.pendingClose=e,t.pendingCloseReject=n,t._tryClose()}).then(()=>{t.fd.close()},e=>{throw t.fd.close(),e})}async discard(){await this.close(),await vT.promises.unlink(this.fileName)}async writeULE32(t,e){const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t,!0),await this.write(n,e)}async writeUBE32(t,e){const n=new Uint8Array(4);new DataView(n.buffer).setUint32(0,t,!1),await this.write(n,e)}async writeULE64(t,e){const n=new Uint8Array(8),r=new DataView(n.buffer);r.setUint32(0,4294967295&t,!0),r.setUint32(4,Math.floor(t/4294967296),!0),await this.write(n,e)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),n=new Uint32Array(e.buffer);return 4294967296*n[1]+n[0]}async readString(t){const e=this;if(e.pendingClose)throw new Error("Reading a closing file");let n=void 0===t?e.pos:t,r=Math.floor(n/e.pageSize),i=!1,o="";for(;!i;){let t=e._loadPage(r);e._triggerLoad(),await t,e.__statusPage("After Await (read): ",r);let s=n%e.pageSize;const a=new Uint8Array(e.pages[r].buff.buffer,e.pages[r].buff.byteOffset+s,e.pageSize-s);let c=a.findIndex(t=>0===t);i=-1!==c,i?(o+=(new TextDecoder).decode(a.slice(0,c)),e.pos=r*this.pageSize+s+c+1):(o+=(new TextDecoder).decode(a),e.pos=r*this.pageSize+s+a.length),e.pages[r].pendingOps--,e.__statusPage("After Op done: ",r),n=e.pos,r++,e.pendingLoads.length>0&&setImmediate(e._triggerLoad.bind(e))}return o}}const ST=new Uint8Array(4),_T=new DataView(ST.buffer),LT=new Uint8Array(8),xT=new DataView(LT.buffer);class RT{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t>this.allocSize){const e=Math.max(this.allocSize+(1<<20),Math.floor(1.1*this.allocSize),t),n=new Uint8Array(e);n.set(this.o.data),this.o.data=n,this.allocSize=e}}async write(t,e){if(void 0===e&&(e=this.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(e+t.byteLength),this.o.data.set(t.slice(),e),e+t.byteLength>this.totalSize&&(this.totalSize=e+t.byteLength),this.pos=e+t.byteLength}async readToBuffer(t,e,n,r){if(void 0===r&&(r=this.pos),this.readOnly&&r+n>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(r+n);const i=new Uint8Array(this.o.data.buffer,this.o.data.byteOffset+r,n);t.set(i,e),this.pos=r+n}async read(t,e){const n=new Uint8Array(t);return await this.readToBuffer(n,0,t,e),n}close(){this.o.data.byteLength!=this.totalSize&&(this.o.data=this.o.data.slice(0,this.totalSize))}async discard(){}async writeULE32(t,e){_T.setUint32(0,t,!0),await this.write(ST,e)}async writeUBE32(t,e){_T.setUint32(0,t,!1),await this.write(ST,e)}async writeULE64(t,e){xT.setUint32(0,4294967295&t,!0),xT.setUint32(4,Math.floor(t/4294967296),!0),await this.write(LT,e)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),n=new Uint32Array(e.buffer);return 4294967296*n[1]+n[0]}async readString(t){const e=this;let n=void 0===t?e.pos:t;if(n>this.totalSize){if(this.readOnly)throw new Error("Reading out of bounds");this._resizeIfNeeded(t)}const r=new Uint8Array(e.o.data.buffer,n,this.totalSize-n);let i=r.findIndex(t=>0===t),o="";return-1!==i?(o=(new TextDecoder).decode(r.slice(0,i)),e.pos=n+i+1):e.pos=n,o}}const FT=1<<22;const kT=new Uint8Array(4),OT=new DataView(kT.buffer),QT=new Uint8Array(8),UT=new DataView(QT.buffer);class PT{constructor(){this.pageSize=16384}_resizeIfNeeded(t){if(t<=this.totalSize)return;if(this.readOnly)throw new Error("Reading out of file bounds");const e=Math.floor((t-1)/FT)+1;for(let n=Math.max(this.o.data.length-1,0);n<e;n++){const r=new Uint8Array(n<e-1?FT:t-(e-1)*FT);n==this.o.data.length-1&&r.set(this.o.data[n]),this.o.data[n]=r}this.totalSize=t}async write(t,e){const n=this;if(void 0===e&&(e=n.pos),this.readOnly)throw new Error("Writing a read only file");this._resizeIfNeeded(e+t.byteLength);let r=Math.floor(e/FT),i=e%FT,o=t.byteLength;for(;o>0;){const e=i+o>FT?FT-i:o,s=t.slice(t.byteLength-o,t.byteLength-o+e);new Uint8Array(n.o.data[r].buffer,i,e).set(s),o-=e,r++,i=0}this.pos=e+t.byteLength}async readToBuffer(t,e,n,r){const i=this;if(void 0===r&&(r=i.pos),this.readOnly&&r+n>this.totalSize)throw new Error("Reading out of bounds");this._resizeIfNeeded(r+n);let o=Math.floor(r/FT),s=r%FT,a=n;for(;a>0;){const r=s+a>FT?FT-s:a,c=new Uint8Array(i.o.data[o].buffer,s,r);t.set(c,e+n-a),a-=r,o++,s=0}this.pos=r+n}async read(t,e){const n=new Uint8Array(t);return await this.readToBuffer(n,0,t,e),n}close(){}async discard(){}async writeULE32(t,e){OT.setUint32(0,t,!0),await this.write(kT,e)}async writeUBE32(t,e){OT.setUint32(0,t,!1),await this.write(kT,e)}async writeULE64(t,e){UT.setUint32(0,4294967295&t,!0),UT.setUint32(4,Math.floor(t/4294967296),!0),await this.write(QT,e)}async readULE32(t){const e=await this.read(4,t);return new Uint32Array(e.buffer)[0]}async readUBE32(t){const e=await this.read(4,t);return new DataView(e.buffer).getUint32(0,!1)}async readULE64(t){const e=await this.read(8,t),n=new Uint32Array(e.buffer);return 4294967296*n[1]+n[0]}async readString(t){const e=this;let n=void 0===t?e.pos:t;if(n>this.totalSize){if(this.readOnly)throw new Error("Reading out of bounds");this._resizeIfNeeded(t)}let r=!1,i="";for(;!r;){let t=Math.floor(n/FT),o=n%FT;if(void 0===e.o.data[t])throw new Error("ERROR");let s=Math.min(2048,e.o.data[t].length-o);const a=new Uint8Array(e.o.data[t].buffer,o,s);let c=a.findIndex(t=>0===t);r=-1!==c,r?(i+=(new TextDecoder).decode(a.slice(0,c)),e.pos=t*FT+o+c+1):(i+=(new TextDecoder).decode(a),e.pos=t*FT+o+a.length),n=e.pos}return i}}async function GT(t,e,n){if("string"==typeof t&&(t={type:"file",fileName:t,cacheSize:e||65536,pageSize:n||8192}),"file"==t.type)return await MT(t.fileName,1538,t.cacheSize,t.pageSize);if("mem"==t.type)return function(t){const e=t.initialSize||1<<20,n=new RT;return n.o=t,n.o.data=new Uint8Array(e),n.allocSize=e,n.totalSize=0,n.readOnly=!1,n.pos=0,n}(t);if("bigMem"==t.type)return function(t){const e=t.initialSize||0,n=new PT;n.o=t;const r=e?Math.floor((e-1)/FT)+1:0;n.o.data=[];for(let t=0;t<r-1;t++)n.o.data.push(new Uint8Array(FT));return r&&n.o.data.push(new Uint8Array(e-FT*(r-1))),n.totalSize=0,n.readOnly=!1,n.pos=0,n}(t);throw new Error("Invalid FastFile type: "+t.type)}async function VT(t,e,n){if(t instanceof Uint8Array&&(t={type:"mem",data:t}),"string"==typeof t){t={type:"mem",data:await fetch(t).then(function(t){return t.arrayBuffer()}).then(function(t){return new Uint8Array(t)})}}if("file"==t.type)return await MT(t.fileName,0,t.cacheSize,t.pageSize);if("mem"==t.type)return await function(t){const e=new RT;return e.o=t,e.allocSize=t.data.byteLength,e.totalSize=t.data.byteLength,e.readOnly=!0,e.pos=0,e}(t);if("bigMem"==t.type)return await function(t){const e=new PT;return e.o=t,e.totalSize=(t.data.length-1)*FT+t.data[t.data.length-1].byteLength,e.readOnly=!0,e.pos=0,e}(t);throw new Error("Invalid FastFile type: "+t.type)}async function jT(t,e,n,r,i){const o=await VT(t),s=await o.read(4);let a="";for(let t=0;t<4;t++)a+=String.fromCharCode(s[t]);if(a!=e)throw new Error(t+": Invalid File format");if(await o.readULE32()>n)throw new Error("Version not supported");const c=await o.readULE32();let l=[];for(let t=0;t<c;t++){let t=await o.readULE32(),e=await o.readULE64();void 0===l[t]&&(l[t]=[]),l[t].push({p:o.pos,size:e}),o.pos+=e}return{fd:o,sections:l}}async function HT(t,e,n,r,i,o){const s=await GT(t,i,o),a=new Uint8Array(4);for(let t=0;t<4;t++)a[t]=e.charCodeAt(t);return await s.write(a,0),await s.writeULE32(n),await s.writeULE32(r),s}async function YT(t,e){if(void 0!==t.writingSection)throw new Error("Already writing a section");await t.writeULE32(e),t.writingSection={pSectionSize:t.pos},await t.writeULE64(0)}async function zT(t){if(void 0===t.writingSection)throw new Error("Not writing a section");const e=t.pos-t.writingSection.pSectionSize-8,n=t.pos;t.pos=t.writingSection.pSectionSize,await t.writeULE64(e),t.pos=n,delete t.writingSection}async function JT(t,e,n){if(void 0!==t.readingSection)throw new Error("Already reading a section");if(!e[n])throw new Error(t.fileName+": Missing section "+n);if(e[n].length>1)throw new Error(t.fileName+": Section Duplicated "+n);t.pos=e[n][0].p,t.readingSection=e[n][0]}async function WT(t,e){if(void 0===t.readingSection)throw new Error("Not reading a section");if(!e&&t.pos-t.readingSection.p!=t.readingSection.size)throw new Error("Invalid section size reading");delete t.readingSection}async function qT(t,e,n,r){const i=new Uint8Array(n);bT.toRprLE(i,0,e,n),await t.write(i,r)}async function KT(t,e,n){const r=await t.read(e,n);return bT.fromRprLE(r,0,e)}async function ZT(t,e,n,r,i){void 0===i&&(i=e[r][0].size);const o=t.pageSize;await JT(t,e,r),await YT(n,r);for(let e=0;e<i;e+=o){const r=Math.min(i-e,o),s=await t.read(r);await n.write(s)}await zT(n),await WT(t,i!=e[r][0].size)}async function XT(t,e,n,r,i){if((r=void 0===r?0:r)+(i=void 0===i?e[n][0].size-r:i)>e[n][0].size)throw new Error("Reading out of the range of the section");let o;return o=i<1<<30?new Uint8Array(i):new HC(i),await t.readToBuffer(o,0,i,e[n][0].p+r),o}async function $T(t,e,n,r,i){const o=16*t.pageSize;if(await JT(t,e,i),await JT(n,r,i),e[i][0].size!=r[i][0].size)return!1;const s=e[i][0].size;for(let e=0;e<s;e+=o){const r=Math.min(s-e,o),i=await t.read(r),a=await n.read(r);for(let t=0;t<r;t++)if(i[t]!=a[t])return!1}return await WT(t),await WT(n),!0}const tb=bT.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),eb=bT.e("21888242871839275222246405745257275088548364400416034343698204186575808495617"),nb=bT.e("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab",16),rb=bT.e("21888242871839275222246405745257275088696311157297823662689037894645226208583");async function ib(t,e){let n,r=e&&e.singleThread;if(bT.eq(t,eb))n=await BT(r);else{if(!bT.eq(t,tb))throw new Error(`Curve not supported: ${bT.toString(t)}`);n=await IT(r)}return n}async function ob(t,e){let n,r=e&&e.singleThread;if(bT.eq(t,rb))n=await BT(r);else{if(!bT.eq(t,nb))throw new Error(`Curve not supported: ${bT.toString(t)}`);n=await IT(r)}return n}async function sb(t,e){let n,r=e&&e.singleThread;const i=t.toUpperCase().match(/[A-Za-z0-9]+/g).join("");if(["BN128","BN254","ALTBN128"].indexOf(i)>=0)n=await BT(r);else{if(!(["BLS12381"].indexOf(i)>=0))throw new Error(`Curve not supported: ${t}`);n=await IT(r)}return n}function ab(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function cb(t,...e){if(!((n=t)instanceof Uint8Array||null!=n&&"object"==typeof n&&"Uint8Array"===n.constructor.name))throw new Error("Uint8Array expected");var n;if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function lb(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 ub(t,e){cb(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}
|
|
113
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hb=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),db=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],pb=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,fb=db?t=>t:t=>pb(t);function gb(t){for(let e=0;e<t.length;e++)t[e]=pb(t[e])}function Ab(t){return"string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),cb(t),t}class Eb{clone(){return this._cloneInto()}}function mb(t){const e=(e,n)=>t(n).update(Ab(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}const wb=new Uint8Array([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]);class yb extends Eb{constructor(t,e,n={},r,i,o){if(super(),this.blockLen=t,this.outputLen=e,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,ab(t),ab(e),ab(r),e<0||e>r)throw new Error("outputLen bigger than keyLen");if(void 0!==n.key&&(n.key.length<1||n.key.length>r))throw new Error(`key must be up 1..${r} byte long or undefined`);if(void 0!==n.salt&&n.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(void 0!==n.personalization&&n.personalization.length!==o)throw new Error(`personalization must be ${o} byte long or undefined`);this.buffer32=hb(this.buffer=new Uint8Array(t))}update(t){lb(this);const{blockLen:e,buffer:n,buffer32:r}=this,i=(t=Ab(t)).length,o=t.byteOffset,s=t.buffer;for(let a=0;a<i;){this.pos===e&&(db||gb(r),this.compress(r,0,!1),db||gb(r),this.pos=0);const c=Math.min(e-this.pos,i-a),l=o+a;if(c===e&&!(l%4)&&a+c<i){const t=new Uint32Array(s,l,Math.floor((i-a)/4));db||gb(t);for(let n=0;a+e<i;n+=r.length,a+=e)this.length+=e,this.compress(t,n,!1);db||gb(t);continue}n.set(t.subarray(a,a+c),this.pos),this.pos+=c,this.length+=c,a+=c}return this}digestInto(t){lb(this),ub(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,this.buffer.subarray(e).fill(0),db||gb(n),this.compress(n,0,!0),db||gb(n);const r=hb(t);this.get().forEach((t,e)=>r[e]=fb(t))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:r,destroyed:i,outputLen:o,pos:s}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=r,t.destroyed=i,t.outputLen=o,t.buffer.set(e),t.pos=s,t}}const Bb=BigInt(2**32-1),Ib=BigInt(32);function Cb(t,e=!1){return e?{h:Number(t&Bb),l:Number(t>>Ib&Bb)}:{h:0|Number(t>>Ib&Bb),l:0|Number(t&Bb)}}function Tb(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=Cb(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]}const bb=(t,e,n)=>t<<n|e>>>32-n,Db=(t,e,n)=>e<<n|t>>>32-n,vb=(t,e,n)=>e<<n-32|t>>>64-n,Mb=(t,e,n)=>t<<n-32|e>>>64-n;var Nb={fromBig:Cb,split:Tb,toBig:(t,e)=>BigInt(t>>>0)<<Ib|BigInt(e>>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:bb,rotlSL:Db,rotlBH:vb,rotlBL:Mb,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)};const Sb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),_b=new Uint32Array(32);function Lb(t,e,n,r,i,o){const s=i[o],a=i[o+1];let c=_b[2*t],l=_b[2*t+1],u=_b[2*e],h=_b[2*e+1],d=_b[2*n],p=_b[2*n+1],f=_b[2*r],g=_b[2*r+1],A=Nb.add3L(c,u,s);l=Nb.add3H(A,l,h,a),c=0|A,({Dh:g,Dl:f}={Dh:g^l,Dl:f^c}),({Dh:g,Dl:f}={Dh:Nb.rotr32H(g,f),Dl:Nb.rotr32L(g,f)}),({h:p,l:d}=Nb.add(p,d,g,f)),({Bh:h,Bl:u}={Bh:h^p,Bl:u^d}),({Bh:h,Bl:u}={Bh:Nb.rotrSH(h,u,24),Bl:Nb.rotrSL(h,u,24)}),_b[2*t]=c,_b[2*t+1]=l,_b[2*e]=u,_b[2*e+1]=h,_b[2*n]=d,_b[2*n+1]=p,_b[2*r]=f,_b[2*r+1]=g}function xb(t,e,n,r,i,o){const s=i[o],a=i[o+1];let c=_b[2*t],l=_b[2*t+1],u=_b[2*e],h=_b[2*e+1],d=_b[2*n],p=_b[2*n+1],f=_b[2*r],g=_b[2*r+1],A=Nb.add3L(c,u,s);l=Nb.add3H(A,l,h,a),c=0|A,({Dh:g,Dl:f}={Dh:g^l,Dl:f^c}),({Dh:g,Dl:f}={Dh:Nb.rotrSH(g,f,16),Dl:Nb.rotrSL(g,f,16)}),({h:p,l:d}=Nb.add(p,d,g,f)),({Bh:h,Bl:u}={Bh:h^p,Bl:u^d}),({Bh:h,Bl:u}={Bh:Nb.rotrBH(h,u,63),Bl:Nb.rotrBL(h,u,63)}),_b[2*t]=c,_b[2*t+1]=l,_b[2*e]=u,_b[2*e+1]=h,_b[2*n]=d,_b[2*n+1]=p,_b[2*r]=f,_b[2*r+1]=g}class Rb extends yb{constructor(t={}){super(128,void 0===t.dkLen?64:t.dkLen,t,64,16,16),this.v0l=0|Sb[0],this.v0h=0|Sb[1],this.v1l=0|Sb[2],this.v1h=0|Sb[3],this.v2l=0|Sb[4],this.v2h=0|Sb[5],this.v3l=0|Sb[6],this.v3h=0|Sb[7],this.v4l=0|Sb[8],this.v4h=0|Sb[9],this.v5l=0|Sb[10],this.v5h=0|Sb[11],this.v6l=0|Sb[12],this.v6h=0|Sb[13],this.v7l=0|Sb[14],this.v7h=0|Sb[15];const e=t.key?t.key.length:0;if(this.v0l^=this.outputLen|e<<8|65536|1<<24,t.salt){const e=hb(Ab(t.salt));this.v4l^=fb(e[0]),this.v4h^=fb(e[1]),this.v5l^=fb(e[2]),this.v5h^=fb(e[3])}if(t.personalization){const e=hb(Ab(t.personalization));this.v6l^=fb(e[0]),this.v6h^=fb(e[1]),this.v7l^=fb(e[2]),this.v7h^=fb(e[3])}if(t.key){const e=new Uint8Array(this.blockLen);e.set(Ab(t.key)),this.update(e)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:r,v2l:i,v2h:o,v3l:s,v3h:a,v4l:c,v4h:l,v5l:u,v5h:h,v6l:d,v6h:p,v7l:f,v7h:g}=this;return[t,e,n,r,i,o,s,a,c,l,u,h,d,p,f,g]}set(t,e,n,r,i,o,s,a,c,l,u,h,d,p,f,g){this.v0l=0|t,this.v0h=0|e,this.v1l=0|n,this.v1h=0|r,this.v2l=0|i,this.v2h=0|o,this.v3l=0|s,this.v3h=0|a,this.v4l=0|c,this.v4h=0|l,this.v5l=0|u,this.v5h=0|h,this.v6l=0|d,this.v6h=0|p,this.v7l=0|f,this.v7h=0|g}compress(t,e,n){this.get().forEach((t,e)=>_b[e]=t),_b.set(Sb,16);let{h:r,l:i}=Nb.fromBig(BigInt(this.length));_b[24]=Sb[8]^i,_b[25]=Sb[9]^r,n&&(_b[28]=~_b[28],_b[29]=~_b[29]);let o=0;const s=wb;for(let n=0;n<12;n++)Lb(0,4,8,12,t,e+2*s[o++]),xb(0,4,8,12,t,e+2*s[o++]),Lb(1,5,9,13,t,e+2*s[o++]),xb(1,5,9,13,t,e+2*s[o++]),Lb(2,6,10,14,t,e+2*s[o++]),xb(2,6,10,14,t,e+2*s[o++]),Lb(3,7,11,15,t,e+2*s[o++]),xb(3,7,11,15,t,e+2*s[o++]),Lb(0,5,10,15,t,e+2*s[o++]),xb(0,5,10,15,t,e+2*s[o++]),Lb(1,6,11,12,t,e+2*s[o++]),xb(1,6,11,12,t,e+2*s[o++]),Lb(2,7,8,13,t,e+2*s[o++]),xb(2,7,8,13,t,e+2*s[o++]),Lb(3,4,9,14,t,e+2*s[o++]),xb(3,4,9,14,t,e+2*s[o++]);this.v0l^=_b[0]^_b[16],this.v0h^=_b[1]^_b[17],this.v1l^=_b[2]^_b[18],this.v1h^=_b[3]^_b[19],this.v2l^=_b[4]^_b[20],this.v2h^=_b[5]^_b[21],this.v3l^=_b[6]^_b[22],this.v3h^=_b[7]^_b[23],this.v4l^=_b[8]^_b[24],this.v4h^=_b[9]^_b[25],this.v5l^=_b[10]^_b[26],this.v5h^=_b[11]^_b[27],this.v6l^=_b[12]^_b[28],this.v6h^=_b[13]^_b[29],this.v7l^=_b[14]^_b[30],this.v7h^=_b[15]^_b[31],_b.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Fb=mb(t=>new Rb(t));function kb(t){return(4294901760&t?(t&=4294901760,16):0)|(4278255360&t?(t&=4278255360,8):0)|(4042322160&t?(t&=4042322160,4):0)|(3435973836&t?(t&=3435973836,2):0)|!!(2863311530&t)}function Ob(t,e){const n=new DataView(t.buffer,t.byteOffset,t.byteLength);let r="";for(let t=0;t<4;t++){t>0&&(r+="\n"),r+="\t\t";for(let e=0;e<4;e++)e>0&&(r+=" "),r+=n.getUint32(16*t+4*e).toString(16).padStart(8,"0")}return e&&(r=e+"\n"+r),r}function Qb(t,e){if(t.byteLength!=e.byteLength)return!1;for(var n=new Int8Array(t),r=new Int8Array(e),i=0;i!=t.byteLength;i++)if(n[i]!=r[i])return!1;return!0}function Ub(t){return t.clone()}async function Pb(t,e,n,r,i){if(t.G1.isZero(e))return!1;if(t.G1.isZero(n))return!1;if(t.G2.isZero(r))return!1;if(t.G2.isZero(i))return!1;return await t.pairingEq(e,i,t.G1.neg(n),r)}function Gb(){return window.prompt("Enter a random text. (Entropy): ","")}function Vb(t){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),e}async function jb(t){{const e=await globalThis.crypto.subtle.digest("SHA-256",t.buffer);return new Uint8Array(e)}}function Hb(t,e){return new DataView(t.buffer).getUint32(e,!1)}async function Yb(t){for(;!t;)t=await Gb();const e=Fb.create(64);e.update(Vb(64));const n=new TextEncoder;e.update(n.encode(t));const r=e.digest(),i=[];for(let t=0;t<8;t++)i[t]=Hb(r,4*t);return new ZB(i)}async function zb(t,e){let n,r;e<32?(n=1<<e>>>0,r=1):(n=4294967296,r=1<<e-32>>>0);let i=t;for(let t=0;t<r;t++)for(let t=0;t<n;t++)i=await jb(i);const o=new DataView(i.buffer,i.byteOffset,i.byteLength),s=[];for(let t=0;t<8;t++)s[t]=o.getUint32(4*t,!1);return new ZB(s)}function Jb(t){return t instanceof Uint8Array?t:("0x"==t.slice(0,2)&&(t=t.slice(2)),new Uint8Array(t.match(/[\da-f]{2}/gi).map(function(t){return parseInt(t,16)})))}function Wb(t){return Array.prototype.map.call(t,function(t){return("0"+(255&t).toString(16)).slice(-2)}).join("")}const qb=10;async function Kb(t,e){await YT(t,1),await t.writeULE32(1),await zT(t);const n=await ob(e.q);await YT(t,2);const r=n.q,i=8*(Math.floor((bT.bitLength(r)-1)/64)+1),o=n.r,s=8*(Math.floor((bT.bitLength(o)-1)/64)+1);await t.writeULE32(i),await qT(t,r,i),await t.writeULE32(s),await qT(t,o,s),await t.writeULE32(e.nVars),await t.writeULE32(e.nPublic),await t.writeULE32(e.domainSize),await Zb(t,n,e.vk_alpha_1),await Zb(t,n,e.vk_beta_1),await Xb(t,n,e.vk_beta_2),await Xb(t,n,e.vk_gamma_2),await Zb(t,n,e.vk_delta_1),await Xb(t,n,e.vk_delta_2),await zT(t)}async function Zb(t,e,n){const r=new Uint8Array(2*e.G1.F.n8);e.G1.toRprLEM(r,0,n),await t.write(r)}async function Xb(t,e,n){const r=new Uint8Array(2*e.G2.F.n8);e.G2.toRprLEM(r,0,n),await t.write(r)}async function $b(t,e,n){const r=await t.read(2*e.G1.F.n8),i=e.G1.fromRprLEM(r,0);return n?e.G1.toObject(i):i}async function tD(t,e,n){const r=await t.read(2*e.G2.F.n8),i=e.G2.fromRprLEM(r,0);return n?e.G2.toObject(i):i}async function eD(t,e,n,r){await JT(t,e,1);const i=await t.readULE32();if(await WT(t),1===i)return await async function(t,e,n,r){const i={protocol:"groth16"};await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.curve=await ob(i.q,r),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.vk_alpha_1=await $b(t,i.curve,n),i.vk_beta_1=await $b(t,i.curve,n),i.vk_beta_2=await tD(t,i.curve,n),i.vk_gamma_2=await tD(t,i.curve,n),i.vk_delta_1=await $b(t,i.curve,n),i.vk_delta_2=await tD(t,i.curve,n),await WT(t),i}(t,e,n,r);if(2===i)return await async function(t,e,n,r){const i={protocol:"plonk"};await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.curve=await ob(i.q,r),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.nAdditions=await t.readULE32(),i.nConstraints=await t.readULE32(),i.k1=await t.read(s),i.k2=await t.read(s),i.Qm=await $b(t,i.curve,n),i.Ql=await $b(t,i.curve,n),i.Qr=await $b(t,i.curve,n),i.Qo=await $b(t,i.curve,n),i.Qc=await $b(t,i.curve,n),i.S1=await $b(t,i.curve,n),i.S2=await $b(t,i.curve,n),i.S3=await $b(t,i.curve,n),i.X_2=await tD(t,i.curve,n),await WT(t),i}(t,e,n,r);if(10===i)return await async function(t,e,n,r){const i={protocol:"fflonk"};i.protocolId=qb,await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o),i.curve=await ob(i.q,r);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.nAdditions=await t.readULE32(),i.nConstraints=await t.readULE32(),i.k1=await t.read(s),i.k2=await t.read(s),i.w3=await t.read(s),i.w4=await t.read(s),i.w8=await t.read(s),i.wr=await t.read(s),i.X_2=await tD(t,i.curve,n),i.C0=await $b(t,i.curve,n),await WT(t),i}(t,e,n,r);throw new Error("Protocol not supported: ")}async function nD(t,e,n){const r={delta:{}};r.deltaAfter=await $b(t,e,n),r.delta.g1_s=await $b(t,e,n),r.delta.g1_sx=await $b(t,e,n),r.delta.g2_spx=await tD(t,e,n),r.transcript=await t.read(64),r.type=await t.readULE32();const i=await t.readULE32(),o=t.pos;let s=0;for(;t.pos-o<i;){const e=await t.read(1);if(e[0]<=s)throw new Error("Parameters in the contribution must be sorted");if(s=e[0],1==e[0]){const e=await t.read(1),n=await t.read(e[0]);r.name=(new TextDecoder).decode(n)}else if(2==e[0]){const e=await t.read(1);r.numIterationsExp=e[0]}else{if(3!=e[0])throw new Error("Parameter not recognized");{const e=await t.read(1);r.beaconHash=await t.read(e[0])}}}if(t.pos!=o+i)throw new Error("Parameters do not match");return r}async function rD(t,e,n){await JT(t,n,10);const r={contributions:[]};r.csHash=await t.read(64);const i=await t.readULE32();for(let n=0;n<i;n++){const n=await nD(t,e);r.contributions.push(n)}return await WT(t),r}async function iD(t,e,n){await Zb(t,e,n.deltaAfter),await Zb(t,e,n.delta.g1_s),await Zb(t,e,n.delta.g1_sx),await Xb(t,e,n.delta.g2_spx),await t.write(n.transcript),await t.writeULE32(n.type||0);const r=[];if(n.name){r.push(1);const t=new TextEncoder("utf-8").encode(n.name.substring(0,64));r.push(t.byteLength);for(let e=0;e<t.byteLength;e++)r.push(t[e])}if(1==n.type){r.push(2),r.push(n.numIterationsExp),r.push(3),r.push(n.beaconHash.byteLength);for(let t=0;t<n.beaconHash.byteLength;t++)r.push(n.beaconHash[t])}if(r.length>0){const e=new Uint8Array(r);await t.writeULE32(e.byteLength),await t.write(e)}else await t.writeULE32(0)}async function oD(t,e,n){await YT(t,10),await t.write(n.csHash),await t.writeULE32(n.contributions.length);for(let r=0;r<n.contributions.length;r++)await iD(t,e,n.contributions[r]);await zT(t)}function sD(t,e,n){const r=new Uint8Array(2*e.G1.F.n8);e.G1.toRprUncompressed(r,0,n),t.update(r)}function aD(t,e,n){sD(t,e,n.deltaAfter),sD(t,e,n.delta.g1_s),sD(t,e,n.delta.g1_sx),function(t,e,n){const r=new Uint8Array(2*e.G2.F.n8);e.G2.toRprUncompressed(r,0,n),t.update(r)}(t,e,n.delta.g2_spx),t.update(n.transcript)}async function cD(t,e){await JT(t,e,1);const n=await t.readULE32(),r=await KT(t,n),i=await t.readULE32();return await WT(t),{n8:n,q:r,nWitness:i}}const{stringifyBigInts:lD}=DT;async function uD(t,e,n,r){const{fd:i,sections:o}=await jT(e,"wtns",2),s=await cD(i,o),{fd:a,sections:c}=await jT(t,"zkey",2),l=await eD(a,c,void 0,r);if("groth16"!=l.protocol)throw new Error("zkey file is not groth16");if(!bT.eq(l.r,s.q))throw new Error("Curve of the witness does not match the curve of the proving key");if(s.nWitness!=l.nVars)throw new Error(`Invalid witness length. Circuit: ${l.nVars}, witness: ${s.nWitness}`);const u=l.curve,h=u.Fr,d=u.G1,p=u.G2,f=kb(l.domainSize);n&&n.debug("Reading Wtns");const g=await XT(i,o,2);n&&n.debug("Reading Coeffs");const A=await XT(a,c,4);n&&n.debug("Building ABC");const[E,m,w]=await async function(t,e,n,r,i){const o=t.Fr.n8,s=12+e.n8r,a=(r.byteLength-4)/s,c=new HC(e.domainSize*o),l=new HC(e.domainSize*o),u=new HC(e.domainSize*o),h=[c,l];for(let e=0;e<a;e++){i&&e%1e6==0&&i.debug(`QAP AB: ${e}/${a}`);const c=r.slice(4+e*s,4+e*s+s),l=new DataView(c.buffer),u=l.getUint32(0,!0),d=l.getUint32(4,!0),p=l.getUint32(8,!0),f=c.slice(12,12+o);h[u].set(t.Fr.add(h[u].slice(d*o,d*o+o),t.Fr.mul(f,n.slice(p*o,p*o+o))),d*o)}for(let n=0;n<e.domainSize;n++)i&&n%1e6==0&&i.debug(`QAP C: ${n}/${e.domainSize}`),u.set(t.Fr.mul(c.slice(n*o,n*o+o),l.slice(n*o,n*o+o)),n*o);return[c,l,u]}(u,l,g,A,n),y=f==h.s?u.Fr.shift:u.Fr.w[f+1],B=await h.ifft(E,"","",n,"IFFT_A"),I=await h.batchApplyKey(B,h.e(1),y),C=await h.fft(I,"","",n,"FFT_A"),T=await h.ifft(m,"","",n,"IFFT_B"),b=await h.batchApplyKey(T,h.e(1),y),D=await h.fft(b,"","",n,"FFT_B"),v=await h.ifft(w,"","",n,"IFFT_C"),M=await h.batchApplyKey(v,h.e(1),y),N=await h.fft(M,"","",n,"FFT_C");n&&n.debug("Join ABC");const S=await async function(t,e,n,r,i,o){const s=1<<22,a=t.Fr.n8,c=Math.floor(n.byteLength/t.Fr.n8),l=[];for(let e=0;e<c;e+=s){o&&o.debug(`JoinABC: ${e}/${c}`);const u=Math.min(c-e,s),h=[],d=n.slice(e*a,(e+u)*a),p=r.slice(e*a,(e+u)*a),f=i.slice(e*a,(e+u)*a);h.push({cmd:"ALLOCSET",var:0,buff:d}),h.push({cmd:"ALLOCSET",var:1,buff:p}),h.push({cmd:"ALLOCSET",var:2,buff:f}),h.push({cmd:"ALLOC",var:3,len:u*a}),h.push({cmd:"CALL",fnName:"qap_joinABC",params:[{var:0},{var:1},{var:2},{val:u},{var:3}]}),h.push({cmd:"CALL",fnName:"frm_batchFromMontgomery",params:[{var:3},{val:u},{var:3}]}),h.push({cmd:"GET",out:0,var:3,len:u*a}),l.push(t.tm.queueAction(h))}const u=await Promise.all(l);let h;h=n instanceof HC?new HC(n.byteLength):new Uint8Array(n.byteLength);let d=0;for(let t=0;t<u.length;t++)h.set(u[t][0],d),d+=u[t][0].byteLength;return h}(u,0,C,D,N,n);let _={};n&&n.debug("Reading A Points");const L=await XT(a,c,5);_.pi_a=await u.G1.multiExpAffine(L,g,n,"multiexp A"),n&&n.debug("Reading B1 Points");const x=await XT(a,c,6);let R=await u.G1.multiExpAffine(x,g,n,"multiexp B1");n&&n.debug("Reading B2 Points");const F=await XT(a,c,7);_.pi_b=await u.G2.multiExpAffine(F,g,n,"multiexp B2"),n&&n.debug("Reading C Points");const k=await XT(a,c,8);_.pi_c=await u.G1.multiExpAffine(k,g.slice((l.nPublic+1)*u.Fr.n8),n,"multiexp C"),n&&n.debug("Reading H Points");const O=await XT(a,c,9),Q=await u.G1.multiExpAffine(O,S,n,"multiexp H"),U=u.Fr.random(),P=u.Fr.random();_.pi_a=d.add(_.pi_a,l.vk_alpha_1),_.pi_a=d.add(_.pi_a,d.timesFr(l.vk_delta_1,U)),_.pi_b=p.add(_.pi_b,l.vk_beta_2),_.pi_b=p.add(_.pi_b,p.timesFr(l.vk_delta_2,P)),R=d.add(R,l.vk_beta_1),R=d.add(R,d.timesFr(l.vk_delta_1,P)),_.pi_c=d.add(_.pi_c,Q),_.pi_c=d.add(_.pi_c,d.timesFr(_.pi_a,P)),_.pi_c=d.add(_.pi_c,d.timesFr(R,U)),_.pi_c=d.add(_.pi_c,d.timesFr(l.vk_delta_1,h.neg(h.mul(U,P))));let G=[];for(let t=1;t<=l.nPublic;t++){const e=g.slice(t*h.n8,t*h.n8+h.n8);G.push(bT.fromRprLE(e))}return _.pi_a=d.toObject(d.toAffine(_.pi_a)),_.pi_b=p.toObject(p.toAffine(_.pi_b)),_.pi_c=d.toObject(d.toAffine(_.pi_c)),_.protocol="groth16",_.curve=u.name,await a.close(),await i.close(),_=lD(_),G=lD(G),{proof:_,publicSignals:G}}function hD(t){let e=[];return function t(e,n){if(Array.isArray(n))for(let r=0;r<n.length;r++)t(e,n[r]);else e.push(n)}(e,t),e}function dD(t,e){let n=BigInt(t)%e;return n<0&&(n+=e),n}function pD(t){const e=BigInt(2)**BigInt(64);let n=BigInt("0xCBF29CE484222325");for(let r=0;r<t.length;r++)n^=BigInt(t[r].charCodeAt(0)),n*=BigInt(1099511628211),n%=e;let r=n.toString(16),i=16-r.length;return r="0".repeat(i).concat(r),r}function fD(t,e){const n=[];let r=BigInt(t);const i=BigInt(4294967296);for(;r;)n.unshift(Number(r%i)),r/=i;if(e){let t=e-n.length;for(;t>0;)n.unshift(0),t--}return n}async function gD(t,e){let n,r,i;e=e||{};let o=1,s=0,a=0,c=!1;if(t instanceof WebAssembly.Instance)n=t,c=!0;else{let c=32767;if(e.memorySize&&(c=parseInt(e.memorySize),c<0))throw new Error("Invalid memory size");let l=!1;for(;!l;)try{i=new WebAssembly.Memory({initial:c}),l=!0}catch(t){if(c<=1)throw t;console.warn("Could not allocate "+1024*c*64+" bytes. This may cause severe instability. Trying with "+1024*c*64/2+" bytes"),c=Math.floor(c/2)}const d=await WebAssembly.compile(t);let p="",f="";n=await WebAssembly.instantiate(d,{env:{memory:i},runtime:{printDebug:function(t){console.log("printDebug:",t)},exceptionHandler:function(t){let e;throw e=1===t?"Signal not found. ":2===t?"Too many signals set. ":3===t?"Signal already set. ":4===t?"Assert Failed. ":5===t?"Not enough memory. ":6===t?"Input signal array access exceeds the size. ":"Unknown error. ",console.error("ERROR: ",t,p),new Error(e+p)},printErrorMessage:function(){p+=u()+"\n"},writeBufferMessage:function(){const t=u();"\n"===t?(console.log(f),f=""):(""!==f&&(f+=" "),f+=t)},showSharedRWMemory:function(){const t=n.exports.getFieldNumLen32(),e=new Uint32Array(t);for(let r=0;r<t;r++)e[t-1-r]=n.exports.readSharedRWMemory(r);if(o>=2&&(s>=1||a>=7)){""!==f&&(f+=" ");const t=bT.fromArray(e,4294967296).toString();f+=t}else console.log(bT.fromArray(e,4294967296))},error:function(t,n,i,o,s,a){let c;throw c=7===t?h(n)+" "+r.getFr(o).toString()+" != "+r.getFr(s).toString()+" "+h(a):9===t?h(n)+" "+r.getFr(o).toString()+" "+h(s):5===t&&e.sym?h(n)+" "+e.sym.labelIdx2Name[s]:h(n)+" "+i+" "+o+" "+s+" "+a,console.log("ERROR: ",t,c),new Error(c)},log:function(t){console.log(r.getFr(t).toString())},logGetSignal:function(t,n){e.logGetSignal&&e.logGetSignal(t,r.getFr(n))},logSetSignal:function(t,n){e.logSetSignal&&e.logSetSignal(t,r.getFr(n))},logStartComponent:function(t){e.logStartComponent&&e.logStartComponent(t)},logFinishComponent:function(t){e.logFinishComponent&&e.logFinishComponent(t)}}})}"function"==typeof n.exports.getVersion&&(o=n.exports.getVersion()),"function"==typeof n.exports.getMinorVersion&&(s=n.exports.getMinorVersion()),"function"==typeof n.exports.getPatchVersion&&(a=n.exports.getPatchVersion());const l=e&&(e.sanityCheck||e.logGetSignal||e.logSetSignal||e.logStartComponent||e.logFinishComponent);if(2===o)r=new ED(n,l);else{if(1!==o)throw new Error(`Unsupported circom version: ${o}`);if(c)throw new Error("Loading code from WebAssembly instance is not supported for circom version 1");r=new AD(i,n,l)}return r;function u(){let t="",e=n.exports.getMessageChar();for(;0!==e;)t+=String.fromCharCode(e),e=n.exports.getMessageChar();return t}function h(t){const e=new Uint8Array(i.buffer),n=[];for(let r=0;e[t+r]>0;r++)n.push(e[t+r]);return String.fromCharCode.apply(null,n)}}class AD{constructor(t,e,n){this.memory=t,this.i32=new Uint32Array(t.buffer),this.instance=e,this.n32=(this.instance.exports.getFrLen()>>2)-2;const r=this.instance.exports.getPRawPrime(),i=new Array(this.n32);for(let t=0;t<this.n32;t++)i[this.n32-1-t]=this.i32[(r>>2)+t];this.prime=bT.fromArray(i,4294967296),this.Fr=new iI(this.prime),this.mask32=bT.fromString("FFFFFFFF",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(bT.shiftLeft(1,64*this.n64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=n}circom_version(){return 1}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);const n=this.allocInt(),r=this.allocFr();Object.keys(t).forEach(e=>{const i=pD(e),o=parseInt(i.slice(0,8),16),s=parseInt(i.slice(8,16),16);try{this.instance.exports.getSignalOffset32(n,0,o,s)}catch(t){throw new Error(`Signal ${e} is not an input of the circuit.`)}const a=this.getInt(n),c=hD(t[e]);for(let t=0;t<c.length;t++)this.setFr(r,c[t]),this.instance.exports.setSignal(0,0,a+t,r)})}async calculateWitness(t,e){const n=this,r=n.i32[0],i=[];await n._doCalculateWitness(t,e);for(let t=0;t<n.NVars;t++){const e=n.instance.exports.getPWitness(t);i.push(n.getFr(e))}return n.i32[0]=r,i}async calculateBinWitness(t,e){const n=this,r=n.i32[0];await n._doCalculateWitness(t,e);const i=n.instance.exports.getWitnessBuffer();n.i32[0]=r;const o=n.memory.buffer.slice(i,i+n.NVars*n.n64*8);return new Uint8Array(o)}allocInt(){const t=this.i32[0];return this.i32[0]=t+8,t}allocFr(){const t=this.i32[0];return this.i32[0]=t+4*this.n32+8,t}getInt(t){return this.i32[t>>2]}setInt(t,e){this.i32[t>>2]=e}getFr(t){const e=this,n=t>>2;if(2147483648&e.i32[n+1]){const t=new Array(e.n32);for(let r=0;r<e.n32;r++)t[e.n32-1-r]=e.i32[n+2+r];const i=e.Fr.e(bT.fromArray(t,4294967296));return 1073741824&e.i32[n+1]?(r=i,e.Fr.mul(e.RInv,r)):i}return 2147483648&e.i32[n]?e.Fr.e(e.i32[n]-4294967296):e.Fr.e(e.i32[n]);var r}setFr(t,e){const n=this;e=n.Fr.e(e);const r=n.Fr.neg(n.Fr.e("80000000",16)),i=n.Fr.e("7FFFFFFF",16);if(n.Fr.geq(e,r)&&n.Fr.leq(e,i)){let i;return n.Fr.geq(e,n.Fr.zero)?i=bT.toNumber(e):(i=bT.toNumber(n.Fr.sub(e,r)),i-=2147483648,i=4294967296+i),n.i32[t>>2]=i,void(n.i32[1+(t>>2)]=0)}n.i32[t>>2]=0,n.i32[1+(t>>2)]=2147483648;const o=bT.toArray(e,4294967296);for(let e=0;e<n.n32;e++){const r=o.length-1-e;n.i32[2+(t>>2)+e]=r>=0?o[r]:0}}}class ED{constructor(t,e){this.instance=t,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();const n=new Uint32Array(this.n32);for(let t=0;t<this.n32;t++)n[this.n32-1-t]=this.instance.exports.readSharedRWMemory(t);this.prime=bT.fromArray(n,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=e}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);const n=Object.keys(t);let r=0;if(n.forEach(e=>{const n=pD(e),i=parseInt(n.slice(0,8),16),o=parseInt(n.slice(8,16),16),s=hD(t[e]);if("function"==typeof this.instance.exports.getInputSignalSize){let t=this.instance.exports.getInputSignalSize(i,o);if(t<0)throw new Error(`Signal ${e} not found\n`);if(s.length<t)throw new Error(`Not enough values for input signal ${e}\n`);if(s.length>t)throw new Error(`Too many values for input signal ${e}\n`)}for(let t=0;t<s.length;t++){const e=fD(dD(s[t],this.prime),this.n32);for(let t=0;t<this.n32;t++)this.instance.exports.writeSharedRWMemory(t,e[this.n32-1-t]);try{this.instance.exports.setInputSignal(i,o,t),r++}catch(t){throw new Error(t)}}}),r<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${r} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(t,e){const n=[];await this._doCalculateWitness(t,e);for(let t=0;t<this.witnessSize;t++){this.instance.exports.getWitness(t);const e=new Uint32Array(this.n32);for(let t=0;t<this.n32;t++)e[this.n32-1-t]=this.instance.exports.readSharedRWMemory(t);n.push(bT.fromArray(e,4294967296))}return n}async calculateWTNSBin(t,e){const n=new Uint32Array(this.witnessSize*this.n32+this.n32+11),r=new Uint8Array(n.buffer);await this._doCalculateWitness(t,e),r[0]="w".charCodeAt(0),r[1]="t".charCodeAt(0),r[2]="n".charCodeAt(0),r[3]="s".charCodeAt(0),n[1]=2,n[2]=2,n[3]=1;const i=4*this.n32,o=(8+i).toString(16);n[4]=parseInt(o.slice(0,8),16),n[5]=parseInt(o.slice(8,16),16),n[6]=i,this.instance.exports.getRawPrime();let s=7;for(let t=0;t<this.n32;t++)n[s+t]=this.instance.exports.readSharedRWMemory(t);s+=this.n32,n[s]=this.witnessSize,s++,n[s]=2,s++;const a=(i*this.witnessSize).toString(16);n[s]=parseInt(a.slice(0,8),16),n[s+1]=parseInt(a.slice(8,16),16),s+=2;for(let t=0;t<this.witnessSize;t++){this.instance.exports.getWitness(t);for(let t=0;t<this.n32;t++)n[s+t]=this.instance.exports.readSharedRWMemory(t);s+=this.n32}return r}}const{unstringifyBigInts:mD}=DT;async function wD(t,e,n,r){const i=mD(t),o=await VT(e),s=await o.read(o.totalSize);await o.close();const a=await gD(s,r);if(1===a.circom_version()){const t=await a.calculateBinWitness(i),e=await HT(n,"wtns",2,2);await async function(t,e,n){await YT(t,1);const r=8*(Math.floor((bT.bitLength(n)-1)/64)+1);if(await t.writeULE32(r),await qT(t,n,r),e.byteLength%r!=0)throw new Error("Invalid witness length");await t.writeULE32(e.byteLength/r),await zT(t),await YT(t,2),await t.write(e),await zT(t)}(e,t,a.prime),await e.close()}else{const t=await GT(n),e=await a.calculateWTNSBin(i);await t.write(e),await t.close()}}const{unstringifyBigInts:yD}=DT;const{unstringifyBigInts:BD}=DT;function ID(t,e){return bT.geq(e,0)&&bT.lt(e,t.r)}const{unstringifyBigInts:CD}=DT;function TD(t){let e=t.toString(16);for(;e.length<64;)e="0"+e;return e=`"0x${e}"`,e}var bD=Object.freeze({__proto__:null,fullProve:async function(t,e,n,r,i,o){const s=yD(t),a={type:"mem"};return await wD(s,e,a,i),await uD(n,a,r,o)},prove:uD,verify:async function(t,e,n,r){const i=BD(t),o=BD(n),s=BD(e),a=await sb(i.curve),c=a.G1.fromObject(i.IC[0]),l=new Uint8Array(2*a.G1.F.n8*s.length),u=new Uint8Array(a.Fr.n8*s.length);if(!function(t,e){for(let n=0;n<e.length;n++)if(!ID(t,e[n]))return!1;return!0}(a,s))return r&&r.error("Public inputs are not valid."),!1;for(let t=0;t<s.length;t++){const e=a.G1.fromObject(i.IC[t+1]);l.set(e,t*a.G1.F.n8*2),bT.toRprLE(u,a.Fr.n8*t,s[t],a.Fr.n8)}let h=await a.G1.multiExpAffine(l,u);h=a.G1.add(h,c);const d=a.G1.fromObject(o.pi_a),p=a.G2.fromObject(o.pi_b),f=a.G1.fromObject(o.pi_c);if(!function(t,e){const n=t.G1,r=t.G2;return n.isValid(e.pi_a)&&r.isValid(e.pi_b)&&n.isValid(e.pi_c)}(a,{pi_a:d,pi_b:p,pi_c:f}))return r&&r.error("Proof commitments are not valid."),!1;const g=a.G2.fromObject(i.vk_gamma_2),A=a.G2.fromObject(i.vk_delta_2),E=a.G1.fromObject(i.vk_alpha_1),m=a.G2.fromObject(i.vk_beta_2);return await a.pairingEq(a.G1.neg(d),p,h,g,f,A,E,m)?(r&&r.info("OK!"),!0):(r&&r.error("Invalid proof"),!1)},exportSolidityCallData:async function(t,e){const n=CD(t),r=CD(e);let i,o="";for(let t=0;t<r.length;t++)""!=o&&(o+=","),o+=TD(r[t]);return i=`[${TD(n.pi_a[0])}, ${TD(n.pi_a[1])}],[[${TD(n.pi_b[0][1])}, ${TD(n.pi_b[0][0])}],[${TD(n.pi_b[1][1])}, ${TD(n.pi_b[1][0])}]],[${TD(n.pi_c[0])}, ${TD(n.pi_c[1])}],[${o}]`,i}});function DD(t,e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(let t=0;t<8;t++)r[t]=n.getUint32(4*t);const i=new ZB(r);return t.G2.fromRng(i)}async function vD(t,e){if(!e[1])throw new Error(t.fileName+": File has no header");if(e[1].length>1)throw new Error(t.fileName+": File has more than one header");t.pos=e[1][0].p;const n=await t.readULE32(),r=await t.read(n),i=bT.fromRprLE(r),o=await ob(i);if(8*o.F1.n64!=n)throw new Error(t.fileName+": Invalid size");const s=await t.readULE32(),a=await t.readULE32();if(t.pos-e[1][0].p!=e[1][0].size)throw new Error("Invalid PTau header size");return{curve:o,power:s,ceremonyPower:a}}async function MD(t,e,n,r,i,o,s,a,c,l){const u=i[o],h=2*u.F.n8,d=e[r][0].size/h;await JT(t,e,r),await YT(n,r);let p=s;for(let e=0;e<d;e+=65536){l&&l.debug(`Applying key: ${c}: ${e}/${d}`);const r=Math.min(d-e,65536);let o;o=await t.read(r*h),o=await u.batchApplyKey(o,p,a),await n.write(o),p=i.Fr.mul(p,i.Fr.exp(a,r))}await zT(n),await WT(t)}async function ND(t,e,n,r,i,o,s,a,c,l,u){const h=r[i],d=2*h.F.n8,p=Math.floor((1<<20)/d);let f=s;for(let i=0;i<o;i+=p){u&&u.debug(`Applying key ${l}: ${i}/${o}`);const s=Math.min(o-i,p),g=await t.read(s*d),A=await h.batchUtoLEM(g),E=await h.batchApplyKey(A,f,a);let m;m="COMPRESSED"==c?await h.batchLEMtoC(E):await h.batchLEMtoU(E),n&&n.update(m),await e.write(m),f=r.Fr.mul(f,r.Fr.exp(a,s))}}const SD=262144,_D={get:function(t,e){return isNaN(e)?t[e]:t.getElement(e)},set:function(t,e,n){return isNaN(e)?(t[e]=n,!0):t.setElement(e,n)}};class LD{constructor(t){this.length=t||0,this.arr=new Array(SD);for(let e=0;e<t;e+=SD)this.arr[e/SD]=new Array(Math.min(SD,t-e));return this}push(){for(let t=0;t<arguments.length;t++)this.setElement(this.length,arguments[t])}slice(t,e){const n=new Array(e-t);for(let r=t;r<e;r++)n[r-t]=this.getElement(r);return n}getElement(t){t=parseInt(t);const e=Math.floor(t/SD),n=t%SD;return this.arr[e]?this.arr[e][n]:void 0}setElement(t,e){t=parseInt(t);const n=Math.floor(t/SD);this.arr[n]||(this.arr[n]=new Array(SD));const r=t%SD;return this.arr[n][r]=e,t>=this.length&&(this.length=t+1),!0}getKeys(){const t=new xD;for(let e=0;e<this.arr.length;e++)if(this.arr[e])for(let n=0;n<this.arr[e].length;n++)void 0!==this.arr[e][n]&&t.push(e*SD+n);return t}}class xD{constructor(t){const e=new LD(t);return new Proxy(e,_D)}}var RD=xD;async function FD(t,e,n){let r;r="object"==typeof n?n:void 0===n?{singleThread:!1}:{singleThread:n};const i={};if(await JT(t,e,1),i.n8=await t.readULE32(),i.prime=await KT(t,i.n8),r.F){if(r.F.p!=i.prime)throw new Error("Different Prime");i.F=r.F}else if(r.getFieldFromPrime)i.F=await r.getFieldFromPrime(i.prime,r.singleThread);else if(r.getCurveFromPrime)i.curve=await r.getCurveFromPrime(i.prime,r.singleThread),i.F=i.curve.Fr;else try{i.curve=await async function(t,e,n){let r;if(LB(t,TT))r=await BT(e,n);else{if(!LB(t,CT))throw new Error(`Curve not supported: ${PB(t)}`);r=await IT(e,n)}return r}(i.prime,r.singleThread),i.F=i.curve.Fr}catch(t){i.F=new iI(i.prime)}return i.nVars=await t.readULE32(),i.nOutputs=await t.readULE32(),i.nPubInputs=await t.readULE32(),i.nPrvInputs=await t.readULE32(),i.nLabels=await t.readULE64(),i.nConstraints=await t.readULE32(),i.useCustomGates=void 0!==e[4]&&null!==e[4]&&void 0!==e[5]&&null!==e[5],await WT(t),i}async function kD(t,e,n){if("object"!=typeof n)throw new Error("readR1csFd: options must be an object");n.loadConstraints=!("loadConstraints"in n)||n.loadConstraints,n.loadMap="loadMap"in n&&n.loadMap,n.loadCustomGates=!("loadCustomGates"in n)||n.loadCustomGates;const r=await FD(t,e,n);return n.loadConstraints&&(r.constraints=await async function(t,e,n,r,i){let o;o="object"==typeof r?r:void 0===r?{}:{logger:r,loggerCtx:i};const s=await XT(t,e,2);let a,c=0;a=n.nConstraints>1<<20?new RD:[];for(let t=0;t<n.nConstraints;t++){o.logger&&t%1e5==0&&o.logger.info(`${o.loggerCtx}: Loading constraints: ${t}/${n.nConstraints}`);const e=l();a.push(e)}return a;function l(){const t=[];return t[0]=u(),t[1]=u(),t[2]=u(),t}function u(){const t={},e=s.slice(c,c+4);c+=4;const r=new DataView(e.buffer).getUint32(0,!0),i=s.slice(c,c+(4+n.n8)*r);c+=(4+n.n8)*r;const o=new DataView(i.buffer);for(let e=0;e<r;e++){const r=o.getUint32(e*(4+n.n8),!0),s=n.F.fromRprLE(i,e*(4+n.n8)+4);t[r]=s}return t}}(t,e,r,n)),n.loadMap&&(r.map=await async function(t,e,n,r,i){let o;o="object"==typeof r?r:void 0===r?{}:{logger:r,loggerCtx:i};const s=await XT(t,e,3);let a,c=0;a=n.nVars>1<<20?new RD:[];for(let t=0;t<n.nVars;t++){o.logger&&t%1e4==0&&o.logger.info(`${o.loggerCtx}: Loading map: ${t}/${n.nVars}`);const e=l();a.push(e)}return a;function l(){const t=s.slice(c,c+8);c+=8;const e=new DataView(t.buffer),n=e.getUint32(0,!0);return 4294967296*e.getUint32(4,!0)+n}}(t,e,r,n)),n.loadCustomGates&&(r.useCustomGates?(r.customGates=await async function(t,e,n){await JT(t,e,4);let r=await t.readULE32(),i=[];for(let e=0;e<r;e++){let e={};e.templateName=await t.readString();let r=await t.readULE32();e.parameters=Array(r);let o=await t.read(n.n8*r);for(let t=0;t<r;t++)e.parameters[t]=n.F.fromRprLE(o,t*n.n8,n.n8);i.push(e)}return await WT(t),i}(t,e,r),r.customGatesUses=await async function(t,e,n){const r=await XT(t,e,5),i=new Uint32Array(r.buffer,r.byteOffset,r.byteLength/4),o=i[0];let s,a=1;s=o>1<<20?new RD:[];for(let t=0;t<o;t++){n.logger&&t%1e5==0&&n.logger.info(`${n.loggerCtx}: Loading custom gate uses: ${t}/${o}`);let e={};e.id=i[a++];let r=i[a++];e.signals=[];for(let t=0;t<r;t++){const t=i[a++],n=i[a++];e.signals.push(4294967296*n+t)}s.push(e)}return s}(t,e,n)):(r.customGates=[],r.customGatesUses=[])),r}bT.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),bT.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");async function OD(t){const e={labelIdx2Name:["one"],varIdx2Name:["one"],componentIdx2Name:[]},n=await VT(t),r=await n.read(n.totalSize),i=new TextDecoder("utf-8").decode(r).split("\n");for(let t=0;t<i.length;t++){const n=i[t].split(",");4==n.length&&(e.varIdx2Name[n[1]]?e.varIdx2Name[n[1]]+="|"+n[3]:e.varIdx2Name[n[1]]=n[3],e.labelIdx2Name[n[0]]=n[3],e.componentIdx2Name[n[2]]||(e.componentIdx2Name[n[2]]=o(n[3])))}return await n.close(),e;function o(t){const e=t.split(".");return e.pop(),e.join(".")}}const{unstringifyBigInts:QD}=DT;var UD=Object.freeze({__proto__:null,calculate:wD,debug:async function(t,e,n,r,i,o){const s=QD(t),a=await VT(e),c=await a.read(a.totalSize);await a.close();const l={...i,sanityCheck:!0};let u=await OD(r);i.set&&(u||(u=await OD(r)),l.logSetSignal=function(t,e){o&&o.info("SET "+u.labelIdx2Name[t]+" <-- "+e.toString())}),i.get&&(u||(u=await OD(r)),l.logGetSignal=function(t,e){o&&o.info("GET "+u.labelIdx2Name[t]+" --\x3e "+e.toString())}),i.trigger&&(u||(u=await OD(r)),l.logStartComponent=function(t){o&&o.info("START: "+u.componentIdx2Name[t])},l.logFinishComponent=function(t){o&&o.info("FINISH: "+u.componentIdx2Name[t])}),l.sym=u;const h=await gD(c,l),d=await h.calculateWitness(s,!0),p=await HT(n,"wtns",2,2);await async function(t,e,n){await YT(t,1);const r=8*(Math.floor((bT.bitLength(n)-1)/64)+1);await t.writeULE32(r),await qT(t,n,r),await t.writeULE32(e.length),await zT(t),await YT(t,2);for(let n=0;n<e.length;n++)await qT(t,e[n],r);await zT(t)}(p,d,h.prime),await p.close()},exportJson:async function(t){return await async function(t){const{fd:e,sections:n}=await jT(t,"wtns",2),{n8:r,nWitness:i}=await cD(e,n);await JT(e,n,2);const o=[];for(let t=0;t<i;t++){const t=await KT(e,r);o.push(t)}return await WT(e),await e.close(),o}(t)},check:async function(t,e,n){n&&n.info("WITNESS CHECKING STARTED"),n&&n.info("> Reading r1cs file");const{fd:r,sections:i}=await jT(t,"r1cs",1),o=await kD(r,i,{loadConstraints:!1,loadCustomGates:!1});n&&n.info("> Reading witness file");const{fd:s,sections:a}=await jT(e,"wtns",2),c=await cD(s,a);if(!bT.eq(o.prime,c.q))throw new Error("Curve of the witness does not match the curve of the proving key");const l=await XT(s,a,2);await s.close();const u=(await ib(o.prime)).Fr,h=u.n8,d=await XT(r,i,2);n&&(n.info("----------------------------"),n.info(" WITNESS CHECK"),n.info(` Curve: ${o.curve.name}`),n.info(` Vars (wires): ${o.nVars}`),n.info(` Outputs: ${o.nOutputs}`),n.info(` Public Inputs: ${o.nPubInputs}`),n.info(` Private Inputs: ${o.nPrvInputs}`),n.info(` Labels: ${o.nLabels}`),n.info(` Constraints: ${o.nConstraints}`),n.info(` Custom Gates: ${o.useCustomGates}`),n.info("----------------------------")),n&&n.info("> Checking witness correctness");let p=0,f=!0;for(let t=0;t<o.nConstraints;t++){n&&0!==t&&t%5e5==0&&n.info(`··· processing r1cs constraints ${t}/${o.nConstraints}`);const e=A(),r=A(),i=A(),s=g(e),a=g(r),c=g(i);if(!u.eq(u.sub(u.mul(s,a),c),u.zero)){n.warn("··· aborting checking process at constraint "+t),f=!1;break}}return r.close(),n&&(f?(n.info("WITNESS IS CORRECT"),n.info("WITNESS CHECKING FINISHED SUCCESSFULLY")):(n.warn("WITNESS IS NOT CORRECT"),n.warn("WITNESS CHECKING FINISHED UNSUCCESSFULLY"))),f;function g(t){let e=u.zero;return Object.keys(t).forEach(n=>{const r=function(t){return u.fromRprLE(l.slice(t*h,t*h+h))}(n),i=t[n];e=u.add(e,u.mul(r,i))}),e}function A(){const t={},e=d.slice(p,p+4);p+=4;const n=new DataView(e.buffer).getUint32(0,!0),r=d.slice(p,p+(4+o.n8)*n);p+=(4+o.n8)*n;const i=new DataView(r.buffer);for(let e=0;e<n;e++){const n=i.getUint32(e*(4+o.n8),!0),s=o.F.fromRprLE(r,e*(4+o.n8)+4);t[n]=s}return t}}});const PD=262144,GD={get:function(t,e){return isNaN(e)?t[e]:t.getElement(e)},set:function(t,e,n){return isNaN(e)?(t[e]=n,!0):t.setElement(e,n)}};class VD{constructor(t){this.length=t||0,this.arr=new Array(PD);for(let e=0;e<t;e+=PD)this.arr[e/PD]=new Array(Math.min(PD,t-e));return this}push(){for(let t=0;t<arguments.length;t++)this.setElement(this.length,arguments[t])}slice(t,e){const n=new Array(e-t);for(let r=t;r<e;r++)n[r-t]=this.getElement(r);return n}getElement(t){t=parseInt(t);const e=Math.floor(t/PD),n=t%PD;return this.arr[e]?this.arr[e][n]:void 0}setElement(t,e){t=parseInt(t);const n=Math.floor(t/PD);this.arr[n]||(this.arr[n]=new Array(PD));const r=t%PD;return this.arr[n][r]=e,t>=this.length&&(this.length=t+1),!0}getKeys(){const t=new jD;for(let e=0;e<this.arr.length;e++)if(this.arr[e])for(let n=0;n<this.arr[e].length;n++)void 0!==this.arr[e][n]&&t.push(e*PD+n);return t}}class jD{constructor(t){const e=new VD(t);return new Proxy(e,GD)}}var HD=jD;async function YD(t,e,n,r){const i=Fb.create({dkLen:64}),{fd:o,sections:s}=await jT(e,"ptau",1),{curve:a,power:c}=await vD(o,s),{fd:l,sections:u}=await jT(t,"r1cs",1),h=await FD(l,u,!1),d=await HT(n,"zkey",1,10,1<<22,1<<24),p=2*a.G1.F.n8,f=2*a.G2.F.n8;if(h.prime!=a.r)return r&&r.error("r1cs curve does not match powers of tau ceremony curve"),-1;const g=kb(h.nConstraints+h.nPubInputs+h.nOutputs+1-1)+1;if(g>c)return r&&r.error(`circuit too big for this power of tau ceremony. ${h.nConstraints}*2 > 2**${c}`),-1;if(!s[12])return r&&r.error("Powers of tau is not prepared."),-1;const A=h.nOutputs+h.nPubInputs,E=2**g;await YT(d,1),await d.writeULE32(1),await zT(d),await YT(d,2);const m=a.q,w=8*(Math.floor((bT.bitLength(m)-1)/64)+1),y=a.r,B=8*(Math.floor((bT.bitLength(y)-1)/64)+1),I=bT.mod(bT.shl(1,8*B),y),C=a.Fr.e(bT.mod(bT.mul(I,I),y));let T,b,D;await d.writeULE32(w),await qT(d,m,w),await d.writeULE32(B),await qT(d,y,B),await d.writeULE32(h.nVars),await d.writeULE32(A),await d.writeULE32(E),T=await o.read(p,s[4][0].p),await d.write(T),T=await a.G1.batchLEMtoU(T),i.update(T),b=await o.read(p,s[5][0].p),await d.write(b),b=await a.G1.batchLEMtoU(b),i.update(b),D=await o.read(f,s[6][0].p),await d.write(D),D=await a.G2.batchLEMtoU(D),i.update(D);const v=new Uint8Array(p);a.G1.toRprLEM(v,0,a.G1.g);const M=new Uint8Array(f);a.G2.toRprLEM(M,0,a.G2.g);const N=new Uint8Array(p);a.G1.toRprUncompressed(N,0,a.G1.g);const S=new Uint8Array(f);a.G2.toRprUncompressed(S,0,a.G2.g),await d.write(M),await d.write(v),await d.write(M),i.update(S),i.update(N),i.update(S),await zT(d),r&&r.info("Reading r1cs");let _=await XT(l,u,2);const L=new HD(h.nVars),x=new HD(h.nVars),R=new HD(h.nVars),F=new HD(h.nVars-A-1),k=new Array(A+1);r&&r.info("Reading tauG1");let O=await XT(o,s,12,(E-1)*p,E*p);r&&r.info("Reading tauG2");let Q=await XT(o,s,13,(E-1)*f,E*f);r&&r.info("Reading alphatauG1");let U=await XT(o,s,14,(E-1)*p,E*p);r&&r.info("Reading betatauG1");let P=await XT(o,s,15,(E-1)*p,E*p);await async function(){const t=new Uint8Array(12+a.Fr.n8),e=new DataView(t.buffer),n=new Uint8Array(a.Fr.n8);a.Fr.toRprLE(n,0,a.Fr.e(1));let i=0;function o(){const t=_.slice(i,i+4);i+=4;return new DataView(t.buffer).getUint32(0,!0)}const s=new HD;for(let t=0;t<h.nConstraints;t++){r&&t%1e4==0&&r.debug(`processing constraints: ${t}/${h.nConstraints}`);const e=o();for(let n=0;n<e;n++){const e=o(),n=i;i+=a.Fr.n8;const r=0,c=p*t,l=3,u=p*t;void 0===L[e]&&(L[e]=[]),L[e].push([r,c,n]),e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([l,u,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([l,u,n])),s.push([0,t,e,n])}const n=o();for(let e=0;e<n;e++){const e=o(),n=i;i+=a.Fr.n8;const r=0,c=p*t,l=1,u=f*t,h=2,d=p*t;void 0===x[e]&&(x[e]=[]),x[e].push([r,c,n]),void 0===R[e]&&(R[e]=[]),R[e].push([l,u,n]),e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([h,d,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([h,d,n])),s.push([1,t,e,n])}const c=o();for(let e=0;e<c;e++){const e=o(),n=i;i+=a.Fr.n8;const r=0,s=p*t;e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([r,s,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([r,s,n]))}}for(let t=0;t<=A;t++){const e=0,n=p*(h.nConstraints+t),r=3,i=p*(h.nConstraints+t);void 0===L[t]&&(L[t]=[]),L[t].push([e,n,-1]),void 0===k[t]&&(k[t]=[]),k[t].push([r,i,-1]),s.push([0,h.nConstraints+t,t,-1])}await YT(d,4);const c=new HC(s.length*(12+a.Fr.n8)+4),l=new Uint8Array(4);new DataView(l.buffer).setUint32(0,s.length,!0),c.set(l);let u=4;for(let t=0;t<s.length;t++)r&&t%1e5==0&&r.debug(`writing coeffs: ${t}/${s.length}`),g(s[t]);function g(r){let i;e.setUint32(0,r[0],!0),e.setUint32(4,r[1],!0),e.setUint32(8,r[2],!0),i=r[3]>=0?a.Fr.fromRprLE(_.slice(r[3],r[3]+a.Fr.n8),0):a.Fr.fromRprLE(n,0);const o=a.Fr.mul(i,C);a.Fr.toRprLE(t,12,o),c.set(t,u),u+=t.length}await d.write(c),await zT(d)}(),await V(3,"G1",k,"IC"),await async function(){await YT(d,9);const t=new HC(E*p);if(g<a.Fr.s){let e=await XT(o,s,12,(2*E-1)*p,2*E*p);for(let n=0;n<E;n++){r&&n%1e4==0&&r.debug(`splitting buffer: ${n}/${E}`);const i=e.slice((2*n+1)*p,(2*n+1)*p+p);t.set(i,n*p)}}else{if(g!=a.Fr.s)throw r&&r.error("Circuit too big"),new Error("Circuit too big for this curve");{const e=s[12][0].p+(2**(g+1)-1)*p;await o.readToBuffer(t,0,E*p,e+E*p)}}await d.write(t),await zT(d)}(),await async function(){z(E-1);for(let t=0;t<E-1;t+=16384){r&&r.debug(`HashingHPoints: ${t}/${E}`);const e=Math.min(E-1,16384);await H(t,e)}}(),await V(8,"G1",F,"C"),await V(5,"G1",L,"A"),await V(6,"G1",x,"B1"),await V(7,"G2",R,"B2");const G=i.digest();return await YT(d,10),await d.write(G),await d.writeULE32(0),await zT(d),r&&r.info(Ob(G,"Circuit hash: ")),await d.close(),await l.close(),await o.close(),G;async function V(t,e,n,o){const s=a[e];z(n.length),await YT(d,t);let c=[],l=0;for(;l<n.length;){let t=0;for(;l<n.length&&t<a.tm.concurrency;){r&&r.debug(`Writing points start ${o}: ${l}/${n.length}`);let i=1,s=n[l]?n[l].length:0;for(;l+i<n.length&&s+(n[l+i]?n[l+i].length:0)<32768&&i<32768;)s+=n[l+i]?n[l+i].length:0,i++;const a=n.slice(l,l+i),u=l;c.push(j(e,a,r,o).then(t=>(r&&r.debug(`Writing points end ${o}: ${u}/${n.length}`),t))),l+=i,t++}const u=await Promise.all(c);for(let t=0;t<u.length;t++){await d.write(u[t][0]);const e=await s.batchLEMtoU(u[t][0]);i.update(e)}c=[]}await zT(d)}async function j(t,e,n,r){const i=a[t],o=2*i.F.n8,s=3*i.F.n8,c=2*i.F.n8;let l,u,h,d;if("G1"==t)l="g1m_timesScalarAffine",u="g1m_multiexpAffine",h="g1m_batchToAffine",d="g1m_zero";else{if("G2"!=t)throw new Error("Invalid group");l="g2m_timesScalarAffine",u="g2m_multiexpAffine",h="g2m_batchToAffine",d="g2m_zero"}let p,f,g=0;for(let t=0;t<e.length;t++)g+=e[t]?e[t].length:0;g>32768?(p=new HC(g*o),f=new HC(g*a.Fr.n8)):(p=new Uint8Array(g*o),f=new Uint8Array(g*a.Fr.n8));let A=0,E=0;const m=[O,Q,U,P],w=new Uint8Array(a.Fr.n8);a.Fr.toRprLE(w,0,a.Fr.e(1));let y=0;for(let t=0;t<e.length;t++)if(e[t])for(let i=0;i<e[t].length;i++)n&&i&&i%1e4==0&&n.debug(`Configuring big array ${r}: ${i}/${e[t].length}`),p.set(m[e[t][i][0]].slice(e[t][i][1],e[t][i][1]+o),y*o),e[t][i][2]>=0?f.set(_.slice(e[t][i][2],e[t][i][2]+a.Fr.n8),y*a.Fr.n8):f.set(w,y*a.Fr.n8),y++;if(e.length>1){const t=[];t.push({cmd:"ALLOCSET",var:0,buff:p}),t.push({cmd:"ALLOCSET",var:1,buff:f}),t.push({cmd:"ALLOC",var:2,len:e.length*s}),A=0,E=0;let n=0;for(let r=0;r<e.length;r++)e[r]?(1==e[r].length?t.push({cmd:"CALL",fnName:l,params:[{var:0,offset:A},{var:1,offset:E},{val:a.Fr.n8},{var:2,offset:n}]}):t.push({cmd:"CALL",fnName:u,params:[{var:0,offset:A},{var:1,offset:E},{val:a.Fr.n8},{val:e[r].length},{var:2,offset:n}]}),A+=o*e[r].length,E+=a.Fr.n8*e[r].length,n+=s):(t.push({cmd:"CALL",fnName:d,params:[{var:2,offset:n}]}),n+=s);t.push({cmd:"CALL",fnName:h,params:[{var:2},{val:e.length},{var:2}]}),t.push({cmd:"GET",out:0,var:2,len:e.length*c});return await a.tm.queueAction(t)}{let t=await i.multiExpAffine(p,f,n,r);return t=[i.toAffine(t)],t}}async function H(t,e){const n=await o.read(e*p,s[2][0].p+(t+E)*p),r=await o.read(e*p,s[2][0].p+t*p),c=a.tm.concurrency,l=Math.floor(e/c),u=[];for(let t=0;t<c;t++){let i;if(i=t<c-1?l:e-t*l,0==i)continue;const o=n.slice(t*l*p,(t*l+i)*p),s=r.slice(t*l*p,(t*l+i)*p);u.push(Y(o,s))}const h=await Promise.all(u);for(let t=0;t<h.length;t++)i.update(h[t][0])}async function Y(t,e){const n=t.byteLength/p,r=3*a.G1.F.n8,i=[];i.push({cmd:"ALLOCSET",var:0,buff:t}),i.push({cmd:"ALLOCSET",var:1,buff:e}),i.push({cmd:"ALLOC",var:2,len:n*r});for(let t=0;t<n;t++)i.push({cmd:"CALL",fnName:"g1m_subAffine",params:[{var:0,offset:t*p},{var:1,offset:t*p},{var:2,offset:t*r}]});i.push({cmd:"CALL",fnName:"g1m_batchToAffine",params:[{var:2},{val:n},{var:2}]}),i.push({cmd:"CALL",fnName:"g1m_batchLEMtoU",params:[{var:2},{val:n},{var:2}]}),i.push({cmd:"GET",out:0,var:2,len:n*p});return await a.tm.queueAction(i)}function z(t){const e=new Uint8Array(4);new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t,!1),i.update(e)}}const zD=Pb;async function JD(t,e,n,r){let i;const{fd:o,sections:s}=await jT(n,"zkey",2),a=await eD(o,s,!1);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=2*c.G1.F.n8,u=await rD(o,c,s),h=Fb.create({dkLen:64});h.update(u.csHash);let d=c.G1.g;for(let t=0;t<u.contributions.length;t++){const e=u.contributions[t],n=Ub(h);if(sD(n,c,e.delta.g1_s),sD(n,c,e.delta.g1_sx),!Qb(n.digest(),e.transcript))return console.log(`INVALID(${t}): Inconsistent transcript `),!1;const r=DD(c,e.transcript);if(i=await zD(c,e.delta.g1_s,e.delta.g1_sx,r,e.delta.g2_spx),!0!==i)return console.log(`INVALID(${t}): public key G1 and G2 do not have the same ration `),!1;if(i=await zD(c,d,e.deltaAfter,r,e.delta.g2_spx),!0!==i)return console.log(`INVALID(${t}): deltaAfter does not fillow the public key `),!1;if(1==e.type){const n=await zb(e.beaconHash,e.numIterationsExp),r=c.Fr.fromRng(n),i=c.G1.toAffine(c.G1.fromRng(n)),o=c.G1.toAffine(c.G1.timesFr(i,r));if(!0!==c.G1.eq(i,e.delta.g1_s))return console.log(`INVALID(${t}): Key of the beacon does not match. g1_s `),!1;if(!0!==c.G1.eq(o,e.delta.g1_sx))return console.log(`INVALID(${t}): Key of the beacon does not match. g1_sx `),!1}aD(h,c,e);const o=Fb.create({dkLen:64});aD(o,c,e),e.contributionHash=o.digest(),d=e.deltaAfter}const{fd:p,sections:f}=await jT(t,"zkey",2),g=await eD(p,f,!1);if("groth16"!=g.protocol)throw new Error("zkeyinit file is not groth16");if(!bT.eq(g.q,a.q)||!bT.eq(g.r,a.r)||g.n8q!=a.n8q||g.n8r!=a.n8r)return r&&r.error("INVALID: Different curves"),!1;if(g.nVars!=a.nVars||g.nPublic!=a.nPublic||g.domainSize!=a.domainSize)return r&&r.error("INVALID: Different circuit parameters"),!1;if(!c.G1.eq(a.vk_alpha_1,g.vk_alpha_1))return r&&r.error("INVALID: Invalid alpha1"),!1;if(!c.G1.eq(a.vk_beta_1,g.vk_beta_1))return r&&r.error("INVALID: Invalid beta1"),!1;if(!c.G2.eq(a.vk_beta_2,g.vk_beta_2))return r&&r.error("INVALID: Invalid beta2"),!1;if(!c.G2.eq(a.vk_gamma_2,g.vk_gamma_2))return r&&r.error("INVALID: Invalid gamma2"),!1;if(!c.G1.eq(a.vk_delta_1,d))return r&&r.error("INVALID: Invalid delta1"),!1;if(i=await zD(c,c.G1.g,d,c.G2.g,a.vk_delta_2),!0!==i)return r&&r.error("INVALID: Invalid delta2"),!1;const A=await rD(p,c,f);if(!Qb(u.csHash,A.csHash))return r&&r.error("INVALID: Circuit does not match"),!1;if(s[8][0].size!=l*(a.nVars-a.nPublic-1))return r&&r.error("INVALID: Invalid L section size"),!1;if(s[9][0].size!=l*a.domainSize)return r&&r.error("INVALID: Invalid H section size"),!1;let E;if(E=await $T(o,s,p,f,3),!E)return r&&r.error("INVALID: IC section is not identical"),!1;if(E=await $T(o,s,p,f,4),!E)return r&&r.error("Coeffs section is not identical"),!1;if(E=await $T(o,s,p,f,5),!E)return r&&r.error("A section is not identical"),!1;if(E=await $T(o,s,p,f,6),!E)return r&&r.error("B1 section is not identical"),!1;if(E=await $T(o,s,p,f,7),!E)return r&&r.error("B2 section is not identical"),!1;if(i=await async function(t,e,n,o,s,a,l,u,h){const d=1<<20,p=c[t],f=2*p.F.n8;await JT(e,n,a),await JT(o,s,a);let g=p.zero,A=p.zero;const E=n[a][0].size/f;for(let t=0;t<E;t+=d){r&&r.debug(`Same ratio check ${h}: ${t}/${E}`);const n=Math.min(E-t,d),i=await e.read(n*f),s=await o.read(n*f),a=Vb(4*n),c=await p.multiExpAffine(i,a),l=await p.multiExpAffine(s,a);g=p.add(g,c),A=p.add(A,l)}return await WT(e),await WT(o),0==E||(i=await zD(c,g,A,l,u),!0===i)}("G1",p,f,o,s,8,a.vk_delta_2,g.vk_delta_2,"L section"),!0!==i)return r&&r.error("L section does not match"),!1;if(i=await async function(){const t=1<<20,n=c.G1,l=c.Fr,u=2*n.F.n8,{fd:h,sections:d}=await jT(e,"ptau",1);let p=new HC(a.domainSize*a.n8r);const f=new Array(8);for(let t=0;t<8;t++)f[t]=Hb(Vb(4),0);const A=new ZB(f);for(let t=0;t<a.domainSize-1;t++){const e=l.fromRng(A);l.toRprLE(p,t*a.n8r,e)}l.toRprLE(p,(a.domainSize-1)*a.n8r,l.zero);let E,w=n.zero;for(let e=0;e<a.domainSize;e+=t){r&&r.debug(`H Verification(tau): ${e}/${a.domainSize}`);const i=Math.min(a.domainSize-e,t),o=await h.read(u*i,d[2][0].p+a.domainSize*u+e*u),s=await h.read(u*i,d[2][0].p+e*u),c=await m(o,s),l=p.slice(e*a.n8r,(e+i)*a.n8r),f=await n.multiExpAffine(c,l);w=n.add(w,f)}if(p=await l.batchToMontgomery(p),a.power<l.s)E=l.neg(l.e(2));else{const t=2**l.s,e=l.exp(l.shift,t);E=l.sub(e,l.one)}const y=a.power<l.s?l.w[a.power+1]:l.shift;p=await l.batchApplyKey(p,E,y),p=await l.fft(p),p=await l.batchFromMontgomery(p),await JT(o,s,9);let B=n.zero;for(let e=0;e<a.domainSize;e+=t){r&&r.debug(`H Verification(lagrange): ${e}/${a.domainSize}`);const i=Math.min(a.domainSize-e,t),s=await o.read(u*i),c=p.slice(e*a.n8r,(e+i)*a.n8r),l=await n.multiExpAffine(s,c);B=n.add(B,l)}return await WT(o),i=await zD(c,w,B,a.vk_delta_2,g.vk_delta_2),!0===i}(),!0!==i)return r&&r.error("H section does not match"),!1;r&&r.info(Ob(u.csHash,"Circuit Hash: ")),await o.close(),await p.close();for(let t=u.contributions.length-1;t>=0;t--){const e=u.contributions[t];r&&r.info("-------------------------"),r&&r.info(Ob(e.contributionHash,`contribution #${t+1} ${e.name?e.name:""}:`)),1==e.type&&(r&&r.info(`Beacon generator: ${Wb(e.beaconHash)}`),r&&r.info(`Beacon iterations Exp: ${e.numIterationsExp}`))}return r&&r.info("-------------------------"),r&&r.info("ZKey Ok!"),!0;async function m(t,e){const n=2*c.G1.F.n8,r=t.byteLength/n,i=c.tm.concurrency,o=Math.floor(r/i),s=[];for(let n=0;n<i;n++){let a;if(a=n<i-1?o:r-n*o,0==a)continue;const c=t.slice(n*o*l,(n*o+a)*l),u=e.slice(n*o*l,(n*o+a)*l);s.push(w(c,u))}const a=await Promise.all(s),u=new Uint8Array(r*n);let h=0;for(let t=0;t<a.length;t++)u.set(a[t][0],h),h+=a[t][0].byteLength;return u}async function w(t,e){const n=2*c.G1.F.n8,r=3*c.G1.F.n8,i=t.byteLength/n,o=[];o.push({cmd:"ALLOCSET",var:0,buff:t}),o.push({cmd:"ALLOCSET",var:1,buff:e}),o.push({cmd:"ALLOC",var:2,len:i*r});for(let t=0;t<i;t++)o.push({cmd:"CALL",fnName:"g1m_subAffine",params:[{var:0,offset:t*n},{var:1,offset:t*n},{var:2,offset:t*r}]});o.push({cmd:"CALL",fnName:"g1m_batchToAffine",params:[{var:2},{val:i},{var:2}]}),o.push({cmd:"GET",out:0,var:2,len:i*n});return await c.tm.queueAction(o)}}const{stringifyBigInts:WD}=DT;async function qD(t,e){e&&e.info("EXPORT VERIFICATION KEY STARTED");const{fd:n,sections:r}=await jT(t,"zkey",2),i=await eD(n,r);let o;if(e&&e.info("> Detected protocol: "+i.protocol),"groth16"===i.protocol)o=await async function(t,e,n){const r=await ob(t.q),i=2*r.G1.F.n8,o=await r.pairing(t.vk_alpha_1,t.vk_beta_2);let s={protocol:t.protocol,curve:r.name,nPublic:t.nPublic,vk_alpha_1:r.G1.toObject(t.vk_alpha_1),vk_beta_2:r.G2.toObject(t.vk_beta_2),vk_gamma_2:r.G2.toObject(t.vk_gamma_2),vk_delta_2:r.G2.toObject(t.vk_delta_2),vk_alphabeta_12:r.Gt.toObject(o)};await JT(e,n,3),s.IC=[];for(let n=0;n<=t.nPublic;n++){const t=await e.read(i),n=r.G1.toObject(t);s.IC.push(n)}return await WT(e),s=WD(s),s}(i,n,r);else if("plonk"===i.protocol)o=await async function(t){const e=await ob(t.q);let n={protocol:t.protocol,curve:e.name,nPublic:t.nPublic,power:t.power,k1:e.Fr.toObject(t.k1),k2:e.Fr.toObject(t.k2),Qm:e.G1.toObject(t.Qm),Ql:e.G1.toObject(t.Ql),Qr:e.G1.toObject(t.Qr),Qo:e.G1.toObject(t.Qo),Qc:e.G1.toObject(t.Qc),S1:e.G1.toObject(t.S1),S2:e.G1.toObject(t.S2),S3:e.G1.toObject(t.S3),X_2:e.G2.toObject(t.X_2),w:e.Fr.toObject(e.Fr.w[t.power])};return n=WD(n),n}(i);else{if(!i.protocolId||i.protocolId!==qb)throw new Error("zkey file protocol unrecognized");o=await async function(t){const e=await ob(t.q);let n={protocol:t.protocol,curve:e.name,nPublic:t.nPublic,power:t.power,k1:e.Fr.toObject(t.k1),k2:e.Fr.toObject(t.k2),w:e.Fr.toObject(e.Fr.w[t.power]),w3:e.Fr.toObject(t.w3),w4:e.Fr.toObject(t.w4),w8:e.Fr.toObject(t.w8),wr:e.Fr.toObject(t.wr),X_2:e.G2.toObject(t.X_2),C0:e.G1.toObject(t.C0)};return WD(n)}(i)}return await n.close(),e&&e.info("EXPORT VERIFICATION KEY FINISHED"),o}var KD={};const{unstringifyBigInts:ZD,stringifyBigInts:XD}=DT;async function $D(t,e,n){n&&n.info("FFLONK EXPORT SOLIDITY VERIFIER STARTED");const r=await sb(t.curve);let i=l(t.w3);t.w3_2=u(r.Fr.square(i));let o=l(t.w4);t.w4_2=u(r.Fr.square(o)),t.w4_3=u(r.Fr.mul(r.Fr.square(o),o));let s=l(t.w8),a=r.Fr.one;for(let e=1;e<8;e++)a=r.Fr.mul(a,s),t["w8_"+e]=u(a);let c=e[t.protocol];return n&&n.info("FFLONK EXPORT SOLIDITY VERIFIER FINISHED"),KD.render(c,t);function l(t){const e=ZD(t);return r.Fr.fromObject(e)}function u(t){const e=r.Fr.toObject(t);return XD(e)}}var tv=Object.freeze({__proto__:null,newZKey:YD,exportBellman:async function(t,e,n){const{fd:r,sections:i}=await jT(t,"zkey",2),o=await eD(r,i);if("groth16"!=o.protocol)throw new Error("zkey file is not groth16");const s=await ob(o.q),a=2*s.G1.F.n8,c=2*s.G2.F.n8,l=await rD(r,s,i),u=await GT(e);let h;await m(o.vk_alpha_1),await m(o.vk_beta_1),await w(o.vk_beta_2),await w(o.vk_gamma_2),await m(o.vk_delta_1),await w(o.vk_delta_2),h=await XT(r,i,3),h=await s.G1.batchLEMtoU(h),await y("G1",h);const d=await XT(r,i,9);let p,f,g,A,E;p=await s.G1.fft(d,"affine","jacobian",n),p=await s.G1.batchApplyKey(p,s.Fr.neg(s.Fr.e(2)),s.Fr.w[o.power+1],"jacobian","affine",n),p=p.slice(0,p.byteLength-a),p=await s.G1.batchLEMtoU(p),await y("G1",p),f=await XT(r,i,8),f=await s.G1.batchLEMtoU(f),await y("G1",f),g=await XT(r,i,5),g=await s.G1.batchLEMtoU(g),await y("G1",g),A=await XT(r,i,6),A=await s.G1.batchLEMtoU(A),await y("G1",A),E=await XT(r,i,7),E=await s.G2.batchLEMtoU(E),await y("G2",E),await u.write(l.csHash),await async function(t){const e=new Uint8Array(4);new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t,!1),await u.write(e)}(l.contributions.length);for(let t=0;t<l.contributions.length;t++){const e=l.contributions[t];await m(e.deltaAfter),await m(e.delta.g1_s),await m(e.delta.g1_sx),await w(e.delta.g2_spx),await u.write(e.transcript)}async function m(t){const e=new Uint8Array(a);s.G1.toRprUncompressed(e,0,t),await u.write(e)}async function w(t){const e=new Uint8Array(c);s.G2.toRprUncompressed(e,0,t),await u.write(e)}async function y(t,e){let n;n="G1"==t?a:c;const r=new Uint8Array(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(0,e.byteLength/n,!1),await u.write(r),await u.write(e)}await r.close(),await u.close()},importBellman:async function(t,e,n,r,i){const{fd:o,sections:s}=await jT(t,"zkey",2),a=await eD(o,s,!1);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=2*c.G1.F.n8,u=2*c.G2.F.n8,h=await rD(o,c,s),d={},p=await VT(e);p.pos=3*l+3*u+8+l*a.nVars+4+l*(a.domainSize-1)+4+l*a.nVars+4+l*a.nVars+4+u*a.nVars,d.csHash=await p.read(64);const f=await p.readUBE32();d.contributions=[];for(let t=0;t<f;t++){const e={delta:{}};e.deltaAfter=await I(p),e.delta.g1_s=await I(p),e.delta.g1_sx=await I(p),e.delta.g2_spx=await C(p),e.transcript=await p.read(64),t<h.contributions.length&&(e.type=h.contributions[t].type,1==e.type&&(e.beaconHash=h.contributions[t].beaconHash,e.numIterationsExp=h.contributions[t].numIterationsExp),h.contributions[t].name&&(e.name=h.contributions[t].name)),d.contributions.push(e)}if(!Qb(d.csHash,h.csHash))return i&&i.error("Hash of the original circuit does not match with the MPC one"),!1;if(h.contributions.length>d.contributions.length)return i&&i.error("The impoerted file does not include new contributions"),!1;for(let t=0;t<h.contributions.length;t++)if(!T(h.contributions[t],d.contributions[t]))return i&&i.error(`Previous contribution ${t} does not match`),!1;if(r)for(let t=h.contributions.length;t<d.contributions.length;t++)d.contributions[t].name=r;const g=await HT(n,"zkey",1,10);if(p.pos=0,p.pos+=l,p.pos+=l,p.pos+=u,p.pos+=u,a.vk_delta_1=await I(p),a.vk_delta_2=await C(p),await Kb(g,a),await p.readUBE32()!=a.nPublic+1)return i&&i.error("Invalid number of points in IC"),await g.discard(),!1;if(p.pos+=l*(a.nPublic+1),await ZT(o,s,g,3),await ZT(o,s,g,4),await p.readUBE32()!=a.domainSize-1)return i&&i.error("Invalid number of points in H"),await g.discard(),!1;let A;const E=await p.read(l*(a.domainSize-1)),m=await c.G1.batchUtoLEM(E);A=new Uint8Array(a.domainSize*l),A.set(m),c.G1.toRprLEM(A,l*(a.domainSize-1),c.G1.zeroAffine);const w=c.Fr.neg(c.Fr.inv(c.Fr.e(2))),y=c.Fr.inv(c.Fr.w[a.power+1]);if(A=await c.G1.batchApplyKey(A,w,y,"affine","jacobian",i),A=await c.G1.ifft(A,"jacobian","affine",i),await YT(g,9),await g.write(A),await zT(g),await p.readUBE32()!=a.nVars-a.nPublic-1)return i&&i.error("Invalid number of points in L"),await g.discard(),!1;let B;return B=await p.read(l*(a.nVars-a.nPublic-1)),B=await c.G1.batchUtoLEM(B),await YT(g,8),await g.write(B),await zT(g),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in A"),await g.discard(),!1):(p.pos+=l*a.nVars,await ZT(o,s,g,5),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in B1"),await g.discard(),!1):(p.pos+=l*a.nVars,await ZT(o,s,g,6),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in B2"),await g.discard(),!1):(p.pos+=u*a.nVars,await ZT(o,s,g,7),await oD(g,c,d),await p.close(),await g.close(),await o.close(),!0)));async function I(t){const e=await t.read(2*c.G1.F.n8);return c.G1.fromRprUncompressed(e,0)}async function C(t){const e=await t.read(2*c.G2.F.n8);return c.G2.fromRprUncompressed(e,0)}function T(t,e){return!!c.G1.eq(t.deltaAfter,e.deltaAfter)&&(!!c.G1.eq(t.delta.g1_s,e.delta.g1_s)&&(!!c.G1.eq(t.delta.g1_sx,e.delta.g1_sx)&&(!!c.G2.eq(t.delta.g2_spx,e.delta.g2_spx)&&!!Qb(t.transcript,e.transcript))))}},verifyFromR1cs:async function(t,e,n,r){const i={type:"bigMem"};return await YD(t,e,i,r),await JD(i,e,n,r)},verifyFromInit:JD,contribute:async function(t,e,n,r,i){const{fd:o,sections:s}=await jT(t,"zkey",2),a=await eD(o,s);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=await rD(o,c,s),u=await HT(e,"zkey",1,10),h=await Yb(r),d=Fb.create({dkLen:64});d.update(l.csHash);for(let t=0;t<l.contributions.length;t++)aD(d,c,l.contributions[t]);const p={delta:{}};p.delta.prvKey=c.Fr.fromRng(h),p.delta.g1_s=c.G1.toAffine(c.G1.fromRng(h)),p.delta.g1_sx=c.G1.toAffine(c.G1.timesFr(p.delta.g1_s,p.delta.prvKey)),sD(d,c,p.delta.g1_s),sD(d,c,p.delta.g1_sx),p.transcript=d.digest(),p.delta.g2_sp=DD(c,p.transcript),p.delta.g2_spx=c.G2.toAffine(c.G2.timesFr(p.delta.g2_sp,p.delta.prvKey)),a.vk_delta_1=c.G1.timesFr(a.vk_delta_1,p.delta.prvKey),a.vk_delta_2=c.G2.timesFr(a.vk_delta_2,p.delta.prvKey),p.deltaAfter=a.vk_delta_1,p.type=0,n&&(p.name=n),l.contributions.push(p),await Kb(u,a),await ZT(o,s,u,3),await ZT(o,s,u,4),await ZT(o,s,u,5),await ZT(o,s,u,6),await ZT(o,s,u,7);const f=c.Fr.inv(p.delta.prvKey);await MD(o,s,u,8,c,"G1",f,c.Fr.e(1),"L Section",i),await MD(o,s,u,9,c,"G1",f,c.Fr.e(1),"H Section",i),await oD(u,c,l),await o.close(),await u.close();const g=Fb.create({dkLen:64});aD(g,c,p);const A=g.digest();return i&&i.info(Ob(l.csHash,"Circuit Hash: ")),i&&i.info(Ob(A,"Contribution Hash: ")),A},beacon:async function(t,e,n,r,i,o){const s=Jb(r);if(0==s.byteLength||2*s.byteLength!=r.length)return o&&o.error("Invalid Beacon Hash. (It must be a valid hexadecimal sequence)"),!1;if(s.length>=256)return o&&o.error("Maximum length of beacon hash is 255 bytes"),!1;if((i=parseInt(i))<10||i>63)return o&&o.error("Invalid numIterationsExp. (Must be between 10 and 63)"),!1;const{fd:a,sections:c}=await jT(t,"zkey",2),l=await eD(a,c);if("groth16"!=l.protocol)throw new Error("zkey file is not groth16");const u=await ob(l.q),h=await rD(a,u,c),d=await HT(e,"zkey",1,10),p=await zb(s,i),f=Fb.create({dkLen:64});f.update(h.csHash);for(let t=0;t<h.contributions.length;t++)aD(f,u,h.contributions[t]);const g={delta:{}};g.delta.prvKey=u.Fr.fromRng(p),g.delta.g1_s=u.G1.toAffine(u.G1.fromRng(p)),g.delta.g1_sx=u.G1.toAffine(u.G1.timesFr(g.delta.g1_s,g.delta.prvKey)),sD(f,u,g.delta.g1_s),sD(f,u,g.delta.g1_sx),g.transcript=f.digest(),g.delta.g2_sp=DD(u,g.transcript),g.delta.g2_spx=u.G2.toAffine(u.G2.timesFr(g.delta.g2_sp,g.delta.prvKey)),l.vk_delta_1=u.G1.timesFr(l.vk_delta_1,g.delta.prvKey),l.vk_delta_2=u.G2.timesFr(l.vk_delta_2,g.delta.prvKey),g.deltaAfter=l.vk_delta_1,g.type=1,g.numIterationsExp=i,g.beaconHash=s,n&&(g.name=n),h.contributions.push(g),await Kb(d,l),await ZT(a,c,d,3),await ZT(a,c,d,4),await ZT(a,c,d,5),await ZT(a,c,d,6),await ZT(a,c,d,7);const A=u.Fr.inv(g.delta.prvKey);await MD(a,c,d,8,u,"G1",A,u.Fr.e(1),"L Section",o),await MD(a,c,d,9,u,"G1",A,u.Fr.e(1),"H Section",o),await oD(d,u,h),await a.close(),await d.close();const E=Fb.create({dkLen:64});aD(E,u,g);const m=E.digest();return o&&o.info(Ob(m,"Contribution Hash: ")),m},exportJson:async function(t){const e=await async function(t,e){const{fd:n,sections:r}=await jT(t,"zkey",1),i=await eD(n,r,e),o=new iI(i.r),s=bT.mod(bT.shl(1,8*i.n8r),i.r),a=o.inv(s),c=o.mul(a,a);let l=await ob(i.q);await JT(n,r,3),i.IC=[];for(let t=0;t<=i.nPublic;t++){const t=await $b(n,l,e);i.IC.push(t)}await WT(n),await JT(n,r,4);const u=await n.readULE32();i.ccoefs=[];for(let t=0;t<u;t++){const t=await n.readULE32(),e=await n.readULE32(),r=await n.readULE32(),o=await h();i.ccoefs.push({matrix:t,constraint:e,signal:r,value:o})}await WT(n),await JT(n,r,5),i.A=[];for(let t=0;t<i.nVars;t++){const r=await $b(n,l,e);i.A[t]=r}await WT(n),await JT(n,r,6),i.B1=[];for(let t=0;t<i.nVars;t++){const r=await $b(n,l,e);i.B1[t]=r}await WT(n),await JT(n,r,7),i.B2=[];for(let t=0;t<i.nVars;t++){const r=await tD(n,l,e);i.B2[t]=r}await WT(n),await JT(n,r,8),i.C=[];for(let t=i.nPublic+1;t<i.nVars;t++){const r=await $b(n,l,e);i.C[t]=r}await WT(n),await JT(n,r,9),i.hExps=[];for(let t=0;t<i.domainSize;t++){const t=await $b(n,l,e);i.hExps.push(t)}return await WT(n),await n.close(),i;async function h(){const t=await KT(n,i.n8r);return o.mul(t,c)}}(t,!0);return delete e.curve,delete e.F,DT.stringifyBigInts(e)},bellmanContribute:async function(t,e,n,r,i){const o=await Yb(r),s=t.Fr.fromRng(o),a=t.Fr.inv(s),c=2*t.G1.F.n8,l=2*t.G2.F.n8,u=await VT(e),h=await GT(n);await M(c),await M(c),await M(l),await M(l);const d=await N(),p=t.G1.timesFr(d,s);await _(p);const f=await S(),g=t.G2.timesFr(f,s);await L(g);const A=await u.readUBE32();await h.writeUBE32(A),await M(A*c);const E=await u.readUBE32();await h.writeUBE32(E),await ND(u,h,null,t,"G1",E,a,t.Fr.e(1),"UNCOMPRESSED","H",i);const m=await u.readUBE32();await h.writeUBE32(m),await ND(u,h,null,t,"G1",m,a,t.Fr.e(1),"UNCOMPRESSED","L",i);const w=await u.readUBE32();await h.writeUBE32(w),await M(w*c);const y=await u.readUBE32();await h.writeUBE32(y),await M(y*c);const B=await u.readUBE32();await h.writeUBE32(B),await M(B*l);const I=Fb.create({dkLen:64}),C={};C.csHash=await u.read(64),I.update(C.csHash);const T=await u.readUBE32();C.contributions=[];for(let e=0;e<T;e++){const e={delta:{}};e.deltaAfter=await N(),e.delta.g1_s=await N(),e.delta.g1_sx=await N(),e.delta.g2_spx=await S(),e.transcript=await u.read(64),C.contributions.push(e),aD(I,t,e)}const b={delta:{}};b.delta.prvKey=s,b.delta.g1_s=t.G1.toAffine(t.G1.fromRng(o)),b.delta.g1_sx=t.G1.toAffine(t.G1.timesFr(b.delta.g1_s,s)),sD(I,t,b.delta.g1_s),sD(I,t,b.delta.g1_sx),b.transcript=I.digest(),b.delta.g2_sp=DD(t,b.transcript),b.delta.g2_spx=t.G2.toAffine(t.G2.timesFr(b.delta.g2_sp,s)),b.deltaAfter=p,b.type=0,C.contributions.push(b),await h.write(C.csHash),await h.writeUBE32(C.contributions.length);for(let t=0;t<C.contributions.length;t++){const e=C.contributions[t];await _(e.deltaAfter),await _(e.delta.g1_s),await _(e.delta.g1_sx),await L(e.delta.g2_spx),await h.write(e.transcript)}const D=Fb.create({dkLen:64});aD(D,t,b);const v=D.digest();return i&&i.info(Ob(v,"Contribution Hash: ")),await h.close(),await u.close(),v;async function M(t){const e=2*u.pageSize;for(let n=0;n<t;n+=e){const r=Math.min(t-n,e),i=await u.read(r);await h.write(i)}}async function N(){const e=await u.read(2*t.G1.F.n8);return t.G1.fromRprUncompressed(e,0)}async function S(){const e=await u.read(2*t.G2.F.n8);return t.G2.fromRprUncompressed(e,0)}async function _(e){const n=new Uint8Array(c);t.G1.toRprUncompressed(n,0,e),await h.write(n)}async function L(e){const n=new Uint8Array(l);t.G2.toRprUncompressed(n,0,e),await h.write(n)}},exportVerificationKey:qD,exportSolidityVerifier:async function(t,e,n){const r=await qD(t,n);if("fflonk"===r.protocol)return $D(r,e,n);let i=e[r.protocol];return KD.render(i,r)}});const ev=[],nv=[],rv=[],iv=BigInt(0),ov=BigInt(1),sv=BigInt(2),av=BigInt(7),cv=BigInt(256),lv=BigInt(113);for(let t=0,e=ov,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],ev.push(2*(5*r+n)),nv.push((t+1)*(t+2)/2%64);let i=iv;for(let t=0;t<7;t++)e=(e<<ov^(e>>av)*lv)%cv,e&sv&&(i^=ov<<(ov<<BigInt(t))-ov);rv.push(i)}const[uv,hv]=Tb(rv,!0);const{stringifyBigInts:dv}=DT;const{unstringifyBigInts:pv}=DT;const{unstringifyBigInts:fv}=DT;const{unstringifyBigInts:gv}=DT;const{stringifyBigInts:Av}=DT;const{unstringifyBigInts:Ev}=DT;const{unstringifyBigInts:mv}=DT;const{unstringifyBigInts:wv}=DT;var yv=s(8287).hp;const Bv=pm.fromJSON({});class Iv extends Error{name="AttestorError";code;data;constructor(t,e,n){super(e),this.code=t,this.data=n}toProto(){return pm.create({code:om[this.code],message:this.message,data:JSON.stringify(this.data)})}static fromProto(t=Bv){return new Iv("number"==typeof t.code?function(t,e){for(const n in t)if(t[n]===e)return n;return}(om,t.code)||"UNRECOGNIZED":t.code,t.message,t.data?JSON.parse(t.data):void 0)}static fromError(t,e="ERROR_INTERNAL"){return t instanceof Iv?t:new Iv(e,t.message)}static badRequest(t,e){return new Iv("ERROR_BAD_REQUEST",t,e)}}const Cv=+(oy("ZK_CONCURRENCY")||10);async function Tv({zkOperators:t,oprfOperators:e,logger:n=uy,zkProofConcurrency:r=Cv,cipherSuite:i,zkEngine:o="snarkjs"}){const s=new uB({concurrency:r,autoStart:!0}),a=[];n=n.child({module:"zk",zkEngine:o});let c=0;return{async addPacketToProve(t,{redactedPlaintext:e,toprfs:n=[],overshotToprfFromPrevBlock:r},o,s){if("plaintext"===t.type)throw new Error("Cannot generate proof for plaintext");const l=Ww(i),u=bv(l),h=await C.exportKey(t.encKey),d=t.iv,p=function(t,e){Ww(e),t=t.slice(0,-16);const{ivLength:n}=G[e],r=12-n;return t.slice(r)}(t.ciphertext,i);r&&e.set(new Uint8Array(r.length).fill(fy));const f="TLS_AES_128_GCM_SHA256"===(g=i)||"TLS_AES_256_GCM_SHA384"===g||"TLS_CHACHA20_POLY1305_SHA256"===g?p.length-1:p.length;var g;const A={onGeneratedProofs:o,algorithm:l,proofsToGenerate:[],toprfsToGenerate:[],iv:t.fixedIv};for(const r of n){const n=f-(r.dataLocation.fromIndex+r.dataLocation.length);if(n<0){const e=s();if("ciphertext"!==e?.type)throw new Iv("ERROR_INTERNAL","TOPRF data overshoots ciphertext length, but no next ciphertext packet found");if(e.encKey!==t.encKey)throw new Iv("ERROR_INTERNAL","TOPRF data overshoots ciphertext length, but next packet has different encryption key");const i=e.ciphertext.slice(0,Math.abs(n)),o=e.iv;r.overshoot={ciphertext:i,iv:o,recordNumber:e.recordNumber}}const i=Fv(l,r),o={fromIndex:i,toIndex:Math.min(i+u,p.length)};A.toprfsToGenerate.push(Rv({key:h,iv:d,ciphertext:p,slice:o,toprf:{...r,dataLocation:{...r.dataLocation,fromIndex:r.dataLocation.fromIndex-i}}})),c+=1;const a=Math.min(f,r.dataLocation.fromIndex+r.dataLocation.length);for(let t=r.dataLocation.fromIndex;t<a;t++)e[t]=fy}for(let t=0;t<p.length;t+=u){const n=xv({key:h,iv:d,ciphertext:p,redactedPlaintext:e,slice:{fromIndex:t,toIndex:Math.min(t+u,p.length)}});n&&(A.proofsToGenerate.push(n),c+=1)}a.push(A)},getTotalChunksToProve:()=>c,async generateProofs(t){if(!a.length)return;const e=Date.now(),r=[];for(const{onGeneratedProofs:e,algorithm:n,proofsToGenerate:i,toprfsToGenerate:o}of a){const a=[],c=[];let h=i.length+o.length;for(const o of i)r.push(s.add(async()=>{const r=await l(n,o);t?.(),a.push(r),h-=1,0===h&&e(a,c)},{throwOnTimeout:!0}));for(const i of o)r.push(s.add(async()=>{const r=await u(n,i);t?.(),c.push(r),h-=1,0===h&&e(a,c)},{throwOnTimeout:!0}))}await Promise.all(r),n?.info({durationMs:Date.now()-e,zkProofsToGen:c},"generated ZK proofs"),a.splice(0,a.length),c=0;const o=Ww(i),d=await h(o);d.release?.()}};async function l(t,{startIdx:e,redactedPlaintext:r,privateInput:i,publicInput:o}){const s=h(t),a=await Uw({algorithm:t,privateInput:i,publicInput:o,operator:s,logger:n});return n?.debug({startIdx:e},"generated proof for chunk"),{proofData:"string"==typeof a.proofData?Yw(a.proofData):a.proofData,decryptedRedactedCiphertext:a.plaintext||new Uint8Array,redactedPlaintext:r,startIdx:e}}async function u(t,{startIdx:r,privateInput:i,publicInput:s,toprf:a}){const c=function(t){return e?.[t]||_v(t,o,n)}(t),l=[];if(a?.overshoot){const{dataLocation:e,overshoot:{ciphertext:n}}=a;l.push({pos:e.fromIndex,len:e.length-n.length},{pos:kw(e.fromIndex+e.length,t),len:n.length})}else a&&l.push({pos:a.dataLocation.fromIndex,len:a.dataLocation.length});const u=await Uw({algorithm:t,privateInput:i,publicInput:s,operator:c,logger:n,...a?{toprf:{locations:l,output:a.nullifier,responses:a.responses,domainSeparator:bw},mask:a.mask}:{}});return n?.debug({toprfLocations:l},"generated TOPRF proof for chunk"),{startIdx:r,proofData:"string"==typeof u.proofData?Yw(u.proofData):u.proofData,payload:a}}function h(e){return t?.[e]||Sv(e,o,n)}}function bv(t){const{chunkSize:e,bitsPerWord:n}=Ow[t];return e*n/8}const Dv={},vv={},Mv={snarkjs:function({algorithm:t,fetcher:e,options:{maxProofConcurrency:n=2}={}}){let r,i,o;const s=new uB({concurrency:n});return{async generateWitness({out:n,...r},s){i||=function(n){return e.fetch("snarkjs",`${t}/circuit.wasm`,n)}(),o||=(async()=>{if(!UD.getWtnsCalculator)return;const t=WebAssembly.Memory;WebAssembly.Memory=class extends WebAssembly.Memory{constructor(){super({initial:5})}};try{return await UD.getWtnsCalculator(await i)}finally{WebAssembly.Memory=t}})();const{noncesAndCounters:[{nonce:a,counter:c}]}=r,l={key:Sw(t,r.key),nonce:Sw(t,a),counter:Sw(t,c),in:Sw(t,r.in)},u={type:"mem"};return await o?await UD.wtnsCalculateWithCalculator(l,await o,u):await UD.calculate(l,await i,u),u.data},async groth16Prove(t,e){r||=a();const{data:n}=await r,{proof:i}=await s.add(()=>bD.prove(n,t,e));return{proof:JSON.stringify(i)}},async groth16Verify(e,n,i){n="string"!=typeof n?yv.from(n).toString():n,r||=a();const o=await r;o.json||(o.json=await tv.exportVerificationKey(o.data));const{noncesAndCounters:[{nonce:s,counter:c}]}=e;return bD.verify(o.json,Sw(t,e.out,s,c,e.in),JSON.parse(n),i)},release(){r=void 0,i=void 0,o=void 0}};async function a(n){return{data:await e.fetch("snarkjs",`${t}/circuit_final.zkey`,n)}}},gnark:function({algorithm:t,fetcher:e}){return{generateWitness:async e=>Wy(t,e),async groth16Prove(n,r){const i=await tB(t,e,r),o=await Xy(i.prove,n);if("object"!=typeof o||!("proof"in o)||!o.proof)throw new Error(`Failed to create gnark proof: ${JSON.stringify(o)}`);return{proof:Uy(o.proof)}},async groth16Verify(n,r,i){const o=await tB(t,e,i),s=qy(t,n),a=JSON.stringify({cipher:t,proof:"string"==typeof r?r:Qy(r),publicSignals:s});return 1===Zy(o.verify,a)}}}},Nv={gnark:function({fetcher:t,algorithm:e}){return{generateWitness:async t=>Wy(e,t),async groth16Prove(t,e){const r=await n(e),i=await Xy(r.prove,t);if("object"!=typeof i||!("proof"in i)||!i.proof)throw new Error(`Failed to create gnark TOPRF proof: ${JSON.stringify(i)}`);return{proof:Uy(i.proof)}},async groth16Verify(t,r,i){const o=await n(i),s=qy(e,t),a=JSON.stringify({cipher:`${e}-toprf`,proof:"string"==typeof r?r:Qy(r),publicSignals:s});return 1===Zy(o.verify,a)},async generateThresholdKeys(t,e,r){const i=await n(r),{generateThresholdKeys:o,vfree:s}=i,a={total:t,threshold:e},c=Zy(o,JSON.stringify(a)),l=nB.from(eB.decode(c.r0,"unsigned char",c.r1)).toString();s(c.r0);const u=JSON.parse(l),h=[];for(let t=0;t<u.shares.length;t++){const e=u.shares[t];h.push({index:e.index,publicKey:ky(e.publicKey),privateKey:ky(e.privateKey)})}return{publicKey:ky(u.publicKey),privateKey:ky(u.privateKey),shares:h}},async generateOPRFRequestData(t,e,r){const i=await n(r),o={data:Qy(t),domainSeparator:e},s=await Xy(i.generateOPRFRequest,JSON.stringify(o));return{mask:ky(s.mask),maskedData:ky(s.maskedData),secretElements:[ky(s.secretElements[0]),ky(s.secretElements[1])]}},async finaliseOPRF(t,e,r,i){const o=await n(i),s={serverPublicKey:Ly(t),request:{mask:Ly(e.mask),maskedData:Ly(e.maskedData),secretElements:[Ly(e.secretElements[0]),Ly(e.secretElements[1])]},responses:r.map(({publicKeyShare:t,evaluated:e,c:n,r})=>({publicKeyShare:Ly(t),evaluated:Ly(e),c:Ly(n),r:Ly(r)}))},a=await Xy(o.toprfFinalize,JSON.stringify(s));return ky(a.output)},async evaluateOPRF(t,e,r){const i=await n(r),{oprfEvaluate:o,vfree:s}=i,a={serverPrivate:Ly(t),maskedData:Ly(e)},c=Zy(o,JSON.stringify(a)),l=nB.from(eB.decode(c.r0,"unsigned char",c.r1)).toString();s(c.r0);const u=JSON.parse(l);return{evaluated:ky(u.evaluated),c:ky(u.c),r:ky(u.r)}}};async function n(n){const{ext:r,id:i}=rB[e];return zy(i,r,t,n)}}};function Sv(t,e,n){let r=Dv[e];if(r||(Dv[e]={},r=Dv[e]),!r[t]){const i="node"===iy()?"local":"remote",o="remote"===i?kv():void 0;n?.info({type:i,algorithm:t,zkBaseUrl:o},"fetching zk operator");const s="local"===i?jw():Vw({baseUrl:o}),a=Mv[e];if(!a)throw new Error(`No ZK operator maker for ${e}`);r[t]=a({algorithm:t,fetcher:s})}return r[t]}function _v(t,e,n){let r=vv[e];if(r||(vv[e]={},r=vv[e]),!r[t]){const i="node"===iy()?"local":"remote",o="remote"===i?kv():void 0;n?.info({type:i,algorithm:t,zkBaseUrl:o},"fetching oprf operator");const s="local"===i?jw():Vw({baseUrl:o}),a=Nv[e];if(!a)throw new Error(`No OPRF operator maker for ${e}`);r[t]=a({algorithm:t,fetcher:s})}return r[t]}function Lv(t){if("gnark"===t)return cm;if("snarkjs"===t)return am;throw new Error(`Unknown ZK engine: ${t}`)}function xv({key:t,iv:e,ciphertext:n,redactedPlaintext:r,slice:{fromIndex:i,toIndex:o}}){const s=n.slice(i,o),a=r.slice(i,o);if(!gy(a)){for(let t=0;t<s.length;t++)a[t]===fy&&(s[t]=fy);return{startIdx:i,redactedPlaintext:a,privateInput:{key:t},publicInput:{ciphertext:s,iv:e,offsetBytes:i}}}}function Rv({key:t,iv:e,ciphertext:n,slice:{fromIndex:r,toIndex:i},toprf:o}){const s=n.slice(r,i);if(o?.overshoot){const{overshoot:{ciphertext:n,iv:i}}=o;return{privateInput:{key:t},publicInput:[{ciphertext:s,iv:e,offsetBytes:r},{ciphertext:n,iv:i}],toprf:o,startIdx:r}}return{privateInput:{key:t},publicInput:{ciphertext:s,iv:e,offsetBytes:r},toprf:o,startIdx:r}}function Fv(t,{dataLocation:e,overshoot:n}){const r=bv(t),i=Rw(t),o=Math.floor(e.fromIndex/r);if(Math.floor((e.fromIndex+e.length)/r)===o){const t=o*r;if(n){return t+Math.ceil(n.ciphertext.length/i)*i}return t}const s=Math.floor(e.fromIndex/i)*i;if(Math.ceil((e.fromIndex+e.length)/i)-s>r)throw new Iv("ERROR_BAD_REQUEST","OPRF data cannot fit into a single chunk");return s}function kv(){return"string"!=typeof ATTESTOR_BASE_URL?Bw:new URL(Bw,ATTESTOR_BASE_URL).toString()}var Ov=s(2341);function Qv(t){return t&&Ov(t)||""}var Uv=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const Pv=new dg("abstract-provider/5.8.0");class Gv{constructor(){Pv.checkAbstract(new.target,Gv),BA(this,"_isProvider",!0)}getFeeData(){return Uv(this,void 0,void 0,function*(){const{block:t,gasPrice:e}=yield IA({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(t=>null)});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=UA.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}})}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Vv=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const jv=new dg("abstract-signer/5.8.0"),Hv=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Yv=[dg.errors.INSUFFICIENT_FUNDS,dg.errors.NONCE_EXPIRED,dg.errors.REPLACEMENT_UNDERPRICED];class zv{constructor(){jv.checkAbstract(new.target,zv),BA(this,"_isSigner",!0)}getBalance(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)})}getTransactionCount(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)})}estimateGas(t){return Vv(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const e=yield IA(this.checkTransaction(t));return yield this.provider.estimateGas(e)})}call(t,e){return Vv(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield IA(this.checkTransaction(t));return yield this.provider.call(n,e)})}sendTransaction(t){return Vv(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)})}getChainId(){return Vv(this,void 0,void 0,function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)})}checkTransaction(t){for(const e in t)-1===Hv.indexOf(e)&&jv.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=CA(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then(e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&jv.throwArgumentError("from address mismatch","transaction",t),e[0])),e}populateTransaction(t){return Vv(this,void 0,void 0,function*(){const e=yield IA(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then(t=>Vv(this,void 0,void 0,function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&jv.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})),e.to.catch(t=>{}));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||jv.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):jv.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&jv.throwError("network does not support EIP-1559",dg.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):jv.throwError("failed to get consistent fee data",dg.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch(t=>{if(Yv.indexOf(t.code)>=0)throw t;return jv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",dg.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})})),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then(e=>(0!==e[1]&&e[0]!==e[1]&&jv.throwArgumentError("chainId address mismatch","transaction",t),e[0])),yield IA(e)})}_checkProvider(t){this.provider||jv.throwError("missing provider",dg.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}const Jv=new dg("strings/5.8.0");var Wv,qv;function Kv(t,e,n,r,i){if(t===qv.BAD_PREFIX||t===qv.UNEXPECTED_CONTINUE){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return t===qv.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Wv||(Wv={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(qv||(qv={}));Object.freeze({error:function(t,e,n,r,i){return Jv.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:Kv,replace:function(t,e,n,r,i){return t===qv.OVERLONG?(r.push(i),0):(r.push(65533),Kv(t,e,n))}});function Zv(t,e=Wv.current){e!=Wv.current&&(Jv.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return wg(n)}function Xv(t){return"string"==typeof t&&(t=Zv(t)),zA(yg([Zv("Ethereum Signed Message:\n"),Zv(String(t.length)),t]))}function $v(t){return zA(Zv(t))}var tM=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const eM=new dg("hash/5.8.0"),nM=new Uint8Array(32);nM.fill(0);const rM=UA.from(-1),iM=UA.from(0),oM=UA.from(1),sM=UA.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const aM=Mg(oM.toHexString(),32),cM=Mg(iM.toHexString(),32),lM={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},uM=["name","version","chainId","verifyingContract","salt"];function hM(t){return function(e){return"string"!=typeof e&&eM.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const dM={name:hM("name"),version:hM("version"),chainId:function(t){try{return UA.from(t).toString()}catch(t){}return eM.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return $A(t).toLowerCase()}catch(t){}return eM.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=wg(t);if(32!==e.length)throw new Error("bad length");return Tg(e)}catch(t){}return eM.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function pM(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&eM.throwArgumentError("invalid numeric width","type",t);const i=sM.mask(n?r-1:r),o=n?i.add(oM).mul(rM):iM;return function(e){const n=UA.from(e);return(n.lt(o)||n.gt(i))&&eM.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Mg(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&eM.throwArgumentError("invalid bytes width","type",t),function(e){return wg(e).length!==n&&eM.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=wg(t),n=e.length%32;return n?vg([e,nM.slice(n)]):Tg(e)}(e)}}}switch(t){case"address":return function(t){return Mg($A(t),32)};case"bool":return function(t){return t?aM:cM};case"bytes":return function(t){return zA(t)};case"string":return function(t){return $v(t)}}return null}function fM(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class gM{constructor(t){BA(this,"types",Object.freeze(vA(t))),BA(this,"_encoderCache",{}),BA(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach(t=>{e[t]={},n[t]=[],r[t]={}});for(const r in t){const i={};t[r].forEach(o=>{i[o.name]&&eM.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===r&&eM.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);pM(s)||(n[s]||eM.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(r),e[r][s]=!0)})}const i=Object.keys(n).filter(t=>0===n[t].length);0===i.length?eM.throwArgumentError("missing primary type","types",t):i.length>1&&eM.throwArgumentError(`ambiguous primary types or unused types: ${i.map(t=>JSON.stringify(t)).join(", ")}`,"types",t),BA(this,"primaryType",i[0]),function i(o,s){s[o]&&eM.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{n[t]&&(i(t,s),Object.keys(s).forEach(e=>{r[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=fM(e,t[e])+n.map(e=>fM(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=pM(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&eM.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(zA)),zA(vg(i))}}const n=this.types[t];if(n){const e=$v(this._types[t]);return t=>{const r=n.map(({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?zA(r):r});return r.unshift(e),vg(r)}}return eM.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||eM.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return zA(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(pM(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&eM.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,n))}const i=this.types[t];return i?i.reduce((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t),{}):eM.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new gM(t)}static getPrimaryType(t){return gM.from(t).primaryType}static hashStruct(t,e,n){return gM.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=lM[n];r||eM.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort((t,e)=>uM.indexOf(t.name)-uM.indexOf(e.name)),gM.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return vg(["0x1901",gM.hashDomain(t),gM.from(e).hash(n)])}static hash(t,e,n){return zA(gM.encode(t,e,n))}static resolveNames(t,e,n,r){return tM(this,void 0,void 0,function*(){t=CA(t);const i={};t.verifyingContract&&!Ig(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=gM.from(e);o.visit(n,(t,e)=>("address"!==t||Ig(e,20)||(i[e]="0x"),e));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,(t,e)=>"address"===t&&i[e]?i[e]:e),{domain:t,value:n}})}static getPayload(t,e,n){gM.hashDomain(t);const r={},i=[];uM.forEach(e=>{const n=t[e];null!=n&&(r[e]=dM[e](n),i.push({name:e,type:lM[e]}))});const o=gM.from(e),s=CA(e);return s.EIP712Domain?eM.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(n),{types:s,domain:r,primaryType:o.primaryType,message:o.visit(n,(t,e)=>{if(t.match(/^bytes(\d*)/))return Tg(wg(e));if(t.match(/^u?int/))return UA.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&eM.throwArgumentError("invalid string","value",e),e}return eM.throwArgumentError("unsupported type","type",t)})}}}class AM{constructor(t){BA(this,"alphabet",t),BA(this,"base",t.length),BA(this,"_alphabetMap",{}),BA(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=wg(t);if(0===e.length)return"";let n=[0];for(let t=0;t<e.length;++t){let r=e[t];for(let t=0;t<n.length;++t)r+=n[t]<<8,n[t]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t<e.length-1;++t)r+=this._leader;for(let t=n.length-1;t>=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n<t.length;n++){let r=this._alphabetMap[t[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let t=0;t<e.length;++t)i+=e[t]*this.base,e[t]=255&i,i>>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n<t.length-1;++n)e.push(0);return wg(new Uint8Array(e.reverse()))}}new AM("abcdefghijklmnopqrstuvwxyz234567");const EM=new AM("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var mM;!function(t){t.sha256="sha256",t.sha512="sha512"}(mM||(mM={}));const wM=new dg("sha2/5.8.0");function yM(t){return"0x"+kg().sha256().update(wg(t)).digest("hex")}function BM(t,e,n){return mM[t]||wM.throwError("unsupported algorithm "+t,dg.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+kg().hmac(kg()[t],wg(e)).update(wg(n)).digest("hex")}function IM(t,e,n,r,i){let o;t=wg(t),e=wg(e);let s=1;const a=new Uint8Array(r),c=new Uint8Array(e.length+4);let l,u;c.set(e);for(let h=1;h<=s;h++){c[e.length]=h>>24&255,c[e.length+1]=h>>16&255,c[e.length+2]=h>>8&255,c[e.length+3]=255&h;let d=wg(BM(i,t,c));o||(o=d.length,u=new Uint8Array(o),s=Math.ceil(r/o),l=r-(s-1)*o),u.set(d);for(let e=1;e<n;e++){d=wg(BM(i,t,d));for(let t=0;t<o;t++)u[t]^=d[t]}const p=(h-1)*o,f=h===s?l:o;a.set(wg(u).slice(0,f),p)}return Tg(a)}const CM=new dg("wordlists/5.8.0");class TM{constructor(t){CM.checkAbstract(new.target,TM),BA(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let n=0;n<2048;n++){const r=t.getWord(n);if(n!==t.getWordIndex(r))return"0x";e.push(r)}return $v(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}let bM=null;function DM(t){if(null==bM&&(bM="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==TM.check(t)))throw bM=null,new Error("BIP39 Wordlist for en (English) FAILED")}const vM=new class extends TM{constructor(){super("en")}getWord(t){return DM(this),bM[t]}getWordIndex(t){return DM(this),bM.indexOf(t)}};TM.register(vM);const MM={en:vM},NM=new dg("hdnode/5.8.0"),SM=UA.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_M=Zv("Bitcoin seed"),LM=2147483648;function xM(t){return(1<<t)-1<<8-t}function RM(t){return(1<<t)-1}function FM(t){return Mg(Tg(t),32)}function kM(t){return EM.encode(yg([t,Dg(yM(yM(t)),0,4)]))}function OM(t){if(null==t)return MM.en;if("string"==typeof t){const e=MM[t];return null==e&&NM.throwArgumentError("unknown locale","wordlist",t),e}return t}const QM={},UM="m/44'/60'/0'/0/0";class PM{constructor(t,e,n,r,i,o,s,a){if(t!==QM)throw new Error("HDNode constructor cannot be called directly");if(e){const t=new LA(e);BA(this,"privateKey",t.privateKey),BA(this,"publicKey",t.compressedPublicKey)}else BA(this,"privateKey",null),BA(this,"publicKey",Tg(n));var c;BA(this,"parentFingerprint",r),BA(this,"fingerprint",Dg((c=yM(this.publicKey),"0x"+kg().ripemd160().update(wg(c)).digest("hex")),0,4)),BA(this,"address",cE(this.publicKey)),BA(this,"chainCode",i),BA(this,"index",o),BA(this,"depth",s),null==a?(BA(this,"mnemonic",null),BA(this,"path",null)):"string"==typeof a?(BA(this,"mnemonic",null),BA(this,"path",a)):(BA(this,"mnemonic",a),BA(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return kM(yg([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",Tg(this.depth),this.parentFingerprint,Mg(Tg(this.index),4),this.chainCode,null!=this.privateKey?yg(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new PM(QM,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(2147483647&t));const n=new Uint8Array(37);if(t&LM){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(wg(this.privateKey),1),e&&(e+="'")}else n.set(wg(this.publicKey));for(let e=24;e>=0;e-=8)n[33+(e>>3)]=t>>24-e&255;const r=wg(BM(mM.sha512,this.chainCode,n)),i=r.slice(0,32),o=r.slice(32);let s=null,a=null;if(this.privateKey)s=FM(UA.from(i).add(this.privateKey).mod(SM));else{a=new LA(Tg(i))._addPoint(this.publicKey)}let c=e;const l=this.mnemonic;return l&&(c=Object.freeze({phrase:l.phrase,path:e,locale:l.locale||"en"})),new PM(QM,s,a,this.fingerprint,FM(o),t,this.depth+1,c)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let n=this;for(let t=0;t<e.length;t++){const r=e[t];if(r.match(/^[0-9]+'$/)){const t=parseInt(r.substring(0,r.length-1));if(t>=LM)throw new Error("invalid path index - "+r);n=n._derive(LM+t)}else{if(!r.match(/^[0-9]+$/))throw new Error("invalid path component - "+r);{const t=parseInt(r);if(t>=LM)throw new Error("invalid path index - "+r);n=n._derive(t)}}}return n}static _fromSeed(t,e){const n=wg(t);if(n.length<16||n.length>64)throw new Error("invalid seed");const r=wg(BM(mM.sha512,_M,n));return new PM(QM,FM(r.slice(0,32)),null,"0x00000000",FM(r.slice(32)),0,0,e)}static fromMnemonic(t,e,n){return t=VM(GM(t,n=OM(n)),n),PM._fromSeed(function(t,e){e||(e="");const n=Zv("mnemonic"+e,Wv.NFKD);return IM(Zv(t,Wv.NFKD),n,2048,64,"sha512")}(t,e),{phrase:t,path:"m",locale:n.locale})}static fromSeed(t){return PM._fromSeed(t,null)}static fromExtendedKey(t){const e=EM.decode(t);82===e.length&&kM(e.slice(0,78))===t||NM.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const n=e[4],r=Tg(e.slice(5,9)),i=parseInt(Tg(e.slice(9,13)).substring(2),16),o=Tg(e.slice(13,45)),s=e.slice(45,78);switch(Tg(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new PM(QM,null,Tg(s),r,o,i,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new PM(QM,Tg(s.slice(1)),null,r,o,i,n,null)}return NM.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function GM(t,e){e=OM(e),NM.checkNormalize();const n=e.split(t);if(n.length%3!=0)throw new Error("invalid mnemonic");const r=wg(new Uint8Array(Math.ceil(11*n.length/8)));let i=0;for(let t=0;t<n.length;t++){let o=e.getWordIndex(n[t].normalize("NFKD"));if(-1===o)throw new Error("invalid mnemonic");for(let t=0;t<11;t++)o&1<<10-t&&(r[i>>3]|=1<<7-i%8),i++}const o=32*n.length/3,s=xM(n.length/3);if((wg(yM(r.slice(0,o/8)))[0]&s)!==(r[r.length-1]&s))throw new Error("invalid checksum");return Tg(r.slice(0,o/8))}function VM(t,e){if(e=OM(e),(t=wg(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const n=[0];let r=11;for(let e=0;e<t.length;e++)r>8?(n[n.length-1]<<=8,n[n.length-1]|=t[e],r-=8):(n[n.length-1]<<=r,n[n.length-1]|=t[e]>>8-r,n.push(t[e]&RM(8-r)),r+=3);const i=t.length/4,o=wg(yM(t))[0]&xM(i);return n[n.length-1]<<=i,n[n.length-1]|=o>>8-i,e.join(n.map(t=>e.getWord(t)))}const jM=new dg("random/5.8.0");const HM=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==s.g)return s.g;throw new Error("unable to locate global object")}();let YM=HM.crypto||HM.msCrypto;function zM(t){(t<=0||t>1024||t%1||t!=t)&&jM.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return YM.getRandomValues(e),wg(e)}YM&&YM.getRandomValues||(jM.warn("WARNING: Missing strong random number source"),YM={getRandomValues:function(t){return jM.throwError("no secure random source avaialble",dg.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var JM=s(2872),WM=s.n(JM),qM=s(9983),KM=s.n(qM);function ZM(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wg(t)}function XM(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function $M(t){return"string"==typeof t?Zv(t,Wv.NFKC):wg(t)}function tN(t,e){let n=t;const r=e.toLowerCase().split("/");for(let t=0;t<r.length;t++){let e=null;for(const i in n)if(i.toLowerCase()===r[t]){e=n[i];break}if(null===e)return null;n=e}return n}function eN(t){const e=wg(t);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const n=Tg(e);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const nN="json-wallets/5.8.0";var rN=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const iN=new dg(nN);function oN(t){return null!=t&&t.mnemonic&&t.mnemonic.phrase}class sN extends MA{isKeystoreAccount(t){return!(!t||!t._isKeystoreAccount)}}function aN(t,e){const n=ZM(tN(t,"crypto/ciphertext"));if(Tg(zA(yg([e.slice(16,32),n]))).substring(2)!==tN(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const r=function(t,e,n){if("aes-128-ctr"===tN(t,"crypto/cipher")){const r=ZM(tN(t,"crypto/cipherparams/iv")),i=new(WM().Counter)(r);return wg(new(WM().ModeOfOperation.ctr)(e,i).decrypt(n))}return null}(t,e.slice(0,16),n);r||iN.throwError("unsupported cipher",dg.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=e.slice(32,64),o=cE(r);if(t.address){let e=t.address.toLowerCase();if("0x"!==e.substring(0,2)&&(e="0x"+e),$A(e)!==o)throw new Error("address mismatch")}const s={_isKeystoreAccount:!0,address:o,privateKey:Tg(r)};if("0.1"===tN(t,"x-ethers/version")){const e=ZM(tN(t,"x-ethers/mnemonicCiphertext")),n=ZM(tN(t,"x-ethers/mnemonicCounter")),r=new(WM().Counter)(n),o=new(WM().ModeOfOperation.ctr)(i,r),a=tN(t,"x-ethers/path")||UM,c=tN(t,"x-ethers/locale")||"en",l=wg(o.decrypt(e));try{const t=VM(l,c),e=PM.fromMnemonic(t,null,c).derivePath(a);if(e.privateKey!=s.privateKey)throw new Error("mnemonic mismatch");s.mnemonic=e.mnemonic}catch(t){if(t.code!==dg.errors.INVALID_ARGUMENT||"wordlist"!==t.argument)throw t}}return new sN(s)}function cN(t,e,n,r,i){return wg(IM(t,e,n,r,i))}function lN(t,e,n,r,i){return Promise.resolve(cN(t,e,n,r,i))}function uN(t,e,n,r,i){const o=$M(e),s=tN(t,"crypto/kdf");if(s&&"string"==typeof s){const e=function(t,e){return iN.throwArgumentError("invalid key-derivation function parameters",t,e)};if("scrypt"===s.toLowerCase()){const n=ZM(tN(t,"crypto/kdfparams/salt")),a=parseInt(tN(t,"crypto/kdfparams/n")),c=parseInt(tN(t,"crypto/kdfparams/r")),l=parseInt(tN(t,"crypto/kdfparams/p"));a&&c&&l||e("kdf",s),a&a-1&&e("N",a);const u=parseInt(tN(t,"crypto/kdfparams/dklen"));return 32!==u&&e("dklen",u),r(o,n,a,c,l,64,i)}if("pbkdf2"===s.toLowerCase()){const r=ZM(tN(t,"crypto/kdfparams/salt"));let i=null;const s=tN(t,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":e("prf",s);const a=parseInt(tN(t,"crypto/kdfparams/c")),c=parseInt(tN(t,"crypto/kdfparams/dklen"));return 32!==c&&e("dklen",c),n(o,r,a,c,i)}}return iN.throwArgumentError("unsupported key-derivation function","kdf",s)}const hN=new dg(nN);class dN extends MA{isCrowdsaleAccount(t){return!(!t||!t._isCrowdsaleAccount)}}function pN(t,e){const n=JSON.parse(t);e=$M(e);const r=$A(tN(n,"ethaddr")),i=ZM(tN(n,"encseed"));i&&i.length%16==0||hN.throwArgumentError("invalid encseed","json",t);const o=wg(IM(e,e,2e3,32,"sha256")).slice(0,16),s=i.slice(0,16),a=i.slice(16),c=new(WM().ModeOfOperation.cbc)(o,s),l=WM().padding.pkcs7.strip(wg(c.decrypt(a)));let u="";for(let t=0;t<l.length;t++)u+=String.fromCharCode(l[t]);const h=zA(Zv(u));return new dN({_isCrowdsaleAccount:!0,address:r,privateKey:h})}function fN(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function gN(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}function AN(t,e,n){if(fN(t)){n&&n(0);const r=pN(t,e);return n&&n(1),Promise.resolve(r)}return gN(t)?function(t,e,n){return rN(this,void 0,void 0,function*(){const r=JSON.parse(t);return aN(r,yield uN(r,e,lN,KM().scrypt,n))})}(t,e,n):Promise.reject(new Error("invalid JSON wallet"))}function EN(t,e){if(fN(t))return pN(t,e);if(gN(t))return function(t,e){const n=JSON.parse(t);return aN(n,uN(n,e,cN,KM().syncScrypt))}(t,e);throw new Error("invalid JSON wallet")}var mN=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const wN=new dg("wallet/5.8.0");class yN extends zv{constructor(t,e){if(super(),null!=(n=t)&&Ig(n.privateKey,32)&&null!=n.address){const e=new LA(t.privateKey);if(BA(this,"_signingKey",()=>e),BA(this,"address",cE(this.publicKey)),this.address!==$A(t.address)&&wN.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;BA(this,"_mnemonic",()=>({phrase:e.phrase,path:e.path||UM,locale:e.locale||"en"}));const n=this.mnemonic;cE(PM.fromMnemonic(n.phrase,null,n.locale).derivePath(n.path).privateKey)!==this.address&&wN.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else BA(this,"_mnemonic",()=>null)}else{if(LA.isSigningKey(t))"secp256k1"!==t.curve&&wN.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),BA(this,"_signingKey",()=>t);else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new LA(t);BA(this,"_signingKey",()=>e)}BA(this,"_mnemonic",()=>null),BA(this,"address",cE(this.publicKey))}var n;e&&!Gv.isProvider(e)&&wN.throwArgumentError("invalid provider","provider",e),BA(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new yN(this,t)}signTransaction(t){return IA(t).then(e=>{null!=e.from&&($A(e.from)!==this.address&&wN.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const n=this._signingKey().signDigest(zA(EE(e)));return EE(e,n)})}signMessage(t){return mN(this,void 0,void 0,function*(){return Sg(this._signingKey().signDigest(Xv(t)))})}_signTypedData(t,e,n){return mN(this,void 0,void 0,function*(){const r=yield gM.resolveNames(t,e,n,t=>(null==this.provider&&wN.throwError("cannot resolve ENS names without a provider",dg.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t)));return Sg(this._signingKey().signDigest(gM.hash(r.domain,e,r.value)))})}encrypt(t,e,n){if("function"!=typeof e||n||(n=e,e={}),n&&"function"!=typeof n)throw new Error("invalid callback");return e||(e={}),function(t,e,n,r){try{if($A(t.address)!==cE(t.privateKey))throw new Error("address/privateKey mismatch");if(oN(t)){const e=t.mnemonic;if(PM.fromMnemonic(e.phrase,null,e.locale).derivePath(e.path||UM).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(t){return Promise.reject(t)}"function"!=typeof n||r||(r=n,n={}),n||(n={});const i=wg(t.privateKey),o=$M(e);let s=null,a=null,c=null;if(oN(t)){const e=t.mnemonic;s=wg(GM(e.phrase,e.locale||"en")),a=e.path||UM,c=e.locale||"en"}let l=n.client;l||(l="ethers.js");let u=null;u=n.salt?wg(n.salt):zM(32);let h=null;if(n.iv){if(h=wg(n.iv),16!==h.length)throw new Error("invalid iv")}else h=zM(16);let d=null;if(n.uuid){if(d=wg(n.uuid),16!==d.length)throw new Error("invalid uuid")}else d=zM(16);let p=1<<17,f=8,g=1;return n.scrypt&&(n.scrypt.N&&(p=n.scrypt.N),n.scrypt.r&&(f=n.scrypt.r),n.scrypt.p&&(g=n.scrypt.p)),KM().scrypt(o,u,p,f,g,64,r).then(e=>{const n=(e=wg(e)).slice(0,16),r=e.slice(16,32),o=e.slice(32,64),A=new(WM().Counter)(h),E=wg(new(WM().ModeOfOperation.ctr)(n,A).encrypt(i)),m=zA(yg([r,E])),w={address:t.address.substring(2).toLowerCase(),id:eN(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Tg(h).substring(2)},ciphertext:Tg(E).substring(2),kdf:"scrypt",kdfparams:{salt:Tg(u).substring(2),n:p,dklen:32,p:g,r:f},mac:m.substring(2)}};if(s){const t=zM(16),e=new(WM().Counter)(t),n=wg(new(WM().ModeOfOperation.ctr)(o,e).encrypt(s)),r=new Date,i=r.getUTCFullYear()+"-"+XM(r.getUTCMonth()+1,2)+"-"+XM(r.getUTCDate(),2)+"T"+XM(r.getUTCHours(),2)+"-"+XM(r.getUTCMinutes(),2)+"-"+XM(r.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:l,gethFilename:"UTC--"+i+"--"+w.address,mnemonicCounter:Tg(t).substring(2),mnemonicCiphertext:Tg(n).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(w)})}(this,t,e,n)}static createRandom(t){let e=zM(16);t||(t={}),t.extraEntropy&&(e=wg(Dg(zA(yg([e,t.extraEntropy])),0,16)));const n=VM(e,t.locale);return yN.fromMnemonic(n,t.path,t.locale)}static fromEncryptedJson(t,e,n){return AN(t,e,n).then(t=>new yN(t))}static fromEncryptedJsonSync(t,e){return new yN(EN(t,e))}static fromMnemonic(t,e,n){return e||(e=UM),new yN(PM.fromMnemonic(t,null,n).derivePath(e))}}const{Kt:BN,uN:IN}=n,CN={getPublicKey:t=>wg(IN(t,!0)),getAddress:t=>BN(t).toLowerCase(),async sign(t,e){const n=function(t){if(!t)throw new Error("Private key missing");return new yN(t)}(e);return wg(await n.signMessage(t))},async verify(t,e,n){const r="string"==typeof n?n:Tg(n),i=function(t,e){return lE(Xv(t),e)}(t,e);return i.toLowerCase()===r.toLowerCase()}};const TN={[WE]:CN};s(1357);Event;const bN=["TLS_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256","TLS_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_RSA_WITH_AES_128_GCM_SHA256"],DN="node"===iy()?P:P.filter(t=>"X25519"!==t);function vN(){return{cipherSuites:bN,namedCurves:DN}}async function MN(t){const e=await async function(t){if(t instanceof ArrayBuffer)return new Uint8Array(t);if(t instanceof Uint8Array||"object"==typeof t&&t&&"buffer"in t)return t;if("string"==typeof t)return Yw(t);if("undefined"!=typeof Blob&&t instanceof Blob)return new Uint8Array(await t.arrayBuffer());throw new Error("unsupported data: "+String(t))}(t),{messages:n}=gw.decode(e);for(const t of n)await NN.call(this,t)}function NN(t){if(this.logger?.trace({msg:t},"received message"),t.connectionTerminationAlert){const e=Iv.fromProto(t.connectionTerminationAlert);return this.logger?.warn({err:"ERROR_NO_ERROR"!==e.code?e:void 0},"received connection termination alert"),void this.dispatchRPCEvent("connection-terminated",e)}const e=function(t){if(t.requestError)return{direction:"response",type:"error"};for(const e in t){if(!t[e])continue;const n=Xw(e);if(n)return n}}(t);if(e){if("response"===e.direction&&"error"===e.type)return void this.dispatchRPCEvent("rpc-response",{id:t.id,error:Iv.fromProto(t.requestError)});const n=`${e.type}Response`;return"response"===e.direction?void this.dispatchRPCEvent("rpc-response",{id:t.id,type:e.type,data:t[n]}):this.isInitialised||"init"===e.type?new Promise((r,i)=>{this.dispatchRPCEvent("rpc-request",{requestId:t.id,type:e.type,data:t[$w(e.type)],respond:o=>this.isOpen?"code"in o?(i(o),this.sendMessage({id:t.id,requestError:o.toProto()})):(r(),this.sendMessage({id:t.id,[n]:o})):(this.logger?.debug({type:e.type,res:o},"connection closed before responding"),void i(new Error("connection closed")))})}):(this.logger.warn({type:e.type},"RPC request received before initialisation"),void this.sendMessage({id:t.id,requestError:Iv.badRequest("Initialise connection first").toProto()}))}t.tunnelMessage?this.dispatchRPCEvent("tunnel-message",t.tunnelMessage):t.tunnelDisconnectEvent?this.dispatchRPCEvent("tunnel-disconnect-event",t.tunnelDisconnectEvent):this.logger.warn({msg:t},"unhandled message")}TLS_ADDITIONAL_ROOT_CA_LIST.push("-----BEGIN CERTIFICATE-----\nMIIEszCCA5ugAwIBAgIQCyWUIs7ZgSoVoE6ZUooO+jANBgkqhkiG9w0BAQsFADBh\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\nd3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH\nMjAeFw0xNzExMDIxMjI0MzNaFw0yNzExMDIxMjI0MzNaMGAxCzAJBgNVBAYTAlVT\nMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j\nb20xHzAdBgNVBAMTFlJhcGlkU1NMIFRMUyBSU0EgQ0EgRzEwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQC/uVklRBI1FuJdUEkFCuDL/I3aJQiaZ6aibRHj\nap/ap9zy1aYNrphe7YcaNwMoPsZvXDR+hNJOo9gbgOYVTPq8gXc84I75YKOHiVA4\nNrJJQZ6p2sJQyqx60HkEIjzIN+1LQLfXTlpuznToOa1hyTD0yyitFyOYwURM+/CI\n8FNFMpBhw22hpeAQkOOLmsqT5QZJYeik7qlvn8gfD+XdDnk3kkuuu0eG+vuyrSGr\n5uX5LRhFWlv1zFQDch/EKmd163m6z/ycx/qLa9zyvILc7cQpb+k7TLra9WE17YPS\nn9ANjG+ECo9PDW3N9lwhKQCNvw1gGoguyCQu7HE7BnW8eSSFAgMBAAGjggFmMIIB\nYjAdBgNVHQ4EFgQUDNtsgkkPSmcKuBTuesRIUojrVjgwHwYDVR0jBBgwFoAUTiJU\nIBiV5uNu5g/6+rkS7QYXjzkwDgYDVR0PAQH/BAQDAgGGMB0GA1UdJQQWMBQGCCsG\nAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAGAQH/AgEAMDQGCCsGAQUFBwEB\nBCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEIGA1Ud\nHwQ7MDkwN6A1oDOGMWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEds\nb2JhbFJvb3RHMi5jcmwwYwYDVR0gBFwwWjA3BglghkgBhv1sAQEwKjAoBggrBgEF\nBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzALBglghkgBhv1sAQIw\nCAYGZ4EMAQIBMAgGBmeBDAECAjANBgkqhkiG9w0BAQsFAAOCAQEAGUSlOb4K3Wtm\nSlbmE50UYBHXM0SKXPqHMzk6XQUpCheF/4qU8aOhajsyRQFDV1ih/uPIg7YHRtFi\nCTq4G+zb43X1T77nJgSOI9pq/TqCwtukZ7u9VLL3JAq3Wdy2moKLvvC8tVmRzkAe\n0xQCkRKIjbBG80MSyDX/R4uYgj6ZiNT/Zg6GI6RofgqgpDdssLc0XIRQEotxIZcK\nzP3pGJ9FCbMHmMLLyuBd+uCWvVcF2ogYAawufChS/PT61D9rqzPRS5I2uqa3tmIT\n44JhJgWhBnFMb7AGQkvNq9KNS9dd3GWc17H/dXa1enoxzWjE0hBdFjxPhUb0W3wi\n8o34/m8Fxw==\n-----END CERTIFICATE-----");class SN{eventTarget=new EventTarget;socket;logger;metadata;isInitialised=!1;constructor(t,e,n){this.socket=t,this.metadata=e,this.logger=n,t.addEventListener("error",t=>{const e=Iv.fromError(t.error||new Error(t.message),"ERROR_NETWORK_ERROR");this.dispatchRPCEvent("connection-terminated",e)}),t.addEventListener("close",()=>this.dispatchRPCEvent("connection-terminated",new Iv("ERROR_NO_ERROR","connection closed"))),t.addEventListener("message",async t=>{try{await MN.call(this,t.data)}catch(t){this.logger.error({err:t},"error processing message")}})}get isOpen(){return this.socket.readyState===this.socket.OPEN}get isClosed(){return this.socket.readyState===this.socket.CLOSED||this.socket.readyState===this.socket.CLOSING}async sendMessage(...t){if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Connection closed, cannot send message");if(!this.isOpen)throw new Iv("ERROR_NETWORK_ERROR","Wait for connection to open before sending message");const e=ey(...t),n=gw.encode(e).finish();return this.logger.trace({msg:e},"sending messages"),"sendPromise"in this.socket&&this.socket.sendPromise?await this.socket.sendPromise(n):this.socket.send(n),e}dispatchRPCEvent(t,e){const n=function(t,e){const n=new Event(t);return n.data=e,n}(t,e);this.eventTarget.dispatchEvent(n)}addEventListener(t,e){this.eventTarget.addEventListener(t,e)}removeEventListener(t,e){this.eventTarget.removeEventListener(t,e)}async terminateConnection(t){if(!this.isClosed)try{const e=t?Iv.fromError(t):new Iv("ERROR_NO_ERROR","");this.dispatchRPCEvent("connection-terminated",e),this.isOpen&&await this.sendMessage({connectionTerminationAlert:e.toProto()})}catch(t){this.logger?.error({err:t},"error terminating connection")}finally{this.socket.close()}}}function _N(t){return new WebSocket(t)}const{K3:LN}=n;class xN extends SN{waitForInitPromise;initResponse;constructor({url:t,initMessages:e=[],signatureType:n=Iw.signatureType,logger:r=uy,authRequest:i,makeWebSocket:o=_N}){const s={...Iw,signatureType:n,auth:i},a=ey({initRequest:s},...e),c=gw.encode(a).finish(),l=LN.encode(c);(t=new URL(t.toString())).searchParams.set("messages",l),super(o(t),s,r);const u=a.messages[0].id;this.waitForInitPromise=this.waitForResponse(u,Tw).then(t=>{r.info("client initialised"),this.isInitialised=!0,this.initResponse=t}),this.waitForInitPromise.catch(()=>{}),this.addEventListener("connection-terminated",t=>r.info({err:t.data},"connection terminated"))}async rpc(t,e,n=9e4){const r=Kw();this.logger.debug({type:t,id:r},"sending rpc request");const i=Date.now();try{const i=this.waitForResponse(r,n);return await this.sendMessage({id:r,[$w(t)]:e}),await i}finally{const e=Date.now()-i;this.logger.debug({type:t,timeTakenMs:e},"received rpc response")}}waitForResponse(t,e=9e4){if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Client connection already closed");return new Promise((n,r)=>{const i=e=>{e.data.id===t&&(a(),"error"in e.data?r(e.data.error):n(e.data.data))},o=t=>{a(),"ERROR_NO_ERROR"!==t.data.code?r(t.data):r(new Iv("ERROR_NETWORK_ERROR",t.data.message,t.data.data))},s=setTimeout(()=>{a(),r(new Iv("ERROR_TIMEOUT",`RPC request timed out after ${e}ms`,{id:t}))},e),a=()=>{clearTimeout(s),this.removeEventListener("rpc-response",i),this.removeEventListener("connection-terminated",o)};this.addEventListener("rpc-response",i),this.addEventListener("connection-terminated",o)})}waitForInit=()=>{if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Client connection already closed");return this.waitForInitPromise}}var RN;!function(t){t.AssignmentExpression="AssignmentExpression",t.AssignmentPattern="AssignmentPattern",t.ArrayExpression="ArrayExpression",t.ArrayPattern="ArrayPattern",t.ArrowFunctionExpression="ArrowFunctionExpression",t.AwaitExpression="AwaitExpression",t.BlockStatement="BlockStatement",t.BinaryExpression="BinaryExpression",t.BreakStatement="BreakStatement",t.CallExpression="CallExpression",t.CatchClause="CatchClause",t.ChainExpression="ChainExpression",t.ClassBody="ClassBody",t.ClassDeclaration="ClassDeclaration",t.ClassExpression="ClassExpression",t.ConditionalExpression="ConditionalExpression",t.ContinueStatement="ContinueStatement",t.Decorator="Decorator",t.DoWhileStatement="DoWhileStatement",t.DebuggerStatement="DebuggerStatement",t.EmptyStatement="EmptyStatement",t.ExportAllDeclaration="ExportAllDeclaration",t.ExportDefaultDeclaration="ExportDefaultDeclaration",t.ExportNamedDeclaration="ExportNamedDeclaration",t.ExportSpecifier="ExportSpecifier",t.ExpressionStatement="ExpressionStatement",t.ForStatement="ForStatement",t.ForOfStatement="ForOfStatement",t.ForInStatement="ForInStatement",t.FunctionDeclaration="FunctionDeclaration",t.FunctionExpression="FunctionExpression",t.Identifier="Identifier",t.IfStatement="IfStatement",t.ImportAttribute="ImportAttribute",t.ImportExpression="ImportExpression",t.ImportDeclaration="ImportDeclaration",t.ImportDefaultSpecifier="ImportDefaultSpecifier",t.ImportNamespaceSpecifier="ImportNamespaceSpecifier",t.ImportSpecifier="ImportSpecifier",t.Literal="Literal",t.LabeledStatement="LabeledStatement",t.LogicalExpression="LogicalExpression",t.MemberExpression="MemberExpression",t.MetaProperty="MetaProperty",t.MethodDefinition="MethodDefinition",t.NewExpression="NewExpression",t.ObjectExpression="ObjectExpression",t.ObjectPattern="ObjectPattern",t.Program="Program",t.Property="Property",t.PrivateIdentifier="PrivateIdentifier",t.RestElement="RestElement",t.ReturnStatement="ReturnStatement",t.SequenceExpression="SequenceExpression",t.SpreadElement="SpreadElement",t.StaticBlock="StaticBlock",t.Super="Super",t.SwitchCase="SwitchCase",t.SwitchStatement="SwitchStatement",t.TaggedTemplateExpression="TaggedTemplateExpression",t.TemplateElement="TemplateElement",t.TemplateLiteral="TemplateLiteral",t.ThisExpression="ThisExpression",t.ThrowStatement="ThrowStatement",t.TryStatement="TryStatement",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.VariableDeclaration="VariableDeclaration",t.VariableDeclarator="VariableDeclarator",t.WhileStatement="WhileStatement",t.WithStatement="WithStatement",t.YieldExpression="YieldExpression"}(RN||(RN={}));class FN{constructor(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}insertInnerComments(t,e){if(t.type===RN.BlockStatement&&0===t.body.length){const n=[];for(let t=this.leading.length-1;t>=0;--t){const r=this.leading[t];e.end.offset>=r.start&&(n.unshift(r.comment),this.leading.splice(t,1),this.trailing.splice(t,1))}n.length&&(t.innerComments=n)}}findTrailingComments(t){let e=[];if(this.trailing.length>0){for(let n=this.trailing.length-1;n>=0;--n){const r=this.trailing[n];r.start>=t.end.offset&&e.unshift(r.comment)}return this.trailing.length=0,e}const n=this.stack[this.stack.length-1];if(n&&n.node.trailingComments){const r=n.node.trailingComments[0];r&&r.range[0]>=t.end.offset&&(e=n.node.trailingComments,delete n.node.trailingComments)}return e}findLeadingComments(t){const e=[];let n;for(;this.stack.length>0;){const e=this.stack[this.stack.length-1];if(!(e&&e.start>=t.start.offset))break;n=e.node,this.stack.pop()}if(n){for(let r=(n.leadingComments?n.leadingComments.length:0)-1;r>=0;--r){const i=n.leadingComments[r];i.range[1]<=t.start.offset&&(e.unshift(i),n.leadingComments.splice(r,1))}return n.leadingComments&&0===n.leadingComments.length&&delete n.leadingComments,e}for(let n=this.leading.length-1;n>=0;--n){const r=this.leading[n];r.start<=t.start.offset&&(e.unshift(r.comment),this.leading.splice(n,1))}return e}visitNode(t,e){if(t.type===RN.Program&&t.body.length>0)return;this.insertInnerComments(t,e);const n=this.findTrailingComments(e),r=this.findLeadingComments(e);r.length>0&&(t.leadingComments=r),n.length>0&&(t.trailingComments=n),this.stack.push({node:t,start:e.start.offset})}visitComment(t,e){const n="L"===t.type[0]?"Line":"Block",r={type:n,value:t.value};if(t.range&&(r.range=t.range),t.loc&&(r.loc=t.loc),this.comments.push(r),this.attach){const r={comment:{type:n,value:t.value,range:[e.start.offset,e.end.offset]},start:e.start.offset};t.loc&&(r.comment.loc=t.loc),t.type=n,this.leading.push(r),this.trailing.push(r)}}visit(t,e){"LineComment"===t.type||"BlockComment"===t.type?this.visitComment(t,e):this.attach&&this.visitNode(t,e)}}const kN={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},ON={fromCodePoint:t=>t<65536?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10))+String.fromCharCode(56320+(t-65536&1023)),isStringWellFormedUnicode(t){for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n>=55296&&n<=56319){if(e===t.length-1)return!1;if(e++,n=t.charCodeAt(e),n<56320&&n>57343)return!1}else if(n>=56320&&n<=57343)return!1}return!0},isWhiteSpace:t=>32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0,isLineTerminator:t=>10===t||13===t||8232===t||8233===t,isIdentifierStart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&kN.NonAsciiIdentifierStart.test(ON.fromCodePoint(t)),isIdentifierPart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&kN.NonAsciiIdentifierPart.test(ON.fromCodePoint(t)),isDecimalDigit:t=>t>=48&&t<=57,isDecimalDigitChar:t=>1===t.length&&ON.isDecimalDigit(t.charCodeAt(0)),isHexDigit:t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,isHexDigitChar:t=>1===t.length&&ON.isHexDigit(t.charCodeAt(0)),isOctalDigit:t=>t>=48&&t<=55,isOctalDigitChar:t=>1===t.length&&ON.isOctalDigit(t.charCodeAt(0))};var QN;!function(t){t.JSXAttribute="JSXAttribute",t.JSXClosingElement="JSXClosingElement",t.JSXClosingFragment="JSXClosingFragment",t.JSXElement="JSXElement",t.JSXEmptyExpression="JSXEmptyExpression",t.JSXExpressionContainer="JSXExpressionContainer",t.JSXIdentifier="JSXIdentifier",t.JSXMemberExpression="JSXMemberExpression",t.JSXNamespacedName="JSXNamespacedName",t.JSXOpeningElement="JSXOpeningElement",t.JSXOpeningFragment="JSXOpeningFragment",t.JSXSpreadAttribute="JSXSpreadAttribute",t.JSXText="JSXText"}(QN||(QN={}));class UN{constructor(t){this.type=QN.JSXClosingElement,this.name=t}}class PN{constructor(){this.type=QN.JSXClosingFragment}}class GN{constructor(t,e,n){this.type=QN.JSXElement,this.openingElement=t,this.children=e,this.closingElement=n}}class VN{constructor(){this.type=QN.JSXEmptyExpression}}class jN{constructor(t){this.type=QN.JSXExpressionContainer,this.expression=t}}class HN{constructor(t){this.type=QN.JSXIdentifier,this.name=t}}class YN{constructor(t,e){this.type=QN.JSXMemberExpression,this.object=t,this.property=e}}class zN{constructor(t,e){this.type=QN.JSXAttribute,this.name=t,this.value=e}}class JN{constructor(t,e){this.type=QN.JSXNamespacedName,this.namespace=t,this.name=e}}class WN{constructor(t,e,n){this.type=QN.JSXOpeningElement,this.name=t,this.selfClosing=e,this.attributes=n}}class qN{constructor(t){this.type=QN.JSXOpeningFragment,this.selfClosing=t}}class KN{constructor(t){this.type=QN.JSXSpreadAttribute,this.argument=t}}class ZN{constructor(t,e){this.type=QN.JSXText,this.value=t,this.raw=e}}class XN{constructor(t){this.type=RN.ArrayExpression,this.elements=t}}class $N{constructor(t){this.type=RN.ArrayPattern,this.elements=t}}class tS{constructor(t,e,n,r){this.type=RN.ArrowFunctionExpression,this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=n,this.async=r}}class eS{constructor(t,e,n){this.type=RN.AssignmentExpression,this.operator=t,this.left=e,this.right=n}}class nS{constructor(t,e){this.type=RN.AssignmentPattern,this.left=t,this.right=e}}class rS{constructor(t,e,n,r){this.type=RN.FunctionDeclaration,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!0}}class iS{constructor(t){this.type=RN.AwaitExpression,this.argument=t}}class oS{constructor(t,e,n){this.type=RN.Literal,this.value=t,this.raw=e,this.bigint=n}}class sS{constructor(t,e,n){this.type=RN.BinaryExpression,this.operator=t,this.left=e,this.right=n}}class aS{constructor(t){this.type=RN.BlockStatement,this.body=t}}class cS{constructor(t){this.type=RN.BreakStatement,this.label=t}}class lS{constructor(t,e,n){this.type=RN.CallExpression,this.callee=t,this.arguments=e,this.optional=n}}class uS{constructor(t,e){this.type=RN.CatchClause,this.param=t,this.body=e}}class hS{constructor(t){this.type=RN.ChainExpression,this.expression=t}}class dS{constructor(t){this.type=RN.ClassBody,this.body=t}}class pS{constructor(t,e,n,r){this.type=RN.ClassDeclaration,this.id=t,this.superClass=e,this.body=n,this.decorators=r}}class fS{constructor(t,e,n,r){this.type=RN.ClassExpression,this.id=t,this.superClass=e,this.body=n,this.decorators=r}}class gS{constructor(t,e,n){this.type=RN.ConditionalExpression,this.test=t,this.consequent=e,this.alternate=n}}class AS{constructor(t){this.type=RN.ContinueStatement,this.label=t}}class ES{constructor(){this.type=RN.DebuggerStatement}}class mS{constructor(t){this.type=RN.Decorator,this.expression=t}}class wS{constructor(t,e){this.type=RN.ExpressionStatement,this.expression=t,this.directive=e}}class yS{constructor(t,e){this.type=RN.DoWhileStatement,this.body=t,this.test=e}}class BS{constructor(){this.type=RN.EmptyStatement}}class IS{constructor(t,e,n){this.type=RN.ExportAllDeclaration,this.source=t,this.exported=e,this.assertions=n}}class CS{constructor(t){this.type=RN.ExportDefaultDeclaration,this.declaration=t}}class TS{constructor(t,e,n,r){this.type=RN.ExportNamedDeclaration,this.declaration=t,this.specifiers=e,this.source=n,this.assertions=r}}class bS{constructor(t,e){this.type=RN.ExportSpecifier,this.exported=e,this.local=t}}class DS{constructor(t){this.type=RN.ExpressionStatement,this.expression=t}}class vS{constructor(t,e,n){this.type=RN.ForInStatement,this.left=t,this.right=e,this.body=n,this.each=!1}}class MS{constructor(t,e,n,r){this.type=RN.ForOfStatement,this.await=r,this.left=t,this.right=e,this.body=n}}class NS{constructor(t,e,n,r){this.type=RN.ForStatement,this.init=t,this.test=e,this.update=n,this.body=r}}class SS{constructor(t,e,n,r){this.type=RN.FunctionDeclaration,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!1}}class _S{constructor(t,e,n,r,i){this.type=RN.FunctionExpression,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=i}}class LS{constructor(t){this.type=RN.Identifier,this.name=t}}class xS{constructor(t,e,n){this.type=RN.IfStatement,this.test=t,this.consequent=e,this.alternate=n}}class RS{constructor(t,e){this.type=RN.ImportAttribute,this.key=t,this.value=e}}class FS{constructor(t,e){this.type=RN.ImportExpression,this.source=t,this.attributes=e}}class kS{constructor(t,e,n){this.type=RN.ImportDeclaration,this.specifiers=t,this.source=e,this.assertions=n}}class OS{constructor(t){this.type=RN.ImportDefaultSpecifier,this.local=t}}class QS{constructor(t){this.type=RN.ImportNamespaceSpecifier,this.local=t}}class US{constructor(t,e){this.type=RN.ImportSpecifier,this.local=t,this.imported=e}}class PS{constructor(t,e){this.type=RN.LabeledStatement,this.label=t,this.body=e}}class GS{constructor(t,e){this.type=RN.Literal,this.value=t,this.raw=e}}class VS{constructor(t,e,n){this.type=RN.LogicalExpression,this.operator=t,this.left=e,this.right=n}}class jS{constructor(t,e,n,r){this.type=RN.MemberExpression,this.computed=t,this.object=e,this.property=n,this.optional=r}}class HS{constructor(t,e){this.type=RN.MetaProperty,this.meta=t,this.property=e}}class YS{constructor(t,e,n,r,i,o){this.type=RN.MethodDefinition,this.key=t,this.computed=e,this.value=n,this.kind=r,this.static=i,this.decorators=o}}class zS{constructor(t){this.type=RN.Program,this.body=t,this.sourceType="module"}}class JS{constructor(t,e){this.type=RN.NewExpression,this.callee=t,this.arguments=e}}class WS{constructor(t){this.type=RN.ObjectExpression,this.properties=t}}class qS{constructor(t){this.type=RN.ObjectPattern,this.properties=t}}class KS{constructor(t){this.type=RN.PrivateIdentifier,this.name=t}}class ZS{constructor(t,e,n,r,i,o){this.type=RN.Property,this.key=e,this.computed=n,this.value=r,this.kind=t,this.method=i,this.shorthand=o}}class XS{constructor(t,e,n,r,i){this.type=RN.Property,this.key=t,this.computed=e,this.value=n,this.static=r,this.decorators=i}}class $S{constructor(t,e,n,r){this.type=RN.Literal,this.value=t,this.raw=e,this.regex={pattern:n,flags:r}}}class t_{constructor(t){this.type=RN.RestElement,this.argument=t}}class e_{constructor(t){this.type=RN.ReturnStatement,this.argument=t}}class n_{constructor(t){this.type=RN.Program,this.body=t,this.sourceType="script"}}class r_{constructor(t){this.type=RN.SequenceExpression,this.expressions=t}}class i_{constructor(t){this.type=RN.SpreadElement,this.argument=t}}class o_{constructor(t){this.type=RN.StaticBlock,this.body=t}}class s_{constructor(){this.type=RN.Super}}class a_{constructor(t,e){this.type=RN.SwitchCase,this.test=t,this.consequent=e}}class c_{constructor(t,e){this.type=RN.SwitchStatement,this.discriminant=t,this.cases=e}}class l_{constructor(t,e){this.type=RN.TaggedTemplateExpression,this.tag=t,this.quasi=e}}class u_{constructor(t,e){this.type=RN.TemplateElement,this.value=t,this.tail=e}}class h_{constructor(t,e){this.type=RN.TemplateLiteral,this.quasis=t,this.expressions=e}}class d_{constructor(){this.type=RN.ThisExpression}}class p_{constructor(t){this.type=RN.ThrowStatement,this.argument=t}}class f_{constructor(t,e,n){this.type=RN.TryStatement,this.block=t,this.handler=e,this.finalizer=n}}class g_{constructor(t,e){this.type=RN.UnaryExpression,this.operator=t,this.argument=e,this.prefix=!0}}class A_{constructor(t,e,n){this.type=RN.UpdateExpression,this.operator=t,this.argument=e,this.prefix=n}}class E_{constructor(t,e){this.type=RN.VariableDeclaration,this.declarations=t,this.kind=e}}class m_{constructor(t,e){this.type=RN.VariableDeclarator,this.id=t,this.init=e}}class w_{constructor(t,e){this.type=RN.WhileStatement,this.test=t,this.body=e}}class y_{constructor(t,e){this.type=RN.WithStatement,this.object=t,this.body=e}}class B_{constructor(t,e){this.type=RN.YieldExpression,this.argument=t,this.delegate=e}}function I_(t,e){if(!t)throw new Error("ASSERT: "+e)}class C_{constructor(){this.errors=[],this.tolerant=!1}recordError(t){this.errors.push(t)}tolerate(t){if(!this.tolerant)throw t;this.recordError(t)}constructError(t,e){let n=new Error(t);try{throw n}catch(t){Object.create&&Object.defineProperty&&(n=Object.create(t),Object.defineProperty(n,"column",{value:e}))}return n}createError(t,e,n,r){const i="Line "+e+": "+r,o=this.constructError(i,n);o.index=t,o.lineNumber=e,o.description=r;return o}throwError(t,e,n,r){throw this.createError(t,e,n,r)}tolerateError(t,e,n,r){const i=this.createError(t,e,n,r);if(!this.tolerant)throw i;this.recordError(i)}}const T_="Async functions can only be declared at the top level or inside a block.",b_="Unexpected token",D_="Getter must not have any formal parameters",v_="Setter must have exactly one formal parameter",M_="Setter function argument must not be a rest parameter",N_="Cannot use 'import.meta' outside a module",S_="Class constructor may not be an async method",__="Class constructor may not be a private method",L_="Class constructor may not be an accessor",x_="Missing initializer in %0 declaration",R_="Unexpected token =",F_="Unexpected token =",k_="Duplicate binding %0",O_="A class may only have one constructor",Q_="Duplicate parameter name not allowed in this context",U_="Duplicate __proto__ fields are not allowed in object literals",P_="%0 loop variable declaration may not have an initializer",G_="Generator declarations are not allowed in legacy contexts",V_="Illegal break statement",j_="Illegal continue statement",H_="Unexpected token",Y_="Unexpected token",z_="Illegal 'use strict' directive in function with non-simple parameter list",J_="Illegal return statement",W_="Keyword must not contain escaped characters",q_="Invalid hexadecimal escape sequence",K_="Invalid left-hand side in assignment",Z_="Invalid left-hand side in for-in",X_="Invalid left-hand side in for-loop",$_="Unexpected token",tL="Invalid regular expression",eL="Invalid tagged template on optional chain",nL="Invalid Unicode escape sequence",rL="let is disallowed as a lexically bound name",iL="Unexpected token",oL="More than one default clause in switch statement",sL="Illegal newline after throw",aL="Unexpected token",cL="The `as` and `from` contextual keywords must not contain Unicode escape sequences.",lL="Missing catch or finally after try",uL="Decorators must not be followed by a semicolon.",hL="Numeric separator must be exactly one underscore",dL="Numeric separator is not allowed here",pL="Rest parameter must be last formal parameter",fL="Unexpected token",gL="%0 '%1' has already been declared",AL="Classes may not have static property named prototype",EL="Catch variable may not be eval or arguments in strict mode",mL="Delete of an unqualified identifier in strict mode.",wL="In strict mode code, functions can only be declared at top level or inside a block",yL="Function name may not be eval or arguments in strict mode",BL="Assignment to eval or arguments is not allowed in strict mode",IL="Postfix increment/decrement may not have eval or arguments operand in strict mode",CL="Prefix increment/decrement may not have eval or arguments operand in strict mode",TL="Strict mode code may not include a with statement",bL="Octal literals are not allowed in strict mode.",DL="Parameter name eval or arguments is not allowed in strict mode",vL="Use of future reserved word in strict mode",ML="Variable name may not be eval or arguments in strict mode",NL="Octal literals are not allowed in template strings.",SL="\\8 and \\9 are not allowed in template strings.",_L="Unexpected end of input",LL="Unexpected identifier",xL="Unexpected number",RL="Unexpected reserved word",FL="Unexpected string",kL="'super' keyword unexpected here",OL="Unexpected quasi %0",QL="Unexpected token %0",UL="Unexpected token ILLEGAL",PL="Undefined label '%0'",GL="Invalid regular expression: missing /";function VL(t){return"0123456789abcdef".indexOf(t.toLowerCase())}function jL(t){return"01234567".indexOf(t)}class HL{constructor(t,e){this.source=t,this.errorHandler=e,this.trackComment=!1,this.isModule=!1,this.length=t.length,this.index=0,this.lineNumber=t.length>0?1:0,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart,this.curlyStack=t.curlyStack}eof(){return this.index>=this.length}throwUnexpectedToken(t=UL){return this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}tolerateUnexpectedToken(t=UL){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}skipSingleLineComment(t){let e,n,r=[];for(this.trackComment&&(r=[],e=this.index-t,n={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{}});!this.eof();){const i=this.source.charCodeAt(this.index);if(++this.index,ON.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};const i={multiLine:!1,slice:[e+t,this.index-1],range:[e,this.index-1],loc:n};r.push(i)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};const i={multiLine:!1,slice:[e+t,this.index],range:[e,this.index],loc:n};r.push(i)}return r}skipMultiLineComment(){let t,e,n=[];for(this.trackComment&&(n=[],t=this.index-2,e={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){const r=this.source.charCodeAt(this.index);if(ON.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:e};n.push(r)}return n}++this.index}else++this.index}if(this.trackComment){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:e};n.push(r)}return this.tolerateUnexpectedToken(),n}scanComments(){let t;this.trackComment&&(t=[]);let e=0===this.index;for(;!this.eof();){let n=this.source.charCodeAt(this.index);if(ON.isWhiteSpace(n))++this.index;else if(ON.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,e=!0;else if(47===n)if(n=this.source.charCodeAt(this.index+1),47===n){this.index+=2;const n=this.skipSingleLineComment(2);this.trackComment&&(t=t.concat(n)),e=!0}else{if(42!==n)break;{this.index+=2;const e=this.skipMultiLineComment();this.trackComment&&(t=t.concat(e))}}else if(e&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;{this.index+=3;const e=this.skipSingleLineComment(3);this.trackComment&&(t=t.concat(e))}}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;{this.index+=4;const e=this.skipSingleLineComment(4);this.trackComment&&(t=t.concat(e))}}}return t}isFutureReservedWord(t){switch(t){case"enum":case"export":case"import":case"super":return!0;default:return!1}}isStrictModeReservedWord(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}isRestrictedWord(t){return"eval"===t||"arguments"===t}isKeyword(t){switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}codePointAt(t){let e=this.source.charCodeAt(t);if(e>=55296&&e<=56319){const n=this.source.charCodeAt(t+1);if(n>=56320&&n<=57343){e=1024*(e-55296)+n-56320+65536}}return e}scanHexEscape(t){const e="u"===t?4:2;let n=0;for(let t=0;t<e;++t){if(this.eof()||!ON.isHexDigit(this.source.charCodeAt(this.index)))return null;n=16*n+VL(this.source[this.index++])}return String.fromCharCode(n)}tryToScanUnicodeCodePointEscape(){let t=this.source[this.index],e=0;if("}"===t)return null;for(;!this.eof()&&(t=this.source[this.index++],ON.isHexDigit(t.charCodeAt(0)));)e=16*e+VL(t);return e>1114111||"}"!==t?null:ON.fromCodePoint(e)}scanUnicodeCodePointEscape(){const t=this.tryToScanUnicodeCodePointEscape();return null===t?this.throwUnexpectedToken():t}getIdentifier(){const t=this.index++;for(;!this.eof();){const e=this.source.charCodeAt(this.index);if(92===e)return this.index=t,this.getComplexIdentifier();if(e>=55296&&e<57343)return this.index=t,this.getComplexIdentifier();if(!ON.isIdentifierPart(e))break;++this.index}return this.source.slice(t,this.index)}getComplexIdentifier(){let t,e=this.codePointAt(this.index),n=ON.fromCodePoint(e);for(this.index+=n.length,92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&ON.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken()),n=t);!this.eof()&&(e=this.codePointAt(this.index),ON.isIdentifierPart(e));)t=ON.fromCodePoint(e),n+=t,this.index+=t.length,92===e&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&ON.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken()),n+=t);return n}octalToDecimal(t){let e="0"!==t,n=jL(t);return!this.eof()&&ON.isOctalDigit(this.source.charCodeAt(this.index))&&(e=!0,n=8*n+jL(this.source[this.index++]),"0123".indexOf(t)>=0&&!this.eof()&&ON.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+jL(this.source[this.index++]))),{code:n,octal:e}}scanIdentifier(){let t;const e=this.index,n=92===this.source.charCodeAt(e),r=n?this.getComplexIdentifier():this.getIdentifier();if(t=1===r.length?3:this.isKeyword(r)?4:"null"===r?5:"true"===r||"false"===r?1:3,3!==t&&e+r.length!==this.index){const t=this.index;this.index=e,this.tolerateUnexpectedToken(W_),this.index=t}return{type:t,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index,escaped:n}}scanPunctuator(){const t=this.index;let e=this.source[this.index];switch(e){case"(":case"{":"{"===e&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,e="...");break;case"}":++this.index,this.curlyStack.pop();break;case"?":++this.index,"?"===this.source[this.index]&&(++this.index,"="===this.source[this.index]?(++this.index,e="??="):e="??"),"."!==this.source[this.index]||/^\d$/.test(this.source[this.index+1])||(++this.index,e="?.");break;case"#":case")":case";":case",":case"[":case"]":case":":case"~":case"@":++this.index;break;default:e=this.source.substr(this.index,4),">>>="===e?this.index+=4:(e=e.substr(0,3),"==="===e||"!=="===e||">>>"===e||"<<="===e||">>="===e||"**="===e||"&&="===e||"||="===e?this.index+=3:(e=e.substr(0,2),"&&"===e||"||"===e||"=="===e||"!="===e||"+="===e||"-="===e||"*="===e||"/="===e||"++"===e||"--"===e||"<<"===e||">>"===e||"&="===e||"|="===e||"^="===e||"%="===e||"<="===e||">="===e||"=>"===e||"**"===e?this.index+=2:(e=this.source[this.index],"<>=!+-*%&|^/".indexOf(e)>=0&&++this.index)))}return this.index===t&&this.throwUnexpectedToken(),{type:7,value:e,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanHexLiteral(t){let e=this.scanLiteralPart(ON.isHexDigitChar);return 0===e.length&&this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0x"+e),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}):(ON.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+e,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index})}scanBinaryLiteral(t){let e,n=this.scanLiteralPart(t=>"0"===t||"1"===t);return 0===n.length&&this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0b"+n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}):(this.eof()||(e=this.source.charCodeAt(this.index),(ON.isIdentifierStart(e)||ON.isDecimalDigit(e))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index})}scanOctalLiteral(t,e){let n="",r=!1;return ON.isOctalDigit(t.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index,n+=this.scanLiteralPart(ON.isOctalDigitChar),r||0!==n.length||this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0o"+n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}):((ON.isIdentifierStart(this.source.charCodeAt(this.index))||ON.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index})}isImplicitOctalLiteral(){for(let t=this.index+1;t<this.length;++t){const e=this.source[t];if("8"===e||"9"===e||"n"===e)return!1;if(!ON.isOctalDigit(e.charCodeAt(0)))return!0}return!0}scanLiteralPart(t){let e="";for("_"===this.source[this.index]&&this.throwUnexpectedToken(dL);this.source[this.index]&&(t(this.source[this.index])||"_"===this.source[this.index]);)"_"!==this.source[this.index]&&(e+=this.source[this.index]),this.index++,"_"===this.source[this.index-1]&&"_"===this.source[this.index]&&this.throwUnexpectedToken(hL);return"_"===this.source[this.index-1]&&this.throwUnexpectedToken(dL),e}scanNumericLiteral(){const t=this.index;let e=this.source[t];I_(ON.isDecimalDigit(e.charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point");let n="";if("."!==e){if(n=this.source[this.index++],e=this.source[this.index],"0"===n){if("x"===e||"X"===e)return++this.index,this.scanHexLiteral(t);if("b"===e||"B"===e)return++this.index,this.scanBinaryLiteral(t);if("o"===e||"O"===e)return this.scanOctalLiteral(e,t);if(e&&ON.isOctalDigit(e.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(e,t)}this.index--,n=this.scanLiteralPart(ON.isDecimalDigitChar),e=this.source[this.index]}if("."===e&&(n+=this.source[this.index++],n+=this.scanLiteralPart(ON.isDecimalDigitChar),e=this.source[this.index]),"e"===e||"E"===e)n+=this.source[this.index++],e=this.source[this.index],"+"!==e&&"-"!==e||(n+=this.source[this.index++]),ON.isDecimalDigit(this.source.charCodeAt(this.index))?n+=this.scanLiteralPart(ON.isDecimalDigitChar):this.throwUnexpectedToken();else if("n"===e)return n.length>1&&"0"===n[0]&&this.throwUnexpectedToken(),this.index++,{type:6,value:BigInt(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index};return ON.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseFloat(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanStringLiteral(){const t=this.index;let e=this.source[t];I_("'"===e||'"'===e,"String literal must starts with a quote"),++this.index;let n=!1,r="";for(;!this.eof();){let t=this.source[this.index++];if(t===e){e="";break}if("\\"===t)if(t=this.source[this.index++],t&&ON.isLineTerminator(t.charCodeAt(0)))++this.lineNumber,"\r"===t&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(t){case"u":if("{"===this.source[this.index])++this.index,r+=this.scanUnicodeCodePointEscape();else{const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(),r+=e}break;case"x":const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(q_),r+=e;break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;case"8":case"9":r+=t,this.tolerateUnexpectedToken();break;default:if(t&&ON.isOctalDigit(t.charCodeAt(0))){const e=this.octalToDecimal(t);n=e.octal||n,r+=String.fromCharCode(e.code)}else r+=t}else{if(ON.isLineTerminator(t.charCodeAt(0)))break;r+=t}}return""!==e&&(this.index=t,this.throwUnexpectedToken()),{type:8,value:r,octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanTemplate(){let t="",e=!1;const n=this.index,r="`"===this.source[n];let i=!1,o=null,s=2;for(++this.index;!this.eof();){let n=this.source[this.index++];if("`"===n){s=1,i=!0,e=!0;break}if("$"===n){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,e=!0;break}t+=n}else{if(null!==o)continue;if("\\"===n)if(n=this.source[this.index++],ON.isLineTerminator(n.charCodeAt(0)))++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":if("{"===this.source[this.index]){++this.index;const e=this.tryToScanUnicodeCodePointEscape();null===e?o="u":t+=e}else{const e=this.scanHexEscape(n);null===e?o="u":t+=e}break;case"x":const e=this.scanHexEscape(n);null===e?o="x":t+=e;break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:"0"===n?ON.isDecimalDigit(this.source.charCodeAt(this.index))?o="0":t+="\0":ON.isDecimalDigitChar(n)?o=n:t+=n}else ON.isLineTerminator(n.charCodeAt(0))?(++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,t+="\n"):t+=n}}return e||this.throwUnexpectedToken(),r||this.curlyStack.pop(),{type:10,value:this.source.slice(n+1,this.index-s),cooked:null===o?t:null,head:r,tail:i,notEscapeSequenceHead:o,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}testRegExp(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(t,e,n)=>{const r=parseInt(e||n,16);return r>1114111&&this.throwUnexpectedToken(tL),r<=65535?String.fromCharCode(r):""}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,""));try{RegExp(n)}catch(t){this.throwUnexpectedToken(tL)}try{return new RegExp(t,e)}catch(t){return null}}scanRegExpBody(){let t=this.source[this.index];I_("/"===t,"Regular expression literal must start with a slash");let e=this.source[this.index++],n=!1,r=!1;for(;!this.eof();)if(t=this.source[this.index++],e+=t,"\\"===t)t=this.source[this.index++],ON.isLineTerminator(t.charCodeAt(0))&&this.throwUnexpectedToken(GL),e+=t;else if(ON.isLineTerminator(t.charCodeAt(0)))this.throwUnexpectedToken(GL);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||this.throwUnexpectedToken(GL),e.substr(1,e.length-2)}scanRegExpFlags(){let t="",e="";for(;!this.eof();){let n=this.source[this.index];if(!ON.isIdentifierPart(n.charCodeAt(0)))break;if(++this.index,"\\"!==n||this.eof())e+=n,t+=n;else if(n=this.source[this.index],"u"===n){++this.index;let n=this.index;const r=this.scanHexEscape("u");if(null!==r)for(e+=r,t+="\\u";n<this.index;++n)t+=this.source[n];else this.index=n,e+="u",t+="\\u";this.tolerateUnexpectedToken()}else t+="\\",this.tolerateUnexpectedToken()}return e}scanRegExp(){const t=this.index,e=this.scanRegExpBody(),n=this.scanRegExpFlags();return{type:9,value:"",pattern:e,flags:n,regex:this.testRegExp(e,n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}lex(){if(this.eof())return{type:2,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const t=this.source.charCodeAt(this.index);return ON.isIdentifierStart(t)?this.scanIdentifier():40===t||41===t||59===t?this.scanPunctuator():39===t||34===t?this.scanStringLiteral():46===t?ON.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():ON.isDecimalDigit(t)?this.scanNumericLiteral():96===t||125===t&&"${"===this.curlyStack[this.curlyStack.length-1]?this.scanTemplate():t>=55296&&t<57343&&ON.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}}const YL={1:"Boolean",2:"<end>",3:"Identifier",4:"Keyword",5:"Null",6:"Numeric",7:"Punctuator",8:"String",9:"RegularExpression",10:"Template"},zL="ArrowParameterPlaceHolder";class JL{constructor(t,e={},n){this.config={range:"boolean"==typeof e.range&&e.range,loc:"boolean"==typeof e.loc&&e.loc,source:null,tokens:"boolean"==typeof e.tokens&&e.tokens,comment:"boolean"==typeof e.comment&&e.comment,tolerant:"boolean"==typeof e.tolerant&&e.tolerant},this.config.loc&&e.source&&null!==e.source&&(this.config.source=String(e.source)),this.delegate=n,this.errorHandler=new C_,this.errorHandler.tolerant=1==this.config.tolerant,this.scanner=new HL(t,this.errorHandler),this.scanner.trackComment=1==this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"??":5,"||":6,"&&":7,"|":8,"^":9,"&":10,"==":11,"!=":11,"===":11,"!==":11,"<":12,">":12,"<=":12,">=":12,"<<":13,">>":13,">>>":13,"+":14,"-":14,"*":15,"/":15,"%":15},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,isAsync:!1,allowIn:!0,allowStrictDirective:!0,allowSuper:!1,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inConstructor:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,inClassConstructor:!1,labelSet:{},strict:!1,decorators:null},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,(t,e)=>(I_(e<n.length,"Message reference must be in range"),n[e])),i=this.lastMarker.index,o=this.lastMarker.line,s=this.lastMarker.column+1;throw this.errorHandler.createError(i,o,s,r)}tolerateError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,(t,e)=>(I_(e<n.length,"Message reference must be in range"),n[e])),i=this.lastMarker.index,o=this.scanner.lineNumber,s=this.lastMarker.column+1;this.errorHandler.tolerateError(i,o,s,r)}unexpectedTokenError(t,e){let n,r=e||QL;if(t?(e||(r=2===t.type?_L:3===t.type?LL:6===t.type?xL:8===t.type?FL:10===t.type?OL:QL,4===t.type&&(this.scanner.isFutureReservedWord(t.value)?r=RL:this.context.strict&&this.scanner.isStrictModeReservedWord(t.value)&&(r=vL))),n=t.value):n="ILLEGAL",r=r.replace("%0",n),t&&"number"==typeof t.lineNumber){const e=t.start,n=t.lineNumber,i=this.lastMarker.index-this.lastMarker.column,o=t.start-i+1;return this.errorHandler.createError(e,n,o,r)}{const t=this.lastMarker.index,e=this.lastMarker.line,n=this.lastMarker.column+1;return this.errorHandler.createError(t,e,n,r)}}throwUnexpectedToken(t,e){throw this.unexpectedTokenError(t,e)}tolerateUnexpectedToken(t,e){this.errorHandler.tolerate(this.unexpectedTokenError(t,e))}tolerateInvalidLoopStatement(){(this.matchKeyword("class")||this.matchKeyword("function"))&&this.tolerateError(QL,this.lookahead)}collectComments(){if(this.config.comment){const t=this.scanner.scanComments();if(t.length>0&&this.delegate)for(let e=0;e<t.length;++e){const n=t[e],r={type:n.multiLine?"BlockComment":"LineComment",value:this.scanner.source.slice(n.slice[0],n.slice[1])};this.config.range&&(r.range=n.range),this.config.loc&&(r.loc=n.loc);const i={start:{line:n.loc.start.line,column:n.loc.start.column,offset:n.range[0]},end:{line:n.loc.end.line,column:n.loc.end.column,offset:n.range[1]}};this.delegate(r,i)}}else this.scanner.scanComments()}getTokenRaw(t){return this.scanner.source.slice(t.start,t.end)}convertToken(t){const e={type:YL[t.type],value:this.getTokenRaw(t)};if(this.config.range&&(e.range=[t.start,t.end]),this.config.loc&&(e.loc={start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),9===t.type){const n=t.pattern,r=t.flags;e.regex={pattern:n,flags:r}}return e}nextToken(){const t=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.collectComments(),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart);const e=this.scanner.lex();return this.hasLineTerminator=t.lineNumber!==e.lineNumber,e&&this.context.strict&&3===e.type&&this.scanner.isStrictModeReservedWord(e.value)&&(e.type=4),this.lookahead=e,this.config.tokens&&2!==e.type&&this.tokens.push(this.convertToken(e)),t}nextRegexToken(){this.collectComments();const t=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(t))),this.lookahead=t,this.nextToken(),t}createNode(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}startNode(t,e=0){let n=t.start-t.lineStart,r=t.lineNumber;return n<0&&(n+=e,r--),{index:t.start,line:r,column:n}}finalize(t,e){if(this.config.range&&(e.range=[t.index,this.lastMarker.index]),this.config.loc&&(e.loc={start:{line:t.line,column:t.column},end:{line:this.lastMarker.line,column:this.lastMarker.column}},this.config.source&&(e.loc.source=this.config.source)),this.delegate){const n={start:{line:t.line,column:t.column,offset:t.index},end:{line:this.lastMarker.line,column:this.lastMarker.column,offset:this.lastMarker.index}};this.delegate(e,n)}return e}expect(t){const e=this.nextToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}expectCommaSeparator(){if(this.config.tolerant){const t=this.lookahead;7===t.type&&","===t.value?this.nextToken():7===t.type&&";"===t.value?(this.nextToken(),this.tolerateUnexpectedToken(t)):this.tolerateUnexpectedToken(t,QL)}else this.expect(",")}expectKeyword(t){const e=this.nextToken();4===e.type&&e.value===t||this.throwUnexpectedToken(e)}match(t){return 7===this.lookahead.type&&this.lookahead.value===t}matchKeyword(t){return 4===this.lookahead.type&&this.lookahead.value===t}matchContextualKeyword(t){return 3===this.lookahead.type&&this.lookahead.value===t}matchAssign(){if(7!==this.lookahead.type)return!1;const t=this.lookahead.value;return"="===t||"*="===t||"**="===t||"/="===t||"%="===t||"+="===t||"-="===t||"<<="===t||">>="===t||">>>="===t||"&="===t||"^="===t||"|="===t||"&&="===t||"||="===t||"??="===t}isolateCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const i=t.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=e,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,i}inheritCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const i=t.call(this);return this.context.isBindingElement=this.context.isBindingElement&&e,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,i}consumeSemicolon(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)}parsePrimaryExpression(){const t=this.createNode();let e,n,r;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.isAsync)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(t,new LS(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,bL),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e="bigint"==typeof n.value?this.finalize(t,new oS(n.value,r,n.value.toString())):this.finalize(t,new GS(n.value,r));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new GS("true"===n.value,r));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new GS(null,r));break;case 10:e=this.parseTemplateLiteral({isTagged:!1});break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,n=this.nextRegexToken(),r=this.getTokenRaw(n),e=this.finalize(t,new $S(n.regex,r,n.pattern,n.flags));break;case"#":this.nextToken(),e=this.finalize(t,new KS(this.nextToken().value));break;case"@":let i=this.parseDecorators();this.context.decorators=i,this.parsePrimaryExpression(),this.context.decorators=null,e=this.finalize(t,new KS(this.nextToken().value));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(t,new LS(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(t,new d_)):this.matchKeyword("class")?e=this.parseClassExpression():this.matchKeyword("new")?e=this.parseNewExpression():this.matchImportCall()?e=this.parseImportCall():this.matchImportMeta()?(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,N_),e=this.parseImportMeta()):e=this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e}parseSpreadElement(){const t=this.createNode();this.expect("...");const e=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(t,new i_(e))}parseArrayInitializer(){const t=this.createNode(),e=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),e.push(null);else if(this.match("...")){const t=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),e.push(t)}else e.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(t,new XN(e))}parsePropertyMethod(t){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=t.simple;const r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&t.firstRestricted&&this.tolerateUnexpectedToken(t.firstRestricted,t.message),this.context.strict&&t.stricted&&this.tolerateUnexpectedToken(t.stricted,t.message),this.context.strict=e,this.context.allowStrictDirective=n,r}parsePropertyMethodFunction(t){const e=this.createNode(),n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters(),i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(e,new _S(null,r.params,i,t,!1))}parsePropertyMethodAsyncFunction(t){const e=this.createNode(),n=this.context.allowYield,r=this.context.isAsync;this.context.allowYield=!1,this.context.isAsync=!0;const i=this.parseFormalParameters(),o=this.parsePropertyMethod(i);return this.context.allowYield=n,this.context.isAsync=r,this.finalize(e,new _S(null,i.params,o,t,!0))}parseObjectPropertyKey(t=!1){const e=this.createNode(),n=this.nextToken();let r;switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,bL);const i=this.getTokenRaw(n);r="bigint"==typeof n.value?this.finalize(e,new oS(n.value,i,n.value.toString())):this.finalize(e,new GS(n.value,i));break;case 3:case 1:case 5:case 4:r=this.finalize(e,t?new KS(n.value):new LS(n.value));break;case 7:"["===n.value?(r=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):r=this.throwUnexpectedToken(n);break;default:r=this.throwUnexpectedToken(n)}return r}isPropertyKey(t,e){return t.type===RN.Identifier&&t.name===e||t.type===RN.Literal&&t.value===e}parseObjectProperty(t){const e=this.createNode(),n=this.lookahead;let r,i=null,o=null,s=!1,a=!1,c=!1,l=!1,u=!1;if(3===n.type){const t=n.value;this.nextToken(),s=this.match("["),l=!(this.hasLineTerminator||"async"!==t||this.match(":")||this.match("(")||this.match(",")),u=this.match("*"),u&&this.nextToken(),i=l?this.parseObjectPropertyKey():this.finalize(e,new LS(t))}else this.match("*")?this.nextToken():(s=this.match("["),i=this.parseObjectPropertyKey());const h=this.qualifiedPropertyName(this.lookahead);if(3===n.type&&!l&&"get"===n.value&&h)r="get",s=this.match("["),i=this.parseObjectPropertyKey(),this.context.allowYield=!1,o=this.parseGetterMethod();else if(3===n.type&&!l&&"set"===n.value&&h)r="set",s=this.match("["),i=this.parseObjectPropertyKey(),o=this.parseSetterMethod();else if(7===n.type&&"*"===n.value&&h)r="init",s=this.match("["),i=this.parseObjectPropertyKey(),o=this.parseGeneratorMethod(!1),a=!0;else if(i||this.throwUnexpectedToken(this.lookahead),r="init",this.match(":")&&!l)!s&&this.isPropertyKey(i,"__proto__")&&(t.value&&this.tolerateError(U_),t.value=!0),this.nextToken(),o=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))o=l?this.parsePropertyMethodAsyncFunction(u):this.parsePropertyMethodFunction(u),a=!0;else if(3===n.type){const t=this.finalize(e,new LS(n.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;const n=this.isolateCoverGrammar(this.parseAssignmentExpression);o=this.finalize(e,new nS(t,n))}else c=!0,o=t}else this.throwUnexpectedToken(this.nextToken());return this.finalize(e,new ZS(r,i,s,o,a,c))}parseObjectInitializer(){const t=this.createNode();this.expect("{");const e=[],n={value:!1};for(;!this.match("}");){const t=this.match("...")?this.parseSpreadElement():this.parseObjectProperty(n);e.push(t),this.match("}")||t.method&&!this.match(",")||this.expectCommaSeparator()}return this.expect("}"),this.finalize(t,new WS(e))}throwTemplateLiteralEarlyErrors(t){switch(t.notEscapeSequenceHead){case"u":return this.throwUnexpectedToken(t,nL);case"x":return this.throwUnexpectedToken(t,q_);case"8":case"9":return this.throwUnexpectedToken(t,SL);default:return this.throwUnexpectedToken(t,NL)}}parseTemplateHead(t){I_(this.lookahead.head,"Template literal must start with a template head");const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,i=n.cooked;return this.finalize(e,new u_({raw:r,cooked:i},n.tail))}parseTemplateElement(t){10!==this.lookahead.type&&this.throwUnexpectedToken();const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,i=n.cooked;return this.finalize(e,new u_({raw:r,cooked:i},n.tail))}parseTemplateLiteral(t){const e=this.createNode(),n=[],r=[];let i=this.parseTemplateHead(t);for(r.push(i);!i.tail;)n.push(this.parseExpression()),i=this.parseTemplateElement(t),r.push(i);return this.finalize(e,new h_(r,n))}reinterpretExpressionAsPattern(t){switch(t.type){case RN.Identifier:case RN.MemberExpression:case RN.RestElement:case RN.AssignmentPattern:break;case RN.SpreadElement:t.type=RN.RestElement,this.reinterpretExpressionAsPattern(t.argument);break;case RN.ArrayExpression:t.type=RN.ArrayPattern;for(let e=0;e<t.elements.length;e++)null!==t.elements[e]&&this.reinterpretExpressionAsPattern(t.elements[e]);break;case RN.ObjectExpression:t.type=RN.ObjectPattern;for(let e=0;e<t.properties.length;e++){const n=t.properties[e];this.reinterpretExpressionAsPattern(n.type===RN.SpreadElement?n:n.value)}break;case RN.AssignmentExpression:t.type=RN.AssignmentPattern,delete t.operator,this.reinterpretExpressionAsPattern(t.left)}}parseGroupExpression(){let t;if(this.expect("("),this.match(")"))this.nextToken(),this.match("=>")||this.expect("=>"),t={type:zL,params:[],async:!1};else{const e=this.lookahead,n=[];if(this.match("..."))t=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),t={type:zL,params:[t],async:!1};else{let r=!1;if(this.context.isBindingElement=!0,t=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){const i=[];for(this.context.isAssignmentTarget=!1,i.push(t);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(let t=0;t<i.length;t++)this.reinterpretExpressionAsPattern(i[t]);r=!0,t={type:zL,params:i,async:!1}}else if(this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),i.push(this.parseRestElement(n)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(let t=0;t<i.length;t++)this.reinterpretExpressionAsPattern(i[t]);r=!0,t={type:zL,params:i,async:!1}}else i.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(r)break}r||(t=this.finalize(this.startNode(e),new r_(i)))}if(!r){if(this.expect(")"),this.match("=>")&&(t.type===RN.Identifier&&"yield"===t.name&&(r=!0,t={type:zL,params:[t],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),t.type===RN.SequenceExpression)for(let e=0;e<t.expressions.length;e++)this.reinterpretExpressionAsPattern(t.expressions[e]);else this.reinterpretExpressionAsPattern(t);const e=t.type===RN.SequenceExpression?t.expressions:[t];t={type:zL,params:e,async:!1}}this.context.isBindingElement=!1}}}return t}parseArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}isIdentifierName(t){return 3===t.type||4===t.type||1===t.type||5===t.type}parseIdentifierName(t=!1){let e=!1,n=this.createNode(),r=this.nextToken();return"#"===r.value&&t&&(r=this.nextToken(),e=!0),this.isIdentifierName(r)||this.throwUnexpectedToken(r),this.finalize(n,e?new KS(r.value):new LS(r.value))}parseNewExpression(){const t=this.createNode(),e=this.parseIdentifierName();let n;if(I_("new"===e.name,"New expression must start with `new`"),this.match("."))if(this.nextToken(),3===this.lookahead.type&&this.context.inFunctionBody&&"target"===this.lookahead.value){const t=this.parseIdentifierName();n=new HS(e,t)}else this.throwUnexpectedToken(this.lookahead);else if(this.matchKeyword("import"))this.throwUnexpectedToken(this.lookahead);else{const t=this.isolateCoverGrammar(this.parseLeftHandSideExpression),e=this.match("(")?this.parseArguments():[];n=new JS(t,e),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return this.finalize(t,n)}parseAsyncArgument(){const t=this.parseAssignmentExpression();return this.context.firstCoverInitializedNameError=null,t}parseAsyncArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAsyncArgument);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}matchImportCall(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();this.scanner.restoreState(e),t=7===n.type&&"("===n.value}return t}parseImportCall(){const t=this.createNode();this.expectKeyword("import"),this.expect("(");const e=this.parseAssignmentExpression();let n=null;return this.match(",")&&(this.nextToken(),n=this.parseObjectInitializer()),!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new FS(e,n))}matchImportMeta(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();if(7===n.type&&"."===n.value){this.scanner.scanComments();const e=this.scanner.lex();t=3===e.type&&"meta"===e.value,t&&e.end-e.start!==4&&this.tolerateUnexpectedToken(e,W_)}else t=!1;this.scanner.restoreState(e)}return t}parseImportMeta(){const t=this.createNode(),e=this.parseIdentifierName();this.expect(".");const n=this.parseIdentifierName();return this.context.isAssignmentTarget=!1,this.finalize(t,new HS(e,n))}parseLeftHandSideExpressionAllowCall(){const t=this.lookahead,e=this.matchContextualKeyword("async"),n=this.context.allowIn;let r;this.context.allowIn=!0;const i=this.matchKeyword("super");i&&this.context.inFunctionBody?(r=this.createNode(),this.nextToken(),r=this.finalize(r,new s_),this.match("(")||this.match(".")||this.match("[")||this.throwUnexpectedToken(this.lookahead)):r=this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression),!i||!this.match("(")||this.context.inClassConstructor&&this.context.allowSuper||this.tolerateError(kL);let o=!1;for(;;){let n=!1;if(this.match("?.")&&(n=!0,o=!0,this.expect("?.")),this.match("(")){const i=e&&t.lineNumber===this.lookahead.lineNumber;this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;const o=i?this.parseAsyncArguments():this.parseArguments();if(r.type===RN.ImportExpression&&1!==o.length&&this.tolerateError(b_),r=this.finalize(this.startNode(t),new lS(r,o,n)),i&&this.match("=>")){for(let t=0;t<o.length;++t)this.reinterpretExpressionAsPattern(o[t]);r={type:zL,params:o,async:!0}}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,this.expect("[");const e=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),r=this.finalize(this.startNode(t),new jS(!0,r,e,n))}else if(10===this.lookahead.type&&this.lookahead.head){n&&this.throwUnexpectedToken(this.lookahead),o&&this.throwError(eL);const e=this.parseTemplateLiteral({isTagged:!0});r=this.finalize(this.startNode(t),new l_(r,e))}else{if(!this.match(".")&&!n)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,n||this.expect(".");const e=this.parseIdentifierName(!0);r=this.finalize(this.startNode(t),new jS(!1,r,e,n))}}}return this.context.allowIn=n,o?new hS(r):r}parseSuper(){const t=this.createNode();return this.expectKeyword("super"),this.match("[")||this.match(".")||this.throwUnexpectedToken(this.lookahead),this.finalize(t,new s_)}parseLeftHandSideExpression(){I_(this.context.allowIn,"callee of new expression always allow in keyword.");const t=this.startNode(this.lookahead);let e=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression),n=!1;for(;;){let r=!1;if(this.match("?.")&&(r=!0,n=!0,this.expect("?.")),this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,this.expect("[");const n=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),e=this.finalize(t,new jS(!0,e,n,r))}else if(10===this.lookahead.type&&this.lookahead.head){r&&this.throwUnexpectedToken(this.lookahead),n&&this.throwError(eL);const i=this.parseTemplateLiteral({isTagged:!0});e=this.finalize(t,new l_(e,i))}else{if(!this.match(".")&&!r)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,r||this.expect(".");const n=this.parseIdentifierName();e=this.finalize(t,new jS(!1,e,n,r))}}}return n?new hS(e):e}parseUpdateExpression(){let t;const e=this.lookahead;if(this.match("++")||this.match("--")){const n=this.startNode(e),r=this.nextToken();t=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&t.type===RN.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(CL),this.context.isAssignmentTarget||this.tolerateError(K_);const i=!0;t=this.finalize(n,new A_(r.value,t,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(t=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&7===this.lookahead.type&&(this.match("++")||this.match("--"))){this.context.strict&&t.type===RN.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(IL),this.context.isAssignmentTarget||this.tolerateError(K_),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=this.nextToken().value,r=!1;t=this.finalize(this.startNode(e),new A_(n,t,r))}return t}parseAwaitExpression(){const t=this.createNode();this.nextToken();const e=this.parseUnaryExpression();return this.finalize(t,new iS(e))}parseUnaryExpression(){let t;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){const e=this.startNode(this.lookahead),n=this.nextToken();t=this.inheritCoverGrammar(this.parseUnaryExpression),t=this.finalize(e,new g_(n.value,t)),this.context.strict&&"delete"===t.operator&&t.argument.type===RN.Identifier&&this.tolerateError(mL),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else t=(this.context.isModule&&!this.context.inFunctionBody||this.context.isAsync)&&this.matchContextualKeyword("await")?this.parseAwaitExpression():this.parseUpdateExpression();return t}parseExponentiationExpression(){const t=this.lookahead,e=this.match("(");let n=this.inheritCoverGrammar(this.parseUnaryExpression);if((n.type!==RN.UnaryExpression||e)&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=n,r=this.isolateCoverGrammar(this.parseExponentiationExpression);n=this.finalize(this.startNode(t),new sS("**",e,r))}return n}binaryPrecedence(t){const e=t.value;let n;return n=7===t.type?this.operatorPrecedence[e]||0:4===t.type&&("instanceof"===e||this.context.allowIn&&"in"===e)?12:0,n}parseBinaryExpression(){const t=this.lookahead;let e=this.inheritCoverGrammar(this.parseExponentiationExpression),n=!0,r=!0;const i=t=>{"&&"!==t.value&&"||"!==t.value||(r=!1),"??"===t.value&&(n=!1)},o=this.lookahead;let s=this.binaryPrecedence(o);if(s>0){i(o),this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const a=[t,this.lookahead];let c=e,l=this.isolateCoverGrammar(this.parseExponentiationExpression);const u=[c,o.value,l],h=[s];for(;s=this.binaryPrecedence(this.lookahead),!(s<=0);){for((n||"&&"!==this.lookahead.value&&"||"!==this.lookahead.value)&&(r||"??"!==this.lookahead.value)||this.throwUnexpectedToken(this.lookahead),i(this.lookahead);u.length>2&&s<=h[h.length-1];){l=u.pop();const t=u.pop();h.pop(),c=u.pop(),a.pop();const e=a[a.length-1],n=this.startNode(e,e.lineStart),r="||"===t||"&&"===t||"??"===t;u.push(this.finalize(n,r?new VS(t,c,l):new sS(t,c,l)))}u.push(this.nextToken().value),h.push(s),a.push(this.lookahead),u.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}let d=u.length-1;e=u[d];let p=a.pop();for(;d>1;){const t=a.pop(),n=p&&p.lineStart,r=this.startNode(t,n),i=u[d-1],o="||"===i||"&&"===i||"??"===i;e=this.finalize(r,o?new VS(i,u[d-2],e):new sS(i,u[d-2],e)),d-=2,p=t}}return e}parseConditionalExpression(){const t=this.lookahead;let e=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();const n=this.context.allowIn;this.context.allowIn=!0;const r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");const i=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new gS(e,r,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return e}checkPatternParam(t,e){switch(e.type){case RN.Identifier:this.validateParam(t,e,e.name);break;case RN.RestElement:this.checkPatternParam(t,e.argument);break;case RN.AssignmentPattern:this.checkPatternParam(t,e.left);break;case RN.ArrayPattern:for(let n=0;n<e.elements.length;n++)null!==e.elements[n]&&this.checkPatternParam(t,e.elements[n]);break;case RN.ObjectPattern:for(let n=0;n<e.properties.length;n++){const r=e.properties[n];this.checkPatternParam(t,r.type===RN.RestElement?r:r.value)}}t.simple=t.simple&&e instanceof LS}reinterpretAsCoverFormalsList(t){let e=[t];const n={simple:!0,paramSet:{}};let r=!1;switch(t.type){case RN.Identifier:break;case zL:e=t.params,r=t.async;break;default:return null}for(let t=0;t<e.length;++t){const i=e[t];i.type===RN.AssignmentPattern?i.right.type===RN.YieldExpression&&(i.right.argument&&this.throwUnexpectedToken(this.lookahead),i.right.type=RN.Identifier,i.right.name="yield",delete i.right.argument,delete i.right.delegate):r&&i.type===RN.Identifier&&"await"===i.name&&this.throwUnexpectedToken(this.lookahead),this.checkPatternParam(n,i),e[t]=i}if(this.context.strict||!this.context.allowYield)for(let t=0;t<e.length;++t){e[t].type===RN.YieldExpression&&this.throwUnexpectedToken(this.lookahead)}if(n.hasDuplicateParameterNames){const t=this.context.strict?n.stricted:n.firstRestricted;this.throwUnexpectedToken(t,Q_)}return{simple:n.simple,params:e,stricted:n.stricted,firstRestricted:n.firstRestricted,message:n.message}}parseAssignmentExpression(){let t;if(!this.context.allowYield&&this.matchKeyword("yield"))t=this.parseYieldExpression();else{const e=this.lookahead;let n=e;if(t=this.parseConditionalExpression(),3===n.type&&n.lineNumber===this.lookahead.lineNumber&&"async"===n.value&&(3===this.lookahead.type||this.matchKeyword("yield"))){const e=this.parsePrimaryExpression();this.reinterpretExpressionAsPattern(e),t={type:zL,params:[e],async:!0}}if(t.type===zL||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=t.async,r=this.reinterpretAsCoverFormalsList(t);if(r){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;const i=this.context.strict,o=this.context.allowStrictDirective;this.context.allowStrictDirective=r.simple;const s=this.context.allowYield,a=this.context.isAsync;this.context.allowYield=!0,this.context.isAsync=n;const c=this.startNode(e);let l;if(this.expect("=>"),this.match("{")){const t=this.context.allowIn;this.context.allowIn=!0,l=this.parseFunctionSourceElements(),this.context.allowIn=t}else l=this.isolateCoverGrammar(this.parseAssignmentExpression);const u=l.type!==RN.BlockStatement;this.context.strict&&r.firstRestricted&&this.throwUnexpectedToken(r.firstRestricted,r.message),this.context.strict&&r.stricted&&this.tolerateUnexpectedToken(r.stricted,r.message),t=this.finalize(c,new tS(r.params,l,u,n)),this.context.strict=i,this.context.allowStrictDirective=o,this.context.allowYield=s,this.context.isAsync=a}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(K_),this.context.strict&&t.type===RN.Identifier){const e=t;this.scanner.isRestrictedWord(e.name)&&this.tolerateUnexpectedToken(n,BL),this.scanner.isStrictModeReservedWord(e.name)&&this.tolerateUnexpectedToken(n,vL)}this.match("=")?this.reinterpretExpressionAsPattern(t):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),n=this.nextToken();const r=n.value,i=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new eS(r,t,i)),this.context.firstCoverInitializedNameError=null}}return t}parseExpression(){const t=this.lookahead;let e=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){const n=[];for(n.push(e);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));e=this.finalize(this.startNode(t),new r_(n))}return e}parseStatementListItem(){let t;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,H_),t=this.parseExportDeclaration();break;case"import":this.matchImportCall()?t=this.parseExpressionStatement():this.matchImportMeta()?t=this.parseStatement():(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,Y_),t=this.parseImportDeclaration());break;case"const":t=this.parseLexicalDeclaration({inFor:!1});break;case"function":t=this.parseFunctionDeclaration();break;case"class":t=this.parseClassDeclaration();break;case"let":t=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:t=this.parseStatement()}else t=this.parseStatement();return t}parseBlock(){const t=this.createNode();this.expect("{");const e=[];for(;!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new aS(e))}parseLexicalBinding(t,e){const n=this.createNode(),r=this.parsePattern([],t);this.context.strict&&r.type===RN.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(ML);let i=null;return"const"===t?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),i=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(x_,"const")):(!e.inFor&&r.type!==RN.Identifier||this.match("="))&&(this.expect("="),i=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new m_(r,i))}parseBindingList(t,e){const n=[this.parseLexicalBinding(t,e)];for(;this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(t,e));return n}isLexicalDeclaration(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.scanner.lex();return this.scanner.restoreState(t),3===e.type||7===e.type&&"["===e.value||7===e.type&&"{"===e.value||4===e.type&&"let"===e.value||4===e.type&&"yield"===e.value}parseLexicalDeclaration(t){const e=this.createNode(),n=this.nextToken().value;I_("let"===n||"const"===n,"Lexical declaration must be either let or const");const r=this.parseBindingList(n,t);return this.consumeSemicolon(),this.finalize(e,new E_(r,n))}isInitializedProperty(){let t=this.scanner.saveState();this.scanner.scanComments();let e=this.scanner.lex();return this.scanner.restoreState(t),3===this.lookahead.type&&"="===e.value}isDeclaredProperty(){let t=this.scanner.saveState();this.scanner.scanComments();let e=this.scanner.lex();return this.scanner.restoreState(t),3===this.lookahead.type&&";"===e.value||3===this.lookahead.type&&e.lineNumber!==this.startMarker.line}parseBindingRestElement(t,e){const n=this.createNode();this.expect("...");const r=this.parsePattern(t,e);return this.finalize(n,new t_(r))}parseArrayPattern(t,e){const n=this.createNode();this.expect("[");const r=[];for(;!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(t,e));break}r.push(this.parsePatternWithDefault(t,e)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new $N(r))}parsePropertyPattern(t,e){const n=this.createNode();let r=!1,i=!1;let o,s;if(3===this.lookahead.type){const r=this.lookahead;o=this.parseVariableIdentifier();const a=this.finalize(n,new LS(r.value));if(this.match("=")){t.push(r),i=!0,this.nextToken();const e=this.parseAssignmentExpression();s=this.finalize(this.startNode(r),new nS(a,e))}else this.match(":")?(this.expect(":"),s=this.parsePatternWithDefault(t,e)):(t.push(r),i=!0,s=a)}else r=this.match("["),o=this.parseObjectPropertyKey(),this.expect(":"),s=this.parsePatternWithDefault(t,e);return this.finalize(n,new ZS("init",o,r,s,!1,i))}parseRestProperty(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(F_),this.match("}")||this.throwError(fL),this.finalize(e,new t_(n))}parseObjectPattern(t,e){const n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.match("...")?this.parseRestProperty(t):this.parsePropertyPattern(t,e)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new qS(r))}parsePattern(t,e){let n;return this.match("[")?n=this.parseArrayPattern(t,e):this.match("{")?n=this.parseObjectPattern(t,e):(!this.matchKeyword("let")||"const"!==e&&"let"!==e||this.tolerateUnexpectedToken(this.lookahead,rL),t.push(this.lookahead),n=this.parseVariableIdentifier(e)),n}parsePatternWithDefault(t,e){const n=this.lookahead;let r=this.parsePattern(t,e);if(this.match("=")){this.nextToken();const t=this.context.allowYield;this.context.allowYield=!0;const e=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=t,r=this.finalize(this.startNode(n),new nS(r,e))}return r}parseVariableIdentifier(t){const e=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,vL):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,vL):(this.context.strict||"let"!==n.value||"var"!==t)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.isAsync)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(e,new LS(n.value))}parseVariableDeclaration(t){const e=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===RN.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(ML);let r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===RN.Identifier||t.inFor||this.expect("="),this.finalize(e,new m_(n,r))}parseVariableDeclarationList(t){const e={inFor:t.inFor},n=[];for(n.push(this.parseVariableDeclaration(e));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(e));return n}parseVariableStatement(){const t=this.createNode();this.expectKeyword("var");const e=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(t,new E_(e,"var"))}parseEmptyStatement(){const t=this.createNode();return this.expect(";"),this.finalize(t,new BS)}parseExpressionStatement(){const t=this.createNode(),e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new DS(e))}parseIfClause(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(wL),this.parseStatement()}parseIfStatement(){const t=this.createNode();let e,n=null;this.expectKeyword("if"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new xS(r,e,n))}parseDoWhileStatement(){const t=this.createNode();this.expectKeyword("do"),this.tolerateInvalidLoopStatement();const e=this.context.inIteration;this.context.inIteration=!0;const n=this.parseStatement();this.context.inIteration=e,this.expectKeyword("while"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new yS(n,r))}parseWhileStatement(){const t=this.createNode();let e;this.expectKeyword("while"),this.expect("(");const n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS);else{this.expect(")");const t=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=t}return this.finalize(t,new w_(n,e))}parseForStatement(){let t,e,n=null,r=null,i=null,o=!0,s=!1;const a=this.createNode();if(this.expectKeyword("for"),this.matchContextualKeyword("await")&&(this.context.isAsync||this.tolerateUnexpectedToken(this.lookahead),s=!0,this.nextToken()),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){n=this.createNode(),this.nextToken();const r=this.context.allowIn;this.context.allowIn=!1;const i=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=r,!s&&1===i.length&&this.matchKeyword("in")){const r=i[0];r.init&&(r.id.type===RN.ArrayPattern||r.id.type===RN.ObjectPattern||this.context.strict)&&this.tolerateError(P_,"for-in"),n=this.finalize(n,new E_(i,"var")),this.nextToken(),t=n,e=this.parseExpression(),n=null}else 1===i.length&&null===i[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new E_(i,"var")),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,o=!1):(n=this.finalize(n,new E_(i,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){n=this.createNode();const r=this.nextToken().value;if(this.context.strict||"in"!==this.lookahead.value){const i=this.context.allowIn;this.context.allowIn=!1;const s=this.parseBindingList(r,{inFor:!0});this.context.allowIn=i,1===s.length&&null===s[0].init&&this.matchKeyword("in")?(n=this.finalize(n,new E_(s,r)),this.nextToken(),t=n,e=this.parseExpression(),n=null):1===s.length&&null===s[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new E_(s,r)),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,o=!1):(this.consumeSemicolon(),n=this.finalize(n,new E_(s,r)))}else n=this.finalize(n,new LS(r)),this.nextToken(),t=n,e=this.parseExpression(),n=null}else{const r=this.lookahead,i=this.context.isBindingElement,s=this.context.isAssignmentTarget,a=this.context.firstCoverInitializedNameError,c=this.context.allowIn;if(this.context.allowIn=!1,n=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=c,this.matchKeyword("in"))this.context.isAssignmentTarget&&n.type!==RN.AssignmentExpression||this.tolerateError(Z_),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseExpression(),n=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&n.type!==RN.AssignmentExpression||this.tolerateError(X_),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseAssignmentExpression(),n=null,o=!1;else{if(this.context.isBindingElement=i,this.context.isAssignmentTarget=s,this.context.firstCoverInitializedNameError=a,this.match(",")){const t=[n];for(;this.match(",");)this.nextToken(),t.push(this.isolateCoverGrammar(this.parseAssignmentExpression));n=this.finalize(this.startNode(r),new r_(t))}this.expect(";")}}let c;if(void 0===t&&(this.match(";")||(r=this.isolateCoverGrammar(this.parseExpression)),this.expect(";"),this.match(")")||(i=this.isolateCoverGrammar(this.parseExpression))),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),c=this.finalize(this.createNode(),new BS);else{this.expect(")"),this.tolerateInvalidLoopStatement();const t=this.context.inIteration;this.context.inIteration=!0,c=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=t}return void 0===t?this.finalize(a,new NS(n,r,i,c)):o?this.finalize(a,new vS(t,e,c)):this.finalize(a,new MS(t,e,c,s))}parseContinueStatement(){const t=this.createNode();this.expectKeyword("continue");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier();e=t;const n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(PL,t.name)}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.throwError(j_),this.finalize(t,new AS(e))}parseBreakStatement(){const t=this.createNode();this.expectKeyword("break");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier(),n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(PL,t.name),e=t}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.context.inSwitch||this.throwError(V_),this.finalize(t,new cS(e))}parseReturnStatement(){this.context.inFunctionBody||this.tolerateError(J_);const t=this.createNode();this.expectKeyword("return");const e=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&2!==this.lookahead.type||8===this.lookahead.type||10===this.lookahead.type?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(t,new e_(e))}parseWithStatement(){this.context.strict&&this.tolerateError(TL);const t=this.createNode();let e;this.expectKeyword("with"),this.expect("(");const n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new y_(n,e))}parseSwitchCase(){const t=this.createNode();let e;this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");const n=[];for(;!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a_(e,n))}parseSwitchStatement(){const t=this.createNode();this.expectKeyword("switch"),this.expect("(");const e=this.parseExpression();this.expect(")");const n=this.context.inSwitch;this.context.inSwitch=!0;const r=[];let i=!1;for(this.expect("{");!this.match("}");){const t=this.parseSwitchCase();null===t.test&&(i&&this.throwError(oL),i=!0),r.push(t)}return this.expect("}"),this.context.inSwitch=n,this.finalize(t,new c_(e,r))}parseLabelledStatement(){const t=this.createNode(),e=this.parseExpression();let n;if(e.type===RN.Identifier&&this.match(":")){this.nextToken();const t=e,r="$"+t.name;let i;if(Object.prototype.hasOwnProperty.call(this.context.labelSet,r)&&this.throwError(gL,"Label",t.name),this.context.labelSet[r]=!0,this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),i=this.parseClassDeclaration();else if(this.matchKeyword("function")){const t=this.lookahead,e=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(t,wL):e.generator&&this.tolerateUnexpectedToken(t,G_),i=e}else i=this.parseStatement();delete this.context.labelSet[r],n=new PS(t,i)}else this.consumeSemicolon(),n=new DS(e);return this.finalize(t,n)}parseThrowStatement(){const t=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(sL);const e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new p_(e))}parseCatchClause(){const t=this.createNode();this.expectKeyword("catch");let e=null;if(this.match("(")){this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);const t=[];e=this.parsePattern(t);const n={};for(let e=0;e<t.length;e++){const r="$"+t[e].value;Object.prototype.hasOwnProperty.call(n,r)&&this.tolerateError(k_,t[e].value),n[r]=!0}this.context.strict&&e.type===RN.Identifier&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(EL),this.expect(")")}const n=this.parseBlock();return this.finalize(t,new uS(e,n))}parseFinallyClause(){return this.expectKeyword("finally"),this.parseBlock()}parseTryStatement(){const t=this.createNode();this.expectKeyword("try");const e=this.parseBlock(),n=this.matchKeyword("catch")?this.parseCatchClause():null,r=this.matchKeyword("finally")?this.parseFinallyClause():null;return n||r||this.throwError(lL),this.finalize(t,new f_(e,n,r))}parseDebuggerStatement(){const t=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(t,new ES)}parseStatement(){let t;switch(this.lookahead.type){case 1:case 5:case 6:case 8:case 10:case 9:t=this.parseExpressionStatement();break;case 7:const e=this.lookahead.value;t="{"===e?this.parseBlock():"("===e?this.parseExpressionStatement():";"===e?this.parseEmptyStatement():this.parseExpressionStatement();break;case 3:t=this.matchAsyncFunction()?this.parseFunctionDeclaration():this.parseLabelledStatement();break;case 4:switch(this.lookahead.value){case"break":t=this.parseBreakStatement();break;case"continue":t=this.parseContinueStatement();break;case"debugger":t=this.parseDebuggerStatement();break;case"do":t=this.parseDoWhileStatement();break;case"for":t=this.parseForStatement();break;case"function":t=this.parseFunctionDeclaration();break;case"if":t=this.parseIfStatement();break;case"return":t=this.parseReturnStatement();break;case"switch":t=this.parseSwitchStatement();break;case"throw":t=this.parseThrowStatement();break;case"try":t=this.parseTryStatement();break;case"var":t=this.parseVariableStatement();break;case"while":t=this.parseWhileStatement();break;case"with":t=this.parseWithStatement();break;default:t=this.parseExpressionStatement()}break;default:t=this.throwUnexpectedToken(this.lookahead)}return t}parseFunctionSourceElements(){const t=this.createNode();this.expect("{");const e=this.parseDirectivePrologues(),n=this.context.labelSet,r=this.context.inIteration,i=this.context.inSwitch,o=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;2!==this.lookahead.type&&!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=n,this.context.inIteration=r,this.context.inSwitch=i,this.context.inFunctionBody=o,this.finalize(t,new aS(e))}validateParam(t,e,n){const r="$"+n;this.context.strict?(this.scanner.isRestrictedWord(n)&&(t.stricted=e,t.message=DL),Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)):t.firstRestricted||(this.scanner.isRestrictedWord(n)?(t.firstRestricted=e,t.message=DL):this.scanner.isStrictModeReservedWord(n)?(t.firstRestricted=e,t.message=vL):Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)),"function"==typeof Object.defineProperty?Object.defineProperty(t.paramSet,r,{value:!0,enumerable:!0,writable:!0,configurable:!0}):t.paramSet[r]=!0}parseRestElement(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(R_),this.match(")")||this.throwError(pL),this.finalize(e,new t_(n))}parseFormalParameter(t){const e=[],n=this.match("...")?this.parseRestElement(e):this.parsePatternWithDefault(e);for(let n=0;n<e.length;n++)this.validateParam(t,e[n],e[n].value);t.simple=t.simple&&n instanceof LS,t.params.push(n)}parseFormalParameters(t){const e={simple:!0,hasDuplicateParameterNames:!1,params:[],firstRestricted:t};if(this.expect("("),!this.match(")"))for(e.paramSet={};2!==this.lookahead.type&&(this.parseFormalParameter(e),!this.match(")"))&&(this.expect(","),!this.match(")")););return this.expect(")"),e.hasDuplicateParameterNames&&(this.context.strict||this.context.isAsync||!e.simple)&&this.throwError(Q_),{simple:e.simple,params:e.params,stricted:e.stricted,firstRestricted:e.firstRestricted,message:e.message}}matchAsyncFunction(){let t=this.matchContextualKeyword("async");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();this.scanner.restoreState(e),t=e.lineNumber===n.lineNumber&&4===n.type&&"function"===n.value}return t}parseFunctionDeclaration(t){const e=this.createNode(),n=this.matchContextualKeyword("async");n&&(this.context.inIteration&&this.tolerateError(T_),this.nextToken()),this.expectKeyword("function");const r=this.match("*");let i;r&&this.nextToken();let o=null,s=null;if(!t||!this.match("(")){const t=this.lookahead;o=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,yL):this.scanner.isRestrictedWord(t.value)?(s=t,i=yL):this.scanner.isStrictModeReservedWord(t.value)&&(s=t,i=vL)}const a=this.context.isAsync,c=this.context.allowYield;this.context.isAsync=n,this.context.allowYield=!r;const l=this.parseFormalParameters(s),u=l.params,h=l.stricted;s=l.firstRestricted,l.message&&(i=l.message);const d=this.context.strict,p=this.context.allowStrictDirective;this.context.allowStrictDirective=l.simple;const f=this.parseFunctionSourceElements();return this.context.strict&&s&&this.throwUnexpectedToken(s,i),this.context.strict&&h&&this.tolerateUnexpectedToken(h,i),this.context.strict=d,this.context.allowStrictDirective=p,this.context.isAsync=a,this.context.allowYield=c,n?this.finalize(e,new rS(o,u,f,r)):this.finalize(e,new SS(o,u,f,r))}parseFunctionExpression(){const t=this.createNode(),e=this.matchContextualKeyword("async");e&&this.nextToken(),this.expectKeyword("function");const n=this.match("*");let r;n&&this.nextToken();let i,o=null;const s=this.context.isAsync,a=this.context.allowYield;if(this.context.isAsync=e,this.context.allowYield=!n,!this.match("(")){const t=this.lookahead;o=this.context.strict||n||!this.matchKeyword("yield")?this.parseVariableIdentifier():this.parseIdentifierName(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,yL):this.scanner.isRestrictedWord(t.value)?(i=t,r=yL):this.scanner.isStrictModeReservedWord(t.value)&&(i=t,r=vL)}const c=this.parseFormalParameters(i),l=c.params,u=c.stricted;i=c.firstRestricted,c.message&&(r=c.message);const h=this.context.strict,d=this.context.allowStrictDirective;this.context.allowStrictDirective=c.simple;const p=this.parseFunctionSourceElements();return this.context.strict&&i&&this.throwUnexpectedToken(i,r),this.context.strict&&u&&this.tolerateUnexpectedToken(u,r),this.context.strict=h,this.context.allowStrictDirective=d,this.context.isAsync=s,this.context.allowYield=a,this.finalize(t,new _S(o,l,p,n,e))}parseDirective(){const t=this.lookahead,e=this.createNode(),n=this.parseExpression(),r=n.type===RN.Literal?this.getTokenRaw(t).slice(1,-1):null;return this.consumeSemicolon(),this.finalize(e,r?new wS(n,r):new DS(n))}parseDirectivePrologues(){let t=null;const e=[];for(;;){const n=this.lookahead;if(8!==n.type)break;const r=this.parseDirective();e.push(r);const i=r.directive;if("string"!=typeof i)break;"use strict"===i?(this.context.strict=!0,t&&this.tolerateUnexpectedToken(t,bL),this.context.allowStrictDirective||this.tolerateUnexpectedToken(n,z_)):!t&&n.octal&&(t=n)}return e}qualifiedPropertyName(t){switch(t.type){case 3:case 8:case 1:case 5:case 6:case 4:return!0;case 7:return"["===t.value||"#"===t.value}return!1}parseGetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();r.params.length>0&&this.tolerateError(D_);const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new _S(null,r.params,i,e,!1))}parseSetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();1!==r.params.length?this.tolerateError(v_):r.params[0]instanceof t_&&this.tolerateError(M_);const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new _S(null,r.params,i,e,!1))}parseGeneratorMethod(t){const e=this.createNode(),n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();this.context.allowYield=!1;const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(e,new _S(null,r.params,i,!0,t))}isStartOfExpression(){let t=!0;const e=this.lookahead.value;switch(this.lookahead.type){case 7:t="["===e||"("===e||"{"===e||"+"===e||"-"===e||"!"===e||"~"===e||"++"===e||"--"===e||"/"===e||"/="===e;break;case 4:t="class"===e||"delete"===e||"function"===e||"let"===e||"new"===e||"super"===e||"this"===e||"typeof"===e||"void"===e||"yield"===e}return t}parseYieldExpression(){const t=this.createNode();this.expectKeyword("yield");let e=null,n=!1;if(!this.hasLineTerminator){const t=this.context.allowYield;this.context.allowYield=!1,n=this.match("*"),n?(this.nextToken(),e=this.parseAssignmentExpression()):this.isStartOfExpression()&&(e=this.parseAssignmentExpression()),this.context.allowYield=t}return this.finalize(t,new B_(e,n))}parseStaticBlock(){const t=this.createNode();this.expect("{");const e=[];for(;!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new o_(e))}parseDecorator(){const t=this.createNode();this.expect("@");const e=this.context.strict,n=this.context.allowYield,r=this.context.isAsync;this.context.strict=!1,this.context.allowYield=!0,this.context.isAsync=!1;const i=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);return this.context.strict=e,this.context.allowYield=n,this.context.isAsync=r,this.match(";")&&this.throwError(uL),this.finalize(t,new mS(i))}parseDecorators(){let t=null;for(;this.match("@");)null==t&&(t=[]),t.push(this.parseDecorator());return t}parseClassElement(t){let e=this.lookahead;const n=this.createNode(),r=this.context.inConstructor;let i="",o=null,s=null,a=!1,c=!1,l=!1,u=!1,h=!1,d=!1;const p=this.parseDecorators();if(p&&(e=this.lookahead),this.match("*"))this.nextToken();else{a=this.match("["),this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d);const t=o;if(this.context.inConstructor=3===e.type&&"constructor"===e.value,"static"===t.name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(e=this.lookahead,l=!0,a=this.match("["),this.match("*")?(this.nextToken(),this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead)):(this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d))),"static"===t.name&&this.match("{"))return this.parseStaticBlock();if(3===e.type&&!this.hasLineTerminator&&"async"===e.value){const t=this.lookahead.value;":"!==t&&"("!==t&&(u=!0,h=this.match("*"),h&&this.nextToken(),e=this.lookahead,a=this.match("["),this.match("*")?(this.nextToken(),this.match("#")&&(d=!0,this.nextToken())):(this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d)),3!==e.type||"constructor"!==e.value||l||this.tolerateUnexpectedToken(e,S_))}}3===e.type&&"constructor"===e.value&&d&&this.tolerateUnexpectedToken(e,__);const f=this.qualifiedPropertyName(this.lookahead);if(3===e.type||8===e.type?"get"===e.value&&f?(i="get",this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),a=this.match("["),o=this.parseObjectPropertyKey(d),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===e.value&&f?(i="set",this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),a=this.match("["),o=this.parseObjectPropertyKey(d),s=this.parseSetterMethod()):this.match("(")||(i="property",a=!1,this.match("=")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression))):7===e.type&&"*"===e.value&&f?(i="init",a=this.match("["),o=this.parseObjectPropertyKey(d),s=this.parseGeneratorMethod(u),c=!0):7!==e.type||"["!==e.value||this.match("(")||(i="property",a=!0,this.match("=")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression))),!i&&o&&this.match("(")){const t=this.context.inClassConstructor;this.context.inClassConstructor="constructor"===e.value,i="init",s=u?this.parsePropertyMethodAsyncFunction(h):this.parsePropertyMethodFunction(h),this.context.inClassConstructor=t,c=!0}return i||this.throwUnexpectedToken(this.lookahead),"init"===i&&(i="method"),a||(l&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(e,AL),!l&&this.isPropertyKey(o,"constructor")&&(("method"!==i||!c||s&&s.generator)&&this.throwUnexpectedToken(e,L_),t.value?this.throwUnexpectedToken(e,O_):t.value=!0,i="constructor")),this.context.inConstructor=r,"property"===i?(this.consumeSemicolon(),this.finalize(n,new XS(o,a,s,l,p))):this.finalize(n,new YS(o,a,s,i,l,p))}parseClassElementList(){const t=[],e={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():t.push(this.parseClassElement(e));return this.expect("}"),t}parseClassBody(){const t=this.createNode(),e=this.parseClassElementList();return this.finalize(t,new dS(e))}parseClassDeclaration(t){const e=this.createNode(),n=this.context.strict,r=this.context.allowSuper;this.context.strict=!0,this.expectKeyword("class");const i=t&&3!==this.lookahead.type?null:this.parseVariableIdentifier();let o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall),this.context.allowSuper=!0);const s=this.parseClassBody();return this.context.allowSuper=r,this.context.strict=n,this.finalize(e,new pS(i,o,s,this.context.decorators))}parseClassExpression(){const t=this.createNode(),e=this.context.strict;this.context.strict=!0,this.expectKeyword("class");const n=3===this.lookahead.type?this.parseVariableIdentifier():null;let r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall),this.context.allowSuper=!0);const i=this.parseClassBody();return this.context.strict=e,this.finalize(t,new fS(n,r,i,this.context.decorators))}parseModule(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new zS(e))}parseScript(){const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new n_(e))}parseImportAttributes(){if("assert"===this.lookahead.value){this.nextToken(),this.expect("{");const t=[];for(;!this.match("}");)t.push(this.parseImportAttribute()),this.match("}")||this.expectCommaSeparator();return this.expect("}"),t}return null}parseImportAttribute(){const t=this.createNode();3!==this.lookahead.type&&this.throwUnexpectedToken(this.nextToken());const e=this.parseIdentifierName();this.match(":")||this.throwUnexpectedToken(this.nextToken()),this.nextToken();const n=this.nextToken(),r=this.getTokenRaw(n),i=this.finalize(t,new GS(n.value,r));return this.finalize(t,new RS(e,i))}parseModuleSpecifier(){const t=this.createNode();8!==this.lookahead.type&&this.throwError($_);const e=this.nextToken(),n=this.getTokenRaw(e);return ON.isStringWellFormedUnicode(e.value)||this.throwError($_),this.finalize(t,new GS(e.value,n))}parseImportSpecifier(){const t=this.createNode();let e,n;return 3===this.lookahead.type?(e=this.parseVariableIdentifier(),n=e,this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseVariableIdentifier())):(e=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName(),n=e,this.matchContextualKeyword("as")?(this.nextToken(),n=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(t,new US(n,e))}parseNamedImports(){this.expect("{");const t=[];for(;!this.match("}");)t.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),t}parseImportDefaultSpecifier(){const t=this.createNode(),e=this.parseIdentifierName();return this.finalize(t,new OS(e))}parseImportNamespaceSpecifier(){const t=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(aL),this.lookahead.escaped&&this.throwError(cL),this.nextToken();const e=this.parseIdentifierName();return this.finalize(t,new QS(e))}parseImportDeclaration(){this.context.inFunctionBody&&this.throwError(Y_);const t=this.createNode();let e;this.expectKeyword("import");let n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}const r=this.parseImportAttributes();return this.consumeSemicolon(),this.finalize(t,new kS(n,e,r))}parseExportSpecifier(){const t=this.createNode(),e=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName();let n=e;return this.matchContextualKeyword("as")&&(this.lookahead.escaped&&this.throwError(cL),this.nextToken(),n=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName()),this.finalize(t,new bS(e,n))}parseExportDeclaration(){this.context.inFunctionBody&&this.throwError(H_);const t=this.createNode();let e;if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){const n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new CS(n))}else if(this.matchKeyword("class")){const n=this.parseClassDeclaration(!0);e=this.finalize(t,new CS(n))}else if(this.matchContextualKeyword("async")){const n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();e=this.finalize(t,new CS(n))}else{this.matchContextualKeyword("from")&&this.throwError(QL,this.lookahead.value);const n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),e=this.finalize(t,new CS(n))}else if(this.match("*")){this.nextToken();let n=null;if(this.matchContextualKeyword("as")&&(this.lookahead.escaped&&this.throwError(cL),this.nextToken(),n=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName()),!this.matchContextualKeyword("from")){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}this.lookahead.escaped&&this.throwError(cL),this.nextToken();const r=this.parseModuleSpecifier(),i=this.parseImportAttributes();this.consumeSemicolon(),e=this.finalize(t,new IS(r,n,i))}else if(4===this.lookahead.type){let n;switch(this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new TS(n,[],null,null))}else if(this.matchAsyncFunction()){const n=this.parseFunctionDeclaration();e=this.finalize(t,new TS(n,[],null,null))}else{const n=[];let r=null,i=!1,o=null;for(this.expect("{");!this.match("}");)i=i||this.matchKeyword("default"),n.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.lookahead.escaped&&this.throwError(cL),this.nextToken(),r=this.parseModuleSpecifier(),o=this.parseImportAttributes(),this.consumeSemicolon();else if(i){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}else o=this.parseImportAttributes(),this.consumeSemicolon();e=this.finalize(t,new TS(null,n,r,o))}return e}}const WL={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"};function qL(t){let e;switch(t.type){case QN.JSXIdentifier:e=t.name;break;case QN.JSXNamespacedName:const n=t;e=qL(n.namespace)+":"+qL(n.name);break;case QN.JSXMemberExpression:const r=t;e=qL(r.object)+"."+qL(r.property)}return e}YL[100]="JSXIdentifier",YL[101]="JSXText";class KL extends JL{constructor(t,e,n){super(t,e,n)}parsePrimaryExpression(){return this.match("<")?this.parseJSXRoot():super.parsePrimaryExpression()}startJSX(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column}finishJSX(){this.nextToken()}reenterJSX(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()}createJSXNode(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}createJSXChildNode(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}scanXHTMLEntity(t){let e="&",n=!0,r=!1,i=!1,o=!1;for(;!this.scanner.eof()&&n&&!r;){const s=this.scanner.source[this.scanner.index];if(s===t)break;if(r=";"===s,e+=s,++this.scanner.index,!r)switch(e.length){case 2:i="#"===s;break;case 3:i&&(o="x"===s,n=o||ON.isDecimalDigit(s.charCodeAt(0)),i=i&&!o);break;default:n=n&&!(i&&!ON.isDecimalDigit(s.charCodeAt(0))),n=n&&!(o&&!ON.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&e.length>2){const t=e.substr(1,e.length-2);i&&t.length>1?e=String.fromCharCode(parseInt(t.substr(1),10)):o&&t.length>2?e=String.fromCharCode(parseInt("0"+t.substr(1),16)):i||o||!WL[t]||(e=WL[t])}return e}lexJSX(){const t=this.scanner.source.charCodeAt(this.scanner.index);if(60===t||62===t||47===t||58===t||61===t||123===t||125===t){return{type:7,value:this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===t||39===t){const t=this.scanner.index,e=this.scanner.source[this.scanner.index++];let n="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index++];if(t===e)break;n+="&"===t?this.scanXHTMLEntity(e):t}return{type:8,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===t){const t=this.scanner.source.charCodeAt(this.scanner.index+1),e=this.scanner.source.charCodeAt(this.scanner.index+2),n=46===t&&46===e?"...":".",r=this.scanner.index;return this.scanner.index+=n.length,{type:7,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(96===t)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(ON.isIdentifierStart(t)&&92!==t){const t=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){const t=this.scanner.source.charCodeAt(this.scanner.index);if(ON.isIdentifierPart(t)&&92!==t)++this.scanner.index;else{if(45!==t)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()}nextJSXToken(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(t)),t}nextJSXText(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.scanner.index;let e="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index];if("{"===t||"<"===t)break;++this.scanner.index,e+=t,ON.isLineTerminator(t.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===t&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;const n={type:101,value:e,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index};return e.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n}peekJSXToken(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.lexJSX();return this.scanner.restoreState(t),e}expectJSX(t){const e=this.nextJSXToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}matchJSX(t){const e=this.peekJSXToken();return 7===e.type&&e.value===t}parseJSXIdentifier(){const t=this.createJSXNode(),e=this.nextJSXToken();return 100!==e.type&&this.throwUnexpectedToken(e),this.finalize(t,new HN(e.value))}parseJSXElementName(){const t=this.createJSXNode();let e=this.parseJSXIdentifier();if(this.matchJSX(":")){const n=e;this.expectJSX(":");const r=this.parseJSXIdentifier();e=this.finalize(t,new JN(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){const n=e;this.expectJSX(".");const r=this.parseJSXIdentifier();e=this.finalize(t,new YN(n,r))}return e}parseJSXAttributeName(){const t=this.createJSXNode();let e;const n=this.parseJSXIdentifier();if(this.matchJSX(":")){const r=n;this.expectJSX(":");const i=this.parseJSXIdentifier();e=this.finalize(t,new JN(r,i))}else e=n;return e}parseJSXStringLiteralAttribute(){const t=this.createJSXNode(),e=this.nextJSXToken();8!==e.type&&this.throwUnexpectedToken(e);const n=this.getTokenRaw(e);return this.finalize(t,new GS(e.value,n))}parseJSXExpressionAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new jN(e))}parseJSXAttributeValue(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()}parseJSXNameValueAttribute(){const t=this.createJSXNode(),e=this.parseJSXAttributeName();let n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(t,new zN(e,n))}parseJSXSpreadAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new KN(e))}parseJSXAttributes(){const t=[];for(;!this.matchJSX("/")&&!this.matchJSX(">");){const e=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();t.push(e)}return t}parseJSXOpeningElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new qN(!1));const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new WN(e,r,n))}parseJSXBoundaryElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){if(this.expectJSX("/"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new PN);const e=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(t,new UN(e))}const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new WN(e,r,n))}parseJSXEmptyExpression(){const t=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(t,new VN)}parseJSXExpressionContainer(){const t=this.createJSXNode();let e;return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new jN(e))}parseJSXChildren(){const t=[];for(;!this.scanner.eof();){const e=this.createJSXChildNode(),n=this.nextJSXText();if(n.start<n.end){const r=this.getTokenRaw(n),i=this.finalize(e,new ZN(n.value,r));t.push(i)}if("{"!==this.scanner.source[this.scanner.index])break;{const e=this.parseJSXExpressionContainer();t.push(e)}}return t}parseComplexJSXElement(t){const e=[];for(;!this.scanner.eof();){t.children=t.children.concat(this.parseJSXChildren());const n=this.createJSXChildNode(),r=this.parseJSXBoundaryElement();if(r.type===QN.JSXOpeningElement){const i=r;if(i.selfClosing){const e=this.finalize(n,new GN(i,[],null));t.children.push(e)}else e.push(t),t={node:n,opening:i,closing:null,children:[]}}if(r.type===QN.JSXClosingElement){t.closing=r;const n=qL(t.opening.name);if(n!==qL(t.closing.name)&&this.tolerateError("Expected corresponding JSX closing tag for %0",n),!(e.length>0))break;{const n=this.finalize(t.node,new GN(t.opening,t.children,t.closing));(t=e[e.length-1]).children.push(n),e.pop()}}if(r.type===QN.JSXClosingFragment){if(t.closing=r,t.opening.type===QN.JSXOpeningFragment)break;this.tolerateError("Expected corresponding JSX closing tag for jsx fragment")}}return t}parseJSXElement(){const t=this.createJSXNode(),e=this.parseJSXOpeningElement();let n=[],r=null;if(!e.selfClosing){const i=this.parseComplexJSXElement({node:t,opening:e,closing:r,children:n});n=i.children,r=i.closing}return this.finalize(t,new GN(e,n,r))}parseJSXRoot(){this.config.tokens&&this.tokens.pop(),this.startJSX();const t=this.parseJSXElement();return this.finishJSX(),t}isStartOfExpression(){return super.isStartOfExpression()||this.match("<")}}function ZL(t,e,n){let r=null;const i=(t,e)=>{n&&n(t,e),r&&r.visit(t,e)};let o="function"==typeof n?i:null,s=!1;if(e){s="boolean"==typeof e.comment&&e.comment;const t="boolean"==typeof e.attachComment&&e.attachComment;(s||t)&&(r=new FN,r.attach=t,e.comment=!0,o=i)}let a,c=!1;e&&"string"==typeof e.sourceType&&(c="module"===e.sourceType),a=e&&"boolean"==typeof e.jsx&&e.jsx?new KL(t,e,o):new JL(t,e,o);const l=c?a.parseModule():a.parseScript();return s&&r&&(l.comments=r.comments),a.config.tokens&&(l.tokens=a.tokens),a.config.tolerant&&(l.errors=a.errorHandler.errors),l}function XL(t,e,n){const r=e||{};return r.sourceType="script",ZL(t,r,n)}class $L{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+$L.version}static addUnaryOp(t){return $L.max_unop_len=Math.max(t.length,$L.max_unop_len),$L.unary_ops[t]=1,$L}static addBinaryOp(t,e,n){return $L.max_binop_len=Math.max(t.length,$L.max_binop_len),$L.binary_ops[t]=e,n?$L.right_associative.add(t):$L.right_associative.delete(t),$L}static addIdentifierChar(t){return $L.additional_identifier_chars.add(t),$L}static addLiteral(t,e){return $L.literals[t]=e,$L}static removeUnaryOp(t){return delete $L.unary_ops[t],t.length===$L.max_unop_len&&($L.max_unop_len=$L.getMaxKeyLen($L.unary_ops)),$L}static removeAllUnaryOps(){return $L.unary_ops={},$L.max_unop_len=0,$L}static removeIdentifierChar(t){return $L.additional_identifier_chars.delete(t),$L}static removeBinaryOp(t){return delete $L.binary_ops[t],t.length===$L.max_binop_len&&($L.max_binop_len=$L.getMaxKeyLen($L.binary_ops)),$L.right_associative.delete(t),$L}static removeAllBinaryOps(){return $L.binary_ops={},$L.max_binop_len=0,$L}static removeLiteral(t){return delete $L.literals[t],$L}static removeAllLiterals(){return $L.literals={},$L}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new $L(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(t=>t.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return $L.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!$L.binary_ops[String.fromCharCode(t)]||$L.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return $L.isIdentifierStart(t)||$L.isDecimalDigit(t)}throwError(t){const e=new Error(t+" at character "+this.index);throw e.index=this.index,e.description=t,e}runHook(t,e){if($L.hooks[t]){const n={context:this,node:e};return $L.hooks.run(t,n),n.node}return e}searchHook(t){if($L.hooks[t]){const e={context:this};return $L.hooks[t].find(function(t){return t.call(e.context,e),e.node}),e.node}}gobbleSpaces(){let t=this.code;for(;t===$L.SPACE_CODE||t===$L.TAB_CODE||t===$L.LF_CODE||t===$L.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),e=1===t.length?t[0]:{type:$L.COMPOUND,body:t};return this.runHook("after-all",e)}gobbleExpressions(t){let e,n,r=[];for(;this.index<this.expr.length;)if(e=this.code,e===$L.SEMCOL_CODE||e===$L.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())r.push(n);else if(this.index<this.expr.length){if(e===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,$L.max_binop_len),e=t.length;for(;e>0;){if($L.binary_ops.hasOwnProperty(t)&&(!$L.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!$L.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=e,t;t=t.substr(0,--e)}return!1}gobbleBinaryExpression(){let t,e,n,r,i,o,s,a,c;if(o=this.gobbleToken(),!o)return o;if(e=this.gobbleBinaryOp(),!e)return o;for(i={value:e,prec:$L.binaryPrecedence(e),right_a:$L.right_associative.has(e)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+e),r=[o,i,s];e=this.gobbleBinaryOp();){if(n=$L.binaryPrecedence(e),0===n){this.index-=e.length;break}i={value:e,prec:n,right_a:$L.right_associative.has(e)},c=e;const a=t=>i.right_a&&t.right_a?n>t.prec:n<=t.prec;for(;r.length>2&&a(r[r.length-2]);)s=r.pop(),e=r.pop().value,o=r.pop(),t={type:$L.BINARY_EXP,operator:e,left:o,right:s},r.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+c),r.push(i,t)}for(a=r.length-1,t=r[a];a>1;)t={type:$L.BINARY_EXP,operator:r[a-1].value,left:r[a-2],right:t},a-=2;return t}gobbleToken(){let t,e,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(t=this.code,$L.isDecimalDigit(t)||t===$L.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===$L.SQUOTE_CODE||t===$L.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(t===$L.OBRACK_CODE)r=this.gobbleArray();else{for(e=this.expr.substr(this.index,$L.max_unop_len),n=e.length;n>0;){if($L.unary_ops.hasOwnProperty(e)&&(!$L.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!$L.isIdentifierPart(this.expr.charCodeAt(this.index+e.length)))){this.index+=n;const t=this.gobbleToken();return t||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:$L.UNARY_EXP,operator:e,argument:t,prefix:!0})}e=e.substr(0,--n)}$L.isIdentifierStart(t)?(r=this.gobbleIdentifier(),$L.literals.hasOwnProperty(r.name)?r={type:$L.LITERAL,value:$L.literals[r.name],raw:r.name}:r.name===$L.this_str&&(r={type:$L.THIS_EXP})):t===$L.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let e=this.code;for(;e===$L.PERIOD_CODE||e===$L.OBRACK_CODE||e===$L.OPAREN_CODE||e===$L.QUMARK_CODE;){let n;if(e===$L.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==$L.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),e=this.code}this.index++,e===$L.OBRACK_CODE?((t={type:$L.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),e=this.code,e!==$L.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):e===$L.OPAREN_CODE?t={type:$L.CALL_EXP,arguments:this.gobbleArguments($L.CPAREN_CODE),callee:t}:(e===$L.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:$L.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),e=this.code}return t}gobbleNumericLiteral(){let t,e,n="";for(;$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===$L.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(t=this.char,"e"===t||"E"===t){for(n+=this.expr.charAt(this.index++),t=this.char,"+"!==t&&"-"!==t||(n+=this.expr.charAt(this.index++));$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);$L.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return e=this.code,$L.isIdentifierStart(e)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(e===$L.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===$L.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:$L.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let t="";const e=this.index,n=this.expr.charAt(this.index++);let r=!1;for(;this.index<this.expr.length;){let e=this.expr.charAt(this.index++);if(e===n){r=!0;break}if("\\"===e)switch(e=this.expr.charAt(this.index++),e){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return r||this.throwError('Unclosed quote after "'+t+'"'),{type:$L.LITERAL,value:t,raw:this.expr.substring(e,this.index)}}gobbleIdentifier(){let t=this.code,e=this.index;for($L.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,$L.isIdentifierPart(t));)this.index++;return{type:$L.IDENTIFIER,name:this.expr.slice(e,this.index)}}gobbleArguments(t){const e=[];let n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===t){n=!0,this.index++,t===$L.CPAREN_CODE&&r&&r>=e.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}if(i===$L.COMMA_CODE){if(this.index++,r++,r!==e.length)if(t===$L.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===$L.CBRACK_CODE)for(let t=e.length;t<r;t++)e.push(null)}else if(e.length!==r&&0!==r)this.throwError("Expected comma");else{const t=this.gobbleExpression();t&&t.type!==$L.COMPOUND||this.throwError("Expected comma"),e.push(t)}}return n||this.throwError("Expected "+String.fromCharCode(t)),e}gobbleGroup(){this.index++;let t=this.gobbleExpressions($L.CPAREN_CODE);if(this.code===$L.CPAREN_CODE)return this.index++,1===t.length?t[0]:!!t.length&&{type:$L.SEQUENCE_EXP,expressions:t};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:$L.ARRAY_EXP,elements:this.gobbleArguments($L.CBRACK_CODE)}}}const tx=new class{add(t,e,n){if("string"!=typeof arguments[0])for(let t in arguments[0])this.add(t,arguments[0][t],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(t){this[t]=this[t]||[],e&&this[t][n?"unshift":"push"](e)},this)}run(t,e){this[t]=this[t]||[],this[t].forEach(function(t){t.call(e&&e.context?e.context:e,e)})}};Object.assign($L,{hooks:tx,plugins:new class{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach(t=>{if("object"!=typeof t||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}}($L),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),$L.max_unop_len=$L.getMaxKeyLen($L.unary_ops),$L.max_binop_len=$L.getMaxKeyLen($L.binary_ops);const ex=t=>new $L(t).parse(),nx=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames($L).filter(t=>!nx.includes(t)&&void 0===ex[t]).forEach(t=>{ex[t]=$L[t]}),ex.Jsep=$L;var rx={name:"ternary",init(t){t.hooks.add("after-expression",function(e){if(e.node&&this.code===t.QUMARK_CODE){this.index++;const n=e.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),e.node={type:"ConditionalExpression",test:n,consequent:r,alternate:i},n.operator&&t.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&t.binary_ops[r.right.operator]<=.9;)r=r.right;e.node.test=r.right,r.right=e.node,e.node=n}}else this.throwError("Expected :")}})}};ex.plugins.register(rx);var ix={name:"regex",init(t){t.hooks.add("gobble-token",function(e){if(47===this.code){const n=++this.index;let r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){const r=this.expr.slice(n,this.index);let i,o="";for(;++this.index<this.expr.length;){const t=this.code;if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57))break;o+=this.char}try{i=new RegExp(r,o)}catch(t){this.throwError(t.message)}return e.node={type:t.LITERAL,value:i,raw:this.expr.slice(n-1,this.index)},e.node=this.gobbleTokenProperty(e.node),e.node}this.code===t.OBRACK_CODE?r=!0:r&&this.code===t.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const ox={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(t){const e=[t.IDENTIFIER,t.MEMBER_EXP];function n(t){ox.assignmentOperators.has(t.operator)?(t.type="AssignmentExpression",n(t.left),n(t.right)):t.operator||Object.values(t).forEach(t=>{t&&"object"==typeof t&&n(t)})}ox.assignmentOperators.forEach(e=>t.addBinaryOp(e,ox.assignmentPrecedence,!0)),t.hooks.add("gobble-token",function(t){const n=this.code;ox.updateOperators.some(t=>t===n&&t===this.expr.charCodeAt(this.index+1))&&(this.index+=2,t.node={type:"UpdateExpression",operator:43===n?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},t.node.argument&&e.includes(t.node.argument.type)||this.throwError(`Unexpected ${t.node.operator}`))}),t.hooks.add("after-token",function(t){if(t.node){const n=this.code;ox.updateOperators.some(t=>t===n&&t===this.expr.charCodeAt(this.index+1))&&(e.includes(t.node.type)||this.throwError(`Unexpected ${t.node.operator}`),this.index+=2,t.node={type:"UpdateExpression",operator:43===n?"++":"--",argument:t.node,prefix:!1})}}),t.hooks.add("after-expression",function(t){t.node&&n(t.node)})}};ex.plugins.register(ix,ox),ex.addUnaryOp("typeof"),ex.addLiteral("null",null),ex.addLiteral("undefined",void 0);const sx=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),ax={evalAst(t,e){switch(t.type){case"BinaryExpression":case"LogicalExpression":return ax.evalBinaryExpression(t,e);case"Compound":return ax.evalCompound(t,e);case"ConditionalExpression":return ax.evalConditionalExpression(t,e);case"Identifier":return ax.evalIdentifier(t,e);case"Literal":return ax.evalLiteral(t,e);case"MemberExpression":return ax.evalMemberExpression(t,e);case"UnaryExpression":return ax.evalUnaryExpression(t,e);case"ArrayExpression":return ax.evalArrayExpression(t,e);case"CallExpression":return ax.evalCallExpression(t,e);case"AssignmentExpression":return ax.evalAssignmentExpression(t,e);default:throw SyntaxError("Unexpected expression",t)}},evalBinaryExpression:(t,e)=>({"||":(t,e)=>t||e(),"&&":(t,e)=>t&&e(),"|":(t,e)=>t|e(),"^":(t,e)=>t^e(),"&":(t,e)=>t&e(),"==":(t,e)=>t==e(),"!=":(t,e)=>t!=e(),"===":(t,e)=>t===e(),"!==":(t,e)=>t!==e(),"<":(t,e)=>t<e(),">":(t,e)=>t>e(),"<=":(t,e)=>t<=e(),">=":(t,e)=>t>=e(),"<<":(t,e)=>t<<e(),">>":(t,e)=>t>>e(),">>>":(t,e)=>t>>>e(),"+":(t,e)=>t+e(),"-":(t,e)=>t-e(),"*":(t,e)=>t*e(),"/":(t,e)=>t/e(),"%":(t,e)=>t%e()}[t.operator](ax.evalAst(t.left,e),()=>ax.evalAst(t.right,e))),evalCompound(t,e){let n;for(let r=0;r<t.body.length;r++){"Identifier"===t.body[r].type&&["var","let","const"].includes(t.body[r].name)&&t.body[r+1]&&"AssignmentExpression"===t.body[r+1].type&&(r+=1);const i=t.body[r];n=ax.evalAst(i,e)}return n},evalConditionalExpression:(t,e)=>ax.evalAst(t.test,e)?ax.evalAst(t.consequent,e):ax.evalAst(t.alternate,e),evalIdentifier(t,e){if(Object.hasOwn(e,t.name))return e[t.name];throw ReferenceError(`${t.name} is not defined`)},evalLiteral:t=>t.value,evalMemberExpression(t,e){const n=String(t.computed?ax.evalAst(t.property):t.property.name),r=ax.evalAst(t.object,e);if(null==r)throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);if(!Object.hasOwn(r,n)&&sx.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);const i=r[n];return"function"==typeof i?i.bind(r):i},evalUnaryExpression:(t,e)=>({"-":t=>-ax.evalAst(t,e),"!":t=>!ax.evalAst(t,e),"~":t=>~ax.evalAst(t,e),"+":t=>+ax.evalAst(t,e),typeof:t=>typeof ax.evalAst(t,e)}[t.operator](t.argument)),evalArrayExpression:(t,e)=>t.elements.map(t=>ax.evalAst(t,e)),evalCallExpression(t,e){const n=t.arguments.map(t=>ax.evalAst(t,e));return ax.evalAst(t.callee,e)(...n)},evalAssignmentExpression(t,e){if("Identifier"!==t.left.type)throw SyntaxError("Invalid left-hand side in assignment");const n=t.left.name,r=ax.evalAst(t.right,e);return e[n]=r,e[n]}};function cx(t,e){return(t=t.slice()).push(e),t}function lx(t,e){return(e=e.slice()).unshift(t),e}class ux extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function hx(t,e,n,r,i){if(!(this instanceof hx))try{return new hx(t,e,n,r,i)}catch(t){if(!t.avoidNew)throw t;return t.value}"string"==typeof t&&(i=r,r=n,n=e,e=t,t=null);const o=t&&"object"==typeof t;if(t=t||{},this.json=t.json||n,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=!Object.hasOwn(t,"wrap")||t.wrap,this.sandbox=t.sandbox||{},this.eval=void 0===t.eval?"safe":t.eval,this.ignoreEvalErrors=void 0!==t.ignoreEvalErrors&&t.ignoreEvalErrors,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||r||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==t.autostart){const r={path:o?t.path:e};o?"json"in t&&(r.json=t.json):r.json=n;const i=this.evaluate(r);if(!i||"object"!=typeof i)throw new ux(i);return i}}hx.prototype.evaluate=function(t,e,n,r){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,e=e||this.json,(t=t||this.path)&&"object"==typeof t&&!Array.isArray(t)){if(!t.path&&""!==t.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=Object.hasOwn(t,"flatten")?t.flatten:s,this.currResultType=Object.hasOwn(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=Object.hasOwn(t,"sandbox")?t.sandbox:this.currSandbox,a=Object.hasOwn(t,"wrap")?t.wrap:a,this.currEval=Object.hasOwn(t,"eval")?t.eval:this.currEval,n=Object.hasOwn(t,"callback")?t.callback:n,this.currOtherTypeCallback=Object.hasOwn(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(t,"parent")?t.parent:i,o=Object.hasOwn(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=hx.toPathString(t)),!t&&""!==t||!e)return;const c=hx.toPathArray(t);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const l=this._trace(c,e,["$"],i,o,n).filter(function(t){return t&&!t.isParentSelector});return l.length?a||1!==l.length||l[0].hasArrExpr?l.reduce((t,e)=>{const n=this._getPreferredOutput(e);return s&&Array.isArray(n)?t=t.concat(n):t.push(n),t},[]):this._getPreferredOutput(l[0]):a?[]:void 0},hx.prototype._getPreferredOutput=function(t){const e=this.currResultType;switch(e){case"all":{const e=Array.isArray(t.path)?t.path:hx.toPathArray(t.path);return t.pointer=hx.toPointer(e),t.path="string"==typeof t.path?t.path:hx.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return hx.toPathString(t[e]);case"pointer":return hx.toPointer(t.path);default:throw new TypeError("Unknown result type")}},hx.prototype._handleCallback=function(t,e,n){if(e){const r=this._getPreferredOutput(t);t.path="string"==typeof t.path?t.path:hx.toPathString(t.path),e(r,n,t)}},hx.prototype._trace=function(t,e,n,r,i,o,s,a){let c;if(!t.length)return c={path:n,value:e,parent:r,parentProperty:i,hasArrExpr:s},this._handleCallback(c,o,"value"),c;const l=t[0],u=t.slice(1),h=[];function d(t){Array.isArray(t)?t.forEach(t=>{h.push(t)}):h.push(t)}if(("string"!=typeof l||a)&&e&&Object.hasOwn(e,l))d(this._trace(u,e[l],cx(n,l),e,l,o,s));else if("*"===l)this._walk(e,t=>{d(this._trace(u,e[t],cx(n,t),e,t,o,!0,!0))});else if(".."===l)d(this._trace(u,e,n,r,i,o,s)),this._walk(e,r=>{"object"==typeof e[r]&&d(this._trace(t.slice(),e[r],cx(n,r),e,r,o,!0))});else{if("^"===l)return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:u,isParentSelector:!0};if("~"===l)return c={path:cx(n,l),value:i,parent:r,parentProperty:null},this._handleCallback(c,o,"property"),c;if("$"===l)d(this._trace(u,e,n,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))d(this._slice(l,u,e,n,r,i,o));else if(0===l.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const t=l.replace(/^\?\((.*?)\)$/u,"$1"),s=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(t);s?this._walk(e,t=>{const a=[s[2]],c=s[1]?e[t][s[1]]:e[t];this._trace(a,c,n,r,i,o,!0).length>0&&d(this._trace(u,e[t],cx(n,t),e,t,o,!0))}):this._walk(e,s=>{this._eval(t,e[s],s,n,r,i)&&d(this._trace(u,e[s],cx(n,s),e,s,o,!0))})}else if("("===l[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(lx(this._eval(l,e,n.at(-1),n.slice(0,-1),r,i),u),e,n,r,i,o,s))}else if("@"===l[0]){let t=!1;const s=l.slice(1,-2);switch(s){case"scalar":e&&["object","function"].includes(typeof e)||(t=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===s&&(t=!0);break;case"integer":!Number.isFinite(e)||e%1||(t=!0);break;case"number":Number.isFinite(e)&&(t=!0);break;case"nonFinite":"number"!=typeof e||Number.isFinite(e)||(t=!0);break;case"object":e&&typeof e===s&&(t=!0);break;case"array":Array.isArray(e)&&(t=!0);break;case"other":t=this.currOtherTypeCallback(e,n,r,i);break;case"null":null===e&&(t=!0);break;default:throw new TypeError("Unknown value type "+s)}if(t)return c={path:n,value:e,parent:r,parentProperty:i},this._handleCallback(c,o,"value"),c}else if("`"===l[0]&&e&&Object.hasOwn(e,l.slice(1))){const t=l.slice(1);d(this._trace(u,e[t],cx(n,t),e,t,o,s,!0))}else if(l.includes(",")){const t=l.split(",");for(const s of t)d(this._trace(lx(s,u),e,n,r,i,o,!0))}else!a&&e&&Object.hasOwn(e,l)&&d(this._trace(u,e[l],cx(n,l),e,l,o,s,!0))}if(this._hasParentSelector)for(let t=0;t<h.length;t++){const n=h[t];if(n&&n.isParentSelector){const a=this._trace(n.expr,e,n.path,r,i,o,s);if(Array.isArray(a)){h[t]=a[0];const e=a.length;for(let n=1;n<e;n++)t++,h.splice(t,0,a[n])}else h[t]=a}}return h},hx.prototype._walk=function(t,e){if(Array.isArray(t)){const n=t.length;for(let t=0;t<n;t++)e(t)}else t&&"object"==typeof t&&Object.keys(t).forEach(t=>{e(t)})},hx.prototype._slice=function(t,e,n,r,i,o,s){if(!Array.isArray(n))return;const a=n.length,c=t.split(":"),l=c[2]&&Number.parseInt(c[2])||1;let u=c[0]&&Number.parseInt(c[0])||0,h=c[1]&&Number.parseInt(c[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);const d=[];for(let t=u;t<h;t+=l){this._trace(lx(t,e),n,r,i,o,s,!0).forEach(t=>{d.push(t)})}return d},hx.prototype._eval=function(t,e,n,r,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const s=t.includes("@path");s&&(this.currSandbox._$_path=hx.toPathString(r.concat([n])));const a=this.currEval+"Script:"+t;if(!hx.cache[a]){let e=t.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(e=e.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)hx.cache[a]=new this.safeVm.Script(e);else if("native"===this.currEval)hx.cache[a]=new this.vm.Script(e);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const t=this.currEval;hx.cache[a]=new t(e)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);hx.cache[a]={runInNewContext:t=>this.currEval(e,t)}}}try{return hx.cache[a].runInNewContext(this.currSandbox)}catch(e){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+e.message+": "+t)}},hx.cache={},hx.toPathString=function(t){const e=t,n=e.length;let r="$";for(let t=1;t<n;t++)/^(~|\^|@.*?\(\))$/u.test(e[t])||(r+=/^[0-9*]+$/u.test(e[t])?"["+e[t]+"]":"['"+e[t]+"']");return r},hx.toPointer=function(t){const e=t,n=e.length;let r="";for(let t=1;t<n;t++)/^(~|\^|@.*?\(\))$/u.test(e[t])||(r+="/"+e[t].toString().replaceAll("~","~0").replaceAll("/","~1"));return r},hx.toPathArray=function(t){const{cache:e}=hx;if(e[t])return e[t].concat();const n=[],r=t.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(t,e){return"[#"+(n.push(e)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(t,e){return"['"+e.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(t,e){return";"+e.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(t){const e=t.match(/#(\d+)/u);return e&&e[1]?n[e[1]]:t});return e[t]=r,e[t].concat()},hx.prototype.safeVm={Script:class{constructor(t){this.code=t,this.ast=ex(this.code)}runInNewContext(t){const e=Object.assign(Object.create(null),t);return ax.evalAst(this.ast,e)}}};hx.prototype.vm={Script:class{constructor(t){this.code=t}runInNewContext(t){let e=this.code;const n=Object.keys(t),r=[];!function(t,e,n){const r=t.length;for(let i=0;i<r;i++)n(t[i])&&e.push(t.splice(i--,1)[0])}(n,r,e=>"function"==typeof t[e]);const i=n.map(e=>t[e]);e=r.reduce((e,n)=>{let r=t[n].toString();return/function/u.test(r)||(r="function "+r),"var "+n+"="+r+";"+e},"")+e,/(['"])use strict\1/u.test(e)||n.includes("arguments")||(e="var arguments = undefined;"+e),e=e.replace(/;\s*$/u,"");const o=e.lastIndexOf(";"),s=-1!==o?e.slice(0,o+1)+" return "+e.slice(o+1):" return "+e;return new Function(...n,s)(...i)}}};const dx=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),px="�";var fx;!function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"}(fx||(fx={}));const gx="--",Ax="[CDATA[",Ex="doctype",mx="script",wx="public",yx="system";function Bx(t){return t>=55296&&t<=57343}function Ix(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159}function Cx(t){return t>=64976&&t<=65007||dx.has(t)}var Tx;!function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"}(Tx||(Tx={}));class bx{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,e){const{line:n,col:r,offset:i}=this,o=r+e,s=i+e;return{code:t,startLine:n,endLine:n,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const e=this.html.charCodeAt(this.pos+1);if(function(t){return t>=56320&&t<=57343}(e))return this.pos++,this._addGap(),1024*(t-55296)+9216+e}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,fx.EOF;return this._err(Tx.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,e){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=e}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,e){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(e)return this.html.startsWith(t,this.pos);for(let e=0;e<t.length;e++){if((32|this.html.charCodeAt(this.pos+e))!==t.charCodeAt(e))return!1}return!0}peek(t){const e=this.pos+t;if(e>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fx.EOF;const n=this.html.charCodeAt(e);return n===fx.CARRIAGE_RETURN?fx.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fx.EOF;let t=this.html.charCodeAt(this.pos);if(t===fx.CARRIAGE_RETURN)return this.isEol=!0,this.skipNextNewLine=!0,fx.LINE_FEED;if(t===fx.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine))return this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance();this.skipNextNewLine=!1,Bx(t)&&(t=this._processSurrogate(t));return null===this.handler.onParseError||t>31&&t<127||t===fx.LINE_FEED||t===fx.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t}_checkForProblematicCharacters(t){Ix(t)?this._err(Tx.controlCharacterInInputStream):Cx(t)&&this._err(Tx.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Dx;function vx(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}!function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"}(Dx||(Dx={}));const Mx=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0)));var Nx;const Sx=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);Nx=String.fromCodePoint;function _x(t){var e;return t>=55296&&t<=57343||t>1114111?65533:null!==(e=Sx.get(t))&&void 0!==e?e:t}var Lx;!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(Lx||(Lx={}));var xx,Rx,Fx;function kx(t){return t>=Lx.ZERO&&t<=Lx.NINE}function Ox(t){return t>=Lx.UPPER_A&&t<=Lx.UPPER_F||t>=Lx.LOWER_A&&t<=Lx.LOWER_F}function Qx(t){return t===Lx.EQUALS||function(t){return t>=Lx.UPPER_A&&t<=Lx.UPPER_Z||t>=Lx.LOWER_A&&t<=Lx.LOWER_Z||kx(t)}(t)}!function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}(xx||(xx={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(Rx||(Rx={})),function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"}(Fx||(Fx={}));class Ux{constructor(t,e,n){this.decodeTree=t,this.emitCodePoint=e,this.errors=n,this.state=Rx.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Fx.Strict}startEntity(t){this.decodeMode=t,this.state=Rx.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case Rx.EntityStart:return t.charCodeAt(e)===Lx.NUM?(this.state=Rx.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=Rx.NamedEntity,this.stateNamedEntity(t,e));case Rx.NumericStart:return this.stateNumericStart(t,e);case Rx.NumericDecimal:return this.stateNumericDecimal(t,e);case Rx.NumericHex:return this.stateNumericHex(t,e);case Rx.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===Lx.LOWER_X?(this.state=Rx.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=Rx.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,n,r){if(e!==n){const i=n-e;this.result=this.result*Math.pow(r,i)+Number.parseInt(t.substr(e,i),r),this.consumed+=i}}stateNumericHex(t,e){const n=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!kx(r)&&!Ox(r))return this.addToNumericResult(t,n,e,16),this.emitNumericEntity(r,3);e+=1}return this.addToNumericResult(t,n,e,16),-1}stateNumericDecimal(t,e){const n=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!kx(r))return this.addToNumericResult(t,n,e,10),this.emitNumericEntity(r,2);e+=1}return this.addToNumericResult(t,n,e,10),-1}emitNumericEntity(t,e){var n;if(this.consumed<=e)return null===(n=this.errors)||void 0===n||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Lx.SEMI)this.consumed+=1;else if(this.decodeMode===Fx.Strict)return 0;return this.emitCodePoint(_x(this.result),this.consumed),this.errors&&(t!==Lx.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:n}=this;let r=n[this.treeIndex],i=(r&xx.VALUE_LENGTH)>>14;for(;e<t.length;e++,this.excess++){const o=t.charCodeAt(e);if(this.treeIndex=Px(n,r,this.treeIndex+Math.max(1,i),o),this.treeIndex<0)return 0===this.result||this.decodeMode===Fx.Attribute&&(0===i||Qx(o))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&xx.VALUE_LENGTH)>>14,0!==i){if(o===Lx.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Fx.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:n}=this,r=(n[e]&xx.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,r,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,n){const{decodeTree:r}=this;return this.emitCodePoint(1===e?r[t]&~xx.VALUE_LENGTH:r[t+1],n),3===e&&this.emitCodePoint(r[t+2],n),n}end(){var t;switch(this.state){case Rx.NamedEntity:return 0===this.result||this.decodeMode===Fx.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case Rx.NumericDecimal:return this.emitNumericEntity(0,2);case Rx.NumericHex:return this.emitNumericEntity(0,3);case Rx.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Rx.EntityStart:return 0}}}function Px(t,e,n,r){const i=(e&xx.BRANCH_LENGTH)>>7,o=e&xx.JUMP_TABLE;if(0===i)return 0!==o&&r===o?n:-1;if(o){const e=r-o;return e<0||e>=i?-1:t[n+e]-1}let s=n,a=s+i-1;for(;s<=a;){const e=s+a>>>1,n=t[e];if(n<r)s=e+1;else{if(!(n>r))return t[e+i];a=e-1}}return-1}var Gx,Vx,jx,Hx,Yx;!function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"}(Gx||(Gx={})),function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"}(Vx||(Vx={})),function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"}(jx||(jx={})),function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"}(Hx||(Hx={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"}(Yx||(Yx={}));const zx=new Map([[Hx.A,Yx.A],[Hx.ADDRESS,Yx.ADDRESS],[Hx.ANNOTATION_XML,Yx.ANNOTATION_XML],[Hx.APPLET,Yx.APPLET],[Hx.AREA,Yx.AREA],[Hx.ARTICLE,Yx.ARTICLE],[Hx.ASIDE,Yx.ASIDE],[Hx.B,Yx.B],[Hx.BASE,Yx.BASE],[Hx.BASEFONT,Yx.BASEFONT],[Hx.BGSOUND,Yx.BGSOUND],[Hx.BIG,Yx.BIG],[Hx.BLOCKQUOTE,Yx.BLOCKQUOTE],[Hx.BODY,Yx.BODY],[Hx.BR,Yx.BR],[Hx.BUTTON,Yx.BUTTON],[Hx.CAPTION,Yx.CAPTION],[Hx.CENTER,Yx.CENTER],[Hx.CODE,Yx.CODE],[Hx.COL,Yx.COL],[Hx.COLGROUP,Yx.COLGROUP],[Hx.DD,Yx.DD],[Hx.DESC,Yx.DESC],[Hx.DETAILS,Yx.DETAILS],[Hx.DIALOG,Yx.DIALOG],[Hx.DIR,Yx.DIR],[Hx.DIV,Yx.DIV],[Hx.DL,Yx.DL],[Hx.DT,Yx.DT],[Hx.EM,Yx.EM],[Hx.EMBED,Yx.EMBED],[Hx.FIELDSET,Yx.FIELDSET],[Hx.FIGCAPTION,Yx.FIGCAPTION],[Hx.FIGURE,Yx.FIGURE],[Hx.FONT,Yx.FONT],[Hx.FOOTER,Yx.FOOTER],[Hx.FOREIGN_OBJECT,Yx.FOREIGN_OBJECT],[Hx.FORM,Yx.FORM],[Hx.FRAME,Yx.FRAME],[Hx.FRAMESET,Yx.FRAMESET],[Hx.H1,Yx.H1],[Hx.H2,Yx.H2],[Hx.H3,Yx.H3],[Hx.H4,Yx.H4],[Hx.H5,Yx.H5],[Hx.H6,Yx.H6],[Hx.HEAD,Yx.HEAD],[Hx.HEADER,Yx.HEADER],[Hx.HGROUP,Yx.HGROUP],[Hx.HR,Yx.HR],[Hx.HTML,Yx.HTML],[Hx.I,Yx.I],[Hx.IMG,Yx.IMG],[Hx.IMAGE,Yx.IMAGE],[Hx.INPUT,Yx.INPUT],[Hx.IFRAME,Yx.IFRAME],[Hx.KEYGEN,Yx.KEYGEN],[Hx.LABEL,Yx.LABEL],[Hx.LI,Yx.LI],[Hx.LINK,Yx.LINK],[Hx.LISTING,Yx.LISTING],[Hx.MAIN,Yx.MAIN],[Hx.MALIGNMARK,Yx.MALIGNMARK],[Hx.MARQUEE,Yx.MARQUEE],[Hx.MATH,Yx.MATH],[Hx.MENU,Yx.MENU],[Hx.META,Yx.META],[Hx.MGLYPH,Yx.MGLYPH],[Hx.MI,Yx.MI],[Hx.MO,Yx.MO],[Hx.MN,Yx.MN],[Hx.MS,Yx.MS],[Hx.MTEXT,Yx.MTEXT],[Hx.NAV,Yx.NAV],[Hx.NOBR,Yx.NOBR],[Hx.NOFRAMES,Yx.NOFRAMES],[Hx.NOEMBED,Yx.NOEMBED],[Hx.NOSCRIPT,Yx.NOSCRIPT],[Hx.OBJECT,Yx.OBJECT],[Hx.OL,Yx.OL],[Hx.OPTGROUP,Yx.OPTGROUP],[Hx.OPTION,Yx.OPTION],[Hx.P,Yx.P],[Hx.PARAM,Yx.PARAM],[Hx.PLAINTEXT,Yx.PLAINTEXT],[Hx.PRE,Yx.PRE],[Hx.RB,Yx.RB],[Hx.RP,Yx.RP],[Hx.RT,Yx.RT],[Hx.RTC,Yx.RTC],[Hx.RUBY,Yx.RUBY],[Hx.S,Yx.S],[Hx.SCRIPT,Yx.SCRIPT],[Hx.SEARCH,Yx.SEARCH],[Hx.SECTION,Yx.SECTION],[Hx.SELECT,Yx.SELECT],[Hx.SOURCE,Yx.SOURCE],[Hx.SMALL,Yx.SMALL],[Hx.SPAN,Yx.SPAN],[Hx.STRIKE,Yx.STRIKE],[Hx.STRONG,Yx.STRONG],[Hx.STYLE,Yx.STYLE],[Hx.SUB,Yx.SUB],[Hx.SUMMARY,Yx.SUMMARY],[Hx.SUP,Yx.SUP],[Hx.TABLE,Yx.TABLE],[Hx.TBODY,Yx.TBODY],[Hx.TEMPLATE,Yx.TEMPLATE],[Hx.TEXTAREA,Yx.TEXTAREA],[Hx.TFOOT,Yx.TFOOT],[Hx.TD,Yx.TD],[Hx.TH,Yx.TH],[Hx.THEAD,Yx.THEAD],[Hx.TITLE,Yx.TITLE],[Hx.TR,Yx.TR],[Hx.TRACK,Yx.TRACK],[Hx.TT,Yx.TT],[Hx.U,Yx.U],[Hx.UL,Yx.UL],[Hx.SVG,Yx.SVG],[Hx.VAR,Yx.VAR],[Hx.WBR,Yx.WBR],[Hx.XMP,Yx.XMP]]);function Jx(t){var e;return null!==(e=zx.get(t))&&void 0!==e?e:Yx.UNKNOWN}const Wx=Yx,qx={[Gx.HTML]:new Set([Wx.ADDRESS,Wx.APPLET,Wx.AREA,Wx.ARTICLE,Wx.ASIDE,Wx.BASE,Wx.BASEFONT,Wx.BGSOUND,Wx.BLOCKQUOTE,Wx.BODY,Wx.BR,Wx.BUTTON,Wx.CAPTION,Wx.CENTER,Wx.COL,Wx.COLGROUP,Wx.DD,Wx.DETAILS,Wx.DIR,Wx.DIV,Wx.DL,Wx.DT,Wx.EMBED,Wx.FIELDSET,Wx.FIGCAPTION,Wx.FIGURE,Wx.FOOTER,Wx.FORM,Wx.FRAME,Wx.FRAMESET,Wx.H1,Wx.H2,Wx.H3,Wx.H4,Wx.H5,Wx.H6,Wx.HEAD,Wx.HEADER,Wx.HGROUP,Wx.HR,Wx.HTML,Wx.IFRAME,Wx.IMG,Wx.INPUT,Wx.LI,Wx.LINK,Wx.LISTING,Wx.MAIN,Wx.MARQUEE,Wx.MENU,Wx.META,Wx.NAV,Wx.NOEMBED,Wx.NOFRAMES,Wx.NOSCRIPT,Wx.OBJECT,Wx.OL,Wx.P,Wx.PARAM,Wx.PLAINTEXT,Wx.PRE,Wx.SCRIPT,Wx.SECTION,Wx.SELECT,Wx.SOURCE,Wx.STYLE,Wx.SUMMARY,Wx.TABLE,Wx.TBODY,Wx.TD,Wx.TEMPLATE,Wx.TEXTAREA,Wx.TFOOT,Wx.TH,Wx.THEAD,Wx.TITLE,Wx.TR,Wx.TRACK,Wx.UL,Wx.WBR,Wx.XMP]),[Gx.MATHML]:new Set([Wx.MI,Wx.MO,Wx.MN,Wx.MS,Wx.MTEXT,Wx.ANNOTATION_XML]),[Gx.SVG]:new Set([Wx.TITLE,Wx.FOREIGN_OBJECT,Wx.DESC]),[Gx.XLINK]:new Set,[Gx.XML]:new Set,[Gx.XMLNS]:new Set},Kx=new Set([Wx.H1,Wx.H2,Wx.H3,Wx.H4,Wx.H5,Wx.H6]);new Set([Hx.STYLE,Hx.SCRIPT,Hx.XMP,Hx.IFRAME,Hx.NOEMBED,Hx.NOFRAMES,Hx.PLAINTEXT]);var Zx;!function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"}(Zx||(Zx={}));const Xx={DATA:Zx.DATA,RCDATA:Zx.RCDATA,RAWTEXT:Zx.RAWTEXT,SCRIPT_DATA:Zx.SCRIPT_DATA,PLAINTEXT:Zx.PLAINTEXT,CDATA_SECTION:Zx.CDATA_SECTION};function $x(t){return t>=fx.LATIN_CAPITAL_A&&t<=fx.LATIN_CAPITAL_Z}function tR(t){return function(t){return t>=fx.LATIN_SMALL_A&&t<=fx.LATIN_SMALL_Z}(t)||$x(t)}function eR(t){return tR(t)||function(t){return t>=fx.DIGIT_0&&t<=fx.DIGIT_9}(t)}function nR(t){return t+32}function rR(t){return t===fx.SPACE||t===fx.LINE_FEED||t===fx.TABULATION||t===fx.FORM_FEED}function iR(t){return rR(t)||t===fx.SOLIDUS||t===fx.GREATER_THAN_SIGN}class oR{constructor(t,e){this.options=t,this.handler=e,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Zx.DATA,this.returnState=Zx.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new bx(e),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ux(Mx,(t,e)=>{this.preprocessor.pos=this.entityStartPos+e-1,this._flushCodePointConsumedAsCharacterReference(t)},e.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Tx.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:t=>{this._err(Tx.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+t)},validateNumericCharacterReference:t=>{const e=function(t){return t===fx.NULL?Tx.nullCharacterReference:t>1114111?Tx.characterReferenceOutsideUnicodeRange:Bx(t)?Tx.surrogateCharacterReference:Cx(t)?Tx.noncharacterCharacterReference:Ix(t)||t===fx.CARRIAGE_RETURN?Tx.controlCharacterReference:null}(t);e&&this._err(e,1)}}:void 0)}_err(t,e=0){var n,r;null===(r=(n=this.handler).onParseError)||void 0===r||r.call(n,this.preprocessor.getError(t,e))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,this.inLoop||(this._runParsingLoop(),this.paused||null==t||t())}write(t,e,n){this.active=!0,this.preprocessor.write(t,e),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let e=0;e<t;e++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,e){return!!this.preprocessor.startsWith(t,e)&&(this._advanceBy(t.length-1),!0)}_createStartTagToken(){this.currentToken={type:Dx.START_TAG,tagName:"",tagID:Yx.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Dx.END_TAG,tagName:"",tagID:Yx.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Dx.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Dx.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,e){this.currentCharacterToken={type:t,chars:e,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,e;const n=this.currentToken;if(null===vx(n,this.currentAttr.name)){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){(null!==(t=(e=n.location).attrs)&&void 0!==t?t:e.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(Tx.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Jx(t.tagName),t.type===Dx.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(Tx.endTagWithAttributes),t.selfClosing&&this._err(Tx.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Dx.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Dx.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Dx.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Dx.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,e){if(this.currentCharacterToken){if(this.currentCharacterToken.type===t)return void(this.currentCharacterToken.chars+=e);this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(t,e)}_emitCodePoint(t){const e=rR(t)?Dx.WHITESPACE_CHARACTER:t===fx.NULL?Dx.NULL_CHARACTER:Dx.CHARACTER;this._appendCharToCurrentCharacterToken(e,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Dx.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=Zx.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Fx.Attribute:Fx.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Zx.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case Zx.DATA:this._stateData(t);break;case Zx.RCDATA:this._stateRcdata(t);break;case Zx.RAWTEXT:this._stateRawtext(t);break;case Zx.SCRIPT_DATA:this._stateScriptData(t);break;case Zx.PLAINTEXT:this._statePlaintext(t);break;case Zx.TAG_OPEN:this._stateTagOpen(t);break;case Zx.END_TAG_OPEN:this._stateEndTagOpen(t);break;case Zx.TAG_NAME:this._stateTagName(t);break;case Zx.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(t);break;case Zx.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(t);break;case Zx.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(t);break;case Zx.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(t);break;case Zx.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(t);break;case Zx.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(t);break;case Zx.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(t);break;case Zx.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(t);break;case Zx.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(t);break;case Zx.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(t);break;case Zx.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(t);break;case Zx.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(t);break;case Zx.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(t);break;case Zx.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(t);break;case Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(t);break;case Zx.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(t);break;case Zx.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(t);break;case Zx.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(t);break;case Zx.ATTRIBUTE_NAME:this._stateAttributeName(t);break;case Zx.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(t);break;case Zx.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(t);break;case Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(t);break;case Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(t);break;case Zx.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(t);break;case Zx.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(t);break;case Zx.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(t);break;case Zx.BOGUS_COMMENT:this._stateBogusComment(t);break;case Zx.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(t);break;case Zx.COMMENT_START:this._stateCommentStart(t);break;case Zx.COMMENT_START_DASH:this._stateCommentStartDash(t);break;case Zx.COMMENT:this._stateComment(t);break;case Zx.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(t);break;case Zx.COMMENT_END_DASH:this._stateCommentEndDash(t);break;case Zx.COMMENT_END:this._stateCommentEnd(t);break;case Zx.COMMENT_END_BANG:this._stateCommentEndBang(t);break;case Zx.DOCTYPE:this._stateDoctype(t);break;case Zx.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(t);break;case Zx.DOCTYPE_NAME:this._stateDoctypeName(t);break;case Zx.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(t);break;case Zx.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(t);break;case Zx.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(t);break;case Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(t);break;case Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(t);break;case Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(t);break;case Zx.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break;case Zx.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(t);break;case Zx.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(t);break;case Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(t);break;case Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(t);break;case Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(t);break;case Zx.BOGUS_DOCTYPE:this._stateBogusDoctype(t);break;case Zx.CDATA_SECTION:this._stateCdataSection(t);break;case Zx.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(t);break;case Zx.CDATA_SECTION_END:this._stateCdataSectionEnd(t);break;case Zx.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Zx.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(t);break;default:throw new Error("Unknown state")}}_stateData(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.TAG_OPEN;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitCodePoint(t);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case fx.AMPERSAND:this._startCharacterReference();break;case fx.LESS_THAN_SIGN:this.state=Zx.RCDATA_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.RAWTEXT_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateTagOpen(t){if(tR(t))this._createStartTagToken(),this.state=Zx.TAG_NAME,this._stateTagName(t);else switch(t){case fx.EXCLAMATION_MARK:this.state=Zx.MARKUP_DECLARATION_OPEN;break;case fx.SOLIDUS:this.state=Zx.END_TAG_OPEN;break;case fx.QUESTION_MARK:this._err(Tx.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t);break;case fx.EOF:this._err(Tx.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(Tx.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Zx.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(tR(t))this._createEndTagToken(),this.state=Zx.TAG_NAME,this._stateTagName(t);else switch(t){case fx.GREATER_THAN_SIGN:this._err(Tx.missingEndTagName),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(Tx.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.SOLIDUS:this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.tagName+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:e.tagName+=String.fromCodePoint($x(t)?nR(t):t)}}_stateRcdataLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=Zx.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){tR(t)?(this.state=Zx.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=Zx.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();this.currentToken.tagName=this.lastStartTagName;switch(this.preprocessor.peek(this.lastStartTagName.length)){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Zx.BEFORE_ATTRIBUTE_NAME,!1;case fx.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Zx.SELF_CLOSING_START_TAG,!1;case fx.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Zx.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){tR(t)?(this.state=Zx.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case fx.SOLIDUS:this.state=Zx.SCRIPT_DATA_END_TAG_OPEN;break;case fx.EXCLAMATION_MARK:this.state=Zx.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){tR(t)?(this.state=Zx.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===fx.HYPHEN_MINUS?(this.state=Zx.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===fx.HYPHEN_MINUS?(this.state=Zx.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case fx.HYPHEN_MINUS:this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.GREATER_THAN_SIGN:this.state=Zx.SCRIPT_DATA,this._emitChars(">");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:tR(t)?(this._emitChars("<"),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){tR(t)?(this.state=Zx.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(mx,!1)&&iR(this.preprocessor.peek(mx.length))){this._emitCodePoint(t);for(let t=0;t<mx.length;t++)this._emitCodePoint(this._consume());this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case fx.HYPHEN_MINUS:this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.GREATER_THAN_SIGN:this.state=Zx.SCRIPT_DATA,this._emitChars(">");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===fx.SOLIDUS?(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(mx,!1)&&iR(this.preprocessor.peek(mx.length))){this._emitCodePoint(t);for(let t=0;t<mx.length;t++)this._emitCodePoint(this._consume());this.state=Zx.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.SOLIDUS:case fx.GREATER_THAN_SIGN:case fx.EOF:this.state=Zx.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case fx.EQUALS_SIGN:this._err(Tx.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=Zx.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=Zx.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:case fx.SOLIDUS:case fx.GREATER_THAN_SIGN:case fx.EOF:this._leaveAttrName(),this.state=Zx.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case fx.EQUALS_SIGN:this._leaveAttrName(),this.state=Zx.BEFORE_ATTRIBUTE_VALUE;break;case fx.QUOTATION_MARK:case fx.APOSTROPHE:case fx.LESS_THAN_SIGN:this._err(Tx.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.name+=px;break;default:this.currentAttr.name+=String.fromCodePoint($x(t)?nR(t):t)}}_stateAfterAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.SOLIDUS:this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.EQUALS_SIGN:this.state=Zx.BEFORE_ATTRIBUTE_VALUE;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=Zx.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:this.state=Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this.state=Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingAttributeValue),this.state=Zx.DATA,this.emitCurrentTagToken();break;default:this.state=Zx.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this._leaveAttrValue(),this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.QUOTATION_MARK:case fx.APOSTROPHE:case fx.LESS_THAN_SIGN:case fx.EQUALS_SIGN:case fx.GRAVE_ACCENT:this._err(Tx.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this._leaveAttrValue(),this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.SOLIDUS:this._leaveAttrValue(),this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._err(Tx.missingWhitespaceBetweenAttributes),this.state=Zx.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case fx.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._err(Tx.unexpectedSolidusInTag),this.state=Zx.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this.emitCurrentComment(e),this._emitEOFToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.data+=px;break;default:e.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(gx,!0)?(this._createCommentToken(gx.length+1),this.state=Zx.COMMENT_START):this._consumeSequenceIfMatch(Ex,!1)?(this.currentLocation=this.getCurrentLocation(Ex.length+1),this.state=Zx.DOCTYPE):this._consumeSequenceIfMatch(Ax,!0)?this.inForeignNode?this.state=Zx.CDATA_SECTION:(this._err(Tx.cdataInHtmlContent),this._createCommentToken(Ax.length+1),this.currentToken.data="[CDATA[",this.state=Zx.BOGUS_COMMENT):this._ensureHibernation()||(this._err(Tx.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_START_DASH;break;case fx.GREATER_THAN_SIGN:{this._err(Tx.abruptClosingOfEmptyComment),this.state=Zx.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptClosingOfEmptyComment),this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="-",this.state=Zx.COMMENT,this._stateComment(t)}}_stateComment(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END_DASH;break;case fx.LESS_THAN_SIGN:e.data+="<",this.state=Zx.COMMENT_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.data+=px;break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const e=this.currentToken;switch(t){case fx.EXCLAMATION_MARK:e.data+="!",this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG;break;case fx.LESS_THAN_SIGN:e.data+="<";break;default:this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===fx.HYPHEN_MINUS?this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Zx.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===fx.HYPHEN_MINUS?this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Zx.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==fx.GREATER_THAN_SIGN&&t!==fx.EOF&&this._err(Tx.nestedComment),this.state=Zx.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END;break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="-",this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EXCLAMATION_MARK:this.state=Zx.COMMENT_END_BANG;break;case fx.HYPHEN_MINUS:e.data+="-";break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="--",this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:e.data+="--!",this.state=Zx.COMMENT_END_DASH;break;case fx.GREATER_THAN_SIGN:this._err(Tx.incorrectlyClosedComment),this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="--!",this.state=Zx.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:this.state=Zx.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break;case fx.EOF:{this._err(Tx.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(Tx.missingWhitespaceBeforeDoctypeName),this.state=Zx.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if($x(t))this._createDoctypeToken(String.fromCharCode(nR(t))),this.state=Zx.DOCTYPE_NAME;else switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._createDoctypeToken(px),this.state=Zx.DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:{this._err(Tx.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Zx.DATA;break}case fx.EOF:{this._err(Tx.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=Zx.DOCTYPE_NAME}}_stateDoctypeName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.AFTER_DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.name+=px;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.name+=String.fromCodePoint($x(t)?nR(t):t)}}_stateAfterDoctypeName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(wx,!1)?this.state=Zx.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(yx,!1)?this.state=Zx.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(Tx.invalidCharacterSequenceAfterDoctypeName),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceAfterDoctypePublicKeyword),e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceAfterDoctypePublicKeyword),e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const e=this.currentToken;switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.publicId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypePublicIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const e=this.currentToken;switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.publicId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypePublicIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.QUOTATION_MARK:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceAfterDoctypeSystemKeyword),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceAfterDoctypeSystemKeyword),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const e=this.currentToken;switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.systemId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypeSystemIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const e=this.currentToken;switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.systemId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypeSystemIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter);break;case fx.EOF:this.emitCurrentDoctype(e),this._emitEOFToken()}}_stateCdataSection(t){switch(t){case fx.RIGHT_SQUARE_BRACKET:this.state=Zx.CDATA_SECTION_BRACKET;break;case fx.EOF:this._err(Tx.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===fx.RIGHT_SQUARE_BRACKET?this.state=Zx.CDATA_SECTION_END:(this._emitChars("]"),this.state=Zx.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA;break;case fx.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=Zx.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0){if(!this.preprocessor.lastChunkWritten)return this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,void(this.preprocessor.endOfChunkHit=!0);t=this.entityDecoder.end()}0===t?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(fx.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&eR(this.preprocessor.peek(1))?Zx.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){eR(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===fx.SEMICOLON&&this._err(Tx.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const sR=new Set([Yx.DD,Yx.DT,Yx.LI,Yx.OPTGROUP,Yx.OPTION,Yx.P,Yx.RB,Yx.RP,Yx.RT,Yx.RTC]),aR=new Set([...sR,Yx.CAPTION,Yx.COLGROUP,Yx.TBODY,Yx.TD,Yx.TFOOT,Yx.TH,Yx.THEAD,Yx.TR]),cR=new Set([Yx.APPLET,Yx.CAPTION,Yx.HTML,Yx.MARQUEE,Yx.OBJECT,Yx.TABLE,Yx.TD,Yx.TEMPLATE,Yx.TH]),lR=new Set([...cR,Yx.OL,Yx.UL]),uR=new Set([...cR,Yx.BUTTON]),hR=new Set([Yx.ANNOTATION_XML,Yx.MI,Yx.MN,Yx.MO,Yx.MS,Yx.MTEXT]),dR=new Set([Yx.DESC,Yx.FOREIGN_OBJECT,Yx.TITLE]),pR=new Set([Yx.TR,Yx.TEMPLATE,Yx.HTML]),fR=new Set([Yx.TBODY,Yx.TFOOT,Yx.THEAD,Yx.TEMPLATE,Yx.HTML]),gR=new Set([Yx.TABLE,Yx.TEMPLATE,Yx.HTML]),AR=new Set([Yx.TD,Yx.TH]);class ER{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,e,n){this.treeAdapter=e,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Yx.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===Yx.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Gx.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,e){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=e,this.currentTagId=e,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,e,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,e){const n=this._indexOf(t);this.items[n]=e,n===this.stackTop&&(this.current=e)}insertAfter(t,e,n){const r=this._indexOf(t)+1;this.items.splice(r,0,e),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(t){let e=this.stackTop+1;do{e=this.tagIDs.lastIndexOf(t,e-1)}while(e>0&&this.treeAdapter.getNamespaceURI(this.items[e])!==Gx.HTML);this.shortenToLength(Math.max(e,0))}shortenToLength(t){for(;this.stackTop>=t;){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,this.stackTop<t)}}popUntilElementPopped(t){const e=this._indexOf(t);this.shortenToLength(Math.max(e,0))}popUntilPopped(t,e){const n=this._indexOfTagNames(t,e);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Kx,Gx.HTML)}popUntilTableCellPopped(){this.popUntilPopped(AR,Gx.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,e){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===e)return n;return-1}clearBackTo(t,e){const n=this._indexOfTagNames(t,e);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(gR,Gx.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fR,Gx.HTML)}clearBackToTableRowContext(){this.clearBackTo(pR,Gx.HTML)}remove(t){const e=this._indexOf(t);e>=0&&(e===this.stackTop?this.pop():(this.items.splice(e,1),this.tagIDs.splice(e,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Yx.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const e=this._indexOf(t)-1;return e>=0?this.items[e]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===Yx.HTML}hasInDynamicScope(t,e){for(let n=this.stackTop;n>=0;n--){const r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case Gx.HTML:if(r===t)return!0;if(e.has(r))return!1;break;case Gx.SVG:if(dR.has(r))return!1;break;case Gx.MATHML:if(hR.has(r))return!1}}return!0}hasInScope(t){return this.hasInDynamicScope(t,cR)}hasInListItemScope(t){return this.hasInDynamicScope(t,lR)}hasInButtonScope(t){return this.hasInDynamicScope(t,uR)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const e=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Gx.HTML:if(Kx.has(e))return!0;if(cR.has(e))return!1;break;case Gx.SVG:if(dR.has(e))return!1;break;case Gx.MATHML:if(hR.has(e))return!1}}return!0}hasInTableScope(t){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Gx.HTML)switch(this.tagIDs[e]){case t:return!0;case Yx.TABLE:case Yx.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Gx.HTML)switch(this.tagIDs[t]){case Yx.TBODY:case Yx.THEAD:case Yx.TFOOT:return!0;case Yx.TABLE:case Yx.HTML:return!1}return!0}hasInSelectScope(t){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Gx.HTML)switch(this.tagIDs[e]){case t:return!0;case Yx.OPTION:case Yx.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&sR.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&aR.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;void 0!==this.currentTagId&&this.currentTagId!==t&&aR.has(this.currentTagId);)this.pop()}}var mR;!function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"}(mR||(mR={}));const wR={type:mR.Marker};class yR{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,e){const n=[],r=e.length,i=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let t=0;t<this.entries.length;t++){const e=this.entries[t];if(e.type===mR.Marker)break;const{element:s}=e;if(this.treeAdapter.getTagName(s)===i&&this.treeAdapter.getNamespaceURI(s)===o){const e=this.treeAdapter.getAttrList(s);e.length===r&&n.push({idx:t,attrs:e})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<3)return;const e=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,e);if(n.length<3)return;const r=new Map(e.map(t=>[t.name,t.value]));let i=0;for(let t=0;t<n.length;t++){const e=n[t];e.attrs.every(t=>r.get(t.name)===t.value)&&(i+=1,i>=3&&this.entries.splice(e.idx,1))}}insertMarker(){this.entries.unshift(wR)}pushElement(t,e){this._ensureNoahArkCondition(t),this.entries.unshift({type:mR.Element,element:t,token:e})}insertElementAfterBookmark(t,e){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:mR.Element,element:t,token:e})}removeEntry(t){const e=this.entries.indexOf(t);-1!==e&&this.entries.splice(e,1)}clearToLastMarker(){const t=this.entries.indexOf(wR);-1===t?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const e=this.entries.find(e=>e.type===mR.Marker||this.treeAdapter.getTagName(e.element)===t);return e&&e.type===mR.Element?e:null}getElementEntry(t){return this.entries.find(e=>e.type===mR.Element&&e.element===t)}}const BR={createDocument:()=>({nodeName:"#document",mode:jx.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(t,e,n)=>({nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}),createCommentNode:t=>({nodeName:"#comment",data:t,parentNode:null}),createTextNode:t=>({nodeName:"#text",value:t,parentNode:null}),appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent:t=>t.content,setDocumentType(t,e,n,r){const i=t.childNodes.find(t=>"#documentType"===t.nodeName);if(i)i.name=e,i.publicId=n,i.systemId=r;else{const i={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};BR.appendChild(t,i)}},setDocumentMode(t,e){t.mode=e},getDocumentMode:t=>t.mode,detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(BR.isTextNode(n))return void(n.value+=e)}BR.appendChild(t,BR.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&BR.isTextNode(r)?r.value+=e:BR.insertBefore(t,BR.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(t=>t.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild:t=>t.childNodes[0],getChildNodes:t=>t.childNodes,getParentNode:t=>t.parentNode,getAttrList:t=>t.attrs,getTagName:t=>t.tagName,getNamespaceURI:t=>t.namespaceURI,getTextNodeContent:t=>t.value,getCommentNodeContent:t=>t.data,getDocumentTypeNodeName:t=>t.name,getDocumentTypeNodePublicId:t=>t.publicId,getDocumentTypeNodeSystemId:t=>t.systemId,isTextNode:t=>"#text"===t.nodeName,isCommentNode:t=>"#comment"===t.nodeName,isDocumentTypeNode:t=>"#documentType"===t.nodeName,isElementNode:t=>Object.prototype.hasOwnProperty.call(t,"tagName"),setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation:t=>t.sourceCodeLocation,updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},IR="html",CR=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],TR=[...CR,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],bR=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),DR=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],vR=[...DR,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function MR(t,e){return e.some(e=>t.startsWith(e))}const NR="text/html",SR="application/xhtml+xml",_R=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),LR=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Gx.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Gx.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Gx.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Gx.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Gx.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Gx.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Gx.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Gx.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Gx.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Gx.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Gx.XMLNS}]]),xR=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),RR=new Set([Yx.B,Yx.BIG,Yx.BLOCKQUOTE,Yx.BODY,Yx.BR,Yx.CENTER,Yx.CODE,Yx.DD,Yx.DIV,Yx.DL,Yx.DT,Yx.EM,Yx.EMBED,Yx.H1,Yx.H2,Yx.H3,Yx.H4,Yx.H5,Yx.H6,Yx.HEAD,Yx.HR,Yx.I,Yx.IMG,Yx.LI,Yx.LISTING,Yx.MENU,Yx.META,Yx.NOBR,Yx.OL,Yx.P,Yx.PRE,Yx.RUBY,Yx.S,Yx.SMALL,Yx.SPAN,Yx.STRONG,Yx.STRIKE,Yx.SUB,Yx.SUP,Yx.TABLE,Yx.TT,Yx.U,Yx.UL,Yx.VAR]);function FR(t){for(let e=0;e<t.attrs.length;e++)if("definitionurl"===t.attrs[e].name){t.attrs[e].name="definitionURL";break}}function kR(t){for(let e=0;e<t.attrs.length;e++){const n=_R.get(t.attrs[e].name);null!=n&&(t.attrs[e].name=n)}}function OR(t){for(let e=0;e<t.attrs.length;e++){const n=LR.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function QR(t,e,n,r){return(!r||r===Gx.HTML)&&function(t,e,n){if(e===Gx.MATHML&&t===Yx.ANNOTATION_XML)for(let t=0;t<n.length;t++)if(n[t].name===Vx.ENCODING){const e=n[t].value.toLowerCase();return e===NR||e===SR}return e===Gx.SVG&&(t===Yx.FOREIGN_OBJECT||t===Yx.DESC||t===Yx.TITLE)}(t,e,n)||(!r||r===Gx.MATHML)&&function(t,e){return e===Gx.MATHML&&(t===Yx.MI||t===Yx.MO||t===Yx.MN||t===Yx.MS||t===Yx.MTEXT)}(t,e)}var UR;!function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"}(UR||(UR={}));const PR={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},GR=new Set([Yx.TABLE,Yx.TBODY,Yx.TFOOT,Yx.THEAD,Yx.TR]),VR={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:BR,onParseError:null};class jR{constructor(t,e,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=UR.INITIAL,this.originalInsertionMode=UR.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...VR,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=e?e:this.treeAdapter.createDocument(),this.tokenizer=new oR(this.options,this),this.activeFormattingElements=new yR(this.treeAdapter),this.fragmentContextID=n?Jx(this.treeAdapter.getTagName(n)):Yx.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new ER(this.document,this.treeAdapter,this)}static parse(t,e){const n=new this(e);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,e){const n={...VR,...e};null!=t||(t=n.treeAdapter.createElement(Hx.TEMPLATE,Gx.HTML,[]));const r=n.treeAdapter.createElement("documentmock",Gx.HTML,[]),i=new this(n,r,t);return i.fragmentContextID===Yx.TEMPLATE&&i.tmplInsertionModeStack.unshift(UR.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),e=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,e),e}_err(t,e,n){var r;if(!this.onParseError)return;const i=null!==(r=t.location)&&void 0!==r?r:PR,o={code:e,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:n?i.startLine:i.endLine,endCol:n?i.startCol:i.endCol,endOffset:n?i.startOffset:i.endOffset};this.onParseError(o)}onItemPush(t,e,n){var r,i;null===(i=(r=this.treeAdapter).onItemPush)||void 0===i||i.call(r,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,e)}onItemPop(t,e){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),null===(r=(n=this.treeAdapter).onItemPop)||void 0===r||r.call(n,t,this.openElements.current),e){let t,e;0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,e=this.fragmentContextID):({current:t,currentTagId:e}=this.openElements),this._setContextModes(t,e)}}_setContextModes(t,e){const n=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Gx.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==t&&void 0!==e&&!this._isIntegrationPoint(e,t)}_switchToTextParsing(t,e){this._insertElement(t,Gx.HTML),this.tokenizer.state=e,this.originalInsertionMode=this.insertionMode,this.insertionMode=UR.TEXT}switchToPlaintextParsing(){this.insertionMode=UR.TEXT,this.originalInsertionMode=UR.IN_BODY,this.tokenizer.state=Xx.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Hx.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===Gx.HTML)switch(this.fragmentContextID){case Yx.TITLE:case Yx.TEXTAREA:this.tokenizer.state=Xx.RCDATA;break;case Yx.STYLE:case Yx.XMP:case Yx.IFRAME:case Yx.NOEMBED:case Yx.NOFRAMES:case Yx.NOSCRIPT:this.tokenizer.state=Xx.RAWTEXT;break;case Yx.SCRIPT:this.tokenizer.state=Xx.SCRIPT_DATA;break;case Yx.PLAINTEXT:this.tokenizer.state=Xx.PLAINTEXT}}_setDocumentType(t){const e=t.name||"",n=t.publicId||"",r=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,e,n,r),t.location){const e=this.treeAdapter.getChildNodes(this.document).find(t=>this.treeAdapter.isDocumentTypeNode(t));e&&this.treeAdapter.setNodeSourceCodeLocation(e,t.location)}}_attachElementToTree(t,e){if(this.options.sourceCodeLocationInfo){const n=e&&{...e,startTag:e};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const e=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=e?e:this.document,t)}}_appendElement(t,e){const n=this.treeAdapter.createElement(t.tagName,e,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,e){const n=this.treeAdapter.createElement(t.tagName,e,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,e){const n=this.treeAdapter.createElement(t,Gx.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,e)}_insertTemplate(t){const e=this.treeAdapter.createElement(t.tagName,Gx.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(e,n),this._attachElementToTree(e,t.location),this.openElements.push(e,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Hx.HTML,Gx.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,Yx.HTML)}_appendCommentNode(t,e){const n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(e,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let e,n;if(this._shouldFosterParentOnInsertion()?(({parent:e,beforeElement:n}=this._findFosterParentingLocation()),n?this.treeAdapter.insertTextBefore(e,t.chars,n):this.treeAdapter.insertText(e,t.chars)):(e=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(e,t.chars)),!t.location)return;const r=this.treeAdapter.getChildNodes(e),i=n?r.lastIndexOf(n):r.length,o=r[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:e,endCol:n,endOffset:r}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:e,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,e){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(e,n)}_setEndLocation(t,e){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&e.location){const n=e.location,r=this.treeAdapter.getTagName(t),i=e.type===Dx.END_TAG&&r===e.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let e,n;return 0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,n=this.fragmentContextID):({current:e,currentTagId:n}=this.openElements),(t.tagID!==Yx.SVG||this.treeAdapter.getTagName(e)!==Hx.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(e)!==Gx.MATHML)&&(this.tokenizer.inForeignNode||(t.tagID===Yx.MGLYPH||t.tagID===Yx.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,e,Gx.HTML))}_processToken(t){switch(t.type){case Dx.CHARACTER:this.onCharacter(t);break;case Dx.NULL_CHARACTER:this.onNullCharacter(t);break;case Dx.COMMENT:this.onComment(t);break;case Dx.DOCTYPE:this.onDoctype(t);break;case Dx.START_TAG:this._processStartTag(t);break;case Dx.END_TAG:this.onEndTag(t);break;case Dx.EOF:this.onEof(t);break;case Dx.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(t)}}_isIntegrationPoint(t,e,n){return QR(t,this.treeAdapter.getNamespaceURI(e),this.treeAdapter.getAttrList(e),n)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const e=this.activeFormattingElements.entries.findIndex(t=>t.type===mR.Marker||this.openElements.contains(t.element));for(let n=-1===e?t-1:e-1;n>=0;n--){const t=this.activeFormattingElements.entries[n];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=UR.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Yx.P),this.openElements.popUntilTagNamePopped(Yx.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(0===t&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case Yx.TR:return void(this.insertionMode=UR.IN_ROW);case Yx.TBODY:case Yx.THEAD:case Yx.TFOOT:return void(this.insertionMode=UR.IN_TABLE_BODY);case Yx.CAPTION:return void(this.insertionMode=UR.IN_CAPTION);case Yx.COLGROUP:return void(this.insertionMode=UR.IN_COLUMN_GROUP);case Yx.TABLE:return void(this.insertionMode=UR.IN_TABLE);case Yx.BODY:return void(this.insertionMode=UR.IN_BODY);case Yx.FRAMESET:return void(this.insertionMode=UR.IN_FRAMESET);case Yx.SELECT:return void this._resetInsertionModeForSelect(t);case Yx.TEMPLATE:return void(this.insertionMode=this.tmplInsertionModeStack[0]);case Yx.HTML:return void(this.insertionMode=this.headElement?UR.AFTER_HEAD:UR.BEFORE_HEAD);case Yx.TD:case Yx.TH:if(t>0)return void(this.insertionMode=UR.IN_CELL);break;case Yx.HEAD:if(t>0)return void(this.insertionMode=UR.IN_HEAD)}this.insertionMode=UR.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let e=t-1;e>0;e--){const t=this.openElements.tagIDs[e];if(t===Yx.TEMPLATE)break;if(t===Yx.TABLE)return void(this.insertionMode=UR.IN_SELECT_IN_TABLE)}this.insertionMode=UR.IN_SELECT}_isElementCausesFosterParenting(t){return GR.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const e=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case Yx.TEMPLATE:if(this.treeAdapter.getNamespaceURI(e)===Gx.HTML)return{parent:this.treeAdapter.getTemplateContent(e),beforeElement:null};break;case Yx.TABLE:{const n=this.treeAdapter.getParentNode(e);return n?{parent:n,beforeElement:e}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const e=this._findFosterParentingLocation();e.beforeElement?this.treeAdapter.insertBefore(e.parent,t,e.beforeElement):this.treeAdapter.appendChild(e.parent,t)}_isSpecialElement(t,e){const n=this.treeAdapter.getNamespaceURI(t);return qx[n].has(e)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(t,e){t._insertCharacters(e),t.framesetOk=!1}(this,t);else switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.IN_BODY:case UR.IN_CAPTION:case UR.IN_CELL:case UR.IN_TEMPLATE:lF(this,t);break;case UR.TEXT:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:this._insertCharacters(t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_TABLE_TEXT:CF(this,t);break;case UR.IN_COLUMN_GROUP:vF(this,t);break;case UR.AFTER_BODY:kF(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(t,e){e.chars=px,t._insertCharacters(e)}(this,t);else switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.TEXT:this._insertCharacters(t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_COLUMN_GROUP:vF(this,t);break;case UR.AFTER_BODY:kF(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML)ZR(this,t);else switch(this.insertionMode){case UR.INITIAL:case UR.BEFORE_HTML:case UR.BEFORE_HEAD:case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:case UR.IN_BODY:case UR.IN_TABLE:case UR.IN_CAPTION:case UR.IN_COLUMN_GROUP:case UR.IN_TABLE_BODY:case UR.IN_ROW:case UR.IN_CELL:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:case UR.IN_TEMPLATE:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:ZR(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.AFTER_BODY:!function(t,e){t._appendCommentNode(e,t.openElements.items[0])}(this,t);break;case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:!function(t,e){t._appendCommentNode(e,t.document)}(this,t)}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case UR.INITIAL:!function(t,e){t._setDocumentType(e);const n=e.forceQuirks?jx.QUIRKS:function(t){if(t.name!==IR)return jx.QUIRKS;const{systemId:e}=t;if(e&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===e.toLowerCase())return jx.QUIRKS;let{publicId:n}=t;if(null!==n){if(n=n.toLowerCase(),bR.has(n))return jx.QUIRKS;let t=null===e?TR:CR;if(MR(n,t))return jx.QUIRKS;if(t=null===e?DR:vR,MR(n,t))return jx.LIMITED_QUIRKS}return jx.NO_QUIRKS}(e);(function(t){return t.name===IR&&null===t.publicId&&(null===t.systemId||"about:legacy-compat"===t.systemId)})(e)||t._err(e,Tx.nonConformingDoctype);t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=UR.BEFORE_HTML}(this,t);break;case UR.BEFORE_HEAD:case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:this._err(t,Tx.misplacedDoctype);break;case UR.IN_TABLE_TEXT:TF(this,t)}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Tx.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?function(t,e){if(function(t){const e=t.tagID;return e===Yx.FONT&&t.attrs.some(({name:t})=>t===Vx.COLOR||t===Vx.SIZE||t===Vx.FACE)||RR.has(e)}(e))QF(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===Gx.MATHML?FR(e):r===Gx.SVG&&(!function(t){const e=xR.get(t.tagName);null!=e&&(t.tagName=e,t.tagID=Jx(t.tagName))}(e),kR(e)),OR(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:!function(t,e){e.tagID===Yx.HTML?(t._insertElement(e,Gx.HTML),t.insertionMode=UR.BEFORE_HEAD):tF(t,e)}(this,t);break;case UR.BEFORE_HEAD:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.HEAD:t._insertElement(e,Gx.HTML),t.headElement=t.openElements.current,t.insertionMode=UR.IN_HEAD;break;default:eF(t,e)}}(this,t);break;case UR.IN_HEAD:nF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BASEFONT:case Yx.BGSOUND:case Yx.HEAD:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.STYLE:nF(t,e);break;case Yx.NOSCRIPT:t._err(e,Tx.nestedNoscriptInHead);break;default:oF(t,e)}}(this,t);break;case UR.AFTER_HEAD:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BODY:t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=UR.IN_BODY;break;case Yx.FRAMESET:t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_FRAMESET;break;case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.SCRIPT:case Yx.STYLE:case Yx.TEMPLATE:case Yx.TITLE:t._err(e,Tx.abandonedHeadElementChild),t.openElements.push(t.headElement,Yx.HEAD),nF(t,e),t.openElements.remove(t.headElement);break;case Yx.HEAD:t._err(e,Tx.misplacedStartTagForHeadElement);break;default:sF(t,e)}}(this,t);break;case UR.IN_BODY:fF(this,t);break;case UR.IN_TABLE:wF(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_CAPTION:!function(t,e){const n=e.tagID;bF.has(n)?t.openElements.hasInTableScope(Yx.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_TABLE,wF(t,e)):fF(t,e)}(this,t);break;case UR.IN_COLUMN_GROUP:DF(this,t);break;case UR.IN_TABLE_BODY:MF(this,t);break;case UR.IN_ROW:SF(this,t);break;case UR.IN_CELL:!function(t,e){const n=e.tagID;bF.has(n)?(t.openElements.hasInTableScope(Yx.TD)||t.openElements.hasInTableScope(Yx.TH))&&(t._closeTableCell(),SF(t,e)):fF(t,e)}(this,t);break;case UR.IN_SELECT:LF(this,t);break;case UR.IN_SELECT_IN_TABLE:!function(t,e){const n=e.tagID;n===Yx.CAPTION||n===Yx.TABLE||n===Yx.TBODY||n===Yx.TFOOT||n===Yx.THEAD||n===Yx.TR||n===Yx.TD||n===Yx.TH?(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),t._processStartTag(e)):LF(t,e)}(this,t);break;case UR.IN_TEMPLATE:!function(t,e){switch(e.tagID){case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.SCRIPT:case Yx.STYLE:case Yx.TEMPLATE:case Yx.TITLE:nF(t,e);break;case Yx.CAPTION:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.tmplInsertionModeStack[0]=UR.IN_TABLE,t.insertionMode=UR.IN_TABLE,wF(t,e);break;case Yx.COL:t.tmplInsertionModeStack[0]=UR.IN_COLUMN_GROUP,t.insertionMode=UR.IN_COLUMN_GROUP,DF(t,e);break;case Yx.TR:t.tmplInsertionModeStack[0]=UR.IN_TABLE_BODY,t.insertionMode=UR.IN_TABLE_BODY,MF(t,e);break;case Yx.TD:case Yx.TH:t.tmplInsertionModeStack[0]=UR.IN_ROW,t.insertionMode=UR.IN_ROW,SF(t,e);break;default:t.tmplInsertionModeStack[0]=UR.IN_BODY,t.insertionMode=UR.IN_BODY,fF(t,e)}}(this,t);break;case UR.AFTER_BODY:!function(t,e){e.tagID===Yx.HTML?fF(t,e):kF(t,e)}(this,t);break;case UR.IN_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.FRAMESET:t._insertElement(e,Gx.HTML);break;case Yx.FRAME:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.NOFRAMES:nF(t,e)}}(this,t);break;case UR.AFTER_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.NOFRAMES:nF(t,e)}}(this,t);break;case UR.AFTER_AFTER_BODY:!function(t,e){e.tagID===Yx.HTML?fF(t,e):OF(t,e)}(this,t);break;case UR.AFTER_AFTER_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.NOFRAMES:nF(t,e)}}(this,t)}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?function(t,e){if(e.tagID===Yx.P||e.tagID===Yx.BR)return QF(t),void t._endTagOutsideForeignContent(e);for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===Gx.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:!function(t,e){const n=e.tagID;n!==Yx.HTML&&n!==Yx.HEAD&&n!==Yx.BODY&&n!==Yx.BR||tF(t,e)}(this,t);break;case UR.BEFORE_HEAD:!function(t,e){const n=e.tagID;n===Yx.HEAD||n===Yx.BODY||n===Yx.HTML||n===Yx.BR?eF(t,e):t._err(e,Tx.endTagWithoutMatchingOpenElement)}(this,t);break;case UR.IN_HEAD:!function(t,e){switch(e.tagID){case Yx.HEAD:t.openElements.pop(),t.insertionMode=UR.AFTER_HEAD;break;case Yx.BODY:case Yx.BR:case Yx.HTML:iF(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.IN_HEAD_NO_SCRIPT:!function(t,e){switch(e.tagID){case Yx.NOSCRIPT:t.openElements.pop(),t.insertionMode=UR.IN_HEAD;break;case Yx.BR:oF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.AFTER_HEAD:!function(t,e){switch(e.tagID){case Yx.BODY:case Yx.HTML:case Yx.BR:sF(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.IN_BODY:AF(this,t);break;case UR.TEXT:!function(t,e){var n;e.tagID===Yx.SCRIPT&&(null===(n=t.scriptHandler)||void 0===n||n.call(t,t.openElements.current));t.openElements.pop(),t.insertionMode=t.originalInsertionMode}(this,t);break;case UR.IN_TABLE:yF(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_CAPTION:!function(t,e){const n=e.tagID;switch(n){case Yx.CAPTION:case Yx.TABLE:t.openElements.hasInTableScope(Yx.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_TABLE,n===Yx.TABLE&&yF(t,e));break;case Yx.BODY:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TBODY:case Yx.TD:case Yx.TFOOT:case Yx.TH:case Yx.THEAD:case Yx.TR:break;default:AF(t,e)}}(this,t);break;case UR.IN_COLUMN_GROUP:!function(t,e){switch(e.tagID){case Yx.COLGROUP:t.openElements.currentTagId===Yx.COLGROUP&&(t.openElements.pop(),t.insertionMode=UR.IN_TABLE);break;case Yx.TEMPLATE:rF(t,e);break;case Yx.COL:break;default:vF(t,e)}}(this,t);break;case UR.IN_TABLE_BODY:NF(this,t);break;case UR.IN_ROW:_F(this,t);break;case UR.IN_CELL:!function(t,e){const n=e.tagID;switch(n){case Yx.TD:case Yx.TH:t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_ROW);break;case Yx.TABLE:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.TR:t.openElements.hasInTableScope(n)&&(t._closeTableCell(),_F(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:break;default:AF(t,e)}}(this,t);break;case UR.IN_SELECT:xF(this,t);break;case UR.IN_SELECT_IN_TABLE:!function(t,e){const n=e.tagID;n===Yx.CAPTION||n===Yx.TABLE||n===Yx.TBODY||n===Yx.TFOOT||n===Yx.THEAD||n===Yx.TR||n===Yx.TD||n===Yx.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),t.onEndTag(e)):xF(t,e)}(this,t);break;case UR.IN_TEMPLATE:!function(t,e){e.tagID===Yx.TEMPLATE&&rF(t,e)}(this,t);break;case UR.AFTER_BODY:FF(this,t);break;case UR.IN_FRAMESET:!function(t,e){e.tagID!==Yx.FRAMESET||t.openElements.isRootHtmlElementCurrent()||(t.openElements.pop(),t.fragmentContext||t.openElements.currentTagId===Yx.FRAMESET||(t.insertionMode=UR.AFTER_FRAMESET))}(this,t);break;case UR.AFTER_FRAMESET:!function(t,e){e.tagID===Yx.HTML&&(t.insertionMode=UR.AFTER_AFTER_FRAMESET)}(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onEof(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.IN_BODY:case UR.IN_TABLE:case UR.IN_CAPTION:case UR.IN_COLUMN_GROUP:case UR.IN_TABLE_BODY:case UR.IN_ROW:case UR.IN_CELL:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:EF(this,t);break;case UR.TEXT:!function(t,e){t._err(e,Tx.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_TEMPLATE:RF(this,t);break;case UR.AFTER_BODY:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:XR(this,t)}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===fx.LINE_FEED)){if(1===t.chars.length)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(t);else switch(this.insertionMode){case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:case UR.TEXT:case UR.IN_COLUMN_GROUP:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:this._insertCharacters(t);break;case UR.IN_BODY:case UR.IN_CAPTION:case UR.IN_CELL:case UR.IN_TEMPLATE:case UR.AFTER_BODY:case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:cF(this,t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_TABLE_TEXT:IF(this,t)}}}function HR(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):gF(t,e),n}function YR(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function zR(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let o=0,s=i;s!==n;o++,s=i){i=t.openElements.getCommonAncestor(s);const n=t.activeFormattingElements.getElementEntry(s),a=n&&o>=3;!n||a?(a&&t.activeFormattingElements.removeEntry(n),t.openElements.remove(s)):(s=JR(t,n),r===e&&(t.activeFormattingElements.bookmark=n),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(s,r),r=s)}return r}function JR(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function WR(t,e,n){const r=Jx(t.treeAdapter.getTagName(e));if(t._isElementCausesFosterParenting(r))t._fosterParentElement(n);else{const i=t.treeAdapter.getNamespaceURI(e);r===Yx.TEMPLATE&&i===Gx.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function qR(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,o=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,o),t.treeAdapter.appendChild(e,o),t.activeFormattingElements.insertElementAfterBookmark(o,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,o,i.tagID)}function KR(t,e){for(let n=0;n<8;n++){const n=HR(t,e);if(!n)break;const r=YR(t,n);if(!r)break;t.activeFormattingElements.bookmark=n;const i=zR(t,r,n.element),o=t.openElements.getCommonAncestor(n.element);t.treeAdapter.detachNode(i),o&&WR(t,o,i),qR(t,r,n)}}function ZR(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function XR(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const n=t.openElements.items[0],r=t.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(t._setEndLocation(n,e),t.openElements.stackTop>=1)){const n=t.openElements.items[1],r=t.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&t._setEndLocation(n,e)}}}}function $R(t,e){t._err(e,Tx.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,jx.QUIRKS),t.insertionMode=UR.BEFORE_HTML,t._processToken(e)}function tF(t,e){t._insertFakeRootElement(),t.insertionMode=UR.BEFORE_HEAD,t._processToken(e)}function eF(t,e){t._insertFakeElement(Hx.HEAD,Yx.HEAD),t.headElement=t.openElements.current,t.insertionMode=UR.IN_HEAD,t._processToken(e)}function nF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.TITLE:t._switchToTextParsing(e,Xx.RCDATA);break;case Yx.NOSCRIPT:t.options.scriptingEnabled?t._switchToTextParsing(e,Xx.RAWTEXT):(t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_HEAD_NO_SCRIPT);break;case Yx.NOFRAMES:case Yx.STYLE:t._switchToTextParsing(e,Xx.RAWTEXT);break;case Yx.SCRIPT:t._switchToTextParsing(e,Xx.SCRIPT_DATA);break;case Yx.TEMPLATE:t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=UR.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(UR.IN_TEMPLATE);break;case Yx.HEAD:t._err(e,Tx.misplacedStartTagForHeadElement);break;default:iF(t,e)}}function rF(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==Yx.TEMPLATE&&t._err(e,Tx.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(Yx.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,Tx.endTagWithoutMatchingOpenElement)}function iF(t,e){t.openElements.pop(),t.insertionMode=UR.AFTER_HEAD,t._processToken(e)}function oF(t,e){const n=e.type===Dx.EOF?Tx.openElementsLeftAfterEof:Tx.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=UR.IN_HEAD,t._processToken(e)}function sF(t,e){t._insertFakeElement(Hx.BODY,Yx.BODY),t.insertionMode=UR.IN_BODY,aF(t,e)}function aF(t,e){switch(e.type){case Dx.CHARACTER:lF(t,e);break;case Dx.WHITESPACE_CHARACTER:cF(t,e);break;case Dx.COMMENT:ZR(t,e);break;case Dx.START_TAG:fF(t,e);break;case Dx.END_TAG:AF(t,e);break;case Dx.EOF:EF(t,e)}}function cF(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function lF(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function uF(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,Gx.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function hF(t){const e=vx(t,Vx.TYPE);return null!=e&&"hidden"===e.toLowerCase()}function dF(t,e){t._switchToTextParsing(e,Xx.RAWTEXT)}function pF(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML)}function fF(t,e){switch(e.tagID){case Yx.I:case Yx.S:case Yx.B:case Yx.U:case Yx.EM:case Yx.TT:case Yx.BIG:case Yx.CODE:case Yx.FONT:case Yx.SMALL:case Yx.STRIKE:case Yx.STRONG:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.A:!function(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(Hx.A);n&&(KR(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.H1:case Yx.H2:case Yx.H3:case Yx.H4:case Yx.H5:case Yx.H6:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),void 0!==t.openElements.currentTagId&&Kx.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.P:case Yx.DL:case Yx.OL:case Yx.UL:case Yx.DIV:case Yx.DIR:case Yx.NAV:case Yx.MAIN:case Yx.MENU:case Yx.ASIDE:case Yx.CENTER:case Yx.FIGURE:case Yx.FOOTER:case Yx.HEADER:case Yx.HGROUP:case Yx.DIALOG:case Yx.DETAILS:case Yx.ADDRESS:case Yx.ARTICLE:case Yx.SEARCH:case Yx.SECTION:case Yx.SUMMARY:case Yx.FIELDSET:case Yx.BLOCKQUOTE:case Yx.FIGCAPTION:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.LI:case Yx.DD:case Yx.DT:!function(t,e){t.framesetOk=!1;const n=e.tagID;for(let e=t.openElements.stackTop;e>=0;e--){const r=t.openElements.tagIDs[e];if(n===Yx.LI&&r===Yx.LI||(n===Yx.DD||n===Yx.DT)&&(r===Yx.DD||r===Yx.DT)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.popUntilTagNamePopped(r);break}if(r!==Yx.ADDRESS&&r!==Yx.DIV&&r!==Yx.P&&t._isSpecialElement(t.openElements.items[e],r))break}t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.BR:case Yx.IMG:case Yx.WBR:case Yx.AREA:case Yx.EMBED:case Yx.KEYGEN:uF(t,e);break;case Yx.HR:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._appendElement(e,Gx.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}(t,e);break;case Yx.RB:case Yx.RTC:!function(t,e){t.openElements.hasInScope(Yx.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.RT:case Yx.RP:!function(t,e){t.openElements.hasInScope(Yx.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(Yx.RTC),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.PRE:case Yx.LISTING:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}(t,e);break;case Yx.XMP:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Xx.RAWTEXT)}(t,e);break;case Yx.SVG:!function(t,e){t._reconstructActiveFormattingElements(),kR(e),OR(e),e.selfClosing?t._appendElement(e,Gx.SVG):t._insertElement(e,Gx.SVG),e.ackSelfClosing=!0}(t,e);break;case Yx.HTML:!function(t,e){0===t.openElements.tmplCount&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}(t,e);break;case Yx.BASE:case Yx.LINK:case Yx.META:case Yx.STYLE:case Yx.TITLE:case Yx.SCRIPT:case Yx.BGSOUND:case Yx.BASEFONT:case Yx.TEMPLATE:nF(t,e);break;case Yx.BODY:!function(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&0===t.openElements.tmplCount&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}(t,e);break;case Yx.FORM:!function(t,e){const n=t.openElements.tmplCount>0;t.formElement&&!n||(t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),n||(t.formElement=t.openElements.current))}(t,e);break;case Yx.NOBR:!function(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(Yx.NOBR)&&(KR(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.MATH:!function(t,e){t._reconstructActiveFormattingElements(),FR(e),OR(e),e.selfClosing?t._appendElement(e,Gx.MATHML):t._insertElement(e,Gx.MATHML),e.ackSelfClosing=!0}(t,e);break;case Yx.TABLE:!function(t,e){t.treeAdapter.getDocumentMode(t.document)!==jx.QUIRKS&&t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=UR.IN_TABLE}(t,e);break;case Yx.INPUT:!function(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,Gx.HTML),hF(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}(t,e);break;case Yx.PARAM:case Yx.TRACK:case Yx.SOURCE:!function(t,e){t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0}(t,e);break;case Yx.IMAGE:!function(t,e){e.tagName=Hx.IMG,e.tagID=Yx.IMG,uF(t,e)}(t,e);break;case Yx.BUTTON:!function(t,e){t.openElements.hasInScope(Yx.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.framesetOk=!1}(t,e);break;case Yx.APPLET:case Yx.OBJECT:case Yx.MARQUEE:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}(t,e);break;case Yx.IFRAME:!function(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Xx.RAWTEXT)}(t,e);break;case Yx.SELECT:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===UR.IN_TABLE||t.insertionMode===UR.IN_CAPTION||t.insertionMode===UR.IN_TABLE_BODY||t.insertionMode===UR.IN_ROW||t.insertionMode===UR.IN_CELL?UR.IN_SELECT_IN_TABLE:UR.IN_SELECT}(t,e);break;case Yx.OPTION:case Yx.OPTGROUP:!function(t,e){t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.NOEMBED:case Yx.NOFRAMES:dF(t,e);break;case Yx.FRAMESET:!function(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_FRAMESET)}(t,e);break;case Yx.TEXTAREA:!function(t,e){t._insertElement(e,Gx.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Xx.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=UR.TEXT}(t,e);break;case Yx.NOSCRIPT:t.options.scriptingEnabled?dF(t,e):pF(t,e);break;case Yx.PLAINTEXT:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.tokenizer.state=Xx.PLAINTEXT}(t,e);break;case Yx.COL:case Yx.TH:case Yx.TD:case Yx.TR:case Yx.HEAD:case Yx.FRAME:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.CAPTION:case Yx.COLGROUP:break;default:pF(t,e)}}function gF(t,e){const n=e.tagName,r=e.tagID;for(let e=t.openElements.stackTop;e>0;e--){const i=t.openElements.items[e],o=t.openElements.tagIDs[e];if(r===o&&(r!==Yx.UNKNOWN||t.treeAdapter.getTagName(i)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=e&&t.openElements.shortenToLength(e);break}if(t._isSpecialElement(i,o))break}}function AF(t,e){switch(e.tagID){case Yx.A:case Yx.B:case Yx.I:case Yx.S:case Yx.U:case Yx.EM:case Yx.TT:case Yx.BIG:case Yx.CODE:case Yx.FONT:case Yx.NOBR:case Yx.SMALL:case Yx.STRIKE:case Yx.STRONG:KR(t,e);break;case Yx.P:!function(t){t.openElements.hasInButtonScope(Yx.P)||t._insertFakeElement(Hx.P,Yx.P),t._closePElement()}(t);break;case Yx.DL:case Yx.UL:case Yx.OL:case Yx.DIR:case Yx.DIV:case Yx.NAV:case Yx.PRE:case Yx.MAIN:case Yx.MENU:case Yx.ASIDE:case Yx.BUTTON:case Yx.CENTER:case Yx.FIGURE:case Yx.FOOTER:case Yx.HEADER:case Yx.HGROUP:case Yx.DIALOG:case Yx.ADDRESS:case Yx.ARTICLE:case Yx.DETAILS:case Yx.SEARCH:case Yx.SECTION:case Yx.SUMMARY:case Yx.LISTING:case Yx.FIELDSET:case Yx.BLOCKQUOTE:case Yx.FIGCAPTION:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}(t,e);break;case Yx.LI:!function(t){t.openElements.hasInListItemScope(Yx.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(Yx.LI),t.openElements.popUntilTagNamePopped(Yx.LI))}(t);break;case Yx.DD:case Yx.DT:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}(t,e);break;case Yx.H1:case Yx.H2:case Yx.H3:case Yx.H4:case Yx.H5:case Yx.H6:!function(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}(t);break;case Yx.BR:!function(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(Hx.BR,Yx.BR),t.openElements.pop(),t.framesetOk=!1}(t);break;case Yx.BODY:!function(t,e){if(t.openElements.hasInScope(Yx.BODY)&&(t.insertionMode=UR.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}(t,e);break;case Yx.HTML:!function(t,e){t.openElements.hasInScope(Yx.BODY)&&(t.insertionMode=UR.AFTER_BODY,FF(t,e))}(t,e);break;case Yx.FORM:!function(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(Yx.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(Yx.FORM):n&&t.openElements.remove(n))}(t);break;case Yx.APPLET:case Yx.OBJECT:case Yx.MARQUEE:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:gF(t,e)}}function EF(t,e){t.tmplInsertionModeStack.length>0?RF(t,e):XR(t,e)}function mF(t,e){if(void 0!==t.openElements.currentTagId&&GR.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=UR.IN_TABLE_TEXT,e.type){case Dx.CHARACTER:CF(t,e);break;case Dx.WHITESPACE_CHARACTER:IF(t,e)}else BF(t,e)}function wF(t,e){switch(e.tagID){case Yx.TD:case Yx.TH:case Yx.TR:!function(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(Hx.TBODY,Yx.TBODY),t.insertionMode=UR.IN_TABLE_BODY,MF(t,e)}(t,e);break;case Yx.STYLE:case Yx.SCRIPT:case Yx.TEMPLATE:nF(t,e);break;case Yx.COL:!function(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(Hx.COLGROUP,Yx.COLGROUP),t.insertionMode=UR.IN_COLUMN_GROUP,DF(t,e)}(t,e);break;case Yx.FORM:!function(t,e){t.formElement||0!==t.openElements.tmplCount||(t._insertElement(e,Gx.HTML),t.formElement=t.openElements.current,t.openElements.pop())}(t,e);break;case Yx.TABLE:!function(t,e){t.openElements.hasInTableScope(Yx.TABLE)&&(t.openElements.popUntilTagNamePopped(Yx.TABLE),t._resetInsertionMode(),t._processStartTag(e))}(t,e);break;case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:!function(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_TABLE_BODY}(t,e);break;case Yx.INPUT:!function(t,e){hF(e)?t._appendElement(e,Gx.HTML):BF(t,e),e.ackSelfClosing=!0}(t,e);break;case Yx.CAPTION:!function(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_CAPTION}(t,e);break;case Yx.COLGROUP:!function(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_COLUMN_GROUP}(t,e);break;default:BF(t,e)}}function yF(t,e){switch(e.tagID){case Yx.TABLE:t.openElements.hasInTableScope(Yx.TABLE)&&(t.openElements.popUntilTagNamePopped(Yx.TABLE),t._resetInsertionMode());break;case Yx.TEMPLATE:rF(t,e);break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TBODY:case Yx.TD:case Yx.TFOOT:case Yx.TH:case Yx.THEAD:case Yx.TR:break;default:BF(t,e)}}function BF(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,aF(t,e),t.fosterParentingEnabled=n}function IF(t,e){t.pendingCharacterTokens.push(e)}function CF(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function TF(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)BF(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const bF=new Set([Yx.CAPTION,Yx.COL,Yx.COLGROUP,Yx.TBODY,Yx.TD,Yx.TFOOT,Yx.TH,Yx.THEAD,Yx.TR]);function DF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.COL:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.TEMPLATE:nF(t,e);break;default:vF(t,e)}}function vF(t,e){t.openElements.currentTagId===Yx.COLGROUP&&(t.openElements.pop(),t.insertionMode=UR.IN_TABLE,t._processToken(e))}function MF(t,e){switch(e.tagID){case Yx.TR:t.openElements.clearBackToTableBodyContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_ROW;break;case Yx.TH:case Yx.TD:t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(Hx.TR,Yx.TR),t.insertionMode=UR.IN_ROW,SF(t,e);break;case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE,wF(t,e));break;default:wF(t,e)}}function NF(t,e){const n=e.tagID;switch(e.tagID){case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE);break;case Yx.TABLE:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE,yF(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TD:case Yx.TH:case Yx.TR:break;default:yF(t,e)}}function SF(t,e){switch(e.tagID){case Yx.TH:case Yx.TD:t.openElements.clearBackToTableRowContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_CELL,t.activeFormattingElements.insertMarker();break;case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.TR:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,MF(t,e));break;default:wF(t,e)}}function _F(t,e){switch(e.tagID){case Yx.TR:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY);break;case Yx.TABLE:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,NF(t,e));break;case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(Yx.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,NF(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TD:case Yx.TH:break;default:yF(t,e)}}function LF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.OPTION:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t._insertElement(e,Gx.HTML);break;case Yx.OPTGROUP:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop(),t._insertElement(e,Gx.HTML);break;case Yx.HR:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop(),t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.INPUT:case Yx.KEYGEN:case Yx.TEXTAREA:case Yx.SELECT:t.openElements.hasInSelectScope(Yx.SELECT)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),e.tagID!==Yx.SELECT&&t._processStartTag(e));break;case Yx.SCRIPT:case Yx.TEMPLATE:nF(t,e)}}function xF(t,e){switch(e.tagID){case Yx.OPTGROUP:t.openElements.stackTop>0&&t.openElements.currentTagId===Yx.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===Yx.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop();break;case Yx.OPTION:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop();break;case Yx.SELECT:t.openElements.hasInSelectScope(Yx.SELECT)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode());break;case Yx.TEMPLATE:rF(t,e)}}function RF(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(Yx.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):XR(t,e)}function FF(t,e){var n;if(e.tagID===Yx.HTML){if(t.fragmentContext||(t.insertionMode=UR.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===Yx.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(null===(n=t.treeAdapter.getNodeSourceCodeLocation(r))||void 0===n?void 0:n.endTag)&&t._setEndLocation(r,e)}}else kF(t,e)}function kF(t,e){t.insertionMode=UR.IN_BODY,aF(t,e)}function OF(t,e){t.insertionMode=UR.IN_BODY,aF(t,e)}function QF(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==Gx.HTML&&void 0!==t.openElements.currentTagId&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),String.prototype.codePointAt;function UF(t,e){return function(n){let r,i=0,o="";for(;t.exec(n);)i!==r.index&&n.substring(i,r.index),e.get(r[0].charCodeAt(0)),r.index+1;return o+n.substring(i)}}new Map([[34,"""],[38,"&"],[160," "]]),new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]);new Set([Hx.AREA,Hx.BASE,Hx.BASEFONT,Hx.BGSOUND,Hx.BR,Hx.COL,Hx.EMBED,Hx.FRAME,Hx.HR,Hx.IMG,Hx.INPUT,Hx.KEYGEN,Hx.LINK,Hx.META,Hx.PARAM,Hx.SOURCE,Hx.TRACK,Hx.WBR]);var PF;!function(t){t.Root="root",t.Text="text",t.Directive="directive",t.Comment="comment",t.Script="script",t.Style="style",t.Tag="tag",t.CDATA="cdata",t.Doctype="doctype"}(PF||(PF={}));PF.Root,PF.Text,PF.Directive,PF.Comment,PF.Script,PF.Style,PF.Tag,PF.CDATA,PF.Doctype;class GF{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return tk(this,t)}}class VF extends GF{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class jF extends VF{constructor(){super(...arguments),this.type=PF.Text}get nodeType(){return 3}}class HF extends VF{constructor(){super(...arguments),this.type=PF.Comment}get nodeType(){return 8}}class YF extends VF{constructor(t,e){super(e),this.name=t,this.type=PF.Directive}get nodeType(){return 1}}class zF extends GF{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class JF extends zF{constructor(){super(...arguments),this.type=PF.CDATA}get nodeType(){return 4}}class WF extends zF{constructor(){super(...arguments),this.type=PF.Root}get nodeType(){return 9}}class qF extends zF{constructor(t,e,n=[],r=("script"===t?PF.Script:"style"===t?PF.Style:PF.Tag)){super(n),this.name=t,this.attribs=e,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map(t=>{var e,n;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(n=this["x-attribsPrefix"])||void 0===n?void 0:n[t]}})}}function KF(t){return(e=t).type===PF.Tag||e.type===PF.Script||e.type===PF.Style;var e}function ZF(t){return t.type===PF.Text}function XF(t){return t.type===PF.Comment}function $F(t){return t.type===PF.Directive}function tk(t,e=!1){let n;if(ZF(t))n=new jF(t.data);else if(XF(t))n=new HF(t.data);else if(KF(t)){const r=e?ek(t.children):[],i=new qF(t.name,{...t.attribs},r);r.forEach(t=>t.parent=i),null!=t.namespace&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...t["x-attribsPrefix"]}),n=i}else if(function(t){return t.type===PF.CDATA}(t)){const r=e?ek(t.children):[],i=new JF(r);r.forEach(t=>t.parent=i),n=i}else if(function(t){return t.type===PF.Root}(t)){const r=e?ek(t.children):[],i=new WF(r);r.forEach(t=>t.parent=i),t["x-mode"]&&(i["x-mode"]=t["x-mode"]),n=i}else{if(!$F(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new YF(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),n=e}}return n.startIndex=t.startIndex,n.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(n.sourceCodeLocation=t.sourceCodeLocation),n}function ek(t){const e=t.map(t=>tk(t,!0));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}function nk(t){const e=t.includes('"')?"'":'"';return e+t+e}const rk={isCommentNode:XF,isElementNode:KF,isTextNode:ZF,createDocument(){const t=new WF([]);return t["x-mode"]=jx.NO_QUIRKS,t},createDocumentFragment:()=>new WF([]),createElement(t,e,n){const r=Object.create(null),i=Object.create(null),o=Object.create(null);for(let t=0;t<n.length;t++){const e=n[t].name;r[e]=n[t].value,i[e]=n[t].namespace,o[e]=n[t].prefix}const s=new qF(t,r,[]);return s.namespace=e,s["x-attribsNamespace"]=i,s["x-attribsPrefix"]=o,s},createCommentNode:t=>new HF(t),createTextNode:t=>new jF(t),appendChild(t,e){const n=t.children[t.children.length-1];n&&(n.next=e,e.prev=n),t.children.push(e),e.parent=t},insertBefore(t,e,n){const r=t.children.indexOf(n),{prev:i}=n;i&&(i.next=e,e.prev=i),n.prev=e,e.next=n,t.children.splice(r,0,e),e.parent=t},setTemplateContent(t,e){rk.appendChild(t,e)},getTemplateContent:t=>t.children[0],setDocumentType(t,e,n,r){const i=function(t,e,n){let r="!DOCTYPE ";return t&&(r+=t),e?r+=` PUBLIC ${nk(e)}`:n&&(r+=" SYSTEM"),n&&(r+=` ${nk(n)}`),r}(e,n,r);let o=t.children.find(t=>$F(t)&&"!doctype"===t.name);o?o.data=null!=i?i:null:(o=new YF("!doctype",i),rk.appendChild(t,o)),o["x-name"]=e,o["x-publicId"]=n,o["x-systemId"]=r},setDocumentMode(t,e){t["x-mode"]=e},getDocumentMode:t=>t["x-mode"],detachNode(t){if(t.parent){const e=t.parent.children.indexOf(t),{prev:n,next:r}=t;t.prev=null,t.next=null,n&&(n.next=r),r&&(r.prev=n),t.parent.children.splice(e,1),t.parent=null}},insertText(t,e){const n=t.children[t.children.length-1];n&&ZF(n)?n.data+=e:rk.appendChild(t,rk.createTextNode(e))},insertTextBefore(t,e,n){const r=t.children[t.children.indexOf(n)-1];r&&ZF(r)?r.data+=e:rk.insertBefore(t,rk.createTextNode(e),n)},adoptAttributes(t,e){for(let n=0;n<e.length;n++){const r=e[n].name;void 0===t.attribs[r]&&(t.attribs[r]=e[n].value,t["x-attribsNamespace"][r]=e[n].namespace,t["x-attribsPrefix"][r]=e[n].prefix)}},getFirstChild:t=>t.children[0],getChildNodes:t=>t.children,getParentNode:t=>t.parent,getAttrList:t=>t.attributes,getTagName:t=>t.name,getNamespaceURI:t=>t.namespace,getTextNodeContent:t=>t.data,getCommentNodeContent:t=>t.data,getDocumentTypeNodeName(t){var e;return null!==(e=t["x-name"])&&void 0!==e?e:""},getDocumentTypeNodePublicId(t){var e;return null!==(e=t["x-publicId"])&&void 0!==e?e:""},getDocumentTypeNodeSystemId(t){var e;return null!==(e=t["x-systemId"])&&void 0!==e?e:""},isDocumentTypeNode:t=>$F(t)&&"!doctype"===t.name,setNodeSourceCodeLocation(t,e){e&&(t.startIndex=e.startOffset,t.endIndex=e.endOffset),t.sourceCodeLocation=e},getNodeSourceCodeLocation:t=>t.sourceCodeLocation,updateNodeSourceCodeLocation(t,e){null!=e.endOffset&&(t.endIndex=e.endOffset),t.sourceCodeLocation={...t.sourceCodeLocation,...e}}};var ik=s(928),ok=s(3631);qF.prototype.toString=function(){throw new Error("Element.toString() is not supported")},Object.defineProperty(GF.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(GF.prototype,"localName",{get:function(){return this.name}});const sk=Object.getOwnPropertyDescriptor(qF.prototype,"attributes")?.get;function ak(t,e,n){return function(t,e,n){const r=function(t,e){return jR.parse(t,e)}(t,{treeAdapter:rk,sourceCodeLocationInfo:!0});r.name="root";const i=ok.parse(e),o=i.select({node:r,allowAnyNamespaceForNoPrefix:!0});if(!o.length)throw new Error(`Failed to find XPath: "${e}"`);return o.map(t=>function(t,e){if(!e)return{start:t.startIndex,end:t.endIndex};if(!("firstChild"in t)||!t.firstChild)throw new Error(`Node "${t.name}" has no children`);return{start:t.firstChild.startIndex,end:t.lastChild.endIndex}}(t,n))}(t,e,n)}function ck(t,e){const n=hx({path:e,json:JSON.parse(t),wrap:!1,resultType:"pointer",eval:"safe",ignoreEvalErrors:!0});if(!n)throw new Error("jsonPath not found");const r=XL("("+t+")",{range:!0});if(r.body[0]instanceof DS&&(r.body[0].expression instanceof WS||r.body[0].expression instanceof XN)){const t=Array.isArray(n)?n:[n],e=[];for(const n of t){const t=lk(r.body[0].expression,"",[n]);t&&e.push({start:t.start-1,end:t.end-1})}return e}throw new Error("jsonPath not found")}function lk(t,e,n){if(t instanceof WS)for(const r of t.properties){if(!(r instanceof ZS))continue;const t=r.key.type===RN.Literal?e+"/"+r.key.value:e;if(n.includes(t)&&"range"in r&&Array.isArray(r.range))return{start:r.range[0],end:r.range[1]};if(r.value instanceof WS||r.value instanceof XN){const e=lk(r.value,t,n);if(e)return e}}if(t instanceof XN)for(let r=0;r<t.elements.length;r++){const i=t.elements[r];if(!i)continue;const o=e+"/"+r;if(n.includes(o)&&"range"in i&&Array.isArray(i.range))return{start:i.range[0],end:i.range[1]};if(i instanceof WS){const t=lk(i,o,n);if(t)return t}if(i instanceof XN){const t=lk(i,o,n);if(t)return t}}return null}function uk(t){const e=[];for(const[n,r]of Object.entries(t||{}))e.push(`${n}: ${r}`);return e}function hk(t,e,n){if(n?.length){let e=0;for(const r of n){const n=r.toIndex-r.fromIndex;if(t>=e&&t<=e+n)return t-e+r.fromIndex;e+=n}throw new Error("position out of range")}return e+t}function dk(t,e,n){const r=[];if(!n?.length)return r;for(let i=1;i<n?.length;i++){const o=n[i];o.fromIndex>t&&o.fromIndex<e&&r.push({fromIndex:n[i-1].toIndex,toIndex:o.fromIndex})}return r}function pk(t){const e=wy();return e.onChunk(t),e.streamEnded(),e.res}function fk(t){return ik(t,"sgiu")}sk?Object.defineProperty(qF.prototype,"attributes",{get:function(...t){const e=sk.call(this,...t);return e.item=t=>{const n=e[t];return{...n,nodeType:2,localName:n.name}},e}}):console.warn("[WARN] Unable to patch DOM: Element.attributes property descriptor not found");const gk="{".charCodeAt(0),Ak="}".charCodeAt(0);function Ek(t,e){if(0===t.length&&0===e?.length)return!0;if(!e)return!1;let n=-1,r=-1;for(;n<t.length&&r<e.length;){let t=i(),e=o();if(t!==e){if(t!==gk||e!==fy)return!1;if(i()!==gk)return!1;for(;(t=i())!==Ak&&-1!==t;);for(;(t=i())!==Ak&&-1!==t;);if(-1===t)return!1;for(;(e=o())===fy&&-1!==e;);if(-1===e)return-1===i();r--}}function i(){return n++,n<t.length?t[n]:-1}function o(){return e?(r++,r<e.length?e[r]:-1):-1}return n===t.length&&r===e.length}const{K3:mk}=n,wk={hostPort:function(t,e){const{host:n}=new URL(function(t,e){let n=t?.url;const r=new Set;let i=null;for(;i=Ik.exec(n);)r.add(i[1]);for(const i of r)if(t.paramValues&&i in t.paramValues)n=n?.replaceAll(`{{${i}}}`,t.paramValues[i].toString());else{if(!e?.paramValues||!(i in e.paramValues))throw new Error(`parameter "${i}" value not found in templateParams`);n=n?.replaceAll(`{{${i}}}`,e.paramValues[i].toString())}return n}(t,e));if(!n)throw new Error("url is incorrect");return n},writeRedactionMode:t=>"writeRedactionMode"in t?t.writeRedactionMode:void 0,geoLocation:(t,e)=>"geoLocation"in t?function(t,e){if(t?.geoLocation){const n=new Set;let r=t.geoLocation,i=null;for(;i=Ik.exec(r);)n.add(i[1]);for(const i of n)if(t.paramValues&&i in t.paramValues)r=r?.replaceAll(`{{${i}}}`,t.paramValues[i].toString());else{if(!e?.paramValues||!(i in e.paramValues))throw new Error(`parameter "${i}" value not found in templateParams`);r=r?.replaceAll(`{{${i}}}`,e.paramValues[i].toString())}if(!/^[A-Za-z]{2}$/gisu.test(r))throw new Error(`Geolocation ${r} is invalid`);return r}return}(t,e):void 0,proxySessionId:(t,e)=>"proxySessionId"in t?function(t,e){if(t?.proxySessionId){const r=new Set;let i=t.proxySessionId,o=null;for(;o=Ik.exec(i);)r.add(o[1]);for(const n of r)if(t.paramValues&&n in t.paramValues)i=i?.replaceAll(`{{${n}}}`,t.paramValues[n].toString());else{if(!e?.paramValues||!(n in e.paramValues))throw new Error(`parameter "${n}" value not found in templateParams`);i=i?.replaceAll(`{{${n}}}`,e.paramValues[n].toString())}if(!("string"==typeof(n=i)&&n.length>=8&&n.length<15&&/^[a-z0-9]+$/.test(n)))throw new Error(`proxySessionId ${i} is invalid`);return i}var n;return}(t,e):void 0,additionalClientOptions(t){let e={applicationLayerProtocols:["http/1.1"]};return"additionalClientOptions"in t&&(e={...e,...t.additionalClientOptions}),e},createRequest(t,e,n){if(!t.cookieStr&&!t.authorisationHeader&&!t.headers)throw new Error("auth parameters are not set");const r=e.headers||{},i={...t.headers};t.cookieStr&&(i.Cookie=t.cookieStr),t.authorisationHeader&&(i.Authorization=t.authorisationHeader);Object.keys(r).some(t=>"user-agent"===t.toLowerCase())||Object.keys(i).some(t=>"user-agent"===t.toLowerCase())||(r["User-Agent"]="reclaim/0.0.1");const o=Tk(e,t);e=o.newParams;const s=new URL(e.url),{pathname:a}=s,c=e.url.includes("?")?e.url.split("?")[1]:"";n.info({url:e.url,path:a,query:c.toString()});const l=e.body instanceof Uint8Array?e.body:Yw(e.body||""),u=l.length,h=`${e.method} ${a}${c?.length?"?"+c:""} HTTP/1.1`,d=uk(i);n.info({requestLine:h});const p=Yw([h,`Host: ${Bk(s)}`,`Content-Length: ${u}`,"Connection: close","Accept-Encoding: identity",...uk(r),...d,"\r\n"].join("\r\n")),f=K([p,l]),g=d.join("\r\n"),A=Jw(f,Yw(g)),E=[{fromIndex:A,toIndex:A+g.length}];if(o.hiddenBodyParts?.length>0)for(const t of o.hiddenBodyParts)t.length&&E.push({fromIndex:p.length+t.index,toIndex:p.length+t.index+t.length});if(o.hiddenURLParts?.length>0)for(const t of o.hiddenURLParts)t.length&&E.push({fromIndex:t.index,toIndex:t.index+t.length});return E.sort((t,e)=>t.toIndex-e.toIndex),{data:f,redactions:E}},getResponseRedactions({response:t,params:e,logger:n,ctx:r}){n.debug({response:mk.encode(t),params:e});const i=pk(t);if(!e.responseRedactions?.length)return[];if(2!=(i.statusCode/100|0))throw n.error({response:mk.encode(t),params:e}),new Error(`Expected status 2xx, got ${i.statusCode} (${i.statusMessage})`);const o=Tk(e,void 0,!0).newParams,s=i.statusLineEndIndex,a=i.bodyStartIndex??0;if(a<4)throw n.error({response:mk.encode(t)}),new Error("Failed to find response body");const c=[{fromIndex:0,toIndex:s}];if(yk(r)){if(!Z(t.slice(i.headerEndIdx,i.headerEndIdx+4),Yw("\r\n\r\n")))throw n.error({response:mk.encode(t)}),new Error(`Failed to find header/body separator at index ${i.headerEndIdx}`)}c.push({fromIndex:i.headerEndIdx,toIndex:i.headerEndIdx+4}),i.headerIndices.date&&c.push(i.headerIndices.date);const l=tt(i.body),u=[];for(const t of o.responseRedactions||[]){const e=Ck(l,t,a,i.chunks);for(const{reveal:t,redactions:n}of e)c.push(t),u.push(...n)}if(c.sort((t,e)=>t.toIndex-e.toIndex),c.length>1){let e=0;for(const t of c)e<t.fromIndex&&u.push({fromIndex:e,toIndex:t.fromIndex}),e=t.toIndex;u.push({fromIndex:e,toIndex:t.length})}for(const t of c)t.hash&&u.push(t);return u.sort((t,e)=>t.toIndex-e.toIndex),u},assertValidProviderReceipt({receipt:t,params:e,logger:n,ctx:r}){!function(){const r=t.filter(t=>"client"===t.sender).map(t=>t.message),i=t.filter(t=>"server"===t.sender).map(t=>t.message),o=mk.encode(K(r)),s=mk.encode(K(i));n.debug({request:o,response:s,params:e})}();let i={};const o="secretParams"in e?e.secretParams:void 0,s=Tk(e,o,!o),a=s.newParams;i={...i,...s.extractedValues};const c=function(t){const e=t.filter(t=>"client"===t.sender);if(e[0].message[0]===fy)throw new Error("First client message request is redacted. Cannot parse");const n={method:"",url:"",protocol:"",headers:{}};let r=K(e.map(t=>t.message));for(let t=i();void 0!==t&&""!==t;t=i())if(n.method){let e=t.indexOf(":");-1===e&&(e=t.length-1);const r=t.slice(0,e).toLowerCase().trim(),i=t.slice(e+1).trim(),o=n.headers[r];"string"==typeof o?n.headers[r]=[o,i]:Array.isArray(o)?o.push(i):n.headers[r]=i}else{const[,e,r,i]=t.match(/(\w+) (.*) (.*)/)||[];n.method=e.toLowerCase(),n.url=r,n.protocol=i}if(r.length&&(n.body=r),!n.method)throw new Error("Client request is incomplete");return n;function i(){const t=Jw(r,my);if(-1===t)return;const e=Hw(r.slice(0,t));return r=r.slice(t+my.length),e}}(t);if(c.method!==a.method.toLowerCase())throw new Error(`Invalid method: ${c.method}`);const l=new URL(a.url),{protocol:u,pathname:h}=l;if("https:"!==u)throw n.error("params URL: %s",a.url),new Error(`Expected protocol: https, found: ${u}`);const d=a.url.includes("?")?a.url.split("?")[1]:"",p=h.replaceAll("%7B","{").replaceAll("%7D","}")+(d?.length?"?"+d:"");if(!Ek(Yw(p),Yw(c.url)))throw n.error("params URL: %s",a.url),new Error(`Expected path: ${p}, found: ${c.url}`);const f=Bk(l);if(c.headers.host!==f)throw new Error(`Expected host: ${f}, found: ${c.headers.host}`);const g=c.headers.connection;if("close"!==g)throw new Error(`Connection header must be "close", got "${g}"`);const A=function(...t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(...t.filter(t=>"server"===t.sender).map(t=>t.message).filter(t=>!t.every(t=>t===fy)));let E;E=Hw(A);if(!fk("^HTTP\\/1.1 2\\d{2}").exec(E)){const t=fk("^HTTP\\/1.1 (\\d{3})").exec(E);if(t&&t.length>1)throw new Error(`Provider returned error ${t[1]}`);let e=E.indexOf("*");throw-1===e&&(e=E.indexOf("\n")),-1===e&&(e=12),new Error(`Response did not start with "HTTP/1.1 2XX" got "${E.slice(0,e)}"`)}let m;if(yk(r)){if(m=E.indexOf("\r\n\r\n",12)+4,m<4)throw new Error("Response body start not found")}else m=12;const w=fk("[dD]ate: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-3][0-9]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[0-9]{4}) (?:[01][0-9]|2[0-3])(?::[0-5][0-9]){2} GMT)").exec(E);if(w&&w.length>1){const t=new Date(w[1]);Date.now()-t.getTime()>6e5&&n.info({dateHeader:w[0],current:Date.now()},"date header is off")}const y=a.body instanceof Uint8Array?a.body:Yw(a.body||"");if(y.length>0&&!Ek(y,c.body))throw new Error("request body mismatch");o||(E=E.slice(m).replace(/(\*){3,}/g,""));for(const{type:t,value:e,invert:n}of a.responseMatches||[]){const r=Boolean(n);switch(t){case"regex":const o=fk(e).exec(E),s=null!==o;if(s===r)throw new Error(`Invalid receipt. Regex "${e}" ${n?"matched":"didn't match"}`);if(!s)continue;const a=o?.groups;for(const t in a||[]){if(t in i)throw new Error(`Duplicate parameter ${t}`);const e=a?.[t];"string"==typeof e&&(i[t]=e)}break;case"contains":if(E.includes(e)===r)throw new Error(`Invalid receipt. Response ${n?"contains":"does not contain"} "${e}"`);break;default:throw new Error(`Invalid response match type ${t}`)}}return{extractedParameters:i}}};function yk({version:t}){return t>=em}function Bk(t){const e=t.hostname,n=t.port;return n&&443!==+n?`${e}:${n}`:e}const Ik=/{{([^{}]+)}}/gis;function*Ck(t,e,n,r){let i=t,o=0,s=-1;if(e.xPath){const n=ak(t,e.xPath,!!e.jsonPath);for(const{start:r,end:u}of n)i=t.slice(r,u),o=r,s=u-r,e.jsonPath?yield*a():e.regex?yield*c():yield*l()}else if(e.jsonPath)yield*a();else{if(!e.regex)throw new Error("Expected either xPath, jsonPath or regex for redaction");yield*c()}function*a(){const n=ck(i,e.jsonPath),r=o;for(const a of n){const n=a.start,u=a.end;i=t.slice(r+n,r+u),o=r+n,s=u-n,e.regex?yield*c():yield*l()}}function*c(){uy.debug({element:mk.encode(Yw(i)),body:mk.encode(Yw(t))});const n=fk(e.regex),a=i||t,c=n.exec(a);if(!c?.[0])throw new Error(`regexp ${e.regex} does not match found element '${mk.encode(Yw(a))}'`);if(o+=c.index,s=n.lastIndex-c.index,i=c[0],e.hash&&(!c.groups||Object.keys(c.groups).length>1))throw new Error("Exactly one named capture group is needed per hashed redaction");if(!e.hash||!c.groups)return void(yield*l());const h=c[0],d=Object.values(c.groups)[0],p=h.indexOf(d);s=p,i=h.slice(0,p),yield*l(null),o+=p,i=d,s=d.length;const f=u(o,s,e.hash),g=dk(f.fromIndex,f.toIndex,r);if(g.length)throw new Error("Hash redactions cannot be performed if the redacted string is split between 2 or more HTTP chunks");yield{reveal:f,redactions:g},o+=d.length,i=h.slice(p+d.length),s=i.length,yield*l(null)}function*l(t=e.hash,n=r){if(o<0||!s)return;const i=u(o,s,t||void 0);yield{reveal:i,redactions:dk(i.fromIndex,i.toIndex,n)}}function u(t,e,i){return{fromIndex:hk(t,n,r),toIndex:hk(t+e,n,r),hash:i}}}function Tk(t,e,n){const r=JSON.parse(JSON.stringify(t));let i={};const o=[],s=h(r.url,n);if(s&&(r.url=s.newParam,i={...s.extractedValues},s.hiddenParts.length)){const e=`https://${Bk(new URL(r.url))}`.length-t.method.length-1;for(const t of s.hiddenParts)o.push({index:t.index-e,length:t.length})}let a,c=[];if(r.body){a=h("string"==typeof r.body?r.body:Hw(r.body),n),a&&(r.body=a.newParam,i={...i,...a.extractedValues},c=a.hiddenParts)}const l=h(r.geoLocation);l&&(r.geoLocation=l.newParam,i={...i,...l.extractedValues});const u=h(r.proxySessionId);if(u&&(r.proxySessionId=u.newParam,i={...i,...u.extractedValues}),r.responseRedactions)for(const t of r.responseRedactions){if(t.regex){const e=h(t.regex);t.regex=e?.newParam}if(t.xPath){const e=h(t.xPath);t.xPath=e?.newParam}if(t.jsonPath){const e=h(t.jsonPath);t.jsonPath=e?.newParam}}if(r.responseMatches)for(const t of r.responseMatches)if(""!==t.value){const e=h(t.value);t.value=e?.newParam,i={...i,...e?.extractedValues}}return{newParams:r,extractedValues:i,hiddenBodyParts:c,hiddenURLParts:o};function h(t,n){if(!t)return null;const i={},o=[];let s=0;return{newParam:t=t.replace(Ik,(t,a,c)=>{if(r.paramValues&&a in r.paramValues)return i[a]=r.paramValues[a],s+=r.paramValues[a].length-t.length,r.paramValues[a];if(e){if(e?.paramValues&&a in e?.paramValues)return o.push({index:c+s,length:e.paramValues[a].length}),s+=e.paramValues[a].length-t.length,e.paramValues[a];throw new Error(`parameter's "${a}" value not found in paramValues and secret parameter's paramValues`)}if(n)return t;throw new Error(`parameter's "${a}" value not found in paramValues`)}),extractedValues:i,hiddenParts:o}}}const bk={http:wk},Dk=async({onMessage:t,onClose:e,tlsOpts:n,request:r,connect:i,logger:o})=>{const s=[],a=r.id||Zw();let c,l,u,h;const d=new Promise((t,e)=>{u=t,h=e}),p=zd({host:r.host,...n,logger:o,onHandshake(){u?.()},onApplicationData:e=>t?.(e),onTlsEnd:f,async write(t,e){const n=K([t.header,t.content]);if(s.push({sender:"client",message:{...e,data:n}}),!c){const t=Kw();l=i([{id:t,createTunnelRequest:{host:r.host||"",port:r.port||443,geoLocation:r.geoLocation||"",proxySessionId:r.proxySessionId||"",id:a}},{tunnelMessage:{tunnelId:a,message:n}}]);try{await async function(){return c=await(({tunnelId:t,client:e,onClose:n,onMessage:r})=>{let i=!1;return e.addEventListener("tunnel-message",o),e.addEventListener("tunnel-disconnect-event",s),e.addEventListener("connection-terminated",a),{async write(n){await e.sendMessage({tunnelMessage:{tunnelId:t,message:n}})},async close(n){i||(c(n),await e.rpc("disconnectTunnel",{id:t}))}};function o({data:e}){e.tunnelId===t&&r?.(e.message)}function s({data:e}){e.tunnelId===t&&c(e.error?.code?Iv.fromProto(e.error):void 0)}function a({data:t}){c(t)}function c(r){e.logger?.debug({tunnelId:t,err:r},"TCP tunnel closed"),e.removeEventListener("tunnel-message",o),e.removeEventListener("tunnel-disconnect-event",s),e.removeEventListener("connection-terminated",a),n?.(r),n=void 0,i=!0}})({tunnelId:a,client:l,onMessage(t){p.handleReceivedBytes(t)},onClose(t){p.end(t)}}),o?.debug("plaintext tunnel created"),c}(),await l.waitForResponse(t)}catch(t){f(t)}return}return c.write(n)},onRead(t,e){s.push({sender:"server",message:{...e,data:K([t.header,"ciphertext"===e.type?e.ciphertext:t.content])}})}});return await p.startHandshake(),await d,u=h=void 0,{transcript:s,tls:p,write:t=>p.write(t),async close(t){f(t);try{await c.close(t)}catch(t){o?.error({err:t},"err in close tunnel")}}};function f(t){e?.(t),e=void 0,h?.(t||new Error("TLS connection closed"))}},vk={};function Mk({logger:t,maxRetries:e=3,...n}){const r=t||("logger"in n.client?n.client.logger:uy);return async function(t,{maxRetries:e=3,shouldRetry:n,logger:r}){let i=0;for(;i<e;)try{return await t(i)}catch(t){if(i+=1,i>=e)throw t;if(!n(t))throw t;r.info({err:t,retries:i},"retrying failed operation")}throw new Error("retries exhausted")}(t=>async function({name:t,params:e,secretParams:n,context:r,onStep:i,ownerPrivateKey:o,client:s,logger:a=uy,timestampS:c,updateProviderParams:l,updateParametersFromOprfData:u=!0,...h}){const d=bk[t],p=qw(e,d.hostPort,n),f=qw(e,d.geoLocation,n),g=qw(e,d.proxySessionId,n),A=qw(e,d.additionalClientOptions),E={...vN(),fetchCertificateBytes:J,...A},{zkEngine:m="snarkjs"}=h;let w=qw(e,d.writeRedactionMode);const[y,B]=p.split(":"),I=wy();let T,b=!1;const D=new Map;let v;i?.({name:"connecting"});const M={host:y,port:B?+B:yw,geoLocation:f,proxySessionId:g,id:Zw()};a=a.child({tunnelId:M.id});const N="authRequest"in s?"function"==typeof s.authRequest?await s.authRequest():s.authRequest:void 0,S=await Dk({tlsOpts:E,connect:t=>{let e=!1;return T="metadata"in s?s:function(t,e=()=>({})){const n=t.toString();let r,i=vk[n];if(i?.isClosed?r="closed":i||(r="non-existent"),r){const o=e();o?.logger?.info({key:n,createReason:r},"creating new client"),i=vk[n]=new xN({...o,url:t})}return i}(s.url,()=>(e=!0,{authRequest:N,initMessages:t,logger:a})),e||T.waitForInit().then(()=>T.sendMessage(...t)).catch(t=>{a.error({err:t},"error in sending init msgs")}),T},logger:a,request:M,onMessage(t){a.debug({bytes:t.length},"recv data from server"),I.onChunk(t),I.res.complete&&(a?.debug("got complete HTTP response from server"),setTimeout(()=>{v?.()},100))},onClose(t){const e=t?"error":"debug";a?.[e]({err:t},"tls session ended"),v?.(t);try{I.streamEnded()}catch{}}}),{version:_,cipherSuite:L}=S.tls.getMetadata();"TLS1_2"===_&&"zk"!==w&&(w="zk",a.info("TLS1.2 detected, defaulting to zk redaction mode"));const{redactions:x,data:R}=d.createRequest(n,e,a),F="string"==typeof R?$(R):R;a.debug({redactions:x.length},"generated request");const k=new Promise((t,e)=>{v=n=>n?e(n):t()});i?.({name:"sending-request-data"});try{"zk"===w?await q():await W(),a.info("wrote request to server")}catch(t){a.error({err:t},"session errored during write, waiting for stream end")}if(i?.({name:"waiting-for-response"}),await k,await S.close(),a.info("session closed, processing response"),l){const{params:t,secretParams:r}=await l(S.transcript,_??"TLS1_2");e={...e,...t},n={...n,...r}}const O=TN[T.metadata.signatureType];let Q,U;const[P]=tt("server",1);P&&"ciphertext"===P.message.type&&(Q=P.message.fixedIv);const[G]=tt("client",1);G&&"ciphertext"===G.message.type&&(U=G.message.fixedIv);const V=await et(),j=jm.create({request:M,data:{provider:t,parameters:Qv(e),context:Qv(r),timestampS:c??zw(),owner:ot()},transcript:V,zkEngine:"gnark"===m?cm:am,fixedServerIV:Q,fixedClientIV:U});i?.({name:"waiting-for-verification"});const H=jm.encode(j).finish(),Y=await O.sign(H,o);j.signatures={requestSignature:Y};const z=await T.rpc("claimTunnel",j);return a.info({success:!!z.claim},"recv claim response"),z;async function J(t){if(!T)throw new Error("attestor client not initialized");return(await T.rpc("fetchCertificateBytes",{url:t})).bytes}async function W(){let t=0;for(const e of x){const n=F.slice(t,e.fromIndex);n.length&&await Z(n,!0);const r=F.slice(e.fromIndex,e.toIndex);await Z(r,!1),t=e.toIndex}const e=x?.[x.length-1]?.toIndex||0,n=F.slice(e);n.length&&await Z(n,!0)}async function q(){let t=S.transcript.length;await S.tls.write(F),t=S.transcript.length-t,X({type:"zk",redactedPlaintext:Ay(F,x)},t)}async function Z(t,e){e!==b&&await S.tls.updateTrafficKeys();let n=S.transcript.length;await S.write(t),n=S.transcript.length-n,X(e?{type:"complete"}:void 0,n),b=e}function X(t,e=1){const n=tt("client",e);if(n.length)for(const e of n)it(e.message,t)}function tt(t,e){const n=[];for(let r=S.transcript.length-1;r>=0;r--){const i=S.transcript[r];if(i.sender===t&&(n.push(i),n.length===e))break}return n}async function et(){await nt();const t=Date.now(),e=await async function(t,e,{onZkProgress:n,...r}){const i=[],o=await Tv(r);let s=0;await Promise.all(t.map(async({message:n,sender:r},s)=>{const a={sender:"client"===r?jE:HE,message:n.data,reveal:void 0};i.push(a);const c=e.get(n);if(c&&"plaintext"!==n.type)switch(c?.type){case"complete":a.reveal={directReveal:{key:await C.exportKey(n.encKey),iv:n.fixedIv,recordNumber:n.recordNumber}};break;case"zk":c.redactedPlaintext=K([c.redactedPlaintext,n.plaintext.slice(c.redactedPlaintext.length)]),await o.addPacketToProve(n,c,(t,e)=>a.reveal={zkReveal:{proofs:t,toprfs:e}},()=>{const e=t.slice(s+1).find(t=>t.sender===r);return e?.message})}}));const a=o.getTotalChunksToProve();return n?.(s,a),await o.generateProofs(()=>{s+=1,n?.(s,a)}),i}(S.transcript,D,{logger:a,cipherSuite:L,onZkProgress(e,n){const r=(Date.now()-t)/e*(n-e);i?.({name:"generating-zk-proofs",proofsDone:e,proofsTotal:n,approxTimeLeftS:Math.round(r/1e3)})},...h});return e}async function nt(){const t=S.transcript;let r="all";const i=[],o=[];for(const e of t){if("ciphertext"!==e.message.type||!ty(e.message,_))continue;const t="TLS1_3"===_?e.message.plaintext.slice(0,-1):e.message.plaintext;i.push({message:t,sender:e.sender}),"server"===e.sender&&o.push({plaintext:t,message:e.message})}d.getResponseRedactions&&(r=await async function(t,e,n){const r=t.map(t=>({block:t,redactedPlaintext:new Uint8Array(t.plaintext)})),i=K(t.map(t=>t.plaintext)),o=e(i);if(!o.length)return"all";let s=0,a=0,c=0;for(const t of o)await l(t);return r.filter(t=>!gy(t.redactedPlaintext));async function l(t){for(;c<t.fromIndex;)u();if(t.hash){const e=i.slice(t.fromIndex,t.toIndex),{nullifier:o,responses:l,mask:h}=await n(e),d={nullifier:o,responses:l,dataLocation:{fromIndex:a,length:t.toIndex-t.fromIndex},mask:h,plaintext:e},p=s,f=r[s];f.toprfs||=[],f.toprfs.push(d);const g=Ey(o,d.dataLocation.length);let A=0,E=0;for(;c<t.toIndex;)s!==p&&(E+=1),r[s].redactedPlaintext[a]=g.charCodeAt(A),u(),A+=1;E&&(r[s].overshotToprfFromPrevBlock={length:E})}for(;c<t.toIndex;)r[s].redactedPlaintext[a]=fy,u()}function u(){c+=1,a+=1,a>=t[s].plaintext.length&&(s+=1,a=0)}}(o,t=>d.getResponseRedactions({response:t,params:e,logger:a,ctx:Cw}),rt));const s=i.filter(t=>"client"===t.sender);if("all"===r){for(const{message:e,sender:n}of t)"server"===n&&it(e,{type:"complete"});s.push(...i.filter(t=>"server"===t.sender))}else for(const{block:t,redactedPlaintext:n,overshotToprfFromPrevBlock:i,toprfs:o}of r)if(it(t.message,{type:"zk",redactedPlaintext:n,toprfs:o,overshotToprfFromPrevBlock:i}),s.push({sender:"server",message:n}),u&&o){let t=Qv(e);for(const e of o){const n=Hw(e.plaintext),r=Ey(e.nullifier,e.dataLocation.length);t=t.replaceAll(n,r)}e=JSON.parse(t)}await d.assertValidProviderReceipt({receipt:s,params:{...e,secretParams:n},logger:a,ctx:Cw});for(const e of t)if("ciphertext"===e.message.type){if(ty(e.message,_))break;it(e.message,{type:"complete"})}}async function rt(t){a.info({length:t.length},"generating OPRF...");const e=h.oprfOperators?.chacha20||_v("chacha20",m,a),n=await e.generateOPRFRequestData(t,bw,a),r=await T.rpc("toprf",{maskedData:n.maskedData,engine:Lv(m)});return{nullifier:await e.finaliseOPRF(T.initResponse.toprfPublicKey,n,[r]),responses:[r],mask:n.mask,dataLocation:void 0,plaintext:t}}function it(t,e){e?D.set(t,e):D.delete(t)}function ot(){const{getAddress:t,getPublicKey:e}=O;return t(e(o))}}({...n,logger:t?r.child({attempt:t}):r}),{maxRetries:e,logger:r,shouldRetry:Nk})}function Nk(t){return!(t instanceof TypeError)&&(!!t?.message?.includes("stream ended before")||t instanceof Iv&&"ERROR_INVALID_CLAIM"!==t.code&&"ERROR_BAD_REQUEST"!==t.code&&"ERROR_AUTHENTICATION_FAILED"!==t.code&&"ERROR_TOPRF_OUT_OF_BOUNDS"!==t.code)}var Sk=window.WebSocket;window.WebSocket;var _k=s(7770),Lk=s(3859);function xk(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return Rk(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(Rk(e={},r,function(){return this}),e),h=l.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Rk(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return c.prototype=l,Rk(h,"constructor",l),Rk(l,"constructor",c),c.displayName="GeneratorFunction",Rk(l,i,"GeneratorFunction"),Rk(h),Rk(h,i,"Generator"),Rk(h,r,function(){return this}),Rk(h,"toString",function(){return"[object Generator]"}),(xk=function(){return{w:o,m:d}})()}function Rk(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Rk=function(t,e,n,r){function o(e,n){Rk(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Rk(t,e,n,r)}function Fk(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function kk(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){Fk(o,r,i,s,a,"next",t)}function a(t){Fk(o,r,i,s,a,"throw",t)}s(void 0)})}}var Ok,Qk=function(){var t=kk(xk().m(function t(e,n,r,i){var o,s,a,c;return xk().w(function(t){for(;;)switch(t.p=t.n){case 0:return o=(0,_k.y8)({sessionId:e||"unknown",providerId:r||"unknown",appId:i||"unknown",source:"reclaim-extension-sdk",type:Lk.LOG_TYPES.FETCH_DATA}),t.p=1,t.n=2,fetch("".concat(Yf()),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,status:n})});case 2:if((s=t.v).ok){t.n=3;break}throw new Error("Failed to update session status");case 3:return o.info({message:"Successfully updated session status: "+n,logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.FETCH_DATA}),t.n=4,s.json();case 4:return a=t.v,t.a(2,a);case 5:throw t.p=5,c=t.v,o.error({message:"Error updating session status: "+c.toString(),logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.FETCH_DATA,eventType:Lk.EVENT_TYPES.UPDATE_SESSION_STATUS_ERROR}),c;case 6:return t.a(2)}},t,null,[[1,5]])}));return function(e,n,r,i){return t.apply(this,arguments)}}();function Uk(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return Pk(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(Pk(e={},r,function(){return this}),e),h=l.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Pk(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return c.prototype=l,Pk(h,"constructor",l),Pk(l,"constructor",c),c.displayName="GeneratorFunction",Pk(l,i,"GeneratorFunction"),Pk(h),Pk(h,i,"Generator"),Pk(h,r,function(){return this}),Pk(h,"toString",function(){return"[object Generator]"}),(Uk=function(){return{w:o,m:d}})()}function Pk(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Pk=function(t,e,n,r){function o(e,n){Pk(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Pk(t,e,n,r)}function Gk(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function Vk(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){Gk(o,r,i,s,a,"next",t)}function a(t){Gk(o,r,i,s,a,"throw",t)}s(void 0)})}}function jk(t){return jk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jk(t)}function Hk(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Yk(r.key),r)}}function Yk(t){var e=function(t,e){if("object"!=jk(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=jk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==jk(e)?e:e+""}Ok=Pf,Object.assign(C,Ok);var zk=(0,_k.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk",type:Lk.LOG_TYPES.OFFSCREEN});"undefined"==typeof WebAssembly&&a.w9.error(a.Ey.OFFSCREEN,"WebAssembly is not available in this browser context"),void 0!==s.g&&(s.g.WASM_PATH=chrome.runtime.getURL(""));var Jk=document.createElement("meta");Jk.httpEquiv="Cross-Origin-Embedder-Policy",Jk.content="require-corp",document.head.appendChild(Jk);var Wk=document.createElement("meta");Wk.httpEquiv="Cross-Origin-Opener-Policy",Wk.content="same-origin",document.head.appendChild(Wk),window.WebSocket=Sk;var qk=function(){return function(t,e,n){return e&&Hk(t.prototype,e),n&&Hk(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.init()},[{key:"init",value:function(){zk.info({message:"[OFFSCREEN] Offscreen ready",logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.OFFSCREEN}),chrome.runtime.onMessage.addListener(this.handleMessage.bind(this));try{var t=s(3859).LOG_CONFIG_STORAGE_KEY;chrome.storage.local.get([t],function(e){var n=null==e?void 0:e[t];n&&"object"===jk(n)&&_k.Ow.setConfig(n)}),chrome.storage.onChanged.addListener(function(e,n){if("local"===n&&e[t]){var r=e[t].newValue||{};_k.Ow.setConfig(r)}})}catch(t){}this.sendReadySignal()}},{key:"sendReadySignal",value:function(){chrome.runtime.sendMessage({action:tg,source:Kf,target:qf})}},{key:"handleMessage",value:function(t,e,n){var r=this,i=t.action,o=t.source,s=t.target,a=t.data,c=t.sessionId,l=t.providerId;if(c&&l&&"unknown"!==c&&"unknown"!==l&&zk.setContext({sessionId:c,providerId:l,type:Lk.LOG_TYPES.OFFSCREEN}),s===Kf){switch(i){case ng:this.sendReadySignal(),n({success:!0});break;case Zf:Vk(Uk().m(function t(){var e,n,i,o;return Uk().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,zk.info({message:"[OFFSCREEN] Generating proof",logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_STARTED}),t.n=1,r.generateProof(a,zk);case 1:if(n=t.v,!(i=(null==n||null===(e=n.error)||void 0===e?void 0:e.message)||("string"==typeof(null==n?void 0:n.error)?n.error:null))){t.n=2;break}return zk.error({message:"[OFFSCREEN] Proof contains embedded error:",logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_FAILED}),chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!1,error:i}),t.a(2);case 2:chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!0,proof:n}),t.n=4;break;case 3:t.p=3,o=t.v,zk.error({message:"[OFFSCREEN] Error generating proof: "+o.message,logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_FAILED}),chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!1,error:o.message||"Unknown error in proof generation"});case 4:return t.a(2)}},t,null,[[0,3]])}))(),n({received:!0});break;case Xf:try{var u=window.crypto.getRandomValues(new Uint8Array(32)),h="0x"+Array.from(u).map(function(t){return t.toString(16).padStart(2,"0")}).join("");chrome.runtime.sendMessage({action:$f,source:Kf,target:o,success:!0,privateKey:h}),zk.info({message:"[OFFSCREEN] Private key generated",logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.OFFSCREEN}),n({success:!0,received:!0})}catch(t){chrome.runtime.sendMessage({action:$f,source:Kf,target:o,success:!1,error:t.message||"Unknown error generating private key"}),zk.error({message:"[OFFSCREEN] Error generating private key: "+t.message,logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.OFFSCREEN}),n({success:!1,error:t.message})}break;default:zk.error({message:"[OFFSCREEN] Unknown action: "+i,logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.OFFSCREEN}),n({success:!1,error:"Unknown action"})}return!0}}},{key:"generateProof",value:(t=Vk(Uk().m(function t(e,n){var r,i,o,s,a;return Uk().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}throw new Error("No claim data provided for proof generation");case 1:return r=e.sessionId,delete e.sessionId,t.p=2,n.info({message:"[OFFSCREEN] Updating session status to PROOF_GENERATION_STARTED",logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_STARTED}),t.n=3,Qk(r,zf);case 3:return i=new Promise(function(t,e){setTimeout(function(){e(new Error("Proof generation timed out after 2 minutes"))},12e4)}),t.n=4,Mk(e);case 4:return o=t.v,n.info({message:"[OFFSCREEN] Attestor promise created",logLevel:Lk.LOG_LEVEL.INFO,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_SUCCESS}),t.n=5,Promise.race([o,i]);case 5:return(s=t.v).publicData="string"==typeof e.publicData?e.publicData:null,n.info({message:"[OFFSCREEN] Attestor promise result: "+JSON.stringify(s),logLevel:Lk.LOG_LEVEL.ALL,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.RESULT_RECEIVED,meta:{result:s}}),t.n=6,Qk(r,Jf);case 6:return t.a(2,s);case 7:return t.p=7,a=t.v,n.error({message:"[OFFSCREEN] Error generating proof: "+(null==a?void 0:a.message)||0,logLevel:Lk.LOG_LEVEL.ERROR,type:Lk.LOG_TYPES.OFFSCREEN,eventType:Lk.EVENT_TYPES.PROOF_GENERATION_FAILED}),t.n=8,Qk(r,Wf);case 8:throw a;case 9:return t.a(2)}},t,null,[[2,7]])})),function(e,n){return t.apply(this,arguments)})}]);var t}();new qk})()})();
|
|
113
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hb=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),db=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],pb=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255,fb=db?t=>t:t=>pb(t);function gb(t){for(let e=0;e<t.length;e++)t[e]=pb(t[e])}function Ab(t){return"string"==typeof t&&(t=function(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),cb(t),t}class Eb{clone(){return this._cloneInto()}}function mb(t){const e=(e,n)=>t(n).update(Ab(e)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=e=>t(e),e}const wb=new Uint8Array([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]);class yb extends Eb{constructor(t,e,n={},r,i,o){if(super(),this.blockLen=t,this.outputLen=e,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,ab(t),ab(e),ab(r),e<0||e>r)throw new Error("outputLen bigger than keyLen");if(void 0!==n.key&&(n.key.length<1||n.key.length>r))throw new Error(`key must be up 1..${r} byte long or undefined`);if(void 0!==n.salt&&n.salt.length!==i)throw new Error(`salt must be ${i} byte long or undefined`);if(void 0!==n.personalization&&n.personalization.length!==o)throw new Error(`personalization must be ${o} byte long or undefined`);this.buffer32=hb(this.buffer=new Uint8Array(t))}update(t){lb(this);const{blockLen:e,buffer:n,buffer32:r}=this,i=(t=Ab(t)).length,o=t.byteOffset,s=t.buffer;for(let a=0;a<i;){this.pos===e&&(db||gb(r),this.compress(r,0,!1),db||gb(r),this.pos=0);const c=Math.min(e-this.pos,i-a),l=o+a;if(c===e&&!(l%4)&&a+c<i){const t=new Uint32Array(s,l,Math.floor((i-a)/4));db||gb(t);for(let n=0;a+e<i;n+=r.length,a+=e)this.length+=e,this.compress(t,n,!1);db||gb(t);continue}n.set(t.subarray(a,a+c),this.pos),this.pos+=c,this.length+=c,a+=c}return this}digestInto(t){lb(this),ub(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,this.buffer.subarray(e).fill(0),db||gb(n),this.compress(n,0,!0),db||gb(n);const r=hb(t);this.get().forEach((t,e)=>r[e]=fb(t))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:r,destroyed:i,outputLen:o,pos:s}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.length=n,t.finished=r,t.destroyed=i,t.outputLen=o,t.buffer.set(e),t.pos=s,t}}const Bb=BigInt(2**32-1),Ib=BigInt(32);function Cb(t,e=!1){return e?{h:Number(t&Bb),l:Number(t>>Ib&Bb)}:{h:0|Number(t>>Ib&Bb),l:0|Number(t&Bb)}}function Tb(t,e=!1){let n=new Uint32Array(t.length),r=new Uint32Array(t.length);for(let i=0;i<t.length;i++){const{h:o,l:s}=Cb(t[i],e);[n[i],r[i]]=[o,s]}return[n,r]}const bb=(t,e,n)=>t<<n|e>>>32-n,Db=(t,e,n)=>e<<n|t>>>32-n,vb=(t,e,n)=>e<<n-32|t>>>64-n,Mb=(t,e,n)=>t<<n-32|e>>>64-n;var Nb={fromBig:Cb,split:Tb,toBig:(t,e)=>BigInt(t>>>0)<<Ib|BigInt(e>>>0),shrSH:(t,e,n)=>t>>>n,shrSL:(t,e,n)=>t<<32-n|e>>>n,rotrSH:(t,e,n)=>t>>>n|e<<32-n,rotrSL:(t,e,n)=>t<<32-n|e>>>n,rotrBH:(t,e,n)=>t<<64-n|e>>>n-32,rotrBL:(t,e,n)=>t>>>n-32|e<<64-n,rotr32H:(t,e)=>e,rotr32L:(t,e)=>t,rotlSH:bb,rotlSL:Db,rotlBH:vb,rotlBL:Mb,add:function(t,e,n,r){const i=(e>>>0)+(r>>>0);return{h:t+n+(i/2**32|0)|0,l:0|i}},add3L:(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),add3H:(t,e,n,r)=>e+n+r+(t/2**32|0)|0,add4L:(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),add4H:(t,e,n,r,i)=>e+n+r+i+(t/2**32|0)|0,add5H:(t,e,n,r,i,o)=>e+n+r+i+o+(t/2**32|0)|0,add5L:(t,e,n,r,i)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(i>>>0)};const Sb=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),_b=new Uint32Array(32);function Lb(t,e,n,r,i,o){const s=i[o],a=i[o+1];let c=_b[2*t],l=_b[2*t+1],u=_b[2*e],h=_b[2*e+1],d=_b[2*n],p=_b[2*n+1],f=_b[2*r],g=_b[2*r+1],A=Nb.add3L(c,u,s);l=Nb.add3H(A,l,h,a),c=0|A,({Dh:g,Dl:f}={Dh:g^l,Dl:f^c}),({Dh:g,Dl:f}={Dh:Nb.rotr32H(g,f),Dl:Nb.rotr32L(g,f)}),({h:p,l:d}=Nb.add(p,d,g,f)),({Bh:h,Bl:u}={Bh:h^p,Bl:u^d}),({Bh:h,Bl:u}={Bh:Nb.rotrSH(h,u,24),Bl:Nb.rotrSL(h,u,24)}),_b[2*t]=c,_b[2*t+1]=l,_b[2*e]=u,_b[2*e+1]=h,_b[2*n]=d,_b[2*n+1]=p,_b[2*r]=f,_b[2*r+1]=g}function xb(t,e,n,r,i,o){const s=i[o],a=i[o+1];let c=_b[2*t],l=_b[2*t+1],u=_b[2*e],h=_b[2*e+1],d=_b[2*n],p=_b[2*n+1],f=_b[2*r],g=_b[2*r+1],A=Nb.add3L(c,u,s);l=Nb.add3H(A,l,h,a),c=0|A,({Dh:g,Dl:f}={Dh:g^l,Dl:f^c}),({Dh:g,Dl:f}={Dh:Nb.rotrSH(g,f,16),Dl:Nb.rotrSL(g,f,16)}),({h:p,l:d}=Nb.add(p,d,g,f)),({Bh:h,Bl:u}={Bh:h^p,Bl:u^d}),({Bh:h,Bl:u}={Bh:Nb.rotrBH(h,u,63),Bl:Nb.rotrBL(h,u,63)}),_b[2*t]=c,_b[2*t+1]=l,_b[2*e]=u,_b[2*e+1]=h,_b[2*n]=d,_b[2*n+1]=p,_b[2*r]=f,_b[2*r+1]=g}class Rb extends yb{constructor(t={}){super(128,void 0===t.dkLen?64:t.dkLen,t,64,16,16),this.v0l=0|Sb[0],this.v0h=0|Sb[1],this.v1l=0|Sb[2],this.v1h=0|Sb[3],this.v2l=0|Sb[4],this.v2h=0|Sb[5],this.v3l=0|Sb[6],this.v3h=0|Sb[7],this.v4l=0|Sb[8],this.v4h=0|Sb[9],this.v5l=0|Sb[10],this.v5h=0|Sb[11],this.v6l=0|Sb[12],this.v6h=0|Sb[13],this.v7l=0|Sb[14],this.v7h=0|Sb[15];const e=t.key?t.key.length:0;if(this.v0l^=this.outputLen|e<<8|65536|1<<24,t.salt){const e=hb(Ab(t.salt));this.v4l^=fb(e[0]),this.v4h^=fb(e[1]),this.v5l^=fb(e[2]),this.v5h^=fb(e[3])}if(t.personalization){const e=hb(Ab(t.personalization));this.v6l^=fb(e[0]),this.v6h^=fb(e[1]),this.v7l^=fb(e[2]),this.v7h^=fb(e[3])}if(t.key){const e=new Uint8Array(this.blockLen);e.set(Ab(t.key)),this.update(e)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:r,v2l:i,v2h:o,v3l:s,v3h:a,v4l:c,v4h:l,v5l:u,v5h:h,v6l:d,v6h:p,v7l:f,v7h:g}=this;return[t,e,n,r,i,o,s,a,c,l,u,h,d,p,f,g]}set(t,e,n,r,i,o,s,a,c,l,u,h,d,p,f,g){this.v0l=0|t,this.v0h=0|e,this.v1l=0|n,this.v1h=0|r,this.v2l=0|i,this.v2h=0|o,this.v3l=0|s,this.v3h=0|a,this.v4l=0|c,this.v4h=0|l,this.v5l=0|u,this.v5h=0|h,this.v6l=0|d,this.v6h=0|p,this.v7l=0|f,this.v7h=0|g}compress(t,e,n){this.get().forEach((t,e)=>_b[e]=t),_b.set(Sb,16);let{h:r,l:i}=Nb.fromBig(BigInt(this.length));_b[24]=Sb[8]^i,_b[25]=Sb[9]^r,n&&(_b[28]=~_b[28],_b[29]=~_b[29]);let o=0;const s=wb;for(let n=0;n<12;n++)Lb(0,4,8,12,t,e+2*s[o++]),xb(0,4,8,12,t,e+2*s[o++]),Lb(1,5,9,13,t,e+2*s[o++]),xb(1,5,9,13,t,e+2*s[o++]),Lb(2,6,10,14,t,e+2*s[o++]),xb(2,6,10,14,t,e+2*s[o++]),Lb(3,7,11,15,t,e+2*s[o++]),xb(3,7,11,15,t,e+2*s[o++]),Lb(0,5,10,15,t,e+2*s[o++]),xb(0,5,10,15,t,e+2*s[o++]),Lb(1,6,11,12,t,e+2*s[o++]),xb(1,6,11,12,t,e+2*s[o++]),Lb(2,7,8,13,t,e+2*s[o++]),xb(2,7,8,13,t,e+2*s[o++]),Lb(3,4,9,14,t,e+2*s[o++]),xb(3,4,9,14,t,e+2*s[o++]);this.v0l^=_b[0]^_b[16],this.v0h^=_b[1]^_b[17],this.v1l^=_b[2]^_b[18],this.v1h^=_b[3]^_b[19],this.v2l^=_b[4]^_b[20],this.v2h^=_b[5]^_b[21],this.v3l^=_b[6]^_b[22],this.v3h^=_b[7]^_b[23],this.v4l^=_b[8]^_b[24],this.v4h^=_b[9]^_b[25],this.v5l^=_b[10]^_b[26],this.v5h^=_b[11]^_b[27],this.v6l^=_b[12]^_b[28],this.v6h^=_b[13]^_b[29],this.v7l^=_b[14]^_b[30],this.v7h^=_b[15]^_b[31],_b.fill(0)}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Fb=mb(t=>new Rb(t));function kb(t){return(4294901760&t?(t&=4294901760,16):0)|(4278255360&t?(t&=4278255360,8):0)|(4042322160&t?(t&=4042322160,4):0)|(3435973836&t?(t&=3435973836,2):0)|!!(2863311530&t)}function Ob(t,e){const n=new DataView(t.buffer,t.byteOffset,t.byteLength);let r="";for(let t=0;t<4;t++){t>0&&(r+="\n"),r+="\t\t";for(let e=0;e<4;e++)e>0&&(r+=" "),r+=n.getUint32(16*t+4*e).toString(16).padStart(8,"0")}return e&&(r=e+"\n"+r),r}function Qb(t,e){if(t.byteLength!=e.byteLength)return!1;for(var n=new Int8Array(t),r=new Int8Array(e),i=0;i!=t.byteLength;i++)if(n[i]!=r[i])return!1;return!0}function Ub(t){return t.clone()}async function Pb(t,e,n,r,i){if(t.G1.isZero(e))return!1;if(t.G1.isZero(n))return!1;if(t.G2.isZero(r))return!1;if(t.G2.isZero(i))return!1;return await t.pairingEq(e,i,t.G1.neg(n),r)}function Gb(){return window.prompt("Enter a random text. (Entropy): ","")}function Vb(t){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),e}async function jb(t){{const e=await globalThis.crypto.subtle.digest("SHA-256",t.buffer);return new Uint8Array(e)}}function Hb(t,e){return new DataView(t.buffer).getUint32(e,!1)}async function Yb(t){for(;!t;)t=await Gb();const e=Fb.create(64);e.update(Vb(64));const n=new TextEncoder;e.update(n.encode(t));const r=e.digest(),i=[];for(let t=0;t<8;t++)i[t]=Hb(r,4*t);return new ZB(i)}async function zb(t,e){let n,r;e<32?(n=1<<e>>>0,r=1):(n=4294967296,r=1<<e-32>>>0);let i=t;for(let t=0;t<r;t++)for(let t=0;t<n;t++)i=await jb(i);const o=new DataView(i.buffer,i.byteOffset,i.byteLength),s=[];for(let t=0;t<8;t++)s[t]=o.getUint32(4*t,!1);return new ZB(s)}function Jb(t){return t instanceof Uint8Array?t:("0x"==t.slice(0,2)&&(t=t.slice(2)),new Uint8Array(t.match(/[\da-f]{2}/gi).map(function(t){return parseInt(t,16)})))}function Wb(t){return Array.prototype.map.call(t,function(t){return("0"+(255&t).toString(16)).slice(-2)}).join("")}const qb=10;async function Kb(t,e){await YT(t,1),await t.writeULE32(1),await zT(t);const n=await ob(e.q);await YT(t,2);const r=n.q,i=8*(Math.floor((bT.bitLength(r)-1)/64)+1),o=n.r,s=8*(Math.floor((bT.bitLength(o)-1)/64)+1);await t.writeULE32(i),await qT(t,r,i),await t.writeULE32(s),await qT(t,o,s),await t.writeULE32(e.nVars),await t.writeULE32(e.nPublic),await t.writeULE32(e.domainSize),await Zb(t,n,e.vk_alpha_1),await Zb(t,n,e.vk_beta_1),await Xb(t,n,e.vk_beta_2),await Xb(t,n,e.vk_gamma_2),await Zb(t,n,e.vk_delta_1),await Xb(t,n,e.vk_delta_2),await zT(t)}async function Zb(t,e,n){const r=new Uint8Array(2*e.G1.F.n8);e.G1.toRprLEM(r,0,n),await t.write(r)}async function Xb(t,e,n){const r=new Uint8Array(2*e.G2.F.n8);e.G2.toRprLEM(r,0,n),await t.write(r)}async function $b(t,e,n){const r=await t.read(2*e.G1.F.n8),i=e.G1.fromRprLEM(r,0);return n?e.G1.toObject(i):i}async function tD(t,e,n){const r=await t.read(2*e.G2.F.n8),i=e.G2.fromRprLEM(r,0);return n?e.G2.toObject(i):i}async function eD(t,e,n,r){await JT(t,e,1);const i=await t.readULE32();if(await WT(t),1===i)return await async function(t,e,n,r){const i={protocol:"groth16"};await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.curve=await ob(i.q,r),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.vk_alpha_1=await $b(t,i.curve,n),i.vk_beta_1=await $b(t,i.curve,n),i.vk_beta_2=await tD(t,i.curve,n),i.vk_gamma_2=await tD(t,i.curve,n),i.vk_delta_1=await $b(t,i.curve,n),i.vk_delta_2=await tD(t,i.curve,n),await WT(t),i}(t,e,n,r);if(2===i)return await async function(t,e,n,r){const i={protocol:"plonk"};await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.curve=await ob(i.q,r),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.nAdditions=await t.readULE32(),i.nConstraints=await t.readULE32(),i.k1=await t.read(s),i.k2=await t.read(s),i.Qm=await $b(t,i.curve,n),i.Ql=await $b(t,i.curve,n),i.Qr=await $b(t,i.curve,n),i.Qo=await $b(t,i.curve,n),i.Qc=await $b(t,i.curve,n),i.S1=await $b(t,i.curve,n),i.S2=await $b(t,i.curve,n),i.S3=await $b(t,i.curve,n),i.X_2=await tD(t,i.curve,n),await WT(t),i}(t,e,n,r);if(10===i)return await async function(t,e,n,r){const i={protocol:"fflonk"};i.protocolId=qb,await JT(t,e,2);const o=await t.readULE32();i.n8q=o,i.q=await KT(t,o),i.curve=await ob(i.q,r);const s=await t.readULE32();return i.n8r=s,i.r=await KT(t,s),i.nVars=await t.readULE32(),i.nPublic=await t.readULE32(),i.domainSize=await t.readULE32(),i.power=kb(i.domainSize),i.nAdditions=await t.readULE32(),i.nConstraints=await t.readULE32(),i.k1=await t.read(s),i.k2=await t.read(s),i.w3=await t.read(s),i.w4=await t.read(s),i.w8=await t.read(s),i.wr=await t.read(s),i.X_2=await tD(t,i.curve,n),i.C0=await $b(t,i.curve,n),await WT(t),i}(t,e,n,r);throw new Error("Protocol not supported: ")}async function nD(t,e,n){const r={delta:{}};r.deltaAfter=await $b(t,e,n),r.delta.g1_s=await $b(t,e,n),r.delta.g1_sx=await $b(t,e,n),r.delta.g2_spx=await tD(t,e,n),r.transcript=await t.read(64),r.type=await t.readULE32();const i=await t.readULE32(),o=t.pos;let s=0;for(;t.pos-o<i;){const e=await t.read(1);if(e[0]<=s)throw new Error("Parameters in the contribution must be sorted");if(s=e[0],1==e[0]){const e=await t.read(1),n=await t.read(e[0]);r.name=(new TextDecoder).decode(n)}else if(2==e[0]){const e=await t.read(1);r.numIterationsExp=e[0]}else{if(3!=e[0])throw new Error("Parameter not recognized");{const e=await t.read(1);r.beaconHash=await t.read(e[0])}}}if(t.pos!=o+i)throw new Error("Parameters do not match");return r}async function rD(t,e,n){await JT(t,n,10);const r={contributions:[]};r.csHash=await t.read(64);const i=await t.readULE32();for(let n=0;n<i;n++){const n=await nD(t,e);r.contributions.push(n)}return await WT(t),r}async function iD(t,e,n){await Zb(t,e,n.deltaAfter),await Zb(t,e,n.delta.g1_s),await Zb(t,e,n.delta.g1_sx),await Xb(t,e,n.delta.g2_spx),await t.write(n.transcript),await t.writeULE32(n.type||0);const r=[];if(n.name){r.push(1);const t=new TextEncoder("utf-8").encode(n.name.substring(0,64));r.push(t.byteLength);for(let e=0;e<t.byteLength;e++)r.push(t[e])}if(1==n.type){r.push(2),r.push(n.numIterationsExp),r.push(3),r.push(n.beaconHash.byteLength);for(let t=0;t<n.beaconHash.byteLength;t++)r.push(n.beaconHash[t])}if(r.length>0){const e=new Uint8Array(r);await t.writeULE32(e.byteLength),await t.write(e)}else await t.writeULE32(0)}async function oD(t,e,n){await YT(t,10),await t.write(n.csHash),await t.writeULE32(n.contributions.length);for(let r=0;r<n.contributions.length;r++)await iD(t,e,n.contributions[r]);await zT(t)}function sD(t,e,n){const r=new Uint8Array(2*e.G1.F.n8);e.G1.toRprUncompressed(r,0,n),t.update(r)}function aD(t,e,n){sD(t,e,n.deltaAfter),sD(t,e,n.delta.g1_s),sD(t,e,n.delta.g1_sx),function(t,e,n){const r=new Uint8Array(2*e.G2.F.n8);e.G2.toRprUncompressed(r,0,n),t.update(r)}(t,e,n.delta.g2_spx),t.update(n.transcript)}async function cD(t,e){await JT(t,e,1);const n=await t.readULE32(),r=await KT(t,n),i=await t.readULE32();return await WT(t),{n8:n,q:r,nWitness:i}}const{stringifyBigInts:lD}=DT;async function uD(t,e,n,r){const{fd:i,sections:o}=await jT(e,"wtns",2),s=await cD(i,o),{fd:a,sections:c}=await jT(t,"zkey",2),l=await eD(a,c,void 0,r);if("groth16"!=l.protocol)throw new Error("zkey file is not groth16");if(!bT.eq(l.r,s.q))throw new Error("Curve of the witness does not match the curve of the proving key");if(s.nWitness!=l.nVars)throw new Error(`Invalid witness length. Circuit: ${l.nVars}, witness: ${s.nWitness}`);const u=l.curve,h=u.Fr,d=u.G1,p=u.G2,f=kb(l.domainSize);n&&n.debug("Reading Wtns");const g=await XT(i,o,2);n&&n.debug("Reading Coeffs");const A=await XT(a,c,4);n&&n.debug("Building ABC");const[E,m,w]=await async function(t,e,n,r,i){const o=t.Fr.n8,s=12+e.n8r,a=(r.byteLength-4)/s,c=new HC(e.domainSize*o),l=new HC(e.domainSize*o),u=new HC(e.domainSize*o),h=[c,l];for(let e=0;e<a;e++){i&&e%1e6==0&&i.debug(`QAP AB: ${e}/${a}`);const c=r.slice(4+e*s,4+e*s+s),l=new DataView(c.buffer),u=l.getUint32(0,!0),d=l.getUint32(4,!0),p=l.getUint32(8,!0),f=c.slice(12,12+o);h[u].set(t.Fr.add(h[u].slice(d*o,d*o+o),t.Fr.mul(f,n.slice(p*o,p*o+o))),d*o)}for(let n=0;n<e.domainSize;n++)i&&n%1e6==0&&i.debug(`QAP C: ${n}/${e.domainSize}`),u.set(t.Fr.mul(c.slice(n*o,n*o+o),l.slice(n*o,n*o+o)),n*o);return[c,l,u]}(u,l,g,A,n),y=f==h.s?u.Fr.shift:u.Fr.w[f+1],B=await h.ifft(E,"","",n,"IFFT_A"),I=await h.batchApplyKey(B,h.e(1),y),C=await h.fft(I,"","",n,"FFT_A"),T=await h.ifft(m,"","",n,"IFFT_B"),b=await h.batchApplyKey(T,h.e(1),y),D=await h.fft(b,"","",n,"FFT_B"),v=await h.ifft(w,"","",n,"IFFT_C"),M=await h.batchApplyKey(v,h.e(1),y),N=await h.fft(M,"","",n,"FFT_C");n&&n.debug("Join ABC");const S=await async function(t,e,n,r,i,o){const s=1<<22,a=t.Fr.n8,c=Math.floor(n.byteLength/t.Fr.n8),l=[];for(let e=0;e<c;e+=s){o&&o.debug(`JoinABC: ${e}/${c}`);const u=Math.min(c-e,s),h=[],d=n.slice(e*a,(e+u)*a),p=r.slice(e*a,(e+u)*a),f=i.slice(e*a,(e+u)*a);h.push({cmd:"ALLOCSET",var:0,buff:d}),h.push({cmd:"ALLOCSET",var:1,buff:p}),h.push({cmd:"ALLOCSET",var:2,buff:f}),h.push({cmd:"ALLOC",var:3,len:u*a}),h.push({cmd:"CALL",fnName:"qap_joinABC",params:[{var:0},{var:1},{var:2},{val:u},{var:3}]}),h.push({cmd:"CALL",fnName:"frm_batchFromMontgomery",params:[{var:3},{val:u},{var:3}]}),h.push({cmd:"GET",out:0,var:3,len:u*a}),l.push(t.tm.queueAction(h))}const u=await Promise.all(l);let h;h=n instanceof HC?new HC(n.byteLength):new Uint8Array(n.byteLength);let d=0;for(let t=0;t<u.length;t++)h.set(u[t][0],d),d+=u[t][0].byteLength;return h}(u,0,C,D,N,n);let _={};n&&n.debug("Reading A Points");const L=await XT(a,c,5);_.pi_a=await u.G1.multiExpAffine(L,g,n,"multiexp A"),n&&n.debug("Reading B1 Points");const x=await XT(a,c,6);let R=await u.G1.multiExpAffine(x,g,n,"multiexp B1");n&&n.debug("Reading B2 Points");const F=await XT(a,c,7);_.pi_b=await u.G2.multiExpAffine(F,g,n,"multiexp B2"),n&&n.debug("Reading C Points");const k=await XT(a,c,8);_.pi_c=await u.G1.multiExpAffine(k,g.slice((l.nPublic+1)*u.Fr.n8),n,"multiexp C"),n&&n.debug("Reading H Points");const O=await XT(a,c,9),Q=await u.G1.multiExpAffine(O,S,n,"multiexp H"),U=u.Fr.random(),P=u.Fr.random();_.pi_a=d.add(_.pi_a,l.vk_alpha_1),_.pi_a=d.add(_.pi_a,d.timesFr(l.vk_delta_1,U)),_.pi_b=p.add(_.pi_b,l.vk_beta_2),_.pi_b=p.add(_.pi_b,p.timesFr(l.vk_delta_2,P)),R=d.add(R,l.vk_beta_1),R=d.add(R,d.timesFr(l.vk_delta_1,P)),_.pi_c=d.add(_.pi_c,Q),_.pi_c=d.add(_.pi_c,d.timesFr(_.pi_a,P)),_.pi_c=d.add(_.pi_c,d.timesFr(R,U)),_.pi_c=d.add(_.pi_c,d.timesFr(l.vk_delta_1,h.neg(h.mul(U,P))));let G=[];for(let t=1;t<=l.nPublic;t++){const e=g.slice(t*h.n8,t*h.n8+h.n8);G.push(bT.fromRprLE(e))}return _.pi_a=d.toObject(d.toAffine(_.pi_a)),_.pi_b=p.toObject(p.toAffine(_.pi_b)),_.pi_c=d.toObject(d.toAffine(_.pi_c)),_.protocol="groth16",_.curve=u.name,await a.close(),await i.close(),_=lD(_),G=lD(G),{proof:_,publicSignals:G}}function hD(t){let e=[];return function t(e,n){if(Array.isArray(n))for(let r=0;r<n.length;r++)t(e,n[r]);else e.push(n)}(e,t),e}function dD(t,e){let n=BigInt(t)%e;return n<0&&(n+=e),n}function pD(t){const e=BigInt(2)**BigInt(64);let n=BigInt("0xCBF29CE484222325");for(let r=0;r<t.length;r++)n^=BigInt(t[r].charCodeAt(0)),n*=BigInt(1099511628211),n%=e;let r=n.toString(16),i=16-r.length;return r="0".repeat(i).concat(r),r}function fD(t,e){const n=[];let r=BigInt(t);const i=BigInt(4294967296);for(;r;)n.unshift(Number(r%i)),r/=i;if(e){let t=e-n.length;for(;t>0;)n.unshift(0),t--}return n}async function gD(t,e){let n,r,i;e=e||{};let o=1,s=0,a=0,c=!1;if(t instanceof WebAssembly.Instance)n=t,c=!0;else{let c=32767;if(e.memorySize&&(c=parseInt(e.memorySize),c<0))throw new Error("Invalid memory size");let l=!1;for(;!l;)try{i=new WebAssembly.Memory({initial:c}),l=!0}catch(t){if(c<=1)throw t;console.warn("Could not allocate "+1024*c*64+" bytes. This may cause severe instability. Trying with "+1024*c*64/2+" bytes"),c=Math.floor(c/2)}const d=await WebAssembly.compile(t);let p="",f="";n=await WebAssembly.instantiate(d,{env:{memory:i},runtime:{printDebug:function(t){console.log("printDebug:",t)},exceptionHandler:function(t){let e;throw e=1===t?"Signal not found. ":2===t?"Too many signals set. ":3===t?"Signal already set. ":4===t?"Assert Failed. ":5===t?"Not enough memory. ":6===t?"Input signal array access exceeds the size. ":"Unknown error. ",console.error("ERROR: ",t,p),new Error(e+p)},printErrorMessage:function(){p+=u()+"\n"},writeBufferMessage:function(){const t=u();"\n"===t?(console.log(f),f=""):(""!==f&&(f+=" "),f+=t)},showSharedRWMemory:function(){const t=n.exports.getFieldNumLen32(),e=new Uint32Array(t);for(let r=0;r<t;r++)e[t-1-r]=n.exports.readSharedRWMemory(r);if(o>=2&&(s>=1||a>=7)){""!==f&&(f+=" ");const t=bT.fromArray(e,4294967296).toString();f+=t}else console.log(bT.fromArray(e,4294967296))},error:function(t,n,i,o,s,a){let c;throw c=7===t?h(n)+" "+r.getFr(o).toString()+" != "+r.getFr(s).toString()+" "+h(a):9===t?h(n)+" "+r.getFr(o).toString()+" "+h(s):5===t&&e.sym?h(n)+" "+e.sym.labelIdx2Name[s]:h(n)+" "+i+" "+o+" "+s+" "+a,console.log("ERROR: ",t,c),new Error(c)},log:function(t){console.log(r.getFr(t).toString())},logGetSignal:function(t,n){e.logGetSignal&&e.logGetSignal(t,r.getFr(n))},logSetSignal:function(t,n){e.logSetSignal&&e.logSetSignal(t,r.getFr(n))},logStartComponent:function(t){e.logStartComponent&&e.logStartComponent(t)},logFinishComponent:function(t){e.logFinishComponent&&e.logFinishComponent(t)}}})}"function"==typeof n.exports.getVersion&&(o=n.exports.getVersion()),"function"==typeof n.exports.getMinorVersion&&(s=n.exports.getMinorVersion()),"function"==typeof n.exports.getPatchVersion&&(a=n.exports.getPatchVersion());const l=e&&(e.sanityCheck||e.logGetSignal||e.logSetSignal||e.logStartComponent||e.logFinishComponent);if(2===o)r=new ED(n,l);else{if(1!==o)throw new Error(`Unsupported circom version: ${o}`);if(c)throw new Error("Loading code from WebAssembly instance is not supported for circom version 1");r=new AD(i,n,l)}return r;function u(){let t="",e=n.exports.getMessageChar();for(;0!==e;)t+=String.fromCharCode(e),e=n.exports.getMessageChar();return t}function h(t){const e=new Uint8Array(i.buffer),n=[];for(let r=0;e[t+r]>0;r++)n.push(e[t+r]);return String.fromCharCode.apply(null,n)}}class AD{constructor(t,e,n){this.memory=t,this.i32=new Uint32Array(t.buffer),this.instance=e,this.n32=(this.instance.exports.getFrLen()>>2)-2;const r=this.instance.exports.getPRawPrime(),i=new Array(this.n32);for(let t=0;t<this.n32;t++)i[this.n32-1-t]=this.i32[(r>>2)+t];this.prime=bT.fromArray(i,4294967296),this.Fr=new iI(this.prime),this.mask32=bT.fromString("FFFFFFFF",16),this.NVars=this.instance.exports.getNVars(),this.n64=Math.floor((this.Fr.bitLength-1)/64)+1,this.R=this.Fr.e(bT.shiftLeft(1,64*this.n64)),this.RInv=this.Fr.inv(this.R),this.sanityCheck=n}circom_version(){return 1}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);const n=this.allocInt(),r=this.allocFr();Object.keys(t).forEach(e=>{const i=pD(e),o=parseInt(i.slice(0,8),16),s=parseInt(i.slice(8,16),16);try{this.instance.exports.getSignalOffset32(n,0,o,s)}catch(t){throw new Error(`Signal ${e} is not an input of the circuit.`)}const a=this.getInt(n),c=hD(t[e]);for(let t=0;t<c.length;t++)this.setFr(r,c[t]),this.instance.exports.setSignal(0,0,a+t,r)})}async calculateWitness(t,e){const n=this,r=n.i32[0],i=[];await n._doCalculateWitness(t,e);for(let t=0;t<n.NVars;t++){const e=n.instance.exports.getPWitness(t);i.push(n.getFr(e))}return n.i32[0]=r,i}async calculateBinWitness(t,e){const n=this,r=n.i32[0];await n._doCalculateWitness(t,e);const i=n.instance.exports.getWitnessBuffer();n.i32[0]=r;const o=n.memory.buffer.slice(i,i+n.NVars*n.n64*8);return new Uint8Array(o)}allocInt(){const t=this.i32[0];return this.i32[0]=t+8,t}allocFr(){const t=this.i32[0];return this.i32[0]=t+4*this.n32+8,t}getInt(t){return this.i32[t>>2]}setInt(t,e){this.i32[t>>2]=e}getFr(t){const e=this,n=t>>2;if(2147483648&e.i32[n+1]){const t=new Array(e.n32);for(let r=0;r<e.n32;r++)t[e.n32-1-r]=e.i32[n+2+r];const i=e.Fr.e(bT.fromArray(t,4294967296));return 1073741824&e.i32[n+1]?(r=i,e.Fr.mul(e.RInv,r)):i}return 2147483648&e.i32[n]?e.Fr.e(e.i32[n]-4294967296):e.Fr.e(e.i32[n]);var r}setFr(t,e){const n=this;e=n.Fr.e(e);const r=n.Fr.neg(n.Fr.e("80000000",16)),i=n.Fr.e("7FFFFFFF",16);if(n.Fr.geq(e,r)&&n.Fr.leq(e,i)){let i;return n.Fr.geq(e,n.Fr.zero)?i=bT.toNumber(e):(i=bT.toNumber(n.Fr.sub(e,r)),i-=2147483648,i=4294967296+i),n.i32[t>>2]=i,void(n.i32[1+(t>>2)]=0)}n.i32[t>>2]=0,n.i32[1+(t>>2)]=2147483648;const o=bT.toArray(e,4294967296);for(let e=0;e<n.n32;e++){const r=o.length-1-e;n.i32[2+(t>>2)+e]=r>=0?o[r]:0}}}class ED{constructor(t,e){this.instance=t,this.version=this.instance.exports.getVersion(),this.n32=this.instance.exports.getFieldNumLen32(),this.instance.exports.getRawPrime();const n=new Uint32Array(this.n32);for(let t=0;t<this.n32;t++)n[this.n32-1-t]=this.instance.exports.readSharedRWMemory(t);this.prime=bT.fromArray(n,4294967296),this.witnessSize=this.instance.exports.getWitnessSize(),this.sanityCheck=e}circom_version(){return this.instance.exports.getVersion()}async _doCalculateWitness(t,e){this.instance.exports.init(this.sanityCheck||e?1:0);const n=Object.keys(t);let r=0;if(n.forEach(e=>{const n=pD(e),i=parseInt(n.slice(0,8),16),o=parseInt(n.slice(8,16),16),s=hD(t[e]);if("function"==typeof this.instance.exports.getInputSignalSize){let t=this.instance.exports.getInputSignalSize(i,o);if(t<0)throw new Error(`Signal ${e} not found\n`);if(s.length<t)throw new Error(`Not enough values for input signal ${e}\n`);if(s.length>t)throw new Error(`Too many values for input signal ${e}\n`)}for(let t=0;t<s.length;t++){const e=fD(dD(s[t],this.prime),this.n32);for(let t=0;t<this.n32;t++)this.instance.exports.writeSharedRWMemory(t,e[this.n32-1-t]);try{this.instance.exports.setInputSignal(i,o,t),r++}catch(t){throw new Error(t)}}}),r<this.instance.exports.getInputSize())throw new Error(`Not all inputs have been set. Only ${r} out of ${this.instance.exports.getInputSize()}`)}async calculateWitness(t,e){const n=[];await this._doCalculateWitness(t,e);for(let t=0;t<this.witnessSize;t++){this.instance.exports.getWitness(t);const e=new Uint32Array(this.n32);for(let t=0;t<this.n32;t++)e[this.n32-1-t]=this.instance.exports.readSharedRWMemory(t);n.push(bT.fromArray(e,4294967296))}return n}async calculateWTNSBin(t,e){const n=new Uint32Array(this.witnessSize*this.n32+this.n32+11),r=new Uint8Array(n.buffer);await this._doCalculateWitness(t,e),r[0]="w".charCodeAt(0),r[1]="t".charCodeAt(0),r[2]="n".charCodeAt(0),r[3]="s".charCodeAt(0),n[1]=2,n[2]=2,n[3]=1;const i=4*this.n32,o=(8+i).toString(16);n[4]=parseInt(o.slice(0,8),16),n[5]=parseInt(o.slice(8,16),16),n[6]=i,this.instance.exports.getRawPrime();let s=7;for(let t=0;t<this.n32;t++)n[s+t]=this.instance.exports.readSharedRWMemory(t);s+=this.n32,n[s]=this.witnessSize,s++,n[s]=2,s++;const a=(i*this.witnessSize).toString(16);n[s]=parseInt(a.slice(0,8),16),n[s+1]=parseInt(a.slice(8,16),16),s+=2;for(let t=0;t<this.witnessSize;t++){this.instance.exports.getWitness(t);for(let t=0;t<this.n32;t++)n[s+t]=this.instance.exports.readSharedRWMemory(t);s+=this.n32}return r}}const{unstringifyBigInts:mD}=DT;async function wD(t,e,n,r){const i=mD(t),o=await VT(e),s=await o.read(o.totalSize);await o.close();const a=await gD(s,r);if(1===a.circom_version()){const t=await a.calculateBinWitness(i),e=await HT(n,"wtns",2,2);await async function(t,e,n){await YT(t,1);const r=8*(Math.floor((bT.bitLength(n)-1)/64)+1);if(await t.writeULE32(r),await qT(t,n,r),e.byteLength%r!=0)throw new Error("Invalid witness length");await t.writeULE32(e.byteLength/r),await zT(t),await YT(t,2),await t.write(e),await zT(t)}(e,t,a.prime),await e.close()}else{const t=await GT(n),e=await a.calculateWTNSBin(i);await t.write(e),await t.close()}}const{unstringifyBigInts:yD}=DT;const{unstringifyBigInts:BD}=DT;function ID(t,e){return bT.geq(e,0)&&bT.lt(e,t.r)}const{unstringifyBigInts:CD}=DT;function TD(t){let e=t.toString(16);for(;e.length<64;)e="0"+e;return e=`"0x${e}"`,e}var bD=Object.freeze({__proto__:null,fullProve:async function(t,e,n,r,i,o){const s=yD(t),a={type:"mem"};return await wD(s,e,a,i),await uD(n,a,r,o)},prove:uD,verify:async function(t,e,n,r){const i=BD(t),o=BD(n),s=BD(e),a=await sb(i.curve),c=a.G1.fromObject(i.IC[0]),l=new Uint8Array(2*a.G1.F.n8*s.length),u=new Uint8Array(a.Fr.n8*s.length);if(!function(t,e){for(let n=0;n<e.length;n++)if(!ID(t,e[n]))return!1;return!0}(a,s))return r&&r.error("Public inputs are not valid."),!1;for(let t=0;t<s.length;t++){const e=a.G1.fromObject(i.IC[t+1]);l.set(e,t*a.G1.F.n8*2),bT.toRprLE(u,a.Fr.n8*t,s[t],a.Fr.n8)}let h=await a.G1.multiExpAffine(l,u);h=a.G1.add(h,c);const d=a.G1.fromObject(o.pi_a),p=a.G2.fromObject(o.pi_b),f=a.G1.fromObject(o.pi_c);if(!function(t,e){const n=t.G1,r=t.G2;return n.isValid(e.pi_a)&&r.isValid(e.pi_b)&&n.isValid(e.pi_c)}(a,{pi_a:d,pi_b:p,pi_c:f}))return r&&r.error("Proof commitments are not valid."),!1;const g=a.G2.fromObject(i.vk_gamma_2),A=a.G2.fromObject(i.vk_delta_2),E=a.G1.fromObject(i.vk_alpha_1),m=a.G2.fromObject(i.vk_beta_2);return await a.pairingEq(a.G1.neg(d),p,h,g,f,A,E,m)?(r&&r.info("OK!"),!0):(r&&r.error("Invalid proof"),!1)},exportSolidityCallData:async function(t,e){const n=CD(t),r=CD(e);let i,o="";for(let t=0;t<r.length;t++)""!=o&&(o+=","),o+=TD(r[t]);return i=`[${TD(n.pi_a[0])}, ${TD(n.pi_a[1])}],[[${TD(n.pi_b[0][1])}, ${TD(n.pi_b[0][0])}],[${TD(n.pi_b[1][1])}, ${TD(n.pi_b[1][0])}]],[${TD(n.pi_c[0])}, ${TD(n.pi_c[1])}],[${o}]`,i}});function DD(t,e){const n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=[];for(let t=0;t<8;t++)r[t]=n.getUint32(4*t);const i=new ZB(r);return t.G2.fromRng(i)}async function vD(t,e){if(!e[1])throw new Error(t.fileName+": File has no header");if(e[1].length>1)throw new Error(t.fileName+": File has more than one header");t.pos=e[1][0].p;const n=await t.readULE32(),r=await t.read(n),i=bT.fromRprLE(r),o=await ob(i);if(8*o.F1.n64!=n)throw new Error(t.fileName+": Invalid size");const s=await t.readULE32(),a=await t.readULE32();if(t.pos-e[1][0].p!=e[1][0].size)throw new Error("Invalid PTau header size");return{curve:o,power:s,ceremonyPower:a}}async function MD(t,e,n,r,i,o,s,a,c,l){const u=i[o],h=2*u.F.n8,d=e[r][0].size/h;await JT(t,e,r),await YT(n,r);let p=s;for(let e=0;e<d;e+=65536){l&&l.debug(`Applying key: ${c}: ${e}/${d}`);const r=Math.min(d-e,65536);let o;o=await t.read(r*h),o=await u.batchApplyKey(o,p,a),await n.write(o),p=i.Fr.mul(p,i.Fr.exp(a,r))}await zT(n),await WT(t)}async function ND(t,e,n,r,i,o,s,a,c,l,u){const h=r[i],d=2*h.F.n8,p=Math.floor((1<<20)/d);let f=s;for(let i=0;i<o;i+=p){u&&u.debug(`Applying key ${l}: ${i}/${o}`);const s=Math.min(o-i,p),g=await t.read(s*d),A=await h.batchUtoLEM(g),E=await h.batchApplyKey(A,f,a);let m;m="COMPRESSED"==c?await h.batchLEMtoC(E):await h.batchLEMtoU(E),n&&n.update(m),await e.write(m),f=r.Fr.mul(f,r.Fr.exp(a,s))}}const SD=262144,_D={get:function(t,e){return isNaN(e)?t[e]:t.getElement(e)},set:function(t,e,n){return isNaN(e)?(t[e]=n,!0):t.setElement(e,n)}};class LD{constructor(t){this.length=t||0,this.arr=new Array(SD);for(let e=0;e<t;e+=SD)this.arr[e/SD]=new Array(Math.min(SD,t-e));return this}push(){for(let t=0;t<arguments.length;t++)this.setElement(this.length,arguments[t])}slice(t,e){const n=new Array(e-t);for(let r=t;r<e;r++)n[r-t]=this.getElement(r);return n}getElement(t){t=parseInt(t);const e=Math.floor(t/SD),n=t%SD;return this.arr[e]?this.arr[e][n]:void 0}setElement(t,e){t=parseInt(t);const n=Math.floor(t/SD);this.arr[n]||(this.arr[n]=new Array(SD));const r=t%SD;return this.arr[n][r]=e,t>=this.length&&(this.length=t+1),!0}getKeys(){const t=new xD;for(let e=0;e<this.arr.length;e++)if(this.arr[e])for(let n=0;n<this.arr[e].length;n++)void 0!==this.arr[e][n]&&t.push(e*SD+n);return t}}class xD{constructor(t){const e=new LD(t);return new Proxy(e,_D)}}var RD=xD;async function FD(t,e,n){let r;r="object"==typeof n?n:void 0===n?{singleThread:!1}:{singleThread:n};const i={};if(await JT(t,e,1),i.n8=await t.readULE32(),i.prime=await KT(t,i.n8),r.F){if(r.F.p!=i.prime)throw new Error("Different Prime");i.F=r.F}else if(r.getFieldFromPrime)i.F=await r.getFieldFromPrime(i.prime,r.singleThread);else if(r.getCurveFromPrime)i.curve=await r.getCurveFromPrime(i.prime,r.singleThread),i.F=i.curve.Fr;else try{i.curve=await async function(t,e,n){let r;if(LB(t,TT))r=await BT(e,n);else{if(!LB(t,CT))throw new Error(`Curve not supported: ${PB(t)}`);r=await IT(e,n)}return r}(i.prime,r.singleThread),i.F=i.curve.Fr}catch(t){i.F=new iI(i.prime)}return i.nVars=await t.readULE32(),i.nOutputs=await t.readULE32(),i.nPubInputs=await t.readULE32(),i.nPrvInputs=await t.readULE32(),i.nLabels=await t.readULE64(),i.nConstraints=await t.readULE32(),i.useCustomGates=void 0!==e[4]&&null!==e[4]&&void 0!==e[5]&&null!==e[5],await WT(t),i}async function kD(t,e,n){if("object"!=typeof n)throw new Error("readR1csFd: options must be an object");n.loadConstraints=!("loadConstraints"in n)||n.loadConstraints,n.loadMap="loadMap"in n&&n.loadMap,n.loadCustomGates=!("loadCustomGates"in n)||n.loadCustomGates;const r=await FD(t,e,n);return n.loadConstraints&&(r.constraints=await async function(t,e,n,r,i){let o;o="object"==typeof r?r:void 0===r?{}:{logger:r,loggerCtx:i};const s=await XT(t,e,2);let a,c=0;a=n.nConstraints>1<<20?new RD:[];for(let t=0;t<n.nConstraints;t++){o.logger&&t%1e5==0&&o.logger.info(`${o.loggerCtx}: Loading constraints: ${t}/${n.nConstraints}`);const e=l();a.push(e)}return a;function l(){const t=[];return t[0]=u(),t[1]=u(),t[2]=u(),t}function u(){const t={},e=s.slice(c,c+4);c+=4;const r=new DataView(e.buffer).getUint32(0,!0),i=s.slice(c,c+(4+n.n8)*r);c+=(4+n.n8)*r;const o=new DataView(i.buffer);for(let e=0;e<r;e++){const r=o.getUint32(e*(4+n.n8),!0),s=n.F.fromRprLE(i,e*(4+n.n8)+4);t[r]=s}return t}}(t,e,r,n)),n.loadMap&&(r.map=await async function(t,e,n,r,i){let o;o="object"==typeof r?r:void 0===r?{}:{logger:r,loggerCtx:i};const s=await XT(t,e,3);let a,c=0;a=n.nVars>1<<20?new RD:[];for(let t=0;t<n.nVars;t++){o.logger&&t%1e4==0&&o.logger.info(`${o.loggerCtx}: Loading map: ${t}/${n.nVars}`);const e=l();a.push(e)}return a;function l(){const t=s.slice(c,c+8);c+=8;const e=new DataView(t.buffer),n=e.getUint32(0,!0);return 4294967296*e.getUint32(4,!0)+n}}(t,e,r,n)),n.loadCustomGates&&(r.useCustomGates?(r.customGates=await async function(t,e,n){await JT(t,e,4);let r=await t.readULE32(),i=[];for(let e=0;e<r;e++){let e={};e.templateName=await t.readString();let r=await t.readULE32();e.parameters=Array(r);let o=await t.read(n.n8*r);for(let t=0;t<r;t++)e.parameters[t]=n.F.fromRprLE(o,t*n.n8,n.n8);i.push(e)}return await WT(t),i}(t,e,r),r.customGatesUses=await async function(t,e,n){const r=await XT(t,e,5),i=new Uint32Array(r.buffer,r.byteOffset,r.byteLength/4),o=i[0];let s,a=1;s=o>1<<20?new RD:[];for(let t=0;t<o;t++){n.logger&&t%1e5==0&&n.logger.info(`${n.loggerCtx}: Loading custom gate uses: ${t}/${o}`);let e={};e.id=i[a++];let r=i[a++];e.signals=[];for(let t=0;t<r;t++){const t=i[a++],n=i[a++];e.signals.push(4294967296*n+t)}s.push(e)}return s}(t,e,n)):(r.customGates=[],r.customGatesUses=[])),r}bT.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001",16),bT.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");async function OD(t){const e={labelIdx2Name:["one"],varIdx2Name:["one"],componentIdx2Name:[]},n=await VT(t),r=await n.read(n.totalSize),i=new TextDecoder("utf-8").decode(r).split("\n");for(let t=0;t<i.length;t++){const n=i[t].split(",");4==n.length&&(e.varIdx2Name[n[1]]?e.varIdx2Name[n[1]]+="|"+n[3]:e.varIdx2Name[n[1]]=n[3],e.labelIdx2Name[n[0]]=n[3],e.componentIdx2Name[n[2]]||(e.componentIdx2Name[n[2]]=o(n[3])))}return await n.close(),e;function o(t){const e=t.split(".");return e.pop(),e.join(".")}}const{unstringifyBigInts:QD}=DT;var UD=Object.freeze({__proto__:null,calculate:wD,debug:async function(t,e,n,r,i,o){const s=QD(t),a=await VT(e),c=await a.read(a.totalSize);await a.close();const l={...i,sanityCheck:!0};let u=await OD(r);i.set&&(u||(u=await OD(r)),l.logSetSignal=function(t,e){o&&o.info("SET "+u.labelIdx2Name[t]+" <-- "+e.toString())}),i.get&&(u||(u=await OD(r)),l.logGetSignal=function(t,e){o&&o.info("GET "+u.labelIdx2Name[t]+" --\x3e "+e.toString())}),i.trigger&&(u||(u=await OD(r)),l.logStartComponent=function(t){o&&o.info("START: "+u.componentIdx2Name[t])},l.logFinishComponent=function(t){o&&o.info("FINISH: "+u.componentIdx2Name[t])}),l.sym=u;const h=await gD(c,l),d=await h.calculateWitness(s,!0),p=await HT(n,"wtns",2,2);await async function(t,e,n){await YT(t,1);const r=8*(Math.floor((bT.bitLength(n)-1)/64)+1);await t.writeULE32(r),await qT(t,n,r),await t.writeULE32(e.length),await zT(t),await YT(t,2);for(let n=0;n<e.length;n++)await qT(t,e[n],r);await zT(t)}(p,d,h.prime),await p.close()},exportJson:async function(t){return await async function(t){const{fd:e,sections:n}=await jT(t,"wtns",2),{n8:r,nWitness:i}=await cD(e,n);await JT(e,n,2);const o=[];for(let t=0;t<i;t++){const t=await KT(e,r);o.push(t)}return await WT(e),await e.close(),o}(t)},check:async function(t,e,n){n&&n.info("WITNESS CHECKING STARTED"),n&&n.info("> Reading r1cs file");const{fd:r,sections:i}=await jT(t,"r1cs",1),o=await kD(r,i,{loadConstraints:!1,loadCustomGates:!1});n&&n.info("> Reading witness file");const{fd:s,sections:a}=await jT(e,"wtns",2),c=await cD(s,a);if(!bT.eq(o.prime,c.q))throw new Error("Curve of the witness does not match the curve of the proving key");const l=await XT(s,a,2);await s.close();const u=(await ib(o.prime)).Fr,h=u.n8,d=await XT(r,i,2);n&&(n.info("----------------------------"),n.info(" WITNESS CHECK"),n.info(` Curve: ${o.curve.name}`),n.info(` Vars (wires): ${o.nVars}`),n.info(` Outputs: ${o.nOutputs}`),n.info(` Public Inputs: ${o.nPubInputs}`),n.info(` Private Inputs: ${o.nPrvInputs}`),n.info(` Labels: ${o.nLabels}`),n.info(` Constraints: ${o.nConstraints}`),n.info(` Custom Gates: ${o.useCustomGates}`),n.info("----------------------------")),n&&n.info("> Checking witness correctness");let p=0,f=!0;for(let t=0;t<o.nConstraints;t++){n&&0!==t&&t%5e5==0&&n.info(`··· processing r1cs constraints ${t}/${o.nConstraints}`);const e=A(),r=A(),i=A(),s=g(e),a=g(r),c=g(i);if(!u.eq(u.sub(u.mul(s,a),c),u.zero)){n.warn("··· aborting checking process at constraint "+t),f=!1;break}}return r.close(),n&&(f?(n.info("WITNESS IS CORRECT"),n.info("WITNESS CHECKING FINISHED SUCCESSFULLY")):(n.warn("WITNESS IS NOT CORRECT"),n.warn("WITNESS CHECKING FINISHED UNSUCCESSFULLY"))),f;function g(t){let e=u.zero;return Object.keys(t).forEach(n=>{const r=function(t){return u.fromRprLE(l.slice(t*h,t*h+h))}(n),i=t[n];e=u.add(e,u.mul(r,i))}),e}function A(){const t={},e=d.slice(p,p+4);p+=4;const n=new DataView(e.buffer).getUint32(0,!0),r=d.slice(p,p+(4+o.n8)*n);p+=(4+o.n8)*n;const i=new DataView(r.buffer);for(let e=0;e<n;e++){const n=i.getUint32(e*(4+o.n8),!0),s=o.F.fromRprLE(r,e*(4+o.n8)+4);t[n]=s}return t}}});const PD=262144,GD={get:function(t,e){return isNaN(e)?t[e]:t.getElement(e)},set:function(t,e,n){return isNaN(e)?(t[e]=n,!0):t.setElement(e,n)}};class VD{constructor(t){this.length=t||0,this.arr=new Array(PD);for(let e=0;e<t;e+=PD)this.arr[e/PD]=new Array(Math.min(PD,t-e));return this}push(){for(let t=0;t<arguments.length;t++)this.setElement(this.length,arguments[t])}slice(t,e){const n=new Array(e-t);for(let r=t;r<e;r++)n[r-t]=this.getElement(r);return n}getElement(t){t=parseInt(t);const e=Math.floor(t/PD),n=t%PD;return this.arr[e]?this.arr[e][n]:void 0}setElement(t,e){t=parseInt(t);const n=Math.floor(t/PD);this.arr[n]||(this.arr[n]=new Array(PD));const r=t%PD;return this.arr[n][r]=e,t>=this.length&&(this.length=t+1),!0}getKeys(){const t=new jD;for(let e=0;e<this.arr.length;e++)if(this.arr[e])for(let n=0;n<this.arr[e].length;n++)void 0!==this.arr[e][n]&&t.push(e*PD+n);return t}}class jD{constructor(t){const e=new VD(t);return new Proxy(e,GD)}}var HD=jD;async function YD(t,e,n,r){const i=Fb.create({dkLen:64}),{fd:o,sections:s}=await jT(e,"ptau",1),{curve:a,power:c}=await vD(o,s),{fd:l,sections:u}=await jT(t,"r1cs",1),h=await FD(l,u,!1),d=await HT(n,"zkey",1,10,1<<22,1<<24),p=2*a.G1.F.n8,f=2*a.G2.F.n8;if(h.prime!=a.r)return r&&r.error("r1cs curve does not match powers of tau ceremony curve"),-1;const g=kb(h.nConstraints+h.nPubInputs+h.nOutputs+1-1)+1;if(g>c)return r&&r.error(`circuit too big for this power of tau ceremony. ${h.nConstraints}*2 > 2**${c}`),-1;if(!s[12])return r&&r.error("Powers of tau is not prepared."),-1;const A=h.nOutputs+h.nPubInputs,E=2**g;await YT(d,1),await d.writeULE32(1),await zT(d),await YT(d,2);const m=a.q,w=8*(Math.floor((bT.bitLength(m)-1)/64)+1),y=a.r,B=8*(Math.floor((bT.bitLength(y)-1)/64)+1),I=bT.mod(bT.shl(1,8*B),y),C=a.Fr.e(bT.mod(bT.mul(I,I),y));let T,b,D;await d.writeULE32(w),await qT(d,m,w),await d.writeULE32(B),await qT(d,y,B),await d.writeULE32(h.nVars),await d.writeULE32(A),await d.writeULE32(E),T=await o.read(p,s[4][0].p),await d.write(T),T=await a.G1.batchLEMtoU(T),i.update(T),b=await o.read(p,s[5][0].p),await d.write(b),b=await a.G1.batchLEMtoU(b),i.update(b),D=await o.read(f,s[6][0].p),await d.write(D),D=await a.G2.batchLEMtoU(D),i.update(D);const v=new Uint8Array(p);a.G1.toRprLEM(v,0,a.G1.g);const M=new Uint8Array(f);a.G2.toRprLEM(M,0,a.G2.g);const N=new Uint8Array(p);a.G1.toRprUncompressed(N,0,a.G1.g);const S=new Uint8Array(f);a.G2.toRprUncompressed(S,0,a.G2.g),await d.write(M),await d.write(v),await d.write(M),i.update(S),i.update(N),i.update(S),await zT(d),r&&r.info("Reading r1cs");let _=await XT(l,u,2);const L=new HD(h.nVars),x=new HD(h.nVars),R=new HD(h.nVars),F=new HD(h.nVars-A-1),k=new Array(A+1);r&&r.info("Reading tauG1");let O=await XT(o,s,12,(E-1)*p,E*p);r&&r.info("Reading tauG2");let Q=await XT(o,s,13,(E-1)*f,E*f);r&&r.info("Reading alphatauG1");let U=await XT(o,s,14,(E-1)*p,E*p);r&&r.info("Reading betatauG1");let P=await XT(o,s,15,(E-1)*p,E*p);await async function(){const t=new Uint8Array(12+a.Fr.n8),e=new DataView(t.buffer),n=new Uint8Array(a.Fr.n8);a.Fr.toRprLE(n,0,a.Fr.e(1));let i=0;function o(){const t=_.slice(i,i+4);i+=4;return new DataView(t.buffer).getUint32(0,!0)}const s=new HD;for(let t=0;t<h.nConstraints;t++){r&&t%1e4==0&&r.debug(`processing constraints: ${t}/${h.nConstraints}`);const e=o();for(let n=0;n<e;n++){const e=o(),n=i;i+=a.Fr.n8;const r=0,c=p*t,l=3,u=p*t;void 0===L[e]&&(L[e]=[]),L[e].push([r,c,n]),e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([l,u,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([l,u,n])),s.push([0,t,e,n])}const n=o();for(let e=0;e<n;e++){const e=o(),n=i;i+=a.Fr.n8;const r=0,c=p*t,l=1,u=f*t,h=2,d=p*t;void 0===x[e]&&(x[e]=[]),x[e].push([r,c,n]),void 0===R[e]&&(R[e]=[]),R[e].push([l,u,n]),e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([h,d,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([h,d,n])),s.push([1,t,e,n])}const c=o();for(let e=0;e<c;e++){const e=o(),n=i;i+=a.Fr.n8;const r=0,s=p*t;e<=A?(void 0===k[e]&&(k[e]=[]),k[e].push([r,s,n])):(void 0===F[e-A-1]&&(F[e-A-1]=[]),F[e-A-1].push([r,s,n]))}}for(let t=0;t<=A;t++){const e=0,n=p*(h.nConstraints+t),r=3,i=p*(h.nConstraints+t);void 0===L[t]&&(L[t]=[]),L[t].push([e,n,-1]),void 0===k[t]&&(k[t]=[]),k[t].push([r,i,-1]),s.push([0,h.nConstraints+t,t,-1])}await YT(d,4);const c=new HC(s.length*(12+a.Fr.n8)+4),l=new Uint8Array(4);new DataView(l.buffer).setUint32(0,s.length,!0),c.set(l);let u=4;for(let t=0;t<s.length;t++)r&&t%1e5==0&&r.debug(`writing coeffs: ${t}/${s.length}`),g(s[t]);function g(r){let i;e.setUint32(0,r[0],!0),e.setUint32(4,r[1],!0),e.setUint32(8,r[2],!0),i=r[3]>=0?a.Fr.fromRprLE(_.slice(r[3],r[3]+a.Fr.n8),0):a.Fr.fromRprLE(n,0);const o=a.Fr.mul(i,C);a.Fr.toRprLE(t,12,o),c.set(t,u),u+=t.length}await d.write(c),await zT(d)}(),await V(3,"G1",k,"IC"),await async function(){await YT(d,9);const t=new HC(E*p);if(g<a.Fr.s){let e=await XT(o,s,12,(2*E-1)*p,2*E*p);for(let n=0;n<E;n++){r&&n%1e4==0&&r.debug(`splitting buffer: ${n}/${E}`);const i=e.slice((2*n+1)*p,(2*n+1)*p+p);t.set(i,n*p)}}else{if(g!=a.Fr.s)throw r&&r.error("Circuit too big"),new Error("Circuit too big for this curve");{const e=s[12][0].p+(2**(g+1)-1)*p;await o.readToBuffer(t,0,E*p,e+E*p)}}await d.write(t),await zT(d)}(),await async function(){z(E-1);for(let t=0;t<E-1;t+=16384){r&&r.debug(`HashingHPoints: ${t}/${E}`);const e=Math.min(E-1,16384);await H(t,e)}}(),await V(8,"G1",F,"C"),await V(5,"G1",L,"A"),await V(6,"G1",x,"B1"),await V(7,"G2",R,"B2");const G=i.digest();return await YT(d,10),await d.write(G),await d.writeULE32(0),await zT(d),r&&r.info(Ob(G,"Circuit hash: ")),await d.close(),await l.close(),await o.close(),G;async function V(t,e,n,o){const s=a[e];z(n.length),await YT(d,t);let c=[],l=0;for(;l<n.length;){let t=0;for(;l<n.length&&t<a.tm.concurrency;){r&&r.debug(`Writing points start ${o}: ${l}/${n.length}`);let i=1,s=n[l]?n[l].length:0;for(;l+i<n.length&&s+(n[l+i]?n[l+i].length:0)<32768&&i<32768;)s+=n[l+i]?n[l+i].length:0,i++;const a=n.slice(l,l+i),u=l;c.push(j(e,a,r,o).then(t=>(r&&r.debug(`Writing points end ${o}: ${u}/${n.length}`),t))),l+=i,t++}const u=await Promise.all(c);for(let t=0;t<u.length;t++){await d.write(u[t][0]);const e=await s.batchLEMtoU(u[t][0]);i.update(e)}c=[]}await zT(d)}async function j(t,e,n,r){const i=a[t],o=2*i.F.n8,s=3*i.F.n8,c=2*i.F.n8;let l,u,h,d;if("G1"==t)l="g1m_timesScalarAffine",u="g1m_multiexpAffine",h="g1m_batchToAffine",d="g1m_zero";else{if("G2"!=t)throw new Error("Invalid group");l="g2m_timesScalarAffine",u="g2m_multiexpAffine",h="g2m_batchToAffine",d="g2m_zero"}let p,f,g=0;for(let t=0;t<e.length;t++)g+=e[t]?e[t].length:0;g>32768?(p=new HC(g*o),f=new HC(g*a.Fr.n8)):(p=new Uint8Array(g*o),f=new Uint8Array(g*a.Fr.n8));let A=0,E=0;const m=[O,Q,U,P],w=new Uint8Array(a.Fr.n8);a.Fr.toRprLE(w,0,a.Fr.e(1));let y=0;for(let t=0;t<e.length;t++)if(e[t])for(let i=0;i<e[t].length;i++)n&&i&&i%1e4==0&&n.debug(`Configuring big array ${r}: ${i}/${e[t].length}`),p.set(m[e[t][i][0]].slice(e[t][i][1],e[t][i][1]+o),y*o),e[t][i][2]>=0?f.set(_.slice(e[t][i][2],e[t][i][2]+a.Fr.n8),y*a.Fr.n8):f.set(w,y*a.Fr.n8),y++;if(e.length>1){const t=[];t.push({cmd:"ALLOCSET",var:0,buff:p}),t.push({cmd:"ALLOCSET",var:1,buff:f}),t.push({cmd:"ALLOC",var:2,len:e.length*s}),A=0,E=0;let n=0;for(let r=0;r<e.length;r++)e[r]?(1==e[r].length?t.push({cmd:"CALL",fnName:l,params:[{var:0,offset:A},{var:1,offset:E},{val:a.Fr.n8},{var:2,offset:n}]}):t.push({cmd:"CALL",fnName:u,params:[{var:0,offset:A},{var:1,offset:E},{val:a.Fr.n8},{val:e[r].length},{var:2,offset:n}]}),A+=o*e[r].length,E+=a.Fr.n8*e[r].length,n+=s):(t.push({cmd:"CALL",fnName:d,params:[{var:2,offset:n}]}),n+=s);t.push({cmd:"CALL",fnName:h,params:[{var:2},{val:e.length},{var:2}]}),t.push({cmd:"GET",out:0,var:2,len:e.length*c});return await a.tm.queueAction(t)}{let t=await i.multiExpAffine(p,f,n,r);return t=[i.toAffine(t)],t}}async function H(t,e){const n=await o.read(e*p,s[2][0].p+(t+E)*p),r=await o.read(e*p,s[2][0].p+t*p),c=a.tm.concurrency,l=Math.floor(e/c),u=[];for(let t=0;t<c;t++){let i;if(i=t<c-1?l:e-t*l,0==i)continue;const o=n.slice(t*l*p,(t*l+i)*p),s=r.slice(t*l*p,(t*l+i)*p);u.push(Y(o,s))}const h=await Promise.all(u);for(let t=0;t<h.length;t++)i.update(h[t][0])}async function Y(t,e){const n=t.byteLength/p,r=3*a.G1.F.n8,i=[];i.push({cmd:"ALLOCSET",var:0,buff:t}),i.push({cmd:"ALLOCSET",var:1,buff:e}),i.push({cmd:"ALLOC",var:2,len:n*r});for(let t=0;t<n;t++)i.push({cmd:"CALL",fnName:"g1m_subAffine",params:[{var:0,offset:t*p},{var:1,offset:t*p},{var:2,offset:t*r}]});i.push({cmd:"CALL",fnName:"g1m_batchToAffine",params:[{var:2},{val:n},{var:2}]}),i.push({cmd:"CALL",fnName:"g1m_batchLEMtoU",params:[{var:2},{val:n},{var:2}]}),i.push({cmd:"GET",out:0,var:2,len:n*p});return await a.tm.queueAction(i)}function z(t){const e=new Uint8Array(4);new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t,!1),i.update(e)}}const zD=Pb;async function JD(t,e,n,r){let i;const{fd:o,sections:s}=await jT(n,"zkey",2),a=await eD(o,s,!1);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=2*c.G1.F.n8,u=await rD(o,c,s),h=Fb.create({dkLen:64});h.update(u.csHash);let d=c.G1.g;for(let t=0;t<u.contributions.length;t++){const e=u.contributions[t],n=Ub(h);if(sD(n,c,e.delta.g1_s),sD(n,c,e.delta.g1_sx),!Qb(n.digest(),e.transcript))return console.log(`INVALID(${t}): Inconsistent transcript `),!1;const r=DD(c,e.transcript);if(i=await zD(c,e.delta.g1_s,e.delta.g1_sx,r,e.delta.g2_spx),!0!==i)return console.log(`INVALID(${t}): public key G1 and G2 do not have the same ration `),!1;if(i=await zD(c,d,e.deltaAfter,r,e.delta.g2_spx),!0!==i)return console.log(`INVALID(${t}): deltaAfter does not fillow the public key `),!1;if(1==e.type){const n=await zb(e.beaconHash,e.numIterationsExp),r=c.Fr.fromRng(n),i=c.G1.toAffine(c.G1.fromRng(n)),o=c.G1.toAffine(c.G1.timesFr(i,r));if(!0!==c.G1.eq(i,e.delta.g1_s))return console.log(`INVALID(${t}): Key of the beacon does not match. g1_s `),!1;if(!0!==c.G1.eq(o,e.delta.g1_sx))return console.log(`INVALID(${t}): Key of the beacon does not match. g1_sx `),!1}aD(h,c,e);const o=Fb.create({dkLen:64});aD(o,c,e),e.contributionHash=o.digest(),d=e.deltaAfter}const{fd:p,sections:f}=await jT(t,"zkey",2),g=await eD(p,f,!1);if("groth16"!=g.protocol)throw new Error("zkeyinit file is not groth16");if(!bT.eq(g.q,a.q)||!bT.eq(g.r,a.r)||g.n8q!=a.n8q||g.n8r!=a.n8r)return r&&r.error("INVALID: Different curves"),!1;if(g.nVars!=a.nVars||g.nPublic!=a.nPublic||g.domainSize!=a.domainSize)return r&&r.error("INVALID: Different circuit parameters"),!1;if(!c.G1.eq(a.vk_alpha_1,g.vk_alpha_1))return r&&r.error("INVALID: Invalid alpha1"),!1;if(!c.G1.eq(a.vk_beta_1,g.vk_beta_1))return r&&r.error("INVALID: Invalid beta1"),!1;if(!c.G2.eq(a.vk_beta_2,g.vk_beta_2))return r&&r.error("INVALID: Invalid beta2"),!1;if(!c.G2.eq(a.vk_gamma_2,g.vk_gamma_2))return r&&r.error("INVALID: Invalid gamma2"),!1;if(!c.G1.eq(a.vk_delta_1,d))return r&&r.error("INVALID: Invalid delta1"),!1;if(i=await zD(c,c.G1.g,d,c.G2.g,a.vk_delta_2),!0!==i)return r&&r.error("INVALID: Invalid delta2"),!1;const A=await rD(p,c,f);if(!Qb(u.csHash,A.csHash))return r&&r.error("INVALID: Circuit does not match"),!1;if(s[8][0].size!=l*(a.nVars-a.nPublic-1))return r&&r.error("INVALID: Invalid L section size"),!1;if(s[9][0].size!=l*a.domainSize)return r&&r.error("INVALID: Invalid H section size"),!1;let E;if(E=await $T(o,s,p,f,3),!E)return r&&r.error("INVALID: IC section is not identical"),!1;if(E=await $T(o,s,p,f,4),!E)return r&&r.error("Coeffs section is not identical"),!1;if(E=await $T(o,s,p,f,5),!E)return r&&r.error("A section is not identical"),!1;if(E=await $T(o,s,p,f,6),!E)return r&&r.error("B1 section is not identical"),!1;if(E=await $T(o,s,p,f,7),!E)return r&&r.error("B2 section is not identical"),!1;if(i=await async function(t,e,n,o,s,a,l,u,h){const d=1<<20,p=c[t],f=2*p.F.n8;await JT(e,n,a),await JT(o,s,a);let g=p.zero,A=p.zero;const E=n[a][0].size/f;for(let t=0;t<E;t+=d){r&&r.debug(`Same ratio check ${h}: ${t}/${E}`);const n=Math.min(E-t,d),i=await e.read(n*f),s=await o.read(n*f),a=Vb(4*n),c=await p.multiExpAffine(i,a),l=await p.multiExpAffine(s,a);g=p.add(g,c),A=p.add(A,l)}return await WT(e),await WT(o),0==E||(i=await zD(c,g,A,l,u),!0===i)}("G1",p,f,o,s,8,a.vk_delta_2,g.vk_delta_2,"L section"),!0!==i)return r&&r.error("L section does not match"),!1;if(i=await async function(){const t=1<<20,n=c.G1,l=c.Fr,u=2*n.F.n8,{fd:h,sections:d}=await jT(e,"ptau",1);let p=new HC(a.domainSize*a.n8r);const f=new Array(8);for(let t=0;t<8;t++)f[t]=Hb(Vb(4),0);const A=new ZB(f);for(let t=0;t<a.domainSize-1;t++){const e=l.fromRng(A);l.toRprLE(p,t*a.n8r,e)}l.toRprLE(p,(a.domainSize-1)*a.n8r,l.zero);let E,w=n.zero;for(let e=0;e<a.domainSize;e+=t){r&&r.debug(`H Verification(tau): ${e}/${a.domainSize}`);const i=Math.min(a.domainSize-e,t),o=await h.read(u*i,d[2][0].p+a.domainSize*u+e*u),s=await h.read(u*i,d[2][0].p+e*u),c=await m(o,s),l=p.slice(e*a.n8r,(e+i)*a.n8r),f=await n.multiExpAffine(c,l);w=n.add(w,f)}if(p=await l.batchToMontgomery(p),a.power<l.s)E=l.neg(l.e(2));else{const t=2**l.s,e=l.exp(l.shift,t);E=l.sub(e,l.one)}const y=a.power<l.s?l.w[a.power+1]:l.shift;p=await l.batchApplyKey(p,E,y),p=await l.fft(p),p=await l.batchFromMontgomery(p),await JT(o,s,9);let B=n.zero;for(let e=0;e<a.domainSize;e+=t){r&&r.debug(`H Verification(lagrange): ${e}/${a.domainSize}`);const i=Math.min(a.domainSize-e,t),s=await o.read(u*i),c=p.slice(e*a.n8r,(e+i)*a.n8r),l=await n.multiExpAffine(s,c);B=n.add(B,l)}return await WT(o),i=await zD(c,w,B,a.vk_delta_2,g.vk_delta_2),!0===i}(),!0!==i)return r&&r.error("H section does not match"),!1;r&&r.info(Ob(u.csHash,"Circuit Hash: ")),await o.close(),await p.close();for(let t=u.contributions.length-1;t>=0;t--){const e=u.contributions[t];r&&r.info("-------------------------"),r&&r.info(Ob(e.contributionHash,`contribution #${t+1} ${e.name?e.name:""}:`)),1==e.type&&(r&&r.info(`Beacon generator: ${Wb(e.beaconHash)}`),r&&r.info(`Beacon iterations Exp: ${e.numIterationsExp}`))}return r&&r.info("-------------------------"),r&&r.info("ZKey Ok!"),!0;async function m(t,e){const n=2*c.G1.F.n8,r=t.byteLength/n,i=c.tm.concurrency,o=Math.floor(r/i),s=[];for(let n=0;n<i;n++){let a;if(a=n<i-1?o:r-n*o,0==a)continue;const c=t.slice(n*o*l,(n*o+a)*l),u=e.slice(n*o*l,(n*o+a)*l);s.push(w(c,u))}const a=await Promise.all(s),u=new Uint8Array(r*n);let h=0;for(let t=0;t<a.length;t++)u.set(a[t][0],h),h+=a[t][0].byteLength;return u}async function w(t,e){const n=2*c.G1.F.n8,r=3*c.G1.F.n8,i=t.byteLength/n,o=[];o.push({cmd:"ALLOCSET",var:0,buff:t}),o.push({cmd:"ALLOCSET",var:1,buff:e}),o.push({cmd:"ALLOC",var:2,len:i*r});for(let t=0;t<i;t++)o.push({cmd:"CALL",fnName:"g1m_subAffine",params:[{var:0,offset:t*n},{var:1,offset:t*n},{var:2,offset:t*r}]});o.push({cmd:"CALL",fnName:"g1m_batchToAffine",params:[{var:2},{val:i},{var:2}]}),o.push({cmd:"GET",out:0,var:2,len:i*n});return await c.tm.queueAction(o)}}const{stringifyBigInts:WD}=DT;async function qD(t,e){e&&e.info("EXPORT VERIFICATION KEY STARTED");const{fd:n,sections:r}=await jT(t,"zkey",2),i=await eD(n,r);let o;if(e&&e.info("> Detected protocol: "+i.protocol),"groth16"===i.protocol)o=await async function(t,e,n){const r=await ob(t.q),i=2*r.G1.F.n8,o=await r.pairing(t.vk_alpha_1,t.vk_beta_2);let s={protocol:t.protocol,curve:r.name,nPublic:t.nPublic,vk_alpha_1:r.G1.toObject(t.vk_alpha_1),vk_beta_2:r.G2.toObject(t.vk_beta_2),vk_gamma_2:r.G2.toObject(t.vk_gamma_2),vk_delta_2:r.G2.toObject(t.vk_delta_2),vk_alphabeta_12:r.Gt.toObject(o)};await JT(e,n,3),s.IC=[];for(let n=0;n<=t.nPublic;n++){const t=await e.read(i),n=r.G1.toObject(t);s.IC.push(n)}return await WT(e),s=WD(s),s}(i,n,r);else if("plonk"===i.protocol)o=await async function(t){const e=await ob(t.q);let n={protocol:t.protocol,curve:e.name,nPublic:t.nPublic,power:t.power,k1:e.Fr.toObject(t.k1),k2:e.Fr.toObject(t.k2),Qm:e.G1.toObject(t.Qm),Ql:e.G1.toObject(t.Ql),Qr:e.G1.toObject(t.Qr),Qo:e.G1.toObject(t.Qo),Qc:e.G1.toObject(t.Qc),S1:e.G1.toObject(t.S1),S2:e.G1.toObject(t.S2),S3:e.G1.toObject(t.S3),X_2:e.G2.toObject(t.X_2),w:e.Fr.toObject(e.Fr.w[t.power])};return n=WD(n),n}(i);else{if(!i.protocolId||i.protocolId!==qb)throw new Error("zkey file protocol unrecognized");o=await async function(t){const e=await ob(t.q);let n={protocol:t.protocol,curve:e.name,nPublic:t.nPublic,power:t.power,k1:e.Fr.toObject(t.k1),k2:e.Fr.toObject(t.k2),w:e.Fr.toObject(e.Fr.w[t.power]),w3:e.Fr.toObject(t.w3),w4:e.Fr.toObject(t.w4),w8:e.Fr.toObject(t.w8),wr:e.Fr.toObject(t.wr),X_2:e.G2.toObject(t.X_2),C0:e.G1.toObject(t.C0)};return WD(n)}(i)}return await n.close(),e&&e.info("EXPORT VERIFICATION KEY FINISHED"),o}var KD={};const{unstringifyBigInts:ZD,stringifyBigInts:XD}=DT;async function $D(t,e,n){n&&n.info("FFLONK EXPORT SOLIDITY VERIFIER STARTED");const r=await sb(t.curve);let i=l(t.w3);t.w3_2=u(r.Fr.square(i));let o=l(t.w4);t.w4_2=u(r.Fr.square(o)),t.w4_3=u(r.Fr.mul(r.Fr.square(o),o));let s=l(t.w8),a=r.Fr.one;for(let e=1;e<8;e++)a=r.Fr.mul(a,s),t["w8_"+e]=u(a);let c=e[t.protocol];return n&&n.info("FFLONK EXPORT SOLIDITY VERIFIER FINISHED"),KD.render(c,t);function l(t){const e=ZD(t);return r.Fr.fromObject(e)}function u(t){const e=r.Fr.toObject(t);return XD(e)}}var tv=Object.freeze({__proto__:null,newZKey:YD,exportBellman:async function(t,e,n){const{fd:r,sections:i}=await jT(t,"zkey",2),o=await eD(r,i);if("groth16"!=o.protocol)throw new Error("zkey file is not groth16");const s=await ob(o.q),a=2*s.G1.F.n8,c=2*s.G2.F.n8,l=await rD(r,s,i),u=await GT(e);let h;await m(o.vk_alpha_1),await m(o.vk_beta_1),await w(o.vk_beta_2),await w(o.vk_gamma_2),await m(o.vk_delta_1),await w(o.vk_delta_2),h=await XT(r,i,3),h=await s.G1.batchLEMtoU(h),await y("G1",h);const d=await XT(r,i,9);let p,f,g,A,E;p=await s.G1.fft(d,"affine","jacobian",n),p=await s.G1.batchApplyKey(p,s.Fr.neg(s.Fr.e(2)),s.Fr.w[o.power+1],"jacobian","affine",n),p=p.slice(0,p.byteLength-a),p=await s.G1.batchLEMtoU(p),await y("G1",p),f=await XT(r,i,8),f=await s.G1.batchLEMtoU(f),await y("G1",f),g=await XT(r,i,5),g=await s.G1.batchLEMtoU(g),await y("G1",g),A=await XT(r,i,6),A=await s.G1.batchLEMtoU(A),await y("G1",A),E=await XT(r,i,7),E=await s.G2.batchLEMtoU(E),await y("G2",E),await u.write(l.csHash),await async function(t){const e=new Uint8Array(4);new DataView(e.buffer,e.byteOffset,e.byteLength).setUint32(0,t,!1),await u.write(e)}(l.contributions.length);for(let t=0;t<l.contributions.length;t++){const e=l.contributions[t];await m(e.deltaAfter),await m(e.delta.g1_s),await m(e.delta.g1_sx),await w(e.delta.g2_spx),await u.write(e.transcript)}async function m(t){const e=new Uint8Array(a);s.G1.toRprUncompressed(e,0,t),await u.write(e)}async function w(t){const e=new Uint8Array(c);s.G2.toRprUncompressed(e,0,t),await u.write(e)}async function y(t,e){let n;n="G1"==t?a:c;const r=new Uint8Array(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(0,e.byteLength/n,!1),await u.write(r),await u.write(e)}await r.close(),await u.close()},importBellman:async function(t,e,n,r,i){const{fd:o,sections:s}=await jT(t,"zkey",2),a=await eD(o,s,!1);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=2*c.G1.F.n8,u=2*c.G2.F.n8,h=await rD(o,c,s),d={},p=await VT(e);p.pos=3*l+3*u+8+l*a.nVars+4+l*(a.domainSize-1)+4+l*a.nVars+4+l*a.nVars+4+u*a.nVars,d.csHash=await p.read(64);const f=await p.readUBE32();d.contributions=[];for(let t=0;t<f;t++){const e={delta:{}};e.deltaAfter=await I(p),e.delta.g1_s=await I(p),e.delta.g1_sx=await I(p),e.delta.g2_spx=await C(p),e.transcript=await p.read(64),t<h.contributions.length&&(e.type=h.contributions[t].type,1==e.type&&(e.beaconHash=h.contributions[t].beaconHash,e.numIterationsExp=h.contributions[t].numIterationsExp),h.contributions[t].name&&(e.name=h.contributions[t].name)),d.contributions.push(e)}if(!Qb(d.csHash,h.csHash))return i&&i.error("Hash of the original circuit does not match with the MPC one"),!1;if(h.contributions.length>d.contributions.length)return i&&i.error("The impoerted file does not include new contributions"),!1;for(let t=0;t<h.contributions.length;t++)if(!T(h.contributions[t],d.contributions[t]))return i&&i.error(`Previous contribution ${t} does not match`),!1;if(r)for(let t=h.contributions.length;t<d.contributions.length;t++)d.contributions[t].name=r;const g=await HT(n,"zkey",1,10);if(p.pos=0,p.pos+=l,p.pos+=l,p.pos+=u,p.pos+=u,a.vk_delta_1=await I(p),a.vk_delta_2=await C(p),await Kb(g,a),await p.readUBE32()!=a.nPublic+1)return i&&i.error("Invalid number of points in IC"),await g.discard(),!1;if(p.pos+=l*(a.nPublic+1),await ZT(o,s,g,3),await ZT(o,s,g,4),await p.readUBE32()!=a.domainSize-1)return i&&i.error("Invalid number of points in H"),await g.discard(),!1;let A;const E=await p.read(l*(a.domainSize-1)),m=await c.G1.batchUtoLEM(E);A=new Uint8Array(a.domainSize*l),A.set(m),c.G1.toRprLEM(A,l*(a.domainSize-1),c.G1.zeroAffine);const w=c.Fr.neg(c.Fr.inv(c.Fr.e(2))),y=c.Fr.inv(c.Fr.w[a.power+1]);if(A=await c.G1.batchApplyKey(A,w,y,"affine","jacobian",i),A=await c.G1.ifft(A,"jacobian","affine",i),await YT(g,9),await g.write(A),await zT(g),await p.readUBE32()!=a.nVars-a.nPublic-1)return i&&i.error("Invalid number of points in L"),await g.discard(),!1;let B;return B=await p.read(l*(a.nVars-a.nPublic-1)),B=await c.G1.batchUtoLEM(B),await YT(g,8),await g.write(B),await zT(g),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in A"),await g.discard(),!1):(p.pos+=l*a.nVars,await ZT(o,s,g,5),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in B1"),await g.discard(),!1):(p.pos+=l*a.nVars,await ZT(o,s,g,6),await p.readUBE32()!=a.nVars?(i&&i.error("Invalid number of points in B2"),await g.discard(),!1):(p.pos+=u*a.nVars,await ZT(o,s,g,7),await oD(g,c,d),await p.close(),await g.close(),await o.close(),!0)));async function I(t){const e=await t.read(2*c.G1.F.n8);return c.G1.fromRprUncompressed(e,0)}async function C(t){const e=await t.read(2*c.G2.F.n8);return c.G2.fromRprUncompressed(e,0)}function T(t,e){return!!c.G1.eq(t.deltaAfter,e.deltaAfter)&&(!!c.G1.eq(t.delta.g1_s,e.delta.g1_s)&&(!!c.G1.eq(t.delta.g1_sx,e.delta.g1_sx)&&(!!c.G2.eq(t.delta.g2_spx,e.delta.g2_spx)&&!!Qb(t.transcript,e.transcript))))}},verifyFromR1cs:async function(t,e,n,r){const i={type:"bigMem"};return await YD(t,e,i,r),await JD(i,e,n,r)},verifyFromInit:JD,contribute:async function(t,e,n,r,i){const{fd:o,sections:s}=await jT(t,"zkey",2),a=await eD(o,s);if("groth16"!=a.protocol)throw new Error("zkey file is not groth16");const c=await ob(a.q),l=await rD(o,c,s),u=await HT(e,"zkey",1,10),h=await Yb(r),d=Fb.create({dkLen:64});d.update(l.csHash);for(let t=0;t<l.contributions.length;t++)aD(d,c,l.contributions[t]);const p={delta:{}};p.delta.prvKey=c.Fr.fromRng(h),p.delta.g1_s=c.G1.toAffine(c.G1.fromRng(h)),p.delta.g1_sx=c.G1.toAffine(c.G1.timesFr(p.delta.g1_s,p.delta.prvKey)),sD(d,c,p.delta.g1_s),sD(d,c,p.delta.g1_sx),p.transcript=d.digest(),p.delta.g2_sp=DD(c,p.transcript),p.delta.g2_spx=c.G2.toAffine(c.G2.timesFr(p.delta.g2_sp,p.delta.prvKey)),a.vk_delta_1=c.G1.timesFr(a.vk_delta_1,p.delta.prvKey),a.vk_delta_2=c.G2.timesFr(a.vk_delta_2,p.delta.prvKey),p.deltaAfter=a.vk_delta_1,p.type=0,n&&(p.name=n),l.contributions.push(p),await Kb(u,a),await ZT(o,s,u,3),await ZT(o,s,u,4),await ZT(o,s,u,5),await ZT(o,s,u,6),await ZT(o,s,u,7);const f=c.Fr.inv(p.delta.prvKey);await MD(o,s,u,8,c,"G1",f,c.Fr.e(1),"L Section",i),await MD(o,s,u,9,c,"G1",f,c.Fr.e(1),"H Section",i),await oD(u,c,l),await o.close(),await u.close();const g=Fb.create({dkLen:64});aD(g,c,p);const A=g.digest();return i&&i.info(Ob(l.csHash,"Circuit Hash: ")),i&&i.info(Ob(A,"Contribution Hash: ")),A},beacon:async function(t,e,n,r,i,o){const s=Jb(r);if(0==s.byteLength||2*s.byteLength!=r.length)return o&&o.error("Invalid Beacon Hash. (It must be a valid hexadecimal sequence)"),!1;if(s.length>=256)return o&&o.error("Maximum length of beacon hash is 255 bytes"),!1;if((i=parseInt(i))<10||i>63)return o&&o.error("Invalid numIterationsExp. (Must be between 10 and 63)"),!1;const{fd:a,sections:c}=await jT(t,"zkey",2),l=await eD(a,c);if("groth16"!=l.protocol)throw new Error("zkey file is not groth16");const u=await ob(l.q),h=await rD(a,u,c),d=await HT(e,"zkey",1,10),p=await zb(s,i),f=Fb.create({dkLen:64});f.update(h.csHash);for(let t=0;t<h.contributions.length;t++)aD(f,u,h.contributions[t]);const g={delta:{}};g.delta.prvKey=u.Fr.fromRng(p),g.delta.g1_s=u.G1.toAffine(u.G1.fromRng(p)),g.delta.g1_sx=u.G1.toAffine(u.G1.timesFr(g.delta.g1_s,g.delta.prvKey)),sD(f,u,g.delta.g1_s),sD(f,u,g.delta.g1_sx),g.transcript=f.digest(),g.delta.g2_sp=DD(u,g.transcript),g.delta.g2_spx=u.G2.toAffine(u.G2.timesFr(g.delta.g2_sp,g.delta.prvKey)),l.vk_delta_1=u.G1.timesFr(l.vk_delta_1,g.delta.prvKey),l.vk_delta_2=u.G2.timesFr(l.vk_delta_2,g.delta.prvKey),g.deltaAfter=l.vk_delta_1,g.type=1,g.numIterationsExp=i,g.beaconHash=s,n&&(g.name=n),h.contributions.push(g),await Kb(d,l),await ZT(a,c,d,3),await ZT(a,c,d,4),await ZT(a,c,d,5),await ZT(a,c,d,6),await ZT(a,c,d,7);const A=u.Fr.inv(g.delta.prvKey);await MD(a,c,d,8,u,"G1",A,u.Fr.e(1),"L Section",o),await MD(a,c,d,9,u,"G1",A,u.Fr.e(1),"H Section",o),await oD(d,u,h),await a.close(),await d.close();const E=Fb.create({dkLen:64});aD(E,u,g);const m=E.digest();return o&&o.info(Ob(m,"Contribution Hash: ")),m},exportJson:async function(t){const e=await async function(t,e){const{fd:n,sections:r}=await jT(t,"zkey",1),i=await eD(n,r,e),o=new iI(i.r),s=bT.mod(bT.shl(1,8*i.n8r),i.r),a=o.inv(s),c=o.mul(a,a);let l=await ob(i.q);await JT(n,r,3),i.IC=[];for(let t=0;t<=i.nPublic;t++){const t=await $b(n,l,e);i.IC.push(t)}await WT(n),await JT(n,r,4);const u=await n.readULE32();i.ccoefs=[];for(let t=0;t<u;t++){const t=await n.readULE32(),e=await n.readULE32(),r=await n.readULE32(),o=await h();i.ccoefs.push({matrix:t,constraint:e,signal:r,value:o})}await WT(n),await JT(n,r,5),i.A=[];for(let t=0;t<i.nVars;t++){const r=await $b(n,l,e);i.A[t]=r}await WT(n),await JT(n,r,6),i.B1=[];for(let t=0;t<i.nVars;t++){const r=await $b(n,l,e);i.B1[t]=r}await WT(n),await JT(n,r,7),i.B2=[];for(let t=0;t<i.nVars;t++){const r=await tD(n,l,e);i.B2[t]=r}await WT(n),await JT(n,r,8),i.C=[];for(let t=i.nPublic+1;t<i.nVars;t++){const r=await $b(n,l,e);i.C[t]=r}await WT(n),await JT(n,r,9),i.hExps=[];for(let t=0;t<i.domainSize;t++){const t=await $b(n,l,e);i.hExps.push(t)}return await WT(n),await n.close(),i;async function h(){const t=await KT(n,i.n8r);return o.mul(t,c)}}(t,!0);return delete e.curve,delete e.F,DT.stringifyBigInts(e)},bellmanContribute:async function(t,e,n,r,i){const o=await Yb(r),s=t.Fr.fromRng(o),a=t.Fr.inv(s),c=2*t.G1.F.n8,l=2*t.G2.F.n8,u=await VT(e),h=await GT(n);await M(c),await M(c),await M(l),await M(l);const d=await N(),p=t.G1.timesFr(d,s);await _(p);const f=await S(),g=t.G2.timesFr(f,s);await L(g);const A=await u.readUBE32();await h.writeUBE32(A),await M(A*c);const E=await u.readUBE32();await h.writeUBE32(E),await ND(u,h,null,t,"G1",E,a,t.Fr.e(1),"UNCOMPRESSED","H",i);const m=await u.readUBE32();await h.writeUBE32(m),await ND(u,h,null,t,"G1",m,a,t.Fr.e(1),"UNCOMPRESSED","L",i);const w=await u.readUBE32();await h.writeUBE32(w),await M(w*c);const y=await u.readUBE32();await h.writeUBE32(y),await M(y*c);const B=await u.readUBE32();await h.writeUBE32(B),await M(B*l);const I=Fb.create({dkLen:64}),C={};C.csHash=await u.read(64),I.update(C.csHash);const T=await u.readUBE32();C.contributions=[];for(let e=0;e<T;e++){const e={delta:{}};e.deltaAfter=await N(),e.delta.g1_s=await N(),e.delta.g1_sx=await N(),e.delta.g2_spx=await S(),e.transcript=await u.read(64),C.contributions.push(e),aD(I,t,e)}const b={delta:{}};b.delta.prvKey=s,b.delta.g1_s=t.G1.toAffine(t.G1.fromRng(o)),b.delta.g1_sx=t.G1.toAffine(t.G1.timesFr(b.delta.g1_s,s)),sD(I,t,b.delta.g1_s),sD(I,t,b.delta.g1_sx),b.transcript=I.digest(),b.delta.g2_sp=DD(t,b.transcript),b.delta.g2_spx=t.G2.toAffine(t.G2.timesFr(b.delta.g2_sp,s)),b.deltaAfter=p,b.type=0,C.contributions.push(b),await h.write(C.csHash),await h.writeUBE32(C.contributions.length);for(let t=0;t<C.contributions.length;t++){const e=C.contributions[t];await _(e.deltaAfter),await _(e.delta.g1_s),await _(e.delta.g1_sx),await L(e.delta.g2_spx),await h.write(e.transcript)}const D=Fb.create({dkLen:64});aD(D,t,b);const v=D.digest();return i&&i.info(Ob(v,"Contribution Hash: ")),await h.close(),await u.close(),v;async function M(t){const e=2*u.pageSize;for(let n=0;n<t;n+=e){const r=Math.min(t-n,e),i=await u.read(r);await h.write(i)}}async function N(){const e=await u.read(2*t.G1.F.n8);return t.G1.fromRprUncompressed(e,0)}async function S(){const e=await u.read(2*t.G2.F.n8);return t.G2.fromRprUncompressed(e,0)}async function _(e){const n=new Uint8Array(c);t.G1.toRprUncompressed(n,0,e),await h.write(n)}async function L(e){const n=new Uint8Array(l);t.G2.toRprUncompressed(n,0,e),await h.write(n)}},exportVerificationKey:qD,exportSolidityVerifier:async function(t,e,n){const r=await qD(t,n);if("fflonk"===r.protocol)return $D(r,e,n);let i=e[r.protocol];return KD.render(i,r)}});const ev=[],nv=[],rv=[],iv=BigInt(0),ov=BigInt(1),sv=BigInt(2),av=BigInt(7),cv=BigInt(256),lv=BigInt(113);for(let t=0,e=ov,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],ev.push(2*(5*r+n)),nv.push((t+1)*(t+2)/2%64);let i=iv;for(let t=0;t<7;t++)e=(e<<ov^(e>>av)*lv)%cv,e&sv&&(i^=ov<<(ov<<BigInt(t))-ov);rv.push(i)}const[uv,hv]=Tb(rv,!0);const{stringifyBigInts:dv}=DT;const{unstringifyBigInts:pv}=DT;const{unstringifyBigInts:fv}=DT;const{unstringifyBigInts:gv}=DT;const{stringifyBigInts:Av}=DT;const{unstringifyBigInts:Ev}=DT;const{unstringifyBigInts:mv}=DT;const{unstringifyBigInts:wv}=DT;var yv=s(8287).hp;const Bv=pm.fromJSON({});class Iv extends Error{name="AttestorError";code;data;constructor(t,e,n){super(e),this.code=t,this.data=n}toProto(){return pm.create({code:om[this.code],message:this.message,data:JSON.stringify(this.data)})}static fromProto(t=Bv){return new Iv("number"==typeof t.code?function(t,e){for(const n in t)if(t[n]===e)return n;return}(om,t.code)||"UNRECOGNIZED":t.code,t.message,t.data?JSON.parse(t.data):void 0)}static fromError(t,e="ERROR_INTERNAL"){return t instanceof Iv?t:new Iv(e,t.message)}static badRequest(t,e){return new Iv("ERROR_BAD_REQUEST",t,e)}}const Cv=+(oy("ZK_CONCURRENCY")||10);async function Tv({zkOperators:t,oprfOperators:e,logger:n=uy,zkProofConcurrency:r=Cv,cipherSuite:i,zkEngine:o="snarkjs"}){const s=new uB({concurrency:r,autoStart:!0}),a=[];n=n.child({module:"zk",zkEngine:o});let c=0;return{async addPacketToProve(t,{redactedPlaintext:e,toprfs:n=[],overshotToprfFromPrevBlock:r},o,s){if("plaintext"===t.type)throw new Error("Cannot generate proof for plaintext");const l=Ww(i),u=bv(l),h=await C.exportKey(t.encKey),d=t.iv,p=function(t,e){Ww(e),t=t.slice(0,-16);const{ivLength:n}=G[e],r=12-n;return t.slice(r)}(t.ciphertext,i);r&&e.set(new Uint8Array(r.length).fill(fy));const f="TLS_AES_128_GCM_SHA256"===(g=i)||"TLS_AES_256_GCM_SHA384"===g||"TLS_CHACHA20_POLY1305_SHA256"===g?p.length-1:p.length;var g;const A={onGeneratedProofs:o,algorithm:l,proofsToGenerate:[],toprfsToGenerate:[],iv:t.fixedIv};for(const r of n){const n=f-(r.dataLocation.fromIndex+r.dataLocation.length);if(n<0){const e=s();if("ciphertext"!==e?.type)throw new Iv("ERROR_INTERNAL","TOPRF data overshoots ciphertext length, but no next ciphertext packet found");if(e.encKey!==t.encKey)throw new Iv("ERROR_INTERNAL","TOPRF data overshoots ciphertext length, but next packet has different encryption key");const i=e.ciphertext.slice(0,Math.abs(n)),o=e.iv;r.overshoot={ciphertext:i,iv:o,recordNumber:e.recordNumber}}const i=Fv(l,r),o={fromIndex:i,toIndex:Math.min(i+u,p.length)};A.toprfsToGenerate.push(Rv({key:h,iv:d,ciphertext:p,slice:o,toprf:{...r,dataLocation:{...r.dataLocation,fromIndex:r.dataLocation.fromIndex-i}}})),c+=1;const a=Math.min(f,r.dataLocation.fromIndex+r.dataLocation.length);for(let t=r.dataLocation.fromIndex;t<a;t++)e[t]=fy}for(let t=0;t<p.length;t+=u){const n=xv({key:h,iv:d,ciphertext:p,redactedPlaintext:e,slice:{fromIndex:t,toIndex:Math.min(t+u,p.length)}});n&&(A.proofsToGenerate.push(n),c+=1)}a.push(A)},getTotalChunksToProve:()=>c,async generateProofs(t){if(!a.length)return;const e=Date.now(),r=[];for(const{onGeneratedProofs:e,algorithm:n,proofsToGenerate:i,toprfsToGenerate:o}of a){const a=[],c=[];let h=i.length+o.length;for(const o of i)r.push(s.add(async()=>{const r=await l(n,o);t?.(),a.push(r),h-=1,0===h&&e(a,c)},{throwOnTimeout:!0}));for(const i of o)r.push(s.add(async()=>{const r=await u(n,i);t?.(),c.push(r),h-=1,0===h&&e(a,c)},{throwOnTimeout:!0}))}await Promise.all(r),n?.info({durationMs:Date.now()-e,zkProofsToGen:c},"generated ZK proofs"),a.splice(0,a.length),c=0;const o=Ww(i),d=await h(o);d.release?.()}};async function l(t,{startIdx:e,redactedPlaintext:r,privateInput:i,publicInput:o}){const s=h(t),a=await Uw({algorithm:t,privateInput:i,publicInput:o,operator:s,logger:n});return n?.debug({startIdx:e},"generated proof for chunk"),{proofData:"string"==typeof a.proofData?Yw(a.proofData):a.proofData,decryptedRedactedCiphertext:a.plaintext||new Uint8Array,redactedPlaintext:r,startIdx:e}}async function u(t,{startIdx:r,privateInput:i,publicInput:s,toprf:a}){const c=function(t){return e?.[t]||_v(t,o,n)}(t),l=[];if(a?.overshoot){const{dataLocation:e,overshoot:{ciphertext:n}}=a;l.push({pos:e.fromIndex,len:e.length-n.length},{pos:kw(e.fromIndex+e.length,t),len:n.length})}else a&&l.push({pos:a.dataLocation.fromIndex,len:a.dataLocation.length});const u=await Uw({algorithm:t,privateInput:i,publicInput:s,operator:c,logger:n,...a?{toprf:{locations:l,output:a.nullifier,responses:a.responses,domainSeparator:bw},mask:a.mask}:{}});return n?.debug({toprfLocations:l},"generated TOPRF proof for chunk"),{startIdx:r,proofData:"string"==typeof u.proofData?Yw(u.proofData):u.proofData,payload:a}}function h(e){return t?.[e]||Sv(e,o,n)}}function bv(t){const{chunkSize:e,bitsPerWord:n}=Ow[t];return e*n/8}const Dv={},vv={},Mv={snarkjs:function({algorithm:t,fetcher:e,options:{maxProofConcurrency:n=2}={}}){let r,i,o;const s=new uB({concurrency:n});return{async generateWitness({out:n,...r},s){i||=function(n){return e.fetch("snarkjs",`${t}/circuit.wasm`,n)}(),o||=(async()=>{if(!UD.getWtnsCalculator)return;const t=WebAssembly.Memory;WebAssembly.Memory=class extends WebAssembly.Memory{constructor(){super({initial:5})}};try{return await UD.getWtnsCalculator(await i)}finally{WebAssembly.Memory=t}})();const{noncesAndCounters:[{nonce:a,counter:c}]}=r,l={key:Sw(t,r.key),nonce:Sw(t,a),counter:Sw(t,c),in:Sw(t,r.in)},u={type:"mem"};return await o?await UD.wtnsCalculateWithCalculator(l,await o,u):await UD.calculate(l,await i,u),u.data},async groth16Prove(t,e){r||=a();const{data:n}=await r,{proof:i}=await s.add(()=>bD.prove(n,t,e));return{proof:JSON.stringify(i)}},async groth16Verify(e,n,i){n="string"!=typeof n?yv.from(n).toString():n,r||=a();const o=await r;o.json||(o.json=await tv.exportVerificationKey(o.data));const{noncesAndCounters:[{nonce:s,counter:c}]}=e;return bD.verify(o.json,Sw(t,e.out,s,c,e.in),JSON.parse(n),i)},release(){r=void 0,i=void 0,o=void 0}};async function a(n){return{data:await e.fetch("snarkjs",`${t}/circuit_final.zkey`,n)}}},gnark:function({algorithm:t,fetcher:e}){return{generateWitness:async e=>Wy(t,e),async groth16Prove(n,r){const i=await tB(t,e,r),o=await Xy(i.prove,n);if("object"!=typeof o||!("proof"in o)||!o.proof)throw new Error(`Failed to create gnark proof: ${JSON.stringify(o)}`);return{proof:Uy(o.proof)}},async groth16Verify(n,r,i){const o=await tB(t,e,i),s=qy(t,n),a=JSON.stringify({cipher:t,proof:"string"==typeof r?r:Qy(r),publicSignals:s});return 1===Zy(o.verify,a)}}}},Nv={gnark:function({fetcher:t,algorithm:e}){return{generateWitness:async t=>Wy(e,t),async groth16Prove(t,e){const r=await n(e),i=await Xy(r.prove,t);if("object"!=typeof i||!("proof"in i)||!i.proof)throw new Error(`Failed to create gnark TOPRF proof: ${JSON.stringify(i)}`);return{proof:Uy(i.proof)}},async groth16Verify(t,r,i){const o=await n(i),s=qy(e,t),a=JSON.stringify({cipher:`${e}-toprf`,proof:"string"==typeof r?r:Qy(r),publicSignals:s});return 1===Zy(o.verify,a)},async generateThresholdKeys(t,e,r){const i=await n(r),{generateThresholdKeys:o,vfree:s}=i,a={total:t,threshold:e},c=Zy(o,JSON.stringify(a)),l=nB.from(eB.decode(c.r0,"unsigned char",c.r1)).toString();s(c.r0);const u=JSON.parse(l),h=[];for(let t=0;t<u.shares.length;t++){const e=u.shares[t];h.push({index:e.index,publicKey:ky(e.publicKey),privateKey:ky(e.privateKey)})}return{publicKey:ky(u.publicKey),privateKey:ky(u.privateKey),shares:h}},async generateOPRFRequestData(t,e,r){const i=await n(r),o={data:Qy(t),domainSeparator:e},s=await Xy(i.generateOPRFRequest,JSON.stringify(o));return{mask:ky(s.mask),maskedData:ky(s.maskedData),secretElements:[ky(s.secretElements[0]),ky(s.secretElements[1])]}},async finaliseOPRF(t,e,r,i){const o=await n(i),s={serverPublicKey:Ly(t),request:{mask:Ly(e.mask),maskedData:Ly(e.maskedData),secretElements:[Ly(e.secretElements[0]),Ly(e.secretElements[1])]},responses:r.map(({publicKeyShare:t,evaluated:e,c:n,r})=>({publicKeyShare:Ly(t),evaluated:Ly(e),c:Ly(n),r:Ly(r)}))},a=await Xy(o.toprfFinalize,JSON.stringify(s));return ky(a.output)},async evaluateOPRF(t,e,r){const i=await n(r),{oprfEvaluate:o,vfree:s}=i,a={serverPrivate:Ly(t),maskedData:Ly(e)},c=Zy(o,JSON.stringify(a)),l=nB.from(eB.decode(c.r0,"unsigned char",c.r1)).toString();s(c.r0);const u=JSON.parse(l);return{evaluated:ky(u.evaluated),c:ky(u.c),r:ky(u.r)}}};async function n(n){const{ext:r,id:i}=rB[e];return zy(i,r,t,n)}}};function Sv(t,e,n){let r=Dv[e];if(r||(Dv[e]={},r=Dv[e]),!r[t]){const i="node"===iy()?"local":"remote",o="remote"===i?kv():void 0;n?.info({type:i,algorithm:t,zkBaseUrl:o},"fetching zk operator");const s="local"===i?jw():Vw({baseUrl:o}),a=Mv[e];if(!a)throw new Error(`No ZK operator maker for ${e}`);r[t]=a({algorithm:t,fetcher:s})}return r[t]}function _v(t,e,n){let r=vv[e];if(r||(vv[e]={},r=vv[e]),!r[t]){const i="node"===iy()?"local":"remote",o="remote"===i?kv():void 0;n?.info({type:i,algorithm:t,zkBaseUrl:o},"fetching oprf operator");const s="local"===i?jw():Vw({baseUrl:o}),a=Nv[e];if(!a)throw new Error(`No OPRF operator maker for ${e}`);r[t]=a({algorithm:t,fetcher:s})}return r[t]}function Lv(t){if("gnark"===t)return cm;if("snarkjs"===t)return am;throw new Error(`Unknown ZK engine: ${t}`)}function xv({key:t,iv:e,ciphertext:n,redactedPlaintext:r,slice:{fromIndex:i,toIndex:o}}){const s=n.slice(i,o),a=r.slice(i,o);if(!gy(a)){for(let t=0;t<s.length;t++)a[t]===fy&&(s[t]=fy);return{startIdx:i,redactedPlaintext:a,privateInput:{key:t},publicInput:{ciphertext:s,iv:e,offsetBytes:i}}}}function Rv({key:t,iv:e,ciphertext:n,slice:{fromIndex:r,toIndex:i},toprf:o}){const s=n.slice(r,i);if(o?.overshoot){const{overshoot:{ciphertext:n,iv:i}}=o;return{privateInput:{key:t},publicInput:[{ciphertext:s,iv:e,offsetBytes:r},{ciphertext:n,iv:i}],toprf:o,startIdx:r}}return{privateInput:{key:t},publicInput:{ciphertext:s,iv:e,offsetBytes:r},toprf:o,startIdx:r}}function Fv(t,{dataLocation:e,overshoot:n}){const r=bv(t),i=Rw(t),o=Math.floor(e.fromIndex/r);if(Math.floor((e.fromIndex+e.length)/r)===o){const t=o*r;if(n){return t+Math.ceil(n.ciphertext.length/i)*i}return t}const s=Math.floor(e.fromIndex/i)*i;if(Math.ceil((e.fromIndex+e.length)/i)-s>r)throw new Iv("ERROR_BAD_REQUEST","OPRF data cannot fit into a single chunk");return s}function kv(){return"string"!=typeof ATTESTOR_BASE_URL?Bw:new URL(Bw,ATTESTOR_BASE_URL).toString()}var Ov=s(2341);function Qv(t){return t&&Ov(t)||""}var Uv=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const Pv=new dg("abstract-provider/5.8.0");class Gv{constructor(){Pv.checkAbstract(new.target,Gv),BA(this,"_isProvider",!0)}getFeeData(){return Uv(this,void 0,void 0,function*(){const{block:t,gasPrice:e}=yield IA({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(t=>null)});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=UA.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}})}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var Vv=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const jv=new dg("abstract-signer/5.8.0"),Hv=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Yv=[dg.errors.INSUFFICIENT_FUNDS,dg.errors.NONCE_EXPIRED,dg.errors.REPLACEMENT_UNDERPRICED];class zv{constructor(){jv.checkAbstract(new.target,zv),BA(this,"_isSigner",!0)}getBalance(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)})}getTransactionCount(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)})}estimateGas(t){return Vv(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const e=yield IA(this.checkTransaction(t));return yield this.provider.estimateGas(e)})}call(t,e){return Vv(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield IA(this.checkTransaction(t));return yield this.provider.call(n,e)})}sendTransaction(t){return Vv(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)})}getChainId(){return Vv(this,void 0,void 0,function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Vv(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(t){return Vv(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)})}checkTransaction(t){for(const e in t)-1===Hv.indexOf(e)&&jv.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=CA(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then(e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&jv.throwArgumentError("from address mismatch","transaction",t),e[0])),e}populateTransaction(t){return Vv(this,void 0,void 0,function*(){const e=yield IA(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then(t=>Vv(this,void 0,void 0,function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&jv.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})),e.to.catch(t=>{}));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||jv.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):jv.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&jv.throwError("network does not support EIP-1559",dg.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):jv.throwError("failed to get consistent fee data",dg.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch(t=>{if(Yv.indexOf(t.code)>=0)throw t;return jv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",dg.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})})),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then(e=>(0!==e[1]&&e[0]!==e[1]&&jv.throwArgumentError("chainId address mismatch","transaction",t),e[0])),yield IA(e)})}_checkProvider(t){this.provider||jv.throwError("missing provider",dg.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}const Jv=new dg("strings/5.8.0");var Wv,qv;function Kv(t,e,n,r,i){if(t===qv.BAD_PREFIX||t===qv.UNEXPECTED_CONTINUE){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return t===qv.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Wv||(Wv={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(qv||(qv={}));Object.freeze({error:function(t,e,n,r,i){return Jv.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:Kv,replace:function(t,e,n,r,i){return t===qv.OVERLONG?(r.push(i),0):(r.push(65533),Kv(t,e,n))}});function Zv(t,e=Wv.current){e!=Wv.current&&(Jv.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return wg(n)}function Xv(t){return"string"==typeof t&&(t=Zv(t)),zA(yg([Zv("Ethereum Signed Message:\n"),Zv(String(t.length)),t]))}function $v(t){return zA(Zv(t))}var tM=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const eM=new dg("hash/5.8.0"),nM=new Uint8Array(32);nM.fill(0);const rM=UA.from(-1),iM=UA.from(0),oM=UA.from(1),sM=UA.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const aM=Mg(oM.toHexString(),32),cM=Mg(iM.toHexString(),32),lM={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},uM=["name","version","chainId","verifyingContract","salt"];function hM(t){return function(e){return"string"!=typeof e&&eM.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const dM={name:hM("name"),version:hM("version"),chainId:function(t){try{return UA.from(t).toString()}catch(t){}return eM.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return $A(t).toLowerCase()}catch(t){}return eM.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=wg(t);if(32!==e.length)throw new Error("bad length");return Tg(e)}catch(t){}return eM.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function pM(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&eM.throwArgumentError("invalid numeric width","type",t);const i=sM.mask(n?r-1:r),o=n?i.add(oM).mul(rM):iM;return function(e){const n=UA.from(e);return(n.lt(o)||n.gt(i))&&eM.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Mg(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&eM.throwArgumentError("invalid bytes width","type",t),function(e){return wg(e).length!==n&&eM.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=wg(t),n=e.length%32;return n?vg([e,nM.slice(n)]):Tg(e)}(e)}}}switch(t){case"address":return function(t){return Mg($A(t),32)};case"bool":return function(t){return t?aM:cM};case"bytes":return function(t){return zA(t)};case"string":return function(t){return $v(t)}}return null}function fM(t,e){return`${t}(${e.map(({name:t,type:e})=>e+" "+t).join(",")})`}class gM{constructor(t){BA(this,"types",Object.freeze(vA(t))),BA(this,"_encoderCache",{}),BA(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach(t=>{e[t]={},n[t]=[],r[t]={}});for(const r in t){const i={};t[r].forEach(o=>{i[o.name]&&eM.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const s=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];s===r&&eM.throwArgumentError(`circular type reference to ${JSON.stringify(s)}`,"types",t);pM(s)||(n[s]||eM.throwArgumentError(`unknown type ${JSON.stringify(s)}`,"types",t),n[s].push(r),e[r][s]=!0)})}const i=Object.keys(n).filter(t=>0===n[t].length);0===i.length?eM.throwArgumentError("missing primary type","types",t):i.length>1&&eM.throwArgumentError(`ambiguous primary types or unused types: ${i.map(t=>JSON.stringify(t)).join(", ")}`,"types",t),BA(this,"primaryType",i[0]),function i(o,s){s[o]&&eM.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),s[o]=!0,Object.keys(e[o]).forEach(t=>{n[t]&&(i(t,s),Object.keys(s).forEach(e=>{r[e][t]=!0}))}),delete s[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=fM(e,t[e])+n.map(e=>fM(e,t[e])).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=pM(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&eM.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(zA)),zA(vg(i))}}const n=this.types[t];if(n){const e=$v(this._types[t]);return t=>{const r=n.map(({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?zA(r):r});return r.unshift(e),vg(r)}}return eM.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||eM.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return zA(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(pM(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&eM.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map(e=>this._visit(t,e,n))}const i=this.types[t];return i?i.reduce((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t),{}):eM.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new gM(t)}static getPrimaryType(t){return gM.from(t).primaryType}static hashStruct(t,e,n){return gM.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=lM[n];r||eM.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort((t,e)=>uM.indexOf(t.name)-uM.indexOf(e.name)),gM.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return vg(["0x1901",gM.hashDomain(t),gM.from(e).hash(n)])}static hash(t,e,n){return zA(gM.encode(t,e,n))}static resolveNames(t,e,n,r){return tM(this,void 0,void 0,function*(){t=CA(t);const i={};t.verifyingContract&&!Ig(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=gM.from(e);o.visit(n,(t,e)=>("address"!==t||Ig(e,20)||(i[e]="0x"),e));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,(t,e)=>"address"===t&&i[e]?i[e]:e),{domain:t,value:n}})}static getPayload(t,e,n){gM.hashDomain(t);const r={},i=[];uM.forEach(e=>{const n=t[e];null!=n&&(r[e]=dM[e](n),i.push({name:e,type:lM[e]}))});const o=gM.from(e),s=CA(e);return s.EIP712Domain?eM.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):s.EIP712Domain=i,o.encode(n),{types:s,domain:r,primaryType:o.primaryType,message:o.visit(n,(t,e)=>{if(t.match(/^bytes(\d*)/))return Tg(wg(e));if(t.match(/^u?int/))return UA.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&eM.throwArgumentError("invalid string","value",e),e}return eM.throwArgumentError("unsupported type","type",t)})}}}class AM{constructor(t){BA(this,"alphabet",t),BA(this,"base",t.length),BA(this,"_alphabetMap",{}),BA(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=wg(t);if(0===e.length)return"";let n=[0];for(let t=0;t<e.length;++t){let r=e[t];for(let t=0;t<n.length;++t)r+=n[t]<<8,n[t]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t<e.length-1;++t)r+=this._leader;for(let t=n.length-1;t>=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n<t.length;n++){let r=this._alphabetMap[t[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let t=0;t<e.length;++t)i+=e[t]*this.base,e[t]=255&i,i>>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n<t.length-1;++n)e.push(0);return wg(new Uint8Array(e.reverse()))}}new AM("abcdefghijklmnopqrstuvwxyz234567");const EM=new AM("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var mM;!function(t){t.sha256="sha256",t.sha512="sha512"}(mM||(mM={}));const wM=new dg("sha2/5.8.0");function yM(t){return"0x"+kg().sha256().update(wg(t)).digest("hex")}function BM(t,e,n){return mM[t]||wM.throwError("unsupported algorithm "+t,dg.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:t}),"0x"+kg().hmac(kg()[t],wg(e)).update(wg(n)).digest("hex")}function IM(t,e,n,r,i){let o;t=wg(t),e=wg(e);let s=1;const a=new Uint8Array(r),c=new Uint8Array(e.length+4);let l,u;c.set(e);for(let h=1;h<=s;h++){c[e.length]=h>>24&255,c[e.length+1]=h>>16&255,c[e.length+2]=h>>8&255,c[e.length+3]=255&h;let d=wg(BM(i,t,c));o||(o=d.length,u=new Uint8Array(o),s=Math.ceil(r/o),l=r-(s-1)*o),u.set(d);for(let e=1;e<n;e++){d=wg(BM(i,t,d));for(let t=0;t<o;t++)u[t]^=d[t]}const p=(h-1)*o,f=h===s?l:o;a.set(wg(u).slice(0,f),p)}return Tg(a)}const CM=new dg("wordlists/5.8.0");class TM{constructor(t){CM.checkAbstract(new.target,TM),BA(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const e=[];for(let n=0;n<2048;n++){const r=t.getWord(n);if(n!==t.getWordIndex(r))return"0x";e.push(r)}return $v(e.join("\n")+"\n")}static register(t,e){e||(e=t.locale)}}let bM=null;function DM(t){if(null==bM&&(bM="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==TM.check(t)))throw bM=null,new Error("BIP39 Wordlist for en (English) FAILED")}const vM=new class extends TM{constructor(){super("en")}getWord(t){return DM(this),bM[t]}getWordIndex(t){return DM(this),bM.indexOf(t)}};TM.register(vM);const MM={en:vM},NM=new dg("hdnode/5.8.0"),SM=UA.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_M=Zv("Bitcoin seed"),LM=2147483648;function xM(t){return(1<<t)-1<<8-t}function RM(t){return(1<<t)-1}function FM(t){return Mg(Tg(t),32)}function kM(t){return EM.encode(yg([t,Dg(yM(yM(t)),0,4)]))}function OM(t){if(null==t)return MM.en;if("string"==typeof t){const e=MM[t];return null==e&&NM.throwArgumentError("unknown locale","wordlist",t),e}return t}const QM={},UM="m/44'/60'/0'/0/0";class PM{constructor(t,e,n,r,i,o,s,a){if(t!==QM)throw new Error("HDNode constructor cannot be called directly");if(e){const t=new LA(e);BA(this,"privateKey",t.privateKey),BA(this,"publicKey",t.compressedPublicKey)}else BA(this,"privateKey",null),BA(this,"publicKey",Tg(n));var c;BA(this,"parentFingerprint",r),BA(this,"fingerprint",Dg((c=yM(this.publicKey),"0x"+kg().ripemd160().update(wg(c)).digest("hex")),0,4)),BA(this,"address",cE(this.publicKey)),BA(this,"chainCode",i),BA(this,"index",o),BA(this,"depth",s),null==a?(BA(this,"mnemonic",null),BA(this,"path",null)):"string"==typeof a?(BA(this,"mnemonic",null),BA(this,"path",a)):(BA(this,"mnemonic",a),BA(this,"path",a.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return kM(yg([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",Tg(this.depth),this.parentFingerprint,Mg(Tg(this.index),4),this.chainCode,null!=this.privateKey?yg(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new PM(QM,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let e=this.path;e&&(e+="/"+(2147483647&t));const n=new Uint8Array(37);if(t&LM){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set(wg(this.privateKey),1),e&&(e+="'")}else n.set(wg(this.publicKey));for(let e=24;e>=0;e-=8)n[33+(e>>3)]=t>>24-e&255;const r=wg(BM(mM.sha512,this.chainCode,n)),i=r.slice(0,32),o=r.slice(32);let s=null,a=null;if(this.privateKey)s=FM(UA.from(i).add(this.privateKey).mod(SM));else{a=new LA(Tg(i))._addPoint(this.publicKey)}let c=e;const l=this.mnemonic;return l&&(c=Object.freeze({phrase:l.phrase,path:e,locale:l.locale||"en"})),new PM(QM,s,a,this.fingerprint,FM(o),t,this.depth+1,c)}derivePath(t){const e=t.split("/");if(0===e.length||"m"===e[0]&&0!==this.depth)throw new Error("invalid path - "+t);"m"===e[0]&&e.shift();let n=this;for(let t=0;t<e.length;t++){const r=e[t];if(r.match(/^[0-9]+'$/)){const t=parseInt(r.substring(0,r.length-1));if(t>=LM)throw new Error("invalid path index - "+r);n=n._derive(LM+t)}else{if(!r.match(/^[0-9]+$/))throw new Error("invalid path component - "+r);{const t=parseInt(r);if(t>=LM)throw new Error("invalid path index - "+r);n=n._derive(t)}}}return n}static _fromSeed(t,e){const n=wg(t);if(n.length<16||n.length>64)throw new Error("invalid seed");const r=wg(BM(mM.sha512,_M,n));return new PM(QM,FM(r.slice(0,32)),null,"0x00000000",FM(r.slice(32)),0,0,e)}static fromMnemonic(t,e,n){return t=VM(GM(t,n=OM(n)),n),PM._fromSeed(function(t,e){e||(e="");const n=Zv("mnemonic"+e,Wv.NFKD);return IM(Zv(t,Wv.NFKD),n,2048,64,"sha512")}(t,e),{phrase:t,path:"m",locale:n.locale})}static fromSeed(t){return PM._fromSeed(t,null)}static fromExtendedKey(t){const e=EM.decode(t);82===e.length&&kM(e.slice(0,78))===t||NM.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const n=e[4],r=Tg(e.slice(5,9)),i=parseInt(Tg(e.slice(9,13)).substring(2),16),o=Tg(e.slice(13,45)),s=e.slice(45,78);switch(Tg(e.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new PM(QM,null,Tg(s),r,o,i,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new PM(QM,Tg(s.slice(1)),null,r,o,i,n,null)}return NM.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function GM(t,e){e=OM(e),NM.checkNormalize();const n=e.split(t);if(n.length%3!=0)throw new Error("invalid mnemonic");const r=wg(new Uint8Array(Math.ceil(11*n.length/8)));let i=0;for(let t=0;t<n.length;t++){let o=e.getWordIndex(n[t].normalize("NFKD"));if(-1===o)throw new Error("invalid mnemonic");for(let t=0;t<11;t++)o&1<<10-t&&(r[i>>3]|=1<<7-i%8),i++}const o=32*n.length/3,s=xM(n.length/3);if((wg(yM(r.slice(0,o/8)))[0]&s)!==(r[r.length-1]&s))throw new Error("invalid checksum");return Tg(r.slice(0,o/8))}function VM(t,e){if(e=OM(e),(t=wg(t)).length%4!=0||t.length<16||t.length>32)throw new Error("invalid entropy");const n=[0];let r=11;for(let e=0;e<t.length;e++)r>8?(n[n.length-1]<<=8,n[n.length-1]|=t[e],r-=8):(n[n.length-1]<<=r,n[n.length-1]|=t[e]>>8-r,n.push(t[e]&RM(8-r)),r+=3);const i=t.length/4,o=wg(yM(t))[0]&xM(i);return n[n.length-1]<<=i,n[n.length-1]|=o>>8-i,e.join(n.map(t=>e.getWord(t)))}const jM=new dg("random/5.8.0");const HM=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==s.g)return s.g;throw new Error("unable to locate global object")}();let YM=HM.crypto||HM.msCrypto;function zM(t){(t<=0||t>1024||t%1||t!=t)&&jM.throwArgumentError("invalid length","length",t);const e=new Uint8Array(t);return YM.getRandomValues(e),wg(e)}YM&&YM.getRandomValues||(jM.warn("WARNING: Missing strong random number source"),YM={getRandomValues:function(t){return jM.throwError("no secure random source avaialble",dg.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var JM=s(2872),WM=s.n(JM),qM=s(9983),KM=s.n(qM);function ZM(t){return"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),wg(t)}function XM(t,e){for(t=String(t);t.length<e;)t="0"+t;return t}function $M(t){return"string"==typeof t?Zv(t,Wv.NFKC):wg(t)}function tN(t,e){let n=t;const r=e.toLowerCase().split("/");for(let t=0;t<r.length;t++){let e=null;for(const i in n)if(i.toLowerCase()===r[t]){e=n[i];break}if(null===e)return null;n=e}return n}function eN(t){const e=wg(t);e[6]=15&e[6]|64,e[8]=63&e[8]|128;const n=Tg(e);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const nN="json-wallets/5.8.0";var rN=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const iN=new dg(nN);function oN(t){return null!=t&&t.mnemonic&&t.mnemonic.phrase}class sN extends MA{isKeystoreAccount(t){return!(!t||!t._isKeystoreAccount)}}function aN(t,e){const n=ZM(tN(t,"crypto/ciphertext"));if(Tg(zA(yg([e.slice(16,32),n]))).substring(2)!==tN(t,"crypto/mac").toLowerCase())throw new Error("invalid password");const r=function(t,e,n){if("aes-128-ctr"===tN(t,"crypto/cipher")){const r=ZM(tN(t,"crypto/cipherparams/iv")),i=new(WM().Counter)(r);return wg(new(WM().ModeOfOperation.ctr)(e,i).decrypt(n))}return null}(t,e.slice(0,16),n);r||iN.throwError("unsupported cipher",dg.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=e.slice(32,64),o=cE(r);if(t.address){let e=t.address.toLowerCase();if("0x"!==e.substring(0,2)&&(e="0x"+e),$A(e)!==o)throw new Error("address mismatch")}const s={_isKeystoreAccount:!0,address:o,privateKey:Tg(r)};if("0.1"===tN(t,"x-ethers/version")){const e=ZM(tN(t,"x-ethers/mnemonicCiphertext")),n=ZM(tN(t,"x-ethers/mnemonicCounter")),r=new(WM().Counter)(n),o=new(WM().ModeOfOperation.ctr)(i,r),a=tN(t,"x-ethers/path")||UM,c=tN(t,"x-ethers/locale")||"en",l=wg(o.decrypt(e));try{const t=VM(l,c),e=PM.fromMnemonic(t,null,c).derivePath(a);if(e.privateKey!=s.privateKey)throw new Error("mnemonic mismatch");s.mnemonic=e.mnemonic}catch(t){if(t.code!==dg.errors.INVALID_ARGUMENT||"wordlist"!==t.argument)throw t}}return new sN(s)}function cN(t,e,n,r,i){return wg(IM(t,e,n,r,i))}function lN(t,e,n,r,i){return Promise.resolve(cN(t,e,n,r,i))}function uN(t,e,n,r,i){const o=$M(e),s=tN(t,"crypto/kdf");if(s&&"string"==typeof s){const e=function(t,e){return iN.throwArgumentError("invalid key-derivation function parameters",t,e)};if("scrypt"===s.toLowerCase()){const n=ZM(tN(t,"crypto/kdfparams/salt")),a=parseInt(tN(t,"crypto/kdfparams/n")),c=parseInt(tN(t,"crypto/kdfparams/r")),l=parseInt(tN(t,"crypto/kdfparams/p"));a&&c&&l||e("kdf",s),a&a-1&&e("N",a);const u=parseInt(tN(t,"crypto/kdfparams/dklen"));return 32!==u&&e("dklen",u),r(o,n,a,c,l,64,i)}if("pbkdf2"===s.toLowerCase()){const r=ZM(tN(t,"crypto/kdfparams/salt"));let i=null;const s=tN(t,"crypto/kdfparams/prf");"hmac-sha256"===s?i="sha256":"hmac-sha512"===s?i="sha512":e("prf",s);const a=parseInt(tN(t,"crypto/kdfparams/c")),c=parseInt(tN(t,"crypto/kdfparams/dklen"));return 32!==c&&e("dklen",c),n(o,r,a,c,i)}}return iN.throwArgumentError("unsupported key-derivation function","kdf",s)}const hN=new dg(nN);class dN extends MA{isCrowdsaleAccount(t){return!(!t||!t._isCrowdsaleAccount)}}function pN(t,e){const n=JSON.parse(t);e=$M(e);const r=$A(tN(n,"ethaddr")),i=ZM(tN(n,"encseed"));i&&i.length%16==0||hN.throwArgumentError("invalid encseed","json",t);const o=wg(IM(e,e,2e3,32,"sha256")).slice(0,16),s=i.slice(0,16),a=i.slice(16),c=new(WM().ModeOfOperation.cbc)(o,s),l=WM().padding.pkcs7.strip(wg(c.decrypt(a)));let u="";for(let t=0;t<l.length;t++)u+=String.fromCharCode(l[t]);const h=zA(Zv(u));return new dN({_isCrowdsaleAccount:!0,address:r,privateKey:h})}function fN(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return e.encseed&&e.ethaddr}function gN(t){let e=null;try{e=JSON.parse(t)}catch(t){return!1}return!(!e.version||parseInt(e.version)!==e.version||3!==parseInt(e.version))}function AN(t,e,n){if(fN(t)){n&&n(0);const r=pN(t,e);return n&&n(1),Promise.resolve(r)}return gN(t)?function(t,e,n){return rN(this,void 0,void 0,function*(){const r=JSON.parse(t);return aN(r,yield uN(r,e,lN,KM().scrypt,n))})}(t,e,n):Promise.reject(new Error("invalid JSON wallet"))}function EN(t,e){if(fN(t))return pN(t,e);if(gN(t))return function(t,e){const n=JSON.parse(t);return aN(n,uN(n,e,cN,KM().syncScrypt))}(t,e);throw new Error("invalid JSON wallet")}var mN=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}c((r=r.apply(t,e||[])).next())})};const wN=new dg("wallet/5.8.0");class yN extends zv{constructor(t,e){if(super(),null!=(n=t)&&Ig(n.privateKey,32)&&null!=n.address){const e=new LA(t.privateKey);if(BA(this,"_signingKey",()=>e),BA(this,"address",cE(this.publicKey)),this.address!==$A(t.address)&&wN.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(t){const e=t.mnemonic;return e&&e.phrase}(t)){const e=t.mnemonic;BA(this,"_mnemonic",()=>({phrase:e.phrase,path:e.path||UM,locale:e.locale||"en"}));const n=this.mnemonic;cE(PM.fromMnemonic(n.phrase,null,n.locale).derivePath(n.path).privateKey)!==this.address&&wN.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else BA(this,"_mnemonic",()=>null)}else{if(LA.isSigningKey(t))"secp256k1"!==t.curve&&wN.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),BA(this,"_signingKey",()=>t);else{"string"==typeof t&&t.match(/^[0-9a-f]*$/i)&&64===t.length&&(t="0x"+t);const e=new LA(t);BA(this,"_signingKey",()=>e)}BA(this,"_mnemonic",()=>null),BA(this,"address",cE(this.publicKey))}var n;e&&!Gv.isProvider(e)&&wN.throwArgumentError("invalid provider","provider",e),BA(this,"provider",e||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new yN(this,t)}signTransaction(t){return IA(t).then(e=>{null!=e.from&&($A(e.from)!==this.address&&wN.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete e.from);const n=this._signingKey().signDigest(zA(EE(e)));return EE(e,n)})}signMessage(t){return mN(this,void 0,void 0,function*(){return Sg(this._signingKey().signDigest(Xv(t)))})}_signTypedData(t,e,n){return mN(this,void 0,void 0,function*(){const r=yield gM.resolveNames(t,e,n,t=>(null==this.provider&&wN.throwError("cannot resolve ENS names without a provider",dg.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:t}),this.provider.resolveName(t)));return Sg(this._signingKey().signDigest(gM.hash(r.domain,e,r.value)))})}encrypt(t,e,n){if("function"!=typeof e||n||(n=e,e={}),n&&"function"!=typeof n)throw new Error("invalid callback");return e||(e={}),function(t,e,n,r){try{if($A(t.address)!==cE(t.privateKey))throw new Error("address/privateKey mismatch");if(oN(t)){const e=t.mnemonic;if(PM.fromMnemonic(e.phrase,null,e.locale).derivePath(e.path||UM).privateKey!=t.privateKey)throw new Error("mnemonic mismatch")}}catch(t){return Promise.reject(t)}"function"!=typeof n||r||(r=n,n={}),n||(n={});const i=wg(t.privateKey),o=$M(e);let s=null,a=null,c=null;if(oN(t)){const e=t.mnemonic;s=wg(GM(e.phrase,e.locale||"en")),a=e.path||UM,c=e.locale||"en"}let l=n.client;l||(l="ethers.js");let u=null;u=n.salt?wg(n.salt):zM(32);let h=null;if(n.iv){if(h=wg(n.iv),16!==h.length)throw new Error("invalid iv")}else h=zM(16);let d=null;if(n.uuid){if(d=wg(n.uuid),16!==d.length)throw new Error("invalid uuid")}else d=zM(16);let p=1<<17,f=8,g=1;return n.scrypt&&(n.scrypt.N&&(p=n.scrypt.N),n.scrypt.r&&(f=n.scrypt.r),n.scrypt.p&&(g=n.scrypt.p)),KM().scrypt(o,u,p,f,g,64,r).then(e=>{const n=(e=wg(e)).slice(0,16),r=e.slice(16,32),o=e.slice(32,64),A=new(WM().Counter)(h),E=wg(new(WM().ModeOfOperation.ctr)(n,A).encrypt(i)),m=zA(yg([r,E])),w={address:t.address.substring(2).toLowerCase(),id:eN(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:Tg(h).substring(2)},ciphertext:Tg(E).substring(2),kdf:"scrypt",kdfparams:{salt:Tg(u).substring(2),n:p,dklen:32,p:g,r:f},mac:m.substring(2)}};if(s){const t=zM(16),e=new(WM().Counter)(t),n=wg(new(WM().ModeOfOperation.ctr)(o,e).encrypt(s)),r=new Date,i=r.getUTCFullYear()+"-"+XM(r.getUTCMonth()+1,2)+"-"+XM(r.getUTCDate(),2)+"T"+XM(r.getUTCHours(),2)+"-"+XM(r.getUTCMinutes(),2)+"-"+XM(r.getUTCSeconds(),2)+".0Z";w["x-ethers"]={client:l,gethFilename:"UTC--"+i+"--"+w.address,mnemonicCounter:Tg(t).substring(2),mnemonicCiphertext:Tg(n).substring(2),path:a,locale:c,version:"0.1"}}return JSON.stringify(w)})}(this,t,e,n)}static createRandom(t){let e=zM(16);t||(t={}),t.extraEntropy&&(e=wg(Dg(zA(yg([e,t.extraEntropy])),0,16)));const n=VM(e,t.locale);return yN.fromMnemonic(n,t.path,t.locale)}static fromEncryptedJson(t,e,n){return AN(t,e,n).then(t=>new yN(t))}static fromEncryptedJsonSync(t,e){return new yN(EN(t,e))}static fromMnemonic(t,e,n){return e||(e=UM),new yN(PM.fromMnemonic(t,null,n).derivePath(e))}}const{Kt:BN,uN:IN}=n,CN={getPublicKey:t=>wg(IN(t,!0)),getAddress:t=>BN(t).toLowerCase(),async sign(t,e){const n=function(t){if(!t)throw new Error("Private key missing");return new yN(t)}(e);return wg(await n.signMessage(t))},async verify(t,e,n){const r="string"==typeof n?n:Tg(n),i=function(t,e){return lE(Xv(t),e)}(t,e);return i.toLowerCase()===r.toLowerCase()}};const TN={[WE]:CN};s(1357);Event;const bN=["TLS_CHACHA20_POLY1305_SHA256","TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256","TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256","TLS_AES_256_GCM_SHA384","TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384","TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384","TLS_AES_128_GCM_SHA256","TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256","TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256","TLS_RSA_WITH_AES_128_GCM_SHA256"],DN="node"===iy()?P:P.filter(t=>"X25519"!==t);function vN(){return{cipherSuites:bN,namedCurves:DN}}async function MN(t){const e=await async function(t){if(t instanceof ArrayBuffer)return new Uint8Array(t);if(t instanceof Uint8Array||"object"==typeof t&&t&&"buffer"in t)return t;if("string"==typeof t)return Yw(t);if("undefined"!=typeof Blob&&t instanceof Blob)return new Uint8Array(await t.arrayBuffer());throw new Error("unsupported data: "+String(t))}(t),{messages:n}=gw.decode(e);for(const t of n)await NN.call(this,t)}function NN(t){if(this.logger?.trace({msg:t},"received message"),t.connectionTerminationAlert){const e=Iv.fromProto(t.connectionTerminationAlert);return this.logger?.warn({err:"ERROR_NO_ERROR"!==e.code?e:void 0},"received connection termination alert"),void this.dispatchRPCEvent("connection-terminated",e)}const e=function(t){if(t.requestError)return{direction:"response",type:"error"};for(const e in t){if(!t[e])continue;const n=Xw(e);if(n)return n}}(t);if(e){if("response"===e.direction&&"error"===e.type)return void this.dispatchRPCEvent("rpc-response",{id:t.id,error:Iv.fromProto(t.requestError)});const n=`${e.type}Response`;return"response"===e.direction?void this.dispatchRPCEvent("rpc-response",{id:t.id,type:e.type,data:t[n]}):this.isInitialised||"init"===e.type?new Promise((r,i)=>{this.dispatchRPCEvent("rpc-request",{requestId:t.id,type:e.type,data:t[$w(e.type)],respond:o=>this.isOpen?"code"in o?(i(o),this.sendMessage({id:t.id,requestError:o.toProto()})):(r(),this.sendMessage({id:t.id,[n]:o})):(this.logger?.debug({type:e.type,res:o},"connection closed before responding"),void i(new Error("connection closed")))})}):(this.logger.warn({type:e.type},"RPC request received before initialisation"),void this.sendMessage({id:t.id,requestError:Iv.badRequest("Initialise connection first").toProto()}))}t.tunnelMessage?this.dispatchRPCEvent("tunnel-message",t.tunnelMessage):t.tunnelDisconnectEvent?this.dispatchRPCEvent("tunnel-disconnect-event",t.tunnelDisconnectEvent):this.logger.warn({msg:t},"unhandled message")}TLS_ADDITIONAL_ROOT_CA_LIST.push("-----BEGIN CERTIFICATE-----\nMIIEszCCA5ugAwIBAgIQCyWUIs7ZgSoVoE6ZUooO+jANBgkqhkiG9w0BAQsFADBh\nMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\nd3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH\nMjAeFw0xNzExMDIxMjI0MzNaFw0yNzExMDIxMjI0MzNaMGAxCzAJBgNVBAYTAlVT\nMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j\nb20xHzAdBgNVBAMTFlJhcGlkU1NMIFRMUyBSU0EgQ0EgRzEwggEiMA0GCSqGSIb3\nDQEBAQUAA4IBDwAwggEKAoIBAQC/uVklRBI1FuJdUEkFCuDL/I3aJQiaZ6aibRHj\nap/ap9zy1aYNrphe7YcaNwMoPsZvXDR+hNJOo9gbgOYVTPq8gXc84I75YKOHiVA4\nNrJJQZ6p2sJQyqx60HkEIjzIN+1LQLfXTlpuznToOa1hyTD0yyitFyOYwURM+/CI\n8FNFMpBhw22hpeAQkOOLmsqT5QZJYeik7qlvn8gfD+XdDnk3kkuuu0eG+vuyrSGr\n5uX5LRhFWlv1zFQDch/EKmd163m6z/ycx/qLa9zyvILc7cQpb+k7TLra9WE17YPS\nn9ANjG+ECo9PDW3N9lwhKQCNvw1gGoguyCQu7HE7BnW8eSSFAgMBAAGjggFmMIIB\nYjAdBgNVHQ4EFgQUDNtsgkkPSmcKuBTuesRIUojrVjgwHwYDVR0jBBgwFoAUTiJU\nIBiV5uNu5g/6+rkS7QYXjzkwDgYDVR0PAQH/BAQDAgGGMB0GA1UdJQQWMBQGCCsG\nAQUFBwMBBggrBgEFBQcDAjASBgNVHRMBAf8ECDAGAQH/AgEAMDQGCCsGAQUFBwEB\nBCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEIGA1Ud\nHwQ7MDkwN6A1oDOGMWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEds\nb2JhbFJvb3RHMi5jcmwwYwYDVR0gBFwwWjA3BglghkgBhv1sAQEwKjAoBggrBgEF\nBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzALBglghkgBhv1sAQIw\nCAYGZ4EMAQIBMAgGBmeBDAECAjANBgkqhkiG9w0BAQsFAAOCAQEAGUSlOb4K3Wtm\nSlbmE50UYBHXM0SKXPqHMzk6XQUpCheF/4qU8aOhajsyRQFDV1ih/uPIg7YHRtFi\nCTq4G+zb43X1T77nJgSOI9pq/TqCwtukZ7u9VLL3JAq3Wdy2moKLvvC8tVmRzkAe\n0xQCkRKIjbBG80MSyDX/R4uYgj6ZiNT/Zg6GI6RofgqgpDdssLc0XIRQEotxIZcK\nzP3pGJ9FCbMHmMLLyuBd+uCWvVcF2ogYAawufChS/PT61D9rqzPRS5I2uqa3tmIT\n44JhJgWhBnFMb7AGQkvNq9KNS9dd3GWc17H/dXa1enoxzWjE0hBdFjxPhUb0W3wi\n8o34/m8Fxw==\n-----END CERTIFICATE-----");class SN{eventTarget=new EventTarget;socket;logger;metadata;isInitialised=!1;constructor(t,e,n){this.socket=t,this.metadata=e,this.logger=n,t.addEventListener("error",t=>{const e=Iv.fromError(t.error||new Error(t.message),"ERROR_NETWORK_ERROR");this.dispatchRPCEvent("connection-terminated",e)}),t.addEventListener("close",()=>this.dispatchRPCEvent("connection-terminated",new Iv("ERROR_NO_ERROR","connection closed"))),t.addEventListener("message",async t=>{try{await MN.call(this,t.data)}catch(t){this.logger.error({err:t},"error processing message")}})}get isOpen(){return this.socket.readyState===this.socket.OPEN}get isClosed(){return this.socket.readyState===this.socket.CLOSED||this.socket.readyState===this.socket.CLOSING}async sendMessage(...t){if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Connection closed, cannot send message");if(!this.isOpen)throw new Iv("ERROR_NETWORK_ERROR","Wait for connection to open before sending message");const e=ey(...t),n=gw.encode(e).finish();return this.logger.trace({msg:e},"sending messages"),"sendPromise"in this.socket&&this.socket.sendPromise?await this.socket.sendPromise(n):this.socket.send(n),e}dispatchRPCEvent(t,e){const n=function(t,e){const n=new Event(t);return n.data=e,n}(t,e);this.eventTarget.dispatchEvent(n)}addEventListener(t,e){this.eventTarget.addEventListener(t,e)}removeEventListener(t,e){this.eventTarget.removeEventListener(t,e)}async terminateConnection(t){if(!this.isClosed)try{const e=t?Iv.fromError(t):new Iv("ERROR_NO_ERROR","");this.dispatchRPCEvent("connection-terminated",e),this.isOpen&&await this.sendMessage({connectionTerminationAlert:e.toProto()})}catch(t){this.logger?.error({err:t},"error terminating connection")}finally{this.socket.close()}}}function _N(t){return new WebSocket(t)}const{K3:LN}=n;class xN extends SN{waitForInitPromise;initResponse;constructor({url:t,initMessages:e=[],signatureType:n=Iw.signatureType,logger:r=uy,authRequest:i,makeWebSocket:o=_N}){const s={...Iw,signatureType:n,auth:i},a=ey({initRequest:s},...e),c=gw.encode(a).finish(),l=LN.encode(c);(t=new URL(t.toString())).searchParams.set("messages",l),super(o(t),s,r);const u=a.messages[0].id;this.waitForInitPromise=this.waitForResponse(u,Tw).then(t=>{r.info("client initialised"),this.isInitialised=!0,this.initResponse=t}),this.waitForInitPromise.catch(()=>{}),this.addEventListener("connection-terminated",t=>r.info({err:t.data},"connection terminated"))}async rpc(t,e,n=9e4){const r=Kw();this.logger.debug({type:t,id:r},"sending rpc request");const i=Date.now();try{const i=this.waitForResponse(r,n);return await this.sendMessage({id:r,[$w(t)]:e}),await i}finally{const e=Date.now()-i;this.logger.debug({type:t,timeTakenMs:e},"received rpc response")}}waitForResponse(t,e=9e4){if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Client connection already closed");return new Promise((n,r)=>{const i=e=>{e.data.id===t&&(a(),"error"in e.data?r(e.data.error):n(e.data.data))},o=t=>{a(),"ERROR_NO_ERROR"!==t.data.code?r(t.data):r(new Iv("ERROR_NETWORK_ERROR",t.data.message,t.data.data))},s=setTimeout(()=>{a(),r(new Iv("ERROR_TIMEOUT",`RPC request timed out after ${e}ms`,{id:t}))},e),a=()=>{clearTimeout(s),this.removeEventListener("rpc-response",i),this.removeEventListener("connection-terminated",o)};this.addEventListener("rpc-response",i),this.addEventListener("connection-terminated",o)})}waitForInit=()=>{if(this.isClosed)throw new Iv("ERROR_NETWORK_ERROR","Client connection already closed");return this.waitForInitPromise}}var RN;!function(t){t.AssignmentExpression="AssignmentExpression",t.AssignmentPattern="AssignmentPattern",t.ArrayExpression="ArrayExpression",t.ArrayPattern="ArrayPattern",t.ArrowFunctionExpression="ArrowFunctionExpression",t.AwaitExpression="AwaitExpression",t.BlockStatement="BlockStatement",t.BinaryExpression="BinaryExpression",t.BreakStatement="BreakStatement",t.CallExpression="CallExpression",t.CatchClause="CatchClause",t.ChainExpression="ChainExpression",t.ClassBody="ClassBody",t.ClassDeclaration="ClassDeclaration",t.ClassExpression="ClassExpression",t.ConditionalExpression="ConditionalExpression",t.ContinueStatement="ContinueStatement",t.Decorator="Decorator",t.DoWhileStatement="DoWhileStatement",t.DebuggerStatement="DebuggerStatement",t.EmptyStatement="EmptyStatement",t.ExportAllDeclaration="ExportAllDeclaration",t.ExportDefaultDeclaration="ExportDefaultDeclaration",t.ExportNamedDeclaration="ExportNamedDeclaration",t.ExportSpecifier="ExportSpecifier",t.ExpressionStatement="ExpressionStatement",t.ForStatement="ForStatement",t.ForOfStatement="ForOfStatement",t.ForInStatement="ForInStatement",t.FunctionDeclaration="FunctionDeclaration",t.FunctionExpression="FunctionExpression",t.Identifier="Identifier",t.IfStatement="IfStatement",t.ImportAttribute="ImportAttribute",t.ImportExpression="ImportExpression",t.ImportDeclaration="ImportDeclaration",t.ImportDefaultSpecifier="ImportDefaultSpecifier",t.ImportNamespaceSpecifier="ImportNamespaceSpecifier",t.ImportSpecifier="ImportSpecifier",t.Literal="Literal",t.LabeledStatement="LabeledStatement",t.LogicalExpression="LogicalExpression",t.MemberExpression="MemberExpression",t.MetaProperty="MetaProperty",t.MethodDefinition="MethodDefinition",t.NewExpression="NewExpression",t.ObjectExpression="ObjectExpression",t.ObjectPattern="ObjectPattern",t.Program="Program",t.Property="Property",t.PrivateIdentifier="PrivateIdentifier",t.RestElement="RestElement",t.ReturnStatement="ReturnStatement",t.SequenceExpression="SequenceExpression",t.SpreadElement="SpreadElement",t.StaticBlock="StaticBlock",t.Super="Super",t.SwitchCase="SwitchCase",t.SwitchStatement="SwitchStatement",t.TaggedTemplateExpression="TaggedTemplateExpression",t.TemplateElement="TemplateElement",t.TemplateLiteral="TemplateLiteral",t.ThisExpression="ThisExpression",t.ThrowStatement="ThrowStatement",t.TryStatement="TryStatement",t.UnaryExpression="UnaryExpression",t.UpdateExpression="UpdateExpression",t.VariableDeclaration="VariableDeclaration",t.VariableDeclarator="VariableDeclarator",t.WhileStatement="WhileStatement",t.WithStatement="WithStatement",t.YieldExpression="YieldExpression"}(RN||(RN={}));class FN{constructor(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}insertInnerComments(t,e){if(t.type===RN.BlockStatement&&0===t.body.length){const n=[];for(let t=this.leading.length-1;t>=0;--t){const r=this.leading[t];e.end.offset>=r.start&&(n.unshift(r.comment),this.leading.splice(t,1),this.trailing.splice(t,1))}n.length&&(t.innerComments=n)}}findTrailingComments(t){let e=[];if(this.trailing.length>0){for(let n=this.trailing.length-1;n>=0;--n){const r=this.trailing[n];r.start>=t.end.offset&&e.unshift(r.comment)}return this.trailing.length=0,e}const n=this.stack[this.stack.length-1];if(n&&n.node.trailingComments){const r=n.node.trailingComments[0];r&&r.range[0]>=t.end.offset&&(e=n.node.trailingComments,delete n.node.trailingComments)}return e}findLeadingComments(t){const e=[];let n;for(;this.stack.length>0;){const e=this.stack[this.stack.length-1];if(!(e&&e.start>=t.start.offset))break;n=e.node,this.stack.pop()}if(n){for(let r=(n.leadingComments?n.leadingComments.length:0)-1;r>=0;--r){const i=n.leadingComments[r];i.range[1]<=t.start.offset&&(e.unshift(i),n.leadingComments.splice(r,1))}return n.leadingComments&&0===n.leadingComments.length&&delete n.leadingComments,e}for(let n=this.leading.length-1;n>=0;--n){const r=this.leading[n];r.start<=t.start.offset&&(e.unshift(r.comment),this.leading.splice(n,1))}return e}visitNode(t,e){if(t.type===RN.Program&&t.body.length>0)return;this.insertInnerComments(t,e);const n=this.findTrailingComments(e),r=this.findLeadingComments(e);r.length>0&&(t.leadingComments=r),n.length>0&&(t.trailingComments=n),this.stack.push({node:t,start:e.start.offset})}visitComment(t,e){const n="L"===t.type[0]?"Line":"Block",r={type:n,value:t.value};if(t.range&&(r.range=t.range),t.loc&&(r.loc=t.loc),this.comments.push(r),this.attach){const r={comment:{type:n,value:t.value,range:[e.start.offset,e.end.offset]},start:e.start.offset};t.loc&&(r.comment.loc=t.loc),t.type=n,this.leading.push(r),this.trailing.push(r)}}visit(t,e){"LineComment"===t.type||"BlockComment"===t.type?this.visitComment(t,e):this.attach&&this.visitNode(t,e)}}const kN={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},ON={fromCodePoint:t=>t<65536?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10))+String.fromCharCode(56320+(t-65536&1023)),isStringWellFormedUnicode(t){for(let e=0;e<t.length;e++){let n=t.charCodeAt(e);if(n>=55296&&n<=56319){if(e===t.length-1)return!1;if(e++,n=t.charCodeAt(e),n<56320&&n>57343)return!1}else if(n>=56320&&n<=57343)return!1}return!0},isWhiteSpace:t=>32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0,isLineTerminator:t=>10===t||13===t||8232===t||8233===t,isIdentifierStart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&kN.NonAsciiIdentifierStart.test(ON.fromCodePoint(t)),isIdentifierPart:t=>36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&kN.NonAsciiIdentifierPart.test(ON.fromCodePoint(t)),isDecimalDigit:t=>t>=48&&t<=57,isDecimalDigitChar:t=>1===t.length&&ON.isDecimalDigit(t.charCodeAt(0)),isHexDigit:t=>t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102,isHexDigitChar:t=>1===t.length&&ON.isHexDigit(t.charCodeAt(0)),isOctalDigit:t=>t>=48&&t<=55,isOctalDigitChar:t=>1===t.length&&ON.isOctalDigit(t.charCodeAt(0))};var QN;!function(t){t.JSXAttribute="JSXAttribute",t.JSXClosingElement="JSXClosingElement",t.JSXClosingFragment="JSXClosingFragment",t.JSXElement="JSXElement",t.JSXEmptyExpression="JSXEmptyExpression",t.JSXExpressionContainer="JSXExpressionContainer",t.JSXIdentifier="JSXIdentifier",t.JSXMemberExpression="JSXMemberExpression",t.JSXNamespacedName="JSXNamespacedName",t.JSXOpeningElement="JSXOpeningElement",t.JSXOpeningFragment="JSXOpeningFragment",t.JSXSpreadAttribute="JSXSpreadAttribute",t.JSXText="JSXText"}(QN||(QN={}));class UN{constructor(t){this.type=QN.JSXClosingElement,this.name=t}}class PN{constructor(){this.type=QN.JSXClosingFragment}}class GN{constructor(t,e,n){this.type=QN.JSXElement,this.openingElement=t,this.children=e,this.closingElement=n}}class VN{constructor(){this.type=QN.JSXEmptyExpression}}class jN{constructor(t){this.type=QN.JSXExpressionContainer,this.expression=t}}class HN{constructor(t){this.type=QN.JSXIdentifier,this.name=t}}class YN{constructor(t,e){this.type=QN.JSXMemberExpression,this.object=t,this.property=e}}class zN{constructor(t,e){this.type=QN.JSXAttribute,this.name=t,this.value=e}}class JN{constructor(t,e){this.type=QN.JSXNamespacedName,this.namespace=t,this.name=e}}class WN{constructor(t,e,n){this.type=QN.JSXOpeningElement,this.name=t,this.selfClosing=e,this.attributes=n}}class qN{constructor(t){this.type=QN.JSXOpeningFragment,this.selfClosing=t}}class KN{constructor(t){this.type=QN.JSXSpreadAttribute,this.argument=t}}class ZN{constructor(t,e){this.type=QN.JSXText,this.value=t,this.raw=e}}class XN{constructor(t){this.type=RN.ArrayExpression,this.elements=t}}class $N{constructor(t){this.type=RN.ArrayPattern,this.elements=t}}class tS{constructor(t,e,n,r){this.type=RN.ArrowFunctionExpression,this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=n,this.async=r}}class eS{constructor(t,e,n){this.type=RN.AssignmentExpression,this.operator=t,this.left=e,this.right=n}}class nS{constructor(t,e){this.type=RN.AssignmentPattern,this.left=t,this.right=e}}class rS{constructor(t,e,n,r){this.type=RN.FunctionDeclaration,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!0}}class iS{constructor(t){this.type=RN.AwaitExpression,this.argument=t}}class oS{constructor(t,e,n){this.type=RN.Literal,this.value=t,this.raw=e,this.bigint=n}}class sS{constructor(t,e,n){this.type=RN.BinaryExpression,this.operator=t,this.left=e,this.right=n}}class aS{constructor(t){this.type=RN.BlockStatement,this.body=t}}class cS{constructor(t){this.type=RN.BreakStatement,this.label=t}}class lS{constructor(t,e,n){this.type=RN.CallExpression,this.callee=t,this.arguments=e,this.optional=n}}class uS{constructor(t,e){this.type=RN.CatchClause,this.param=t,this.body=e}}class hS{constructor(t){this.type=RN.ChainExpression,this.expression=t}}class dS{constructor(t){this.type=RN.ClassBody,this.body=t}}class pS{constructor(t,e,n,r){this.type=RN.ClassDeclaration,this.id=t,this.superClass=e,this.body=n,this.decorators=r}}class fS{constructor(t,e,n,r){this.type=RN.ClassExpression,this.id=t,this.superClass=e,this.body=n,this.decorators=r}}class gS{constructor(t,e,n){this.type=RN.ConditionalExpression,this.test=t,this.consequent=e,this.alternate=n}}class AS{constructor(t){this.type=RN.ContinueStatement,this.label=t}}class ES{constructor(){this.type=RN.DebuggerStatement}}class mS{constructor(t){this.type=RN.Decorator,this.expression=t}}class wS{constructor(t,e){this.type=RN.ExpressionStatement,this.expression=t,this.directive=e}}class yS{constructor(t,e){this.type=RN.DoWhileStatement,this.body=t,this.test=e}}class BS{constructor(){this.type=RN.EmptyStatement}}class IS{constructor(t,e,n){this.type=RN.ExportAllDeclaration,this.source=t,this.exported=e,this.assertions=n}}class CS{constructor(t){this.type=RN.ExportDefaultDeclaration,this.declaration=t}}class TS{constructor(t,e,n,r){this.type=RN.ExportNamedDeclaration,this.declaration=t,this.specifiers=e,this.source=n,this.assertions=r}}class bS{constructor(t,e){this.type=RN.ExportSpecifier,this.exported=e,this.local=t}}class DS{constructor(t){this.type=RN.ExpressionStatement,this.expression=t}}class vS{constructor(t,e,n){this.type=RN.ForInStatement,this.left=t,this.right=e,this.body=n,this.each=!1}}class MS{constructor(t,e,n,r){this.type=RN.ForOfStatement,this.await=r,this.left=t,this.right=e,this.body=n}}class NS{constructor(t,e,n,r){this.type=RN.ForStatement,this.init=t,this.test=e,this.update=n,this.body=r}}class SS{constructor(t,e,n,r){this.type=RN.FunctionDeclaration,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=!1}}class _S{constructor(t,e,n,r,i){this.type=RN.FunctionExpression,this.id=t,this.params=e,this.body=n,this.generator=r,this.expression=!1,this.async=i}}class LS{constructor(t){this.type=RN.Identifier,this.name=t}}class xS{constructor(t,e,n){this.type=RN.IfStatement,this.test=t,this.consequent=e,this.alternate=n}}class RS{constructor(t,e){this.type=RN.ImportAttribute,this.key=t,this.value=e}}class FS{constructor(t,e){this.type=RN.ImportExpression,this.source=t,this.attributes=e}}class kS{constructor(t,e,n){this.type=RN.ImportDeclaration,this.specifiers=t,this.source=e,this.assertions=n}}class OS{constructor(t){this.type=RN.ImportDefaultSpecifier,this.local=t}}class QS{constructor(t){this.type=RN.ImportNamespaceSpecifier,this.local=t}}class US{constructor(t,e){this.type=RN.ImportSpecifier,this.local=t,this.imported=e}}class PS{constructor(t,e){this.type=RN.LabeledStatement,this.label=t,this.body=e}}class GS{constructor(t,e){this.type=RN.Literal,this.value=t,this.raw=e}}class VS{constructor(t,e,n){this.type=RN.LogicalExpression,this.operator=t,this.left=e,this.right=n}}class jS{constructor(t,e,n,r){this.type=RN.MemberExpression,this.computed=t,this.object=e,this.property=n,this.optional=r}}class HS{constructor(t,e){this.type=RN.MetaProperty,this.meta=t,this.property=e}}class YS{constructor(t,e,n,r,i,o){this.type=RN.MethodDefinition,this.key=t,this.computed=e,this.value=n,this.kind=r,this.static=i,this.decorators=o}}class zS{constructor(t){this.type=RN.Program,this.body=t,this.sourceType="module"}}class JS{constructor(t,e){this.type=RN.NewExpression,this.callee=t,this.arguments=e}}class WS{constructor(t){this.type=RN.ObjectExpression,this.properties=t}}class qS{constructor(t){this.type=RN.ObjectPattern,this.properties=t}}class KS{constructor(t){this.type=RN.PrivateIdentifier,this.name=t}}class ZS{constructor(t,e,n,r,i,o){this.type=RN.Property,this.key=e,this.computed=n,this.value=r,this.kind=t,this.method=i,this.shorthand=o}}class XS{constructor(t,e,n,r,i){this.type=RN.Property,this.key=t,this.computed=e,this.value=n,this.static=r,this.decorators=i}}class $S{constructor(t,e,n,r){this.type=RN.Literal,this.value=t,this.raw=e,this.regex={pattern:n,flags:r}}}class t_{constructor(t){this.type=RN.RestElement,this.argument=t}}class e_{constructor(t){this.type=RN.ReturnStatement,this.argument=t}}class n_{constructor(t){this.type=RN.Program,this.body=t,this.sourceType="script"}}class r_{constructor(t){this.type=RN.SequenceExpression,this.expressions=t}}class i_{constructor(t){this.type=RN.SpreadElement,this.argument=t}}class o_{constructor(t){this.type=RN.StaticBlock,this.body=t}}class s_{constructor(){this.type=RN.Super}}class a_{constructor(t,e){this.type=RN.SwitchCase,this.test=t,this.consequent=e}}class c_{constructor(t,e){this.type=RN.SwitchStatement,this.discriminant=t,this.cases=e}}class l_{constructor(t,e){this.type=RN.TaggedTemplateExpression,this.tag=t,this.quasi=e}}class u_{constructor(t,e){this.type=RN.TemplateElement,this.value=t,this.tail=e}}class h_{constructor(t,e){this.type=RN.TemplateLiteral,this.quasis=t,this.expressions=e}}class d_{constructor(){this.type=RN.ThisExpression}}class p_{constructor(t){this.type=RN.ThrowStatement,this.argument=t}}class f_{constructor(t,e,n){this.type=RN.TryStatement,this.block=t,this.handler=e,this.finalizer=n}}class g_{constructor(t,e){this.type=RN.UnaryExpression,this.operator=t,this.argument=e,this.prefix=!0}}class A_{constructor(t,e,n){this.type=RN.UpdateExpression,this.operator=t,this.argument=e,this.prefix=n}}class E_{constructor(t,e){this.type=RN.VariableDeclaration,this.declarations=t,this.kind=e}}class m_{constructor(t,e){this.type=RN.VariableDeclarator,this.id=t,this.init=e}}class w_{constructor(t,e){this.type=RN.WhileStatement,this.test=t,this.body=e}}class y_{constructor(t,e){this.type=RN.WithStatement,this.object=t,this.body=e}}class B_{constructor(t,e){this.type=RN.YieldExpression,this.argument=t,this.delegate=e}}function I_(t,e){if(!t)throw new Error("ASSERT: "+e)}class C_{constructor(){this.errors=[],this.tolerant=!1}recordError(t){this.errors.push(t)}tolerate(t){if(!this.tolerant)throw t;this.recordError(t)}constructError(t,e){let n=new Error(t);try{throw n}catch(t){Object.create&&Object.defineProperty&&(n=Object.create(t),Object.defineProperty(n,"column",{value:e}))}return n}createError(t,e,n,r){const i="Line "+e+": "+r,o=this.constructError(i,n);o.index=t,o.lineNumber=e,o.description=r;return o}throwError(t,e,n,r){throw this.createError(t,e,n,r)}tolerateError(t,e,n,r){const i=this.createError(t,e,n,r);if(!this.tolerant)throw i;this.recordError(i)}}const T_="Async functions can only be declared at the top level or inside a block.",b_="Unexpected token",D_="Getter must not have any formal parameters",v_="Setter must have exactly one formal parameter",M_="Setter function argument must not be a rest parameter",N_="Cannot use 'import.meta' outside a module",S_="Class constructor may not be an async method",__="Class constructor may not be a private method",L_="Class constructor may not be an accessor",x_="Missing initializer in %0 declaration",R_="Unexpected token =",F_="Unexpected token =",k_="Duplicate binding %0",O_="A class may only have one constructor",Q_="Duplicate parameter name not allowed in this context",U_="Duplicate __proto__ fields are not allowed in object literals",P_="%0 loop variable declaration may not have an initializer",G_="Generator declarations are not allowed in legacy contexts",V_="Illegal break statement",j_="Illegal continue statement",H_="Unexpected token",Y_="Unexpected token",z_="Illegal 'use strict' directive in function with non-simple parameter list",J_="Illegal return statement",W_="Keyword must not contain escaped characters",q_="Invalid hexadecimal escape sequence",K_="Invalid left-hand side in assignment",Z_="Invalid left-hand side in for-in",X_="Invalid left-hand side in for-loop",$_="Unexpected token",tL="Invalid regular expression",eL="Invalid tagged template on optional chain",nL="Invalid Unicode escape sequence",rL="let is disallowed as a lexically bound name",iL="Unexpected token",oL="More than one default clause in switch statement",sL="Illegal newline after throw",aL="Unexpected token",cL="The `as` and `from` contextual keywords must not contain Unicode escape sequences.",lL="Missing catch or finally after try",uL="Decorators must not be followed by a semicolon.",hL="Numeric separator must be exactly one underscore",dL="Numeric separator is not allowed here",pL="Rest parameter must be last formal parameter",fL="Unexpected token",gL="%0 '%1' has already been declared",AL="Classes may not have static property named prototype",EL="Catch variable may not be eval or arguments in strict mode",mL="Delete of an unqualified identifier in strict mode.",wL="In strict mode code, functions can only be declared at top level or inside a block",yL="Function name may not be eval or arguments in strict mode",BL="Assignment to eval or arguments is not allowed in strict mode",IL="Postfix increment/decrement may not have eval or arguments operand in strict mode",CL="Prefix increment/decrement may not have eval or arguments operand in strict mode",TL="Strict mode code may not include a with statement",bL="Octal literals are not allowed in strict mode.",DL="Parameter name eval or arguments is not allowed in strict mode",vL="Use of future reserved word in strict mode",ML="Variable name may not be eval or arguments in strict mode",NL="Octal literals are not allowed in template strings.",SL="\\8 and \\9 are not allowed in template strings.",_L="Unexpected end of input",LL="Unexpected identifier",xL="Unexpected number",RL="Unexpected reserved word",FL="Unexpected string",kL="'super' keyword unexpected here",OL="Unexpected quasi %0",QL="Unexpected token %0",UL="Unexpected token ILLEGAL",PL="Undefined label '%0'",GL="Invalid regular expression: missing /";function VL(t){return"0123456789abcdef".indexOf(t.toLowerCase())}function jL(t){return"01234567".indexOf(t)}class HL{constructor(t,e){this.source=t,this.errorHandler=e,this.trackComment=!1,this.isModule=!1,this.length=t.length,this.index=0,this.lineNumber=t.length>0?1:0,this.lineStart=0,this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart,this.curlyStack=t.curlyStack}eof(){return this.index>=this.length}throwUnexpectedToken(t=UL){return this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}tolerateUnexpectedToken(t=UL){this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,t)}skipSingleLineComment(t){let e,n,r=[];for(this.trackComment&&(r=[],e=this.index-t,n={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{}});!this.eof();){const i=this.source.charCodeAt(this.index);if(++this.index,ON.isLineTerminator(i)){if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart-1};const i={multiLine:!1,slice:[e+t,this.index-1],range:[e,this.index-1],loc:n};r.push(i)}return 13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,r}}if(this.trackComment){n.end={line:this.lineNumber,column:this.index-this.lineStart};const i={multiLine:!1,slice:[e+t,this.index],range:[e,this.index],loc:n};r.push(i)}return r}skipMultiLineComment(){let t,e,n=[];for(this.trackComment&&(n=[],t=this.index-2,e={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){const r=this.source.charCodeAt(this.index);if(ON.isLineTerminator(r))13===r&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===r){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:e};n.push(r)}return n}++this.index}else++this.index}if(this.trackComment){e.end={line:this.lineNumber,column:this.index-this.lineStart};const r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:e};n.push(r)}return this.tolerateUnexpectedToken(),n}scanComments(){let t;this.trackComment&&(t=[]);let e=0===this.index;for(;!this.eof();){let n=this.source.charCodeAt(this.index);if(ON.isWhiteSpace(n))++this.index;else if(ON.isLineTerminator(n))++this.index,13===n&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,e=!0;else if(47===n)if(n=this.source.charCodeAt(this.index+1),47===n){this.index+=2;const n=this.skipSingleLineComment(2);this.trackComment&&(t=t.concat(n)),e=!0}else{if(42!==n)break;{this.index+=2;const e=this.skipMultiLineComment();this.trackComment&&(t=t.concat(e))}}else if(e&&45===n){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;{this.index+=3;const e=this.skipSingleLineComment(3);this.trackComment&&(t=t.concat(e))}}else{if(60!==n||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;{this.index+=4;const e=this.skipSingleLineComment(4);this.trackComment&&(t=t.concat(e))}}}return t}isFutureReservedWord(t){switch(t){case"enum":case"export":case"import":case"super":return!0;default:return!1}}isStrictModeReservedWord(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}}isRestrictedWord(t){return"eval"===t||"arguments"===t}isKeyword(t){switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}}codePointAt(t){let e=this.source.charCodeAt(t);if(e>=55296&&e<=56319){const n=this.source.charCodeAt(t+1);if(n>=56320&&n<=57343){e=1024*(e-55296)+n-56320+65536}}return e}scanHexEscape(t){const e="u"===t?4:2;let n=0;for(let t=0;t<e;++t){if(this.eof()||!ON.isHexDigit(this.source.charCodeAt(this.index)))return null;n=16*n+VL(this.source[this.index++])}return String.fromCharCode(n)}tryToScanUnicodeCodePointEscape(){let t=this.source[this.index],e=0;if("}"===t)return null;for(;!this.eof()&&(t=this.source[this.index++],ON.isHexDigit(t.charCodeAt(0)));)e=16*e+VL(t);return e>1114111||"}"!==t?null:ON.fromCodePoint(e)}scanUnicodeCodePointEscape(){const t=this.tryToScanUnicodeCodePointEscape();return null===t?this.throwUnexpectedToken():t}getIdentifier(){const t=this.index++;for(;!this.eof();){const e=this.source.charCodeAt(this.index);if(92===e)return this.index=t,this.getComplexIdentifier();if(e>=55296&&e<57343)return this.index=t,this.getComplexIdentifier();if(!ON.isIdentifierPart(e))break;++this.index}return this.source.slice(t,this.index)}getComplexIdentifier(){let t,e=this.codePointAt(this.index),n=ON.fromCodePoint(e);for(this.index+=n.length,92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&ON.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken()),n=t);!this.eof()&&(e=this.codePointAt(this.index),ON.isIdentifierPart(e));)t=ON.fromCodePoint(e),n+=t,this.index+=t.length,92===e&&(n=n.substr(0,n.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):(t=this.scanHexEscape("u"),null!==t&&"\\"!==t&&ON.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken()),n+=t);return n}octalToDecimal(t){let e="0"!==t,n=jL(t);return!this.eof()&&ON.isOctalDigit(this.source.charCodeAt(this.index))&&(e=!0,n=8*n+jL(this.source[this.index++]),"0123".indexOf(t)>=0&&!this.eof()&&ON.isOctalDigit(this.source.charCodeAt(this.index))&&(n=8*n+jL(this.source[this.index++]))),{code:n,octal:e}}scanIdentifier(){let t;const e=this.index,n=92===this.source.charCodeAt(e),r=n?this.getComplexIdentifier():this.getIdentifier();if(t=1===r.length?3:this.isKeyword(r)?4:"null"===r?5:"true"===r||"false"===r?1:3,3!==t&&e+r.length!==this.index){const t=this.index;this.index=e,this.tolerateUnexpectedToken(W_),this.index=t}return{type:t,value:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index,escaped:n}}scanPunctuator(){const t=this.index;let e=this.source[this.index];switch(e){case"(":case"{":"{"===e&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,e="...");break;case"}":++this.index,this.curlyStack.pop();break;case"?":++this.index,"?"===this.source[this.index]&&(++this.index,"="===this.source[this.index]?(++this.index,e="??="):e="??"),"."!==this.source[this.index]||/^\d$/.test(this.source[this.index+1])||(++this.index,e="?.");break;case"#":case")":case";":case",":case"[":case"]":case":":case"~":case"@":++this.index;break;default:e=this.source.substr(this.index,4),">>>="===e?this.index+=4:(e=e.substr(0,3),"==="===e||"!=="===e||">>>"===e||"<<="===e||">>="===e||"**="===e||"&&="===e||"||="===e?this.index+=3:(e=e.substr(0,2),"&&"===e||"||"===e||"=="===e||"!="===e||"+="===e||"-="===e||"*="===e||"/="===e||"++"===e||"--"===e||"<<"===e||">>"===e||"&="===e||"|="===e||"^="===e||"%="===e||"<="===e||">="===e||"=>"===e||"**"===e?this.index+=2:(e=this.source[this.index],"<>=!+-*%&|^/".indexOf(e)>=0&&++this.index)))}return this.index===t&&this.throwUnexpectedToken(),{type:7,value:e,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanHexLiteral(t){let e=this.scanLiteralPart(ON.isHexDigitChar);return 0===e.length&&this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0x"+e),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}):(ON.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+e,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index})}scanBinaryLiteral(t){let e,n=this.scanLiteralPart(t=>"0"===t||"1"===t);return 0===n.length&&this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0b"+n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}):(this.eof()||(e=this.source.charCodeAt(this.index),(ON.isIdentifierStart(e)||ON.isDecimalDigit(e))&&this.throwUnexpectedToken()),{type:6,value:parseInt(n,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index})}scanOctalLiteral(t,e){let n="",r=!1;return ON.isOctalDigit(t.charCodeAt(0))?(r=!0,n="0"+this.source[this.index++]):++this.index,n+=this.scanLiteralPart(ON.isOctalDigitChar),r||0!==n.length||this.throwUnexpectedToken(),"n"===this.source[this.index]?(this.index++,{type:6,value:BigInt("0o"+n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}):((ON.isIdentifierStart(this.source.charCodeAt(this.index))||ON.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(n,8),octal:r,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index})}isImplicitOctalLiteral(){for(let t=this.index+1;t<this.length;++t){const e=this.source[t];if("8"===e||"9"===e||"n"===e)return!1;if(!ON.isOctalDigit(e.charCodeAt(0)))return!0}return!0}scanLiteralPart(t){let e="";for("_"===this.source[this.index]&&this.throwUnexpectedToken(dL);this.source[this.index]&&(t(this.source[this.index])||"_"===this.source[this.index]);)"_"!==this.source[this.index]&&(e+=this.source[this.index]),this.index++,"_"===this.source[this.index-1]&&"_"===this.source[this.index]&&this.throwUnexpectedToken(hL);return"_"===this.source[this.index-1]&&this.throwUnexpectedToken(dL),e}scanNumericLiteral(){const t=this.index;let e=this.source[t];I_(ON.isDecimalDigit(e.charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point");let n="";if("."!==e){if(n=this.source[this.index++],e=this.source[this.index],"0"===n){if("x"===e||"X"===e)return++this.index,this.scanHexLiteral(t);if("b"===e||"B"===e)return++this.index,this.scanBinaryLiteral(t);if("o"===e||"O"===e)return this.scanOctalLiteral(e,t);if(e&&ON.isOctalDigit(e.charCodeAt(0))&&this.isImplicitOctalLiteral())return this.scanOctalLiteral(e,t)}this.index--,n=this.scanLiteralPart(ON.isDecimalDigitChar),e=this.source[this.index]}if("."===e&&(n+=this.source[this.index++],n+=this.scanLiteralPart(ON.isDecimalDigitChar),e=this.source[this.index]),"e"===e||"E"===e)n+=this.source[this.index++],e=this.source[this.index],"+"!==e&&"-"!==e||(n+=this.source[this.index++]),ON.isDecimalDigit(this.source.charCodeAt(this.index))?n+=this.scanLiteralPart(ON.isDecimalDigitChar):this.throwUnexpectedToken();else if("n"===e)return n.length>1&&"0"===n[0]&&this.throwUnexpectedToken(),this.index++,{type:6,value:BigInt(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index};return ON.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseFloat(n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanStringLiteral(){const t=this.index;let e=this.source[t];I_("'"===e||'"'===e,"String literal must starts with a quote"),++this.index;let n=!1,r="";for(;!this.eof();){let t=this.source[this.index++];if(t===e){e="";break}if("\\"===t)if(t=this.source[this.index++],t&&ON.isLineTerminator(t.charCodeAt(0)))++this.lineNumber,"\r"===t&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(t){case"u":if("{"===this.source[this.index])++this.index,r+=this.scanUnicodeCodePointEscape();else{const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(),r+=e}break;case"x":const e=this.scanHexEscape(t);null===e&&this.throwUnexpectedToken(q_),r+=e;break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;case"8":case"9":r+=t,this.tolerateUnexpectedToken();break;default:if(t&&ON.isOctalDigit(t.charCodeAt(0))){const e=this.octalToDecimal(t);n=e.octal||n,r+=String.fromCharCode(e.code)}else r+=t}else{if(ON.isLineTerminator(t.charCodeAt(0)))break;r+=t}}return""!==e&&(this.index=t,this.throwUnexpectedToken()),{type:8,value:r,octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}scanTemplate(){let t="",e=!1;const n=this.index,r="`"===this.source[n];let i=!1,o=null,s=2;for(++this.index;!this.eof();){let n=this.source[this.index++];if("`"===n){s=1,i=!0,e=!0;break}if("$"===n){if("{"===this.source[this.index]){this.curlyStack.push("${"),++this.index,e=!0;break}t+=n}else{if(null!==o)continue;if("\\"===n)if(n=this.source[this.index++],ON.isLineTerminator(n.charCodeAt(0)))++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index;else switch(n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"u":if("{"===this.source[this.index]){++this.index;const e=this.tryToScanUnicodeCodePointEscape();null===e?o="u":t+=e}else{const e=this.scanHexEscape(n);null===e?o="u":t+=e}break;case"x":const e=this.scanHexEscape(n);null===e?o="x":t+=e;break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:"0"===n?ON.isDecimalDigit(this.source.charCodeAt(this.index))?o="0":t+="\0":ON.isDecimalDigitChar(n)?o=n:t+=n}else ON.isLineTerminator(n.charCodeAt(0))?(++this.lineNumber,"\r"===n&&"\n"===this.source[this.index]&&++this.index,this.lineStart=this.index,t+="\n"):t+=n}}return e||this.throwUnexpectedToken(),r||this.curlyStack.pop(),{type:10,value:this.source.slice(n+1,this.index-s),cooked:null===o?t:null,head:r,tail:i,notEscapeSequenceHead:o,lineNumber:this.lineNumber,lineStart:this.lineStart,start:n,end:this.index}}testRegExp(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(t,e,n)=>{const r=parseInt(e||n,16);return r>1114111&&this.throwUnexpectedToken(tL),r<=65535?String.fromCharCode(r):""}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,""));try{RegExp(n)}catch(t){this.throwUnexpectedToken(tL)}try{return new RegExp(t,e)}catch(t){return null}}scanRegExpBody(){let t=this.source[this.index];I_("/"===t,"Regular expression literal must start with a slash");let e=this.source[this.index++],n=!1,r=!1;for(;!this.eof();)if(t=this.source[this.index++],e+=t,"\\"===t)t=this.source[this.index++],ON.isLineTerminator(t.charCodeAt(0))&&this.throwUnexpectedToken(GL),e+=t;else if(ON.isLineTerminator(t.charCodeAt(0)))this.throwUnexpectedToken(GL);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||this.throwUnexpectedToken(GL),e.substr(1,e.length-2)}scanRegExpFlags(){let t="",e="";for(;!this.eof();){let n=this.source[this.index];if(!ON.isIdentifierPart(n.charCodeAt(0)))break;if(++this.index,"\\"!==n||this.eof())e+=n,t+=n;else if(n=this.source[this.index],"u"===n){++this.index;let n=this.index;const r=this.scanHexEscape("u");if(null!==r)for(e+=r,t+="\\u";n<this.index;++n)t+=this.source[n];else this.index=n,e+="u",t+="\\u";this.tolerateUnexpectedToken()}else t+="\\",this.tolerateUnexpectedToken()}return e}scanRegExp(){const t=this.index,e=this.scanRegExpBody(),n=this.scanRegExpFlags();return{type:9,value:"",pattern:e,flags:n,regex:this.testRegExp(e,n),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}}lex(){if(this.eof())return{type:2,value:"",lineNumber:this.lineNumber,lineStart:this.lineStart,start:this.index,end:this.index};const t=this.source.charCodeAt(this.index);return ON.isIdentifierStart(t)?this.scanIdentifier():40===t||41===t||59===t?this.scanPunctuator():39===t||34===t?this.scanStringLiteral():46===t?ON.isDecimalDigit(this.source.charCodeAt(this.index+1))?this.scanNumericLiteral():this.scanPunctuator():ON.isDecimalDigit(t)?this.scanNumericLiteral():96===t||125===t&&"${"===this.curlyStack[this.curlyStack.length-1]?this.scanTemplate():t>=55296&&t<57343&&ON.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}}const YL={1:"Boolean",2:"<end>",3:"Identifier",4:"Keyword",5:"Null",6:"Numeric",7:"Punctuator",8:"String",9:"RegularExpression",10:"Template"},zL="ArrowParameterPlaceHolder";class JL{constructor(t,e={},n){this.config={range:"boolean"==typeof e.range&&e.range,loc:"boolean"==typeof e.loc&&e.loc,source:null,tokens:"boolean"==typeof e.tokens&&e.tokens,comment:"boolean"==typeof e.comment&&e.comment,tolerant:"boolean"==typeof e.tolerant&&e.tolerant},this.config.loc&&e.source&&null!==e.source&&(this.config.source=String(e.source)),this.delegate=n,this.errorHandler=new C_,this.errorHandler.tolerant=1==this.config.tolerant,this.scanner=new HL(t,this.errorHandler),this.scanner.trackComment=1==this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"??":5,"||":6,"&&":7,"|":8,"^":9,"&":10,"==":11,"!=":11,"===":11,"!==":11,"<":12,">":12,"<=":12,">=":12,"<<":13,">>":13,">>>":13,"+":14,"-":14,"*":15,"/":15,"%":15},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,isAsync:!1,allowIn:!0,allowStrictDirective:!0,allowSuper:!1,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inConstructor:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,inClassConstructor:!1,labelSet:{},strict:!1,decorators:null},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,(t,e)=>(I_(e<n.length,"Message reference must be in range"),n[e])),i=this.lastMarker.index,o=this.lastMarker.line,s=this.lastMarker.column+1;throw this.errorHandler.createError(i,o,s,r)}tolerateError(t,...e){const n=e.slice(),r=t.replace(/%(\d)/g,(t,e)=>(I_(e<n.length,"Message reference must be in range"),n[e])),i=this.lastMarker.index,o=this.scanner.lineNumber,s=this.lastMarker.column+1;this.errorHandler.tolerateError(i,o,s,r)}unexpectedTokenError(t,e){let n,r=e||QL;if(t?(e||(r=2===t.type?_L:3===t.type?LL:6===t.type?xL:8===t.type?FL:10===t.type?OL:QL,4===t.type&&(this.scanner.isFutureReservedWord(t.value)?r=RL:this.context.strict&&this.scanner.isStrictModeReservedWord(t.value)&&(r=vL))),n=t.value):n="ILLEGAL",r=r.replace("%0",n),t&&"number"==typeof t.lineNumber){const e=t.start,n=t.lineNumber,i=this.lastMarker.index-this.lastMarker.column,o=t.start-i+1;return this.errorHandler.createError(e,n,o,r)}{const t=this.lastMarker.index,e=this.lastMarker.line,n=this.lastMarker.column+1;return this.errorHandler.createError(t,e,n,r)}}throwUnexpectedToken(t,e){throw this.unexpectedTokenError(t,e)}tolerateUnexpectedToken(t,e){this.errorHandler.tolerate(this.unexpectedTokenError(t,e))}tolerateInvalidLoopStatement(){(this.matchKeyword("class")||this.matchKeyword("function"))&&this.tolerateError(QL,this.lookahead)}collectComments(){if(this.config.comment){const t=this.scanner.scanComments();if(t.length>0&&this.delegate)for(let e=0;e<t.length;++e){const n=t[e],r={type:n.multiLine?"BlockComment":"LineComment",value:this.scanner.source.slice(n.slice[0],n.slice[1])};this.config.range&&(r.range=n.range),this.config.loc&&(r.loc=n.loc);const i={start:{line:n.loc.start.line,column:n.loc.start.column,offset:n.range[0]},end:{line:n.loc.end.line,column:n.loc.end.column,offset:n.range[1]}};this.delegate(r,i)}}else this.scanner.scanComments()}getTokenRaw(t){return this.scanner.source.slice(t.start,t.end)}convertToken(t){const e={type:YL[t.type],value:this.getTokenRaw(t)};if(this.config.range&&(e.range=[t.start,t.end]),this.config.loc&&(e.loc={start:{line:this.startMarker.line,column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}),9===t.type){const n=t.pattern,r=t.flags;e.regex={pattern:n,flags:r}}return e}nextToken(){const t=this.lookahead;this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.collectComments(),this.scanner.index!==this.startMarker.index&&(this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart);const e=this.scanner.lex();return this.hasLineTerminator=t.lineNumber!==e.lineNumber,e&&this.context.strict&&3===e.type&&this.scanner.isStrictModeReservedWord(e.value)&&(e.type=4),this.lookahead=e,this.config.tokens&&2!==e.type&&this.tokens.push(this.convertToken(e)),t}nextRegexToken(){this.collectComments();const t=this.scanner.scanRegExp();return this.config.tokens&&(this.tokens.pop(),this.tokens.push(this.convertToken(t))),this.lookahead=t,this.nextToken(),t}createNode(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}startNode(t,e=0){let n=t.start-t.lineStart,r=t.lineNumber;return n<0&&(n+=e,r--),{index:t.start,line:r,column:n}}finalize(t,e){if(this.config.range&&(e.range=[t.index,this.lastMarker.index]),this.config.loc&&(e.loc={start:{line:t.line,column:t.column},end:{line:this.lastMarker.line,column:this.lastMarker.column}},this.config.source&&(e.loc.source=this.config.source)),this.delegate){const n={start:{line:t.line,column:t.column,offset:t.index},end:{line:this.lastMarker.line,column:this.lastMarker.column,offset:this.lastMarker.index}};this.delegate(e,n)}return e}expect(t){const e=this.nextToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}expectCommaSeparator(){if(this.config.tolerant){const t=this.lookahead;7===t.type&&","===t.value?this.nextToken():7===t.type&&";"===t.value?(this.nextToken(),this.tolerateUnexpectedToken(t)):this.tolerateUnexpectedToken(t,QL)}else this.expect(",")}expectKeyword(t){const e=this.nextToken();4===e.type&&e.value===t||this.throwUnexpectedToken(e)}match(t){return 7===this.lookahead.type&&this.lookahead.value===t}matchKeyword(t){return 4===this.lookahead.type&&this.lookahead.value===t}matchContextualKeyword(t){return 3===this.lookahead.type&&this.lookahead.value===t}matchAssign(){if(7!==this.lookahead.type)return!1;const t=this.lookahead.value;return"="===t||"*="===t||"**="===t||"/="===t||"%="===t||"+="===t||"-="===t||"<<="===t||">>="===t||">>>="===t||"&="===t||"^="===t||"|="===t||"&&="===t||"||="===t||"??="===t}isolateCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const i=t.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=e,this.context.isAssignmentTarget=n,this.context.firstCoverInitializedNameError=r,i}inheritCoverGrammar(t){const e=this.context.isBindingElement,n=this.context.isAssignmentTarget,r=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;const i=t.call(this);return this.context.isBindingElement=this.context.isBindingElement&&e,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&n,this.context.firstCoverInitializedNameError=r||this.context.firstCoverInitializedNameError,i}consumeSemicolon(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)}parsePrimaryExpression(){const t=this.createNode();let e,n,r;switch(this.lookahead.type){case 3:(this.context.isModule||this.context.isAsync)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),e=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(t,new LS(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,bL),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e="bigint"==typeof n.value?this.finalize(t,new oS(n.value,r,n.value.toString())):this.finalize(t,new GS(n.value,r));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new GS("true"===n.value,r));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,n=this.nextToken(),r=this.getTokenRaw(n),e=this.finalize(t,new GS(null,r));break;case 10:e=this.parseTemplateLiteral({isTagged:!1});break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,e=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":e=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":e=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,n=this.nextRegexToken(),r=this.getTokenRaw(n),e=this.finalize(t,new $S(n.regex,r,n.pattern,n.flags));break;case"#":this.nextToken(),e=this.finalize(t,new KS(this.nextToken().value));break;case"@":let i=this.parseDecorators();this.context.decorators=i,this.parsePrimaryExpression(),this.context.decorators=null,e=this.finalize(t,new KS(this.nextToken().value));break;default:e=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?e=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?e=this.finalize(t,new LS(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?e=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),e=this.finalize(t,new d_)):this.matchKeyword("class")?e=this.parseClassExpression():this.matchKeyword("new")?e=this.parseNewExpression():this.matchImportCall()?e=this.parseImportCall():this.matchImportMeta()?(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,N_),e=this.parseImportMeta()):e=this.throwUnexpectedToken(this.nextToken()));break;default:e=this.throwUnexpectedToken(this.nextToken())}return e}parseSpreadElement(){const t=this.createNode();this.expect("...");const e=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(t,new i_(e))}parseArrayInitializer(){const t=this.createNode(),e=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),e.push(null);else if(this.match("...")){const t=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),e.push(t)}else e.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(t,new XN(e))}parsePropertyMethod(t){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=this.context.strict,n=this.context.allowStrictDirective;this.context.allowStrictDirective=t.simple;const r=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&t.firstRestricted&&this.tolerateUnexpectedToken(t.firstRestricted,t.message),this.context.strict&&t.stricted&&this.tolerateUnexpectedToken(t.stricted,t.message),this.context.strict=e,this.context.allowStrictDirective=n,r}parsePropertyMethodFunction(t){const e=this.createNode(),n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters(),i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(e,new _S(null,r.params,i,t,!1))}parsePropertyMethodAsyncFunction(t){const e=this.createNode(),n=this.context.allowYield,r=this.context.isAsync;this.context.allowYield=!1,this.context.isAsync=!0;const i=this.parseFormalParameters(),o=this.parsePropertyMethod(i);return this.context.allowYield=n,this.context.isAsync=r,this.finalize(e,new _S(null,i.params,o,t,!0))}parseObjectPropertyKey(t=!1){const e=this.createNode(),n=this.nextToken();let r;switch(n.type){case 8:case 6:this.context.strict&&n.octal&&this.tolerateUnexpectedToken(n,bL);const i=this.getTokenRaw(n);r="bigint"==typeof n.value?this.finalize(e,new oS(n.value,i,n.value.toString())):this.finalize(e,new GS(n.value,i));break;case 3:case 1:case 5:case 4:r=this.finalize(e,t?new KS(n.value):new LS(n.value));break;case 7:"["===n.value?(r=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):r=this.throwUnexpectedToken(n);break;default:r=this.throwUnexpectedToken(n)}return r}isPropertyKey(t,e){return t.type===RN.Identifier&&t.name===e||t.type===RN.Literal&&t.value===e}parseObjectProperty(t){const e=this.createNode(),n=this.lookahead;let r,i=null,o=null,s=!1,a=!1,c=!1,l=!1,u=!1;if(3===n.type){const t=n.value;this.nextToken(),s=this.match("["),l=!(this.hasLineTerminator||"async"!==t||this.match(":")||this.match("(")||this.match(",")),u=this.match("*"),u&&this.nextToken(),i=l?this.parseObjectPropertyKey():this.finalize(e,new LS(t))}else this.match("*")?this.nextToken():(s=this.match("["),i=this.parseObjectPropertyKey());const h=this.qualifiedPropertyName(this.lookahead);if(3===n.type&&!l&&"get"===n.value&&h)r="get",s=this.match("["),i=this.parseObjectPropertyKey(),this.context.allowYield=!1,o=this.parseGetterMethod();else if(3===n.type&&!l&&"set"===n.value&&h)r="set",s=this.match("["),i=this.parseObjectPropertyKey(),o=this.parseSetterMethod();else if(7===n.type&&"*"===n.value&&h)r="init",s=this.match("["),i=this.parseObjectPropertyKey(),o=this.parseGeneratorMethod(!1),a=!0;else if(i||this.throwUnexpectedToken(this.lookahead),r="init",this.match(":")&&!l)!s&&this.isPropertyKey(i,"__proto__")&&(t.value&&this.tolerateError(U_),t.value=!0),this.nextToken(),o=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))o=l?this.parsePropertyMethodAsyncFunction(u):this.parsePropertyMethodFunction(u),a=!0;else if(3===n.type){const t=this.finalize(e,new LS(n.value));if(this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),c=!0;const n=this.isolateCoverGrammar(this.parseAssignmentExpression);o=this.finalize(e,new nS(t,n))}else c=!0,o=t}else this.throwUnexpectedToken(this.nextToken());return this.finalize(e,new ZS(r,i,s,o,a,c))}parseObjectInitializer(){const t=this.createNode();this.expect("{");const e=[],n={value:!1};for(;!this.match("}");){const t=this.match("...")?this.parseSpreadElement():this.parseObjectProperty(n);e.push(t),this.match("}")||t.method&&!this.match(",")||this.expectCommaSeparator()}return this.expect("}"),this.finalize(t,new WS(e))}throwTemplateLiteralEarlyErrors(t){switch(t.notEscapeSequenceHead){case"u":return this.throwUnexpectedToken(t,nL);case"x":return this.throwUnexpectedToken(t,q_);case"8":case"9":return this.throwUnexpectedToken(t,SL);default:return this.throwUnexpectedToken(t,NL)}}parseTemplateHead(t){I_(this.lookahead.head,"Template literal must start with a template head");const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,i=n.cooked;return this.finalize(e,new u_({raw:r,cooked:i},n.tail))}parseTemplateElement(t){10!==this.lookahead.type&&this.throwUnexpectedToken();const e=this.createNode(),n=this.nextToken();t.isTagged||null===n.notEscapeSequenceHead||this.throwTemplateLiteralEarlyErrors(n);const r=n.value,i=n.cooked;return this.finalize(e,new u_({raw:r,cooked:i},n.tail))}parseTemplateLiteral(t){const e=this.createNode(),n=[],r=[];let i=this.parseTemplateHead(t);for(r.push(i);!i.tail;)n.push(this.parseExpression()),i=this.parseTemplateElement(t),r.push(i);return this.finalize(e,new h_(r,n))}reinterpretExpressionAsPattern(t){switch(t.type){case RN.Identifier:case RN.MemberExpression:case RN.RestElement:case RN.AssignmentPattern:break;case RN.SpreadElement:t.type=RN.RestElement,this.reinterpretExpressionAsPattern(t.argument);break;case RN.ArrayExpression:t.type=RN.ArrayPattern;for(let e=0;e<t.elements.length;e++)null!==t.elements[e]&&this.reinterpretExpressionAsPattern(t.elements[e]);break;case RN.ObjectExpression:t.type=RN.ObjectPattern;for(let e=0;e<t.properties.length;e++){const n=t.properties[e];this.reinterpretExpressionAsPattern(n.type===RN.SpreadElement?n:n.value)}break;case RN.AssignmentExpression:t.type=RN.AssignmentPattern,delete t.operator,this.reinterpretExpressionAsPattern(t.left)}}parseGroupExpression(){let t;if(this.expect("("),this.match(")"))this.nextToken(),this.match("=>")||this.expect("=>"),t={type:zL,params:[],async:!1};else{const e=this.lookahead,n=[];if(this.match("..."))t=this.parseRestElement(n),this.expect(")"),this.match("=>")||this.expect("=>"),t={type:zL,params:[t],async:!1};else{let r=!1;if(this.context.isBindingElement=!0,t=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){const i=[];for(this.context.isAssignmentTarget=!1,i.push(t);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(let t=0;t<i.length;t++)this.reinterpretExpressionAsPattern(i[t]);r=!0,t={type:zL,params:i,async:!1}}else if(this.match("...")){this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),i.push(this.parseRestElement(n)),this.expect(")"),this.match("=>")||this.expect("=>"),this.context.isBindingElement=!1;for(let t=0;t<i.length;t++)this.reinterpretExpressionAsPattern(i[t]);r=!0,t={type:zL,params:i,async:!1}}else i.push(this.inheritCoverGrammar(this.parseAssignmentExpression));if(r)break}r||(t=this.finalize(this.startNode(e),new r_(i)))}if(!r){if(this.expect(")"),this.match("=>")&&(t.type===RN.Identifier&&"yield"===t.name&&(r=!0,t={type:zL,params:[t],async:!1}),!r)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),t.type===RN.SequenceExpression)for(let e=0;e<t.expressions.length;e++)this.reinterpretExpressionAsPattern(t.expressions[e]);else this.reinterpretExpressionAsPattern(t);const e=t.type===RN.SequenceExpression?t.expressions:[t];t={type:zL,params:e,async:!1}}this.context.isBindingElement=!1}}}return t}parseArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAssignmentExpression);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}isIdentifierName(t){return 3===t.type||4===t.type||1===t.type||5===t.type}parseIdentifierName(t=!1){let e=!1,n=this.createNode(),r=this.nextToken();return"#"===r.value&&t&&(r=this.nextToken(),e=!0),this.isIdentifierName(r)||this.throwUnexpectedToken(r),this.finalize(n,e?new KS(r.value):new LS(r.value))}parseNewExpression(){const t=this.createNode(),e=this.parseIdentifierName();let n;if(I_("new"===e.name,"New expression must start with `new`"),this.match("."))if(this.nextToken(),3===this.lookahead.type&&this.context.inFunctionBody&&"target"===this.lookahead.value){const t=this.parseIdentifierName();n=new HS(e,t)}else this.throwUnexpectedToken(this.lookahead);else if(this.matchKeyword("import"))this.throwUnexpectedToken(this.lookahead);else{const t=this.isolateCoverGrammar(this.parseLeftHandSideExpression),e=this.match("(")?this.parseArguments():[];n=new JS(t,e),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return this.finalize(t,n)}parseAsyncArgument(){const t=this.parseAssignmentExpression();return this.context.firstCoverInitializedNameError=null,t}parseAsyncArguments(){this.expect("(");const t=[];if(!this.match(")"))for(;;){const e=this.match("...")?this.parseSpreadElement():this.isolateCoverGrammar(this.parseAsyncArgument);if(t.push(e),this.match(")"))break;if(this.expectCommaSeparator(),this.match(")"))break}return this.expect(")"),t}matchImportCall(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();this.scanner.restoreState(e),t=7===n.type&&"("===n.value}return t}parseImportCall(){const t=this.createNode();this.expectKeyword("import"),this.expect("(");const e=this.parseAssignmentExpression();let n=null;return this.match(",")&&(this.nextToken(),n=this.parseObjectInitializer()),!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new FS(e,n))}matchImportMeta(){let t=this.matchKeyword("import");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();if(7===n.type&&"."===n.value){this.scanner.scanComments();const e=this.scanner.lex();t=3===e.type&&"meta"===e.value,t&&e.end-e.start!==4&&this.tolerateUnexpectedToken(e,W_)}else t=!1;this.scanner.restoreState(e)}return t}parseImportMeta(){const t=this.createNode(),e=this.parseIdentifierName();this.expect(".");const n=this.parseIdentifierName();return this.context.isAssignmentTarget=!1,this.finalize(t,new HS(e,n))}parseLeftHandSideExpressionAllowCall(){const t=this.lookahead,e=this.matchContextualKeyword("async"),n=this.context.allowIn;let r;this.context.allowIn=!0;const i=this.matchKeyword("super");i&&this.context.inFunctionBody?(r=this.createNode(),this.nextToken(),r=this.finalize(r,new s_),this.match("(")||this.match(".")||this.match("[")||this.throwUnexpectedToken(this.lookahead)):r=this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression),!i||!this.match("(")||this.context.inClassConstructor&&this.context.allowSuper||this.tolerateError(kL);let o=!1;for(;;){let n=!1;if(this.match("?.")&&(n=!0,o=!0,this.expect("?.")),this.match("(")){const i=e&&t.lineNumber===this.lookahead.lineNumber;this.context.isBindingElement=!1,this.context.isAssignmentTarget=!1;const o=i?this.parseAsyncArguments():this.parseArguments();if(r.type===RN.ImportExpression&&1!==o.length&&this.tolerateError(b_),r=this.finalize(this.startNode(t),new lS(r,o,n)),i&&this.match("=>")){for(let t=0;t<o.length;++t)this.reinterpretExpressionAsPattern(o[t]);r={type:zL,params:o,async:!0}}}else if(this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,this.expect("[");const e=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),r=this.finalize(this.startNode(t),new jS(!0,r,e,n))}else if(10===this.lookahead.type&&this.lookahead.head){n&&this.throwUnexpectedToken(this.lookahead),o&&this.throwError(eL);const e=this.parseTemplateLiteral({isTagged:!0});r=this.finalize(this.startNode(t),new l_(r,e))}else{if(!this.match(".")&&!n)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!n,n||this.expect(".");const e=this.parseIdentifierName(!0);r=this.finalize(this.startNode(t),new jS(!1,r,e,n))}}}return this.context.allowIn=n,o?new hS(r):r}parseSuper(){const t=this.createNode();return this.expectKeyword("super"),this.match("[")||this.match(".")||this.throwUnexpectedToken(this.lookahead),this.finalize(t,new s_)}parseLeftHandSideExpression(){I_(this.context.allowIn,"callee of new expression always allow in keyword.");const t=this.startNode(this.lookahead);let e=this.matchKeyword("super")&&this.context.inFunctionBody?this.parseSuper():this.inheritCoverGrammar(this.matchKeyword("new")?this.parseNewExpression:this.parsePrimaryExpression),n=!1;for(;;){let r=!1;if(this.match("?.")&&(r=!0,n=!0,this.expect("?.")),this.match("[")){this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,this.expect("[");const n=this.isolateCoverGrammar(this.parseExpression);this.expect("]"),e=this.finalize(t,new jS(!0,e,n,r))}else if(10===this.lookahead.type&&this.lookahead.head){r&&this.throwUnexpectedToken(this.lookahead),n&&this.throwError(eL);const i=this.parseTemplateLiteral({isTagged:!0});e=this.finalize(t,new l_(e,i))}else{if(!this.match(".")&&!r)break;{this.context.isBindingElement=!1,this.context.isAssignmentTarget=!r,r||this.expect(".");const n=this.parseIdentifierName();e=this.finalize(t,new jS(!1,e,n,r))}}}return n?new hS(e):e}parseUpdateExpression(){let t;const e=this.lookahead;if(this.match("++")||this.match("--")){const n=this.startNode(e),r=this.nextToken();t=this.inheritCoverGrammar(this.parseUnaryExpression),this.context.strict&&t.type===RN.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(CL),this.context.isAssignmentTarget||this.tolerateError(K_);const i=!0;t=this.finalize(n,new A_(r.value,t,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else if(t=this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall),!this.hasLineTerminator&&7===this.lookahead.type&&(this.match("++")||this.match("--"))){this.context.strict&&t.type===RN.Identifier&&this.scanner.isRestrictedWord(t.name)&&this.tolerateError(IL),this.context.isAssignmentTarget||this.tolerateError(K_),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=this.nextToken().value,r=!1;t=this.finalize(this.startNode(e),new A_(n,t,r))}return t}parseAwaitExpression(){const t=this.createNode();this.nextToken();const e=this.parseUnaryExpression();return this.finalize(t,new iS(e))}parseUnaryExpression(){let t;if(this.match("+")||this.match("-")||this.match("~")||this.match("!")||this.matchKeyword("delete")||this.matchKeyword("void")||this.matchKeyword("typeof")){const e=this.startNode(this.lookahead),n=this.nextToken();t=this.inheritCoverGrammar(this.parseUnaryExpression),t=this.finalize(e,new g_(n.value,t)),this.context.strict&&"delete"===t.operator&&t.argument.type===RN.Identifier&&this.tolerateError(mL),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}else t=(this.context.isModule&&!this.context.inFunctionBody||this.context.isAsync)&&this.matchContextualKeyword("await")?this.parseAwaitExpression():this.parseUpdateExpression();return t}parseExponentiationExpression(){const t=this.lookahead,e=this.match("(");let n=this.inheritCoverGrammar(this.parseUnaryExpression);if((n.type!==RN.UnaryExpression||e)&&this.match("**")){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const e=n,r=this.isolateCoverGrammar(this.parseExponentiationExpression);n=this.finalize(this.startNode(t),new sS("**",e,r))}return n}binaryPrecedence(t){const e=t.value;let n;return n=7===t.type?this.operatorPrecedence[e]||0:4===t.type&&("instanceof"===e||this.context.allowIn&&"in"===e)?12:0,n}parseBinaryExpression(){const t=this.lookahead;let e=this.inheritCoverGrammar(this.parseExponentiationExpression),n=!0,r=!0;const i=t=>{"&&"!==t.value&&"||"!==t.value||(r=!1),"??"===t.value&&(n=!1)},o=this.lookahead;let s=this.binaryPrecedence(o);if(s>0){i(o),this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const a=[t,this.lookahead];let c=e,l=this.isolateCoverGrammar(this.parseExponentiationExpression);const u=[c,o.value,l],h=[s];for(;s=this.binaryPrecedence(this.lookahead),!(s<=0);){for((n||"&&"!==this.lookahead.value&&"||"!==this.lookahead.value)&&(r||"??"!==this.lookahead.value)||this.throwUnexpectedToken(this.lookahead),i(this.lookahead);u.length>2&&s<=h[h.length-1];){l=u.pop();const t=u.pop();h.pop(),c=u.pop(),a.pop();const e=a[a.length-1],n=this.startNode(e,e.lineStart),r="||"===t||"&&"===t||"??"===t;u.push(this.finalize(n,r?new VS(t,c,l):new sS(t,c,l)))}u.push(this.nextToken().value),h.push(s),a.push(this.lookahead),u.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}let d=u.length-1;e=u[d];let p=a.pop();for(;d>1;){const t=a.pop(),n=p&&p.lineStart,r=this.startNode(t,n),i=u[d-1],o="||"===i||"&&"===i||"??"===i;e=this.finalize(r,o?new VS(i,u[d-2],e):new sS(i,u[d-2],e)),d-=2,p=t}}return e}parseConditionalExpression(){const t=this.lookahead;let e=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();const n=this.context.allowIn;this.context.allowIn=!0;const r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=n,this.expect(":");const i=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new gS(e,r,i)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return e}checkPatternParam(t,e){switch(e.type){case RN.Identifier:this.validateParam(t,e,e.name);break;case RN.RestElement:this.checkPatternParam(t,e.argument);break;case RN.AssignmentPattern:this.checkPatternParam(t,e.left);break;case RN.ArrayPattern:for(let n=0;n<e.elements.length;n++)null!==e.elements[n]&&this.checkPatternParam(t,e.elements[n]);break;case RN.ObjectPattern:for(let n=0;n<e.properties.length;n++){const r=e.properties[n];this.checkPatternParam(t,r.type===RN.RestElement?r:r.value)}}t.simple=t.simple&&e instanceof LS}reinterpretAsCoverFormalsList(t){let e=[t];const n={simple:!0,paramSet:{}};let r=!1;switch(t.type){case RN.Identifier:break;case zL:e=t.params,r=t.async;break;default:return null}for(let t=0;t<e.length;++t){const i=e[t];i.type===RN.AssignmentPattern?i.right.type===RN.YieldExpression&&(i.right.argument&&this.throwUnexpectedToken(this.lookahead),i.right.type=RN.Identifier,i.right.name="yield",delete i.right.argument,delete i.right.delegate):r&&i.type===RN.Identifier&&"await"===i.name&&this.throwUnexpectedToken(this.lookahead),this.checkPatternParam(n,i),e[t]=i}if(this.context.strict||!this.context.allowYield)for(let t=0;t<e.length;++t){e[t].type===RN.YieldExpression&&this.throwUnexpectedToken(this.lookahead)}if(n.hasDuplicateParameterNames){const t=this.context.strict?n.stricted:n.firstRestricted;this.throwUnexpectedToken(t,Q_)}return{simple:n.simple,params:e,stricted:n.stricted,firstRestricted:n.firstRestricted,message:n.message}}parseAssignmentExpression(){let t;if(!this.context.allowYield&&this.matchKeyword("yield"))t=this.parseYieldExpression();else{const e=this.lookahead;let n=e;if(t=this.parseConditionalExpression(),3===n.type&&n.lineNumber===this.lookahead.lineNumber&&"async"===n.value&&(3===this.lookahead.type||this.matchKeyword("yield"))){const e=this.parsePrimaryExpression();this.reinterpretExpressionAsPattern(e),t={type:zL,params:[e],async:!0}}if(t.type===zL||this.match("=>")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;const n=t.async,r=this.reinterpretAsCoverFormalsList(t);if(r){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;const i=this.context.strict,o=this.context.allowStrictDirective;this.context.allowStrictDirective=r.simple;const s=this.context.allowYield,a=this.context.isAsync;this.context.allowYield=!0,this.context.isAsync=n;const c=this.startNode(e);let l;if(this.expect("=>"),this.match("{")){const t=this.context.allowIn;this.context.allowIn=!0,l=this.parseFunctionSourceElements(),this.context.allowIn=t}else l=this.isolateCoverGrammar(this.parseAssignmentExpression);const u=l.type!==RN.BlockStatement;this.context.strict&&r.firstRestricted&&this.throwUnexpectedToken(r.firstRestricted,r.message),this.context.strict&&r.stricted&&this.tolerateUnexpectedToken(r.stricted,r.message),t=this.finalize(c,new tS(r.params,l,u,n)),this.context.strict=i,this.context.allowStrictDirective=o,this.context.allowYield=s,this.context.isAsync=a}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(K_),this.context.strict&&t.type===RN.Identifier){const e=t;this.scanner.isRestrictedWord(e.name)&&this.tolerateUnexpectedToken(n,BL),this.scanner.isStrictModeReservedWord(e.name)&&this.tolerateUnexpectedToken(n,vL)}this.match("=")?this.reinterpretExpressionAsPattern(t):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1),n=this.nextToken();const r=n.value,i=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new eS(r,t,i)),this.context.firstCoverInitializedNameError=null}}return t}parseExpression(){const t=this.lookahead;let e=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){const n=[];for(n.push(e);2!==this.lookahead.type&&this.match(",");)this.nextToken(),n.push(this.isolateCoverGrammar(this.parseAssignmentExpression));e=this.finalize(this.startNode(t),new r_(n))}return e}parseStatementListItem(){let t;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,H_),t=this.parseExportDeclaration();break;case"import":this.matchImportCall()?t=this.parseExpressionStatement():this.matchImportMeta()?t=this.parseStatement():(this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,Y_),t=this.parseImportDeclaration());break;case"const":t=this.parseLexicalDeclaration({inFor:!1});break;case"function":t=this.parseFunctionDeclaration();break;case"class":t=this.parseClassDeclaration();break;case"let":t=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:t=this.parseStatement()}else t=this.parseStatement();return t}parseBlock(){const t=this.createNode();this.expect("{");const e=[];for(;!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new aS(e))}parseLexicalBinding(t,e){const n=this.createNode(),r=this.parsePattern([],t);this.context.strict&&r.type===RN.Identifier&&this.scanner.isRestrictedWord(r.name)&&this.tolerateError(ML);let i=null;return"const"===t?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),i=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(x_,"const")):(!e.inFor&&r.type!==RN.Identifier||this.match("="))&&(this.expect("="),i=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(n,new m_(r,i))}parseBindingList(t,e){const n=[this.parseLexicalBinding(t,e)];for(;this.match(",");)this.nextToken(),n.push(this.parseLexicalBinding(t,e));return n}isLexicalDeclaration(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.scanner.lex();return this.scanner.restoreState(t),3===e.type||7===e.type&&"["===e.value||7===e.type&&"{"===e.value||4===e.type&&"let"===e.value||4===e.type&&"yield"===e.value}parseLexicalDeclaration(t){const e=this.createNode(),n=this.nextToken().value;I_("let"===n||"const"===n,"Lexical declaration must be either let or const");const r=this.parseBindingList(n,t);return this.consumeSemicolon(),this.finalize(e,new E_(r,n))}isInitializedProperty(){let t=this.scanner.saveState();this.scanner.scanComments();let e=this.scanner.lex();return this.scanner.restoreState(t),3===this.lookahead.type&&"="===e.value}isDeclaredProperty(){let t=this.scanner.saveState();this.scanner.scanComments();let e=this.scanner.lex();return this.scanner.restoreState(t),3===this.lookahead.type&&";"===e.value||3===this.lookahead.type&&e.lineNumber!==this.startMarker.line}parseBindingRestElement(t,e){const n=this.createNode();this.expect("...");const r=this.parsePattern(t,e);return this.finalize(n,new t_(r))}parseArrayPattern(t,e){const n=this.createNode();this.expect("[");const r=[];for(;!this.match("]");)if(this.match(","))this.nextToken(),r.push(null);else{if(this.match("...")){r.push(this.parseBindingRestElement(t,e));break}r.push(this.parsePatternWithDefault(t,e)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(n,new $N(r))}parsePropertyPattern(t,e){const n=this.createNode();let r=!1,i=!1;let o,s;if(3===this.lookahead.type){const r=this.lookahead;o=this.parseVariableIdentifier();const a=this.finalize(n,new LS(r.value));if(this.match("=")){t.push(r),i=!0,this.nextToken();const e=this.parseAssignmentExpression();s=this.finalize(this.startNode(r),new nS(a,e))}else this.match(":")?(this.expect(":"),s=this.parsePatternWithDefault(t,e)):(t.push(r),i=!0,s=a)}else r=this.match("["),o=this.parseObjectPropertyKey(),this.expect(":"),s=this.parsePatternWithDefault(t,e);return this.finalize(n,new ZS("init",o,r,s,!1,i))}parseRestProperty(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(F_),this.match("}")||this.throwError(fL),this.finalize(e,new t_(n))}parseObjectPattern(t,e){const n=this.createNode(),r=[];for(this.expect("{");!this.match("}");)r.push(this.match("...")?this.parseRestProperty(t):this.parsePropertyPattern(t,e)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(n,new qS(r))}parsePattern(t,e){let n;return this.match("[")?n=this.parseArrayPattern(t,e):this.match("{")?n=this.parseObjectPattern(t,e):(!this.matchKeyword("let")||"const"!==e&&"let"!==e||this.tolerateUnexpectedToken(this.lookahead,rL),t.push(this.lookahead),n=this.parseVariableIdentifier(e)),n}parsePatternWithDefault(t,e){const n=this.lookahead;let r=this.parsePattern(t,e);if(this.match("=")){this.nextToken();const t=this.context.allowYield;this.context.allowYield=!0;const e=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=t,r=this.finalize(this.startNode(n),new nS(r,e))}return r}parseVariableIdentifier(t){const e=this.createNode(),n=this.nextToken();return 4===n.type&&"yield"===n.value?this.context.strict?this.tolerateUnexpectedToken(n,vL):this.context.allowYield||this.throwUnexpectedToken(n):3!==n.type?this.context.strict&&4===n.type&&this.scanner.isStrictModeReservedWord(n.value)?this.tolerateUnexpectedToken(n,vL):(this.context.strict||"let"!==n.value||"var"!==t)&&this.throwUnexpectedToken(n):(this.context.isModule||this.context.isAsync)&&3===n.type&&"await"===n.value&&this.tolerateUnexpectedToken(n),this.finalize(e,new LS(n.value))}parseVariableDeclaration(t){const e=this.createNode(),n=this.parsePattern([],"var");this.context.strict&&n.type===RN.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(ML);let r=null;return this.match("=")?(this.nextToken(),r=this.isolateCoverGrammar(this.parseAssignmentExpression)):n.type===RN.Identifier||t.inFor||this.expect("="),this.finalize(e,new m_(n,r))}parseVariableDeclarationList(t){const e={inFor:t.inFor},n=[];for(n.push(this.parseVariableDeclaration(e));this.match(",");)this.nextToken(),n.push(this.parseVariableDeclaration(e));return n}parseVariableStatement(){const t=this.createNode();this.expectKeyword("var");const e=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(t,new E_(e,"var"))}parseEmptyStatement(){const t=this.createNode();return this.expect(";"),this.finalize(t,new BS)}parseExpressionStatement(){const t=this.createNode(),e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new DS(e))}parseIfClause(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(wL),this.parseStatement()}parseIfStatement(){const t=this.createNode();let e,n=null;this.expectKeyword("if"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS)):(this.expect(")"),e=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),n=this.parseIfClause())),this.finalize(t,new xS(r,e,n))}parseDoWhileStatement(){const t=this.createNode();this.expectKeyword("do"),this.tolerateInvalidLoopStatement();const e=this.context.inIteration;this.context.inIteration=!0;const n=this.parseStatement();this.context.inIteration=e,this.expectKeyword("while"),this.expect("(");const r=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new yS(n,r))}parseWhileStatement(){const t=this.createNode();let e;this.expectKeyword("while"),this.expect("(");const n=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS);else{this.expect(")");const t=this.context.inIteration;this.context.inIteration=!0,e=this.parseStatement(),this.context.inIteration=t}return this.finalize(t,new w_(n,e))}parseForStatement(){let t,e,n=null,r=null,i=null,o=!0,s=!1;const a=this.createNode();if(this.expectKeyword("for"),this.matchContextualKeyword("await")&&(this.context.isAsync||this.tolerateUnexpectedToken(this.lookahead),s=!0,this.nextToken()),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){n=this.createNode(),this.nextToken();const r=this.context.allowIn;this.context.allowIn=!1;const i=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=r,!s&&1===i.length&&this.matchKeyword("in")){const r=i[0];r.init&&(r.id.type===RN.ArrayPattern||r.id.type===RN.ObjectPattern||this.context.strict)&&this.tolerateError(P_,"for-in"),n=this.finalize(n,new E_(i,"var")),this.nextToken(),t=n,e=this.parseExpression(),n=null}else 1===i.length&&null===i[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new E_(i,"var")),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,o=!1):(n=this.finalize(n,new E_(i,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){n=this.createNode();const r=this.nextToken().value;if(this.context.strict||"in"!==this.lookahead.value){const i=this.context.allowIn;this.context.allowIn=!1;const s=this.parseBindingList(r,{inFor:!0});this.context.allowIn=i,1===s.length&&null===s[0].init&&this.matchKeyword("in")?(n=this.finalize(n,new E_(s,r)),this.nextToken(),t=n,e=this.parseExpression(),n=null):1===s.length&&null===s[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new E_(s,r)),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,o=!1):(this.consumeSemicolon(),n=this.finalize(n,new E_(s,r)))}else n=this.finalize(n,new LS(r)),this.nextToken(),t=n,e=this.parseExpression(),n=null}else{const r=this.lookahead,i=this.context.isBindingElement,s=this.context.isAssignmentTarget,a=this.context.firstCoverInitializedNameError,c=this.context.allowIn;if(this.context.allowIn=!1,n=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=c,this.matchKeyword("in"))this.context.isAssignmentTarget&&n.type!==RN.AssignmentExpression||this.tolerateError(Z_),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseExpression(),n=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&n.type!==RN.AssignmentExpression||this.tolerateError(X_),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseAssignmentExpression(),n=null,o=!1;else{if(this.context.isBindingElement=i,this.context.isAssignmentTarget=s,this.context.firstCoverInitializedNameError=a,this.match(",")){const t=[n];for(;this.match(",");)this.nextToken(),t.push(this.isolateCoverGrammar(this.parseAssignmentExpression));n=this.finalize(this.startNode(r),new r_(t))}this.expect(";")}}let c;if(void 0===t&&(this.match(";")||(r=this.isolateCoverGrammar(this.parseExpression)),this.expect(";"),this.match(")")||(i=this.isolateCoverGrammar(this.parseExpression))),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),c=this.finalize(this.createNode(),new BS);else{this.expect(")"),this.tolerateInvalidLoopStatement();const t=this.context.inIteration;this.context.inIteration=!0,c=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=t}return void 0===t?this.finalize(a,new NS(n,r,i,c)):o?this.finalize(a,new vS(t,e,c)):this.finalize(a,new MS(t,e,c,s))}parseContinueStatement(){const t=this.createNode();this.expectKeyword("continue");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier();e=t;const n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(PL,t.name)}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.throwError(j_),this.finalize(t,new AS(e))}parseBreakStatement(){const t=this.createNode();this.expectKeyword("break");let e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){const t=this.parseVariableIdentifier(),n="$"+t.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(PL,t.name),e=t}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.context.inSwitch||this.throwError(V_),this.finalize(t,new cS(e))}parseReturnStatement(){this.context.inFunctionBody||this.tolerateError(J_);const t=this.createNode();this.expectKeyword("return");const e=!this.match(";")&&!this.match("}")&&!this.hasLineTerminator&&2!==this.lookahead.type||8===this.lookahead.type||10===this.lookahead.type?this.parseExpression():null;return this.consumeSemicolon(),this.finalize(t,new e_(e))}parseWithStatement(){this.context.strict&&this.tolerateError(TL);const t=this.createNode();let e;this.expectKeyword("with"),this.expect("(");const n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),e=this.finalize(this.createNode(),new BS)):(this.expect(")"),e=this.parseStatement()),this.finalize(t,new y_(n,e))}parseSwitchCase(){const t=this.createNode();let e;this.matchKeyword("default")?(this.nextToken(),e=null):(this.expectKeyword("case"),e=this.parseExpression()),this.expect(":");const n=[];for(;!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)n.push(this.parseStatementListItem());return this.finalize(t,new a_(e,n))}parseSwitchStatement(){const t=this.createNode();this.expectKeyword("switch"),this.expect("(");const e=this.parseExpression();this.expect(")");const n=this.context.inSwitch;this.context.inSwitch=!0;const r=[];let i=!1;for(this.expect("{");!this.match("}");){const t=this.parseSwitchCase();null===t.test&&(i&&this.throwError(oL),i=!0),r.push(t)}return this.expect("}"),this.context.inSwitch=n,this.finalize(t,new c_(e,r))}parseLabelledStatement(){const t=this.createNode(),e=this.parseExpression();let n;if(e.type===RN.Identifier&&this.match(":")){this.nextToken();const t=e,r="$"+t.name;let i;if(Object.prototype.hasOwnProperty.call(this.context.labelSet,r)&&this.throwError(gL,"Label",t.name),this.context.labelSet[r]=!0,this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),i=this.parseClassDeclaration();else if(this.matchKeyword("function")){const t=this.lookahead,e=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(t,wL):e.generator&&this.tolerateUnexpectedToken(t,G_),i=e}else i=this.parseStatement();delete this.context.labelSet[r],n=new PS(t,i)}else this.consumeSemicolon(),n=new DS(e);return this.finalize(t,n)}parseThrowStatement(){const t=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(sL);const e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new p_(e))}parseCatchClause(){const t=this.createNode();this.expectKeyword("catch");let e=null;if(this.match("(")){this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);const t=[];e=this.parsePattern(t);const n={};for(let e=0;e<t.length;e++){const r="$"+t[e].value;Object.prototype.hasOwnProperty.call(n,r)&&this.tolerateError(k_,t[e].value),n[r]=!0}this.context.strict&&e.type===RN.Identifier&&this.scanner.isRestrictedWord(e.name)&&this.tolerateError(EL),this.expect(")")}const n=this.parseBlock();return this.finalize(t,new uS(e,n))}parseFinallyClause(){return this.expectKeyword("finally"),this.parseBlock()}parseTryStatement(){const t=this.createNode();this.expectKeyword("try");const e=this.parseBlock(),n=this.matchKeyword("catch")?this.parseCatchClause():null,r=this.matchKeyword("finally")?this.parseFinallyClause():null;return n||r||this.throwError(lL),this.finalize(t,new f_(e,n,r))}parseDebuggerStatement(){const t=this.createNode();return this.expectKeyword("debugger"),this.consumeSemicolon(),this.finalize(t,new ES)}parseStatement(){let t;switch(this.lookahead.type){case 1:case 5:case 6:case 8:case 10:case 9:t=this.parseExpressionStatement();break;case 7:const e=this.lookahead.value;t="{"===e?this.parseBlock():"("===e?this.parseExpressionStatement():";"===e?this.parseEmptyStatement():this.parseExpressionStatement();break;case 3:t=this.matchAsyncFunction()?this.parseFunctionDeclaration():this.parseLabelledStatement();break;case 4:switch(this.lookahead.value){case"break":t=this.parseBreakStatement();break;case"continue":t=this.parseContinueStatement();break;case"debugger":t=this.parseDebuggerStatement();break;case"do":t=this.parseDoWhileStatement();break;case"for":t=this.parseForStatement();break;case"function":t=this.parseFunctionDeclaration();break;case"if":t=this.parseIfStatement();break;case"return":t=this.parseReturnStatement();break;case"switch":t=this.parseSwitchStatement();break;case"throw":t=this.parseThrowStatement();break;case"try":t=this.parseTryStatement();break;case"var":t=this.parseVariableStatement();break;case"while":t=this.parseWhileStatement();break;case"with":t=this.parseWithStatement();break;default:t=this.parseExpressionStatement()}break;default:t=this.throwUnexpectedToken(this.lookahead)}return t}parseFunctionSourceElements(){const t=this.createNode();this.expect("{");const e=this.parseDirectivePrologues(),n=this.context.labelSet,r=this.context.inIteration,i=this.context.inSwitch,o=this.context.inFunctionBody;for(this.context.labelSet={},this.context.inIteration=!1,this.context.inSwitch=!1,this.context.inFunctionBody=!0;2!==this.lookahead.type&&!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.context.labelSet=n,this.context.inIteration=r,this.context.inSwitch=i,this.context.inFunctionBody=o,this.finalize(t,new aS(e))}validateParam(t,e,n){const r="$"+n;this.context.strict?(this.scanner.isRestrictedWord(n)&&(t.stricted=e,t.message=DL),Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)):t.firstRestricted||(this.scanner.isRestrictedWord(n)?(t.firstRestricted=e,t.message=DL):this.scanner.isStrictModeReservedWord(n)?(t.firstRestricted=e,t.message=vL):Object.prototype.hasOwnProperty.call(t.paramSet,r)&&(t.stricted=e,t.hasDuplicateParameterNames=!0)),"function"==typeof Object.defineProperty?Object.defineProperty(t.paramSet,r,{value:!0,enumerable:!0,writable:!0,configurable:!0}):t.paramSet[r]=!0}parseRestElement(t){const e=this.createNode();this.expect("...");const n=this.parsePattern(t);return this.match("=")&&this.throwError(R_),this.match(")")||this.throwError(pL),this.finalize(e,new t_(n))}parseFormalParameter(t){const e=[],n=this.match("...")?this.parseRestElement(e):this.parsePatternWithDefault(e);for(let n=0;n<e.length;n++)this.validateParam(t,e[n],e[n].value);t.simple=t.simple&&n instanceof LS,t.params.push(n)}parseFormalParameters(t){const e={simple:!0,hasDuplicateParameterNames:!1,params:[],firstRestricted:t};if(this.expect("("),!this.match(")"))for(e.paramSet={};2!==this.lookahead.type&&(this.parseFormalParameter(e),!this.match(")"))&&(this.expect(","),!this.match(")")););return this.expect(")"),e.hasDuplicateParameterNames&&(this.context.strict||this.context.isAsync||!e.simple)&&this.throwError(Q_),{simple:e.simple,params:e.params,stricted:e.stricted,firstRestricted:e.firstRestricted,message:e.message}}matchAsyncFunction(){let t=this.matchContextualKeyword("async");if(t){const e=this.scanner.saveState();this.scanner.scanComments();const n=this.scanner.lex();this.scanner.restoreState(e),t=e.lineNumber===n.lineNumber&&4===n.type&&"function"===n.value}return t}parseFunctionDeclaration(t){const e=this.createNode(),n=this.matchContextualKeyword("async");n&&(this.context.inIteration&&this.tolerateError(T_),this.nextToken()),this.expectKeyword("function");const r=this.match("*");let i;r&&this.nextToken();let o=null,s=null;if(!t||!this.match("(")){const t=this.lookahead;o=this.parseVariableIdentifier(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,yL):this.scanner.isRestrictedWord(t.value)?(s=t,i=yL):this.scanner.isStrictModeReservedWord(t.value)&&(s=t,i=vL)}const a=this.context.isAsync,c=this.context.allowYield;this.context.isAsync=n,this.context.allowYield=!r;const l=this.parseFormalParameters(s),u=l.params,h=l.stricted;s=l.firstRestricted,l.message&&(i=l.message);const d=this.context.strict,p=this.context.allowStrictDirective;this.context.allowStrictDirective=l.simple;const f=this.parseFunctionSourceElements();return this.context.strict&&s&&this.throwUnexpectedToken(s,i),this.context.strict&&h&&this.tolerateUnexpectedToken(h,i),this.context.strict=d,this.context.allowStrictDirective=p,this.context.isAsync=a,this.context.allowYield=c,n?this.finalize(e,new rS(o,u,f,r)):this.finalize(e,new SS(o,u,f,r))}parseFunctionExpression(){const t=this.createNode(),e=this.matchContextualKeyword("async");e&&this.nextToken(),this.expectKeyword("function");const n=this.match("*");let r;n&&this.nextToken();let i,o=null;const s=this.context.isAsync,a=this.context.allowYield;if(this.context.isAsync=e,this.context.allowYield=!n,!this.match("(")){const t=this.lookahead;o=this.context.strict||n||!this.matchKeyword("yield")?this.parseVariableIdentifier():this.parseIdentifierName(),this.context.strict?this.scanner.isRestrictedWord(t.value)&&this.tolerateUnexpectedToken(t,yL):this.scanner.isRestrictedWord(t.value)?(i=t,r=yL):this.scanner.isStrictModeReservedWord(t.value)&&(i=t,r=vL)}const c=this.parseFormalParameters(i),l=c.params,u=c.stricted;i=c.firstRestricted,c.message&&(r=c.message);const h=this.context.strict,d=this.context.allowStrictDirective;this.context.allowStrictDirective=c.simple;const p=this.parseFunctionSourceElements();return this.context.strict&&i&&this.throwUnexpectedToken(i,r),this.context.strict&&u&&this.tolerateUnexpectedToken(u,r),this.context.strict=h,this.context.allowStrictDirective=d,this.context.isAsync=s,this.context.allowYield=a,this.finalize(t,new _S(o,l,p,n,e))}parseDirective(){const t=this.lookahead,e=this.createNode(),n=this.parseExpression(),r=n.type===RN.Literal?this.getTokenRaw(t).slice(1,-1):null;return this.consumeSemicolon(),this.finalize(e,r?new wS(n,r):new DS(n))}parseDirectivePrologues(){let t=null;const e=[];for(;;){const n=this.lookahead;if(8!==n.type)break;const r=this.parseDirective();e.push(r);const i=r.directive;if("string"!=typeof i)break;"use strict"===i?(this.context.strict=!0,t&&this.tolerateUnexpectedToken(t,bL),this.context.allowStrictDirective||this.tolerateUnexpectedToken(n,z_)):!t&&n.octal&&(t=n)}return e}qualifiedPropertyName(t){switch(t.type){case 3:case 8:case 1:case 5:case 6:case 4:return!0;case 7:return"["===t.value||"#"===t.value}return!1}parseGetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();r.params.length>0&&this.tolerateError(D_);const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new _S(null,r.params,i,e,!1))}parseSetterMethod(){const t=this.createNode(),e=!1,n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();1!==r.params.length?this.tolerateError(v_):r.params[0]instanceof t_&&this.tolerateError(M_);const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(t,new _S(null,r.params,i,e,!1))}parseGeneratorMethod(t){const e=this.createNode(),n=this.context.allowYield;this.context.allowYield=!0;const r=this.parseFormalParameters();this.context.allowYield=!1;const i=this.parsePropertyMethod(r);return this.context.allowYield=n,this.finalize(e,new _S(null,r.params,i,!0,t))}isStartOfExpression(){let t=!0;const e=this.lookahead.value;switch(this.lookahead.type){case 7:t="["===e||"("===e||"{"===e||"+"===e||"-"===e||"!"===e||"~"===e||"++"===e||"--"===e||"/"===e||"/="===e;break;case 4:t="class"===e||"delete"===e||"function"===e||"let"===e||"new"===e||"super"===e||"this"===e||"typeof"===e||"void"===e||"yield"===e}return t}parseYieldExpression(){const t=this.createNode();this.expectKeyword("yield");let e=null,n=!1;if(!this.hasLineTerminator){const t=this.context.allowYield;this.context.allowYield=!1,n=this.match("*"),n?(this.nextToken(),e=this.parseAssignmentExpression()):this.isStartOfExpression()&&(e=this.parseAssignmentExpression()),this.context.allowYield=t}return this.finalize(t,new B_(e,n))}parseStaticBlock(){const t=this.createNode();this.expect("{");const e=[];for(;!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new o_(e))}parseDecorator(){const t=this.createNode();this.expect("@");const e=this.context.strict,n=this.context.allowYield,r=this.context.isAsync;this.context.strict=!1,this.context.allowYield=!0,this.context.isAsync=!1;const i=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);return this.context.strict=e,this.context.allowYield=n,this.context.isAsync=r,this.match(";")&&this.throwError(uL),this.finalize(t,new mS(i))}parseDecorators(){let t=null;for(;this.match("@");)null==t&&(t=[]),t.push(this.parseDecorator());return t}parseClassElement(t){let e=this.lookahead;const n=this.createNode(),r=this.context.inConstructor;let i="",o=null,s=null,a=!1,c=!1,l=!1,u=!1,h=!1,d=!1;const p=this.parseDecorators();if(p&&(e=this.lookahead),this.match("*"))this.nextToken();else{a=this.match("["),this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d);const t=o;if(this.context.inConstructor=3===e.type&&"constructor"===e.value,"static"===t.name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(e=this.lookahead,l=!0,a=this.match("["),this.match("*")?(this.nextToken(),this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead)):(this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d))),"static"===t.name&&this.match("{"))return this.parseStaticBlock();if(3===e.type&&!this.hasLineTerminator&&"async"===e.value){const t=this.lookahead.value;":"!==t&&"("!==t&&(u=!0,h=this.match("*"),h&&this.nextToken(),e=this.lookahead,a=this.match("["),this.match("*")?(this.nextToken(),this.match("#")&&(d=!0,this.nextToken())):(this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),o=this.parseObjectPropertyKey(d)),3!==e.type||"constructor"!==e.value||l||this.tolerateUnexpectedToken(e,S_))}}3===e.type&&"constructor"===e.value&&d&&this.tolerateUnexpectedToken(e,__);const f=this.qualifiedPropertyName(this.lookahead);if(3===e.type||8===e.type?"get"===e.value&&f?(i="get",this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),a=this.match("["),o=this.parseObjectPropertyKey(d),this.context.allowYield=!1,s=this.parseGetterMethod()):"set"===e.value&&f?(i="set",this.match("#")&&(d=!0,this.nextToken(),e=this.lookahead),a=this.match("["),o=this.parseObjectPropertyKey(d),s=this.parseSetterMethod()):this.match("(")||(i="property",a=!1,this.match("=")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression))):7===e.type&&"*"===e.value&&f?(i="init",a=this.match("["),o=this.parseObjectPropertyKey(d),s=this.parseGeneratorMethod(u),c=!0):7!==e.type||"["!==e.value||this.match("(")||(i="property",a=!0,this.match("=")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression))),!i&&o&&this.match("(")){const t=this.context.inClassConstructor;this.context.inClassConstructor="constructor"===e.value,i="init",s=u?this.parsePropertyMethodAsyncFunction(h):this.parsePropertyMethodFunction(h),this.context.inClassConstructor=t,c=!0}return i||this.throwUnexpectedToken(this.lookahead),"init"===i&&(i="method"),a||(l&&this.isPropertyKey(o,"prototype")&&this.throwUnexpectedToken(e,AL),!l&&this.isPropertyKey(o,"constructor")&&(("method"!==i||!c||s&&s.generator)&&this.throwUnexpectedToken(e,L_),t.value?this.throwUnexpectedToken(e,O_):t.value=!0,i="constructor")),this.context.inConstructor=r,"property"===i?(this.consumeSemicolon(),this.finalize(n,new XS(o,a,s,l,p))):this.finalize(n,new YS(o,a,s,i,l,p))}parseClassElementList(){const t=[],e={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():t.push(this.parseClassElement(e));return this.expect("}"),t}parseClassBody(){const t=this.createNode(),e=this.parseClassElementList();return this.finalize(t,new dS(e))}parseClassDeclaration(t){const e=this.createNode(),n=this.context.strict,r=this.context.allowSuper;this.context.strict=!0,this.expectKeyword("class");const i=t&&3!==this.lookahead.type?null:this.parseVariableIdentifier();let o=null;this.matchKeyword("extends")&&(this.nextToken(),o=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall),this.context.allowSuper=!0);const s=this.parseClassBody();return this.context.allowSuper=r,this.context.strict=n,this.finalize(e,new pS(i,o,s,this.context.decorators))}parseClassExpression(){const t=this.createNode(),e=this.context.strict;this.context.strict=!0,this.expectKeyword("class");const n=3===this.lookahead.type?this.parseVariableIdentifier():null;let r=null;this.matchKeyword("extends")&&(this.nextToken(),r=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall),this.context.allowSuper=!0);const i=this.parseClassBody();return this.context.strict=e,this.finalize(t,new fS(n,r,i,this.context.decorators))}parseModule(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new zS(e))}parseScript(){const t=this.createNode(),e=this.parseDirectivePrologues();for(;2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new n_(e))}parseImportAttributes(){if("assert"===this.lookahead.value){this.nextToken(),this.expect("{");const t=[];for(;!this.match("}");)t.push(this.parseImportAttribute()),this.match("}")||this.expectCommaSeparator();return this.expect("}"),t}return null}parseImportAttribute(){const t=this.createNode();3!==this.lookahead.type&&this.throwUnexpectedToken(this.nextToken());const e=this.parseIdentifierName();this.match(":")||this.throwUnexpectedToken(this.nextToken()),this.nextToken();const n=this.nextToken(),r=this.getTokenRaw(n),i=this.finalize(t,new GS(n.value,r));return this.finalize(t,new RS(e,i))}parseModuleSpecifier(){const t=this.createNode();8!==this.lookahead.type&&this.throwError($_);const e=this.nextToken(),n=this.getTokenRaw(e);return ON.isStringWellFormedUnicode(e.value)||this.throwError($_),this.finalize(t,new GS(e.value,n))}parseImportSpecifier(){const t=this.createNode();let e,n;return 3===this.lookahead.type?(e=this.parseVariableIdentifier(),n=e,this.matchContextualKeyword("as")&&(this.nextToken(),n=this.parseVariableIdentifier())):(e=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName(),n=e,this.matchContextualKeyword("as")?(this.nextToken(),n=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(t,new US(n,e))}parseNamedImports(){this.expect("{");const t=[];for(;!this.match("}");)t.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),t}parseImportDefaultSpecifier(){const t=this.createNode(),e=this.parseIdentifierName();return this.finalize(t,new OS(e))}parseImportNamespaceSpecifier(){const t=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(aL),this.lookahead.escaped&&this.throwError(cL),this.nextToken();const e=this.parseIdentifierName();return this.finalize(t,new QS(e))}parseImportDeclaration(){this.context.inFunctionBody&&this.throwError(Y_);const t=this.createNode();let e;this.expectKeyword("import");let n=[];if(8===this.lookahead.type)e=this.parseModuleSpecifier();else{if(this.match("{")?n=n.concat(this.parseNamedImports()):this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(n.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?n.push(this.parseImportNamespaceSpecifier()):this.match("{")?n=n.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}this.nextToken(),e=this.parseModuleSpecifier()}const r=this.parseImportAttributes();return this.consumeSemicolon(),this.finalize(t,new kS(n,e,r))}parseExportSpecifier(){const t=this.createNode(),e=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName();let n=e;return this.matchContextualKeyword("as")&&(this.lookahead.escaped&&this.throwError(cL),this.nextToken(),n=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName()),this.finalize(t,new bS(e,n))}parseExportDeclaration(){this.context.inFunctionBody&&this.throwError(H_);const t=this.createNode();let e;if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){const n=this.parseFunctionDeclaration(!0);e=this.finalize(t,new CS(n))}else if(this.matchKeyword("class")){const n=this.parseClassDeclaration(!0);e=this.finalize(t,new CS(n))}else if(this.matchContextualKeyword("async")){const n=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression();e=this.finalize(t,new CS(n))}else{this.matchContextualKeyword("from")&&this.throwError(QL,this.lookahead.value);const n=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression();this.consumeSemicolon(),e=this.finalize(t,new CS(n))}else if(this.match("*")){this.nextToken();let n=null;if(this.matchContextualKeyword("as")&&(this.lookahead.escaped&&this.throwError(cL),this.nextToken(),n=8==this.lookahead.type?this.parseModuleSpecifier():this.parseIdentifierName()),!this.matchContextualKeyword("from")){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}this.lookahead.escaped&&this.throwError(cL),this.nextToken();const r=this.parseModuleSpecifier(),i=this.parseImportAttributes();this.consumeSemicolon(),e=this.finalize(t,new IS(r,n,i))}else if(4===this.lookahead.type){let n;switch(this.lookahead.value){case"let":case"const":n=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":n=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}e=this.finalize(t,new TS(n,[],null,null))}else if(this.matchAsyncFunction()){const n=this.parseFunctionDeclaration();e=this.finalize(t,new TS(n,[],null,null))}else{const n=[];let r=null,i=!1,o=null;for(this.expect("{");!this.match("}");)i=i||this.matchKeyword("default"),n.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");if(this.expect("}"),this.matchContextualKeyword("from"))this.lookahead.escaped&&this.throwError(cL),this.nextToken(),r=this.parseModuleSpecifier(),o=this.parseImportAttributes(),this.consumeSemicolon();else if(i){const t=this.lookahead.value?QL:iL;this.throwError(t,this.lookahead.value)}else o=this.parseImportAttributes(),this.consumeSemicolon();e=this.finalize(t,new TS(null,n,r,o))}return e}}const WL={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"};function qL(t){let e;switch(t.type){case QN.JSXIdentifier:e=t.name;break;case QN.JSXNamespacedName:const n=t;e=qL(n.namespace)+":"+qL(n.name);break;case QN.JSXMemberExpression:const r=t;e=qL(r.object)+"."+qL(r.property)}return e}YL[100]="JSXIdentifier",YL[101]="JSXText";class KL extends JL{constructor(t,e,n){super(t,e,n)}parsePrimaryExpression(){return this.match("<")?this.parseJSXRoot():super.parsePrimaryExpression()}startJSX(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column}finishJSX(){this.nextToken()}reenterJSX(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()}createJSXNode(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}createJSXChildNode(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}scanXHTMLEntity(t){let e="&",n=!0,r=!1,i=!1,o=!1;for(;!this.scanner.eof()&&n&&!r;){const s=this.scanner.source[this.scanner.index];if(s===t)break;if(r=";"===s,e+=s,++this.scanner.index,!r)switch(e.length){case 2:i="#"===s;break;case 3:i&&(o="x"===s,n=o||ON.isDecimalDigit(s.charCodeAt(0)),i=i&&!o);break;default:n=n&&!(i&&!ON.isDecimalDigit(s.charCodeAt(0))),n=n&&!(o&&!ON.isHexDigit(s.charCodeAt(0)))}}if(n&&r&&e.length>2){const t=e.substr(1,e.length-2);i&&t.length>1?e=String.fromCharCode(parseInt(t.substr(1),10)):o&&t.length>2?e=String.fromCharCode(parseInt("0"+t.substr(1),16)):i||o||!WL[t]||(e=WL[t])}return e}lexJSX(){const t=this.scanner.source.charCodeAt(this.scanner.index);if(60===t||62===t||47===t||58===t||61===t||123===t||125===t){return{type:7,value:this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index}}if(34===t||39===t){const t=this.scanner.index,e=this.scanner.source[this.scanner.index++];let n="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index++];if(t===e)break;n+="&"===t?this.scanXHTMLEntity(e):t}return{type:8,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}if(46===t){const t=this.scanner.source.charCodeAt(this.scanner.index+1),e=this.scanner.source.charCodeAt(this.scanner.index+2),n=46===t&&46===e?"...":".",r=this.scanner.index;return this.scanner.index+=n.length,{type:7,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:r,end:this.scanner.index}}if(96===t)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(ON.isIdentifierStart(t)&&92!==t){const t=this.scanner.index;for(++this.scanner.index;!this.scanner.eof();){const t=this.scanner.source.charCodeAt(this.scanner.index);if(ON.isIdentifierPart(t)&&92!==t)++this.scanner.index;else{if(45!==t)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(t,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index}}return this.scanner.lex()}nextJSXToken(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(t)),t}nextJSXText(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;const t=this.scanner.index;let e="";for(;!this.scanner.eof();){const t=this.scanner.source[this.scanner.index];if("{"===t||"<"===t)break;++this.scanner.index,e+=t,ON.isLineTerminator(t.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===t&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;const n={type:101,value:e,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index};return e.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n}peekJSXToken(){const t=this.scanner.saveState();this.scanner.scanComments();const e=this.lexJSX();return this.scanner.restoreState(t),e}expectJSX(t){const e=this.nextJSXToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)}matchJSX(t){const e=this.peekJSXToken();return 7===e.type&&e.value===t}parseJSXIdentifier(){const t=this.createJSXNode(),e=this.nextJSXToken();return 100!==e.type&&this.throwUnexpectedToken(e),this.finalize(t,new HN(e.value))}parseJSXElementName(){const t=this.createJSXNode();let e=this.parseJSXIdentifier();if(this.matchJSX(":")){const n=e;this.expectJSX(":");const r=this.parseJSXIdentifier();e=this.finalize(t,new JN(n,r))}else if(this.matchJSX("."))for(;this.matchJSX(".");){const n=e;this.expectJSX(".");const r=this.parseJSXIdentifier();e=this.finalize(t,new YN(n,r))}return e}parseJSXAttributeName(){const t=this.createJSXNode();let e;const n=this.parseJSXIdentifier();if(this.matchJSX(":")){const r=n;this.expectJSX(":");const i=this.parseJSXIdentifier();e=this.finalize(t,new JN(r,i))}else e=n;return e}parseJSXStringLiteralAttribute(){const t=this.createJSXNode(),e=this.nextJSXToken();8!==e.type&&this.throwUnexpectedToken(e);const n=this.getTokenRaw(e);return this.finalize(t,new GS(e.value,n))}parseJSXExpressionAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new jN(e))}parseJSXAttributeValue(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()}parseJSXNameValueAttribute(){const t=this.createJSXNode(),e=this.parseJSXAttributeName();let n=null;return this.matchJSX("=")&&(this.expectJSX("="),n=this.parseJSXAttributeValue()),this.finalize(t,new zN(e,n))}parseJSXSpreadAttribute(){const t=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();const e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new KN(e))}parseJSXAttributes(){const t=[];for(;!this.matchJSX("/")&&!this.matchJSX(">");){const e=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();t.push(e)}return t}parseJSXOpeningElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new qN(!1));const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new WN(e,r,n))}parseJSXBoundaryElement(){const t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){if(this.expectJSX("/"),this.matchJSX(">"))return this.expectJSX(">"),this.finalize(t,new PN);const e=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(t,new UN(e))}const e=this.parseJSXElementName(),n=this.parseJSXAttributes(),r=this.matchJSX("/");return r&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new WN(e,r,n))}parseJSXEmptyExpression(){const t=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(t,new VN)}parseJSXExpressionContainer(){const t=this.createJSXNode();let e;return this.expectJSX("{"),this.matchJSX("}")?(e=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),e=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(t,new jN(e))}parseJSXChildren(){const t=[];for(;!this.scanner.eof();){const e=this.createJSXChildNode(),n=this.nextJSXText();if(n.start<n.end){const r=this.getTokenRaw(n),i=this.finalize(e,new ZN(n.value,r));t.push(i)}if("{"!==this.scanner.source[this.scanner.index])break;{const e=this.parseJSXExpressionContainer();t.push(e)}}return t}parseComplexJSXElement(t){const e=[];for(;!this.scanner.eof();){t.children=t.children.concat(this.parseJSXChildren());const n=this.createJSXChildNode(),r=this.parseJSXBoundaryElement();if(r.type===QN.JSXOpeningElement){const i=r;if(i.selfClosing){const e=this.finalize(n,new GN(i,[],null));t.children.push(e)}else e.push(t),t={node:n,opening:i,closing:null,children:[]}}if(r.type===QN.JSXClosingElement){t.closing=r;const n=qL(t.opening.name);if(n!==qL(t.closing.name)&&this.tolerateError("Expected corresponding JSX closing tag for %0",n),!(e.length>0))break;{const n=this.finalize(t.node,new GN(t.opening,t.children,t.closing));(t=e[e.length-1]).children.push(n),e.pop()}}if(r.type===QN.JSXClosingFragment){if(t.closing=r,t.opening.type===QN.JSXOpeningFragment)break;this.tolerateError("Expected corresponding JSX closing tag for jsx fragment")}}return t}parseJSXElement(){const t=this.createJSXNode(),e=this.parseJSXOpeningElement();let n=[],r=null;if(!e.selfClosing){const i=this.parseComplexJSXElement({node:t,opening:e,closing:r,children:n});n=i.children,r=i.closing}return this.finalize(t,new GN(e,n,r))}parseJSXRoot(){this.config.tokens&&this.tokens.pop(),this.startJSX();const t=this.parseJSXElement();return this.finishJSX(),t}isStartOfExpression(){return super.isStartOfExpression()||this.match("<")}}function ZL(t,e,n){let r=null;const i=(t,e)=>{n&&n(t,e),r&&r.visit(t,e)};let o="function"==typeof n?i:null,s=!1;if(e){s="boolean"==typeof e.comment&&e.comment;const t="boolean"==typeof e.attachComment&&e.attachComment;(s||t)&&(r=new FN,r.attach=t,e.comment=!0,o=i)}let a,c=!1;e&&"string"==typeof e.sourceType&&(c="module"===e.sourceType),a=e&&"boolean"==typeof e.jsx&&e.jsx?new KL(t,e,o):new JL(t,e,o);const l=c?a.parseModule():a.parseScript();return s&&r&&(l.comments=r.comments),a.config.tokens&&(l.tokens=a.tokens),a.config.tolerant&&(l.errors=a.errorHandler.errors),l}function XL(t,e,n){const r=e||{};return r.sourceType="script",ZL(t,r,n)}class $L{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+$L.version}static addUnaryOp(t){return $L.max_unop_len=Math.max(t.length,$L.max_unop_len),$L.unary_ops[t]=1,$L}static addBinaryOp(t,e,n){return $L.max_binop_len=Math.max(t.length,$L.max_binop_len),$L.binary_ops[t]=e,n?$L.right_associative.add(t):$L.right_associative.delete(t),$L}static addIdentifierChar(t){return $L.additional_identifier_chars.add(t),$L}static addLiteral(t,e){return $L.literals[t]=e,$L}static removeUnaryOp(t){return delete $L.unary_ops[t],t.length===$L.max_unop_len&&($L.max_unop_len=$L.getMaxKeyLen($L.unary_ops)),$L}static removeAllUnaryOps(){return $L.unary_ops={},$L.max_unop_len=0,$L}static removeIdentifierChar(t){return $L.additional_identifier_chars.delete(t),$L}static removeBinaryOp(t){return delete $L.binary_ops[t],t.length===$L.max_binop_len&&($L.max_binop_len=$L.getMaxKeyLen($L.binary_ops)),$L.right_associative.delete(t),$L}static removeAllBinaryOps(){return $L.binary_ops={},$L.max_binop_len=0,$L}static removeLiteral(t){return delete $L.literals[t],$L}static removeAllLiterals(){return $L.literals={},$L}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new $L(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(t=>t.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return $L.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!$L.binary_ops[String.fromCharCode(t)]||$L.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return $L.isIdentifierStart(t)||$L.isDecimalDigit(t)}throwError(t){const e=new Error(t+" at character "+this.index);throw e.index=this.index,e.description=t,e}runHook(t,e){if($L.hooks[t]){const n={context:this,node:e};return $L.hooks.run(t,n),n.node}return e}searchHook(t){if($L.hooks[t]){const e={context:this};return $L.hooks[t].find(function(t){return t.call(e.context,e),e.node}),e.node}}gobbleSpaces(){let t=this.code;for(;t===$L.SPACE_CODE||t===$L.TAB_CODE||t===$L.LF_CODE||t===$L.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),e=1===t.length?t[0]:{type:$L.COMPOUND,body:t};return this.runHook("after-all",e)}gobbleExpressions(t){let e,n,r=[];for(;this.index<this.expr.length;)if(e=this.code,e===$L.SEMCOL_CODE||e===$L.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())r.push(n);else if(this.index<this.expr.length){if(e===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){const t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,$L.max_binop_len),e=t.length;for(;e>0;){if($L.binary_ops.hasOwnProperty(t)&&(!$L.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!$L.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=e,t;t=t.substr(0,--e)}return!1}gobbleBinaryExpression(){let t,e,n,r,i,o,s,a,c;if(o=this.gobbleToken(),!o)return o;if(e=this.gobbleBinaryOp(),!e)return o;for(i={value:e,prec:$L.binaryPrecedence(e),right_a:$L.right_associative.has(e)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+e),r=[o,i,s];e=this.gobbleBinaryOp();){if(n=$L.binaryPrecedence(e),0===n){this.index-=e.length;break}i={value:e,prec:n,right_a:$L.right_associative.has(e)},c=e;const a=t=>i.right_a&&t.right_a?n>t.prec:n<=t.prec;for(;r.length>2&&a(r[r.length-2]);)s=r.pop(),e=r.pop().value,o=r.pop(),t={type:$L.BINARY_EXP,operator:e,left:o,right:s},r.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+c),r.push(i,t)}for(a=r.length-1,t=r[a];a>1;)t={type:$L.BINARY_EXP,operator:r[a-1].value,left:r[a-2],right:t},a-=2;return t}gobbleToken(){let t,e,n,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(t=this.code,$L.isDecimalDigit(t)||t===$L.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===$L.SQUOTE_CODE||t===$L.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(t===$L.OBRACK_CODE)r=this.gobbleArray();else{for(e=this.expr.substr(this.index,$L.max_unop_len),n=e.length;n>0;){if($L.unary_ops.hasOwnProperty(e)&&(!$L.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!$L.isIdentifierPart(this.expr.charCodeAt(this.index+e.length)))){this.index+=n;const t=this.gobbleToken();return t||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:$L.UNARY_EXP,operator:e,argument:t,prefix:!0})}e=e.substr(0,--n)}$L.isIdentifierStart(t)?(r=this.gobbleIdentifier(),$L.literals.hasOwnProperty(r.name)?r={type:$L.LITERAL,value:$L.literals[r.name],raw:r.name}:r.name===$L.this_str&&(r={type:$L.THIS_EXP})):t===$L.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let e=this.code;for(;e===$L.PERIOD_CODE||e===$L.OBRACK_CODE||e===$L.OPAREN_CODE||e===$L.QUMARK_CODE;){let n;if(e===$L.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==$L.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),e=this.code}this.index++,e===$L.OBRACK_CODE?((t={type:$L.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()}).property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),e=this.code,e!==$L.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):e===$L.OPAREN_CODE?t={type:$L.CALL_EXP,arguments:this.gobbleArguments($L.CPAREN_CODE),callee:t}:(e===$L.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:$L.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),e=this.code}return t}gobbleNumericLiteral(){let t,e,n="";for(;$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(this.code===$L.PERIOD_CODE)for(n+=this.expr.charAt(this.index++);$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);if(t=this.char,"e"===t||"E"===t){for(n+=this.expr.charAt(this.index++),t=this.char,"+"!==t&&"-"!==t||(n+=this.expr.charAt(this.index++));$L.isDecimalDigit(this.code);)n+=this.expr.charAt(this.index++);$L.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+n+this.char+")")}return e=this.code,$L.isIdentifierStart(e)?this.throwError("Variable names cannot start with a number ("+n+this.char+")"):(e===$L.PERIOD_CODE||1===n.length&&n.charCodeAt(0)===$L.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:$L.LITERAL,value:parseFloat(n),raw:n}}gobbleStringLiteral(){let t="";const e=this.index,n=this.expr.charAt(this.index++);let r=!1;for(;this.index<this.expr.length;){let e=this.expr.charAt(this.index++);if(e===n){r=!0;break}if("\\"===e)switch(e=this.expr.charAt(this.index++),e){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=e}else t+=e}return r||this.throwError('Unclosed quote after "'+t+'"'),{type:$L.LITERAL,value:t,raw:this.expr.substring(e,this.index)}}gobbleIdentifier(){let t=this.code,e=this.index;for($L.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,$L.isIdentifierPart(t));)this.index++;return{type:$L.IDENTIFIER,name:this.expr.slice(e,this.index)}}gobbleArguments(t){const e=[];let n=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let i=this.code;if(i===t){n=!0,this.index++,t===$L.CPAREN_CODE&&r&&r>=e.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}if(i===$L.COMMA_CODE){if(this.index++,r++,r!==e.length)if(t===$L.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===$L.CBRACK_CODE)for(let t=e.length;t<r;t++)e.push(null)}else if(e.length!==r&&0!==r)this.throwError("Expected comma");else{const t=this.gobbleExpression();t&&t.type!==$L.COMPOUND||this.throwError("Expected comma"),e.push(t)}}return n||this.throwError("Expected "+String.fromCharCode(t)),e}gobbleGroup(){this.index++;let t=this.gobbleExpressions($L.CPAREN_CODE);if(this.code===$L.CPAREN_CODE)return this.index++,1===t.length?t[0]:!!t.length&&{type:$L.SEQUENCE_EXP,expressions:t};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:$L.ARRAY_EXP,elements:this.gobbleArguments($L.CBRACK_CODE)}}}const tx=new class{add(t,e,n){if("string"!=typeof arguments[0])for(let t in arguments[0])this.add(t,arguments[0][t],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(t){this[t]=this[t]||[],e&&this[t][n?"unshift":"push"](e)},this)}run(t,e){this[t]=this[t]||[],this[t].forEach(function(t){t.call(e&&e.context?e.context:e,e)})}};Object.assign($L,{hooks:tx,plugins:new class{constructor(t){this.jsep=t,this.registered={}}register(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach(t=>{if("object"!=typeof t||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}}($L),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),$L.max_unop_len=$L.getMaxKeyLen($L.unary_ops),$L.max_binop_len=$L.getMaxKeyLen($L.binary_ops);const ex=t=>new $L(t).parse(),nx=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames($L).filter(t=>!nx.includes(t)&&void 0===ex[t]).forEach(t=>{ex[t]=$L[t]}),ex.Jsep=$L;var rx={name:"ternary",init(t){t.hooks.add("after-expression",function(e){if(e.node&&this.code===t.QUMARK_CODE){this.index++;const n=e.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;const i=this.gobbleExpression();if(i||this.throwError("Expected expression"),e.node={type:"ConditionalExpression",test:n,consequent:r,alternate:i},n.operator&&t.binary_ops[n.operator]<=.9){let r=n;for(;r.right.operator&&t.binary_ops[r.right.operator]<=.9;)r=r.right;e.node.test=r.right,r.right=e.node,e.node=n}}else this.throwError("Expected :")}})}};ex.plugins.register(rx);var ix={name:"regex",init(t){t.hooks.add("gobble-token",function(e){if(47===this.code){const n=++this.index;let r=!1;for(;this.index<this.expr.length;){if(47===this.code&&!r){const r=this.expr.slice(n,this.index);let i,o="";for(;++this.index<this.expr.length;){const t=this.code;if(!(t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57))break;o+=this.char}try{i=new RegExp(r,o)}catch(t){this.throwError(t.message)}return e.node={type:t.LITERAL,value:i,raw:this.expr.slice(n-1,this.index)},e.node=this.gobbleTokenProperty(e.node),e.node}this.code===t.OBRACK_CODE?r=!0:r&&this.code===t.CBRACK_CODE&&(r=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}})}};const ox={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[43,45],assignmentPrecedence:.9,init(t){const e=[t.IDENTIFIER,t.MEMBER_EXP];function n(t){ox.assignmentOperators.has(t.operator)?(t.type="AssignmentExpression",n(t.left),n(t.right)):t.operator||Object.values(t).forEach(t=>{t&&"object"==typeof t&&n(t)})}ox.assignmentOperators.forEach(e=>t.addBinaryOp(e,ox.assignmentPrecedence,!0)),t.hooks.add("gobble-token",function(t){const n=this.code;ox.updateOperators.some(t=>t===n&&t===this.expr.charCodeAt(this.index+1))&&(this.index+=2,t.node={type:"UpdateExpression",operator:43===n?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},t.node.argument&&e.includes(t.node.argument.type)||this.throwError(`Unexpected ${t.node.operator}`))}),t.hooks.add("after-token",function(t){if(t.node){const n=this.code;ox.updateOperators.some(t=>t===n&&t===this.expr.charCodeAt(this.index+1))&&(e.includes(t.node.type)||this.throwError(`Unexpected ${t.node.operator}`),this.index+=2,t.node={type:"UpdateExpression",operator:43===n?"++":"--",argument:t.node,prefix:!1})}}),t.hooks.add("after-expression",function(t){t.node&&n(t.node)})}};ex.plugins.register(ix,ox),ex.addUnaryOp("typeof"),ex.addLiteral("null",null),ex.addLiteral("undefined",void 0);const sx=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),ax={evalAst(t,e){switch(t.type){case"BinaryExpression":case"LogicalExpression":return ax.evalBinaryExpression(t,e);case"Compound":return ax.evalCompound(t,e);case"ConditionalExpression":return ax.evalConditionalExpression(t,e);case"Identifier":return ax.evalIdentifier(t,e);case"Literal":return ax.evalLiteral(t,e);case"MemberExpression":return ax.evalMemberExpression(t,e);case"UnaryExpression":return ax.evalUnaryExpression(t,e);case"ArrayExpression":return ax.evalArrayExpression(t,e);case"CallExpression":return ax.evalCallExpression(t,e);case"AssignmentExpression":return ax.evalAssignmentExpression(t,e);default:throw SyntaxError("Unexpected expression",t)}},evalBinaryExpression:(t,e)=>({"||":(t,e)=>t||e(),"&&":(t,e)=>t&&e(),"|":(t,e)=>t|e(),"^":(t,e)=>t^e(),"&":(t,e)=>t&e(),"==":(t,e)=>t==e(),"!=":(t,e)=>t!=e(),"===":(t,e)=>t===e(),"!==":(t,e)=>t!==e(),"<":(t,e)=>t<e(),">":(t,e)=>t>e(),"<=":(t,e)=>t<=e(),">=":(t,e)=>t>=e(),"<<":(t,e)=>t<<e(),">>":(t,e)=>t>>e(),">>>":(t,e)=>t>>>e(),"+":(t,e)=>t+e(),"-":(t,e)=>t-e(),"*":(t,e)=>t*e(),"/":(t,e)=>t/e(),"%":(t,e)=>t%e()}[t.operator](ax.evalAst(t.left,e),()=>ax.evalAst(t.right,e))),evalCompound(t,e){let n;for(let r=0;r<t.body.length;r++){"Identifier"===t.body[r].type&&["var","let","const"].includes(t.body[r].name)&&t.body[r+1]&&"AssignmentExpression"===t.body[r+1].type&&(r+=1);const i=t.body[r];n=ax.evalAst(i,e)}return n},evalConditionalExpression:(t,e)=>ax.evalAst(t.test,e)?ax.evalAst(t.consequent,e):ax.evalAst(t.alternate,e),evalIdentifier(t,e){if(Object.hasOwn(e,t.name))return e[t.name];throw ReferenceError(`${t.name} is not defined`)},evalLiteral:t=>t.value,evalMemberExpression(t,e){const n=String(t.computed?ax.evalAst(t.property):t.property.name),r=ax.evalAst(t.object,e);if(null==r)throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);if(!Object.hasOwn(r,n)&&sx.has(n))throw TypeError(`Cannot read properties of ${r} (reading '${n}')`);const i=r[n];return"function"==typeof i?i.bind(r):i},evalUnaryExpression:(t,e)=>({"-":t=>-ax.evalAst(t,e),"!":t=>!ax.evalAst(t,e),"~":t=>~ax.evalAst(t,e),"+":t=>+ax.evalAst(t,e),typeof:t=>typeof ax.evalAst(t,e)}[t.operator](t.argument)),evalArrayExpression:(t,e)=>t.elements.map(t=>ax.evalAst(t,e)),evalCallExpression(t,e){const n=t.arguments.map(t=>ax.evalAst(t,e));return ax.evalAst(t.callee,e)(...n)},evalAssignmentExpression(t,e){if("Identifier"!==t.left.type)throw SyntaxError("Invalid left-hand side in assignment");const n=t.left.name,r=ax.evalAst(t.right,e);return e[n]=r,e[n]}};function cx(t,e){return(t=t.slice()).push(e),t}function lx(t,e){return(e=e.slice()).unshift(t),e}class ux extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}}function hx(t,e,n,r,i){if(!(this instanceof hx))try{return new hx(t,e,n,r,i)}catch(t){if(!t.avoidNew)throw t;return t.value}"string"==typeof t&&(i=r,r=n,n=e,e=t,t=null);const o=t&&"object"==typeof t;if(t=t||{},this.json=t.json||n,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=!Object.hasOwn(t,"wrap")||t.wrap,this.sandbox=t.sandbox||{},this.eval=void 0===t.eval?"safe":t.eval,this.ignoreEvalErrors=void 0!==t.ignoreEvalErrors&&t.ignoreEvalErrors,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||r||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==t.autostart){const r={path:o?t.path:e};o?"json"in t&&(r.json=t.json):r.json=n;const i=this.evaluate(r);if(!i||"object"!=typeof i)throw new ux(i);return i}}hx.prototype.evaluate=function(t,e,n,r){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,n=n||this.callback,this.currOtherTypeCallback=r||this.otherTypeCallback,e=e||this.json,(t=t||this.path)&&"object"==typeof t&&!Array.isArray(t)){if(!t.path&&""!==t.path)throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=Object.hasOwn(t,"flatten")?t.flatten:s,this.currResultType=Object.hasOwn(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=Object.hasOwn(t,"sandbox")?t.sandbox:this.currSandbox,a=Object.hasOwn(t,"wrap")?t.wrap:a,this.currEval=Object.hasOwn(t,"eval")?t.eval:this.currEval,n=Object.hasOwn(t,"callback")?t.callback:n,this.currOtherTypeCallback=Object.hasOwn(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,i=Object.hasOwn(t,"parent")?t.parent:i,o=Object.hasOwn(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=hx.toPathString(t)),!t&&""!==t||!e)return;const c=hx.toPathArray(t);"$"===c[0]&&c.length>1&&c.shift(),this._hasParentSelector=null;const l=this._trace(c,e,["$"],i,o,n).filter(function(t){return t&&!t.isParentSelector});return l.length?a||1!==l.length||l[0].hasArrExpr?l.reduce((t,e)=>{const n=this._getPreferredOutput(e);return s&&Array.isArray(n)?t=t.concat(n):t.push(n),t},[]):this._getPreferredOutput(l[0]):a?[]:void 0},hx.prototype._getPreferredOutput=function(t){const e=this.currResultType;switch(e){case"all":{const e=Array.isArray(t.path)?t.path:hx.toPathArray(t.path);return t.pointer=hx.toPointer(e),t.path="string"==typeof t.path?t.path:hx.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return hx.toPathString(t[e]);case"pointer":return hx.toPointer(t.path);default:throw new TypeError("Unknown result type")}},hx.prototype._handleCallback=function(t,e,n){if(e){const r=this._getPreferredOutput(t);t.path="string"==typeof t.path?t.path:hx.toPathString(t.path),e(r,n,t)}},hx.prototype._trace=function(t,e,n,r,i,o,s,a){let c;if(!t.length)return c={path:n,value:e,parent:r,parentProperty:i,hasArrExpr:s},this._handleCallback(c,o,"value"),c;const l=t[0],u=t.slice(1),h=[];function d(t){Array.isArray(t)?t.forEach(t=>{h.push(t)}):h.push(t)}if(("string"!=typeof l||a)&&e&&Object.hasOwn(e,l))d(this._trace(u,e[l],cx(n,l),e,l,o,s));else if("*"===l)this._walk(e,t=>{d(this._trace(u,e[t],cx(n,t),e,t,o,!0,!0))});else if(".."===l)d(this._trace(u,e,n,r,i,o,s)),this._walk(e,r=>{"object"==typeof e[r]&&d(this._trace(t.slice(),e[r],cx(n,r),e,r,o,!0))});else{if("^"===l)return this._hasParentSelector=!0,{path:n.slice(0,-1),expr:u,isParentSelector:!0};if("~"===l)return c={path:cx(n,l),value:i,parent:r,parentProperty:null},this._handleCallback(c,o,"property"),c;if("$"===l)d(this._trace(u,e,n,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))d(this._slice(l,u,e,n,r,i,o));else if(0===l.indexOf("?(")){if(!1===this.currEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const t=l.replace(/^\?\((.*?)\)$/u,"$1"),s=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(t);s?this._walk(e,t=>{const a=[s[2]],c=s[1]?e[t][s[1]]:e[t];this._trace(a,c,n,r,i,o,!0).length>0&&d(this._trace(u,e[t],cx(n,t),e,t,o,!0))}):this._walk(e,s=>{this._eval(t,e[s],s,n,r,i)&&d(this._trace(u,e[s],cx(n,s),e,s,o,!0))})}else if("("===l[0]){if(!1===this.currEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(lx(this._eval(l,e,n.at(-1),n.slice(0,-1),r,i),u),e,n,r,i,o,s))}else if("@"===l[0]){let t=!1;const s=l.slice(1,-2);switch(s){case"scalar":e&&["object","function"].includes(typeof e)||(t=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===s&&(t=!0);break;case"integer":!Number.isFinite(e)||e%1||(t=!0);break;case"number":Number.isFinite(e)&&(t=!0);break;case"nonFinite":"number"!=typeof e||Number.isFinite(e)||(t=!0);break;case"object":e&&typeof e===s&&(t=!0);break;case"array":Array.isArray(e)&&(t=!0);break;case"other":t=this.currOtherTypeCallback(e,n,r,i);break;case"null":null===e&&(t=!0);break;default:throw new TypeError("Unknown value type "+s)}if(t)return c={path:n,value:e,parent:r,parentProperty:i},this._handleCallback(c,o,"value"),c}else if("`"===l[0]&&e&&Object.hasOwn(e,l.slice(1))){const t=l.slice(1);d(this._trace(u,e[t],cx(n,t),e,t,o,s,!0))}else if(l.includes(",")){const t=l.split(",");for(const s of t)d(this._trace(lx(s,u),e,n,r,i,o,!0))}else!a&&e&&Object.hasOwn(e,l)&&d(this._trace(u,e[l],cx(n,l),e,l,o,s,!0))}if(this._hasParentSelector)for(let t=0;t<h.length;t++){const n=h[t];if(n&&n.isParentSelector){const a=this._trace(n.expr,e,n.path,r,i,o,s);if(Array.isArray(a)){h[t]=a[0];const e=a.length;for(let n=1;n<e;n++)t++,h.splice(t,0,a[n])}else h[t]=a}}return h},hx.prototype._walk=function(t,e){if(Array.isArray(t)){const n=t.length;for(let t=0;t<n;t++)e(t)}else t&&"object"==typeof t&&Object.keys(t).forEach(t=>{e(t)})},hx.prototype._slice=function(t,e,n,r,i,o,s){if(!Array.isArray(n))return;const a=n.length,c=t.split(":"),l=c[2]&&Number.parseInt(c[2])||1;let u=c[0]&&Number.parseInt(c[0])||0,h=c[1]&&Number.parseInt(c[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);const d=[];for(let t=u;t<h;t+=l){this._trace(lx(t,e),n,r,i,o,s,!0).forEach(t=>{d.push(t)})}return d},hx.prototype._eval=function(t,e,n,r,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=n,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;const s=t.includes("@path");s&&(this.currSandbox._$_path=hx.toPathString(r.concat([n])));const a=this.currEval+"Script:"+t;if(!hx.cache[a]){let e=t.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(e=e.replaceAll("@path","_$_path")),"safe"===this.currEval||!0===this.currEval||void 0===this.currEval)hx.cache[a]=new this.safeVm.Script(e);else if("native"===this.currEval)hx.cache[a]=new this.vm.Script(e);else if("function"==typeof this.currEval&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const t=this.currEval;hx.cache[a]=new t(e)}else{if("function"!=typeof this.currEval)throw new TypeError(`Unknown "eval" property "${this.currEval}"`);hx.cache[a]={runInNewContext:t=>this.currEval(e,t)}}}try{return hx.cache[a].runInNewContext(this.currSandbox)}catch(e){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+e.message+": "+t)}},hx.cache={},hx.toPathString=function(t){const e=t,n=e.length;let r="$";for(let t=1;t<n;t++)/^(~|\^|@.*?\(\))$/u.test(e[t])||(r+=/^[0-9*]+$/u.test(e[t])?"["+e[t]+"]":"['"+e[t]+"']");return r},hx.toPointer=function(t){const e=t,n=e.length;let r="";for(let t=1;t<n;t++)/^(~|\^|@.*?\(\))$/u.test(e[t])||(r+="/"+e[t].toString().replaceAll("~","~0").replaceAll("/","~1"));return r},hx.toPathArray=function(t){const{cache:e}=hx;if(e[t])return e[t].concat();const n=[],r=t.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(t,e){return"[#"+(n.push(e)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(t,e){return"['"+e.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(t,e){return";"+e.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(t){const e=t.match(/#(\d+)/u);return e&&e[1]?n[e[1]]:t});return e[t]=r,e[t].concat()},hx.prototype.safeVm={Script:class{constructor(t){this.code=t,this.ast=ex(this.code)}runInNewContext(t){const e=Object.assign(Object.create(null),t);return ax.evalAst(this.ast,e)}}};hx.prototype.vm={Script:class{constructor(t){this.code=t}runInNewContext(t){let e=this.code;const n=Object.keys(t),r=[];!function(t,e,n){const r=t.length;for(let i=0;i<r;i++)n(t[i])&&e.push(t.splice(i--,1)[0])}(n,r,e=>"function"==typeof t[e]);const i=n.map(e=>t[e]);e=r.reduce((e,n)=>{let r=t[n].toString();return/function/u.test(r)||(r="function "+r),"var "+n+"="+r+";"+e},"")+e,/(['"])use strict\1/u.test(e)||n.includes("arguments")||(e="var arguments = undefined;"+e),e=e.replace(/;\s*$/u,"");const o=e.lastIndexOf(";"),s=-1!==o?e.slice(0,o+1)+" return "+e.slice(o+1):" return "+e;return new Function(...n,s)(...i)}}};const dx=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),px="�";var fx;!function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"}(fx||(fx={}));const gx="--",Ax="[CDATA[",Ex="doctype",mx="script",wx="public",yx="system";function Bx(t){return t>=55296&&t<=57343}function Ix(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159}function Cx(t){return t>=64976&&t<=65007||dx.has(t)}var Tx;!function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"}(Tx||(Tx={}));class bx{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=65536,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,e){const{line:n,col:r,offset:i}=this,o=r+e,s=i+e;return{code:t,startLine:n,endLine:n,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const e=this.html.charCodeAt(this.pos+1);if(function(t){return t>=56320&&t<=57343}(e))return this.pos++,this._addGap(),1024*(t-55296)+9216+e}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,fx.EOF;return this._err(Tx.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,e){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=e}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,e){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(e)return this.html.startsWith(t,this.pos);for(let e=0;e<t.length;e++){if((32|this.html.charCodeAt(this.pos+e))!==t.charCodeAt(e))return!1}return!0}peek(t){const e=this.pos+t;if(e>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fx.EOF;const n=this.html.charCodeAt(e);return n===fx.CARRIAGE_RETURN?fx.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,fx.EOF;let t=this.html.charCodeAt(this.pos);if(t===fx.CARRIAGE_RETURN)return this.isEol=!0,this.skipNextNewLine=!0,fx.LINE_FEED;if(t===fx.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine))return this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance();this.skipNextNewLine=!1,Bx(t)&&(t=this._processSurrogate(t));return null===this.handler.onParseError||t>31&&t<127||t===fx.LINE_FEED||t===fx.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t}_checkForProblematicCharacters(t){Ix(t)?this._err(Tx.controlCharacterInInputStream):Cx(t)&&this._err(Tx.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Dx;function vx(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}!function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"}(Dx||(Dx={}));const Mx=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0)));var Nx;const Sx=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);Nx=String.fromCodePoint;function _x(t){var e;return t>=55296&&t<=57343||t>1114111?65533:null!==(e=Sx.get(t))&&void 0!==e?e:t}var Lx;!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(Lx||(Lx={}));var xx,Rx,Fx;function kx(t){return t>=Lx.ZERO&&t<=Lx.NINE}function Ox(t){return t>=Lx.UPPER_A&&t<=Lx.UPPER_F||t>=Lx.LOWER_A&&t<=Lx.LOWER_F}function Qx(t){return t===Lx.EQUALS||function(t){return t>=Lx.UPPER_A&&t<=Lx.UPPER_Z||t>=Lx.LOWER_A&&t<=Lx.LOWER_Z||kx(t)}(t)}!function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}(xx||(xx={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(Rx||(Rx={})),function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"}(Fx||(Fx={}));class Ux{constructor(t,e,n){this.decodeTree=t,this.emitCodePoint=e,this.errors=n,this.state=Rx.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Fx.Strict}startEntity(t){this.decodeMode=t,this.state=Rx.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case Rx.EntityStart:return t.charCodeAt(e)===Lx.NUM?(this.state=Rx.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=Rx.NamedEntity,this.stateNamedEntity(t,e));case Rx.NumericStart:return this.stateNumericStart(t,e);case Rx.NumericDecimal:return this.stateNumericDecimal(t,e);case Rx.NumericHex:return this.stateNumericHex(t,e);case Rx.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===Lx.LOWER_X?(this.state=Rx.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=Rx.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,n,r){if(e!==n){const i=n-e;this.result=this.result*Math.pow(r,i)+Number.parseInt(t.substr(e,i),r),this.consumed+=i}}stateNumericHex(t,e){const n=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!kx(r)&&!Ox(r))return this.addToNumericResult(t,n,e,16),this.emitNumericEntity(r,3);e+=1}return this.addToNumericResult(t,n,e,16),-1}stateNumericDecimal(t,e){const n=e;for(;e<t.length;){const r=t.charCodeAt(e);if(!kx(r))return this.addToNumericResult(t,n,e,10),this.emitNumericEntity(r,2);e+=1}return this.addToNumericResult(t,n,e,10),-1}emitNumericEntity(t,e){var n;if(this.consumed<=e)return null===(n=this.errors)||void 0===n||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Lx.SEMI)this.consumed+=1;else if(this.decodeMode===Fx.Strict)return 0;return this.emitCodePoint(_x(this.result),this.consumed),this.errors&&(t!==Lx.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:n}=this;let r=n[this.treeIndex],i=(r&xx.VALUE_LENGTH)>>14;for(;e<t.length;e++,this.excess++){const o=t.charCodeAt(e);if(this.treeIndex=Px(n,r,this.treeIndex+Math.max(1,i),o),this.treeIndex<0)return 0===this.result||this.decodeMode===Fx.Attribute&&(0===i||Qx(o))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&xx.VALUE_LENGTH)>>14,0!==i){if(o===Lx.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Fx.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:n}=this,r=(n[e]&xx.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,r,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,n){const{decodeTree:r}=this;return this.emitCodePoint(1===e?r[t]&~xx.VALUE_LENGTH:r[t+1],n),3===e&&this.emitCodePoint(r[t+2],n),n}end(){var t;switch(this.state){case Rx.NamedEntity:return 0===this.result||this.decodeMode===Fx.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case Rx.NumericDecimal:return this.emitNumericEntity(0,2);case Rx.NumericHex:return this.emitNumericEntity(0,3);case Rx.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Rx.EntityStart:return 0}}}function Px(t,e,n,r){const i=(e&xx.BRANCH_LENGTH)>>7,o=e&xx.JUMP_TABLE;if(0===i)return 0!==o&&r===o?n:-1;if(o){const e=r-o;return e<0||e>=i?-1:t[n+e]-1}let s=n,a=s+i-1;for(;s<=a;){const e=s+a>>>1,n=t[e];if(n<r)s=e+1;else{if(!(n>r))return t[e+i];a=e-1}}return-1}var Gx,Vx,jx,Hx,Yx;!function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"}(Gx||(Gx={})),function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"}(Vx||(Vx={})),function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"}(jx||(jx={})),function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"}(Hx||(Hx={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"}(Yx||(Yx={}));const zx=new Map([[Hx.A,Yx.A],[Hx.ADDRESS,Yx.ADDRESS],[Hx.ANNOTATION_XML,Yx.ANNOTATION_XML],[Hx.APPLET,Yx.APPLET],[Hx.AREA,Yx.AREA],[Hx.ARTICLE,Yx.ARTICLE],[Hx.ASIDE,Yx.ASIDE],[Hx.B,Yx.B],[Hx.BASE,Yx.BASE],[Hx.BASEFONT,Yx.BASEFONT],[Hx.BGSOUND,Yx.BGSOUND],[Hx.BIG,Yx.BIG],[Hx.BLOCKQUOTE,Yx.BLOCKQUOTE],[Hx.BODY,Yx.BODY],[Hx.BR,Yx.BR],[Hx.BUTTON,Yx.BUTTON],[Hx.CAPTION,Yx.CAPTION],[Hx.CENTER,Yx.CENTER],[Hx.CODE,Yx.CODE],[Hx.COL,Yx.COL],[Hx.COLGROUP,Yx.COLGROUP],[Hx.DD,Yx.DD],[Hx.DESC,Yx.DESC],[Hx.DETAILS,Yx.DETAILS],[Hx.DIALOG,Yx.DIALOG],[Hx.DIR,Yx.DIR],[Hx.DIV,Yx.DIV],[Hx.DL,Yx.DL],[Hx.DT,Yx.DT],[Hx.EM,Yx.EM],[Hx.EMBED,Yx.EMBED],[Hx.FIELDSET,Yx.FIELDSET],[Hx.FIGCAPTION,Yx.FIGCAPTION],[Hx.FIGURE,Yx.FIGURE],[Hx.FONT,Yx.FONT],[Hx.FOOTER,Yx.FOOTER],[Hx.FOREIGN_OBJECT,Yx.FOREIGN_OBJECT],[Hx.FORM,Yx.FORM],[Hx.FRAME,Yx.FRAME],[Hx.FRAMESET,Yx.FRAMESET],[Hx.H1,Yx.H1],[Hx.H2,Yx.H2],[Hx.H3,Yx.H3],[Hx.H4,Yx.H4],[Hx.H5,Yx.H5],[Hx.H6,Yx.H6],[Hx.HEAD,Yx.HEAD],[Hx.HEADER,Yx.HEADER],[Hx.HGROUP,Yx.HGROUP],[Hx.HR,Yx.HR],[Hx.HTML,Yx.HTML],[Hx.I,Yx.I],[Hx.IMG,Yx.IMG],[Hx.IMAGE,Yx.IMAGE],[Hx.INPUT,Yx.INPUT],[Hx.IFRAME,Yx.IFRAME],[Hx.KEYGEN,Yx.KEYGEN],[Hx.LABEL,Yx.LABEL],[Hx.LI,Yx.LI],[Hx.LINK,Yx.LINK],[Hx.LISTING,Yx.LISTING],[Hx.MAIN,Yx.MAIN],[Hx.MALIGNMARK,Yx.MALIGNMARK],[Hx.MARQUEE,Yx.MARQUEE],[Hx.MATH,Yx.MATH],[Hx.MENU,Yx.MENU],[Hx.META,Yx.META],[Hx.MGLYPH,Yx.MGLYPH],[Hx.MI,Yx.MI],[Hx.MO,Yx.MO],[Hx.MN,Yx.MN],[Hx.MS,Yx.MS],[Hx.MTEXT,Yx.MTEXT],[Hx.NAV,Yx.NAV],[Hx.NOBR,Yx.NOBR],[Hx.NOFRAMES,Yx.NOFRAMES],[Hx.NOEMBED,Yx.NOEMBED],[Hx.NOSCRIPT,Yx.NOSCRIPT],[Hx.OBJECT,Yx.OBJECT],[Hx.OL,Yx.OL],[Hx.OPTGROUP,Yx.OPTGROUP],[Hx.OPTION,Yx.OPTION],[Hx.P,Yx.P],[Hx.PARAM,Yx.PARAM],[Hx.PLAINTEXT,Yx.PLAINTEXT],[Hx.PRE,Yx.PRE],[Hx.RB,Yx.RB],[Hx.RP,Yx.RP],[Hx.RT,Yx.RT],[Hx.RTC,Yx.RTC],[Hx.RUBY,Yx.RUBY],[Hx.S,Yx.S],[Hx.SCRIPT,Yx.SCRIPT],[Hx.SEARCH,Yx.SEARCH],[Hx.SECTION,Yx.SECTION],[Hx.SELECT,Yx.SELECT],[Hx.SOURCE,Yx.SOURCE],[Hx.SMALL,Yx.SMALL],[Hx.SPAN,Yx.SPAN],[Hx.STRIKE,Yx.STRIKE],[Hx.STRONG,Yx.STRONG],[Hx.STYLE,Yx.STYLE],[Hx.SUB,Yx.SUB],[Hx.SUMMARY,Yx.SUMMARY],[Hx.SUP,Yx.SUP],[Hx.TABLE,Yx.TABLE],[Hx.TBODY,Yx.TBODY],[Hx.TEMPLATE,Yx.TEMPLATE],[Hx.TEXTAREA,Yx.TEXTAREA],[Hx.TFOOT,Yx.TFOOT],[Hx.TD,Yx.TD],[Hx.TH,Yx.TH],[Hx.THEAD,Yx.THEAD],[Hx.TITLE,Yx.TITLE],[Hx.TR,Yx.TR],[Hx.TRACK,Yx.TRACK],[Hx.TT,Yx.TT],[Hx.U,Yx.U],[Hx.UL,Yx.UL],[Hx.SVG,Yx.SVG],[Hx.VAR,Yx.VAR],[Hx.WBR,Yx.WBR],[Hx.XMP,Yx.XMP]]);function Jx(t){var e;return null!==(e=zx.get(t))&&void 0!==e?e:Yx.UNKNOWN}const Wx=Yx,qx={[Gx.HTML]:new Set([Wx.ADDRESS,Wx.APPLET,Wx.AREA,Wx.ARTICLE,Wx.ASIDE,Wx.BASE,Wx.BASEFONT,Wx.BGSOUND,Wx.BLOCKQUOTE,Wx.BODY,Wx.BR,Wx.BUTTON,Wx.CAPTION,Wx.CENTER,Wx.COL,Wx.COLGROUP,Wx.DD,Wx.DETAILS,Wx.DIR,Wx.DIV,Wx.DL,Wx.DT,Wx.EMBED,Wx.FIELDSET,Wx.FIGCAPTION,Wx.FIGURE,Wx.FOOTER,Wx.FORM,Wx.FRAME,Wx.FRAMESET,Wx.H1,Wx.H2,Wx.H3,Wx.H4,Wx.H5,Wx.H6,Wx.HEAD,Wx.HEADER,Wx.HGROUP,Wx.HR,Wx.HTML,Wx.IFRAME,Wx.IMG,Wx.INPUT,Wx.LI,Wx.LINK,Wx.LISTING,Wx.MAIN,Wx.MARQUEE,Wx.MENU,Wx.META,Wx.NAV,Wx.NOEMBED,Wx.NOFRAMES,Wx.NOSCRIPT,Wx.OBJECT,Wx.OL,Wx.P,Wx.PARAM,Wx.PLAINTEXT,Wx.PRE,Wx.SCRIPT,Wx.SECTION,Wx.SELECT,Wx.SOURCE,Wx.STYLE,Wx.SUMMARY,Wx.TABLE,Wx.TBODY,Wx.TD,Wx.TEMPLATE,Wx.TEXTAREA,Wx.TFOOT,Wx.TH,Wx.THEAD,Wx.TITLE,Wx.TR,Wx.TRACK,Wx.UL,Wx.WBR,Wx.XMP]),[Gx.MATHML]:new Set([Wx.MI,Wx.MO,Wx.MN,Wx.MS,Wx.MTEXT,Wx.ANNOTATION_XML]),[Gx.SVG]:new Set([Wx.TITLE,Wx.FOREIGN_OBJECT,Wx.DESC]),[Gx.XLINK]:new Set,[Gx.XML]:new Set,[Gx.XMLNS]:new Set},Kx=new Set([Wx.H1,Wx.H2,Wx.H3,Wx.H4,Wx.H5,Wx.H6]);new Set([Hx.STYLE,Hx.SCRIPT,Hx.XMP,Hx.IFRAME,Hx.NOEMBED,Hx.NOFRAMES,Hx.PLAINTEXT]);var Zx;!function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"}(Zx||(Zx={}));const Xx={DATA:Zx.DATA,RCDATA:Zx.RCDATA,RAWTEXT:Zx.RAWTEXT,SCRIPT_DATA:Zx.SCRIPT_DATA,PLAINTEXT:Zx.PLAINTEXT,CDATA_SECTION:Zx.CDATA_SECTION};function $x(t){return t>=fx.LATIN_CAPITAL_A&&t<=fx.LATIN_CAPITAL_Z}function tR(t){return function(t){return t>=fx.LATIN_SMALL_A&&t<=fx.LATIN_SMALL_Z}(t)||$x(t)}function eR(t){return tR(t)||function(t){return t>=fx.DIGIT_0&&t<=fx.DIGIT_9}(t)}function nR(t){return t+32}function rR(t){return t===fx.SPACE||t===fx.LINE_FEED||t===fx.TABULATION||t===fx.FORM_FEED}function iR(t){return rR(t)||t===fx.SOLIDUS||t===fx.GREATER_THAN_SIGN}class oR{constructor(t,e){this.options=t,this.handler=e,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=Zx.DATA,this.returnState=Zx.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new bx(e),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Ux(Mx,(t,e)=>{this.preprocessor.pos=this.entityStartPos+e-1,this._flushCodePointConsumedAsCharacterReference(t)},e.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(Tx.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:t=>{this._err(Tx.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+t)},validateNumericCharacterReference:t=>{const e=function(t){return t===fx.NULL?Tx.nullCharacterReference:t>1114111?Tx.characterReferenceOutsideUnicodeRange:Bx(t)?Tx.surrogateCharacterReference:Cx(t)?Tx.noncharacterCharacterReference:Ix(t)||t===fx.CARRIAGE_RETURN?Tx.controlCharacterReference:null}(t);e&&this._err(e,1)}}:void 0)}_err(t,e=0){var n,r;null===(r=(n=this.handler).onParseError)||void 0===r||r.call(n,this.preprocessor.getError(t,e))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,this.inLoop||(this._runParsingLoop(),this.paused||null==t||t())}write(t,e,n){this.active=!0,this.preprocessor.write(t,e),this._runParsingLoop(),this.paused||null==n||n()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return!!this.preprocessor.endOfChunkHit&&(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0)}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let e=0;e<t;e++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,e){return!!this.preprocessor.startsWith(t,e)&&(this._advanceBy(t.length-1),!0)}_createStartTagToken(){this.currentToken={type:Dx.START_TAG,tagName:"",tagID:Yx.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Dx.END_TAG,tagName:"",tagID:Yx.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Dx.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Dx.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,e){this.currentCharacterToken={type:t,chars:e,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,e;const n=this.currentToken;if(null===vx(n,this.currentAttr.name)){if(n.attrs.push(this.currentAttr),n.location&&this.currentLocation){(null!==(t=(e=n.location).attrs)&&void 0!==t?t:e.attrs=Object.create(null))[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(Tx.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Jx(t.tagName),t.type===Dx.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(Tx.endTagWithAttributes),t.selfClosing&&this._err(Tx.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Dx.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Dx.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Dx.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Dx.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,e){if(this.currentCharacterToken){if(this.currentCharacterToken.type===t)return void(this.currentCharacterToken.chars+=e);this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk()}this._createCharacterToken(t,e)}_emitCodePoint(t){const e=rR(t)?Dx.WHITESPACE_CHARACTER:t===fx.NULL?Dx.NULL_CHARACTER:Dx.CHARACTER;this._appendCharToCurrentCharacterToken(e,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Dx.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=Zx.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Fx.Attribute:Fx.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Zx.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case Zx.DATA:this._stateData(t);break;case Zx.RCDATA:this._stateRcdata(t);break;case Zx.RAWTEXT:this._stateRawtext(t);break;case Zx.SCRIPT_DATA:this._stateScriptData(t);break;case Zx.PLAINTEXT:this._statePlaintext(t);break;case Zx.TAG_OPEN:this._stateTagOpen(t);break;case Zx.END_TAG_OPEN:this._stateEndTagOpen(t);break;case Zx.TAG_NAME:this._stateTagName(t);break;case Zx.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(t);break;case Zx.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(t);break;case Zx.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(t);break;case Zx.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(t);break;case Zx.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(t);break;case Zx.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(t);break;case Zx.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(t);break;case Zx.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(t);break;case Zx.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(t);break;case Zx.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(t);break;case Zx.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(t);break;case Zx.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(t);break;case Zx.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(t);break;case Zx.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(t);break;case Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(t);break;case Zx.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(t);break;case Zx.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(t);break;case Zx.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(t);break;case Zx.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(t);break;case Zx.ATTRIBUTE_NAME:this._stateAttributeName(t);break;case Zx.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(t);break;case Zx.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(t);break;case Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(t);break;case Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(t);break;case Zx.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(t);break;case Zx.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(t);break;case Zx.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(t);break;case Zx.BOGUS_COMMENT:this._stateBogusComment(t);break;case Zx.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(t);break;case Zx.COMMENT_START:this._stateCommentStart(t);break;case Zx.COMMENT_START_DASH:this._stateCommentStartDash(t);break;case Zx.COMMENT:this._stateComment(t);break;case Zx.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(t);break;case Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(t);break;case Zx.COMMENT_END_DASH:this._stateCommentEndDash(t);break;case Zx.COMMENT_END:this._stateCommentEnd(t);break;case Zx.COMMENT_END_BANG:this._stateCommentEndBang(t);break;case Zx.DOCTYPE:this._stateDoctype(t);break;case Zx.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(t);break;case Zx.DOCTYPE_NAME:this._stateDoctypeName(t);break;case Zx.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(t);break;case Zx.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(t);break;case Zx.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(t);break;case Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(t);break;case Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(t);break;case Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(t);break;case Zx.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break;case Zx.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(t);break;case Zx.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(t);break;case Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(t);break;case Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(t);break;case Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(t);break;case Zx.BOGUS_DOCTYPE:this._stateBogusDoctype(t);break;case Zx.CDATA_SECTION:this._stateCdataSection(t);break;case Zx.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(t);break;case Zx.CDATA_SECTION_END:this._stateCdataSectionEnd(t);break;case Zx.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Zx.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(t);break;default:throw new Error("Unknown state")}}_stateData(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.TAG_OPEN;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitCodePoint(t);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case fx.AMPERSAND:this._startCharacterReference();break;case fx.LESS_THAN_SIGN:this.state=Zx.RCDATA_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.RAWTEXT_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateTagOpen(t){if(tR(t))this._createStartTagToken(),this.state=Zx.TAG_NAME,this._stateTagName(t);else switch(t){case fx.EXCLAMATION_MARK:this.state=Zx.MARKUP_DECLARATION_OPEN;break;case fx.SOLIDUS:this.state=Zx.END_TAG_OPEN;break;case fx.QUESTION_MARK:this._err(Tx.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t);break;case fx.EOF:this._err(Tx.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break;default:this._err(Tx.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=Zx.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(tR(t))this._createEndTagToken(),this.state=Zx.TAG_NAME,this._stateTagName(t);else switch(t){case fx.GREATER_THAN_SIGN:this._err(Tx.missingEndTagName),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break;default:this._err(Tx.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.SOLIDUS:this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.tagName+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:e.tagName+=String.fromCodePoint($x(t)?nR(t):t)}}_stateRcdataLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=Zx.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){tR(t)?(this.state=Zx.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=Zx.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();this.currentToken.tagName=this.lastStartTagName;switch(this.preprocessor.peek(this.lastStartTagName.length)){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Zx.BEFORE_ATTRIBUTE_NAME,!1;case fx.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Zx.SELF_CLOSING_START_TAG,!1;case fx.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Zx.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){tR(t)?(this.state=Zx.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case fx.SOLIDUS:this.state=Zx.SCRIPT_DATA_END_TAG_OPEN;break;case fx.EXCLAMATION_MARK:this.state=Zx.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break;default:this._emitChars("<"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){tR(t)?(this.state=Zx.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===fx.HYPHEN_MINUS?(this.state=Zx.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===fx.HYPHEN_MINUS?(this.state=Zx.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=Zx.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case fx.HYPHEN_MINUS:this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case fx.GREATER_THAN_SIGN:this.state=Zx.SCRIPT_DATA,this._emitChars(">");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===fx.SOLIDUS?this.state=Zx.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:tR(t)?(this._emitChars("<"),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){tR(t)?(this.state=Zx.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(mx,!1)&&iR(this.preprocessor.peek(mx.length))){this._emitCodePoint(t);for(let t=0;t<mx.length;t++)this._emitCodePoint(this._consume());this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Zx.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case fx.HYPHEN_MINUS:this._emitChars("-");break;case fx.LESS_THAN_SIGN:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break;case fx.GREATER_THAN_SIGN:this.state=Zx.SCRIPT_DATA,this._emitChars(">");break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(px);break;case fx.EOF:this._err(Tx.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===fx.SOLIDUS?(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(mx,!1)&&iR(this.preprocessor.peek(mx.length))){this._emitCodePoint(t);for(let t=0;t<mx.length;t++)this._emitCodePoint(this._consume());this.state=Zx.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Zx.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.SOLIDUS:case fx.GREATER_THAN_SIGN:case fx.EOF:this.state=Zx.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case fx.EQUALS_SIGN:this._err(Tx.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=Zx.ATTRIBUTE_NAME;break;default:this._createAttr(""),this.state=Zx.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:case fx.SOLIDUS:case fx.GREATER_THAN_SIGN:case fx.EOF:this._leaveAttrName(),this.state=Zx.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break;case fx.EQUALS_SIGN:this._leaveAttrName(),this.state=Zx.BEFORE_ATTRIBUTE_VALUE;break;case fx.QUOTATION_MARK:case fx.APOSTROPHE:case fx.LESS_THAN_SIGN:this._err(Tx.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.name+=px;break;default:this.currentAttr.name+=String.fromCodePoint($x(t)?nR(t):t)}}_stateAfterAttributeName(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.SOLIDUS:this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.EQUALS_SIGN:this.state=Zx.BEFORE_ATTRIBUTE_VALUE;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._createAttr(""),this.state=Zx.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:this.state=Zx.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this.state=Zx.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingAttributeValue),this.state=Zx.DATA,this.emitCurrentTagToken();break;default:this.state=Zx.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this._leaveAttrValue(),this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.AMPERSAND:this._startCharacterReference();break;case fx.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this.currentAttr.value+=px;break;case fx.QUOTATION_MARK:case fx.APOSTROPHE:case fx.LESS_THAN_SIGN:case fx.EQUALS_SIGN:case fx.GRAVE_ACCENT:this._err(Tx.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this._leaveAttrValue(),this.state=Zx.BEFORE_ATTRIBUTE_NAME;break;case fx.SOLIDUS:this._leaveAttrValue(),this.state=Zx.SELF_CLOSING_START_TAG;break;case fx.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._err(Tx.missingWhitespaceBetweenAttributes),this.state=Zx.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case fx.GREATER_THAN_SIGN:this.currentToken.selfClosing=!0,this.state=Zx.DATA,this.emitCurrentTagToken();break;case fx.EOF:this._err(Tx.eofInTag),this._emitEOFToken();break;default:this._err(Tx.unexpectedSolidusInTag),this.state=Zx.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this.emitCurrentComment(e),this._emitEOFToken();break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.data+=px;break;default:e.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(gx,!0)?(this._createCommentToken(gx.length+1),this.state=Zx.COMMENT_START):this._consumeSequenceIfMatch(Ex,!1)?(this.currentLocation=this.getCurrentLocation(Ex.length+1),this.state=Zx.DOCTYPE):this._consumeSequenceIfMatch(Ax,!0)?this.inForeignNode?this.state=Zx.CDATA_SECTION:(this._err(Tx.cdataInHtmlContent),this._createCommentToken(Ax.length+1),this.currentToken.data="[CDATA[",this.state=Zx.BOGUS_COMMENT):this._ensureHibernation()||(this._err(Tx.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Zx.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_START_DASH;break;case fx.GREATER_THAN_SIGN:{this._err(Tx.abruptClosingOfEmptyComment),this.state=Zx.DATA;const t=this.currentToken;this.emitCurrentComment(t);break}default:this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptClosingOfEmptyComment),this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="-",this.state=Zx.COMMENT,this._stateComment(t)}}_stateComment(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END_DASH;break;case fx.LESS_THAN_SIGN:e.data+="<",this.state=Zx.COMMENT_LESS_THAN_SIGN;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.data+=px;break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const e=this.currentToken;switch(t){case fx.EXCLAMATION_MARK:e.data+="!",this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG;break;case fx.LESS_THAN_SIGN:e.data+="<";break;default:this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===fx.HYPHEN_MINUS?this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Zx.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===fx.HYPHEN_MINUS?this.state=Zx.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Zx.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==fx.GREATER_THAN_SIGN&&t!==fx.EOF&&this._err(Tx.nestedComment),this.state=Zx.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:this.state=Zx.COMMENT_END;break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="-",this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EXCLAMATION_MARK:this.state=Zx.COMMENT_END_BANG;break;case fx.HYPHEN_MINUS:e.data+="-";break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="--",this.state=Zx.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const e=this.currentToken;switch(t){case fx.HYPHEN_MINUS:e.data+="--!",this.state=Zx.COMMENT_END_DASH;break;case fx.GREATER_THAN_SIGN:this._err(Tx.incorrectlyClosedComment),this.state=Zx.DATA,this.emitCurrentComment(e);break;case fx.EOF:this._err(Tx.eofInComment),this.emitCurrentComment(e),this._emitEOFToken();break;default:e.data+="--!",this.state=Zx.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:this.state=Zx.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break;case fx.EOF:{this._err(Tx.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._err(Tx.missingWhitespaceBeforeDoctypeName),this.state=Zx.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if($x(t))this._createDoctypeToken(String.fromCharCode(nR(t))),this.state=Zx.DOCTYPE_NAME;else switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),this._createDoctypeToken(px),this.state=Zx.DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:{this._err(Tx.missingDoctypeName),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Zx.DATA;break}case fx.EOF:{this._err(Tx.eofInDoctype),this._createDoctypeToken(null);const t=this.currentToken;t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=Zx.DOCTYPE_NAME}}_stateDoctypeName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.AFTER_DOCTYPE_NAME;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.name+=px;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.name+=String.fromCodePoint($x(t)?nR(t):t)}}_stateAfterDoctypeName(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(wx,!1)?this.state=Zx.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(yx,!1)?this.state=Zx.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(Tx.invalidCharacterSequenceAfterDoctypeName),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceAfterDoctypePublicKeyword),e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceAfterDoctypePublicKeyword),e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.publicId="",this.state=Zx.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypePublicIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const e=this.currentToken;switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.publicId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypePublicIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const e=this.currentToken;switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.publicId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypePublicIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case fx.GREATER_THAN_SIGN:this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.QUOTATION_MARK:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:this.state=Zx.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.QUOTATION_MARK:this._err(Tx.missingWhitespaceAfterDoctypeSystemKeyword),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:this._err(Tx.missingWhitespaceAfterDoctypeSystemKeyword),e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.QUOTATION_MARK:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case fx.APOSTROPHE:e.systemId="",this.state=Zx.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case fx.GREATER_THAN_SIGN:this._err(Tx.missingDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.DATA,this.emitCurrentDoctype(e);break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.missingQuoteBeforeDoctypeSystemIdentifier),e.forceQuirks=!0,this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const e=this.currentToken;switch(t){case fx.QUOTATION_MARK:this.state=Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.systemId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypeSystemIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const e=this.currentToken;switch(t){case fx.APOSTROPHE:this.state=Zx.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter),e.systemId+=px;break;case fx.GREATER_THAN_SIGN:this._err(Tx.abruptDoctypeSystemIdentifier),e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:e.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const e=this.currentToken;switch(t){case fx.SPACE:case fx.LINE_FEED:case fx.TABULATION:case fx.FORM_FEED:break;case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.EOF:this._err(Tx.eofInDoctype),e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break;default:this._err(Tx.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Zx.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const e=this.currentToken;switch(t){case fx.GREATER_THAN_SIGN:this.emitCurrentDoctype(e),this.state=Zx.DATA;break;case fx.NULL:this._err(Tx.unexpectedNullCharacter);break;case fx.EOF:this.emitCurrentDoctype(e),this._emitEOFToken()}}_stateCdataSection(t){switch(t){case fx.RIGHT_SQUARE_BRACKET:this.state=Zx.CDATA_SECTION_BRACKET;break;case fx.EOF:this._err(Tx.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===fx.RIGHT_SQUARE_BRACKET?this.state=Zx.CDATA_SECTION_END:(this._emitChars("]"),this.state=Zx.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case fx.GREATER_THAN_SIGN:this.state=Zx.DATA;break;case fx.RIGHT_SQUARE_BRACKET:this._emitChars("]");break;default:this._emitChars("]]"),this.state=Zx.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0){if(!this.preprocessor.lastChunkWritten)return this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,void(this.preprocessor.endOfChunkHit=!0);t=this.entityDecoder.end()}0===t?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(fx.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&eR(this.preprocessor.peek(1))?Zx.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){eR(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===fx.SEMICOLON&&this._err(Tx.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const sR=new Set([Yx.DD,Yx.DT,Yx.LI,Yx.OPTGROUP,Yx.OPTION,Yx.P,Yx.RB,Yx.RP,Yx.RT,Yx.RTC]),aR=new Set([...sR,Yx.CAPTION,Yx.COLGROUP,Yx.TBODY,Yx.TD,Yx.TFOOT,Yx.TH,Yx.THEAD,Yx.TR]),cR=new Set([Yx.APPLET,Yx.CAPTION,Yx.HTML,Yx.MARQUEE,Yx.OBJECT,Yx.TABLE,Yx.TD,Yx.TEMPLATE,Yx.TH]),lR=new Set([...cR,Yx.OL,Yx.UL]),uR=new Set([...cR,Yx.BUTTON]),hR=new Set([Yx.ANNOTATION_XML,Yx.MI,Yx.MN,Yx.MO,Yx.MS,Yx.MTEXT]),dR=new Set([Yx.DESC,Yx.FOREIGN_OBJECT,Yx.TITLE]),pR=new Set([Yx.TR,Yx.TEMPLATE,Yx.HTML]),fR=new Set([Yx.TBODY,Yx.TFOOT,Yx.THEAD,Yx.TEMPLATE,Yx.HTML]),gR=new Set([Yx.TABLE,Yx.TEMPLATE,Yx.HTML]),AR=new Set([Yx.TD,Yx.TH]);class ER{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,e,n){this.treeAdapter=e,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Yx.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===Yx.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Gx.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,e){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=e,this.currentTagId=e,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,e,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,e){const n=this._indexOf(t);this.items[n]=e,n===this.stackTop&&(this.current=e)}insertAfter(t,e,n){const r=this._indexOf(t)+1;this.items.splice(r,0,e),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&void 0!==this.currentTagId&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(t){let e=this.stackTop+1;do{e=this.tagIDs.lastIndexOf(t,e-1)}while(e>0&&this.treeAdapter.getNamespaceURI(this.items[e])!==Gx.HTML);this.shortenToLength(Math.max(e,0))}shortenToLength(t){for(;this.stackTop>=t;){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,this.stackTop<t)}}popUntilElementPopped(t){const e=this._indexOf(t);this.shortenToLength(Math.max(e,0))}popUntilPopped(t,e){const n=this._indexOfTagNames(t,e);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Kx,Gx.HTML)}popUntilTableCellPopped(){this.popUntilPopped(AR,Gx.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,e){for(let n=this.stackTop;n>=0;n--)if(t.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===e)return n;return-1}clearBackTo(t,e){const n=this._indexOfTagNames(t,e);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(gR,Gx.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fR,Gx.HTML)}clearBackToTableRowContext(){this.clearBackTo(pR,Gx.HTML)}remove(t){const e=this._indexOf(t);e>=0&&(e===this.stackTop?this.pop():(this.items.splice(e,1),this.tagIDs.splice(e,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Yx.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const e=this._indexOf(t)-1;return e>=0?this.items[e]:null}isRootHtmlElementCurrent(){return 0===this.stackTop&&this.tagIDs[0]===Yx.HTML}hasInDynamicScope(t,e){for(let n=this.stackTop;n>=0;n--){const r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case Gx.HTML:if(r===t)return!0;if(e.has(r))return!1;break;case Gx.SVG:if(dR.has(r))return!1;break;case Gx.MATHML:if(hR.has(r))return!1}}return!0}hasInScope(t){return this.hasInDynamicScope(t,cR)}hasInListItemScope(t){return this.hasInDynamicScope(t,lR)}hasInButtonScope(t){return this.hasInDynamicScope(t,uR)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const e=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case Gx.HTML:if(Kx.has(e))return!0;if(cR.has(e))return!1;break;case Gx.SVG:if(dR.has(e))return!1;break;case Gx.MATHML:if(hR.has(e))return!1}}return!0}hasInTableScope(t){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Gx.HTML)switch(this.tagIDs[e]){case t:return!0;case Yx.TABLE:case Yx.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Gx.HTML)switch(this.tagIDs[t]){case Yx.TBODY:case Yx.THEAD:case Yx.TFOOT:return!0;case Yx.TABLE:case Yx.HTML:return!1}return!0}hasInSelectScope(t){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Gx.HTML)switch(this.tagIDs[e]){case t:return!0;case Yx.OPTION:case Yx.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;void 0!==this.currentTagId&&sR.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;void 0!==this.currentTagId&&aR.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;void 0!==this.currentTagId&&this.currentTagId!==t&&aR.has(this.currentTagId);)this.pop()}}var mR;!function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"}(mR||(mR={}));const wR={type:mR.Marker};class yR{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,e){const n=[],r=e.length,i=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let t=0;t<this.entries.length;t++){const e=this.entries[t];if(e.type===mR.Marker)break;const{element:s}=e;if(this.treeAdapter.getTagName(s)===i&&this.treeAdapter.getNamespaceURI(s)===o){const e=this.treeAdapter.getAttrList(s);e.length===r&&n.push({idx:t,attrs:e})}}return n}_ensureNoahArkCondition(t){if(this.entries.length<3)return;const e=this.treeAdapter.getAttrList(t),n=this._getNoahArkConditionCandidates(t,e);if(n.length<3)return;const r=new Map(e.map(t=>[t.name,t.value]));let i=0;for(let t=0;t<n.length;t++){const e=n[t];e.attrs.every(t=>r.get(t.name)===t.value)&&(i+=1,i>=3&&this.entries.splice(e.idx,1))}}insertMarker(){this.entries.unshift(wR)}pushElement(t,e){this._ensureNoahArkCondition(t),this.entries.unshift({type:mR.Element,element:t,token:e})}insertElementAfterBookmark(t,e){const n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:mR.Element,element:t,token:e})}removeEntry(t){const e=this.entries.indexOf(t);-1!==e&&this.entries.splice(e,1)}clearToLastMarker(){const t=this.entries.indexOf(wR);-1===t?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const e=this.entries.find(e=>e.type===mR.Marker||this.treeAdapter.getTagName(e.element)===t);return e&&e.type===mR.Element?e:null}getElementEntry(t){return this.entries.find(e=>e.type===mR.Element&&e.element===t)}}const BR={createDocument:()=>({nodeName:"#document",mode:jx.NO_QUIRKS,childNodes:[]}),createDocumentFragment:()=>({nodeName:"#document-fragment",childNodes:[]}),createElement:(t,e,n)=>({nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}),createCommentNode:t=>({nodeName:"#comment",data:t,parentNode:null}),createTextNode:t=>({nodeName:"#text",value:t,parentNode:null}),appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent:t=>t.content,setDocumentType(t,e,n,r){const i=t.childNodes.find(t=>"#documentType"===t.nodeName);if(i)i.name=e,i.publicId=n,i.systemId=r;else{const i={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};BR.appendChild(t,i)}},setDocumentMode(t,e){t.mode=e},getDocumentMode:t=>t.mode,detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(BR.isTextNode(n))return void(n.value+=e)}BR.appendChild(t,BR.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&BR.isTextNode(r)?r.value+=e:BR.insertBefore(t,BR.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(t=>t.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild:t=>t.childNodes[0],getChildNodes:t=>t.childNodes,getParentNode:t=>t.parentNode,getAttrList:t=>t.attrs,getTagName:t=>t.tagName,getNamespaceURI:t=>t.namespaceURI,getTextNodeContent:t=>t.value,getCommentNodeContent:t=>t.data,getDocumentTypeNodeName:t=>t.name,getDocumentTypeNodePublicId:t=>t.publicId,getDocumentTypeNodeSystemId:t=>t.systemId,isTextNode:t=>"#text"===t.nodeName,isCommentNode:t=>"#comment"===t.nodeName,isDocumentTypeNode:t=>"#documentType"===t.nodeName,isElementNode:t=>Object.prototype.hasOwnProperty.call(t,"tagName"),setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation:t=>t.sourceCodeLocation,updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},IR="html",CR=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],TR=[...CR,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],bR=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),DR=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],vR=[...DR,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function MR(t,e){return e.some(e=>t.startsWith(e))}const NR="text/html",SR="application/xhtml+xml",_R=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),LR=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:Gx.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:Gx.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:Gx.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:Gx.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:Gx.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:Gx.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:Gx.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:Gx.XML}],["xml:space",{prefix:"xml",name:"space",namespace:Gx.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:Gx.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:Gx.XMLNS}]]),xR=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),RR=new Set([Yx.B,Yx.BIG,Yx.BLOCKQUOTE,Yx.BODY,Yx.BR,Yx.CENTER,Yx.CODE,Yx.DD,Yx.DIV,Yx.DL,Yx.DT,Yx.EM,Yx.EMBED,Yx.H1,Yx.H2,Yx.H3,Yx.H4,Yx.H5,Yx.H6,Yx.HEAD,Yx.HR,Yx.I,Yx.IMG,Yx.LI,Yx.LISTING,Yx.MENU,Yx.META,Yx.NOBR,Yx.OL,Yx.P,Yx.PRE,Yx.RUBY,Yx.S,Yx.SMALL,Yx.SPAN,Yx.STRONG,Yx.STRIKE,Yx.SUB,Yx.SUP,Yx.TABLE,Yx.TT,Yx.U,Yx.UL,Yx.VAR]);function FR(t){for(let e=0;e<t.attrs.length;e++)if("definitionurl"===t.attrs[e].name){t.attrs[e].name="definitionURL";break}}function kR(t){for(let e=0;e<t.attrs.length;e++){const n=_R.get(t.attrs[e].name);null!=n&&(t.attrs[e].name=n)}}function OR(t){for(let e=0;e<t.attrs.length;e++){const n=LR.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function QR(t,e,n,r){return(!r||r===Gx.HTML)&&function(t,e,n){if(e===Gx.MATHML&&t===Yx.ANNOTATION_XML)for(let t=0;t<n.length;t++)if(n[t].name===Vx.ENCODING){const e=n[t].value.toLowerCase();return e===NR||e===SR}return e===Gx.SVG&&(t===Yx.FOREIGN_OBJECT||t===Yx.DESC||t===Yx.TITLE)}(t,e,n)||(!r||r===Gx.MATHML)&&function(t,e){return e===Gx.MATHML&&(t===Yx.MI||t===Yx.MO||t===Yx.MN||t===Yx.MS||t===Yx.MTEXT)}(t,e)}var UR;!function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"}(UR||(UR={}));const PR={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},GR=new Set([Yx.TABLE,Yx.TBODY,Yx.TFOOT,Yx.THEAD,Yx.TR]),VR={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:BR,onParseError:null};class jR{constructor(t,e,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=UR.INITIAL,this.originalInsertionMode=UR.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...VR,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=null!=e?e:this.treeAdapter.createDocument(),this.tokenizer=new oR(this.options,this),this.activeFormattingElements=new yR(this.treeAdapter),this.fragmentContextID=n?Jx(this.treeAdapter.getTagName(n)):Yx.UNKNOWN,this._setContextModes(null!=n?n:this.document,this.fragmentContextID),this.openElements=new ER(this.document,this.treeAdapter,this)}static parse(t,e){const n=new this(e);return n.tokenizer.write(t,!0),n.document}static getFragmentParser(t,e){const n={...VR,...e};null!=t||(t=n.treeAdapter.createElement(Hx.TEMPLATE,Gx.HTML,[]));const r=n.treeAdapter.createElement("documentmock",Gx.HTML,[]),i=new this(n,r,t);return i.fragmentContextID===Yx.TEMPLATE&&i.tmplInsertionModeStack.unshift(UR.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),e=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,e),e}_err(t,e,n){var r;if(!this.onParseError)return;const i=null!==(r=t.location)&&void 0!==r?r:PR,o={code:e,startLine:i.startLine,startCol:i.startCol,startOffset:i.startOffset,endLine:n?i.startLine:i.endLine,endCol:n?i.startCol:i.endCol,endOffset:n?i.startOffset:i.endOffset};this.onParseError(o)}onItemPush(t,e,n){var r,i;null===(i=(r=this.treeAdapter).onItemPush)||void 0===i||i.call(r,t),n&&this.openElements.stackTop>0&&this._setContextModes(t,e)}onItemPop(t,e){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),null===(r=(n=this.treeAdapter).onItemPop)||void 0===r||r.call(n,t,this.openElements.current),e){let t,e;0===this.openElements.stackTop&&this.fragmentContext?(t=this.fragmentContext,e=this.fragmentContextID):({current:t,currentTagId:e}=this.openElements),this._setContextModes(t,e)}}_setContextModes(t,e){const n=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===Gx.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&void 0!==t&&void 0!==e&&!this._isIntegrationPoint(e,t)}_switchToTextParsing(t,e){this._insertElement(t,Gx.HTML),this.tokenizer.state=e,this.originalInsertionMode=this.insertionMode,this.insertionMode=UR.TEXT}switchToPlaintextParsing(){this.insertionMode=UR.TEXT,this.originalInsertionMode=UR.IN_BODY,this.tokenizer.state=Xx.PLAINTEXT}_getAdjustedCurrentElement(){return 0===this.openElements.stackTop&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===Hx.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(this.fragmentContext&&this.treeAdapter.getNamespaceURI(this.fragmentContext)===Gx.HTML)switch(this.fragmentContextID){case Yx.TITLE:case Yx.TEXTAREA:this.tokenizer.state=Xx.RCDATA;break;case Yx.STYLE:case Yx.XMP:case Yx.IFRAME:case Yx.NOEMBED:case Yx.NOFRAMES:case Yx.NOSCRIPT:this.tokenizer.state=Xx.RAWTEXT;break;case Yx.SCRIPT:this.tokenizer.state=Xx.SCRIPT_DATA;break;case Yx.PLAINTEXT:this.tokenizer.state=Xx.PLAINTEXT}}_setDocumentType(t){const e=t.name||"",n=t.publicId||"",r=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,e,n,r),t.location){const e=this.treeAdapter.getChildNodes(this.document).find(t=>this.treeAdapter.isDocumentTypeNode(t));e&&this.treeAdapter.setNodeSourceCodeLocation(e,t.location)}}_attachElementToTree(t,e){if(this.options.sourceCodeLocationInfo){const n=e&&{...e,startTag:e};this.treeAdapter.setNodeSourceCodeLocation(t,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const e=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(null!=e?e:this.document,t)}}_appendElement(t,e){const n=this.treeAdapter.createElement(t.tagName,e,t.attrs);this._attachElementToTree(n,t.location)}_insertElement(t,e){const n=this.treeAdapter.createElement(t.tagName,e,t.attrs);this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID)}_insertFakeElement(t,e){const n=this.treeAdapter.createElement(t,Gx.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,e)}_insertTemplate(t){const e=this.treeAdapter.createElement(t.tagName,Gx.HTML,t.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(e,n),this._attachElementToTree(e,t.location),this.openElements.push(e,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(Hx.HTML,Gx.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,Yx.HTML)}_appendCommentNode(t,e){const n=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(e,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,t.location)}_insertCharacters(t){let e,n;if(this._shouldFosterParentOnInsertion()?(({parent:e,beforeElement:n}=this._findFosterParentingLocation()),n?this.treeAdapter.insertTextBefore(e,t.chars,n):this.treeAdapter.insertText(e,t.chars)):(e=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(e,t.chars)),!t.location)return;const r=this.treeAdapter.getChildNodes(e),i=n?r.lastIndexOf(n):r.length,o=r[i-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:e,endCol:n,endOffset:r}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:e,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,e){for(let n=this.treeAdapter.getFirstChild(t);n;n=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(e,n)}_setEndLocation(t,e){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&e.location){const n=e.location,r=this.treeAdapter.getTagName(t),i=e.type===Dx.END_TAG&&r===e.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,i)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let e,n;return 0===this.openElements.stackTop&&this.fragmentContext?(e=this.fragmentContext,n=this.fragmentContextID):({current:e,currentTagId:n}=this.openElements),(t.tagID!==Yx.SVG||this.treeAdapter.getTagName(e)!==Hx.ANNOTATION_XML||this.treeAdapter.getNamespaceURI(e)!==Gx.MATHML)&&(this.tokenizer.inForeignNode||(t.tagID===Yx.MGLYPH||t.tagID===Yx.MALIGNMARK)&&void 0!==n&&!this._isIntegrationPoint(n,e,Gx.HTML))}_processToken(t){switch(t.type){case Dx.CHARACTER:this.onCharacter(t);break;case Dx.NULL_CHARACTER:this.onNullCharacter(t);break;case Dx.COMMENT:this.onComment(t);break;case Dx.DOCTYPE:this.onDoctype(t);break;case Dx.START_TAG:this._processStartTag(t);break;case Dx.END_TAG:this.onEndTag(t);break;case Dx.EOF:this.onEof(t);break;case Dx.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(t)}}_isIntegrationPoint(t,e,n){return QR(t,this.treeAdapter.getNamespaceURI(e),this.treeAdapter.getAttrList(e),n)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const e=this.activeFormattingElements.entries.findIndex(t=>t.type===mR.Marker||this.openElements.contains(t.element));for(let n=-1===e?t-1:e-1;n>=0;n--){const t=this.activeFormattingElements.entries[n];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=UR.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Yx.P),this.openElements.popUntilTagNamePopped(Yx.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(0===t&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case Yx.TR:return void(this.insertionMode=UR.IN_ROW);case Yx.TBODY:case Yx.THEAD:case Yx.TFOOT:return void(this.insertionMode=UR.IN_TABLE_BODY);case Yx.CAPTION:return void(this.insertionMode=UR.IN_CAPTION);case Yx.COLGROUP:return void(this.insertionMode=UR.IN_COLUMN_GROUP);case Yx.TABLE:return void(this.insertionMode=UR.IN_TABLE);case Yx.BODY:return void(this.insertionMode=UR.IN_BODY);case Yx.FRAMESET:return void(this.insertionMode=UR.IN_FRAMESET);case Yx.SELECT:return void this._resetInsertionModeForSelect(t);case Yx.TEMPLATE:return void(this.insertionMode=this.tmplInsertionModeStack[0]);case Yx.HTML:return void(this.insertionMode=this.headElement?UR.AFTER_HEAD:UR.BEFORE_HEAD);case Yx.TD:case Yx.TH:if(t>0)return void(this.insertionMode=UR.IN_CELL);break;case Yx.HEAD:if(t>0)return void(this.insertionMode=UR.IN_HEAD)}this.insertionMode=UR.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let e=t-1;e>0;e--){const t=this.openElements.tagIDs[e];if(t===Yx.TEMPLATE)break;if(t===Yx.TABLE)return void(this.insertionMode=UR.IN_SELECT_IN_TABLE)}this.insertionMode=UR.IN_SELECT}_isElementCausesFosterParenting(t){return GR.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&void 0!==this.openElements.currentTagId&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const e=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case Yx.TEMPLATE:if(this.treeAdapter.getNamespaceURI(e)===Gx.HTML)return{parent:this.treeAdapter.getTemplateContent(e),beforeElement:null};break;case Yx.TABLE:{const n=this.treeAdapter.getParentNode(e);return n?{parent:n,beforeElement:e}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const e=this._findFosterParentingLocation();e.beforeElement?this.treeAdapter.insertBefore(e.parent,t,e.beforeElement):this.treeAdapter.appendChild(e.parent,t)}_isSpecialElement(t,e){const n=this.treeAdapter.getNamespaceURI(t);return qx[n].has(e)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(t,e){t._insertCharacters(e),t.framesetOk=!1}(this,t);else switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.IN_BODY:case UR.IN_CAPTION:case UR.IN_CELL:case UR.IN_TEMPLATE:lF(this,t);break;case UR.TEXT:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:this._insertCharacters(t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_TABLE_TEXT:CF(this,t);break;case UR.IN_COLUMN_GROUP:vF(this,t);break;case UR.AFTER_BODY:kF(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode)!function(t,e){e.chars=px,t._insertCharacters(e)}(this,t);else switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.TEXT:this._insertCharacters(t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_COLUMN_GROUP:vF(this,t);break;case UR.AFTER_BODY:kF(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML)ZR(this,t);else switch(this.insertionMode){case UR.INITIAL:case UR.BEFORE_HTML:case UR.BEFORE_HEAD:case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:case UR.IN_BODY:case UR.IN_TABLE:case UR.IN_CAPTION:case UR.IN_COLUMN_GROUP:case UR.IN_TABLE_BODY:case UR.IN_ROW:case UR.IN_CELL:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:case UR.IN_TEMPLATE:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:ZR(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.AFTER_BODY:!function(t,e){t._appendCommentNode(e,t.openElements.items[0])}(this,t);break;case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:!function(t,e){t._appendCommentNode(e,t.document)}(this,t)}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case UR.INITIAL:!function(t,e){t._setDocumentType(e);const n=e.forceQuirks?jx.QUIRKS:function(t){if(t.name!==IR)return jx.QUIRKS;const{systemId:e}=t;if(e&&"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"===e.toLowerCase())return jx.QUIRKS;let{publicId:n}=t;if(null!==n){if(n=n.toLowerCase(),bR.has(n))return jx.QUIRKS;let t=null===e?TR:CR;if(MR(n,t))return jx.QUIRKS;if(t=null===e?DR:vR,MR(n,t))return jx.LIMITED_QUIRKS}return jx.NO_QUIRKS}(e);(function(t){return t.name===IR&&null===t.publicId&&(null===t.systemId||"about:legacy-compat"===t.systemId)})(e)||t._err(e,Tx.nonConformingDoctype);t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=UR.BEFORE_HTML}(this,t);break;case UR.BEFORE_HEAD:case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:this._err(t,Tx.misplacedDoctype);break;case UR.IN_TABLE_TEXT:TF(this,t)}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,Tx.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?function(t,e){if(function(t){const e=t.tagID;return e===Yx.FONT&&t.attrs.some(({name:t})=>t===Vx.COLOR||t===Vx.SIZE||t===Vx.FACE)||RR.has(e)}(e))QF(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===Gx.MATHML?FR(e):r===Gx.SVG&&(!function(t){const e=xR.get(t.tagName);null!=e&&(t.tagName=e,t.tagID=Jx(t.tagName))}(e),kR(e)),OR(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:!function(t,e){e.tagID===Yx.HTML?(t._insertElement(e,Gx.HTML),t.insertionMode=UR.BEFORE_HEAD):tF(t,e)}(this,t);break;case UR.BEFORE_HEAD:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.HEAD:t._insertElement(e,Gx.HTML),t.headElement=t.openElements.current,t.insertionMode=UR.IN_HEAD;break;default:eF(t,e)}}(this,t);break;case UR.IN_HEAD:nF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BASEFONT:case Yx.BGSOUND:case Yx.HEAD:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.STYLE:nF(t,e);break;case Yx.NOSCRIPT:t._err(e,Tx.nestedNoscriptInHead);break;default:oF(t,e)}}(this,t);break;case UR.AFTER_HEAD:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BODY:t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=UR.IN_BODY;break;case Yx.FRAMESET:t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_FRAMESET;break;case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.SCRIPT:case Yx.STYLE:case Yx.TEMPLATE:case Yx.TITLE:t._err(e,Tx.abandonedHeadElementChild),t.openElements.push(t.headElement,Yx.HEAD),nF(t,e),t.openElements.remove(t.headElement);break;case Yx.HEAD:t._err(e,Tx.misplacedStartTagForHeadElement);break;default:sF(t,e)}}(this,t);break;case UR.IN_BODY:fF(this,t);break;case UR.IN_TABLE:wF(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_CAPTION:!function(t,e){const n=e.tagID;bF.has(n)?t.openElements.hasInTableScope(Yx.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_TABLE,wF(t,e)):fF(t,e)}(this,t);break;case UR.IN_COLUMN_GROUP:DF(this,t);break;case UR.IN_TABLE_BODY:MF(this,t);break;case UR.IN_ROW:SF(this,t);break;case UR.IN_CELL:!function(t,e){const n=e.tagID;bF.has(n)?(t.openElements.hasInTableScope(Yx.TD)||t.openElements.hasInTableScope(Yx.TH))&&(t._closeTableCell(),SF(t,e)):fF(t,e)}(this,t);break;case UR.IN_SELECT:LF(this,t);break;case UR.IN_SELECT_IN_TABLE:!function(t,e){const n=e.tagID;n===Yx.CAPTION||n===Yx.TABLE||n===Yx.TBODY||n===Yx.TFOOT||n===Yx.THEAD||n===Yx.TR||n===Yx.TD||n===Yx.TH?(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),t._processStartTag(e)):LF(t,e)}(this,t);break;case UR.IN_TEMPLATE:!function(t,e){switch(e.tagID){case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:case Yx.NOFRAMES:case Yx.SCRIPT:case Yx.STYLE:case Yx.TEMPLATE:case Yx.TITLE:nF(t,e);break;case Yx.CAPTION:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.tmplInsertionModeStack[0]=UR.IN_TABLE,t.insertionMode=UR.IN_TABLE,wF(t,e);break;case Yx.COL:t.tmplInsertionModeStack[0]=UR.IN_COLUMN_GROUP,t.insertionMode=UR.IN_COLUMN_GROUP,DF(t,e);break;case Yx.TR:t.tmplInsertionModeStack[0]=UR.IN_TABLE_BODY,t.insertionMode=UR.IN_TABLE_BODY,MF(t,e);break;case Yx.TD:case Yx.TH:t.tmplInsertionModeStack[0]=UR.IN_ROW,t.insertionMode=UR.IN_ROW,SF(t,e);break;default:t.tmplInsertionModeStack[0]=UR.IN_BODY,t.insertionMode=UR.IN_BODY,fF(t,e)}}(this,t);break;case UR.AFTER_BODY:!function(t,e){e.tagID===Yx.HTML?fF(t,e):kF(t,e)}(this,t);break;case UR.IN_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.FRAMESET:t._insertElement(e,Gx.HTML);break;case Yx.FRAME:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.NOFRAMES:nF(t,e)}}(this,t);break;case UR.AFTER_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.NOFRAMES:nF(t,e)}}(this,t);break;case UR.AFTER_AFTER_BODY:!function(t,e){e.tagID===Yx.HTML?fF(t,e):OF(t,e)}(this,t);break;case UR.AFTER_AFTER_FRAMESET:!function(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.NOFRAMES:nF(t,e)}}(this,t)}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?function(t,e){if(e.tagID===Yx.P||e.tagID===Yx.BR)return QF(t),void t._endTagOutsideForeignContent(e);for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===Gx.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:!function(t,e){const n=e.tagID;n!==Yx.HTML&&n!==Yx.HEAD&&n!==Yx.BODY&&n!==Yx.BR||tF(t,e)}(this,t);break;case UR.BEFORE_HEAD:!function(t,e){const n=e.tagID;n===Yx.HEAD||n===Yx.BODY||n===Yx.HTML||n===Yx.BR?eF(t,e):t._err(e,Tx.endTagWithoutMatchingOpenElement)}(this,t);break;case UR.IN_HEAD:!function(t,e){switch(e.tagID){case Yx.HEAD:t.openElements.pop(),t.insertionMode=UR.AFTER_HEAD;break;case Yx.BODY:case Yx.BR:case Yx.HTML:iF(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.IN_HEAD_NO_SCRIPT:!function(t,e){switch(e.tagID){case Yx.NOSCRIPT:t.openElements.pop(),t.insertionMode=UR.IN_HEAD;break;case Yx.BR:oF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.AFTER_HEAD:!function(t,e){switch(e.tagID){case Yx.BODY:case Yx.HTML:case Yx.BR:sF(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:t._err(e,Tx.endTagWithoutMatchingOpenElement)}}(this,t);break;case UR.IN_BODY:AF(this,t);break;case UR.TEXT:!function(t,e){var n;e.tagID===Yx.SCRIPT&&(null===(n=t.scriptHandler)||void 0===n||n.call(t,t.openElements.current));t.openElements.pop(),t.insertionMode=t.originalInsertionMode}(this,t);break;case UR.IN_TABLE:yF(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_CAPTION:!function(t,e){const n=e.tagID;switch(n){case Yx.CAPTION:case Yx.TABLE:t.openElements.hasInTableScope(Yx.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_TABLE,n===Yx.TABLE&&yF(t,e));break;case Yx.BODY:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TBODY:case Yx.TD:case Yx.TFOOT:case Yx.TH:case Yx.THEAD:case Yx.TR:break;default:AF(t,e)}}(this,t);break;case UR.IN_COLUMN_GROUP:!function(t,e){switch(e.tagID){case Yx.COLGROUP:t.openElements.currentTagId===Yx.COLGROUP&&(t.openElements.pop(),t.insertionMode=UR.IN_TABLE);break;case Yx.TEMPLATE:rF(t,e);break;case Yx.COL:break;default:vF(t,e)}}(this,t);break;case UR.IN_TABLE_BODY:NF(this,t);break;case UR.IN_ROW:_F(this,t);break;case UR.IN_CELL:!function(t,e){const n=e.tagID;switch(n){case Yx.TD:case Yx.TH:t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=UR.IN_ROW);break;case Yx.TABLE:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.TR:t.openElements.hasInTableScope(n)&&(t._closeTableCell(),_F(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:break;default:AF(t,e)}}(this,t);break;case UR.IN_SELECT:xF(this,t);break;case UR.IN_SELECT_IN_TABLE:!function(t,e){const n=e.tagID;n===Yx.CAPTION||n===Yx.TABLE||n===Yx.TBODY||n===Yx.TFOOT||n===Yx.THEAD||n===Yx.TR||n===Yx.TD||n===Yx.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),t.onEndTag(e)):xF(t,e)}(this,t);break;case UR.IN_TEMPLATE:!function(t,e){e.tagID===Yx.TEMPLATE&&rF(t,e)}(this,t);break;case UR.AFTER_BODY:FF(this,t);break;case UR.IN_FRAMESET:!function(t,e){e.tagID!==Yx.FRAMESET||t.openElements.isRootHtmlElementCurrent()||(t.openElements.pop(),t.fragmentContext||t.openElements.currentTagId===Yx.FRAMESET||(t.insertionMode=UR.AFTER_FRAMESET))}(this,t);break;case UR.AFTER_FRAMESET:!function(t,e){e.tagID===Yx.HTML&&(t.insertionMode=UR.AFTER_AFTER_FRAMESET)}(this,t);break;case UR.AFTER_AFTER_BODY:OF(this,t)}}onEof(t){switch(this.insertionMode){case UR.INITIAL:$R(this,t);break;case UR.BEFORE_HTML:tF(this,t);break;case UR.BEFORE_HEAD:eF(this,t);break;case UR.IN_HEAD:iF(this,t);break;case UR.IN_HEAD_NO_SCRIPT:oF(this,t);break;case UR.AFTER_HEAD:sF(this,t);break;case UR.IN_BODY:case UR.IN_TABLE:case UR.IN_CAPTION:case UR.IN_COLUMN_GROUP:case UR.IN_TABLE_BODY:case UR.IN_ROW:case UR.IN_CELL:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:EF(this,t);break;case UR.TEXT:!function(t,e){t._err(e,Tx.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}(this,t);break;case UR.IN_TABLE_TEXT:TF(this,t);break;case UR.IN_TEMPLATE:RF(this,t);break;case UR.AFTER_BODY:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:XR(this,t)}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===fx.LINE_FEED)){if(1===t.chars.length)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode)this._insertCharacters(t);else switch(this.insertionMode){case UR.IN_HEAD:case UR.IN_HEAD_NO_SCRIPT:case UR.AFTER_HEAD:case UR.TEXT:case UR.IN_COLUMN_GROUP:case UR.IN_SELECT:case UR.IN_SELECT_IN_TABLE:case UR.IN_FRAMESET:case UR.AFTER_FRAMESET:this._insertCharacters(t);break;case UR.IN_BODY:case UR.IN_CAPTION:case UR.IN_CELL:case UR.IN_TEMPLATE:case UR.AFTER_BODY:case UR.AFTER_AFTER_BODY:case UR.AFTER_AFTER_FRAMESET:cF(this,t);break;case UR.IN_TABLE:case UR.IN_TABLE_BODY:case UR.IN_ROW:mF(this,t);break;case UR.IN_TABLE_TEXT:IF(this,t)}}}function HR(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):gF(t,e),n}function YR(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function zR(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let o=0,s=i;s!==n;o++,s=i){i=t.openElements.getCommonAncestor(s);const n=t.activeFormattingElements.getElementEntry(s),a=n&&o>=3;!n||a?(a&&t.activeFormattingElements.removeEntry(n),t.openElements.remove(s)):(s=JR(t,n),r===e&&(t.activeFormattingElements.bookmark=n),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(s,r),r=s)}return r}function JR(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function WR(t,e,n){const r=Jx(t.treeAdapter.getTagName(e));if(t._isElementCausesFosterParenting(r))t._fosterParentElement(n);else{const i=t.treeAdapter.getNamespaceURI(e);r===Yx.TEMPLATE&&i===Gx.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function qR(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,o=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,o),t.treeAdapter.appendChild(e,o),t.activeFormattingElements.insertElementAfterBookmark(o,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,o,i.tagID)}function KR(t,e){for(let n=0;n<8;n++){const n=HR(t,e);if(!n)break;const r=YR(t,n);if(!r)break;t.activeFormattingElements.bookmark=n;const i=zR(t,r,n.element),o=t.openElements.getCommonAncestor(n.element);t.treeAdapter.detachNode(i),o&&WR(t,o,i),qR(t,r,n)}}function ZR(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function XR(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const n=t.openElements.items[0],r=t.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(t._setEndLocation(n,e),t.openElements.stackTop>=1)){const n=t.openElements.items[1],r=t.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&t._setEndLocation(n,e)}}}}function $R(t,e){t._err(e,Tx.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,jx.QUIRKS),t.insertionMode=UR.BEFORE_HTML,t._processToken(e)}function tF(t,e){t._insertFakeRootElement(),t.insertionMode=UR.BEFORE_HEAD,t._processToken(e)}function eF(t,e){t._insertFakeElement(Hx.HEAD,Yx.HEAD),t.headElement=t.openElements.current,t.insertionMode=UR.IN_HEAD,t._processToken(e)}function nF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.BASE:case Yx.BASEFONT:case Yx.BGSOUND:case Yx.LINK:case Yx.META:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.TITLE:t._switchToTextParsing(e,Xx.RCDATA);break;case Yx.NOSCRIPT:t.options.scriptingEnabled?t._switchToTextParsing(e,Xx.RAWTEXT):(t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_HEAD_NO_SCRIPT);break;case Yx.NOFRAMES:case Yx.STYLE:t._switchToTextParsing(e,Xx.RAWTEXT);break;case Yx.SCRIPT:t._switchToTextParsing(e,Xx.SCRIPT_DATA);break;case Yx.TEMPLATE:t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=UR.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(UR.IN_TEMPLATE);break;case Yx.HEAD:t._err(e,Tx.misplacedStartTagForHeadElement);break;default:iF(t,e)}}function rF(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==Yx.TEMPLATE&&t._err(e,Tx.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(Yx.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,Tx.endTagWithoutMatchingOpenElement)}function iF(t,e){t.openElements.pop(),t.insertionMode=UR.AFTER_HEAD,t._processToken(e)}function oF(t,e){const n=e.type===Dx.EOF?Tx.openElementsLeftAfterEof:Tx.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=UR.IN_HEAD,t._processToken(e)}function sF(t,e){t._insertFakeElement(Hx.BODY,Yx.BODY),t.insertionMode=UR.IN_BODY,aF(t,e)}function aF(t,e){switch(e.type){case Dx.CHARACTER:lF(t,e);break;case Dx.WHITESPACE_CHARACTER:cF(t,e);break;case Dx.COMMENT:ZR(t,e);break;case Dx.START_TAG:fF(t,e);break;case Dx.END_TAG:AF(t,e);break;case Dx.EOF:EF(t,e)}}function cF(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function lF(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function uF(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,Gx.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function hF(t){const e=vx(t,Vx.TYPE);return null!=e&&"hidden"===e.toLowerCase()}function dF(t,e){t._switchToTextParsing(e,Xx.RAWTEXT)}function pF(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML)}function fF(t,e){switch(e.tagID){case Yx.I:case Yx.S:case Yx.B:case Yx.U:case Yx.EM:case Yx.TT:case Yx.BIG:case Yx.CODE:case Yx.FONT:case Yx.SMALL:case Yx.STRIKE:case Yx.STRONG:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.A:!function(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(Hx.A);n&&(KR(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.H1:case Yx.H2:case Yx.H3:case Yx.H4:case Yx.H5:case Yx.H6:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),void 0!==t.openElements.currentTagId&&Kx.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.P:case Yx.DL:case Yx.OL:case Yx.UL:case Yx.DIV:case Yx.DIR:case Yx.NAV:case Yx.MAIN:case Yx.MENU:case Yx.ASIDE:case Yx.CENTER:case Yx.FIGURE:case Yx.FOOTER:case Yx.HEADER:case Yx.HGROUP:case Yx.DIALOG:case Yx.DETAILS:case Yx.ADDRESS:case Yx.ARTICLE:case Yx.SEARCH:case Yx.SECTION:case Yx.SUMMARY:case Yx.FIELDSET:case Yx.BLOCKQUOTE:case Yx.FIGCAPTION:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.LI:case Yx.DD:case Yx.DT:!function(t,e){t.framesetOk=!1;const n=e.tagID;for(let e=t.openElements.stackTop;e>=0;e--){const r=t.openElements.tagIDs[e];if(n===Yx.LI&&r===Yx.LI||(n===Yx.DD||n===Yx.DT)&&(r===Yx.DD||r===Yx.DT)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.popUntilTagNamePopped(r);break}if(r!==Yx.ADDRESS&&r!==Yx.DIV&&r!==Yx.P&&t._isSpecialElement(t.openElements.items[e],r))break}t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.BR:case Yx.IMG:case Yx.WBR:case Yx.AREA:case Yx.EMBED:case Yx.KEYGEN:uF(t,e);break;case Yx.HR:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._appendElement(e,Gx.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}(t,e);break;case Yx.RB:case Yx.RTC:!function(t,e){t.openElements.hasInScope(Yx.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.RT:case Yx.RP:!function(t,e){t.openElements.hasInScope(Yx.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(Yx.RTC),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.PRE:case Yx.LISTING:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}(t,e);break;case Yx.XMP:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Xx.RAWTEXT)}(t,e);break;case Yx.SVG:!function(t,e){t._reconstructActiveFormattingElements(),kR(e),OR(e),e.selfClosing?t._appendElement(e,Gx.SVG):t._insertElement(e,Gx.SVG),e.ackSelfClosing=!0}(t,e);break;case Yx.HTML:!function(t,e){0===t.openElements.tmplCount&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}(t,e);break;case Yx.BASE:case Yx.LINK:case Yx.META:case Yx.STYLE:case Yx.TITLE:case Yx.SCRIPT:case Yx.BGSOUND:case Yx.BASEFONT:case Yx.TEMPLATE:nF(t,e);break;case Yx.BODY:!function(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&0===t.openElements.tmplCount&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}(t,e);break;case Yx.FORM:!function(t,e){const n=t.openElements.tmplCount>0;t.formElement&&!n||(t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),n||(t.formElement=t.openElements.current))}(t,e);break;case Yx.NOBR:!function(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(Yx.NOBR)&&(KR(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,Gx.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}(t,e);break;case Yx.MATH:!function(t,e){t._reconstructActiveFormattingElements(),FR(e),OR(e),e.selfClosing?t._appendElement(e,Gx.MATHML):t._insertElement(e,Gx.MATHML),e.ackSelfClosing=!0}(t,e);break;case Yx.TABLE:!function(t,e){t.treeAdapter.getDocumentMode(t.document)!==jx.QUIRKS&&t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=UR.IN_TABLE}(t,e);break;case Yx.INPUT:!function(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,Gx.HTML),hF(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}(t,e);break;case Yx.PARAM:case Yx.TRACK:case Yx.SOURCE:!function(t,e){t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0}(t,e);break;case Yx.IMAGE:!function(t,e){e.tagName=Hx.IMG,e.tagID=Yx.IMG,uF(t,e)}(t,e);break;case Yx.BUTTON:!function(t,e){t.openElements.hasInScope(Yx.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(Yx.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.framesetOk=!1}(t,e);break;case Yx.APPLET:case Yx.OBJECT:case Yx.MARQUEE:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}(t,e);break;case Yx.IFRAME:!function(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Xx.RAWTEXT)}(t,e);break;case Yx.SELECT:!function(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===UR.IN_TABLE||t.insertionMode===UR.IN_CAPTION||t.insertionMode===UR.IN_TABLE_BODY||t.insertionMode===UR.IN_ROW||t.insertionMode===UR.IN_CELL?UR.IN_SELECT_IN_TABLE:UR.IN_SELECT}(t,e);break;case Yx.OPTION:case Yx.OPTGROUP:!function(t,e){t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,Gx.HTML)}(t,e);break;case Yx.NOEMBED:case Yx.NOFRAMES:dF(t,e);break;case Yx.FRAMESET:!function(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_FRAMESET)}(t,e);break;case Yx.TEXTAREA:!function(t,e){t._insertElement(e,Gx.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Xx.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=UR.TEXT}(t,e);break;case Yx.NOSCRIPT:t.options.scriptingEnabled?dF(t,e):pF(t,e);break;case Yx.PLAINTEXT:!function(t,e){t.openElements.hasInButtonScope(Yx.P)&&t._closePElement(),t._insertElement(e,Gx.HTML),t.tokenizer.state=Xx.PLAINTEXT}(t,e);break;case Yx.COL:case Yx.TH:case Yx.TD:case Yx.TR:case Yx.HEAD:case Yx.FRAME:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.CAPTION:case Yx.COLGROUP:break;default:pF(t,e)}}function gF(t,e){const n=e.tagName,r=e.tagID;for(let e=t.openElements.stackTop;e>0;e--){const i=t.openElements.items[e],o=t.openElements.tagIDs[e];if(r===o&&(r!==Yx.UNKNOWN||t.treeAdapter.getTagName(i)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=e&&t.openElements.shortenToLength(e);break}if(t._isSpecialElement(i,o))break}}function AF(t,e){switch(e.tagID){case Yx.A:case Yx.B:case Yx.I:case Yx.S:case Yx.U:case Yx.EM:case Yx.TT:case Yx.BIG:case Yx.CODE:case Yx.FONT:case Yx.NOBR:case Yx.SMALL:case Yx.STRIKE:case Yx.STRONG:KR(t,e);break;case Yx.P:!function(t){t.openElements.hasInButtonScope(Yx.P)||t._insertFakeElement(Hx.P,Yx.P),t._closePElement()}(t);break;case Yx.DL:case Yx.UL:case Yx.OL:case Yx.DIR:case Yx.DIV:case Yx.NAV:case Yx.PRE:case Yx.MAIN:case Yx.MENU:case Yx.ASIDE:case Yx.BUTTON:case Yx.CENTER:case Yx.FIGURE:case Yx.FOOTER:case Yx.HEADER:case Yx.HGROUP:case Yx.DIALOG:case Yx.ADDRESS:case Yx.ARTICLE:case Yx.DETAILS:case Yx.SEARCH:case Yx.SECTION:case Yx.SUMMARY:case Yx.LISTING:case Yx.FIELDSET:case Yx.BLOCKQUOTE:case Yx.FIGCAPTION:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}(t,e);break;case Yx.LI:!function(t){t.openElements.hasInListItemScope(Yx.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(Yx.LI),t.openElements.popUntilTagNamePopped(Yx.LI))}(t);break;case Yx.DD:case Yx.DT:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}(t,e);break;case Yx.H1:case Yx.H2:case Yx.H3:case Yx.H4:case Yx.H5:case Yx.H6:!function(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}(t);break;case Yx.BR:!function(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(Hx.BR,Yx.BR),t.openElements.pop(),t.framesetOk=!1}(t);break;case Yx.BODY:!function(t,e){if(t.openElements.hasInScope(Yx.BODY)&&(t.insertionMode=UR.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}(t,e);break;case Yx.HTML:!function(t,e){t.openElements.hasInScope(Yx.BODY)&&(t.insertionMode=UR.AFTER_BODY,FF(t,e))}(t,e);break;case Yx.FORM:!function(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(Yx.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(Yx.FORM):n&&t.openElements.remove(n))}(t);break;case Yx.APPLET:case Yx.OBJECT:case Yx.MARQUEE:!function(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}(t,e);break;case Yx.TEMPLATE:rF(t,e);break;default:gF(t,e)}}function EF(t,e){t.tmplInsertionModeStack.length>0?RF(t,e):XR(t,e)}function mF(t,e){if(void 0!==t.openElements.currentTagId&&GR.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=UR.IN_TABLE_TEXT,e.type){case Dx.CHARACTER:CF(t,e);break;case Dx.WHITESPACE_CHARACTER:IF(t,e)}else BF(t,e)}function wF(t,e){switch(e.tagID){case Yx.TD:case Yx.TH:case Yx.TR:!function(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(Hx.TBODY,Yx.TBODY),t.insertionMode=UR.IN_TABLE_BODY,MF(t,e)}(t,e);break;case Yx.STYLE:case Yx.SCRIPT:case Yx.TEMPLATE:nF(t,e);break;case Yx.COL:!function(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(Hx.COLGROUP,Yx.COLGROUP),t.insertionMode=UR.IN_COLUMN_GROUP,DF(t,e)}(t,e);break;case Yx.FORM:!function(t,e){t.formElement||0!==t.openElements.tmplCount||(t._insertElement(e,Gx.HTML),t.formElement=t.openElements.current,t.openElements.pop())}(t,e);break;case Yx.TABLE:!function(t,e){t.openElements.hasInTableScope(Yx.TABLE)&&(t.openElements.popUntilTagNamePopped(Yx.TABLE),t._resetInsertionMode(),t._processStartTag(e))}(t,e);break;case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:!function(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_TABLE_BODY}(t,e);break;case Yx.INPUT:!function(t,e){hF(e)?t._appendElement(e,Gx.HTML):BF(t,e),e.ackSelfClosing=!0}(t,e);break;case Yx.CAPTION:!function(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_CAPTION}(t,e);break;case Yx.COLGROUP:!function(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_COLUMN_GROUP}(t,e);break;default:BF(t,e)}}function yF(t,e){switch(e.tagID){case Yx.TABLE:t.openElements.hasInTableScope(Yx.TABLE)&&(t.openElements.popUntilTagNamePopped(Yx.TABLE),t._resetInsertionMode());break;case Yx.TEMPLATE:rF(t,e);break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TBODY:case Yx.TD:case Yx.TFOOT:case Yx.TH:case Yx.THEAD:case Yx.TR:break;default:BF(t,e)}}function BF(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,aF(t,e),t.fosterParentingEnabled=n}function IF(t,e){t.pendingCharacterTokens.push(e)}function CF(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function TF(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)BF(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const bF=new Set([Yx.CAPTION,Yx.COL,Yx.COLGROUP,Yx.TBODY,Yx.TD,Yx.TFOOT,Yx.TH,Yx.THEAD,Yx.TR]);function DF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.COL:t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.TEMPLATE:nF(t,e);break;default:vF(t,e)}}function vF(t,e){t.openElements.currentTagId===Yx.COLGROUP&&(t.openElements.pop(),t.insertionMode=UR.IN_TABLE,t._processToken(e))}function MF(t,e){switch(e.tagID){case Yx.TR:t.openElements.clearBackToTableBodyContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_ROW;break;case Yx.TH:case Yx.TD:t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(Hx.TR,Yx.TR),t.insertionMode=UR.IN_ROW,SF(t,e);break;case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE,wF(t,e));break;default:wF(t,e)}}function NF(t,e){const n=e.tagID;switch(e.tagID){case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE);break;case Yx.TABLE:t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE,yF(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TD:case Yx.TH:case Yx.TR:break;default:yF(t,e)}}function SF(t,e){switch(e.tagID){case Yx.TH:case Yx.TD:t.openElements.clearBackToTableRowContext(),t._insertElement(e,Gx.HTML),t.insertionMode=UR.IN_CELL,t.activeFormattingElements.insertMarker();break;case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:case Yx.TR:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,MF(t,e));break;default:wF(t,e)}}function _F(t,e){switch(e.tagID){case Yx.TR:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY);break;case Yx.TABLE:t.openElements.hasInTableScope(Yx.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,NF(t,e));break;case Yx.TBODY:case Yx.TFOOT:case Yx.THEAD:(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(Yx.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=UR.IN_TABLE_BODY,NF(t,e));break;case Yx.BODY:case Yx.CAPTION:case Yx.COL:case Yx.COLGROUP:case Yx.HTML:case Yx.TD:case Yx.TH:break;default:yF(t,e)}}function LF(t,e){switch(e.tagID){case Yx.HTML:fF(t,e);break;case Yx.OPTION:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t._insertElement(e,Gx.HTML);break;case Yx.OPTGROUP:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop(),t._insertElement(e,Gx.HTML);break;case Yx.HR:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop(),t._appendElement(e,Gx.HTML),e.ackSelfClosing=!0;break;case Yx.INPUT:case Yx.KEYGEN:case Yx.TEXTAREA:case Yx.SELECT:t.openElements.hasInSelectScope(Yx.SELECT)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode(),e.tagID!==Yx.SELECT&&t._processStartTag(e));break;case Yx.SCRIPT:case Yx.TEMPLATE:nF(t,e)}}function xF(t,e){switch(e.tagID){case Yx.OPTGROUP:t.openElements.stackTop>0&&t.openElements.currentTagId===Yx.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===Yx.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===Yx.OPTGROUP&&t.openElements.pop();break;case Yx.OPTION:t.openElements.currentTagId===Yx.OPTION&&t.openElements.pop();break;case Yx.SELECT:t.openElements.hasInSelectScope(Yx.SELECT)&&(t.openElements.popUntilTagNamePopped(Yx.SELECT),t._resetInsertionMode());break;case Yx.TEMPLATE:rF(t,e)}}function RF(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(Yx.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):XR(t,e)}function FF(t,e){var n;if(e.tagID===Yx.HTML){if(t.fragmentContext||(t.insertionMode=UR.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===Yx.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(null===(n=t.treeAdapter.getNodeSourceCodeLocation(r))||void 0===n?void 0:n.endTag)&&t._setEndLocation(r,e)}}else kF(t,e)}function kF(t,e){t.insertionMode=UR.IN_BODY,aF(t,e)}function OF(t,e){t.insertionMode=UR.IN_BODY,aF(t,e)}function QF(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==Gx.HTML&&void 0!==t.openElements.currentTagId&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}new Map([[34,"""],[38,"&"],[39,"'"],[60,"<"],[62,">"]]),String.prototype.codePointAt;function UF(t,e){return function(n){let r,i=0,o="";for(;t.exec(n);)i!==r.index&&n.substring(i,r.index),e.get(r[0].charCodeAt(0)),r.index+1;return o+n.substring(i)}}new Map([[34,"""],[38,"&"],[160," "]]),new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]);new Set([Hx.AREA,Hx.BASE,Hx.BASEFONT,Hx.BGSOUND,Hx.BR,Hx.COL,Hx.EMBED,Hx.FRAME,Hx.HR,Hx.IMG,Hx.INPUT,Hx.KEYGEN,Hx.LINK,Hx.META,Hx.PARAM,Hx.SOURCE,Hx.TRACK,Hx.WBR]);var PF;!function(t){t.Root="root",t.Text="text",t.Directive="directive",t.Comment="comment",t.Script="script",t.Style="style",t.Tag="tag",t.CDATA="cdata",t.Doctype="doctype"}(PF||(PF={}));PF.Root,PF.Text,PF.Directive,PF.Comment,PF.Script,PF.Style,PF.Tag,PF.CDATA,PF.Doctype;class GF{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return tk(this,t)}}class VF extends GF{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class jF extends VF{constructor(){super(...arguments),this.type=PF.Text}get nodeType(){return 3}}class HF extends VF{constructor(){super(...arguments),this.type=PF.Comment}get nodeType(){return 8}}class YF extends VF{constructor(t,e){super(e),this.name=t,this.type=PF.Directive}get nodeType(){return 1}}class zF extends GF{constructor(t){super(),this.children=t}get firstChild(){var t;return null!==(t=this.children[0])&&void 0!==t?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class JF extends zF{constructor(){super(...arguments),this.type=PF.CDATA}get nodeType(){return 4}}class WF extends zF{constructor(){super(...arguments),this.type=PF.Root}get nodeType(){return 9}}class qF extends zF{constructor(t,e,n=[],r=("script"===t?PF.Script:"style"===t?PF.Style:PF.Tag)){super(n),this.name=t,this.attribs=e,this.type=r}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map(t=>{var e,n;return{name:t,value:this.attribs[t],namespace:null===(e=this["x-attribsNamespace"])||void 0===e?void 0:e[t],prefix:null===(n=this["x-attribsPrefix"])||void 0===n?void 0:n[t]}})}}function KF(t){return(e=t).type===PF.Tag||e.type===PF.Script||e.type===PF.Style;var e}function ZF(t){return t.type===PF.Text}function XF(t){return t.type===PF.Comment}function $F(t){return t.type===PF.Directive}function tk(t,e=!1){let n;if(ZF(t))n=new jF(t.data);else if(XF(t))n=new HF(t.data);else if(KF(t)){const r=e?ek(t.children):[],i=new qF(t.name,{...t.attribs},r);r.forEach(t=>t.parent=i),null!=t.namespace&&(i.namespace=t.namespace),t["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...t["x-attribsNamespace"]}),t["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...t["x-attribsPrefix"]}),n=i}else if(function(t){return t.type===PF.CDATA}(t)){const r=e?ek(t.children):[],i=new JF(r);r.forEach(t=>t.parent=i),n=i}else if(function(t){return t.type===PF.Root}(t)){const r=e?ek(t.children):[],i=new WF(r);r.forEach(t=>t.parent=i),t["x-mode"]&&(i["x-mode"]=t["x-mode"]),n=i}else{if(!$F(t))throw new Error(`Not implemented yet: ${t.type}`);{const e=new YF(t.name,t.data);null!=t["x-name"]&&(e["x-name"]=t["x-name"],e["x-publicId"]=t["x-publicId"],e["x-systemId"]=t["x-systemId"]),n=e}}return n.startIndex=t.startIndex,n.endIndex=t.endIndex,null!=t.sourceCodeLocation&&(n.sourceCodeLocation=t.sourceCodeLocation),n}function ek(t){const e=t.map(t=>tk(t,!0));for(let t=1;t<e.length;t++)e[t].prev=e[t-1],e[t-1].next=e[t];return e}function nk(t){const e=t.includes('"')?"'":'"';return e+t+e}const rk={isCommentNode:XF,isElementNode:KF,isTextNode:ZF,createDocument(){const t=new WF([]);return t["x-mode"]=jx.NO_QUIRKS,t},createDocumentFragment:()=>new WF([]),createElement(t,e,n){const r=Object.create(null),i=Object.create(null),o=Object.create(null);for(let t=0;t<n.length;t++){const e=n[t].name;r[e]=n[t].value,i[e]=n[t].namespace,o[e]=n[t].prefix}const s=new qF(t,r,[]);return s.namespace=e,s["x-attribsNamespace"]=i,s["x-attribsPrefix"]=o,s},createCommentNode:t=>new HF(t),createTextNode:t=>new jF(t),appendChild(t,e){const n=t.children[t.children.length-1];n&&(n.next=e,e.prev=n),t.children.push(e),e.parent=t},insertBefore(t,e,n){const r=t.children.indexOf(n),{prev:i}=n;i&&(i.next=e,e.prev=i),n.prev=e,e.next=n,t.children.splice(r,0,e),e.parent=t},setTemplateContent(t,e){rk.appendChild(t,e)},getTemplateContent:t=>t.children[0],setDocumentType(t,e,n,r){const i=function(t,e,n){let r="!DOCTYPE ";return t&&(r+=t),e?r+=` PUBLIC ${nk(e)}`:n&&(r+=" SYSTEM"),n&&(r+=` ${nk(n)}`),r}(e,n,r);let o=t.children.find(t=>$F(t)&&"!doctype"===t.name);o?o.data=null!=i?i:null:(o=new YF("!doctype",i),rk.appendChild(t,o)),o["x-name"]=e,o["x-publicId"]=n,o["x-systemId"]=r},setDocumentMode(t,e){t["x-mode"]=e},getDocumentMode:t=>t["x-mode"],detachNode(t){if(t.parent){const e=t.parent.children.indexOf(t),{prev:n,next:r}=t;t.prev=null,t.next=null,n&&(n.next=r),r&&(r.prev=n),t.parent.children.splice(e,1),t.parent=null}},insertText(t,e){const n=t.children[t.children.length-1];n&&ZF(n)?n.data+=e:rk.appendChild(t,rk.createTextNode(e))},insertTextBefore(t,e,n){const r=t.children[t.children.indexOf(n)-1];r&&ZF(r)?r.data+=e:rk.insertBefore(t,rk.createTextNode(e),n)},adoptAttributes(t,e){for(let n=0;n<e.length;n++){const r=e[n].name;void 0===t.attribs[r]&&(t.attribs[r]=e[n].value,t["x-attribsNamespace"][r]=e[n].namespace,t["x-attribsPrefix"][r]=e[n].prefix)}},getFirstChild:t=>t.children[0],getChildNodes:t=>t.children,getParentNode:t=>t.parent,getAttrList:t=>t.attributes,getTagName:t=>t.name,getNamespaceURI:t=>t.namespace,getTextNodeContent:t=>t.data,getCommentNodeContent:t=>t.data,getDocumentTypeNodeName(t){var e;return null!==(e=t["x-name"])&&void 0!==e?e:""},getDocumentTypeNodePublicId(t){var e;return null!==(e=t["x-publicId"])&&void 0!==e?e:""},getDocumentTypeNodeSystemId(t){var e;return null!==(e=t["x-systemId"])&&void 0!==e?e:""},isDocumentTypeNode:t=>$F(t)&&"!doctype"===t.name,setNodeSourceCodeLocation(t,e){e&&(t.startIndex=e.startOffset,t.endIndex=e.endOffset),t.sourceCodeLocation=e},getNodeSourceCodeLocation:t=>t.sourceCodeLocation,updateNodeSourceCodeLocation(t,e){null!=e.endOffset&&(t.endIndex=e.endOffset),t.sourceCodeLocation={...t.sourceCodeLocation,...e}}};var ik=s(3631);qF.prototype.toString=function(){throw new Error("Element.toString() is not supported")},Object.defineProperty(GF.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(GF.prototype,"localName",{get:function(){return this.name}});const ok=Object.getOwnPropertyDescriptor(qF.prototype,"attributes")?.get;function sk(t,e,n){return function(t,e,n){const r=function(t,e){return jR.parse(t,e)}(t,{treeAdapter:rk,sourceCodeLocationInfo:!0});r.name="root";const i=ik.parse(e),o=i.select({node:r,allowAnyNamespaceForNoPrefix:!0});if(!o.length)throw new Error(`Failed to find XPath: "${e}"`);return o.map(t=>function(t,e){if(!e)return{start:t.startIndex,end:t.endIndex};if(!("firstChild"in t)||!t.firstChild)throw new Error(`Node "${t.name}" has no children`);return{start:t.firstChild.startIndex,end:t.lastChild.endIndex}}(t,n))}(t,e,n)}function ak(t,e){const n=hx({path:e,json:JSON.parse(t),wrap:!1,resultType:"pointer",eval:"safe",ignoreEvalErrors:!0});if(!n)throw new Error("jsonPath not found");const r=XL("("+t+")",{range:!0});if(r.body[0]instanceof DS&&(r.body[0].expression instanceof WS||r.body[0].expression instanceof XN)){const t=Array.isArray(n)?n:[n],e=[];for(const n of t){const t=ck(r.body[0].expression,"",[n]);t&&e.push({start:t.start-1,end:t.end-1})}return e}throw new Error("jsonPath not found")}function ck(t,e,n){if(t instanceof WS)for(const r of t.properties){if(!(r instanceof ZS))continue;const t=r.key.type===RN.Literal?e+"/"+r.key.value:e;if(n.includes(t)&&"range"in r&&Array.isArray(r.range))return{start:r.range[0],end:r.range[1]};if(r.value instanceof WS||r.value instanceof XN){const e=ck(r.value,t,n);if(e)return e}}if(t instanceof XN)for(let r=0;r<t.elements.length;r++){const i=t.elements[r];if(!i)continue;const o=e+"/"+r;if(n.includes(o)&&"range"in i&&Array.isArray(i.range))return{start:i.range[0],end:i.range[1]};if(i instanceof WS){const t=ck(i,o,n);if(t)return t}if(i instanceof XN){const t=ck(i,o,n);if(t)return t}}return null}function lk(t){const e=[];for(const[n,r]of Object.entries(t||{}))e.push(`${n}: ${r}`);return e}function uk(t,e,n){if(n?.length){let e=0;for(const r of n){const n=r.toIndex-r.fromIndex;if(t>=e&&t<=e+n)return t-e+r.fromIndex;e+=n}throw new Error("position out of range")}return e+t}function hk(t,e,n){const r=[];if(!n?.length)return r;for(let i=1;i<n?.length;i++){const o=n[i];o.fromIndex>t&&o.fromIndex<e&&r.push({fromIndex:n[i-1].toIndex,toIndex:o.fromIndex})}return r}function dk(t){const e=wy();return e.onChunk(t),e.streamEnded(),e.res}function pk(t){return e=t,n="sgiu",n=n?.replace("u",""),new RegExp(e,n);var e,n}ok?Object.defineProperty(qF.prototype,"attributes",{get:function(...t){const e=ok.call(this,...t);return e.item=t=>{const n=e[t];return{...n,nodeType:2,localName:n.name}},e}}):console.warn("[WARN] Unable to patch DOM: Element.attributes property descriptor not found");const fk="{".charCodeAt(0),gk="}".charCodeAt(0);function Ak(t,e){if(0===t.length&&0===e?.length)return!0;if(!e)return!1;let n=-1,r=-1;for(;n<t.length&&r<e.length;){let t=i(),e=o();if(t!==e){if(t!==fk||e!==fy)return!1;if(i()!==fk)return!1;for(;(t=i())!==gk&&-1!==t;);for(;(t=i())!==gk&&-1!==t;);if(-1===t)return!1;for(;(e=o())===fy&&-1!==e;);if(-1===e)return-1===i();r--}}function i(){return n++,n<t.length?t[n]:-1}function o(){return e?(r++,r<e.length?e[r]:-1):-1}return n===t.length&&r===e.length}const{K3:Ek}=n,mk={hostPort:function(t,e){const{host:n}=new URL(function(t,e){let n=t?.url;const r=new Set;let i=null;for(;i=Bk.exec(n);)r.add(i[1]);for(const i of r)if(t.paramValues&&i in t.paramValues)n=n?.replaceAll(`{{${i}}}`,t.paramValues[i].toString());else{if(!e?.paramValues||!(i in e.paramValues))throw new Error(`parameter "${i}" value not found in templateParams`);n=n?.replaceAll(`{{${i}}}`,e.paramValues[i].toString())}return n}(t,e));if(!n)throw new Error("url is incorrect");return n},writeRedactionMode:t=>"writeRedactionMode"in t?t.writeRedactionMode:void 0,geoLocation:(t,e)=>"geoLocation"in t?function(t,e){if(t?.geoLocation){const n=new Set;let r=t.geoLocation,i=null;for(;i=Bk.exec(r);)n.add(i[1]);for(const i of n)if(t.paramValues&&i in t.paramValues)r=r?.replaceAll(`{{${i}}}`,t.paramValues[i].toString());else{if(!e?.paramValues||!(i in e.paramValues))throw new Error(`parameter "${i}" value not found in templateParams`);r=r?.replaceAll(`{{${i}}}`,e.paramValues[i].toString())}if(!/^[A-Za-z]{2}$/gisu.test(r))throw new Error(`Geolocation ${r} is invalid`);return r}return}(t,e):void 0,proxySessionId:(t,e)=>"proxySessionId"in t?function(t,e){if(t?.proxySessionId){const r=new Set;let i=t.proxySessionId,o=null;for(;o=Bk.exec(i);)r.add(o[1]);for(const n of r)if(t.paramValues&&n in t.paramValues)i=i?.replaceAll(`{{${n}}}`,t.paramValues[n].toString());else{if(!e?.paramValues||!(n in e.paramValues))throw new Error(`parameter "${n}" value not found in templateParams`);i=i?.replaceAll(`{{${n}}}`,e.paramValues[n].toString())}if(!("string"==typeof(n=i)&&n.length>=8&&n.length<15&&/^[a-z0-9]+$/.test(n)))throw new Error(`proxySessionId ${i} is invalid`);return i}var n;return}(t,e):void 0,additionalClientOptions(t){let e={applicationLayerProtocols:["http/1.1"]};return"additionalClientOptions"in t&&(e={...e,...t.additionalClientOptions}),e},createRequest(t,e,n){if(!t.cookieStr&&!t.authorisationHeader&&!t.headers)throw new Error("auth parameters are not set");const r=e.headers||{},i={...t.headers};t.cookieStr&&(i.Cookie=t.cookieStr),t.authorisationHeader&&(i.Authorization=t.authorisationHeader);Object.keys(r).some(t=>"user-agent"===t.toLowerCase())||Object.keys(i).some(t=>"user-agent"===t.toLowerCase())||(r["User-Agent"]="reclaim/0.0.1");const o=Ck(e,t);e=o.newParams;const s=new URL(e.url),{pathname:a}=s,c=e.url.includes("?")?e.url.split("?")[1]:"";n.info({url:e.url,path:a,query:c.toString()});const l=e.body instanceof Uint8Array?e.body:Yw(e.body||""),u=l.length,h=`${e.method} ${a}${c?.length?"?"+c:""} HTTP/1.1`,d=lk(i);n.info({requestLine:h});const p=Yw([h,`Host: ${yk(s)}`,`Content-Length: ${u}`,"Connection: close","Accept-Encoding: identity",...lk(r),...d,"\r\n"].join("\r\n")),f=K([p,l]),g=d.join("\r\n"),A=Jw(f,Yw(g)),E=[{fromIndex:A,toIndex:A+g.length}];if(o.hiddenBodyParts?.length>0)for(const t of o.hiddenBodyParts)t.length&&E.push({fromIndex:p.length+t.index,toIndex:p.length+t.index+t.length});if(o.hiddenURLParts?.length>0)for(const t of o.hiddenURLParts)t.length&&E.push({fromIndex:t.index,toIndex:t.index+t.length});return E.sort((t,e)=>t.toIndex-e.toIndex),{data:f,redactions:E}},getResponseRedactions({response:t,params:e,logger:n,ctx:r}){n.debug({response:Ek.encode(t),params:e});const i=dk(t);if(!e.responseRedactions?.length)return[];if(2!=(i.statusCode/100|0))throw n.error({response:Ek.encode(t),params:e}),new Error(`Expected status 2xx, got ${i.statusCode} (${i.statusMessage})`);const o=Ck(e,void 0,!0).newParams,s=i.statusLineEndIndex,a=i.bodyStartIndex??0;if(a<4)throw n.error({response:Ek.encode(t)}),new Error("Failed to find response body");const c=[{fromIndex:0,toIndex:s}];if(wk(r)){if(!Z(t.slice(i.headerEndIdx,i.headerEndIdx+4),Yw("\r\n\r\n")))throw n.error({response:Ek.encode(t)}),new Error(`Failed to find header/body separator at index ${i.headerEndIdx}`)}c.push({fromIndex:i.headerEndIdx,toIndex:i.headerEndIdx+4}),i.headerIndices.date&&c.push(i.headerIndices.date);const l=tt(i.body),u=[];for(const t of o.responseRedactions||[]){const e=Ik(l,t,a,i.chunks);for(const{reveal:t,redactions:n}of e)c.push(t),u.push(...n)}if(c.sort((t,e)=>t.toIndex-e.toIndex),c.length>1){let e=0;for(const t of c)e<t.fromIndex&&u.push({fromIndex:e,toIndex:t.fromIndex}),e=t.toIndex;u.push({fromIndex:e,toIndex:t.length})}for(const t of c)t.hash&&u.push(t);return u.sort((t,e)=>t.toIndex-e.toIndex),u},assertValidProviderReceipt({receipt:t,params:e,logger:n,ctx:r}){!function(){const r=t.filter(t=>"client"===t.sender).map(t=>t.message),i=t.filter(t=>"server"===t.sender).map(t=>t.message),o=Ek.encode(K(r)),s=Ek.encode(K(i));n.debug({request:o,response:s,params:e})}();let i={};const o="secretParams"in e?e.secretParams:void 0,s=Ck(e,o,!o),a=s.newParams;i={...i,...s.extractedValues};const c=function(t){const e=t.filter(t=>"client"===t.sender);if(e[0].message[0]===fy)throw new Error("First client message request is redacted. Cannot parse");const n={method:"",url:"",protocol:"",headers:{}};let r=K(e.map(t=>t.message));for(let t=i();void 0!==t&&""!==t;t=i())if(n.method){let e=t.indexOf(":");-1===e&&(e=t.length-1);const r=t.slice(0,e).toLowerCase().trim(),i=t.slice(e+1).trim(),o=n.headers[r];"string"==typeof o?n.headers[r]=[o,i]:Array.isArray(o)?o.push(i):n.headers[r]=i}else{const[,e,r,i]=t.match(/(\w+) (.*) (.*)/)||[];n.method=e.toLowerCase(),n.url=r,n.protocol=i}if(r.length&&(n.body=r),!n.method)throw new Error("Client request is incomplete");return n;function i(){const t=Jw(r,my);if(-1===t)return;const e=Hw(r.slice(0,t));return r=r.slice(t+my.length),e}}(t);if(c.method!==a.method.toLowerCase())throw new Error(`Invalid method: ${c.method}`);const l=new URL(a.url),{protocol:u,pathname:h}=l;if("https:"!==u)throw n.error("params URL: %s",a.url),new Error(`Expected protocol: https, found: ${u}`);const d=a.url.includes("?")?a.url.split("?")[1]:"",p=h.replaceAll("%7B","{").replaceAll("%7D","}")+(d?.length?"?"+d:"");if(!Ak(Yw(p),Yw(c.url)))throw n.error("params URL: %s",a.url),new Error(`Expected path: ${p}, found: ${c.url}`);const f=yk(l);if(c.headers.host!==f)throw new Error(`Expected host: ${f}, found: ${c.headers.host}`);const g=c.headers.connection;if("close"!==g)throw new Error(`Connection header must be "close", got "${g}"`);const A=function(...t){const e=t.reduce((t,e)=>t+e.length,0),n=new Uint8Array(e);let r=0;for(const e of t)n.set(e,r),r+=e.length;return n}(...t.filter(t=>"server"===t.sender).map(t=>t.message).filter(t=>!t.every(t=>t===fy)));let E;E=Hw(A);if(!pk("^HTTP\\/1.1 2\\d{2}").exec(E)){const t=pk("^HTTP\\/1.1 (\\d{3})").exec(E);if(t&&t.length>1)throw new Error(`Provider returned error ${t[1]}`);let e=E.indexOf("*");throw-1===e&&(e=E.indexOf("\n")),-1===e&&(e=12),new Error(`Response did not start with "HTTP/1.1 2XX" got "${E.slice(0,e)}"`)}let m;if(wk(r)){if(m=E.indexOf("\r\n\r\n",12)+4,m<4)throw new Error("Response body start not found")}else m=12;const w=pk("[dD]ate: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-3][0-9]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[0-9]{4}) (?:[01][0-9]|2[0-3])(?::[0-5][0-9]){2} GMT)").exec(E);if(w&&w.length>1){const t=new Date(w[1]);Date.now()-t.getTime()>6e5&&n.info({dateHeader:w[0],current:Date.now()},"date header is off")}const y=a.body instanceof Uint8Array?a.body:Yw(a.body||"");if(y.length>0&&!Ak(y,c.body))throw new Error("request body mismatch");o||(E=E.slice(m).replace(/(\*){3,}/g,""));for(const{type:t,value:e,invert:n}of a.responseMatches||[]){const r=Boolean(n);switch(t){case"regex":const o=pk(e).exec(E),s=null!==o;if(s===r)throw new Error(`Invalid receipt. Regex "${e}" ${n?"matched":"didn't match"}`);if(!s)continue;const a=o?.groups;for(const t in a||[]){if(t in i)throw new Error(`Duplicate parameter ${t}`);const e=a?.[t];"string"==typeof e&&(i[t]=e)}break;case"contains":if(E.includes(e)===r)throw new Error(`Invalid receipt. Response ${n?"contains":"does not contain"} "${e}"`);break;default:throw new Error(`Invalid response match type ${t}`)}}return{extractedParameters:i}}};function wk({version:t}){return t>=em}function yk(t){const e=t.hostname,n=t.port;return n&&443!==+n?`${e}:${n}`:e}const Bk=/{{([^{}]+)}}/gis;function*Ik(t,e,n,r){let i=t,o=0,s=-1;if(e.xPath){const n=sk(t,e.xPath,!!e.jsonPath);for(const{start:r,end:u}of n)i=t.slice(r,u),o=r,s=u-r,e.jsonPath?yield*a():e.regex?yield*c():yield*l()}else if(e.jsonPath)yield*a();else{if(!e.regex)throw new Error("Expected either xPath, jsonPath or regex for redaction");yield*c()}function*a(){const n=ak(i,e.jsonPath),r=o;for(const a of n){const n=a.start,u=a.end;i=t.slice(r+n,r+u),o=r+n,s=u-n,e.regex?yield*c():yield*l()}}function*c(){uy.debug({element:Ek.encode(Yw(i)),body:Ek.encode(Yw(t))});const n=pk(e.regex),a=i||t,c=n.exec(a);if(!c?.[0])throw new Error(`regexp ${e.regex} does not match found element '${Ek.encode(Yw(a))}'`);if(o+=c.index,s=n.lastIndex-c.index,i=c[0],e.hash&&(!c.groups||Object.keys(c.groups).length>1))throw new Error("Exactly one named capture group is needed per hashed redaction");if(!e.hash||!c.groups)return void(yield*l());const h=c[0],d=Object.values(c.groups)[0],p=h.indexOf(d);s=p,i=h.slice(0,p),yield*l(null),o+=p,i=d,s=d.length;const f=u(o,s,e.hash),g=hk(f.fromIndex,f.toIndex,r);if(g.length)throw new Error("Hash redactions cannot be performed if the redacted string is split between 2 or more HTTP chunks");yield{reveal:f,redactions:g},o+=d.length,i=h.slice(p+d.length),s=i.length,yield*l(null)}function*l(t=e.hash,n=r){if(o<0||!s)return;const i=u(o,s,t||void 0);yield{reveal:i,redactions:hk(i.fromIndex,i.toIndex,n)}}function u(t,e,i){return{fromIndex:uk(t,n,r),toIndex:uk(t+e,n,r),hash:i}}}function Ck(t,e,n){const r=JSON.parse(JSON.stringify(t));let i={};const o=[],s=h(r.url,n);if(s&&(r.url=s.newParam,i={...s.extractedValues},s.hiddenParts.length)){const e=`https://${yk(new URL(r.url))}`.length-t.method.length-1;for(const t of s.hiddenParts)o.push({index:t.index-e,length:t.length})}let a,c=[];if(r.body){a=h("string"==typeof r.body?r.body:Hw(r.body),n),a&&(r.body=a.newParam,i={...i,...a.extractedValues},c=a.hiddenParts)}const l=h(r.geoLocation);l&&(r.geoLocation=l.newParam,i={...i,...l.extractedValues});const u=h(r.proxySessionId);if(u&&(r.proxySessionId=u.newParam,i={...i,...u.extractedValues}),r.responseRedactions)for(const t of r.responseRedactions){if(t.regex){const e=h(t.regex);t.regex=e?.newParam}if(t.xPath){const e=h(t.xPath);t.xPath=e?.newParam}if(t.jsonPath){const e=h(t.jsonPath);t.jsonPath=e?.newParam}}if(r.responseMatches)for(const t of r.responseMatches)if(""!==t.value){const e=h(t.value);t.value=e?.newParam,i={...i,...e?.extractedValues}}return{newParams:r,extractedValues:i,hiddenBodyParts:c,hiddenURLParts:o};function h(t,n){if(!t)return null;const i={},o=[];let s=0;return{newParam:t=t.replace(Bk,(t,a,c)=>{if(r.paramValues&&a in r.paramValues)return i[a]=r.paramValues[a],s+=r.paramValues[a].length-t.length,r.paramValues[a];if(e){if(e?.paramValues&&a in e?.paramValues)return o.push({index:c+s,length:e.paramValues[a].length}),s+=e.paramValues[a].length-t.length,e.paramValues[a];throw new Error(`parameter's "${a}" value not found in paramValues and secret parameter's paramValues`)}if(n)return t;throw new Error(`parameter's "${a}" value not found in paramValues`)}),extractedValues:i,hiddenParts:o}}}const Tk={http:mk},bk=async({onMessage:t,onClose:e,tlsOpts:n,request:r,connect:i,logger:o})=>{const s=[],a=r.id||Zw();let c,l,u,h;const d=new Promise((t,e)=>{u=t,h=e}),p=zd({host:r.host,...n,logger:o,onHandshake(){u?.()},onApplicationData:e=>t?.(e),onTlsEnd:f,async write(t,e){const n=K([t.header,t.content]);if(s.push({sender:"client",message:{...e,data:n}}),!c){const t=Kw();l=i([{id:t,createTunnelRequest:{host:r.host||"",port:r.port||443,geoLocation:r.geoLocation||"",proxySessionId:r.proxySessionId||"",id:a}},{tunnelMessage:{tunnelId:a,message:n}}]);try{await async function(){return c=await(({tunnelId:t,client:e,onClose:n,onMessage:r})=>{let i=!1;return e.addEventListener("tunnel-message",o),e.addEventListener("tunnel-disconnect-event",s),e.addEventListener("connection-terminated",a),{async write(n){await e.sendMessage({tunnelMessage:{tunnelId:t,message:n}})},async close(n){i||(c(n),await e.rpc("disconnectTunnel",{id:t}))}};function o({data:e}){e.tunnelId===t&&r?.(e.message)}function s({data:e}){e.tunnelId===t&&c(e.error?.code?Iv.fromProto(e.error):void 0)}function a({data:t}){c(t)}function c(r){e.logger?.debug({tunnelId:t,err:r},"TCP tunnel closed"),e.removeEventListener("tunnel-message",o),e.removeEventListener("tunnel-disconnect-event",s),e.removeEventListener("connection-terminated",a),n?.(r),n=void 0,i=!0}})({tunnelId:a,client:l,onMessage(t){p.handleReceivedBytes(t)},onClose(t){p.end(t)}}),o?.debug("plaintext tunnel created"),c}(),await l.waitForResponse(t)}catch(t){f(t)}return}return c.write(n)},onRead(t,e){s.push({sender:"server",message:{...e,data:K([t.header,"ciphertext"===e.type?e.ciphertext:t.content])}})}});return await p.startHandshake(),await d,u=h=void 0,{transcript:s,tls:p,write:t=>p.write(t),async close(t){f(t);try{await c.close(t)}catch(t){o?.error({err:t},"err in close tunnel")}}};function f(t){e?.(t),e=void 0,h?.(t||new Error("TLS connection closed"))}},Dk={};function vk({logger:t,maxRetries:e=3,...n}){const r=t||("logger"in n.client?n.client.logger:uy);return async function(t,{maxRetries:e=3,shouldRetry:n,logger:r}){let i=0;for(;i<e;)try{return await t(i)}catch(t){if(i+=1,i>=e)throw t;if(!n(t))throw t;r.info({err:t,retries:i},"retrying failed operation")}throw new Error("retries exhausted")}(t=>async function({name:t,params:e,secretParams:n,context:r,onStep:i,ownerPrivateKey:o,client:s,logger:a=uy,timestampS:c,updateProviderParams:l,updateParametersFromOprfData:u=!0,...h}){const d=Tk[t],p=qw(e,d.hostPort,n),f=qw(e,d.geoLocation,n),g=qw(e,d.proxySessionId,n),A=qw(e,d.additionalClientOptions),E={...vN(),fetchCertificateBytes:J,...A},{zkEngine:m="snarkjs"}=h;let w=qw(e,d.writeRedactionMode);const[y,B]=p.split(":"),I=wy();let T,b=!1;const D=new Map;let v;i?.({name:"connecting"});const M={host:y,port:B?+B:yw,geoLocation:f,proxySessionId:g,id:Zw()};a=a.child({tunnelId:M.id});const N="authRequest"in s?"function"==typeof s.authRequest?await s.authRequest():s.authRequest:void 0,S=await bk({tlsOpts:E,connect:t=>{let e=!1;return T="metadata"in s?s:function(t,e=()=>({})){const n=t.toString();let r,i=Dk[n];if(i?.isClosed?r="closed":i||(r="non-existent"),r){const o=e();o?.logger?.info({key:n,createReason:r},"creating new client"),i=Dk[n]=new xN({...o,url:t})}return i}(s.url,()=>(e=!0,{authRequest:N,initMessages:t,logger:a})),e||T.waitForInit().then(()=>T.sendMessage(...t)).catch(t=>{a.error({err:t},"error in sending init msgs")}),T},logger:a,request:M,onMessage(t){a.debug({bytes:t.length},"recv data from server"),I.onChunk(t),I.res.complete&&(a?.debug("got complete HTTP response from server"),setTimeout(()=>{v?.()},100))},onClose(t){const e=t?"error":"debug";a?.[e]({err:t},"tls session ended"),v?.(t);try{I.streamEnded()}catch{}}}),{version:_,cipherSuite:L}=S.tls.getMetadata();"TLS1_2"===_&&"zk"!==w&&(w="zk",a.info("TLS1.2 detected, defaulting to zk redaction mode"));const{redactions:x,data:R}=d.createRequest(n,e,a),F="string"==typeof R?$(R):R;a.debug({redactions:x.length},"generated request");const k=new Promise((t,e)=>{v=n=>n?e(n):t()});i?.({name:"sending-request-data"});try{"zk"===w?await q():await W(),a.info("wrote request to server")}catch(t){a.error({err:t},"session errored during write, waiting for stream end")}if(i?.({name:"waiting-for-response"}),await k,await S.close(),a.info("session closed, processing response"),l){const{params:t,secretParams:r}=await l(S.transcript,_??"TLS1_2");e={...e,...t},n={...n,...r}}const O=TN[T.metadata.signatureType];let Q,U;const[P]=tt("server",1);P&&"ciphertext"===P.message.type&&(Q=P.message.fixedIv);const[G]=tt("client",1);G&&"ciphertext"===G.message.type&&(U=G.message.fixedIv);const V=await et(),j=jm.create({request:M,data:{provider:t,parameters:Qv(e),context:Qv(r),timestampS:c??zw(),owner:ot()},transcript:V,zkEngine:"gnark"===m?cm:am,fixedServerIV:Q,fixedClientIV:U});i?.({name:"waiting-for-verification"});const H=jm.encode(j).finish(),Y=await O.sign(H,o);j.signatures={requestSignature:Y};const z=await T.rpc("claimTunnel",j);return a.info({success:!!z.claim},"recv claim response"),z;async function J(t){if(!T)throw new Error("attestor client not initialized");return(await T.rpc("fetchCertificateBytes",{url:t})).bytes}async function W(){let t=0;for(const e of x){const n=F.slice(t,e.fromIndex);n.length&&await Z(n,!0);const r=F.slice(e.fromIndex,e.toIndex);await Z(r,!1),t=e.toIndex}const e=x?.[x.length-1]?.toIndex||0,n=F.slice(e);n.length&&await Z(n,!0)}async function q(){let t=S.transcript.length;await S.tls.write(F),t=S.transcript.length-t,X({type:"zk",redactedPlaintext:Ay(F,x)},t)}async function Z(t,e){e!==b&&await S.tls.updateTrafficKeys();let n=S.transcript.length;await S.write(t),n=S.transcript.length-n,X(e?{type:"complete"}:void 0,n),b=e}function X(t,e=1){const n=tt("client",e);if(n.length)for(const e of n)it(e.message,t)}function tt(t,e){const n=[];for(let r=S.transcript.length-1;r>=0;r--){const i=S.transcript[r];if(i.sender===t&&(n.push(i),n.length===e))break}return n}async function et(){await nt();const t=Date.now(),e=await async function(t,e,{onZkProgress:n,...r}){const i=[],o=await Tv(r);let s=0;await Promise.all(t.map(async({message:n,sender:r},s)=>{const a={sender:"client"===r?jE:HE,message:n.data,reveal:void 0};i.push(a);const c=e.get(n);if(c&&"plaintext"!==n.type)switch(c?.type){case"complete":a.reveal={directReveal:{key:await C.exportKey(n.encKey),iv:n.fixedIv,recordNumber:n.recordNumber}};break;case"zk":c.redactedPlaintext=K([c.redactedPlaintext,n.plaintext.slice(c.redactedPlaintext.length)]),await o.addPacketToProve(n,c,(t,e)=>a.reveal={zkReveal:{proofs:t,toprfs:e}},()=>{const e=t.slice(s+1).find(t=>t.sender===r);return e?.message})}}));const a=o.getTotalChunksToProve();return n?.(s,a),await o.generateProofs(()=>{s+=1,n?.(s,a)}),i}(S.transcript,D,{logger:a,cipherSuite:L,onZkProgress(e,n){const r=(Date.now()-t)/e*(n-e);i?.({name:"generating-zk-proofs",proofsDone:e,proofsTotal:n,approxTimeLeftS:Math.round(r/1e3)})},...h});return e}async function nt(){const t=S.transcript;let r="all";const i=[],o=[];for(const e of t){if("ciphertext"!==e.message.type||!ty(e.message,_))continue;const t="TLS1_3"===_?e.message.plaintext.slice(0,-1):e.message.plaintext;i.push({message:t,sender:e.sender}),"server"===e.sender&&o.push({plaintext:t,message:e.message})}d.getResponseRedactions&&(r=await async function(t,e,n){const r=t.map(t=>({block:t,redactedPlaintext:new Uint8Array(t.plaintext)})),i=K(t.map(t=>t.plaintext)),o=e(i);if(!o.length)return"all";let s=0,a=0,c=0;for(const t of o)await l(t);return r.filter(t=>!gy(t.redactedPlaintext));async function l(t){for(;c<t.fromIndex;)u();if(t.hash){const e=i.slice(t.fromIndex,t.toIndex),{nullifier:o,responses:l,mask:h}=await n(e),d={nullifier:o,responses:l,dataLocation:{fromIndex:a,length:t.toIndex-t.fromIndex},mask:h,plaintext:e},p=s,f=r[s];f.toprfs||=[],f.toprfs.push(d);const g=Ey(o,d.dataLocation.length);let A=0,E=0;for(;c<t.toIndex;)s!==p&&(E+=1),r[s].redactedPlaintext[a]=g.charCodeAt(A),u(),A+=1;E&&(r[s].overshotToprfFromPrevBlock={length:E})}for(;c<t.toIndex;)r[s].redactedPlaintext[a]=fy,u()}function u(){c+=1,a+=1,a>=t[s].plaintext.length&&(s+=1,a=0)}}(o,t=>d.getResponseRedactions({response:t,params:e,logger:a,ctx:Cw}),rt));const s=i.filter(t=>"client"===t.sender);if("all"===r){for(const{message:e,sender:n}of t)"server"===n&&it(e,{type:"complete"});s.push(...i.filter(t=>"server"===t.sender))}else for(const{block:t,redactedPlaintext:n,overshotToprfFromPrevBlock:i,toprfs:o}of r)if(it(t.message,{type:"zk",redactedPlaintext:n,toprfs:o,overshotToprfFromPrevBlock:i}),s.push({sender:"server",message:n}),u&&o){let t=Qv(e);for(const e of o){const n=Hw(e.plaintext),r=Ey(e.nullifier,e.dataLocation.length);t=t.replaceAll(n,r)}e=JSON.parse(t)}await d.assertValidProviderReceipt({receipt:s,params:{...e,secretParams:n},logger:a,ctx:Cw});for(const e of t)if("ciphertext"===e.message.type){if(ty(e.message,_))break;it(e.message,{type:"complete"})}}async function rt(t){a.info({length:t.length},"generating OPRF...");const e=h.oprfOperators?.chacha20||_v("chacha20",m,a),n=await e.generateOPRFRequestData(t,bw,a),r=await T.rpc("toprf",{maskedData:n.maskedData,engine:Lv(m)});return{nullifier:await e.finaliseOPRF(T.initResponse.toprfPublicKey,n,[r]),responses:[r],mask:n.mask,dataLocation:void 0,plaintext:t}}function it(t,e){e?D.set(t,e):D.delete(t)}function ot(){const{getAddress:t,getPublicKey:e}=O;return t(e(o))}}({...n,logger:t?r.child({attempt:t}):r}),{maxRetries:e,logger:r,shouldRetry:Mk})}function Mk(t){return!(t instanceof TypeError)&&(!!t?.message?.includes("stream ended before")||t instanceof Iv&&"ERROR_INVALID_CLAIM"!==t.code&&"ERROR_BAD_REQUEST"!==t.code&&"ERROR_AUTHENTICATION_FAILED"!==t.code&&"ERROR_TOPRF_OUT_OF_BOUNDS"!==t.code)}var Nk=window.WebSocket;window.WebSocket;var Sk=s(7770),_k=s(3859);function Lk(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return xk(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(xk(e={},r,function(){return this}),e),h=l.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,xk(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return c.prototype=l,xk(h,"constructor",l),xk(l,"constructor",c),c.displayName="GeneratorFunction",xk(l,i,"GeneratorFunction"),xk(h),xk(h,i,"Generator"),xk(h,r,function(){return this}),xk(h,"toString",function(){return"[object Generator]"}),(Lk=function(){return{w:o,m:d}})()}function xk(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}xk=function(t,e,n,r){function o(e,n){xk(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},xk(t,e,n,r)}function Rk(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function Fk(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){Rk(o,r,i,s,a,"next",t)}function a(t){Rk(o,r,i,s,a,"throw",t)}s(void 0)})}}var kk,Ok=function(){var t=Fk(Lk().m(function t(e,n,r,i){var o,s,a,c;return Lk().w(function(t){for(;;)switch(t.p=t.n){case 0:return o=(0,Sk.y8)({sessionId:e||"unknown",providerId:r||"unknown",appId:i||"unknown",source:"reclaim-extension-sdk",type:_k.LOG_TYPES.FETCH_DATA}),t.p=1,t.n=2,fetch("".concat(Yf()),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:e,status:n})});case 2:if((s=t.v).ok){t.n=3;break}throw new Error("Failed to update session status");case 3:return o.info({message:"Successfully updated session status: "+n,logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.FETCH_DATA}),t.n=4,s.json();case 4:return a=t.v,t.a(2,a);case 5:throw t.p=5,c=t.v,o.error({message:"Error updating session status: "+c.toString(),logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.FETCH_DATA,eventType:_k.EVENT_TYPES.UPDATE_SESSION_STATUS_ERROR}),c;case 6:return t.a(2)}},t,null,[[1,5]])}));return function(e,n,r,i){return t.apply(this,arguments)}}();function Qk(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof a?r:a,l=Object.create(c.prototype);return Uk(l,"_invoke",function(n,r,i){var o,a,c,l=0,u=i||[],h=!1,d={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return o=e,a=0,c=t,d.n=n,s}};function p(n,r){for(a=n,c=r,e=0;!h&&l&&!i&&e<u.length;e++){var i,o=u[e],p=d.p,f=o[2];n>3?(i=f===r)&&(c=o[(a=o[4])?5:(a=3,3)],o[4]=o[5]=t):o[0]<=p&&((i=n<2&&p<o[1])?(a=0,d.v=r,d.n=o[1]):p<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,d.n=f,a=0))}if(i||n>1)return s;throw h=!0,r}return function(i,u,f){if(l>1)throw TypeError("Generator is already running");for(h&&1===u&&p(u,f),a=u,c=f;(e=a<2?t:c)||!h;){o||(a?a<3?(a>1&&(d.n=-1),p(a,c)):d.n=c:d.v=c);try{if(l=2,o){if(a||(i="next"),e=o[i]){if(!(e=e.call(o,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=o.return)&&e.call(o),a<2&&(c=TypeError("The iterator does not provide a '"+i+"' method"),a=1);o=t}else if((e=(h=d.n<0)?c:n.call(r,d))!==s)break}catch(e){o=t,a=1,c=e}finally{l=1}}return{value:e,done:h}}}(n,i,o),!0),l}var s={};function a(){}function c(){}function l(){}e=Object.getPrototypeOf;var u=[][r]?e(e([][r]())):(Uk(e={},r,function(){return this}),e),h=l.prototype=a.prototype=Object.create(u);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Uk(t,i,"GeneratorFunction")),t.prototype=Object.create(h),t}return c.prototype=l,Uk(h,"constructor",l),Uk(l,"constructor",c),c.displayName="GeneratorFunction",Uk(l,i,"GeneratorFunction"),Uk(h),Uk(h,i,"Generator"),Uk(h,r,function(){return this}),Uk(h,"toString",function(){return"[object Generator]"}),(Qk=function(){return{w:o,m:d}})()}function Uk(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}Uk=function(t,e,n,r){function o(e,n){Uk(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},Uk(t,e,n,r)}function Pk(t,e,n,r,i,o,s){try{var a=t[o](s),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(r,i)}function Gk(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function s(t){Pk(o,r,i,s,a,"next",t)}function a(t){Pk(o,r,i,s,a,"throw",t)}s(void 0)})}}function Vk(t){return Vk="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vk(t)}function jk(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hk(r.key),r)}}function Hk(t){var e=function(t,e){if("object"!=Vk(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=Vk(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==Vk(e)?e:e+""}kk=Pf,Object.assign(C,kk);var Yk=(0,Sk.y8)({sessionId:"unknown",providerId:"unknown",appId:"unknown",source:"reclaim-extension-sdk",type:_k.LOG_TYPES.OFFSCREEN});"undefined"==typeof WebAssembly&&a.w9.error(a.Ey.OFFSCREEN,"WebAssembly is not available in this browser context"),void 0!==s.g&&(s.g.WASM_PATH=chrome.runtime.getURL(""));var zk=document.createElement("meta");zk.httpEquiv="Cross-Origin-Embedder-Policy",zk.content="require-corp",document.head.appendChild(zk);var Jk=document.createElement("meta");Jk.httpEquiv="Cross-Origin-Opener-Policy",Jk.content="same-origin",document.head.appendChild(Jk),window.WebSocket=Nk;var Wk=function(){return function(t,e,n){return e&&jk(t.prototype,e),n&&jk(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.init()},[{key:"init",value:function(){Yk.info({message:"[OFFSCREEN] Offscreen ready",logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.OFFSCREEN}),chrome.runtime.onMessage.addListener(this.handleMessage.bind(this));try{var t=s(3859).LOG_CONFIG_STORAGE_KEY;chrome.storage.local.get([t],function(e){var n=null==e?void 0:e[t];n&&"object"===Vk(n)&&Sk.Ow.setConfig(n)}),chrome.storage.onChanged.addListener(function(e,n){if("local"===n&&e[t]){var r=e[t].newValue||{};Sk.Ow.setConfig(r)}})}catch(t){}this.sendReadySignal()}},{key:"sendReadySignal",value:function(){chrome.runtime.sendMessage({action:tg,source:Kf,target:qf})}},{key:"handleMessage",value:function(t,e,n){var r=this,i=t.action,o=t.source,s=t.target,a=t.data,c=t.sessionId,l=t.providerId;if(c&&l&&"unknown"!==c&&"unknown"!==l&&Yk.setContext({sessionId:c,providerId:l,type:_k.LOG_TYPES.OFFSCREEN}),s===Kf){switch(i){case ng:this.sendReadySignal(),n({success:!0});break;case Zf:Gk(Qk().m(function t(){var e,n,i,o;return Qk().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,Yk.info({message:"[OFFSCREEN] Generating proof",logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_STARTED}),t.n=1,r.generateProof(a,Yk);case 1:if(n=t.v,!(i=(null==n||null===(e=n.error)||void 0===e?void 0:e.message)||("string"==typeof(null==n?void 0:n.error)?n.error:null))){t.n=2;break}return Yk.error({message:"[OFFSCREEN] Proof contains embedded error:",logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_FAILED}),chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!1,error:i}),t.a(2);case 2:chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!0,proof:n}),t.n=4;break;case 3:t.p=3,o=t.v,Yk.error({message:"[OFFSCREEN] Error generating proof: "+o.message,logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_FAILED}),chrome.runtime.sendMessage({action:eg,source:Kf,target:qf,success:!1,error:o.message||"Unknown error in proof generation"});case 4:return t.a(2)}},t,null,[[0,3]])}))(),n({received:!0});break;case Xf:try{var u=window.crypto.getRandomValues(new Uint8Array(32)),h="0x"+Array.from(u).map(function(t){return t.toString(16).padStart(2,"0")}).join("");chrome.runtime.sendMessage({action:$f,source:Kf,target:o,success:!0,privateKey:h}),Yk.info({message:"[OFFSCREEN] Private key generated",logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.OFFSCREEN}),n({success:!0,received:!0})}catch(t){chrome.runtime.sendMessage({action:$f,source:Kf,target:o,success:!1,error:t.message||"Unknown error generating private key"}),Yk.error({message:"[OFFSCREEN] Error generating private key: "+t.message,logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.OFFSCREEN}),n({success:!1,error:t.message})}break;default:Yk.error({message:"[OFFSCREEN] Unknown action: "+i,logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.OFFSCREEN}),n({success:!1,error:"Unknown action"})}return!0}}},{key:"generateProof",value:(t=Gk(Qk().m(function t(e,n){var r,i,o,s,a;return Qk().w(function(t){for(;;)switch(t.p=t.n){case 0:if(e){t.n=1;break}throw new Error("No claim data provided for proof generation");case 1:return r=e.sessionId,delete e.sessionId,t.p=2,n.info({message:"[OFFSCREEN] Updating session status to PROOF_GENERATION_STARTED",logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_STARTED}),t.n=3,Ok(r,zf);case 3:return i=new Promise(function(t,e){setTimeout(function(){e(new Error("Proof generation timed out after 2 minutes"))},12e4)}),t.n=4,vk(e);case 4:return o=t.v,n.info({message:"[OFFSCREEN] Attestor promise created",logLevel:_k.LOG_LEVEL.INFO,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_SUCCESS}),t.n=5,Promise.race([o,i]);case 5:return(s=t.v).publicData="string"==typeof e.publicData?e.publicData:null,n.info({message:"[OFFSCREEN] Attestor promise result: "+JSON.stringify(s),logLevel:_k.LOG_LEVEL.ALL,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.RESULT_RECEIVED,meta:{result:s}}),t.n=6,Ok(r,Jf);case 6:return t.a(2,s);case 7:return t.p=7,a=t.v,n.error({message:"[OFFSCREEN] Error generating proof: "+(null==a?void 0:a.message)||0,logLevel:_k.LOG_LEVEL.ERROR,type:_k.LOG_TYPES.OFFSCREEN,eventType:_k.EVENT_TYPES.PROOF_GENERATION_FAILED}),t.n=8,Ok(r,Wf);case 8:throw a;case 9:return t.a(2)}},t,null,[[2,7]])})),function(e,n){return t.apply(this,arguments)})}]);var t}();new Wk})()})();
|
|
114
114
|
//# sourceMappingURL=offscreen.bundle.js.map
|