@learncard/core 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +1711 -138
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +177 -177
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.esm.js +1711 -138
- package/dist/core.esm.js.map +3 -3
- package/package.json +2 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
var pA=Object.create;var Ia=Object.defineProperty,mA=Object.defineProperties,bA=Object.getOwnPropertyDescriptor,gA=Object.getOwnPropertyDescriptors,yA=Object.getOwnPropertyNames,xl=Object.getOwnPropertySymbols,fg=Object.getPrototypeOf,f0=Object.prototype.hasOwnProperty,ug=Object.prototype.propertyIsEnumerable,vA=Reflect.get;var u0=Math.pow,cg=(r,e,t)=>e in r?Ia(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ne=(r,e)=>{for(var t in e||(e={}))f0.call(e,t)&&cg(r,t,e[t]);if(xl)for(var t of xl(e))ug.call(e,t)&&cg(r,t,e[t]);return r},be=(r,e)=>mA(r,gA(e)),o=(r,e)=>Ia(r,"name",{value:e,configurable:!0});var kt=(r,e)=>{var t={};for(var n in r)f0.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&xl)for(var n of xl(r))e.indexOf(n)<0&&ug.call(r,n)&&(t[n]=r[n]);return t};var Tt=(r,e)=>()=>(r&&(e=r(r=0)),e);var de=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Mt=(r,e)=>{for(var t in e)Ia(r,t,{get:e[t],enumerable:!0})},lg=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yA(e))!f0.call(r,i)&&i!==t&&Ia(r,i,{get:()=>e[i],enumerable:!(n=bA(e,i))||n.enumerable});return r};var ze=(r,e,t)=>(t=r!=null?pA(fg(r)):{},lg(e||!r||!r.__esModule?Ia(t,"default",{value:r,enumerable:!0}):t,r)),hg=r=>lg(Ia({},"__esModule",{value:!0}),r);var l0=(r,e,t)=>vA(fg(r),t,e);var M=(r,e,t)=>new Promise((n,i)=>{var s=f=>{try{c(t.next(f))}catch(l){i(l)}},a=f=>{try{c(t.throw(f))}catch(l){i(l)}},c=f=>f.done?n(f.value):Promise.resolve(f.value).then(s,a);c((t=t.apply(r,e)).next())});var Ms=de(Io=>{"use strict";Object.defineProperty(Io,"__esModule",{value:!0});var BA="[object ArrayBuffer]",Xr=class{static isArrayBuffer(e){return Object.prototype.toString.call(e)===BA}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e).slice().buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=Xr.toUint8Array(e),i=Xr.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let s=0;s<n.length;s++)if(n[s]!==i[s])return!1;return!0}static concat(...e){if(Array.isArray(e[0])){let t=e[0],n=0;for(let a of t)n+=a.byteLength;let i=new Uint8Array(n),s=0;for(let a of t){let c=this.toUint8Array(a);i.set(c,s),s+=c.length}return e[1]?this.toView(i,e[1]):i.buffer}else return this.concat(e)}};o(Xr,"BufferSourceConverter");var ff=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){let t=Xr.toUint8Array(e),n="";for(let s=0;s<t.length;s++)n+=String.fromCharCode(t[s]);return decodeURIComponent(escape(n))}};o(ff,"Utf8Converter");var Yr=class{static toString(e,t=!1){let n=Xr.toArrayBuffer(e),i=new DataView(n),s="";for(let a=0;a<n.byteLength;a+=2){let c=i.getUint16(a,t);s+=String.fromCharCode(c)}return s}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let s=0;s<e.length;s++)i.setUint16(s*2,e.charCodeAt(s),t);return n}};o(Yr,"Utf16Converter");var Ln=class{static isHex(e){return typeof e=="string"&&/^[a-z0-9]+$/i.test(e)}static isBase64(e){return typeof e=="string"&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}static isBase64Url(e){return typeof e=="string"&&/^[a-zA-Z0-9-_]+$/i.test(e)}static ToString(e,t="utf8"){let n=Xr.toUint8Array(e);switch(t.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 Yr.toString(n,!0);case"utf16":case"utf16be":return Yr.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return Yr.fromString(e,!0);case"utf16":case"utf16be":return Yr.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=Xr.toUint8Array(e);if(typeof btoa!="undefined"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob!="undefined"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=Ln.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return ff.fromString(e);case"utf16":case"utf16be":return Yr.fromString(e);case"utf16le":case"usc2":return Yr.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=Ln.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return ff.toString(e);case"utf16":case"utf16be":return Yr.toString(e);case"utf16le":case"usc2":return Yr.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let t=Xr.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){let t=Xr.toUint8Array(e),n="",i=[],s=t.length;for(let a=0;a<s;a++){let c=t[a].toString(16).padStart(2,"0");i.push(c)}return i.join(n)}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!Ln.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){let s=t.slice(i,i+2);n[i/2]=parseInt(s,16)}return n.buffer}static ToUtf16String(e,t=!1){return Yr.toString(e,t)}static FromUtf16String(e,t=!1){return Yr.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}};o(Ln,"Convert");Ln.DEFAULT_UTF8_ENCODING="utf8";function NA(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let s in i)t[s]=i[s]}return t}o(NA,"assign");function IA(...r){let e=r.map(i=>i.byteLength).reduce((i,s)=>i+s),t=new Uint8Array(e),n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(let s of i)t[n++]=s}),t.buffer}o(IA,"combine");function OA(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}o(OA,"isEqual");Io.BufferSourceConverter=Xr;Io.Convert=Ln;Io.assign=NA;Io.combine=IA;Io.isEqual=OA});var Oy=de((vR,Ol)=>{var hy,dy,py,my,by,gy,yy,vy,wy,Nl,v0,xy,_y,Ay,Ja,Ey,Sy,Cy,ky,Ty,My,By,Ny,Iy,Il;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(t(e,t(n)))}):typeof Ol=="object"&&typeof Ol.exports=="object"?r(t(e,t(Ol.exports))):r(t(e));function t(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,a){return n[s]=i?i(s,a):a}}o(t,"createExporter")})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};hy=o(function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function s(){this.constructor=n}o(s,"__"),n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},"__extends"),dy=Object.assign||function(n){for(var i,s=1,a=arguments.length;s<a;s++){i=arguments[s];for(var c in i)Object.prototype.hasOwnProperty.call(i,c)&&(n[c]=i[c])}return n},py=o(function(n,i){var s={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.indexOf(a)<0&&(s[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,a=Object.getOwnPropertySymbols(n);c<a.length;c++)i.indexOf(a[c])<0&&Object.prototype.propertyIsEnumerable.call(n,a[c])&&(s[a[c]]=n[a[c]]);return s},"__rest"),my=o(function(n,i,s,a){var c=arguments.length,f=c<3?i:a===null?a=Object.getOwnPropertyDescriptor(i,s):a,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(n,i,s,a);else for(var h=n.length-1;h>=0;h--)(l=n[h])&&(f=(c<3?l(f):c>3?l(i,s,f):l(i,s))||f);return c>3&&f&&Object.defineProperty(i,s,f),f},"__decorate"),by=o(function(n,i){return function(s,a){i(s,a,n)}},"__param"),gy=o(function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},"__metadata"),yy=o(function(n,i,s,a){function c(f){return f instanceof s?f:new s(function(l){l(f)})}return o(c,"adopt"),new(s||(s=Promise))(function(f,l){function h(x){try{v(a.next(x))}catch(y){l(y)}}o(h,"fulfilled");function d(x){try{v(a.throw(x))}catch(y){l(y)}}o(d,"rejected");function v(x){x.done?f(x.value):c(x.value).then(h,d)}o(v,"step"),v((a=a.apply(n,i||[])).next())})},"__awaiter"),vy=o(function(n,i){var s={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},a,c,f,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(v){return function(x){return d([v,x])}}function d(v){if(a)throw new TypeError("Generator is already executing.");for(;s;)try{if(a=1,c&&(f=v[0]&2?c.return:v[0]?c.throw||((f=c.return)&&f.call(c),0):c.next)&&!(f=f.call(c,v[1])).done)return f;switch(c=0,f&&(v=[v[0]&2,f.value]),v[0]){case 0:case 1:f=v;break;case 4:return s.label++,{value:v[1],done:!1};case 5:s.label++,c=v[1],v=[0];continue;case 7:v=s.ops.pop(),s.trys.pop();continue;default:if(f=s.trys,!(f=f.length>0&&f[f.length-1])&&(v[0]===6||v[0]===2)){s=0;continue}if(v[0]===3&&(!f||v[1]>f[0]&&v[1]<f[3])){s.label=v[1];break}if(v[0]===6&&s.label<f[1]){s.label=f[1],f=v;break}if(f&&s.label<f[2]){s.label=f[2],s.ops.push(v);break}f[2]&&s.ops.pop(),s.trys.pop();continue}v=i.call(n,s)}catch(x){v=[6,x],c=0}finally{a=f=0}if(v[0]&5)throw v[1];return{value:v[0]?v[1]:void 0,done:!0}}},"__generator"),wy=o(function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&Il(i,n,s)},"__exportStar"),Il=Object.create?function(n,i,s,a){a===void 0&&(a=s);var c=Object.getOwnPropertyDescriptor(i,s);(!c||("get"in c?!i.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,c)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]},Nl=o(function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],a=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&a>=n.length&&(n=void 0),{value:n&&n[a++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},"__values"),v0=o(function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var a=s.call(n),c,f=[],l;try{for(;(i===void 0||i-- >0)&&!(c=a.next()).done;)f.push(c.value)}catch(h){l={error:h}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(l)throw l.error}}return f},"__read"),xy=o(function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(v0(arguments[i]));return n},"__spread"),_y=o(function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var a=Array(n),c=0,i=0;i<s;i++)for(var f=arguments[i],l=0,h=f.length;l<h;l++,c++)a[c]=f[l];return a},"__spreadArrays"),Ay=o(function(n,i,s){if(s||arguments.length===2)for(var a=0,c=i.length,f;a<c;a++)(f||!(a in i))&&(f||(f=Array.prototype.slice.call(i,0,a)),f[a]=i[a]);return n.concat(f||Array.prototype.slice.call(i))},"__spreadArray"),Ja=o(function(n){return this instanceof Ja?(this.v=n,this):new Ja(n)},"__await"),Ey=o(function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=s.apply(n,i||[]),c,f=[];return c={},l("next"),l("throw"),l("return"),c[Symbol.asyncIterator]=function(){return this},c;function l(_){a[_]&&(c[_]=function(U){return new Promise(function(E,L){f.push([_,U,E,L])>1||h(_,U)})})}function h(_,U){try{d(a[_](U))}catch(E){y(f[0][3],E)}}function d(_){_.value instanceof Ja?Promise.resolve(_.value.v).then(v,x):y(f[0][2],_)}function v(_){h("next",_)}function x(_){h("throw",_)}function y(_,U){_(U),f.shift(),f.length&&h(f[0][0],f[0][1])}},"__asyncGenerator"),Sy=o(function(n){var i,s;return i={},a("next"),a("throw",function(c){throw c}),a("return"),i[Symbol.iterator]=function(){return this},i;function a(c,f){i[c]=n[c]?function(l){return(s=!s)?{value:Ja(n[c](l)),done:c==="return"}:f?f(l):l}:f}},"__asyncDelegator"),Cy=o(function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof Nl=="function"?Nl(n):n[Symbol.iterator](),s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s);function a(f){s[f]=n[f]&&function(l){return new Promise(function(h,d){l=n[f](l),c(h,d,l.done,l.value)})}}function c(f,l,h,d){Promise.resolve(d).then(function(v){f({value:v,done:h})},l)}},"__asyncValues"),ky=o(function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n},"__makeTemplateObject");var t=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};Ty=o(function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&Il(i,n,s);return t(i,n),i},"__importStar"),My=o(function(n){return n&&n.__esModule?n:{default:n}},"__importDefault"),By=o(function(n,i,s,a){if(s==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!a:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?a:s==="a"?a.call(n):a?a.value:i.get(n)},"__classPrivateFieldGet"),Ny=o(function(n,i,s,a,c){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!c)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!c:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?c.call(n,s):c?c.value=s:i.set(n,s),s},"__classPrivateFieldSet"),Iy=o(function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},"__classPrivateFieldIn"),r("__extends",hy),r("__assign",dy),r("__rest",py),r("__decorate",my),r("__param",by),r("__metadata",gy),r("__awaiter",yy),r("__generator",vy),r("__exportStar",wy),r("__createBinding",Il),r("__values",Nl),r("__read",v0),r("__spread",xy),r("__spreadArrays",_y),r("__spreadArray",Ay),r("__await",Ja),r("__asyncGenerator",Ey),r("__asyncDelegator",Sy),r("__asyncValues",Cy),r("__makeTemplateObject",ky),r("__importStar",Ty),r("__importDefault",My),r("__classPrivateFieldGet",By),r("__classPrivateFieldSet",Ny),r("__classPrivateFieldIn",Iy)})});function XE(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var s=r.charAt(i),a=s.charCodeAt(0);if(t[a]!==255)throw new TypeError(s+" is ambiguous");t[a]=i}var c=r.length,f=r.charAt(0),l=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var _=0,U=0,E=0,L=y.length;E!==L&&y[E]===0;)E++,_++;for(var H=(L-E)*h+1>>>0,F=new Uint8Array(H);E!==L;){for(var j=y[E],D=0,B=H-1;(j!==0||D<U)&&B!==-1;B--,D++)j+=256*F[B]>>>0,F[B]=j%c>>>0,j=j/c>>>0;if(j!==0)throw new Error("Non-zero carry");U=D,E++}for(var R=H-U;R!==H&&F[R]===0;)R++;for(var Y=f.repeat(_);R<H;++R)Y+=r.charAt(F[R]);return Y}o(d,"encode");function v(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var _=0;if(y[_]!==" "){for(var U=0,E=0;y[_]===f;)U++,_++;for(var L=(y.length-_)*l+1>>>0,H=new Uint8Array(L);y[_];){var F=t[y.charCodeAt(_)];if(F===255)return;for(var j=0,D=L-1;(F!==0||j<E)&&D!==-1;D--,j++)F+=c*H[D]>>>0,H[D]=F%256>>>0,F=F/256>>>0;if(F!==0)throw new Error("Non-zero carry");E=j,_++}if(y[_]!==" "){for(var B=L-E;B!==L&&H[B]===0;)B++;for(var R=new Uint8Array(U+(L-B)),Y=U;B!==L;)R[Y++]=H[B++];return R}}}o(v,"decodeUnsafe");function x(y){var _=v(y);if(_)return _;throw new Error(`Non-${e} character`)}return o(x,"decode"),{encode:d,decodeUnsafe:v,decode:x}}var ZE,QE,hv,dv=Tt(()=>{o(XE,"base");ZE=XE,QE=ZE,hv=QE});var cu={};Mt(cu,{coerce:()=>wn,empty:()=>pv,equals:()=>S0,fromHex:()=>tS,fromString:()=>C0,isBinary:()=>rS,toHex:()=>eS,toString:()=>k0});var pv,eS,tS,S0,wn,rS,C0,k0,Zs=Tt(()=>{pv=new Uint8Array(0),eS=o(r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),"toHex"),tS=o(r=>{let e=r.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):pv},"fromHex"),S0=o((r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},"equals"),wn=o(r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},"coerce"),rS=o(r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),"isBinary"),C0=o(r=>new TextEncoder().encode(r),"fromString"),k0=o(r=>new TextDecoder().decode(r),"toString")});var Ch,kh,Th,mv,Mh,Bh,Qs,nS,iS,Bt,pi=Tt(()=>{dv();Zs();Ch=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};o(Ch,"Encoder");kh=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){return mv(this,e)}};o(kh,"Decoder");Th=class{constructor(e){this.decoders=e}or(e){return mv(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};o(Th,"ComposedDecoder");mv=o((r,e)=>new Th(ne(ne({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e})),"or"),Mh=class{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ch(e,t,n),this.decoder=new kh(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};o(Mh,"Codec");Bh=o(({name:r,prefix:e,encode:t,decode:n})=>new Mh(r,e,t,n),"from"),Qs=o(({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:i}=hv(t,e);return Bh({prefix:r,name:e,encode:n,decode:s=>wn(i(s))})},"baseX"),nS=o((r,e,t,n)=>{let i={};for(let h=0;h<e.length;++h)i[e[h]]=h;let s=r.length;for(;r[s-1]==="=";)--s;let a=new Uint8Array(s*t/8|0),c=0,f=0,l=0;for(let h=0;h<s;++h){let d=i[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);f=f<<t|d,c+=t,c>=8&&(c-=8,a[l++]=255&f>>c)}if(c>=t||255&f<<8-c)throw new SyntaxError("Unexpected end of data");return a},"decode"),iS=o((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,s="",a=0,c=0;for(let f=0;f<r.length;++f)for(c=c<<8|r[f],a+=8;a>t;)a-=t,s+=e[i&c>>a];if(a&&(s+=e[i&c<<t-a]),n)for(;s.length*t&7;)s+="=";return s},"encode"),Bt=o(({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>Bh({prefix:e,name:r,encode(i){return iS(i,n,t)},decode(i){return nS(i,n,t,r)}}),"rfc4648")});var T0={};Mt(T0,{identity:()=>sS});var sS,bv=Tt(()=>{pi();Zs();sS=Bh({prefix:"\0",name:"identity",encode:r=>k0(r),decode:r=>C0(r)})});var M0={};Mt(M0,{base2:()=>oS});var oS,gv=Tt(()=>{pi();oS=Bt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var B0={};Mt(B0,{base8:()=>aS});var aS,yv=Tt(()=>{pi();aS=Bt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var N0={};Mt(N0,{base10:()=>cS});var cS,vv=Tt(()=>{pi();cS=Qs({prefix:"9",name:"base10",alphabet:"0123456789"})});var I0={};Mt(I0,{base16:()=>fS,base16upper:()=>uS});var fS,uS,wv=Tt(()=>{pi();fS=Bt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),uS=Bt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var O0={};Mt(O0,{base32:()=>ic,base32hex:()=>pS,base32hexpad:()=>bS,base32hexpadupper:()=>gS,base32hexupper:()=>mS,base32pad:()=>hS,base32padupper:()=>dS,base32upper:()=>lS,base32z:()=>yS});var ic,lS,hS,dS,pS,mS,bS,gS,yS,P0=Tt(()=>{pi();ic=Bt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lS=Bt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hS=Bt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dS=Bt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pS=Bt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),mS=Bt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),bS=Bt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gS=Bt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),yS=Bt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var R0={};Mt(R0,{base36:()=>jo,base36upper:()=>vS});var jo,vS,Nh=Tt(()=>{pi();jo=Qs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),vS=Qs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var U0={};Mt(U0,{base58btc:()=>mi,base58flickr:()=>wS});var mi,wS,L0=Tt(()=>{pi();mi=Qs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wS=Qs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var D0={};Mt(D0,{base64:()=>xS,base64pad:()=>_S,base64url:()=>xv,base64urlpad:()=>AS});var xS,_S,xv,AS,K0=Tt(()=>{pi();xS=Bt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),_S=Bt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xv=Bt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),AS=Bt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function Ev(r,e,t){e=e||[],t=t||0;for(var n=t;r>=kS;)e[t++]=r&255|_v,r/=128;for(;r&CS;)e[t++]=r&255|_v,r>>>=7;return e[t]=r|0,Ev.bytes=t-n+1,e}function $0(r,n){var t=0,n=n||0,i=0,s=n,a,c=r.length;do{if(s>=c)throw $0.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=i<28?(a&Av)<<i:(a&Av)*Math.pow(2,i),i+=7}while(a>=MS);return $0.bytes=s-n,t}var ES,_v,SS,CS,kS,TS,MS,Av,BS,NS,IS,OS,PS,RS,US,LS,DS,KS,$S,FS,fu,Sv=Tt(()=>{ES=Ev,_v=128,SS=127,CS=~SS,kS=Math.pow(2,31);o(Ev,"encode");TS=$0,MS=128,Av=127;o($0,"read");BS=Math.pow(2,7),NS=Math.pow(2,14),IS=Math.pow(2,21),OS=Math.pow(2,28),PS=Math.pow(2,35),RS=Math.pow(2,42),US=Math.pow(2,49),LS=Math.pow(2,56),DS=Math.pow(2,63),KS=o(function(r){return r<BS?1:r<NS?2:r<IS?3:r<OS?4:r<PS?5:r<RS?6:r<US?7:r<LS?8:r<DS?9:10},"length"),$S={encode:ES,decode:TS,encodingLength:KS},FS=$S,fu=FS});var oc={};Mt(oc,{decode:()=>sc,encodeTo:()=>Vo,encodingLength:()=>Go});var sc,Vo,Go,Ih=Tt(()=>{Sv();sc=o(r=>[fu.decode(r),fu.decode.bytes],"decode"),Vo=o((r,e,t=0)=>(fu.encode(r,e,t),e),"encodeTo"),Go=o(r=>fu.encodingLength(r),"encodingLength")});var Jo={};Mt(Jo,{Digest:()=>eo,create:()=>to,decode:()=>uu,equals:()=>F0});var to,uu,F0,eo,ac=Tt(()=>{Zs();Ih();to=o((r,e)=>{let t=e.byteLength,n=Go(r),i=n+Go(t),s=new Uint8Array(i+t);return Vo(r,s,0),Vo(t,s,n),s.set(e,i),new eo(r,t,e,s)},"create"),uu=o(r=>{let e=wn(r),[t,n]=sc(e),[i,s]=sc(e.subarray(n)),a=e.subarray(n+s);if(a.byteLength!==i)throw new Error("Incorrect length");return new eo(t,i,a,e)},"decode"),F0=o((r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&S0(r.bytes,e.bytes),"equals"),eo=class{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};o(eo,"Digest")});var Ph={};Mt(Ph,{Hasher:()=>lu,from:()=>Oh});var Oh,lu,H0=Tt(()=>{ac();Oh=o(({name:r,code:e,encode:t})=>new lu(r,e,t),"from"),lu=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?to(this.code,t):t.then(n=>to(this.code,n))}else throw Error("Unknown type, must be binary type")}};o(lu,"Hasher")});var q0={};Mt(q0,{sha256:()=>Wo,sha512:()=>HS});var Cv,Wo,HS,hu=Tt(()=>{H0();Cv=o(r=>e=>M(void 0,null,function*(){return new Uint8Array(yield crypto.subtle.digest(r,e))}),"sha"),Wo=Oh({name:"sha2-256",code:18,encode:Cv("SHA-256")}),HS=Oh({name:"sha2-512",code:19,encode:Cv("SHA-512")})});var z0={};Mt(z0,{identity:()=>Rh});var kv,qS,Tv,zS,Rh,j0=Tt(()=>{Zs();ac();kv=0,qS="identity",Tv=wn,zS=o(r=>to(kv,Tv(r)),"digest"),Rh={code:kv,name:qS,encode:Tv,digest:zS}});var V0={};Mt(V0,{code:()=>VS,decode:()=>JS,encode:()=>GS,name:()=>jS});var jS,VS,GS,JS,Mv=Tt(()=>{Zs();jS="raw",VS=85,GS=o(r=>wn(r),"encode"),JS=o(r=>wn(r),"decode")});var G0={};Mt(G0,{code:()=>ZS,decode:()=>e9,encode:()=>QS,name:()=>XS});var WS,YS,XS,ZS,QS,e9,Bv=Tt(()=>{WS=new TextEncoder,YS=new TextDecoder,XS="json",ZS=512,QS=o(r=>WS.encode(JSON.stringify(r)),"encode"),e9=o(r=>JSON.parse(YS.decode(r)),"decode")});var Ie,t9,r9,n9,du,i9,Nv,Iv,Uh,Lh,s9,o9,a9,Xi=Tt(()=>{Ih();ac();L0();P0();Zs();Ie=class{constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Lh,byteLength:Lh,code:Uh,version:Uh,multihash:Uh,bytes:Uh,_baseCache:Lh,asCID:Lh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==du)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==i9)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ie.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=to(e,t);return Ie.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&F0(this.multihash,e.multihash)}toString(e){let{bytes:t,version:n,_baseCache:i}=this;switch(n){case 0:return r9(t,i,e||mi.encoder);default:return n9(t,i,e||ic.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return o9(/^0\.0/,a9),!!(e&&(e[Iv]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof Ie)return e;if(e!=null&&e.asCID===e){let{version:t,code:n,multihash:i,bytes:s}=e;return new Ie(t,n,i,s||Nv(t,n,i.bytes))}else if(e!=null&&e[Iv]===!0){let{version:t,multihash:n,code:i}=e,s=uu(n);return Ie.create(t,i,s)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==du)throw new Error(`Version 0 CID must use dag-pb (code: ${du}) block encoding`);return new Ie(e,t,n,n.bytes)}case 1:{let i=Nv(e,t,n.bytes);return new Ie(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ie.create(0,du,e)}static createV1(e,t){return Ie.create(1,e,t)}static decode(e){let[t,n]=Ie.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Ie.inspectBytes(e),n=t.size-t.multihashSize,i=wn(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let s=i.subarray(t.multihashSize-t.digestSize),a=new eo(t.multihashCode,t.digestSize,s,i);return[t.version===0?Ie.createV0(a):Ie.createV1(t.codec,a),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=o(()=>{let[d,v]=sc(e.subarray(t));return t+=v,d},"next"),i=n(),s=du;if(i===18?(i=0,t=0):i===1&&(s=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=t,c=n(),f=n(),l=t+f,h=l-a;return{version:i,codec:s,multihashCode:c,digestSize:f,multihashSize:h,size:l}}static parse(e,t){let[n,i]=t9(e,t),s=Ie.decode(i);return s._baseCache.set(n,e),s}};o(Ie,"CID");t9=o((r,e)=>{switch(r[0]){case"Q":{let t=e||mi;return[mi.prefix,t.decode(`${mi.prefix}${r}`)]}case mi.prefix:{let t=e||mi;return[mi.prefix,t.decode(r)]}case ic.prefix:{let t=e||ic;return[ic.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},"parseCIDtoBytes"),r9=o((r,e,t)=>{let{prefix:n}=t;if(n!==mi.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let s=t.encode(r).slice(1);return e.set(n,s),s}else return i},"toStringV0"),n9=o((r,e,t)=>{let{prefix:n}=t,i=e.get(n);if(i==null){let s=t.encode(r);return e.set(n,s),s}else return i},"toStringV1"),du=112,i9=18,Nv=o((r,e,t)=>{let n=Go(r),i=n+Go(e),s=new Uint8Array(i+t.byteLength);return Vo(r,s,0),Vo(e,s,n),s.set(t,i),s},"encodeCID"),Iv=Symbol.for("@ipld/js-cid/CID"),Uh={writable:!1,configurable:!1,enumerable:!0},Lh={writable:!1,enumerable:!1,configurable:!1},s9="0.0.0-dev",o9=o((r,e)=>{if(r.test(s9))console.warn(e);else throw new Error(e)},"deprecate"),a9=`CID.isCID(v) is deprecated and will be removed in the next major release.
|
1
|
+
var tE=Object.create;var Ha=Object.defineProperty,rE=Object.defineProperties,nE=Object.getOwnPropertyDescriptor,iE=Object.getOwnPropertyDescriptors,oE=Object.getOwnPropertyNames,Ul=Object.getOwnPropertySymbols,Ug=Object.getPrototypeOf,E0=Object.prototype.hasOwnProperty,Lg=Object.prototype.propertyIsEnumerable,sE=Reflect.get;var S0=Math.pow,Rg=(r,e,t)=>e in r?Ha(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ne=(r,e)=>{for(var t in e||(e={}))E0.call(e,t)&&Rg(r,t,e[t]);if(Ul)for(var t of Ul(e))Lg.call(e,t)&&Rg(r,t,e[t]);return r},be=(r,e)=>rE(r,iE(e)),s=(r,e)=>Ha(r,"name",{value:e,configurable:!0});var Mt=(r,e)=>{var t={};for(var n in r)E0.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&Ul)for(var n of Ul(r))e.indexOf(n)<0&&Lg.call(r,n)&&(t[n]=r[n]);return t};var Bt=(r,e)=>()=>(r&&(e=r(r=0)),e);var de=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),It=(r,e)=>{for(var t in e)Ha(r,t,{get:e[t],enumerable:!0})},Dg=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oE(e))!E0.call(r,i)&&i!==t&&Ha(r,i,{get:()=>e[i],enumerable:!(n=nE(e,i))||n.enumerable});return r};var ze=(r,e,t)=>(t=r!=null?tE(Ug(r)):{},Dg(e||!r||!r.__esModule?Ha(t,"default",{value:r,enumerable:!0}):t,r)),Fg=r=>Dg(Ha({},"__esModule",{value:!0}),r);var C0=(r,e,t)=>sE(Ug(r),t,e);var M=(r,e,t)=>new Promise((n,i)=>{var o=c=>{try{f(t.next(c))}catch(l){i(l)}},a=c=>{try{f(t.throw(c))}catch(l){i(l)}},f=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);f((t=t.apply(r,e)).next())});var Ro=de(Fs=>{"use strict";Object.defineProperty(Fs,"__esModule",{value:!0});var gE="[object ArrayBuffer]",tn=class{static isArrayBuffer(e){return Object.prototype.toString.call(e)===gE}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e).slice().buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){let n=tn.toUint8Array(e),i=tn.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let o=0;o<n.length;o++)if(n[o]!==i[o])return!1;return!0}static concat(...e){if(Array.isArray(e[0])){let t=e[0],n=0;for(let a of t)n+=a.byteLength;let i=new Uint8Array(n),o=0;for(let a of t){let f=this.toUint8Array(a);i.set(f,o),o+=f.length}return e[1]?this.toView(i,e[1]):i.buffer}else return this.concat(e)}};s(tn,"BufferSourceConverter");var wc=class{static fromString(e){let t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n.buffer}static toString(e){let t=tn.toUint8Array(e),n="";for(let o=0;o<t.length;o++)n+=String.fromCharCode(t[o]);return decodeURIComponent(escape(n))}};s(wc,"Utf8Converter");var en=class{static toString(e,t=!1){let n=tn.toArrayBuffer(e),i=new DataView(n),o="";for(let a=0;a<n.byteLength;a+=2){let f=i.getUint16(a,t);o+=String.fromCharCode(f)}return o}static fromString(e,t=!1){let n=new ArrayBuffer(e.length*2),i=new DataView(n);for(let o=0;o<e.length;o++)i.setUint16(o*2,e.charCodeAt(o),t);return n}};s(en,"Utf16Converter");var $n=class{static isHex(e){return typeof e=="string"&&/^[a-z0-9]+$/i.test(e)}static isBase64(e){return typeof e=="string"&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}static isBase64Url(e){return typeof e=="string"&&/^[a-zA-Z0-9-_]+$/i.test(e)}static ToString(e,t="utf8"){let n=tn.toUint8Array(e);switch(t.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 en.toString(n,!0);case"utf16":case"utf16be":return en.toString(n);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromString(e,t="utf8"){if(!e)return new ArrayBuffer(0);switch(t.toLowerCase()){case"utf8":return this.FromUtf8String(e);case"binary":return this.FromBinary(e);case"hex":return this.FromHex(e);case"base64":return this.FromBase64(e);case"base64url":return this.FromBase64Url(e);case"utf16le":return en.fromString(e,!0);case"utf16":case"utf16be":return en.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){let t=tn.toUint8Array(e);if(typeof btoa!="undefined"){let n=this.ToString(t,"binary");return btoa(n)}else return Buffer.from(t).toString("base64")}static FromBase64(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!$n.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob!="undefined"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!$n.isBase64Url(t))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(t.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,t=$n.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return wc.fromString(e);case"utf16":case"utf16be":return en.fromString(e);case"utf16le":case"usc2":return en.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=$n.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return wc.toString(e);case"utf16":case"utf16be":return en.toString(e);case"utf16le":case"usc2":return en.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){let t=e.length,n=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);return n.buffer}static ToBinary(e){let t=tn.toUint8Array(e),n="";for(let i=0;i<t.length;i++)n+=String.fromCharCode(t[i]);return n}static ToHex(e){let t=tn.toUint8Array(e),n="",i=[],o=t.length;for(let a=0;a<o;a++){let f=t[a].toString(16).padStart(2,"0");i.push(f)}return i.join(n)}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!$n.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i=i+2){let o=t.slice(i,i+2);n[i/2]=parseInt(o,16)}return n.buffer}static ToUtf16String(e,t=!1){return en.toString(e,t)}static FromUtf16String(e,t=!1){return en.fromString(e,t)}static Base64Padding(e){let t=4-e.length%4;if(t<4)for(let n=0;n<t;n++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}};s($n,"Convert");$n.DEFAULT_UTF8_ENCODING="utf8";function yE(r,...e){let t=arguments[0];for(let n=1;n<arguments.length;n++){let i=arguments[n];for(let o in i)t[o]=i[o]}return t}s(yE,"assign");function vE(...r){let e=r.map(i=>i.byteLength).reduce((i,o)=>i+o),t=new Uint8Array(e),n=0;return r.map(i=>new Uint8Array(i)).forEach(i=>{for(let o of i)t[n++]=o}),t.buffer}s(vE,"combine");function wE(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}s(wE,"isEqual");Fs.BufferSourceConverter=tn;Fs.Convert=$n;Fs.assign=yE;Fs.combine=vE;Fs.isEqual=wE});var sv=de((tL,Gl)=>{var Fy,Ky,$y,Hy,qy,zy,jy,Vy,Wy,Vl,P0,Gy,Jy,Yy,of,Xy,Zy,Qy,ev,tv,rv,nv,iv,ov,Wl;(function(r){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(t(e,t(n)))}):typeof Gl=="object"&&typeof Gl.exports=="object"?r(t(e,t(Gl.exports))):r(t(e));function t(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(o,a){return n[o]=i?i(o,a):a}}s(t,"createExporter")})(function(r){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])};Fy=s(function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function o(){this.constructor=n}s(o,"__"),n.prototype=i===null?Object.create(i):(o.prototype=i.prototype,new o)},"__extends"),Ky=Object.assign||function(n){for(var i,o=1,a=arguments.length;o<a;o++){i=arguments[o];for(var f in i)Object.prototype.hasOwnProperty.call(i,f)&&(n[f]=i[f])}return n},$y=s(function(n,i){var o={};for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.indexOf(a)<0&&(o[a]=n[a]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var f=0,a=Object.getOwnPropertySymbols(n);f<a.length;f++)i.indexOf(a[f])<0&&Object.prototype.propertyIsEnumerable.call(n,a[f])&&(o[a[f]]=n[a[f]]);return o},"__rest"),Hy=s(function(n,i,o,a){var f=arguments.length,c=f<3?i:a===null?a=Object.getOwnPropertyDescriptor(i,o):a,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,i,o,a);else for(var h=n.length-1;h>=0;h--)(l=n[h])&&(c=(f<3?l(c):f>3?l(i,o,c):l(i,o))||c);return f>3&&c&&Object.defineProperty(i,o,c),c},"__decorate"),qy=s(function(n,i){return function(o,a){i(o,a,n)}},"__param"),zy=s(function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},"__metadata"),jy=s(function(n,i,o,a){function f(c){return c instanceof o?c:new o(function(l){l(c)})}return s(f,"adopt"),new(o||(o=Promise))(function(c,l){function h(A){try{y(a.next(A))}catch(v){l(v)}}s(h,"fulfilled");function d(A){try{y(a.throw(A))}catch(v){l(v)}}s(d,"rejected");function y(A){A.done?c(A.value):f(A.value).then(h,d)}s(y,"step"),y((a=a.apply(n,i||[])).next())})},"__awaiter"),Vy=s(function(n,i){var o={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,f,c,l;return l={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function h(y){return function(A){return d([y,A])}}function d(y){if(a)throw new TypeError("Generator is already executing.");for(;o;)try{if(a=1,f&&(c=y[0]&2?f.return:y[0]?f.throw||((c=f.return)&&c.call(f),0):f.next)&&!(c=c.call(f,y[1])).done)return c;switch(f=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return o.label++,{value:y[1],done:!1};case 5:o.label++,f=y[1],y=[0];continue;case 7:y=o.ops.pop(),o.trys.pop();continue;default:if(c=o.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){o=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){o.label=y[1];break}if(y[0]===6&&o.label<c[1]){o.label=c[1],c=y;break}if(c&&o.label<c[2]){o.label=c[2],o.ops.push(y);break}c[2]&&o.ops.pop(),o.trys.pop();continue}y=i.call(n,o)}catch(A){y=[6,A],f=0}finally{a=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},"__generator"),Wy=s(function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&Wl(i,n,o)},"__exportStar"),Wl=Object.create?function(n,i,o,a){a===void 0&&(a=o);var f=Object.getOwnPropertyDescriptor(i,o);(!f||("get"in f?!i.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,f)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]},Vl=s(function(n){var i=typeof Symbol=="function"&&Symbol.iterator,o=i&&n[i],a=0;if(o)return o.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&a>=n.length&&(n=void 0),{value:n&&n[a++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},"__values"),P0=s(function(n,i){var o=typeof Symbol=="function"&&n[Symbol.iterator];if(!o)return n;var a=o.call(n),f,c=[],l;try{for(;(i===void 0||i-- >0)&&!(f=a.next()).done;)c.push(f.value)}catch(h){l={error:h}}finally{try{f&&!f.done&&(o=a.return)&&o.call(a)}finally{if(l)throw l.error}}return c},"__read"),Gy=s(function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(P0(arguments[i]));return n},"__spread"),Jy=s(function(){for(var n=0,i=0,o=arguments.length;i<o;i++)n+=arguments[i].length;for(var a=Array(n),f=0,i=0;i<o;i++)for(var c=arguments[i],l=0,h=c.length;l<h;l++,f++)a[f]=c[l];return a},"__spreadArrays"),Yy=s(function(n,i,o){if(o||arguments.length===2)for(var a=0,f=i.length,c;a<f;a++)(c||!(a in i))&&(c||(c=Array.prototype.slice.call(i,0,a)),c[a]=i[a]);return n.concat(c||Array.prototype.slice.call(i))},"__spreadArray"),of=s(function(n){return this instanceof of?(this.v=n,this):new of(n)},"__await"),Xy=s(function(n,i,o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=o.apply(n,i||[]),f,c=[];return f={},l("next"),l("throw"),l("return"),f[Symbol.asyncIterator]=function(){return this},f;function l(x){a[x]&&(f[x]=function(L){return new Promise(function(_,R){c.push([x,L,_,R])>1||h(x,L)})})}function h(x,L){try{d(a[x](L))}catch(_){v(c[0][3],_)}}function d(x){x.value instanceof of?Promise.resolve(x.value.v).then(y,A):v(c[0][2],x)}function y(x){h("next",x)}function A(x){h("throw",x)}function v(x,L){x(L),c.shift(),c.length&&h(c[0][0],c[0][1])}},"__asyncGenerator"),Zy=s(function(n){var i,o;return i={},a("next"),a("throw",function(f){throw f}),a("return"),i[Symbol.iterator]=function(){return this},i;function a(f,c){i[f]=n[f]?function(l){return(o=!o)?{value:of(n[f](l)),done:f==="return"}:c?c(l):l}:c}},"__asyncDelegator"),Qy=s(function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],o;return i?i.call(n):(n=typeof Vl=="function"?Vl(n):n[Symbol.iterator](),o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o);function a(c){o[c]=n[c]&&function(l){return new Promise(function(h,d){l=n[c](l),f(h,d,l.done,l.value)})}}function f(c,l,h,d){Promise.resolve(d).then(function(y){c({value:y,done:h})},l)}},"__asyncValues"),ev=s(function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n},"__makeTemplateObject");var t=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};tv=s(function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var o in n)o!=="default"&&Object.prototype.hasOwnProperty.call(n,o)&&Wl(i,n,o);return t(i,n),i},"__importStar"),rv=s(function(n){return n&&n.__esModule?n:{default:n}},"__importDefault"),nv=s(function(n,i,o,a){if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!a:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return o==="m"?a:o==="a"?a.call(n):a?a.value:i.get(n)},"__classPrivateFieldGet"),iv=s(function(n,i,o,a,f){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!f)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!f:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?f.call(n,o):f?f.value=o:i.set(n,o),o},"__classPrivateFieldSet"),ov=s(function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},"__classPrivateFieldIn"),r("__extends",Fy),r("__assign",Ky),r("__rest",$y),r("__decorate",Hy),r("__param",qy),r("__metadata",zy),r("__awaiter",jy),r("__generator",Vy),r("__exportStar",Wy),r("__createBinding",Wl),r("__values",Vl),r("__read",P0),r("__spread",Gy),r("__spreadArrays",Jy),r("__spreadArray",Yy),r("__await",of),r("__asyncGenerator",Xy),r("__asyncDelegator",Zy),r("__asyncValues",Qy),r("__makeTemplateObject",ev),r("__importStar",tv),r("__importDefault",rv),r("__classPrivateFieldGet",nv),r("__classPrivateFieldSet",iv),r("__classPrivateFieldIn",ov)})});function DS(r,e){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var i=0;i<r.length;i++){var o=r.charAt(i),a=o.charCodeAt(0);if(t[a]!==255)throw new TypeError(o+" is ambiguous");t[a]=i}var f=r.length,c=r.charAt(0),l=Math.log(f)/Math.log(256),h=Math.log(256)/Math.log(f);function d(v){if(v instanceof Uint8Array||(ArrayBuffer.isView(v)?v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength):Array.isArray(v)&&(v=Uint8Array.from(v))),!(v instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(v.length===0)return"";for(var x=0,L=0,_=0,R=v.length;_!==R&&v[_]===0;)_++,x++;for(var H=(R-_)*h+1>>>0,$=new Uint8Array(H);_!==R;){for(var j=v[_],D=0,B=H-1;(j!==0||D<L)&&B!==-1;B--,D++)j+=256*$[B]>>>0,$[B]=j%f>>>0,j=j/f>>>0;if(j!==0)throw new Error("Non-zero carry");L=D,_++}for(var U=H-L;U!==H&&$[U]===0;)U++;for(var Y=c.repeat(x);U<H;++U)Y+=r.charAt($[U]);return Y}s(d,"encode");function y(v){if(typeof v!="string")throw new TypeError("Expected String");if(v.length===0)return new Uint8Array;var x=0;if(v[x]!==" "){for(var L=0,_=0;v[x]===c;)L++,x++;for(var R=(v.length-x)*l+1>>>0,H=new Uint8Array(R);v[x];){var $=t[v.charCodeAt(x)];if($===255)return;for(var j=0,D=R-1;($!==0||j<_)&&D!==-1;D--,j++)$+=f*H[D]>>>0,H[D]=$%256>>>0,$=$/256>>>0;if($!==0)throw new Error("Non-zero carry");_=j,x++}if(v[x]!==" "){for(var B=R-_;B!==R&&H[B]===0;)B++;for(var U=new Uint8Array(L+(R-B)),Y=L;B!==R;)U[Y++]=H[B++];return U}}}s(y,"decodeUnsafe");function A(v){var x=y(v);if(x)return x;throw new Error(`Non-${e} character`)}return s(A,"decode"),{encode:d,decodeUnsafe:y,decode:A}}var FS,KS,Fv,Kv=Bt(()=>{s(DS,"base");FS=DS,KS=FS,Fv=KS});var vu={};It(vu,{coerce:()=>En,empty:()=>$v,equals:()=>K0,fromHex:()=>HS,fromString:()=>$0,isBinary:()=>qS,toHex:()=>$S,toString:()=>H0});var $v,$S,HS,K0,En,qS,$0,H0,is=Bt(()=>{$v=new Uint8Array(0),$S=s(r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),"toHex"),HS=s(r=>{let e=r.match(/../g);return e?new Uint8Array(e.map(t=>parseInt(t,16))):$v},"fromHex"),K0=s((r,e)=>{if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0},"equals"),En=s(r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},"coerce"),qS=s(r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r),"isBinary"),$0=s(r=>new TextEncoder().encode(r),"fromString"),H0=s(r=>new TextDecoder().decode(r),"toString")});var $h,Hh,qh,Hv,zh,jh,os,zS,jS,Nt,yi=Bt(()=>{Kv();is();$h=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}};s($h,"Encoder");Hh=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseDecode=n}decode(e){if(typeof e=="string")switch(e[0]){case this.prefix:return this.baseDecode(e.slice(1));default:throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}else throw Error("Can only multibase decode strings")}or(e){return Hv(this,e)}};s(Hh,"Decoder");qh=class{constructor(e){this.decoders=e}or(e){return Hv(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};s(qh,"ComposedDecoder");Hv=s((r,e)=>new qh(ne(ne({},r.decoders||{[r.prefix]:r}),e.decoders||{[e.prefix]:e})),"or"),zh=class{constructor(e,t,n,i){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=i,this.encoder=new $h(e,t,n),this.decoder=new Hh(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};s(zh,"Codec");jh=s(({name:r,prefix:e,encode:t,decode:n})=>new zh(r,e,t,n),"from"),os=s(({prefix:r,name:e,alphabet:t})=>{let{encode:n,decode:i}=Fv(t,e);return jh({prefix:r,name:e,encode:n,decode:o=>En(i(o))})},"baseX"),zS=s((r,e,t,n)=>{let i={};for(let h=0;h<e.length;++h)i[e[h]]=h;let o=r.length;for(;r[o-1]==="=";)--o;let a=new Uint8Array(o*t/8|0),f=0,c=0,l=0;for(let h=0;h<o;++h){let d=i[r[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);c=c<<t|d,f+=t,f>=8&&(f-=8,a[l++]=255&c>>f)}if(f>=t||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return a},"decode"),jS=s((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,o="",a=0,f=0;for(let c=0;c<r.length;++c)for(f=f<<8|r[c],a+=8;a>t;)a-=t,o+=e[i&f>>a];if(a&&(o+=e[i&f<<t-a]),n)for(;o.length*t&7;)o+="=";return o},"encode"),Nt=s(({name:r,prefix:e,bitsPerChar:t,alphabet:n})=>jh({prefix:e,name:r,encode(i){return jS(i,n,t)},decode(i){return zS(i,n,t,r)}}),"rfc4648")});var q0={};It(q0,{identity:()=>VS});var VS,qv=Bt(()=>{yi();is();VS=jh({prefix:"\0",name:"identity",encode:r=>H0(r),decode:r=>$0(r)})});var z0={};It(z0,{base2:()=>WS});var WS,zv=Bt(()=>{yi();WS=Nt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})});var j0={};It(j0,{base8:()=>GS});var GS,jv=Bt(()=>{yi();GS=Nt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})});var V0={};It(V0,{base10:()=>JS});var JS,Vv=Bt(()=>{yi();JS=os({prefix:"9",name:"base10",alphabet:"0123456789"})});var W0={};It(W0,{base16:()=>YS,base16upper:()=>XS});var YS,XS,Wv=Bt(()=>{yi();YS=Nt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),XS=Nt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});var G0={};It(G0,{base32:()=>mf,base32hex:()=>t9,base32hexpad:()=>n9,base32hexpadupper:()=>i9,base32hexupper:()=>r9,base32pad:()=>QS,base32padupper:()=>e9,base32upper:()=>ZS,base32z:()=>o9});var mf,ZS,QS,e9,t9,r9,n9,i9,o9,J0=Bt(()=>{yi();mf=Nt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ZS=Nt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),QS=Nt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),e9=Nt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),t9=Nt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),r9=Nt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),n9=Nt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),i9=Nt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),o9=Nt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})});var Y0={};It(Y0,{base36:()=>Zs,base36upper:()=>s9});var Zs,s9,Vh=Bt(()=>{yi();Zs=os({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s9=os({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})});var X0={};It(X0,{base58btc:()=>vi,base58flickr:()=>a9});var vi,a9,Z0=Bt(()=>{yi();vi=os({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),a9=os({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});var Q0={};It(Q0,{base64:()=>f9,base64pad:()=>c9,base64url:()=>Gv,base64urlpad:()=>u9});var f9,c9,Gv,u9,em=Bt(()=>{yi();f9=Nt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),c9=Nt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Gv=Nt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),u9=Nt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});function Xv(r,e,t){e=e||[],t=t||0;for(var n=t;r>=p9;)e[t++]=r&255|Jv,r/=128;for(;r&d9;)e[t++]=r&255|Jv,r>>>=7;return e[t]=r|0,Xv.bytes=t-n+1,e}function tm(r,n){var t=0,n=n||0,i=0,o=n,a,f=r.length;do{if(o>=f)throw tm.bytes=0,new RangeError("Could not decode varint");a=r[o++],t+=i<28?(a&Yv)<<i:(a&Yv)*Math.pow(2,i),i+=7}while(a>=b9);return tm.bytes=o-n,t}var l9,Jv,h9,d9,p9,m9,b9,Yv,g9,y9,v9,w9,x9,A9,_9,E9,S9,C9,T9,k9,wu,Zv=Bt(()=>{l9=Xv,Jv=128,h9=127,d9=~h9,p9=Math.pow(2,31);s(Xv,"encode");m9=tm,b9=128,Yv=127;s(tm,"read");g9=Math.pow(2,7),y9=Math.pow(2,14),v9=Math.pow(2,21),w9=Math.pow(2,28),x9=Math.pow(2,35),A9=Math.pow(2,42),_9=Math.pow(2,49),E9=Math.pow(2,56),S9=Math.pow(2,63),C9=s(function(r){return r<g9?1:r<y9?2:r<v9?3:r<w9?4:r<x9?5:r<A9?6:r<_9?7:r<E9?8:r<S9?9:10},"length"),T9={encode:l9,decode:m9,encodingLength:C9},k9=T9,wu=k9});var gf={};It(gf,{decode:()=>bf,encodeTo:()=>Qs,encodingLength:()=>ea});var bf,Qs,ea,Wh=Bt(()=>{Zv();bf=s(r=>[wu.decode(r),wu.decode.bytes],"decode"),Qs=s((r,e,t=0)=>(wu.encode(r,e,t),e),"encodeTo"),ea=s(r=>wu.encodingLength(r),"encodingLength")});var ta={};It(ta,{Digest:()=>ss,create:()=>as,decode:()=>xu,equals:()=>rm});var as,xu,rm,ss,yf=Bt(()=>{is();Wh();as=s((r,e)=>{let t=e.byteLength,n=ea(r),i=n+ea(t),o=new Uint8Array(i+t);return Qs(r,o,0),Qs(t,o,n),o.set(e,i),new ss(r,t,e,o)},"create"),xu=s(r=>{let e=En(r),[t,n]=bf(e),[i,o]=bf(e.subarray(n)),a=e.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ss(t,i,a,e)},"decode"),rm=s((r,e)=>r===e?!0:r.code===e.code&&r.size===e.size&&K0(r.bytes,e.bytes),"equals"),ss=class{constructor(e,t,n,i){this.code=e,this.size=t,this.digest=n,this.bytes=i}};s(ss,"Digest")});var Jh={};It(Jh,{Hasher:()=>Au,from:()=>Gh});var Gh,Au,nm=Bt(()=>{yf();Gh=s(({name:r,code:e,encode:t})=>new Au(r,e,t),"from"),Au=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?as(this.code,t):t.then(n=>as(this.code,n))}else throw Error("Unknown type, must be binary type")}};s(Au,"Hasher")});var im={};It(im,{sha256:()=>ra,sha512:()=>M9});var Qv,ra,M9,_u=Bt(()=>{nm();Qv=s(r=>e=>M(void 0,null,function*(){return new Uint8Array(yield crypto.subtle.digest(r,e))}),"sha"),ra=Gh({name:"sha2-256",code:18,encode:Qv("SHA-256")}),M9=Gh({name:"sha2-512",code:19,encode:Qv("SHA-512")})});var om={};It(om,{identity:()=>Yh});var ew,B9,tw,I9,Yh,sm=Bt(()=>{is();yf();ew=0,B9="identity",tw=En,I9=s(r=>as(ew,tw(r)),"digest"),Yh={code:ew,name:B9,encode:tw,digest:I9}});var am={};It(am,{code:()=>O9,decode:()=>R9,encode:()=>P9,name:()=>N9});var N9,O9,P9,R9,rw=Bt(()=>{is();N9="raw",O9=85,P9=s(r=>En(r),"encode"),R9=s(r=>En(r),"decode")});var fm={};It(fm,{code:()=>F9,decode:()=>$9,encode:()=>K9,name:()=>D9});var U9,L9,D9,F9,K9,$9,nw=Bt(()=>{U9=new TextEncoder,L9=new TextDecoder,D9="json",F9=512,K9=s(r=>U9.encode(JSON.stringify(r)),"encode"),$9=s(r=>JSON.parse(L9.decode(r)),"decode")});var Ne,H9,q9,z9,Eu,j9,iw,ow,Xh,Zh,V9,W9,G9,to=Bt(()=>{Wh();yf();Z0();J0();is();Ne=class{constructor(e,t,n,i){this.code=t,this.version=e,this.multihash=n,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:Zh,byteLength:Zh,code:Xh,version:Xh,multihash:Xh,bytes:Xh,_baseCache:Zh,asCID:Zh})}toV0(){switch(this.version){case 0:return this;default:{let{code:e,multihash:t}=this;if(e!==Eu)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==j9)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ne.createV0(t)}}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,n=as(e,t);return Ne.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&rm(this.multihash,e.multihash)}toString(e){let{bytes:t,version:n,_baseCache:i}=this;switch(n){case 0:return q9(t,i,e||vi.encoder);default:return z9(t,i,e||mf.encoder)}}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return W9(/^0\.0/,G9),!!(e&&(e[ow]||e.asCID===e))}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof Ne)return e;if(e!=null&&e.asCID===e){let{version:t,code:n,multihash:i,bytes:o}=e;return new Ne(t,n,i,o||iw(t,n,i.bytes))}else if(e!=null&&e[ow]===!0){let{version:t,multihash:n,code:i}=e,o=xu(n);return Ne.create(t,i,o)}else return null}static create(e,t,n){if(typeof t!="number")throw new Error("String codecs are no longer supported");switch(e){case 0:{if(t!==Eu)throw new Error(`Version 0 CID must use dag-pb (code: ${Eu}) block encoding`);return new Ne(e,t,n,n.bytes)}case 1:{let i=iw(e,t,n.bytes);return new Ne(e,t,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return Ne.create(0,Eu,e)}static createV1(e,t){return Ne.create(1,e,t)}static decode(e){let[t,n]=Ne.decodeFirst(e);if(n.length)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=Ne.inspectBytes(e),n=t.size-t.multihashSize,i=En(e.subarray(n,n+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let o=i.subarray(t.multihashSize-t.digestSize),a=new ss(t.multihashCode,t.digestSize,o,i);return[t.version===0?Ne.createV0(a):Ne.createV1(t.codec,a),e.subarray(t.size)]}static inspectBytes(e){let t=0,n=s(()=>{let[d,y]=bf(e.subarray(t));return t+=y,d},"next"),i=n(),o=Eu;if(i===18?(i=0,t=0):i===1&&(o=n()),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=t,f=n(),c=n(),l=t+c,h=l-a;return{version:i,codec:o,multihashCode:f,digestSize:c,multihashSize:h,size:l}}static parse(e,t){let[n,i]=H9(e,t),o=Ne.decode(i);return o._baseCache.set(n,e),o}};s(Ne,"CID");H9=s((r,e)=>{switch(r[0]){case"Q":{let t=e||vi;return[vi.prefix,t.decode(`${vi.prefix}${r}`)]}case vi.prefix:{let t=e||vi;return[vi.prefix,t.decode(r)]}case mf.prefix:{let t=e||mf;return[mf.prefix,t.decode(r)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[r[0],e.decode(r)]}}},"parseCIDtoBytes"),q9=s((r,e,t)=>{let{prefix:n}=t;if(n!==vi.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(n);if(i==null){let o=t.encode(r).slice(1);return e.set(n,o),o}else return i},"toStringV0"),z9=s((r,e,t)=>{let{prefix:n}=t,i=e.get(n);if(i==null){let o=t.encode(r);return e.set(n,o),o}else return i},"toStringV1"),Eu=112,j9=18,iw=s((r,e,t)=>{let n=ea(r),i=n+ea(e),o=new Uint8Array(i+t.byteLength);return Qs(r,o,0),Qs(e,o,n),o.set(t,i),o},"encodeCID"),ow=Symbol.for("@ipld/js-cid/CID"),Xh={writable:!1,configurable:!1,enumerable:!0},Zh={writable:!1,enumerable:!1,configurable:!1},V9="0.0.0-dev",W9=s((r,e)=>{if(r.test(V9))console.warn(e);else throw new Error(e)},"deprecate"),G9=`CID.isCID(v) is deprecated and will be removed in the next major release.
|
2
2
|
Following code pattern:
|
3
3
|
|
4
4
|
if (CID.isCID(value)) {
|
@@ -12,11 +12,11 @@ if (cid) {
|
|
12
12
|
// Make sure to use cid instead of value
|
13
13
|
doSomethingWithCID(cid)
|
14
14
|
}
|
15
|
-
`});var J0=Tt(()=>{Xi();Ih();Zs();H0();ac()});var Ov={};Mt(Ov,{CID:()=>Ie,bases:()=>cc,bytes:()=>cu,codecs:()=>f9,digest:()=>Jo,hasher:()=>Ph,hashes:()=>c9,varint:()=>oc});var cc,c9,f9,Dh=Tt(()=>{bv();gv();yv();vv();wv();P0();Nh();L0();K0();hu();j0();Mv();Bv();J0();cc=ne(ne(ne(ne(ne(ne(ne(ne(ne({},T0),M0),B0),N0),I0),O0),R0),U0),D0),c9=ne(ne({},q0),z0),f9={raw:V0,json:G0}});var Uv=de(tn=>{"use strict";Object.defineProperty(tn,"__esModule",{value:!0});function l9(r,e){var t=r>>>16&65535,n=r&65535,i=e>>>16&65535,s=e&65535;return n*s+(t*s+n*i<<16>>>0)|0}o(l9,"imulShim");tn.mul=Math.imul||l9;function h9(r,e){return r+e|0}o(h9,"add");tn.add=h9;function d9(r,e){return r-e|0}o(d9,"sub");tn.sub=d9;function p9(r,e){return r<<e|r>>>32-e}o(p9,"rotl");tn.rotl=p9;function m9(r,e){return r<<32-e|r>>>e}o(m9,"rotr");tn.rotr=m9;function b9(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}o(b9,"isIntegerShim");tn.isInteger=Number.isInteger||b9;tn.MAX_SAFE_INTEGER=9007199254740991;tn.isSafeInteger=function(r){return tn.isInteger(r)&&r>=-tn.MAX_SAFE_INTEGER&&r<=tn.MAX_SAFE_INTEGER}});var Yo=de(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});var Lv=Uv();function g9(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}o(g9,"readInt16BE");Ve.readInt16BE=g9;function y9(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}o(y9,"readUint16BE");Ve.readUint16BE=y9;function v9(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}o(v9,"readInt16LE");Ve.readInt16LE=v9;function w9(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}o(w9,"readUint16LE");Ve.readUint16LE=w9;function Dv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}o(Dv,"writeUint16BE");Ve.writeUint16BE=Dv;Ve.writeInt16BE=Dv;function Kv(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}o(Kv,"writeUint16LE");Ve.writeUint16LE=Kv;Ve.writeInt16LE=Kv;function Y0(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}o(Y0,"readInt32BE");Ve.readInt32BE=Y0;function X0(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}o(X0,"readUint32BE");Ve.readUint32BE=X0;function Z0(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}o(Z0,"readInt32LE");Ve.readInt32LE=Z0;function Q0(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}o(Q0,"readUint32LE");Ve.readUint32LE=Q0;function Fh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}o(Fh,"writeUint32BE");Ve.writeUint32BE=Fh;Ve.writeInt32BE=Fh;function Hh(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}o(Hh,"writeUint32LE");Ve.writeUint32LE=Hh;Ve.writeInt32LE=Hh;function x9(r,e){e===void 0&&(e=0);var t=Y0(r,e),n=Y0(r,e+4);return t*4294967296+n-(n>>31)*4294967296}o(x9,"readInt64BE");Ve.readInt64BE=x9;function _9(r,e){e===void 0&&(e=0);var t=X0(r,e),n=X0(r,e+4);return t*4294967296+n}o(_9,"readUint64BE");Ve.readUint64BE=_9;function A9(r,e){e===void 0&&(e=0);var t=Z0(r,e),n=Z0(r,e+4);return n*4294967296+t-(t>>31)*4294967296}o(A9,"readInt64LE");Ve.readInt64LE=A9;function E9(r,e){e===void 0&&(e=0);var t=Q0(r,e),n=Q0(r,e+4);return n*4294967296+t}o(E9,"readUint64LE");Ve.readUint64LE=E9;function $v(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Fh(r/4294967296>>>0,e,t),Fh(r>>>0,e,t+4),e}o($v,"writeUint64BE");Ve.writeUint64BE=$v;Ve.writeInt64BE=$v;function Fv(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),Hh(r>>>0,e,t),Hh(r/4294967296>>>0,e,t+4),e}o(Fv,"writeUint64LE");Ve.writeUint64LE=Fv;Ve.writeInt64LE=Fv;function S9(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,s=r/8+t-1;s>=t;s--)n+=e[s]*i,i*=256;return n}o(S9,"readUintBE");Ve.readUintBE=S9;function C9(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,s=t;s<t+r/8;s++)n+=e[s]*i,i*=256;return n}o(C9,"readUintLE");Ve.readUintLE=C9;function k9(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,s=r/8+n-1;s>=n;s--)t[s]=e/i&255,i*=256;return t}o(k9,"writeUintBE");Ve.writeUintBE=k9;function T9(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!Lv.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,s=n;s<n+r/8;s++)t[s]=e/i&255,i*=256;return t}o(T9,"writeUintLE");Ve.writeUintLE=T9;function M9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}o(M9,"readFloat32BE");Ve.readFloat32BE=M9;function B9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}o(B9,"readFloat32LE");Ve.readFloat32LE=B9;function N9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}o(N9,"readFloat64BE");Ve.readFloat64BE=N9;function I9(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}o(I9,"readFloat64LE");Ve.readFloat64LE=I9;function O9(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}o(O9,"writeFloat32BE");Ve.writeFloat32BE=O9;function P9(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}o(P9,"writeFloat32LE");Ve.writeFloat32LE=P9;function R9(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}o(R9,"writeFloat64BE");Ve.writeFloat64BE=R9;function U9(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}o(U9,"writeFloat64LE");Ve.writeFloat64LE=U9});var xn=de(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});function L9(r){for(var e=0;e<r.length;e++)r[e]=0;return r}o(L9,"wipe");em.wipe=L9});var qv=de(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var zh=Yo(),qh=xn();ro.DIGEST_LENGTH=32;ro.BLOCK_SIZE=64;var Hv=function(){function r(){this.digestLength=ro.DIGEST_LENGTH,this.blockSize=ro.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return o(r,"SHA256"),r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){qh.wipe(this._buffer),qh.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(tm(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=tm(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,s=t<<3,a=t%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c<a-8;c++)this._buffer[c]=0;zh.writeUint32BE(i,this._buffer,a-8),zh.writeUint32BE(s,this._buffer,a-4),tm(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(var c=0;c<this.digestLength/4;c++)zh.writeUint32BE(this._state[c],e,c*4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){qh.wipe(e.state),e.buffer&&qh.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();ro.SHA256=Hv;var D9=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function tm(r,e,t,n,i){for(;i>=64;){for(var s=e[0],a=e[1],c=e[2],f=e[3],l=e[4],h=e[5],d=e[6],v=e[7],x=0;x<16;x++){var y=n+x*4;r[x]=zh.readUint32BE(t,y)}for(var x=16;x<64;x++){var _=r[x-2],U=(_>>>17|_<<32-17)^(_>>>19|_<<32-19)^_>>>10;_=r[x-15];var E=(_>>>7|_<<32-7)^(_>>>18|_<<32-18)^_>>>3;r[x]=(U+r[x-7]|0)+(E+r[x-16]|0)}for(var x=0;x<64;x++){var U=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&d)|0)+(v+(D9[x]+r[x]|0)|0)|0,E=((s>>>2|s<<32-2)^(s>>>13|s<<32-13)^(s>>>22|s<<32-22))+(s&a^s&c^a&c)|0;v=d,d=h,h=l,l=f+U|0,f=c,c=a,a=s,s=U+E|0}e[0]+=s,e[1]+=a,e[2]+=c,e[3]+=f,e[4]+=l,e[5]+=h,e[6]+=d,e[7]+=v,n+=64,i-=64}return n}o(tm,"hashBlocks");function K9(r){var e=new Hv;e.update(r);var t=e.digest();return e.clean(),t}o(K9,"hash");ro.hash=K9});var rm=de((hL,jh)=>{(function(){"use strict";var r="input is invalid type",e="finalize already called",t=typeof window=="object",n=t?window:{};n.JS_SHA3_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",s=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?n=global:i&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&typeof jh=="object"&&jh.exports,c=typeof define=="function"&&define.amd,f=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",l="0123456789abcdef".split(""),h=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],v=[1,256,65536,16777216],x=[6,1536,393216,100663296],y=[0,8,16,24],_=[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],U=[224,256,384,512],E=[128,256],L=["hex","buffer","arrayBuffer","array","digest"],H={"128":168,"256":136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(A){return Object.prototype.toString.call(A)==="[object Array]"}),f&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(A){return typeof A=="object"&&A.buffer&&A.buffer.constructor===ArrayBuffer});for(var F=o(function(A,X,Q){return function(P){return new V(A,X,A).update(P)[Q]()}},"createOutputMethod"),j=o(function(A,X,Q){return function(P,O){return new V(A,X,O).update(P)[Q]()}},"createShakeOutputMethod"),D=o(function(A,X,Q){return function(P,O,z,W){return w["cshake"+A].update(P,O,z,W)[Q]()}},"createCshakeOutputMethod"),B=o(function(A,X,Q){return function(P,O,z,W){return w["kmac"+A].update(P,O,z,W)[Q]()}},"createKmacOutputMethod"),R=o(function(A,X,Q,P){for(var O=0;O<L.length;++O){var z=L[O];A[z]=X(Q,P,z)}return A},"createOutputMethods"),Y=o(function(A,X){var Q=F(A,X,"hex");return Q.create=function(){return new V(A,X,A)},Q.update=function(P){return Q.create().update(P)},R(Q,F,A,X)},"createMethod"),b=o(function(A,X){var Q=j(A,X,"hex");return Q.create=function(P){return new V(A,X,P)},Q.update=function(P,O){return Q.create(O).update(P)},R(Q,j,A,X)},"createShakeMethod"),u=o(function(A,X){var Q=H[A],P=D(A,X,"hex");return P.create=function(O,z,W){return!z&&!W?w["shake"+A].create(O):new V(A,X,O).bytepad([z,W],Q)},P.update=function(O,z,W,re){return P.create(z,W,re).update(O)},R(P,D,A,X)},"createCshakeMethod"),p=o(function(A,X){var Q=H[A],P=B(A,X,"hex");return P.create=function(O,z,W){return new K(A,X,z).bytepad(["KMAC",W],Q).bytepad([O],Q)},P.update=function(O,z,W,re){return P.create(O,W,re).update(z)},R(P,B,A,X)},"createKmacMethod"),m=[{name:"keccak",padding:v,bits:U,createMethod:Y},{name:"sha3",padding:x,bits:U,createMethod:Y},{name:"shake",padding:h,bits:E,createMethod:b},{name:"cshake",padding:d,bits:E,createMethod:u},{name:"kmac",padding:d,bits:E,createMethod:p}],w={},S=[],I=0;I<m.length;++I)for(var N=m[I],k=N.bits,g=0;g<k.length;++g){var C=N.name+"_"+k[g];if(S.push(C),w[C]=N.createMethod(k[g],N.padding),N.name!=="sha3"){var Z=N.name+k[g];S.push(Z),w[Z]=w[C]}}function V(A,X,Q){this.blocks=[],this.s=[],this.padding=X,this.outputBits=Q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(A<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Q>>5,this.extraBytes=(Q&31)>>3;for(var P=0;P<50;++P)this.s[P]=0}o(V,"Keccak"),V.prototype.update=function(A){if(this.finalized)throw new Error(e);var X,Q=typeof A;if(Q!=="string"){if(Q==="object"){if(A===null)throw new Error(r);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(r)}else throw new Error(r);X=!0}for(var P=this.blocks,O=this.byteCount,z=A.length,W=this.blockCount,re=0,le=this.s,oe,J;re<z;){if(this.reset)for(this.reset=!1,P[0]=this.block,oe=1;oe<W+1;++oe)P[oe]=0;if(X)for(oe=this.start;re<z&&oe<O;++re)P[oe>>2]|=A[re]<<y[oe++&3];else for(oe=this.start;re<z&&oe<O;++re)J=A.charCodeAt(re),J<128?P[oe>>2]|=J<<y[oe++&3]:J<2048?(P[oe>>2]|=(192|J>>6)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]):J<55296||J>=57344?(P[oe>>2]|=(224|J>>12)<<y[oe++&3],P[oe>>2]|=(128|J>>6&63)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]):(J=65536+((J&1023)<<10|A.charCodeAt(++re)&1023),P[oe>>2]|=(240|J>>18)<<y[oe++&3],P[oe>>2]|=(128|J>>12&63)<<y[oe++&3],P[oe>>2]|=(128|J>>6&63)<<y[oe++&3],P[oe>>2]|=(128|J&63)<<y[oe++&3]);if(this.lastByteIndex=oe,oe>=O){for(this.start=oe-O,this.block=P[W],oe=0;oe<W;++oe)le[oe]^=P[oe];fe(le),this.reset=!0}else this.start=oe}return this},V.prototype.encode=function(A,X){var Q=A&255,P=1,O=[Q];for(A=A>>8,Q=A&255;Q>0;)O.unshift(Q),A=A>>8,Q=A&255,++P;return X?O.push(P):O.unshift(P),this.update(O),O.length},V.prototype.encodeString=function(A){var X,Q=typeof A;if(Q!=="string"){if(Q==="object"){if(A===null)throw new Error(r);if(f&&A.constructor===ArrayBuffer)A=new Uint8Array(A);else if(!Array.isArray(A)&&(!f||!ArrayBuffer.isView(A)))throw new Error(r)}else throw new Error(r);X=!0}var P=0,O=A.length;if(X)P=O;else for(var z=0;z<A.length;++z){var W=A.charCodeAt(z);W<128?P+=1:W<2048?P+=2:W<55296||W>=57344?P+=3:(W=65536+((W&1023)<<10|A.charCodeAt(++z)&1023),P+=4)}return P+=this.encode(P*8),this.update(A),P},V.prototype.bytepad=function(A,X){for(var Q=this.encode(X),P=0;P<A.length;++P)Q+=this.encodeString(A[P]);var O=X-Q%X,z=[];return z.length=O,this.update(z),this},V.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var A=this.blocks,X=this.lastByteIndex,Q=this.blockCount,P=this.s;if(A[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(A[0]=A[Q],X=1;X<Q+1;++X)A[X]=0;for(A[Q-1]|=2147483648,X=0;X<Q;++X)P[X]^=A[X];fe(P)}},V.prototype.toString=V.prototype.hex=function(){this.finalize();for(var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W="",re;z<Q;){for(O=0;O<A&&z<Q;++O,++z)re=X[O],W+=l[re>>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];z%A===0&&(fe(X),O=0)}return P&&(re=X[O],W+=l[re>>4&15]+l[re&15],P>1&&(W+=l[re>>12&15]+l[re>>8&15]),P>2&&(W+=l[re>>20&15]+l[re>>16&15])),W},V.prototype.arrayBuffer=function(){this.finalize();var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W=this.outputBits>>3,re;P?re=new ArrayBuffer(Q+1<<2):re=new ArrayBuffer(W);for(var le=new Uint32Array(re);z<Q;){for(O=0;O<A&&z<Q;++O,++z)le[z]=X[O];z%A===0&&fe(X)}return P&&(le[O]=X[O],re=re.slice(0,W)),re},V.prototype.buffer=V.prototype.arrayBuffer,V.prototype.digest=V.prototype.array=function(){this.finalize();for(var A=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,W=[],re,le;z<Q;){for(O=0;O<A&&z<Q;++O,++z)re=z<<2,le=X[O],W[re]=le&255,W[re+1]=le>>8&255,W[re+2]=le>>16&255,W[re+3]=le>>24&255;z%A===0&&fe(X)}return P&&(re=z<<2,le=X[O],W[re]=le&255,P>1&&(W[re+1]=le>>8&255),P>2&&(W[re+2]=le>>16&255)),W};function K(A,X,Q){V.call(this,A,X,Q)}o(K,"Kmac"),K.prototype=new V,K.prototype.finalize=function(){return this.encode(this.outputBits,!0),V.prototype.finalize.call(this)};var fe=o(function(A){var X,Q,P,O,z,W,re,le,oe,J,pe,ee,ce,$,ie,me,ke,Ne,Xe,dn,te,G,T,q,se,ae,he,ge,rt,Pe,Ee,nt,Ge,it,So,ht,dt,Co,pt,mt,ko,bt,gt,To,yt,vt,Mo,wt,xt,Bo,_t,At,No,Et,St,xs,_s,As,Es,Ss,Cs,ks,Ts;for(P=0;P<48;P+=2)O=A[0]^A[10]^A[20]^A[30]^A[40],z=A[1]^A[11]^A[21]^A[31]^A[41],W=A[2]^A[12]^A[22]^A[32]^A[42],re=A[3]^A[13]^A[23]^A[33]^A[43],le=A[4]^A[14]^A[24]^A[34]^A[44],oe=A[5]^A[15]^A[25]^A[35]^A[45],J=A[6]^A[16]^A[26]^A[36]^A[46],pe=A[7]^A[17]^A[27]^A[37]^A[47],ee=A[8]^A[18]^A[28]^A[38]^A[48],ce=A[9]^A[19]^A[29]^A[39]^A[49],X=ee^(W<<1|re>>>31),Q=ce^(re<<1|W>>>31),A[0]^=X,A[1]^=Q,A[10]^=X,A[11]^=Q,A[20]^=X,A[21]^=Q,A[30]^=X,A[31]^=Q,A[40]^=X,A[41]^=Q,X=O^(le<<1|oe>>>31),Q=z^(oe<<1|le>>>31),A[2]^=X,A[3]^=Q,A[12]^=X,A[13]^=Q,A[22]^=X,A[23]^=Q,A[32]^=X,A[33]^=Q,A[42]^=X,A[43]^=Q,X=W^(J<<1|pe>>>31),Q=re^(pe<<1|J>>>31),A[4]^=X,A[5]^=Q,A[14]^=X,A[15]^=Q,A[24]^=X,A[25]^=Q,A[34]^=X,A[35]^=Q,A[44]^=X,A[45]^=Q,X=le^(ee<<1|ce>>>31),Q=oe^(ce<<1|ee>>>31),A[6]^=X,A[7]^=Q,A[16]^=X,A[17]^=Q,A[26]^=X,A[27]^=Q,A[36]^=X,A[37]^=Q,A[46]^=X,A[47]^=Q,X=J^(O<<1|z>>>31),Q=pe^(z<<1|O>>>31),A[8]^=X,A[9]^=Q,A[18]^=X,A[19]^=Q,A[28]^=X,A[29]^=Q,A[38]^=X,A[39]^=Q,A[48]^=X,A[49]^=Q,$=A[0],ie=A[1],vt=A[11]<<4|A[10]>>>28,Mo=A[10]<<4|A[11]>>>28,ge=A[20]<<3|A[21]>>>29,rt=A[21]<<3|A[20]>>>29,Ss=A[31]<<9|A[30]>>>23,Cs=A[30]<<9|A[31]>>>23,bt=A[40]<<18|A[41]>>>14,gt=A[41]<<18|A[40]>>>14,it=A[2]<<1|A[3]>>>31,So=A[3]<<1|A[2]>>>31,me=A[13]<<12|A[12]>>>20,ke=A[12]<<12|A[13]>>>20,wt=A[22]<<10|A[23]>>>22,xt=A[23]<<10|A[22]>>>22,Pe=A[33]<<13|A[32]>>>19,Ee=A[32]<<13|A[33]>>>19,ks=A[42]<<2|A[43]>>>30,Ts=A[43]<<2|A[42]>>>30,Et=A[5]<<30|A[4]>>>2,St=A[4]<<30|A[5]>>>2,ht=A[14]<<6|A[15]>>>26,dt=A[15]<<6|A[14]>>>26,Ne=A[25]<<11|A[24]>>>21,Xe=A[24]<<11|A[25]>>>21,Bo=A[34]<<15|A[35]>>>17,_t=A[35]<<15|A[34]>>>17,nt=A[45]<<29|A[44]>>>3,Ge=A[44]<<29|A[45]>>>3,q=A[6]<<28|A[7]>>>4,se=A[7]<<28|A[6]>>>4,xs=A[17]<<23|A[16]>>>9,_s=A[16]<<23|A[17]>>>9,Co=A[26]<<25|A[27]>>>7,pt=A[27]<<25|A[26]>>>7,dn=A[36]<<21|A[37]>>>11,te=A[37]<<21|A[36]>>>11,At=A[47]<<24|A[46]>>>8,No=A[46]<<24|A[47]>>>8,To=A[8]<<27|A[9]>>>5,yt=A[9]<<27|A[8]>>>5,ae=A[18]<<20|A[19]>>>12,he=A[19]<<20|A[18]>>>12,As=A[29]<<7|A[28]>>>25,Es=A[28]<<7|A[29]>>>25,mt=A[38]<<8|A[39]>>>24,ko=A[39]<<8|A[38]>>>24,G=A[48]<<14|A[49]>>>18,T=A[49]<<14|A[48]>>>18,A[0]=$^~me&Ne,A[1]=ie^~ke&Xe,A[10]=q^~ae&ge,A[11]=se^~he&rt,A[20]=it^~ht&Co,A[21]=So^~dt&pt,A[30]=To^~vt&wt,A[31]=yt^~Mo&xt,A[40]=Et^~xs&As,A[41]=St^~_s&Es,A[2]=me^~Ne&dn,A[3]=ke^~Xe&te,A[12]=ae^~ge&Pe,A[13]=he^~rt&Ee,A[22]=ht^~Co&mt,A[23]=dt^~pt&ko,A[32]=vt^~wt&Bo,A[33]=Mo^~xt&_t,A[42]=xs^~As&Ss,A[43]=_s^~Es&Cs,A[4]=Ne^~dn&G,A[5]=Xe^~te&T,A[14]=ge^~Pe&nt,A[15]=rt^~Ee&Ge,A[24]=Co^~mt&bt,A[25]=pt^~ko>,A[34]=wt^~Bo&At,A[35]=xt^~_t&No,A[44]=As^~Ss&ks,A[45]=Es^~Cs&Ts,A[6]=dn^~G&$,A[7]=te^~T&ie,A[16]=Pe^~nt&q,A[17]=Ee^~Ge&se,A[26]=mt^~bt&it,A[27]=ko^~gt&So,A[36]=Bo^~At&To,A[37]=_t^~No&yt,A[46]=Ss^~ks&Et,A[47]=Cs^~Ts&St,A[8]=G^~$&me,A[9]=T^~ie&ke,A[18]=nt^~q&ae,A[19]=Ge^~se&he,A[28]=bt^~it&ht,A[29]=gt^~So&dt,A[38]=At^~To&vt,A[39]=No^~yt&Mo,A[48]=ks^~Et&xs,A[49]=Ts^~St&_s,A[0]^=_[P],A[1]^=_[P+1]},"f");if(a)jh.exports=w;else{for(I=0;I<S.length;++I)n[S[I]]=w[S[I]];c&&define(function(){return w})}})()});var zv=de((dL,$9)=>{$9.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var jv=de(()=>{});var _n=de((Vv,nm)=>{(function(r,e){"use strict";function t(b,u){if(!b)throw new Error(u||"Assertion failed")}o(t,"assert");function n(b,u){b.super_=u;var p=o(function(){},"TempCtor");p.prototype=u.prototype,b.prototype=new p,b.prototype.constructor=b}o(n,"inherits");function i(b,u,p){if(i.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((u==="le"||u==="be")&&(p=u,u=10),this._init(b||0,u||10,p||"be"))}o(i,"BN"),typeof r=="object"?r.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var s;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?s=window.Buffer:s=jv().Buffer}catch(b){}i.isBN=o(function(u){return u instanceof i?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===i.wordSize&&Array.isArray(u.words)},"isBN"),i.max=o(function(u,p){return u.cmp(p)>0?u:p},"max"),i.min=o(function(u,p){return u.cmp(p)<0?u:p},"min"),i.prototype._init=o(function(u,p,m){if(typeof u=="number")return this._initNumber(u,p,m);if(typeof u=="object")return this._initArray(u,p,m);p==="hex"&&(p=16),t(p===(p|0)&&p>=2&&p<=36),u=u.toString().replace(/\s+/g,"");var w=0;u[0]==="-"&&(w++,this.negative=1),w<u.length&&(p===16?this._parseHex(u,w,m):(this._parseBase(u,p,w),m==="le"&&this._initArray(this.toArray(),p,m)))},"init"),i.prototype._initNumber=o(function(u,p,m){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(t(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),p,m)},"_initNumber"),i.prototype._initArray=o(function(u,p,m){if(t(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S,I,N=0;if(m==="be")for(w=u.length-1,S=0;w>=0;w-=3)I=u[w]|u[w-1]<<8|u[w-2]<<16,this.words[S]|=I<<N&67108863,this.words[S+1]=I>>>26-N&67108863,N+=24,N>=26&&(N-=26,S++);else if(m==="le")for(w=0,S=0;w<u.length;w+=3)I=u[w]|u[w+1]<<8|u[w+2]<<16,this.words[S]|=I<<N&67108863,this.words[S+1]=I>>>26-N&67108863,N+=24,N>=26&&(N-=26,S++);return this.strip()},"_initArray");function a(b,u){var p=b.charCodeAt(u);return p>=65&&p<=70?p-55:p>=97&&p<=102?p-87:p-48&15}o(a,"parseHex4Bits");function c(b,u,p){var m=a(b,p);return p-1>=u&&(m|=a(b,p-1)<<4),m}o(c,"parseHexByte"),i.prototype._parseHex=o(function(u,p,m){this.length=Math.ceil((u.length-p)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S=0,I=0,N;if(m==="be")for(w=u.length-1;w>=p;w-=2)N=c(u,p,w)<<S,this.words[I]|=N&67108863,S>=18?(S-=18,I+=1,this.words[I]|=N>>>26):S+=8;else{var k=u.length-p;for(w=k%2===0?p+1:p;w<u.length;w+=2)N=c(u,p,w)<<S,this.words[I]|=N&67108863,S>=18?(S-=18,I+=1,this.words[I]|=N>>>26):S+=8}this.strip()},"_parseHex");function f(b,u,p,m){for(var w=0,S=Math.min(b.length,p),I=u;I<S;I++){var N=b.charCodeAt(I)-48;w*=m,N>=49?w+=N-49+10:N>=17?w+=N-17+10:w+=N}return w}o(f,"parseBase"),i.prototype._parseBase=o(function(u,p,m){this.words=[0],this.length=1;for(var w=0,S=1;S<=67108863;S*=p)w++;w--,S=S/p|0;for(var I=u.length-m,N=I%w,k=Math.min(I,I-N)+m,g=0,C=m;C<k;C+=w)g=f(u,C,C+w,p),this.imuln(S),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(N!==0){var Z=1;for(g=f(u,C,u.length,p),C=0;C<N;C++)Z*=p;this.imuln(Z),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},"_parseBase"),i.prototype.copy=o(function(u){u.words=new Array(this.length);for(var p=0;p<this.length;p++)u.words[p]=this.words[p];u.length=this.length,u.negative=this.negative,u.red=this.red},"copy"),i.prototype.clone=o(function(){var u=new i(null);return this.copy(u),u},"clone"),i.prototype._expand=o(function(u){for(;this.length<u;)this.words[this.length++]=0;return this},"_expand"),i.prototype.strip=o(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),i.prototype._normSign=o(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),i.prototype.inspect=o(function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"},"inspect");var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=o(function(u,p){u=u||10,p=p|0||1;var m;if(u===16||u==="hex"){m="";for(var w=0,S=0,I=0;I<this.length;I++){var N=this.words[I],k=((N<<w|S)&16777215).toString(16);S=N>>>24-w&16777215,S!==0||I!==this.length-1?m=l[6-k.length]+k+m:m=k+m,w+=2,w>=26&&(w-=26,I--)}for(S!==0&&(m=S.toString(16)+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(u===(u|0)&&u>=2&&u<=36){var g=h[u],C=d[u];m="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var V=Z.modn(C).toString(u);Z=Z.idivn(C),Z.isZero()?m=V+m:m=l[g-V.length]+V+m}for(this.isZero()&&(m="0"+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}t(!1,"Base should be between 2 and 36")},"toString"),i.prototype.toNumber=o(function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},"toNumber"),i.prototype.toJSON=o(function(){return this.toString(16)},"toJSON"),i.prototype.toBuffer=o(function(u,p){return t(typeof s!="undefined"),this.toArrayLike(s,u,p)},"toBuffer"),i.prototype.toArray=o(function(u,p){return this.toArrayLike(Array,u,p)},"toArray"),i.prototype.toArrayLike=o(function(u,p,m){var w=this.byteLength(),S=m||Math.max(1,w);t(w<=S,"byte array longer than desired length"),t(S>0,"Requested array length <= 0"),this.strip();var I=p==="le",N=new u(S),k,g,C=this.clone();if(I){for(g=0;!C.isZero();g++)k=C.andln(255),C.iushrn(8),N[g]=k;for(;g<S;g++)N[g]=0}else{for(g=0;g<S-w;g++)N[g]=0;for(g=0;!C.isZero();g++)k=C.andln(255),C.iushrn(8),N[S-g-1]=k}return N},"toArrayLike"),Math.clz32?i.prototype._countBits=o(function(u){return 32-Math.clz32(u)},"_countBits"):i.prototype._countBits=o(function(u){var p=u,m=0;return p>=4096&&(m+=13,p>>>=13),p>=64&&(m+=7,p>>>=7),p>=8&&(m+=4,p>>>=4),p>=2&&(m+=2,p>>>=2),m+p},"_countBits"),i.prototype._zeroBits=o(function(u){if(u===0)return 26;var p=u,m=0;return(p&8191)===0&&(m+=13,p>>>=13),(p&127)===0&&(m+=7,p>>>=7),(p&15)===0&&(m+=4,p>>>=4),(p&3)===0&&(m+=2,p>>>=2),(p&1)===0&&m++,m},"_zeroBits"),i.prototype.bitLength=o(function(){var u=this.words[this.length-1],p=this._countBits(u);return(this.length-1)*26+p},"bitLength");function v(b){for(var u=new Array(b.bitLength()),p=0;p<u.length;p++){var m=p/26|0,w=p%26;u[p]=(b.words[m]&1<<w)>>>w}return u}o(v,"toBitArray"),i.prototype.zeroBits=o(function(){if(this.isZero())return 0;for(var u=0,p=0;p<this.length;p++){var m=this._zeroBits(this.words[p]);if(u+=m,m!==26)break}return u},"zeroBits"),i.prototype.byteLength=o(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),i.prototype.toTwos=o(function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},"toTwos"),i.prototype.fromTwos=o(function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},"fromTwos"),i.prototype.isNeg=o(function(){return this.negative!==0},"isNeg"),i.prototype.neg=o(function(){return this.clone().ineg()},"neg"),i.prototype.ineg=o(function(){return this.isZero()||(this.negative^=1),this},"ineg"),i.prototype.iuor=o(function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var p=0;p<u.length;p++)this.words[p]=this.words[p]|u.words[p];return this.strip()},"iuor"),i.prototype.ior=o(function(u){return t((this.negative|u.negative)===0),this.iuor(u)},"ior"),i.prototype.or=o(function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},"or"),i.prototype.uor=o(function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},"uor"),i.prototype.iuand=o(function(u){var p;this.length>u.length?p=u:p=this;for(var m=0;m<p.length;m++)this.words[m]=this.words[m]&u.words[m];return this.length=p.length,this.strip()},"iuand"),i.prototype.iand=o(function(u){return t((this.negative|u.negative)===0),this.iuand(u)},"iand"),i.prototype.and=o(function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},"and"),i.prototype.uand=o(function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},"uand"),i.prototype.iuxor=o(function(u){var p,m;this.length>u.length?(p=this,m=u):(p=u,m=this);for(var w=0;w<m.length;w++)this.words[w]=p.words[w]^m.words[w];if(this!==p)for(;w<p.length;w++)this.words[w]=p.words[w];return this.length=p.length,this.strip()},"iuxor"),i.prototype.ixor=o(function(u){return t((this.negative|u.negative)===0),this.iuxor(u)},"ixor"),i.prototype.xor=o(function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},"xor"),i.prototype.uxor=o(function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},"uxor"),i.prototype.inotn=o(function(u){t(typeof u=="number"&&u>=0);var p=Math.ceil(u/26)|0,m=u%26;this._expand(p),m>0&&p--;for(var w=0;w<p;w++)this.words[w]=~this.words[w]&67108863;return m>0&&(this.words[w]=~this.words[w]&67108863>>26-m),this.strip()},"inotn"),i.prototype.notn=o(function(u){return this.clone().inotn(u)},"notn"),i.prototype.setn=o(function(u,p){t(typeof u=="number"&&u>=0);var m=u/26|0,w=u%26;return this._expand(m+1),p?this.words[m]=this.words[m]|1<<w:this.words[m]=this.words[m]&~(1<<w),this.strip()},"setn"),i.prototype.iadd=o(function(u){var p;if(this.negative!==0&&u.negative===0)return this.negative=0,p=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,p=this.isub(u),u.negative=1,p._normSign();var m,w;this.length>u.length?(m=this,w=u):(m=u,w=this);for(var S=0,I=0;I<w.length;I++)p=(m.words[I]|0)+(w.words[I]|0)+S,this.words[I]=p&67108863,S=p>>>26;for(;S!==0&&I<m.length;I++)p=(m.words[I]|0)+S,this.words[I]=p&67108863,S=p>>>26;if(this.length=m.length,S!==0)this.words[this.length]=S,this.length++;else if(m!==this)for(;I<m.length;I++)this.words[I]=m.words[I];return this},"iadd"),i.prototype.add=o(function(u){var p;return u.negative!==0&&this.negative===0?(u.negative=0,p=this.sub(u),u.negative^=1,p):u.negative===0&&this.negative!==0?(this.negative=0,p=u.sub(this),this.negative=1,p):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},"add"),i.prototype.isub=o(function(u){if(u.negative!==0){u.negative=0;var p=this.iadd(u);return u.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var m=this.cmp(u);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,S;m>0?(w=this,S=u):(w=u,S=this);for(var I=0,N=0;N<S.length;N++)p=(w.words[N]|0)-(S.words[N]|0)+I,I=p>>26,this.words[N]=p&67108863;for(;I!==0&&N<w.length;N++)p=(w.words[N]|0)+I,I=p>>26,this.words[N]=p&67108863;if(I===0&&N<w.length&&w!==this)for(;N<w.length;N++)this.words[N]=w.words[N];return this.length=Math.max(this.length,N),w!==this&&(this.negative=1),this.strip()},"isub"),i.prototype.sub=o(function(u){return this.clone().isub(u)},"sub");function x(b,u,p){p.negative=u.negative^b.negative;var m=b.length+u.length|0;p.length=m,m=m-1|0;var w=b.words[0]|0,S=u.words[0]|0,I=w*S,N=I&67108863,k=I/67108864|0;p.words[0]=N;for(var g=1;g<m;g++){for(var C=k>>>26,Z=k&67108863,V=Math.min(g,u.length-1),K=Math.max(0,g-b.length+1);K<=V;K++){var fe=g-K|0;w=b.words[fe]|0,S=u.words[K]|0,I=w*S+Z,C+=I/67108864|0,Z=I&67108863}p.words[g]=Z|0,k=C|0}return k!==0?p.words[g]=k|0:p.length--,p.strip()}o(x,"smallMulTo");var y=o(function(u,p,m){var w=u.words,S=p.words,I=m.words,N=0,k,g,C,Z=w[0]|0,V=Z&8191,K=Z>>>13,fe=w[1]|0,A=fe&8191,X=fe>>>13,Q=w[2]|0,P=Q&8191,O=Q>>>13,z=w[3]|0,W=z&8191,re=z>>>13,le=w[4]|0,oe=le&8191,J=le>>>13,pe=w[5]|0,ee=pe&8191,ce=pe>>>13,$=w[6]|0,ie=$&8191,me=$>>>13,ke=w[7]|0,Ne=ke&8191,Xe=ke>>>13,dn=w[8]|0,te=dn&8191,G=dn>>>13,T=w[9]|0,q=T&8191,se=T>>>13,ae=S[0]|0,he=ae&8191,ge=ae>>>13,rt=S[1]|0,Pe=rt&8191,Ee=rt>>>13,nt=S[2]|0,Ge=nt&8191,it=nt>>>13,So=S[3]|0,ht=So&8191,dt=So>>>13,Co=S[4]|0,pt=Co&8191,mt=Co>>>13,ko=S[5]|0,bt=ko&8191,gt=ko>>>13,To=S[6]|0,yt=To&8191,vt=To>>>13,Mo=S[7]|0,wt=Mo&8191,xt=Mo>>>13,Bo=S[8]|0,_t=Bo&8191,At=Bo>>>13,No=S[9]|0,Et=No&8191,St=No>>>13;m.negative=u.negative^p.negative,m.length=19,k=Math.imul(V,he),g=Math.imul(V,ge),g=g+Math.imul(K,he)|0,C=Math.imul(K,ge);var xs=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(xs>>>26)|0,xs&=67108863,k=Math.imul(A,he),g=Math.imul(A,ge),g=g+Math.imul(X,he)|0,C=Math.imul(X,ge),k=k+Math.imul(V,Pe)|0,g=g+Math.imul(V,Ee)|0,g=g+Math.imul(K,Pe)|0,C=C+Math.imul(K,Ee)|0;var _s=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(_s>>>26)|0,_s&=67108863,k=Math.imul(P,he),g=Math.imul(P,ge),g=g+Math.imul(O,he)|0,C=Math.imul(O,ge),k=k+Math.imul(A,Pe)|0,g=g+Math.imul(A,Ee)|0,g=g+Math.imul(X,Pe)|0,C=C+Math.imul(X,Ee)|0,k=k+Math.imul(V,Ge)|0,g=g+Math.imul(V,it)|0,g=g+Math.imul(K,Ge)|0,C=C+Math.imul(K,it)|0;var As=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(As>>>26)|0,As&=67108863,k=Math.imul(W,he),g=Math.imul(W,ge),g=g+Math.imul(re,he)|0,C=Math.imul(re,ge),k=k+Math.imul(P,Pe)|0,g=g+Math.imul(P,Ee)|0,g=g+Math.imul(O,Pe)|0,C=C+Math.imul(O,Ee)|0,k=k+Math.imul(A,Ge)|0,g=g+Math.imul(A,it)|0,g=g+Math.imul(X,Ge)|0,C=C+Math.imul(X,it)|0,k=k+Math.imul(V,ht)|0,g=g+Math.imul(V,dt)|0,g=g+Math.imul(K,ht)|0,C=C+Math.imul(K,dt)|0;var Es=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Es>>>26)|0,Es&=67108863,k=Math.imul(oe,he),g=Math.imul(oe,ge),g=g+Math.imul(J,he)|0,C=Math.imul(J,ge),k=k+Math.imul(W,Pe)|0,g=g+Math.imul(W,Ee)|0,g=g+Math.imul(re,Pe)|0,C=C+Math.imul(re,Ee)|0,k=k+Math.imul(P,Ge)|0,g=g+Math.imul(P,it)|0,g=g+Math.imul(O,Ge)|0,C=C+Math.imul(O,it)|0,k=k+Math.imul(A,ht)|0,g=g+Math.imul(A,dt)|0,g=g+Math.imul(X,ht)|0,C=C+Math.imul(X,dt)|0,k=k+Math.imul(V,pt)|0,g=g+Math.imul(V,mt)|0,g=g+Math.imul(K,pt)|0,C=C+Math.imul(K,mt)|0;var Ss=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Ss>>>26)|0,Ss&=67108863,k=Math.imul(ee,he),g=Math.imul(ee,ge),g=g+Math.imul(ce,he)|0,C=Math.imul(ce,ge),k=k+Math.imul(oe,Pe)|0,g=g+Math.imul(oe,Ee)|0,g=g+Math.imul(J,Pe)|0,C=C+Math.imul(J,Ee)|0,k=k+Math.imul(W,Ge)|0,g=g+Math.imul(W,it)|0,g=g+Math.imul(re,Ge)|0,C=C+Math.imul(re,it)|0,k=k+Math.imul(P,ht)|0,g=g+Math.imul(P,dt)|0,g=g+Math.imul(O,ht)|0,C=C+Math.imul(O,dt)|0,k=k+Math.imul(A,pt)|0,g=g+Math.imul(A,mt)|0,g=g+Math.imul(X,pt)|0,C=C+Math.imul(X,mt)|0,k=k+Math.imul(V,bt)|0,g=g+Math.imul(V,gt)|0,g=g+Math.imul(K,bt)|0,C=C+Math.imul(K,gt)|0;var Cs=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,k=Math.imul(ie,he),g=Math.imul(ie,ge),g=g+Math.imul(me,he)|0,C=Math.imul(me,ge),k=k+Math.imul(ee,Pe)|0,g=g+Math.imul(ee,Ee)|0,g=g+Math.imul(ce,Pe)|0,C=C+Math.imul(ce,Ee)|0,k=k+Math.imul(oe,Ge)|0,g=g+Math.imul(oe,it)|0,g=g+Math.imul(J,Ge)|0,C=C+Math.imul(J,it)|0,k=k+Math.imul(W,ht)|0,g=g+Math.imul(W,dt)|0,g=g+Math.imul(re,ht)|0,C=C+Math.imul(re,dt)|0,k=k+Math.imul(P,pt)|0,g=g+Math.imul(P,mt)|0,g=g+Math.imul(O,pt)|0,C=C+Math.imul(O,mt)|0,k=k+Math.imul(A,bt)|0,g=g+Math.imul(A,gt)|0,g=g+Math.imul(X,bt)|0,C=C+Math.imul(X,gt)|0,k=k+Math.imul(V,yt)|0,g=g+Math.imul(V,vt)|0,g=g+Math.imul(K,yt)|0,C=C+Math.imul(K,vt)|0;var ks=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(ks>>>26)|0,ks&=67108863,k=Math.imul(Ne,he),g=Math.imul(Ne,ge),g=g+Math.imul(Xe,he)|0,C=Math.imul(Xe,ge),k=k+Math.imul(ie,Pe)|0,g=g+Math.imul(ie,Ee)|0,g=g+Math.imul(me,Pe)|0,C=C+Math.imul(me,Ee)|0,k=k+Math.imul(ee,Ge)|0,g=g+Math.imul(ee,it)|0,g=g+Math.imul(ce,Ge)|0,C=C+Math.imul(ce,it)|0,k=k+Math.imul(oe,ht)|0,g=g+Math.imul(oe,dt)|0,g=g+Math.imul(J,ht)|0,C=C+Math.imul(J,dt)|0,k=k+Math.imul(W,pt)|0,g=g+Math.imul(W,mt)|0,g=g+Math.imul(re,pt)|0,C=C+Math.imul(re,mt)|0,k=k+Math.imul(P,bt)|0,g=g+Math.imul(P,gt)|0,g=g+Math.imul(O,bt)|0,C=C+Math.imul(O,gt)|0,k=k+Math.imul(A,yt)|0,g=g+Math.imul(A,vt)|0,g=g+Math.imul(X,yt)|0,C=C+Math.imul(X,vt)|0,k=k+Math.imul(V,wt)|0,g=g+Math.imul(V,xt)|0,g=g+Math.imul(K,wt)|0,C=C+Math.imul(K,xt)|0;var Ts=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Ts>>>26)|0,Ts&=67108863,k=Math.imul(te,he),g=Math.imul(te,ge),g=g+Math.imul(G,he)|0,C=Math.imul(G,ge),k=k+Math.imul(Ne,Pe)|0,g=g+Math.imul(Ne,Ee)|0,g=g+Math.imul(Xe,Pe)|0,C=C+Math.imul(Xe,Ee)|0,k=k+Math.imul(ie,Ge)|0,g=g+Math.imul(ie,it)|0,g=g+Math.imul(me,Ge)|0,C=C+Math.imul(me,it)|0,k=k+Math.imul(ee,ht)|0,g=g+Math.imul(ee,dt)|0,g=g+Math.imul(ce,ht)|0,C=C+Math.imul(ce,dt)|0,k=k+Math.imul(oe,pt)|0,g=g+Math.imul(oe,mt)|0,g=g+Math.imul(J,pt)|0,C=C+Math.imul(J,mt)|0,k=k+Math.imul(W,bt)|0,g=g+Math.imul(W,gt)|0,g=g+Math.imul(re,bt)|0,C=C+Math.imul(re,gt)|0,k=k+Math.imul(P,yt)|0,g=g+Math.imul(P,vt)|0,g=g+Math.imul(O,yt)|0,C=C+Math.imul(O,vt)|0,k=k+Math.imul(A,wt)|0,g=g+Math.imul(A,xt)|0,g=g+Math.imul(X,wt)|0,C=C+Math.imul(X,xt)|0,k=k+Math.imul(V,_t)|0,g=g+Math.imul(V,At)|0,g=g+Math.imul(K,_t)|0,C=C+Math.imul(K,At)|0;var Zp=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Zp>>>26)|0,Zp&=67108863,k=Math.imul(q,he),g=Math.imul(q,ge),g=g+Math.imul(se,he)|0,C=Math.imul(se,ge),k=k+Math.imul(te,Pe)|0,g=g+Math.imul(te,Ee)|0,g=g+Math.imul(G,Pe)|0,C=C+Math.imul(G,Ee)|0,k=k+Math.imul(Ne,Ge)|0,g=g+Math.imul(Ne,it)|0,g=g+Math.imul(Xe,Ge)|0,C=C+Math.imul(Xe,it)|0,k=k+Math.imul(ie,ht)|0,g=g+Math.imul(ie,dt)|0,g=g+Math.imul(me,ht)|0,C=C+Math.imul(me,dt)|0,k=k+Math.imul(ee,pt)|0,g=g+Math.imul(ee,mt)|0,g=g+Math.imul(ce,pt)|0,C=C+Math.imul(ce,mt)|0,k=k+Math.imul(oe,bt)|0,g=g+Math.imul(oe,gt)|0,g=g+Math.imul(J,bt)|0,C=C+Math.imul(J,gt)|0,k=k+Math.imul(W,yt)|0,g=g+Math.imul(W,vt)|0,g=g+Math.imul(re,yt)|0,C=C+Math.imul(re,vt)|0,k=k+Math.imul(P,wt)|0,g=g+Math.imul(P,xt)|0,g=g+Math.imul(O,wt)|0,C=C+Math.imul(O,xt)|0,k=k+Math.imul(A,_t)|0,g=g+Math.imul(A,At)|0,g=g+Math.imul(X,_t)|0,C=C+Math.imul(X,At)|0,k=k+Math.imul(V,Et)|0,g=g+Math.imul(V,St)|0,g=g+Math.imul(K,Et)|0,C=C+Math.imul(K,St)|0;var Qp=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(Qp>>>26)|0,Qp&=67108863,k=Math.imul(q,Pe),g=Math.imul(q,Ee),g=g+Math.imul(se,Pe)|0,C=Math.imul(se,Ee),k=k+Math.imul(te,Ge)|0,g=g+Math.imul(te,it)|0,g=g+Math.imul(G,Ge)|0,C=C+Math.imul(G,it)|0,k=k+Math.imul(Ne,ht)|0,g=g+Math.imul(Ne,dt)|0,g=g+Math.imul(Xe,ht)|0,C=C+Math.imul(Xe,dt)|0,k=k+Math.imul(ie,pt)|0,g=g+Math.imul(ie,mt)|0,g=g+Math.imul(me,pt)|0,C=C+Math.imul(me,mt)|0,k=k+Math.imul(ee,bt)|0,g=g+Math.imul(ee,gt)|0,g=g+Math.imul(ce,bt)|0,C=C+Math.imul(ce,gt)|0,k=k+Math.imul(oe,yt)|0,g=g+Math.imul(oe,vt)|0,g=g+Math.imul(J,yt)|0,C=C+Math.imul(J,vt)|0,k=k+Math.imul(W,wt)|0,g=g+Math.imul(W,xt)|0,g=g+Math.imul(re,wt)|0,C=C+Math.imul(re,xt)|0,k=k+Math.imul(P,_t)|0,g=g+Math.imul(P,At)|0,g=g+Math.imul(O,_t)|0,C=C+Math.imul(O,At)|0,k=k+Math.imul(A,Et)|0,g=g+Math.imul(A,St)|0,g=g+Math.imul(X,Et)|0,C=C+Math.imul(X,St)|0;var e0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(e0>>>26)|0,e0&=67108863,k=Math.imul(q,Ge),g=Math.imul(q,it),g=g+Math.imul(se,Ge)|0,C=Math.imul(se,it),k=k+Math.imul(te,ht)|0,g=g+Math.imul(te,dt)|0,g=g+Math.imul(G,ht)|0,C=C+Math.imul(G,dt)|0,k=k+Math.imul(Ne,pt)|0,g=g+Math.imul(Ne,mt)|0,g=g+Math.imul(Xe,pt)|0,C=C+Math.imul(Xe,mt)|0,k=k+Math.imul(ie,bt)|0,g=g+Math.imul(ie,gt)|0,g=g+Math.imul(me,bt)|0,C=C+Math.imul(me,gt)|0,k=k+Math.imul(ee,yt)|0,g=g+Math.imul(ee,vt)|0,g=g+Math.imul(ce,yt)|0,C=C+Math.imul(ce,vt)|0,k=k+Math.imul(oe,wt)|0,g=g+Math.imul(oe,xt)|0,g=g+Math.imul(J,wt)|0,C=C+Math.imul(J,xt)|0,k=k+Math.imul(W,_t)|0,g=g+Math.imul(W,At)|0,g=g+Math.imul(re,_t)|0,C=C+Math.imul(re,At)|0,k=k+Math.imul(P,Et)|0,g=g+Math.imul(P,St)|0,g=g+Math.imul(O,Et)|0,C=C+Math.imul(O,St)|0;var t0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(t0>>>26)|0,t0&=67108863,k=Math.imul(q,ht),g=Math.imul(q,dt),g=g+Math.imul(se,ht)|0,C=Math.imul(se,dt),k=k+Math.imul(te,pt)|0,g=g+Math.imul(te,mt)|0,g=g+Math.imul(G,pt)|0,C=C+Math.imul(G,mt)|0,k=k+Math.imul(Ne,bt)|0,g=g+Math.imul(Ne,gt)|0,g=g+Math.imul(Xe,bt)|0,C=C+Math.imul(Xe,gt)|0,k=k+Math.imul(ie,yt)|0,g=g+Math.imul(ie,vt)|0,g=g+Math.imul(me,yt)|0,C=C+Math.imul(me,vt)|0,k=k+Math.imul(ee,wt)|0,g=g+Math.imul(ee,xt)|0,g=g+Math.imul(ce,wt)|0,C=C+Math.imul(ce,xt)|0,k=k+Math.imul(oe,_t)|0,g=g+Math.imul(oe,At)|0,g=g+Math.imul(J,_t)|0,C=C+Math.imul(J,At)|0,k=k+Math.imul(W,Et)|0,g=g+Math.imul(W,St)|0,g=g+Math.imul(re,Et)|0,C=C+Math.imul(re,St)|0;var r0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(r0>>>26)|0,r0&=67108863,k=Math.imul(q,pt),g=Math.imul(q,mt),g=g+Math.imul(se,pt)|0,C=Math.imul(se,mt),k=k+Math.imul(te,bt)|0,g=g+Math.imul(te,gt)|0,g=g+Math.imul(G,bt)|0,C=C+Math.imul(G,gt)|0,k=k+Math.imul(Ne,yt)|0,g=g+Math.imul(Ne,vt)|0,g=g+Math.imul(Xe,yt)|0,C=C+Math.imul(Xe,vt)|0,k=k+Math.imul(ie,wt)|0,g=g+Math.imul(ie,xt)|0,g=g+Math.imul(me,wt)|0,C=C+Math.imul(me,xt)|0,k=k+Math.imul(ee,_t)|0,g=g+Math.imul(ee,At)|0,g=g+Math.imul(ce,_t)|0,C=C+Math.imul(ce,At)|0,k=k+Math.imul(oe,Et)|0,g=g+Math.imul(oe,St)|0,g=g+Math.imul(J,Et)|0,C=C+Math.imul(J,St)|0;var n0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(n0>>>26)|0,n0&=67108863,k=Math.imul(q,bt),g=Math.imul(q,gt),g=g+Math.imul(se,bt)|0,C=Math.imul(se,gt),k=k+Math.imul(te,yt)|0,g=g+Math.imul(te,vt)|0,g=g+Math.imul(G,yt)|0,C=C+Math.imul(G,vt)|0,k=k+Math.imul(Ne,wt)|0,g=g+Math.imul(Ne,xt)|0,g=g+Math.imul(Xe,wt)|0,C=C+Math.imul(Xe,xt)|0,k=k+Math.imul(ie,_t)|0,g=g+Math.imul(ie,At)|0,g=g+Math.imul(me,_t)|0,C=C+Math.imul(me,At)|0,k=k+Math.imul(ee,Et)|0,g=g+Math.imul(ee,St)|0,g=g+Math.imul(ce,Et)|0,C=C+Math.imul(ce,St)|0;var i0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(i0>>>26)|0,i0&=67108863,k=Math.imul(q,yt),g=Math.imul(q,vt),g=g+Math.imul(se,yt)|0,C=Math.imul(se,vt),k=k+Math.imul(te,wt)|0,g=g+Math.imul(te,xt)|0,g=g+Math.imul(G,wt)|0,C=C+Math.imul(G,xt)|0,k=k+Math.imul(Ne,_t)|0,g=g+Math.imul(Ne,At)|0,g=g+Math.imul(Xe,_t)|0,C=C+Math.imul(Xe,At)|0,k=k+Math.imul(ie,Et)|0,g=g+Math.imul(ie,St)|0,g=g+Math.imul(me,Et)|0,C=C+Math.imul(me,St)|0;var s0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(s0>>>26)|0,s0&=67108863,k=Math.imul(q,wt),g=Math.imul(q,xt),g=g+Math.imul(se,wt)|0,C=Math.imul(se,xt),k=k+Math.imul(te,_t)|0,g=g+Math.imul(te,At)|0,g=g+Math.imul(G,_t)|0,C=C+Math.imul(G,At)|0,k=k+Math.imul(Ne,Et)|0,g=g+Math.imul(Ne,St)|0,g=g+Math.imul(Xe,Et)|0,C=C+Math.imul(Xe,St)|0;var o0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(o0>>>26)|0,o0&=67108863,k=Math.imul(q,_t),g=Math.imul(q,At),g=g+Math.imul(se,_t)|0,C=Math.imul(se,At),k=k+Math.imul(te,Et)|0,g=g+Math.imul(te,St)|0,g=g+Math.imul(G,Et)|0,C=C+Math.imul(G,St)|0;var a0=(N+k|0)+((g&8191)<<13)|0;N=(C+(g>>>13)|0)+(a0>>>26)|0,a0&=67108863,k=Math.imul(q,Et),g=Math.imul(q,St),g=g+Math.imul(se,Et)|0,C=Math.imul(se,St);var c0=(N+k|0)+((g&8191)<<13)|0;return N=(C+(g>>>13)|0)+(c0>>>26)|0,c0&=67108863,I[0]=xs,I[1]=_s,I[2]=As,I[3]=Es,I[4]=Ss,I[5]=Cs,I[6]=ks,I[7]=Ts,I[8]=Zp,I[9]=Qp,I[10]=e0,I[11]=t0,I[12]=r0,I[13]=n0,I[14]=i0,I[15]=s0,I[16]=o0,I[17]=a0,I[18]=c0,N!==0&&(I[19]=N,m.length++),m},"comb10MulTo");Math.imul||(y=x);function _(b,u,p){p.negative=u.negative^b.negative,p.length=b.length+u.length;for(var m=0,w=0,S=0;S<p.length-1;S++){var I=w;w=0;for(var N=m&67108863,k=Math.min(S,u.length-1),g=Math.max(0,S-b.length+1);g<=k;g++){var C=S-g,Z=b.words[C]|0,V=u.words[g]|0,K=Z*V,fe=K&67108863;I=I+(K/67108864|0)|0,fe=fe+N|0,N=fe&67108863,I=I+(fe>>>26)|0,w+=I>>>26,I&=67108863}p.words[S]=N,m=I,I=w}return m!==0?p.words[S]=m:p.length--,p.strip()}o(_,"bigMulTo");function U(b,u,p){var m=new E;return m.mulp(b,u,p)}o(U,"jumboMulTo"),i.prototype.mulTo=o(function(u,p){var m,w=this.length+u.length;return this.length===10&&u.length===10?m=y(this,u,p):w<63?m=x(this,u,p):w<1024?m=_(this,u,p):m=U(this,u,p),m},"mulTo");function E(b,u){this.x=b,this.y=u}o(E,"FFTM"),E.prototype.makeRBT=o(function(u){for(var p=new Array(u),m=i.prototype._countBits(u)-1,w=0;w<u;w++)p[w]=this.revBin(w,m,u);return p},"makeRBT"),E.prototype.revBin=o(function(u,p,m){if(u===0||u===m-1)return u;for(var w=0,S=0;S<p;S++)w|=(u&1)<<p-S-1,u>>=1;return w},"revBin"),E.prototype.permute=o(function(u,p,m,w,S,I){for(var N=0;N<I;N++)w[N]=p[u[N]],S[N]=m[u[N]]},"permute"),E.prototype.transform=o(function(u,p,m,w,S,I){this.permute(I,u,p,m,w,S);for(var N=1;N<S;N<<=1)for(var k=N<<1,g=Math.cos(2*Math.PI/k),C=Math.sin(2*Math.PI/k),Z=0;Z<S;Z+=k)for(var V=g,K=C,fe=0;fe<N;fe++){var A=m[Z+fe],X=w[Z+fe],Q=m[Z+fe+N],P=w[Z+fe+N],O=V*Q-K*P;P=V*P+K*Q,Q=O,m[Z+fe]=A+Q,w[Z+fe]=X+P,m[Z+fe+N]=A-Q,w[Z+fe+N]=X-P,fe!==k&&(O=g*V-C*K,K=g*K+C*V,V=O)}},"transform"),E.prototype.guessLen13b=o(function(u,p){var m=Math.max(p,u)|1,w=m&1,S=0;for(m=m/2|0;m;m=m>>>1)S++;return 1<<S+1+w},"guessLen13b"),E.prototype.conjugate=o(function(u,p,m){if(!(m<=1))for(var w=0;w<m/2;w++){var S=u[w];u[w]=u[m-w-1],u[m-w-1]=S,S=p[w],p[w]=-p[m-w-1],p[m-w-1]=-S}},"conjugate"),E.prototype.normalize13b=o(function(u,p){for(var m=0,w=0;w<p/2;w++){var S=Math.round(u[2*w+1]/p)*8192+Math.round(u[2*w]/p)+m;u[w]=S&67108863,S<67108864?m=0:m=S/67108864|0}return u},"normalize13b"),E.prototype.convert13b=o(function(u,p,m,w){for(var S=0,I=0;I<p;I++)S=S+(u[I]|0),m[2*I]=S&8191,S=S>>>13,m[2*I+1]=S&8191,S=S>>>13;for(I=2*p;I<w;++I)m[I]=0;t(S===0),t((S&-8192)===0)},"convert13b"),E.prototype.stub=o(function(u){for(var p=new Array(u),m=0;m<u;m++)p[m]=0;return p},"stub"),E.prototype.mulp=o(function(u,p,m){var w=2*this.guessLen13b(u.length,p.length),S=this.makeRBT(w),I=this.stub(w),N=new Array(w),k=new Array(w),g=new Array(w),C=new Array(w),Z=new Array(w),V=new Array(w),K=m.words;K.length=w,this.convert13b(u.words,u.length,N,w),this.convert13b(p.words,p.length,C,w),this.transform(N,I,k,g,w,S),this.transform(C,I,Z,V,w,S);for(var fe=0;fe<w;fe++){var A=k[fe]*Z[fe]-g[fe]*V[fe];g[fe]=k[fe]*V[fe]+g[fe]*Z[fe],k[fe]=A}return this.conjugate(k,g,w),this.transform(k,g,K,I,w,S),this.conjugate(K,I,w),this.normalize13b(K,w),m.negative=u.negative^p.negative,m.length=u.length+p.length,m.strip()},"mulp"),i.prototype.mul=o(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),this.mulTo(u,p)},"mul"),i.prototype.mulf=o(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),U(this,u,p)},"mulf"),i.prototype.imul=o(function(u){return this.clone().mulTo(u,this)},"imul"),i.prototype.imuln=o(function(u){t(typeof u=="number"),t(u<67108864);for(var p=0,m=0;m<this.length;m++){var w=(this.words[m]|0)*u,S=(w&67108863)+(p&67108863);p>>=26,p+=w/67108864|0,p+=S>>>26,this.words[m]=S&67108863}return p!==0&&(this.words[m]=p,this.length++),this},"imuln"),i.prototype.muln=o(function(u){return this.clone().imuln(u)},"muln"),i.prototype.sqr=o(function(){return this.mul(this)},"sqr"),i.prototype.isqr=o(function(){return this.imul(this.clone())},"isqr"),i.prototype.pow=o(function(u){var p=v(u);if(p.length===0)return new i(1);for(var m=this,w=0;w<p.length&&p[w]===0;w++,m=m.sqr());if(++w<p.length)for(var S=m.sqr();w<p.length;w++,S=S.sqr())p[w]!==0&&(m=m.mul(S));return m},"pow"),i.prototype.iushln=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=67108863>>>26-p<<26-p,S;if(p!==0){var I=0;for(S=0;S<this.length;S++){var N=this.words[S]&w,k=(this.words[S]|0)-N<<p;this.words[S]=k|I,I=N>>>26-p}I&&(this.words[S]=I,this.length++)}if(m!==0){for(S=this.length-1;S>=0;S--)this.words[S+m]=this.words[S];for(S=0;S<m;S++)this.words[S]=0;this.length+=m}return this.strip()},"iushln"),i.prototype.ishln=o(function(u){return t(this.negative===0),this.iushln(u)},"ishln"),i.prototype.iushrn=o(function(u,p,m){t(typeof u=="number"&&u>=0);var w;p?w=(p-p%26)/26:w=0;var S=u%26,I=Math.min((u-S)/26,this.length),N=67108863^67108863>>>S<<S,k=m;if(w-=I,w=Math.max(0,w),k){for(var g=0;g<I;g++)k.words[g]=this.words[g];k.length=I}if(I!==0)if(this.length>I)for(this.length-=I,g=0;g<this.length;g++)this.words[g]=this.words[g+I];else this.words[0]=0,this.length=1;var C=0;for(g=this.length-1;g>=0&&(C!==0||g>=w);g--){var Z=this.words[g]|0;this.words[g]=C<<26-S|Z>>>S,C=Z&N}return k&&C!==0&&(k.words[k.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},"iushrn"),i.prototype.ishrn=o(function(u,p,m){return t(this.negative===0),this.iushrn(u,p,m)},"ishrn"),i.prototype.shln=o(function(u){return this.clone().ishln(u)},"shln"),i.prototype.ushln=o(function(u){return this.clone().iushln(u)},"ushln"),i.prototype.shrn=o(function(u){return this.clone().ishrn(u)},"shrn"),i.prototype.ushrn=o(function(u){return this.clone().iushrn(u)},"ushrn"),i.prototype.testn=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return!1;var S=this.words[m];return!!(S&w)},"testn"),i.prototype.imaskn=o(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(p!==0&&m++,this.length=Math.min(m,this.length),p!==0){var w=67108863^67108863>>>p<<p;this.words[this.length-1]&=w}return this.strip()},"imaskn"),i.prototype.maskn=o(function(u){return this.clone().imaskn(u)},"maskn"),i.prototype.iaddn=o(function(u){return t(typeof u=="number"),t(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},"iaddn"),i.prototype._iaddn=o(function(u){this.words[0]+=u;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},"_iaddn"),i.prototype.isubn=o(function(u){if(t(typeof u=="number"),t(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this.strip()},"isubn"),i.prototype.addn=o(function(u){return this.clone().iaddn(u)},"addn"),i.prototype.subn=o(function(u){return this.clone().isubn(u)},"subn"),i.prototype.iabs=o(function(){return this.negative=0,this},"iabs"),i.prototype.abs=o(function(){return this.clone().iabs()},"abs"),i.prototype._ishlnsubmul=o(function(u,p,m){var w=u.length+m,S;this._expand(w);var I,N=0;for(S=0;S<u.length;S++){I=(this.words[S+m]|0)+N;var k=(u.words[S]|0)*p;I-=k&67108863,N=(I>>26)-(k/67108864|0),this.words[S+m]=I&67108863}for(;S<this.length-m;S++)I=(this.words[S+m]|0)+N,N=I>>26,this.words[S+m]=I&67108863;if(N===0)return this.strip();for(t(N===-1),N=0,S=0;S<this.length;S++)I=-(this.words[S]|0)+N,N=I>>26,this.words[S]=I&67108863;return this.negative=1,this.strip()},"_ishlnsubmul"),i.prototype._wordDiv=o(function(u,p){var m=this.length-u.length,w=this.clone(),S=u,I=S.words[S.length-1]|0,N=this._countBits(I);m=26-N,m!==0&&(S=S.ushln(m),w.iushln(m),I=S.words[S.length-1]|0);var k=w.length-S.length,g;if(p!=="mod"){g=new i(null),g.length=k+1,g.words=new Array(g.length);for(var C=0;C<g.length;C++)g.words[C]=0}var Z=w.clone()._ishlnsubmul(S,1,k);Z.negative===0&&(w=Z,g&&(g.words[k]=1));for(var V=k-1;V>=0;V--){var K=(w.words[S.length+V]|0)*67108864+(w.words[S.length+V-1]|0);for(K=Math.min(K/I|0,67108863),w._ishlnsubmul(S,K,V);w.negative!==0;)K--,w.negative=0,w._ishlnsubmul(S,1,V),w.isZero()||(w.negative^=1);g&&(g.words[V]=K)}return g&&g.strip(),w.strip(),p!=="div"&&m!==0&&w.iushrn(m),{div:g||null,mod:w}},"_wordDiv"),i.prototype.divmod=o(function(u,p,m){if(t(!u.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var w,S,I;return this.negative!==0&&u.negative===0?(I=this.neg().divmod(u,p),p!=="mod"&&(w=I.div.neg()),p!=="div"&&(S=I.mod.neg(),m&&S.negative!==0&&S.iadd(u)),{div:w,mod:S}):this.negative===0&&u.negative!==0?(I=this.divmod(u.neg(),p),p!=="mod"&&(w=I.div.neg()),{div:w,mod:I.mod}):(this.negative&u.negative)!==0?(I=this.neg().divmod(u.neg(),p),p!=="div"&&(S=I.mod.neg(),m&&S.negative!==0&&S.isub(u)),{div:I.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new i(0),mod:this}:u.length===1?p==="div"?{div:this.divn(u.words[0]),mod:null}:p==="mod"?{div:null,mod:new i(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new i(this.modn(u.words[0]))}:this._wordDiv(u,p)},"divmod"),i.prototype.div=o(function(u){return this.divmod(u,"div",!1).div},"div"),i.prototype.mod=o(function(u){return this.divmod(u,"mod",!1).mod},"mod"),i.prototype.umod=o(function(u){return this.divmod(u,"mod",!0).mod},"umod"),i.prototype.divRound=o(function(u){var p=this.divmod(u);if(p.mod.isZero())return p.div;var m=p.div.negative!==0?p.mod.isub(u):p.mod,w=u.ushrn(1),S=u.andln(1),I=m.cmp(w);return I<0||S===1&&I===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},"divRound"),i.prototype.modn=o(function(u){t(u<=67108863);for(var p=(1<<26)%u,m=0,w=this.length-1;w>=0;w--)m=(p*m+(this.words[w]|0))%u;return m},"modn"),i.prototype.idivn=o(function(u){t(u<=67108863);for(var p=0,m=this.length-1;m>=0;m--){var w=(this.words[m]|0)+p*67108864;this.words[m]=w/u|0,p=w%u}return this.strip()},"idivn"),i.prototype.divn=o(function(u){return this.clone().idivn(u)},"divn"),i.prototype.egcd=o(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),I=new i(0),N=new i(1),k=0;p.isEven()&&m.isEven();)p.iushrn(1),m.iushrn(1),++k;for(var g=m.clone(),C=p.clone();!p.isZero();){for(var Z=0,V=1;(p.words[0]&V)===0&&Z<26;++Z,V<<=1);if(Z>0)for(p.iushrn(Z);Z-- >0;)(w.isOdd()||S.isOdd())&&(w.iadd(g),S.isub(C)),w.iushrn(1),S.iushrn(1);for(var K=0,fe=1;(m.words[0]&fe)===0&&K<26;++K,fe<<=1);if(K>0)for(m.iushrn(K);K-- >0;)(I.isOdd()||N.isOdd())&&(I.iadd(g),N.isub(C)),I.iushrn(1),N.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(I),S.isub(N)):(m.isub(p),I.isub(w),N.isub(S))}return{a:I,b:N,gcd:m.iushln(k)}},"egcd"),i.prototype._invmp=o(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),I=m.clone();p.cmpn(1)>0&&m.cmpn(1)>0;){for(var N=0,k=1;(p.words[0]&k)===0&&N<26;++N,k<<=1);if(N>0)for(p.iushrn(N);N-- >0;)w.isOdd()&&w.iadd(I),w.iushrn(1);for(var g=0,C=1;(m.words[0]&C)===0&&g<26;++g,C<<=1);if(g>0)for(m.iushrn(g);g-- >0;)S.isOdd()&&S.iadd(I),S.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(S)):(m.isub(p),S.isub(w))}var Z;return p.cmpn(1)===0?Z=w:Z=S,Z.cmpn(0)<0&&Z.iadd(u),Z},"_invmp"),i.prototype.gcd=o(function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var p=this.clone(),m=u.clone();p.negative=0,m.negative=0;for(var w=0;p.isEven()&&m.isEven();w++)p.iushrn(1),m.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;m.isEven();)m.iushrn(1);var S=p.cmp(m);if(S<0){var I=p;p=m,m=I}else if(S===0||m.cmpn(1)===0)break;p.isub(m)}while(!0);return m.iushln(w)},"gcd"),i.prototype.invm=o(function(u){return this.egcd(u).a.umod(u)},"invm"),i.prototype.isEven=o(function(){return(this.words[0]&1)===0},"isEven"),i.prototype.isOdd=o(function(){return(this.words[0]&1)===1},"isOdd"),i.prototype.andln=o(function(u){return this.words[0]&u},"andln"),i.prototype.bincn=o(function(u){t(typeof u=="number");var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return this._expand(m+1),this.words[m]|=w,this;for(var S=w,I=m;S!==0&&I<this.length;I++){var N=this.words[I]|0;N+=S,S=N>>>26,N&=67108863,this.words[I]=N}return S!==0&&(this.words[I]=S,this.length++),this},"bincn"),i.prototype.isZero=o(function(){return this.length===1&&this.words[0]===0},"isZero"),i.prototype.cmpn=o(function(u){var p=u<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this.strip();var m;if(this.length>1)m=1;else{p&&(u=-u),t(u<=67108863,"Number is too big");var w=this.words[0]|0;m=w===u?0:w<u?-1:1}return this.negative!==0?-m|0:m},"cmpn"),i.prototype.cmp=o(function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var p=this.ucmp(u);return this.negative!==0?-p|0:p},"cmp"),i.prototype.ucmp=o(function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var p=0,m=this.length-1;m>=0;m--){var w=this.words[m]|0,S=u.words[m]|0;if(w!==S){w<S?p=-1:w>S&&(p=1);break}}return p},"ucmp"),i.prototype.gtn=o(function(u){return this.cmpn(u)===1},"gtn"),i.prototype.gt=o(function(u){return this.cmp(u)===1},"gt"),i.prototype.gten=o(function(u){return this.cmpn(u)>=0},"gten"),i.prototype.gte=o(function(u){return this.cmp(u)>=0},"gte"),i.prototype.ltn=o(function(u){return this.cmpn(u)===-1},"ltn"),i.prototype.lt=o(function(u){return this.cmp(u)===-1},"lt"),i.prototype.lten=o(function(u){return this.cmpn(u)<=0},"lten"),i.prototype.lte=o(function(u){return this.cmp(u)<=0},"lte"),i.prototype.eqn=o(function(u){return this.cmpn(u)===0},"eqn"),i.prototype.eq=o(function(u){return this.cmp(u)===0},"eq"),i.red=o(function(u){return new R(u)},"red"),i.prototype.toRed=o(function(u){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},"toRed"),i.prototype.fromRed=o(function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),i.prototype._forceRed=o(function(u){return this.red=u,this},"_forceRed"),i.prototype.forceRed=o(function(u){return t(!this.red,"Already a number in reduction context"),this._forceRed(u)},"forceRed"),i.prototype.redAdd=o(function(u){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},"redAdd"),i.prototype.redIAdd=o(function(u){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},"redIAdd"),i.prototype.redSub=o(function(u){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},"redSub"),i.prototype.redISub=o(function(u){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},"redISub"),i.prototype.redShl=o(function(u){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},"redShl"),i.prototype.redMul=o(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},"redMul"),i.prototype.redIMul=o(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},"redIMul"),i.prototype.redSqr=o(function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),i.prototype.redISqr=o(function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),i.prototype.redSqrt=o(function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),i.prototype.redInvm=o(function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),i.prototype.redNeg=o(function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),i.prototype.redPow=o(function(u){return t(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)},"redPow");var L={k256:null,p224:null,p192:null,p25519:null};function H(b,u){this.name=b,this.p=new i(u,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(H,"MPrime"),H.prototype._tmp=o(function(){var u=new i(null);return u.words=new Array(Math.ceil(this.n/13)),u},"_tmp"),H.prototype.ireduce=o(function(u){var p=u,m;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),m=p.bitLength();while(m>this.n);var w=m<this.n?-1:p.ucmp(this.p);return w===0?(p.words[0]=0,p.length=1):w>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},"ireduce"),H.prototype.split=o(function(u,p){u.iushrn(this.n,0,p)},"split"),H.prototype.imulK=o(function(u){return u.imul(this.k)},"imulK");function F(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(F,"K256"),n(F,H),F.prototype.split=o(function(u,p){for(var m=4194303,w=Math.min(u.length,9),S=0;S<w;S++)p.words[S]=u.words[S];if(p.length=w,u.length<=9){u.words[0]=0,u.length=1;return}var I=u.words[9];for(p.words[p.length++]=I&m,S=10;S<u.length;S++){var N=u.words[S]|0;u.words[S-10]=(N&m)<<4|I>>>22,I=N}I>>>=22,u.words[S-10]=I,I===0&&u.length>10?u.length-=10:u.length-=9},"split"),F.prototype.imulK=o(function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var p=0,m=0;m<u.length;m++){var w=u.words[m]|0;p+=w*977,u.words[m]=p&67108863,p=w*64+(p/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u},"imulK");function j(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(j,"P224"),n(j,H);function D(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(D,"P192"),n(D,H);function B(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(B,"P25519"),n(B,H),B.prototype.imulK=o(function(u){for(var p=0,m=0;m<u.length;m++){var w=(u.words[m]|0)*19+p,S=w&67108863;w>>>=26,u.words[m]=S,p=w}return p!==0&&(u.words[u.length++]=p),u},"imulK"),i._prime=o(function(u){if(L[u])return L[u];var p;if(u==="k256")p=new F;else if(u==="p224")p=new j;else if(u==="p192")p=new D;else if(u==="p25519")p=new B;else throw new Error("Unknown prime "+u);return L[u]=p,p},"prime");function R(b){if(typeof b=="string"){var u=i._prime(b);this.m=u.p,this.prime=u}else t(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}o(R,"Red"),R.prototype._verify1=o(function(u){t(u.negative===0,"red works only with positives"),t(u.red,"red works only with red numbers")},"_verify1"),R.prototype._verify2=o(function(u,p){t((u.negative|p.negative)===0,"red works only with positives"),t(u.red&&u.red===p.red,"red works only with red numbers")},"_verify2"),R.prototype.imod=o(function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},"imod"),R.prototype.neg=o(function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},"neg"),R.prototype.add=o(function(u,p){this._verify2(u,p);var m=u.add(p);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},"add"),R.prototype.iadd=o(function(u,p){this._verify2(u,p);var m=u.iadd(p);return m.cmp(this.m)>=0&&m.isub(this.m),m},"iadd"),R.prototype.sub=o(function(u,p){this._verify2(u,p);var m=u.sub(p);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},"sub"),R.prototype.isub=o(function(u,p){this._verify2(u,p);var m=u.isub(p);return m.cmpn(0)<0&&m.iadd(this.m),m},"isub"),R.prototype.shl=o(function(u,p){return this._verify1(u),this.imod(u.ushln(p))},"shl"),R.prototype.imul=o(function(u,p){return this._verify2(u,p),this.imod(u.imul(p))},"imul"),R.prototype.mul=o(function(u,p){return this._verify2(u,p),this.imod(u.mul(p))},"mul"),R.prototype.isqr=o(function(u){return this.imul(u,u.clone())},"isqr"),R.prototype.sqr=o(function(u){return this.mul(u,u)},"sqr"),R.prototype.sqrt=o(function(u){if(u.isZero())return u.clone();var p=this.m.andln(3);if(t(p%2===1),p===3){var m=this.m.add(new i(1)).iushrn(2);return this.pow(u,m)}for(var w=this.m.subn(1),S=0;!w.isZero()&&w.andln(1)===0;)S++,w.iushrn(1);t(!w.isZero());var I=new i(1).toRed(this),N=I.redNeg(),k=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new i(2*g*g).toRed(this);this.pow(g,k).cmp(N)!==0;)g.redIAdd(N);for(var C=this.pow(g,w),Z=this.pow(u,w.addn(1).iushrn(1)),V=this.pow(u,w),K=S;V.cmp(I)!==0;){for(var fe=V,A=0;fe.cmp(I)!==0;A++)fe=fe.redSqr();t(A<K);var X=this.pow(C,new i(1).iushln(K-A-1));Z=Z.redMul(X),C=X.redSqr(),V=V.redMul(C),K=A}return Z},"sqrt"),R.prototype.invm=o(function(u){var p=u._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},"invm"),R.prototype.pow=o(function(u,p){if(p.isZero())return new i(1).toRed(this);if(p.cmpn(1)===0)return u.clone();var m=4,w=new Array(1<<m);w[0]=new i(1).toRed(this),w[1]=u;for(var S=2;S<w.length;S++)w[S]=this.mul(w[S-1],u);var I=w[0],N=0,k=0,g=p.bitLength()%26;for(g===0&&(g=26),S=p.length-1;S>=0;S--){for(var C=p.words[S],Z=g-1;Z>=0;Z--){var V=C>>Z&1;if(I!==w[0]&&(I=this.sqr(I)),V===0&&N===0){k=0;continue}N<<=1,N|=V,k++,!(k!==m&&(S!==0||Z!==0))&&(I=this.mul(I,w[N]),k=0,N=0)}g=26}return I},"pow"),R.prototype.convertTo=o(function(u){var p=u.umod(this.m);return p===u?p.clone():p},"convertTo"),R.prototype.convertFrom=o(function(u){var p=u.clone();return p.red=null,p},"convertFrom"),i.mont=o(function(u){return new Y(u)},"mont");function Y(b){R.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"Mont"),n(Y,R),Y.prototype.convertTo=o(function(u){return this.imod(u.ushln(this.shift))},"convertTo"),Y.prototype.convertFrom=o(function(u){var p=this.imod(u.mul(this.rinv));return p.red=null,p},"convertFrom"),Y.prototype.imul=o(function(u,p){if(u.isZero()||p.isZero())return u.words[0]=0,u.length=1,u;var m=u.imul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),I=S;return S.cmp(this.m)>=0?I=S.isub(this.m):S.cmpn(0)<0&&(I=S.iadd(this.m)),I._forceRed(this)},"imul"),Y.prototype.mul=o(function(u,p){if(u.isZero()||p.isZero())return new i(0)._forceRed(this);var m=u.mul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),I=S;return S.cmp(this.m)>=0?I=S.isub(this.m):S.cmpn(0)<0&&(I=S.iadd(this.m)),I._forceRed(this)},"mul"),Y.prototype.invm=o(function(u){var p=this.imod(u._invmp(this.m).mul(this.r2));return p._forceRed(this)},"invm")})(typeof nm=="undefined"||nm,Vv)});var no=de((bL,Jv)=>{Jv.exports=Gv;function Gv(r,e){if(!r)throw new Error(e||"Assertion failed")}o(Gv,"assert");Gv.equal=o(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual")});var im=de(Xv=>{"use strict";var Vh=Xv;function F9(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r!="string"){for(var n=0;n<r.length;n++)t[n]=r[n]|0;return t}if(e==="hex"){r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r);for(var n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var n=0;n<r.length;n++){var i=r.charCodeAt(n),s=i>>8,a=i&255;s?t.push(s,a):t.push(a)}return t}o(F9,"toArray");Vh.toArray=F9;function Wv(r){return r.length===1?"0"+r:r}o(Wv,"zero2");Vh.zero2=Wv;function Yv(r){for(var e="",t=0;t<r.length;t++)e+=Wv(r[t].toString(16));return e}o(Yv,"toHex");Vh.toHex=Yv;Vh.encode=o(function(e,t){return t==="hex"?Yv(e):e},"encode")});var rn=de(Zv=>{"use strict";var Vn=Zv,H9=_n(),q9=no(),Gh=im();Vn.assert=q9;Vn.toArray=Gh.toArray;Vn.zero2=Gh.zero2;Vn.toHex=Gh.toHex;Vn.encode=Gh.encode;function z9(r,e,t){var n=new Array(Math.max(r.bitLength(),t)+1);n.fill(0);for(var i=1<<e+1,s=r.clone(),a=0;a<n.length;a++){var c,f=s.andln(i-1);s.isOdd()?(f>(i>>1)-1?c=(i>>1)-f:c=f,s.isubn(c)):c=0,n[a]=c,s.iushrn(1)}return n}o(z9,"getNAF");Vn.getNAF=z9;function j9(r,e){var t=[[],[]];r=r.clone(),e=e.clone();for(var n=0,i=0,s;r.cmpn(-n)>0||e.cmpn(-i)>0;){var a=r.andln(3)+n&3,c=e.andln(3)+i&3;a===3&&(a=-1),c===3&&(c=-1);var f;(a&1)===0?f=0:(s=r.andln(7)+n&7,(s===3||s===5)&&c===2?f=-a:f=a),t[0].push(f);var l;(c&1)===0?l=0:(s=e.andln(7)+i&7,(s===3||s===5)&&a===2?l=-c:l=c),t[1].push(l),2*n===f+1&&(n=1-n),2*i===l+1&&(i=1-i),r.iushrn(1),e.iushrn(1)}return t}o(j9,"getJSF");Vn.getJSF=j9;function V9(r,e,t){var n="_"+e;r.prototype[e]=o(function(){return this[n]!==void 0?this[n]:this[n]=t.call(this)},"cachedProperty")}o(V9,"cachedProperty");Vn.cachedProperty=V9;function G9(r){return typeof r=="string"?Vn.toArray(r,"hex"):r}o(G9,"parseBytes");Vn.parseBytes=G9;function J9(r){return new H9(r,"hex","le")}o(J9,"intFromLE");Vn.intFromLE=J9});var cm=de((vL,am)=>{var sm;am.exports=o(function(e){return sm||(sm=new io(null)),sm.generate(e)},"rand");function io(r){this.rand=r}o(io,"Rand");am.exports.Rand=io;io.prototype.generate=o(function(e){return this._rand(e)},"generate");io.prototype._rand=o(function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"_rand");if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?io.prototype._rand=o(function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t},"_rand"):self.msCrypto&&self.msCrypto.getRandomValues?io.prototype._rand=o(function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t},"_rand"):typeof window=="object"&&(io.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(om=require("crypto"),typeof om.randomBytes!="function")throw new Error("Not supported");io.prototype._rand=o(function(e){return om.randomBytes(e)},"_rand")}catch(r){}var om});var mu=de((wL,Qv)=>{"use strict";var Xo=_n(),pu=rn(),Jh=pu.getNAF,W9=pu.getJSF,Wh=pu.assert;function so(r,e){this.type=r,this.p=new Xo(e.p,16),this.red=e.prime?Xo.red(e.prime):Xo.mont(this.p),this.zero=new Xo(0).toRed(this.red),this.one=new Xo(1).toRed(this.red),this.two=new Xo(2).toRed(this.red),this.n=e.n&&new Xo(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 t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(so,"BaseCurve");Qv.exports=so;so.prototype.point=o(function(){throw new Error("Not implemented")},"point");so.prototype.validate=o(function(){throw new Error("Not implemented")},"validate");so.prototype._fixedNafMul=o(function(e,t){Wh(e.precomputed);var n=e._getDoubles(),i=Jh(t,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var a=[],c,f;for(c=0;c<i.length;c+=n.step){f=0;for(var l=c+n.step-1;l>=c;l--)f=(f<<1)+i[l];a.push(f)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),v=s;v>0;v--){for(c=0;c<a.length;c++)f=a[c],f===v?d=d.mixedAdd(n.points[c]):f===-v&&(d=d.mixedAdd(n.points[c].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");so.prototype._wnafMul=o(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var s=i.points,a=Jh(t,n,this._bitLength),c=this.jpoint(null,null,null),f=a.length-1;f>=0;f--){for(var l=0;f>=0&&a[f]===0;f--)l++;if(f>=0&&l++,c=c.dblp(l),f<0)break;var h=a[f];Wh(h!==0),e.type==="affine"?h>0?c=c.mixedAdd(s[h-1>>1]):c=c.mixedAdd(s[-h-1>>1].neg()):h>0?c=c.add(s[h-1>>1]):c=c.add(s[-h-1>>1].neg())}return e.type==="affine"?c.toP():c},"_wnafMul");so.prototype._wnafMulAdd=o(function(e,t,n,i,s){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h,d,v;for(h=0;h<i;h++){v=t[h];var x=v._getNAFPoints(e);a[h]=x.wnd,c[h]=x.points}for(h=i-1;h>=1;h-=2){var y=h-1,_=h;if(a[y]!==1||a[_]!==1){f[y]=Jh(n[y],a[y],this._bitLength),f[_]=Jh(n[_],a[_],this._bitLength),l=Math.max(f[y].length,l),l=Math.max(f[_].length,l);continue}var U=[t[y],null,null,t[_]];t[y].y.cmp(t[_].y)===0?(U[1]=t[y].add(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg())):t[y].y.cmp(t[_].y.redNeg())===0?(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].add(t[_].neg())):(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],L=W9(n[y],n[_]);for(l=Math.max(L[0].length,l),f[y]=new Array(l),f[_]=new Array(l),d=0;d<l;d++){var H=L[0][d]|0,F=L[1][d]|0;f[y][d]=E[(H+1)*3+(F+1)],f[_][d]=0,c[y]=U}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var R=!0;for(d=0;d<i;d++)D[d]=f[d][h]|0,D[d]!==0&&(R=!1);if(!R)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?v=c[d][Y-1>>1]:Y<0&&(v=c[d][-Y-1>>1].neg()),v.type==="affine"?j=j.mixedAdd(v):j=j.add(v))}}for(h=0;h<i;h++)c[h]=null;return s?j:j.toP()},"_wnafMulAdd");function An(r,e){this.curve=r,this.type=e,this.precomputed=null}o(An,"BasePoint");so.BasePoint=An;An.prototype.eq=o(function(){throw new Error("Not implemented")},"eq");An.prototype.validate=o(function(){return this.curve.validate(this)},"validate");so.prototype.decodePoint=o(function(e,t){e=pu.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?Wh(e[e.length-1]%2===0):e[0]===7&&Wh(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");An.prototype.encodeCompressed=o(function(e){return this.encode(e,!0)},"encodeCompressed");An.prototype._encode=o(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");An.prototype.encode=o(function(e,t){return pu.encode(this._encode(t),e)},"encode");An.prototype.precompute=o(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");An.prototype._hasDoubles=o(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");An.prototype._getDoubles=o(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");An.prototype._getNAFPoints=o(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),s=1;s<n;s++)t[s]=t[s-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");An.prototype._getBeta=o(function(){return null},"_getBeta");An.prototype.dblp=o(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp")});var bu=de((xL,fm)=>{typeof Object.create=="function"?fm.exports=o(function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):fm.exports=o(function(e,t){if(t){e.super_=t;var n=o(function(){},"TempCtor");n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},"inherits")});var t2=de((_L,e2)=>{"use strict";var Y9=rn(),Nt=_n(),um=bu(),fc=mu(),X9=Y9.assert;function En(r){fc.call(this,"short",r),this.a=new Nt(r.a,16).toRed(this.red),this.b=new Nt(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}o(En,"ShortCurve");um(En,fc);e2.exports=En;En.prototype._getEndomorphism=o(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Nt(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new Nt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?n=s[0]:(n=s[1],X9(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(c){return{a:new Nt(c.a,16),b:new Nt(c.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");En.prototype._getEndoRoots=o(function(e){var t=e===this.p?this.red:Nt.mont(e),n=new Nt(2).toRed(t).redInvm(),i=n.redNeg(),s=new Nt(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[a,c]},"_getEndoRoots");En.prototype._getEndoBasis=o(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new Nt(1),a=new Nt(0),c=new Nt(0),f=new Nt(1),l,h,d,v,x,y,_,U=0,E,L;n.cmpn(0)!==0;){var H=i.div(n);E=i.sub(H.mul(n)),L=c.sub(H.mul(s));var F=f.sub(H.mul(a));if(!d&&E.cmp(t)<0)l=_.neg(),h=s,d=E.neg(),v=L;else if(d&&++U===2)break;_=E,i=n,n=E,c=s,s=L,f=a,a=F}x=E.neg(),y=L;var j=d.sqr().add(v.sqr()),D=x.sqr().add(y.sqr());return D.cmp(j)>=0&&(x=l,y=h),d.negative&&(d=d.neg(),v=v.neg()),x.negative&&(x=x.neg(),y=y.neg()),[{a:d,b:v},{a:x,b:y}]},"_getEndoBasis");En.prototype._endoSplit=o(function(e){var t=this.endo.basis,n=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),f=a.mul(i.a),l=s.mul(n.b),h=a.mul(i.b),d=e.sub(c).sub(f),v=l.add(h).neg();return{k1:d,k2:v}},"_endoSplit");En.prototype.pointFromX=o(function(e,t){e=new Nt(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");En.prototype.validate=o(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate");En.prototype._endoWnafMulAdd=o(function(e,t,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var c=this._endoSplit(t[a]),f=e[a],l=f._getBeta();c.k1.negative&&(c.k1.ineg(),f=f.neg(!0)),c.k2.negative&&(c.k2.ineg(),l=l.neg(!0)),i[a*2]=f,i[a*2+1]=l,s[a*2]=c.k1,s[a*2+1]=c.k2}for(var h=this._wnafMulAdd(1,i,s,a*2,n),d=0;d<a*2;d++)i[d]=null,s[d]=null;return h},"_endoWnafMulAdd");function Xt(r,e,t,n){fc.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Nt(e,16),this.y=new Nt(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(Xt,"Point");um(Xt,fc.BasePoint);En.prototype.point=o(function(e,t,n){return new Xt(this,e,t,n)},"point");En.prototype.pointFromJSON=o(function(e,t){return Xt.fromJSON(this,e,t)},"pointFromJSON");Xt.prototype._getBeta=o(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");Xt.prototype.toJSON=o(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]},"toJSON");Xt.fromJSON=o(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function s(c){return e.point(c[0],c[1],n)}o(s,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},"fromJSON");Xt.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");Xt.prototype.isInfinity=o(function(){return this.inf},"isInfinity");Xt.prototype.add=o(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");Xt.prototype.dbl=o(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},"dbl");Xt.prototype.getX=o(function(){return this.x.fromRed()},"getX");Xt.prototype.getY=o(function(){return this.y.fromRed()},"getY");Xt.prototype.mul=o(function(e){return e=new Nt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");Xt.prototype.mulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},"mulAdd");Xt.prototype.jmulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},"jmulAdd");Xt.prototype.eq=o(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");Xt.prototype.neg=o(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=o(function(s){return s.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");Xt.prototype.toJ=o(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function cr(r,e,t,n){fc.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Nt(0)):(this.x=new Nt(e,16),this.y=new Nt(t,16),this.z=new Nt(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(cr,"JPoint");um(cr,fc.BasePoint);En.prototype.jpoint=o(function(e,t,n){return new cr(this,e,t,n)},"jpoint");cr.prototype.toP=o(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");cr.prototype.neg=o(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");cr.prototype.add=o(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),f=i.redSub(s),l=a.redSub(c);if(f.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),d=h.redMul(f),v=i.redMul(h),x=l.redSqr().redIAdd(d).redISub(v).redISub(v),y=l.redMul(v.redISub(x)).redISub(a.redMul(d)),_=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(x,y,_)},"add");cr.prototype.mixedAdd=o(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),c=n.redSub(i),f=s.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),h=l.redMul(c),d=n.redMul(l),v=f.redSqr().redIAdd(h).redISub(d).redISub(d),x=f.redMul(d.redISub(v)).redISub(s.redMul(h)),y=this.z.redMul(c);return this.curve.jpoint(v,x,y)},"mixedAdd");cr.prototype.dblp=o(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,s=this.curve.tinv,a=this.x,c=this.y,f=this.z,l=f.redSqr().redSqr(),h=c.redAdd(c);for(t=0;t<e;t++){var d=a.redSqr(),v=h.redSqr(),x=v.redSqr(),y=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),_=a.redMul(v),U=y.redSqr().redISub(_.redAdd(_)),E=_.redISub(U),L=y.redMul(E);L=L.redIAdd(L).redISub(x);var H=h.redMul(f);t+1<e&&(l=l.redMul(x)),a=U,f=H,h=L}return this.curve.jpoint(a,h.redMul(s),f)},"dblp");cr.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");cr.prototype._zeroDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i),l=f.redSqr().redISub(c).redISub(c),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),v=this.y.redSqr(),x=v.redSqr(),y=this.x.redAdd(v).redSqr().redISub(d).redISub(x);y=y.redIAdd(y);var _=d.redAdd(d).redIAdd(d),U=_.redSqr(),E=x.redIAdd(x);E=E.redIAdd(E),E=E.redIAdd(E),e=U.redISub(y).redISub(y),t=_.redMul(y.redISub(e)).redISub(E),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");cr.prototype._threeDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=f.redSqr().redISub(c).redISub(c);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),v=this.y.redSqr(),x=this.x.redMul(v),y=this.x.redSub(d).redMul(this.x.redAdd(d));y=y.redAdd(y).redIAdd(y);var _=x.redIAdd(x);_=_.redIAdd(_);var U=_.redAdd(_);e=y.redSqr().redISub(U),n=this.y.redAdd(this.z).redSqr().redISub(v).redISub(d);var E=v.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E),t=y.redMul(_.redISub(e)).redISub(E)}return this.curve.jpoint(e,t,n)},"_threeDbl");cr.prototype._dbl=o(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,s=i.redSqr().redSqr(),a=t.redSqr(),c=n.redSqr(),f=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(c),d=f.redSqr().redISub(h.redAdd(h)),v=h.redISub(d),x=c.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=f.redMul(v).redISub(x),_=n.redAdd(n).redMul(i);return this.curve.jpoint(d,y,_)},"_dbl");cr.prototype.trpl=o(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),c=this.x.redAdd(t).redSqr().redISub(e).redISub(i);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(a);var f=c.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=s.redIAdd(c).redSqr().redISub(a).redISub(f).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var v=this.x.redMul(f).redISub(d);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.y.redMul(h.redMul(l.redISub(h)).redISub(c.redMul(f)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=this.z.redAdd(c).redSqr().redISub(n).redISub(f);return this.curve.jpoint(v,x,y)},"trpl");cr.prototype.mul=o(function(e,t){return e=new Nt(e,t),this.curve._wnafMul(this,e)},"mul");cr.prototype.eq=o(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),s=n.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");cr.prototype.eqXToP=o(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP");cr.prototype.inspect=o(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)+">"},"inspect");cr.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity")});var i2=de((AL,n2)=>{"use strict";var uc=_n(),r2=bu(),Yh=mu(),Z9=rn();function lc(r){Yh.call(this,"mont",r),this.a=new uc(r.a,16).toRed(this.red),this.b=new uc(r.b,16).toRed(this.red),this.i4=new uc(4).toRed(this.red).redInvm(),this.two=new uc(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}o(lc,"MontCurve");r2(lc,Yh);n2.exports=lc;lc.prototype.validate=o(function(e){var t=e.normalize().x,n=t.redSqr(),i=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t),s=i.redSqrt();return s.redSqr().cmp(i)===0},"validate");function Zt(r,e,t){Yh.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new uc(e,16),this.z=new uc(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(Zt,"Point");r2(Zt,Yh.BasePoint);lc.prototype.decodePoint=o(function(e,t){return this.point(Z9.toArray(e,t),1)},"decodePoint");lc.prototype.point=o(function(e,t){return new Zt(this,e,t)},"point");lc.prototype.pointFromJSON=o(function(e){return Zt.fromJSON(this,e)},"pointFromJSON");Zt.prototype.precompute=o(function(){},"precompute");Zt.prototype._encode=o(function(){return this.getX().toArray("be",this.curve.p.byteLength())},"_encode");Zt.fromJSON=o(function(e,t){return new Zt(e,t[0],t[1]||e.one)},"fromJSON");Zt.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");Zt.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity");Zt.prototype.dbl=o(function(){var e=this.x.redAdd(this.z),t=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),s=t.redSub(i),a=t.redMul(i),c=s.redMul(i.redAdd(this.curve.a24.redMul(s)));return this.curve.point(a,c)},"dbl");Zt.prototype.add=o(function(){throw new Error("Not supported on Montgomery curve")},"add");Zt.prototype.diffAdd=o(function(e,t){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),s=e.x.redAdd(e.z),a=e.x.redSub(e.z),c=a.redMul(n),f=s.redMul(i),l=t.z.redMul(c.redAdd(f).redSqr()),h=t.x.redMul(c.redISub(f).redSqr());return this.curve.point(l,h)},"diffAdd");Zt.prototype.mul=o(function(e){for(var t=e.clone(),n=this,i=this.curve.point(null,null),s=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var c=a.length-1;c>=0;c--)a[c]===0?(n=n.diffAdd(i,s),i=i.dbl()):(i=n.diffAdd(i,s),n=n.dbl());return i},"mul");Zt.prototype.mulAdd=o(function(){throw new Error("Not supported on Montgomery curve")},"mulAdd");Zt.prototype.jumlAdd=o(function(){throw new Error("Not supported on Montgomery curve")},"jumlAdd");Zt.prototype.eq=o(function(e){return this.getX().cmp(e.getX())===0},"eq");Zt.prototype.normalize=o(function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},"normalize");Zt.prototype.getX=o(function(){return this.normalize(),this.x.fromRed()},"getX")});var a2=de((EL,o2)=>{"use strict";var Q9=rn(),Zi=_n(),s2=bu(),Xh=mu(),e7=Q9.assert;function bi(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,Xh.call(this,"edwards",r),this.a=new Zi(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Zi(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Zi(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),e7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}o(bi,"EdwardsCurve");s2(bi,Xh);o2.exports=bi;bi.prototype._mulA=o(function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},"_mulA");bi.prototype._mulC=o(function(e){return this.oneC?e:this.c.redMul(e)},"_mulC");bi.prototype.jpoint=o(function(e,t,n,i){return this.point(e,t,n,i)},"jpoint");bi.prototype.pointFromX=o(function(e,t){e=new Zi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),s=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(s.redInvm()),c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var f=c.fromRed().isOdd();return(t&&!f||!t&&f)&&(c=c.redNeg()),this.point(e,c)},"pointFromX");bi.prototype.pointFromY=o(function(e,t){e=new Zi(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),s=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(s.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var c=a.redSqrt();if(c.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return c.fromRed().isOdd()!==t&&(c=c.redNeg()),this.point(c,e)},"pointFromY");bi.prototype.validate=o(function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),i=t.redMul(this.a).redAdd(n),s=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return i.cmp(s)===0},"validate");function ft(r,e,t,n,i){Xh.BasePoint.call(this,r,"projective"),e===null&&t===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Zi(e,16),this.y=new Zi(t,16),this.z=n?new Zi(n,16):this.curve.one,this.t=i&&new Zi(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(ft,"Point");s2(ft,Xh.BasePoint);bi.prototype.pointFromJSON=o(function(e){return ft.fromJSON(this,e)},"pointFromJSON");bi.prototype.point=o(function(e,t,n,i){return new ft(this,e,t,n,i)},"point");ft.fromJSON=o(function(e,t){return new ft(e,t[0],t[1],t[2])},"fromJSON");ft.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");ft.prototype.isInfinity=o(function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},"isInfinity");ft.prototype._extDbl=o(function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),c=a.redSub(n),f=i.redSub(t),l=s.redMul(c),h=a.redMul(f),d=s.redMul(f),v=c.redMul(a);return this.curve.point(l,h,v,d)},"_extDbl");ft.prototype._projDbl=o(function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),i,s,a,c,f,l;if(this.curve.twisted){c=this.curve._mulA(t);var h=c.redAdd(n);this.zOne?(i=e.redSub(t).redSub(n).redMul(h.redSub(this.curve.two)),s=h.redMul(c.redSub(n)),a=h.redSqr().redSub(h).redSub(h)):(f=this.z.redSqr(),l=h.redSub(f).redISub(f),i=e.redSub(t).redISub(n).redMul(l),s=h.redMul(c.redSub(n)),a=h.redMul(l))}else c=t.redAdd(n),f=this.curve._mulC(this.z).redSqr(),l=c.redSub(f).redSub(f),i=this.curve._mulC(e.redISub(c)).redMul(l),s=this.curve._mulC(c).redMul(t.redISub(n)),a=c.redMul(l);return this.curve.point(i,s,a)},"_projDbl");ft.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},"dbl");ft.prototype._extAdd=o(function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),c=s.redSub(i),f=s.redAdd(i),l=n.redAdd(t),h=a.redMul(c),d=f.redMul(l),v=a.redMul(l),x=c.redMul(f);return this.curve.point(h,d,x,v)},"_extAdd");ft.prototype._projAdd=o(function(e){var t=this.z.redMul(e.z),n=t.redSqr(),i=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(s),c=n.redSub(a),f=n.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(s),h=t.redMul(c).redMul(l),d,v;return this.curve.twisted?(d=t.redMul(f).redMul(s.redSub(this.curve._mulA(i))),v=c.redMul(f)):(d=t.redMul(f).redMul(s.redSub(i)),v=this.curve._mulC(c).redMul(f)),this.curve.point(h,d,v)},"_projAdd");ft.prototype.add=o(function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},"add");ft.prototype.mul=o(function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},"mul");ft.prototype.mulAdd=o(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},"mulAdd");ft.prototype.jmulAdd=o(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},"jmulAdd");ft.prototype.normalize=o(function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},"normalize");ft.prototype.neg=o(function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},"neg");ft.prototype.getX=o(function(){return this.normalize(),this.x.fromRed()},"getX");ft.prototype.getY=o(function(){return this.normalize(),this.y.fromRed()},"getY");ft.prototype.eq=o(function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},"eq");ft.prototype.eqXToP=o(function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),this.x.cmp(t)===0)return!0}},"eqXToP");ft.prototype.toP=ft.prototype.normalize;ft.prototype.mixedAdd=ft.prototype.add});var lm=de(c2=>{"use strict";var Zh=c2;Zh.base=mu();Zh.short=t2();Zh.mont=i2();Zh.edwards=a2()});var Gn=de(at=>{"use strict";var t7=no(),r7=bu();at.inherits=r7;function n7(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}o(n7,"isSurrogatePair");function i7(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),i=0;i<r.length;i+=2)t.push(parseInt(r[i]+r[i+1],16))}else for(var n=0,i=0;i<r.length;i++){var s=r.charCodeAt(i);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):n7(r,i)?(s=65536+((s&1023)<<10)+(r.charCodeAt(++i)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}else for(i=0;i<r.length;i++)t[i]=r[i]|0;return t}o(i7,"toArray");at.toArray=i7;function s7(r){for(var e="",t=0;t<r.length;t++)e+=u2(r[t].toString(16));return e}o(s7,"toHex");at.toHex=s7;function f2(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}o(f2,"htonl");at.htonl=f2;function o7(r,e){for(var t="",n=0;n<r.length;n++){var i=r[n];e==="little"&&(i=f2(i)),t+=l2(i.toString(16))}return t}o(o7,"toHex32");at.toHex32=o7;function u2(r){return r.length===1?"0"+r:r}o(u2,"zero2");at.zero2=u2;function l2(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}o(l2,"zero8");at.zero8=l2;function a7(r,e,t,n){var i=t-e;t7(i%4===0);for(var s=new Array(i/4),a=0,c=e;a<s.length;a++,c+=4){var f;n==="big"?f=r[c]<<24|r[c+1]<<16|r[c+2]<<8|r[c+3]:f=r[c+3]<<24|r[c+2]<<16|r[c+1]<<8|r[c],s[a]=f>>>0}return s}o(a7,"join32");at.join32=a7;function c7(r,e){for(var t=new Array(r.length*4),n=0,i=0;n<r.length;n++,i+=4){var s=r[n];e==="big"?(t[i]=s>>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}o(c7,"split32");at.split32=c7;function f7(r,e){return r>>>e|r<<32-e}o(f7,"rotr32");at.rotr32=f7;function u7(r,e){return r<<e|r>>>32-e}o(u7,"rotl32");at.rotl32=u7;function l7(r,e){return r+e>>>0}o(l7,"sum32");at.sum32=l7;function h7(r,e,t){return r+e+t>>>0}o(h7,"sum32_3");at.sum32_3=h7;function d7(r,e,t,n){return r+e+t+n>>>0}o(d7,"sum32_4");at.sum32_4=d7;function p7(r,e,t,n,i){return r+e+t+n+i>>>0}o(p7,"sum32_5");at.sum32_5=p7;function m7(r,e,t,n){var i=r[e],s=r[e+1],a=n+s>>>0,c=(a<n?1:0)+t+i;r[e]=c>>>0,r[e+1]=a}o(m7,"sum64");at.sum64=m7;function b7(r,e,t,n){var i=e+n>>>0,s=(i<e?1:0)+r+t;return s>>>0}o(b7,"sum64_hi");at.sum64_hi=b7;function g7(r,e,t,n){var i=e+n;return i>>>0}o(g7,"sum64_lo");at.sum64_lo=g7;function y7(r,e,t,n,i,s,a,c){var f=0,l=e;l=l+n>>>0,f+=l<e?1:0,l=l+s>>>0,f+=l<s?1:0,l=l+c>>>0,f+=l<c?1:0;var h=r+t+i+a+f;return h>>>0}o(y7,"sum64_4_hi");at.sum64_4_hi=y7;function v7(r,e,t,n,i,s,a,c){var f=e+n+s+c;return f>>>0}o(v7,"sum64_4_lo");at.sum64_4_lo=v7;function w7(r,e,t,n,i,s,a,c,f,l){var h=0,d=e;d=d+n>>>0,h+=d<e?1:0,d=d+s>>>0,h+=d<s?1:0,d=d+c>>>0,h+=d<c?1:0,d=d+l>>>0,h+=d<l?1:0;var v=r+t+i+a+f+h;return v>>>0}o(w7,"sum64_5_hi");at.sum64_5_hi=w7;function x7(r,e,t,n,i,s,a,c,f,l){var h=e+n+s+c+l;return h>>>0}o(x7,"sum64_5_lo");at.sum64_5_lo=x7;function _7(r,e,t){var n=e<<32-t|r>>>t;return n>>>0}o(_7,"rotr64_hi");at.rotr64_hi=_7;function A7(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}o(A7,"rotr64_lo");at.rotr64_lo=A7;function E7(r,e,t){return r>>>t}o(E7,"shr64_hi");at.shr64_hi=E7;function S7(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}o(S7,"shr64_lo");at.shr64_lo=S7});var hc=de(d2=>{"use strict";var h2=Gn(),C7=no();function Qh(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}o(Qh,"BlockHash");d2.BlockHash=Qh;Qh.prototype.update=o(function(e,t){if(e=h2.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=h2.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},"update");Qh.prototype.digest=o(function(e){return this.update(this._pad()),C7(this.pending===null),this._digest(e)},"digest");Qh.prototype._pad=o(function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,i=new Array(n+this.padLength);i[0]=128;for(var s=1;s<n;s++)i[s]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)i[s++]=0;i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=e>>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,a=8;a<this.padLength;a++)i[s++]=0;return i},"pad")});var hm=de(Qi=>{"use strict";var k7=Gn(),gi=k7.rotr32;function T7(r,e,t,n){if(r===0)return p2(e,t,n);if(r===1||r===3)return b2(e,t,n);if(r===2)return m2(e,t,n)}o(T7,"ft_1");Qi.ft_1=T7;function p2(r,e,t){return r&e^~r&t}o(p2,"ch32");Qi.ch32=p2;function m2(r,e,t){return r&e^r&t^e&t}o(m2,"maj32");Qi.maj32=m2;function b2(r,e,t){return r^e^t}o(b2,"p32");Qi.p32=b2;function M7(r){return gi(r,2)^gi(r,13)^gi(r,22)}o(M7,"s0_256");Qi.s0_256=M7;function B7(r){return gi(r,6)^gi(r,11)^gi(r,25)}o(B7,"s1_256");Qi.s1_256=B7;function N7(r){return gi(r,7)^gi(r,18)^r>>>3}o(N7,"g0_256");Qi.g0_256=N7;function I7(r){return gi(r,17)^gi(r,19)^r>>>10}o(I7,"g1_256");Qi.g1_256=I7});var v2=de((ML,y2)=>{"use strict";var dc=Gn(),O7=hc(),P7=hm(),dm=dc.rotl32,gu=dc.sum32,R7=dc.sum32_5,U7=P7.ft_1,g2=O7.BlockHash,L7=[1518500249,1859775393,2400959708,3395469782];function yi(){if(!(this instanceof yi))return new yi;g2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}o(yi,"SHA1");dc.inherits(yi,g2);y2.exports=yi;yi.blockSize=512;yi.outSize=160;yi.hmacStrength=80;yi.padLength=64;yi.prototype._update=o(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=dm(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var s=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],l=this.h[4];for(i=0;i<n.length;i++){var h=~~(i/20),d=R7(dm(s,5),U7(h,a,c,f),l,n[i],L7[h]);l=f,f=c,c=dm(a,30),a=s,s=d}this.h[0]=gu(this.h[0],s),this.h[1]=gu(this.h[1],a),this.h[2]=gu(this.h[2],c),this.h[3]=gu(this.h[3],f),this.h[4]=gu(this.h[4],l)},"_update");yi.prototype._digest=o(function(e){return e==="hex"?dc.toHex32(this.h,"big"):dc.split32(this.h,"big")},"digest")});var pm=de((BL,x2)=>{"use strict";var pc=Gn(),D7=hc(),mc=hm(),K7=no(),Jn=pc.sum32,$7=pc.sum32_4,F7=pc.sum32_5,H7=mc.ch32,q7=mc.maj32,z7=mc.s0_256,j7=mc.s1_256,V7=mc.g0_256,G7=mc.g1_256,w2=D7.BlockHash,J7=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function vi(){if(!(this instanceof vi))return new vi;w2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=J7,this.W=new Array(64)}o(vi,"SHA256");pc.inherits(vi,w2);x2.exports=vi;vi.blockSize=512;vi.outSize=256;vi.hmacStrength=192;vi.padLength=64;vi.prototype._update=o(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=$7(G7(n[i-2]),n[i-7],V7(n[i-15]),n[i-16]);var s=this.h[0],a=this.h[1],c=this.h[2],f=this.h[3],l=this.h[4],h=this.h[5],d=this.h[6],v=this.h[7];for(K7(this.k.length===n.length),i=0;i<n.length;i++){var x=F7(v,j7(l),H7(l,h,d),this.k[i],n[i]),y=Jn(z7(s),q7(s,a,c));v=d,d=h,h=l,l=Jn(f,x),f=c,c=a,a=s,s=Jn(x,y)}this.h[0]=Jn(this.h[0],s),this.h[1]=Jn(this.h[1],a),this.h[2]=Jn(this.h[2],c),this.h[3]=Jn(this.h[3],f),this.h[4]=Jn(this.h[4],l),this.h[5]=Jn(this.h[5],h),this.h[6]=Jn(this.h[6],d),this.h[7]=Jn(this.h[7],v)},"_update");vi.prototype._digest=o(function(e){return e==="hex"?pc.toHex32(this.h,"big"):pc.split32(this.h,"big")},"digest")});var E2=de((NL,A2)=>{"use strict";var mm=Gn(),_2=pm();function es(){if(!(this instanceof es))return new es;_2.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}o(es,"SHA224");mm.inherits(es,_2);A2.exports=es;es.blockSize=512;es.outSize=224;es.hmacStrength=192;es.padLength=64;es.prototype._digest=o(function(e){return e==="hex"?mm.toHex32(this.h.slice(0,7),"big"):mm.split32(this.h.slice(0,7),"big")},"digest")});var ym=de((IL,T2)=>{"use strict";var Fr=Gn(),W7=hc(),Y7=no(),wi=Fr.rotr64_hi,xi=Fr.rotr64_lo,S2=Fr.shr64_hi,C2=Fr.shr64_lo,oo=Fr.sum64,bm=Fr.sum64_hi,gm=Fr.sum64_lo,X7=Fr.sum64_4_hi,Z7=Fr.sum64_4_lo,Q7=Fr.sum64_5_hi,eC=Fr.sum64_5_lo,k2=W7.BlockHash,tC=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Wn(){if(!(this instanceof Wn))return new Wn;k2.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=tC,this.W=new Array(160)}o(Wn,"SHA512");Fr.inherits(Wn,k2);T2.exports=Wn;Wn.blockSize=1024;Wn.outSize=512;Wn.hmacStrength=192;Wn.padLength=128;Wn.prototype._prepareBlock=o(function(e,t){for(var n=this.W,i=0;i<32;i++)n[i]=e[t+i];for(;i<n.length;i+=2){var s=hC(n[i-4],n[i-3]),a=dC(n[i-4],n[i-3]),c=n[i-14],f=n[i-13],l=uC(n[i-30],n[i-29]),h=lC(n[i-30],n[i-29]),d=n[i-32],v=n[i-31];n[i]=X7(s,a,c,f,l,h,d,v),n[i+1]=Z7(s,a,c,f,l,h,d,v)}},"_prepareBlock");Wn.prototype._update=o(function(e,t){this._prepareBlock(e,t);var n=this.W,i=this.h[0],s=this.h[1],a=this.h[2],c=this.h[3],f=this.h[4],l=this.h[5],h=this.h[6],d=this.h[7],v=this.h[8],x=this.h[9],y=this.h[10],_=this.h[11],U=this.h[12],E=this.h[13],L=this.h[14],H=this.h[15];Y7(this.k.length===n.length);for(var F=0;F<n.length;F+=2){var j=L,D=H,B=cC(v,x),R=fC(v,x),Y=rC(v,x,y,_,U,E),b=nC(v,x,y,_,U,E),u=this.k[F],p=this.k[F+1],m=n[F],w=n[F+1],S=Q7(j,D,B,R,Y,b,u,p,m,w),I=eC(j,D,B,R,Y,b,u,p,m,w);j=oC(i,s),D=aC(i,s),B=iC(i,s,a,c,f,l),R=sC(i,s,a,c,f,l);var N=bm(j,D,B,R),k=gm(j,D,B,R);L=U,H=E,U=y,E=_,y=v,_=x,v=bm(h,d,S,I),x=gm(d,d,S,I),h=f,d=l,f=a,l=c,a=i,c=s,i=bm(S,I,N,k),s=gm(S,I,N,k)}oo(this.h,0,i,s),oo(this.h,2,a,c),oo(this.h,4,f,l),oo(this.h,6,h,d),oo(this.h,8,v,x),oo(this.h,10,y,_),oo(this.h,12,U,E),oo(this.h,14,L,H)},"_update");Wn.prototype._digest=o(function(e){return e==="hex"?Fr.toHex32(this.h,"big"):Fr.split32(this.h,"big")},"digest");function rC(r,e,t,n,i){var s=r&t^~r&i;return s<0&&(s+=4294967296),s}o(rC,"ch64_hi");function nC(r,e,t,n,i,s){var a=e&n^~e&s;return a<0&&(a+=4294967296),a}o(nC,"ch64_lo");function iC(r,e,t,n,i){var s=r&t^r&i^t&i;return s<0&&(s+=4294967296),s}o(iC,"maj64_hi");function sC(r,e,t,n,i,s){var a=e&n^e&s^n&s;return a<0&&(a+=4294967296),a}o(sC,"maj64_lo");function oC(r,e){var t=wi(r,e,28),n=wi(e,r,2),i=wi(e,r,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(oC,"s0_512_hi");function aC(r,e){var t=xi(r,e,28),n=xi(e,r,2),i=xi(e,r,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(aC,"s0_512_lo");function cC(r,e){var t=wi(r,e,14),n=wi(r,e,18),i=wi(e,r,9),s=t^n^i;return s<0&&(s+=4294967296),s}o(cC,"s1_512_hi");function fC(r,e){var t=xi(r,e,14),n=xi(r,e,18),i=xi(e,r,9),s=t^n^i;return s<0&&(s+=4294967296),s}o(fC,"s1_512_lo");function uC(r,e){var t=wi(r,e,1),n=wi(r,e,8),i=S2(r,e,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(uC,"g0_512_hi");function lC(r,e){var t=xi(r,e,1),n=xi(r,e,8),i=C2(r,e,7),s=t^n^i;return s<0&&(s+=4294967296),s}o(lC,"g0_512_lo");function hC(r,e){var t=wi(r,e,19),n=wi(e,r,29),i=S2(r,e,6),s=t^n^i;return s<0&&(s+=4294967296),s}o(hC,"g1_512_hi");function dC(r,e){var t=xi(r,e,19),n=xi(e,r,29),i=C2(r,e,6),s=t^n^i;return s<0&&(s+=4294967296),s}o(dC,"g1_512_lo")});var N2=de((OL,B2)=>{"use strict";var vm=Gn(),M2=ym();function ts(){if(!(this instanceof ts))return new ts;M2.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}o(ts,"SHA384");vm.inherits(ts,M2);B2.exports=ts;ts.blockSize=1024;ts.outSize=384;ts.hmacStrength=192;ts.padLength=128;ts.prototype._digest=o(function(e){return e==="hex"?vm.toHex32(this.h.slice(0,12),"big"):vm.split32(this.h.slice(0,12),"big")},"digest")});var I2=de(bc=>{"use strict";bc.sha1=v2();bc.sha224=E2();bc.sha256=pm();bc.sha384=N2();bc.sha512=ym()});var D2=de(L2=>{"use strict";var Zo=Gn(),pC=hc(),ed=Zo.rotl32,O2=Zo.sum32,yu=Zo.sum32_3,P2=Zo.sum32_4,U2=pC.BlockHash;function _i(){if(!(this instanceof _i))return new _i;U2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}o(_i,"RIPEMD160");Zo.inherits(_i,U2);L2.ripemd160=_i;_i.blockSize=512;_i.outSize=160;_i.hmacStrength=192;_i.padLength=64;_i.prototype._update=o(function(e,t){for(var n=this.h[0],i=this.h[1],s=this.h[2],a=this.h[3],c=this.h[4],f=n,l=i,h=s,d=a,v=c,x=0;x<80;x++){var y=O2(ed(P2(n,R2(x,i,s,a),e[gC[x]+t],mC(x)),vC[x]),c);n=c,c=a,a=ed(s,10),s=i,i=y,y=O2(ed(P2(f,R2(79-x,l,h,d),e[yC[x]+t],bC(x)),wC[x]),v),f=v,v=d,d=ed(h,10),h=l,l=y}y=yu(this.h[1],s,d),this.h[1]=yu(this.h[2],a,v),this.h[2]=yu(this.h[3],c,f),this.h[3]=yu(this.h[4],n,l),this.h[4]=yu(this.h[0],i,h),this.h[0]=y},"update");_i.prototype._digest=o(function(e){return e==="hex"?Zo.toHex32(this.h,"little"):Zo.split32(this.h,"little")},"digest");function R2(r,e,t,n){return r<=15?e^t^n:r<=31?e&t|~e&n:r<=47?(e|~t)^n:r<=63?e&n|t&~n:e^(t|~n)}o(R2,"f");function mC(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}o(mC,"K");function bC(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}o(bC,"Kh");var gC=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],yC=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],vC=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],wC=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var $2=de((UL,K2)=>{"use strict";var xC=Gn(),_C=no();function gc(r,e,t){if(!(this instanceof gc))return new gc(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(xC.toArray(e,t))}o(gc,"Hmac");K2.exports=gc;gc.prototype._init=o(function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),_C(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},"init");gc.prototype.update=o(function(e,t){return this.inner.update(e,t),this},"update");gc.prototype.digest=o(function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},"digest")});var vu=de(F2=>{var fr=F2;fr.utils=Gn();fr.common=hc();fr.sha=I2();fr.ripemd=D2();fr.hmac=$2();fr.sha1=fr.sha.sha1;fr.sha256=fr.sha.sha256;fr.sha224=fr.sha.sha224;fr.sha384=fr.sha.sha384;fr.sha512=fr.sha.sha512;fr.ripemd160=fr.ripemd.ripemd160});var q2=de((DL,H2)=>{H2.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var td=de(V2=>{"use strict";var xm=V2,ao=vu(),wm=lm(),AC=rn(),z2=AC.assert;function j2(r){r.type==="short"?this.curve=new wm.short(r):r.type==="edwards"?this.curve=new wm.edwards(r):this.curve=new wm.mont(r),this.g=this.curve.g,this.n=this.curve.n,this.hash=r.hash,z2(this.g.validate(),"Invalid curve"),z2(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(j2,"PresetCurve");xm.PresetCurve=j2;function co(r,e){Object.defineProperty(xm,r,{configurable:!0,enumerable:!0,get:function(){var t=new j2(e);return Object.defineProperty(xm,r,{configurable:!0,enumerable:!0,value:t}),t}})}o(co,"defineCurve");co("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:ao.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});co("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:ao.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});co("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:ao.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});co("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:ao.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"]});co("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:ao.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"]});co("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ao.sha256,gRed:!1,g:["9"]});co("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:ao.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var _m;try{_m=q2()}catch(r){_m=void 0}co("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:ao.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",_m]})});var W2=de(($L,J2)=>{"use strict";var EC=vu(),Qo=im(),G2=no();function fo(r){if(!(this instanceof fo))return new fo(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Qo.toArray(r.entropy,r.entropyEnc||"hex"),t=Qo.toArray(r.nonce,r.nonceEnc||"hex"),n=Qo.toArray(r.pers,r.persEnc||"hex");G2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}o(fo,"HmacDRBG");J2.exports=fo;fo.prototype._init=o(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");fo.prototype._hmac=o(function(){return new EC.hmac(this.hash,this.K)},"hmac");fo.prototype._update=o(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");fo.prototype.reseed=o(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=Qo.toArray(e,t),n=Qo.toArray(n,i),G2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");fo.prototype.generate=o(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=Qo.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(n),this._reseed++,Qo.encode(a,t)},"generate")});var X2=de((FL,Y2)=>{"use strict";var SC=_n(),CC=rn(),Am=CC.assert;function yr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}o(yr,"KeyPair");Y2.exports=yr;yr.fromPublic=o(function(e,t,n){return t instanceof yr?t:new yr(e,{pub:t,pubEnc:n})},"fromPublic");yr.fromPrivate=o(function(e,t,n){return t instanceof yr?t:new yr(e,{priv:t,privEnc:n})},"fromPrivate");yr.prototype.validate=o(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");yr.prototype.getPublic=o(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");yr.prototype.getPrivate=o(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");yr.prototype._importPrivate=o(function(e,t){this.priv=new SC(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");yr.prototype._importPublic=o(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Am(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Am(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");yr.prototype.derive=o(function(e){return e.validate()||Am(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");yr.prototype.sign=o(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");yr.prototype.verify=o(function(e,t){return this.ec.verify(e,t,this)},"verify");yr.prototype.inspect=o(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect")});var ew=de((HL,Q2)=>{"use strict";var rd=_n(),Cm=rn(),kC=Cm.assert;function nd(r,e){if(r instanceof nd)return r;this._importDER(r,e)||(kC(r.r&&r.s,"Signature without r or s"),this.r=new rd(r.r,16),this.s=new rd(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}o(nd,"Signature");Q2.exports=nd;function TC(){this.place=0}o(TC,"Position");function Em(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s<n;s++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}o(Em,"getLength");function Z2(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}o(Z2,"rmPadding");nd.prototype._importDER=o(function(e,t){e=Cm.toArray(e,t);var n=new TC;if(e[n.place++]!==48)return!1;var i=Em(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var s=Em(e,n);if(s===!1)return!1;var a=e.slice(n.place,s+n.place);if(n.place+=s,e[n.place++]!==2)return!1;var c=Em(e,n);if(c===!1||e.length!==c+n.place)return!1;var f=e.slice(n.place,c+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;return this.r=new rd(a),this.s=new rd(f),this.recoveryParam=null,!0},"_importDER");function Sm(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}o(Sm,"constructLength");nd.prototype.toDER=o(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=Z2(t),n=Z2(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Sm(i,t.length),i=i.concat(t),i.push(2),Sm(i,n.length);var s=i.concat(n),a=[48];return Sm(a,s.length),a=a.concat(s),Cm.encode(a,e)},"toDER")});var iw=de((qL,nw)=>{"use strict";var ea=_n(),tw=W2(),MC=rn(),km=td(),BC=cm(),rw=MC.assert,Tm=X2(),id=ew();function Sn(r){if(!(this instanceof Sn))return new Sn(r);typeof r=="string"&&(rw(Object.prototype.hasOwnProperty.call(km,r),"Unknown curve "+r),r=km[r]),r instanceof km.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}o(Sn,"EC");nw.exports=Sn;Sn.prototype.keyPair=o(function(e){return new Tm(this,e)},"keyPair");Sn.prototype.keyFromPrivate=o(function(e,t){return Tm.fromPrivate(this,e,t)},"keyFromPrivate");Sn.prototype.keyFromPublic=o(function(e,t){return Tm.fromPublic(this,e,t)},"keyFromPublic");Sn.prototype.genKeyPair=o(function(e){e||(e={});for(var t=new tw({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||BC(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ea(2));;){var s=new ea(t.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair");Sn.prototype._truncateToN=o(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Sn.prototype.sign=o(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new ea(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),f=new tw({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new ea(1)),h=0;;h++){var d=i.k?i.k(h):new ea(f.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var v=this.g.mul(d);if(!v.isInfinity()){var x=v.getX(),y=x.umod(this.n);if(y.cmpn(0)!==0){var _=d.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),_.cmpn(0)!==0){var U=(v.getY().isOdd()?1:0)|(x.cmp(y)!==0?2:0);return i.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),U^=1),new id({r:y,s:_,recoveryParam:U})}}}}}},"sign");Sn.prototype.verify=o(function(e,t,n,i){e=this._truncateToN(new ea(e,16)),n=this.keyFromPublic(n,i),t=new id(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(e).umod(this.n),l=c.mul(s).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(s)):(h=this.g.mulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(s)===0)},"verify");Sn.prototype.recoverPubKey=function(r,e,t,n){rw((3&t)===t,"The recovery param is more than two bits"),e=new id(e,n);var i=this.n,s=new ea(r),a=e.r,c=e.s,f=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var h=e.r.invm(i),d=i.sub(s).mul(h).umod(i),v=c.mul(h).umod(i);return this.g.mulAdd(d,a,v)};Sn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new id(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(r,e,i)}catch(a){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")}});var cw=de((zL,aw)=>{"use strict";var wu=rn(),ow=wu.assert,sw=wu.parseBytes,yc=wu.cachedProperty;function Qt(r,e){this.eddsa=r,this._secret=sw(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=sw(e.pub)}o(Qt,"KeyPair");Qt.fromPublic=o(function(e,t){return t instanceof Qt?t:new Qt(e,{pub:t})},"fromPublic");Qt.fromSecret=o(function(e,t){return t instanceof Qt?t:new Qt(e,{secret:t})},"fromSecret");Qt.prototype.secret=o(function(){return this._secret},"secret");yc(Qt,"pubBytes",o(function(){return this.eddsa.encodePoint(this.pub())},"pubBytes"));yc(Qt,"pub",o(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())},"pub"));yc(Qt,"privBytes",o(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i},"privBytes"));yc(Qt,"priv",o(function(){return this.eddsa.decodeInt(this.privBytes())},"priv"));yc(Qt,"hash",o(function(){return this.eddsa.hash().update(this.secret()).digest()},"hash"));yc(Qt,"messagePrefix",o(function(){return this.hash().slice(this.eddsa.encodingLength)},"messagePrefix"));Qt.prototype.sign=o(function(e){return ow(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},"sign");Qt.prototype.verify=o(function(e,t){return this.eddsa.verify(e,t,this)},"verify");Qt.prototype.getSecret=o(function(e){return ow(this._secret,"KeyPair is public only"),wu.encode(this.secret(),e)},"getSecret");Qt.prototype.getPublic=o(function(e){return wu.encode(this.pubBytes(),e)},"getPublic");aw.exports=Qt});var uw=de((jL,fw)=>{"use strict";var NC=_n(),sd=rn(),IC=sd.assert,od=sd.cachedProperty,OC=sd.parseBytes;function ta(r,e){this.eddsa=r,typeof e!="object"&&(e=OC(e)),Array.isArray(e)&&(e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),IC(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof NC&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}o(ta,"Signature");od(ta,"S",o(function(){return this.eddsa.decodeInt(this.Sencoded())},"S"));od(ta,"R",o(function(){return this.eddsa.decodePoint(this.Rencoded())},"R"));od(ta,"Rencoded",o(function(){return this.eddsa.encodePoint(this.R())},"Rencoded"));od(ta,"Sencoded",o(function(){return this.eddsa.encodeInt(this.S())},"Sencoded"));ta.prototype.toBytes=o(function(){return this.Rencoded().concat(this.Sencoded())},"toBytes");ta.prototype.toHex=o(function(){return sd.encode(this.toBytes(),"hex").toUpperCase()},"toHex");fw.exports=ta});var mw=de((VL,pw)=>{"use strict";var PC=vu(),RC=td(),vc=rn(),UC=vc.assert,hw=vc.parseBytes,dw=cw(),lw=uw();function Hr(r){if(UC(r==="ed25519","only tested with ed25519 so far"),!(this instanceof Hr))return new Hr(r);r=RC[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=PC.sha512}o(Hr,"EDDSA");pw.exports=Hr;Hr.prototype.sign=o(function(e,t){e=hw(e);var n=this.keyFromSecret(t),i=this.hashInt(n.messagePrefix(),e),s=this.g.mul(i),a=this.encodePoint(s),c=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),f=i.add(c).umod(this.curve.n);return this.makeSignature({R:s,S:f,Rencoded:a})},"sign");Hr.prototype.verify=o(function(e,t,n){e=hw(e),t=this.makeSignature(t);var i=this.keyFromPublic(n),s=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S()),c=t.R().add(i.pub().mul(s));return c.eq(a)},"verify");Hr.prototype.hashInt=o(function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return vc.intFromLE(e.digest()).umod(this.curve.n)},"hashInt");Hr.prototype.keyFromPublic=o(function(e){return dw.fromPublic(this,e)},"keyFromPublic");Hr.prototype.keyFromSecret=o(function(e){return dw.fromSecret(this,e)},"keyFromSecret");Hr.prototype.makeSignature=o(function(e){return e instanceof lw?e:new lw(this,e)},"makeSignature");Hr.prototype.encodePoint=o(function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},"encodePoint");Hr.prototype.decodePoint=o(function(e){e=vc.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),i=(e[t]&128)!==0,s=vc.intFromLE(n);return this.curve.pointFromY(s,i)},"decodePoint");Hr.prototype.encodeInt=o(function(e){return e.toArray("le",this.encodingLength)},"encodeInt");Hr.prototype.decodeInt=o(function(e){return vc.intFromLE(e)},"decodeInt");Hr.prototype.isPoint=o(function(e){return e instanceof this.pointClass},"isPoint")});var gw=de(bw=>{"use strict";var ra=bw;ra.version=zv().version;ra.utils=rn();ra.rand=cm();ra.curve=lm();ra.curves=td();ra.ec=iw();ra.eddsa=mw()});var vw=de(Mm=>{"use strict";Object.defineProperty(Mm,"__esModule",{value:!0});var yw=65536,LC=function(){function r(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self!="undefined"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return o(r,"BrowserRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),n=0;n<t.length;n+=yw)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,yw)));return t},r}();Mm.BrowserRandomSource=LC});var ww=de(Bm=>{"use strict";Object.defineProperty(Bm,"__esModule",{value:!0});var DC=xn(),KC=function(){function r(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof require!="undefined"){var e=require("crypto");e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return o(r,"NodeRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var n=new Uint8Array(e),i=0;i<n.length;i++)n[i]=t[i];return DC.wipe(t),n},r}();Bm.NodeRandomSource=KC});var xw=de(Nm=>{"use strict";Object.defineProperty(Nm,"__esModule",{value:!0});var $C=vw(),FC=ww(),HC=function(){function r(){if(this.isAvailable=!1,this.name="",this._source=new $C.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new FC.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return o(r,"SystemRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},r}();Nm.SystemRandomSource=HC});var wc=de(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:!0});var qC=xw(),zC=Yo(),_w=xn();Yn.defaultRandomSource=new qC.SystemRandomSource;function Im(r,e){return e===void 0&&(e=Yn.defaultRandomSource),e.randomBytes(r)}o(Im,"randomBytes");Yn.randomBytes=Im;function jC(r){r===void 0&&(r=Yn.defaultRandomSource);var e=Im(4,r),t=zC.readUint32LE(e);return _w.wipe(e),t}o(jC,"randomUint32");Yn.randomUint32=jC;var Aw="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function Ew(r,e,t){if(e===void 0&&(e=Aw),t===void 0&&(t=Yn.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var n="",i=e.length,s=256-256%i;r>0;){for(var a=Im(Math.ceil(r*256/s),t),c=0;c<a.length&&r>0;c++){var f=a[c];f<s&&(n+=e.charAt(f%i),r--)}_w.wipe(a)}return n}o(Ew,"randomString");Yn.randomString=Ew;function VC(r,e,t){e===void 0&&(e=Aw),t===void 0&&(t=Yn.defaultRandomSource);var n=Math.ceil(r/(Math.log(e.length)/Math.LN2));return Ew(n,e,t)}o(VC,"randomStringForEntropy");Yn.randomStringForEntropy=VC});var kw=de(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});var _c=Yo(),xc=xn();rs.DIGEST_LENGTH=64;rs.BLOCK_SIZE=128;var Cw=function(){function r(){this.digestLength=rs.DIGEST_LENGTH,this.blockSize=rs.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return o(r,"SHA512"),r.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){xc.wipe(this._buffer),xc.wipe(this._tempHi),xc.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<rs.BLOCK_SIZE&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(Om(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=Om(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,s=t<<3,a=t%128<112?128:256;this._buffer[n]=128;for(var c=n+1;c<a-8;c++)this._buffer[c]=0;_c.writeUint32BE(i,this._buffer,a-8),_c.writeUint32BE(s,this._buffer,a-4),Om(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,a),this._finished=!0}for(var c=0;c<this.digestLength/8;c++)_c.writeUint32BE(this._stateHi[c],e,c*8),_c.writeUint32BE(this._stateLo[c],e,c*8+4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){xc.wipe(e.stateHi),xc.wipe(e.stateLo),e.buffer&&xc.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();rs.SHA512=Cw;var Sw=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function Om(r,e,t,n,i,s,a){for(var c=t[0],f=t[1],l=t[2],h=t[3],d=t[4],v=t[5],x=t[6],y=t[7],_=n[0],U=n[1],E=n[2],L=n[3],H=n[4],F=n[5],j=n[6],D=n[7],B,R,Y,b,u,p,m,w;a>=128;){for(var S=0;S<16;S++){var I=8*S+s;r[S]=_c.readUint32BE(i,I),e[S]=_c.readUint32BE(i,I+4)}for(var S=0;S<80;S++){var N=c,k=f,g=l,C=h,Z=d,V=v,K=x,fe=y,A=_,X=U,Q=E,P=L,O=H,z=F,W=j,re=D;if(B=y,R=D,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=(d>>>14|H<<32-14)^(d>>>18|H<<32-18)^(H>>>41-32|d<<32-(41-32)),R=(H>>>14|d<<32-14)^(H>>>18|d<<32-18)^(d>>>41-32|H<<32-(41-32)),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=d&v^~d&x,R=H&F^~H&j,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=Sw[S*2],R=Sw[S*2+1],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=r[S%16],R=e[S%16],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,Y=m&65535|w<<16,b=u&65535|p<<16,B=Y,R=b,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=(c>>>28|_<<32-28)^(_>>>34-32|c<<32-(34-32))^(_>>>39-32|c<<32-(39-32)),R=(_>>>28|c<<32-28)^(c>>>34-32|_<<32-(34-32))^(c>>>39-32|_<<32-(39-32)),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,B=c&f^c&l^f&l,R=_&U^_&E^U&E,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,fe=m&65535|w<<16,re=u&65535|p<<16,B=C,R=P,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=Y,R=b,u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,C=m&65535|w<<16,P=u&65535|p<<16,f=N,l=k,h=g,d=C,v=Z,x=V,y=K,c=fe,U=A,E=X,L=Q,H=P,F=O,j=z,D=W,_=re,S%16===15)for(var I=0;I<16;I++)B=r[I],R=e[I],u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=r[(I+9)%16],R=e[(I+9)%16],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,Y=r[(I+1)%16],b=e[(I+1)%16],B=(Y>>>1|b<<32-1)^(Y>>>8|b<<32-8)^Y>>>7,R=(b>>>1|Y<<32-1)^(b>>>8|Y<<32-8)^(b>>>7|Y<<32-7),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,Y=r[(I+14)%16],b=e[(I+14)%16],B=(Y>>>19|b<<32-19)^(b>>>61-32|Y<<32-(61-32))^Y>>>6,R=(b>>>19|Y<<32-19)^(Y>>>61-32|b<<32-(61-32))^(b>>>6|Y<<32-6),u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,r[I]=m&65535|w<<16,e[I]=u&65535|p<<16}B=c,R=_,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[0],R=n[0],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[0]=c=m&65535|w<<16,n[0]=_=u&65535|p<<16,B=f,R=U,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[1],R=n[1],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[1]=f=m&65535|w<<16,n[1]=U=u&65535|p<<16,B=l,R=E,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[2],R=n[2],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[2]=l=m&65535|w<<16,n[2]=E=u&65535|p<<16,B=h,R=L,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[3],R=n[3],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[3]=h=m&65535|w<<16,n[3]=L=u&65535|p<<16,B=d,R=H,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[4],R=n[4],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[4]=d=m&65535|w<<16,n[4]=H=u&65535|p<<16,B=v,R=F,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[5],R=n[5],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[5]=v=m&65535|w<<16,n[5]=F=u&65535|p<<16,B=x,R=j,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[6],R=n[6],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[6]=x=m&65535|w<<16,n[6]=j=u&65535|p<<16,B=y,R=D,u=R&65535,p=R>>>16,m=B&65535,w=B>>>16,B=t[7],R=n[7],u+=R&65535,p+=R>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[7]=y=m&65535|w<<16,n[7]=D=u&65535|p<<16,s+=128,a-=128}return s}o(Om,"hashBlocks");function GC(r){var e=new Cw;e.update(r);var t=e.digest();return e.clean(),t}o(GC,"hash");rs.hash=GC});var ad=de(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});var JC=wc(),xu=kw(),Iw=xn();Jt.SIGNATURE_LENGTH=64;Jt.PUBLIC_KEY_LENGTH=32;Jt.SECRET_KEY_LENGTH=64;Jt.SEED_LENGTH=32;function Te(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}o(Te,"gf");var WC=new Uint8Array(32);WC[0]=9;var Um=Te(),Ac=Te([1]),YC=Te([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),XC=Te([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Tw=Te([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Mw=Te([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),ZC=Te([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function uo(r,e){for(var t=0;t<16;t++)r[t]=e[t]|0}o(uo,"set25519");function Pm(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}o(Pm,"car25519");function Ow(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var s=n&(r[i]^e[i]);r[i]^=s,e[i]^=s}}o(Ow,"sel25519");function _u(r,e){for(var t=Te(),n=Te(),i=0;i<16;i++)n[i]=e[i];Pm(n),Pm(n),Pm(n);for(var s=0;s<2;s++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,Ow(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}o(_u,"pack25519");function Pw(r,e){for(var t=0,n=0;n<32;n++)t|=r[n]^e[n];return(1&t-1>>>8)-1}o(Pw,"verify32");function Bw(r,e){var t=new Uint8Array(32),n=new Uint8Array(32);return _u(t,r),_u(n,e),Pw(t,n)}o(Bw,"neq25519");function Rw(r){var e=new Uint8Array(32);return _u(e,r),e[0]&1}o(Rw,"par25519");function QC(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(QC,"unpack25519");function na(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}o(na,"add");function sa(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}o(sa,"sub");function ot(r,e,t){var n,i,s=0,a=0,c=0,f=0,l=0,h=0,d=0,v=0,x=0,y=0,_=0,U=0,E=0,L=0,H=0,F=0,j=0,D=0,B=0,R=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,I=0,N=0,k=0,g=0,C=t[0],Z=t[1],V=t[2],K=t[3],fe=t[4],A=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],W=t[11],re=t[12],le=t[13],oe=t[14],J=t[15];n=e[0],s+=n*C,a+=n*Z,c+=n*V,f+=n*K,l+=n*fe,h+=n*A,d+=n*X,v+=n*Q,x+=n*P,y+=n*O,_+=n*z,U+=n*W,E+=n*re,L+=n*le,H+=n*oe,F+=n*J,n=e[1],a+=n*C,c+=n*Z,f+=n*V,l+=n*K,h+=n*fe,d+=n*A,v+=n*X,x+=n*Q,y+=n*P,_+=n*O,U+=n*z,E+=n*W,L+=n*re,H+=n*le,F+=n*oe,j+=n*J,n=e[2],c+=n*C,f+=n*Z,l+=n*V,h+=n*K,d+=n*fe,v+=n*A,x+=n*X,y+=n*Q,_+=n*P,U+=n*O,E+=n*z,L+=n*W,H+=n*re,F+=n*le,j+=n*oe,D+=n*J,n=e[3],f+=n*C,l+=n*Z,h+=n*V,d+=n*K,v+=n*fe,x+=n*A,y+=n*X,_+=n*Q,U+=n*P,E+=n*O,L+=n*z,H+=n*W,F+=n*re,j+=n*le,D+=n*oe,B+=n*J,n=e[4],l+=n*C,h+=n*Z,d+=n*V,v+=n*K,x+=n*fe,y+=n*A,_+=n*X,U+=n*Q,E+=n*P,L+=n*O,H+=n*z,F+=n*W,j+=n*re,D+=n*le,B+=n*oe,R+=n*J,n=e[5],h+=n*C,d+=n*Z,v+=n*V,x+=n*K,y+=n*fe,_+=n*A,U+=n*X,E+=n*Q,L+=n*P,H+=n*O,F+=n*z,j+=n*W,D+=n*re,B+=n*le,R+=n*oe,Y+=n*J,n=e[6],d+=n*C,v+=n*Z,x+=n*V,y+=n*K,_+=n*fe,U+=n*A,E+=n*X,L+=n*Q,H+=n*P,F+=n*O,j+=n*z,D+=n*W,B+=n*re,R+=n*le,Y+=n*oe,b+=n*J,n=e[7],v+=n*C,x+=n*Z,y+=n*V,_+=n*K,U+=n*fe,E+=n*A,L+=n*X,H+=n*Q,F+=n*P,j+=n*O,D+=n*z,B+=n*W,R+=n*re,Y+=n*le,b+=n*oe,u+=n*J,n=e[8],x+=n*C,y+=n*Z,_+=n*V,U+=n*K,E+=n*fe,L+=n*A,H+=n*X,F+=n*Q,j+=n*P,D+=n*O,B+=n*z,R+=n*W,Y+=n*re,b+=n*le,u+=n*oe,p+=n*J,n=e[9],y+=n*C,_+=n*Z,U+=n*V,E+=n*K,L+=n*fe,H+=n*A,F+=n*X,j+=n*Q,D+=n*P,B+=n*O,R+=n*z,Y+=n*W,b+=n*re,u+=n*le,p+=n*oe,m+=n*J,n=e[10],_+=n*C,U+=n*Z,E+=n*V,L+=n*K,H+=n*fe,F+=n*A,j+=n*X,D+=n*Q,B+=n*P,R+=n*O,Y+=n*z,b+=n*W,u+=n*re,p+=n*le,m+=n*oe,w+=n*J,n=e[11],U+=n*C,E+=n*Z,L+=n*V,H+=n*K,F+=n*fe,j+=n*A,D+=n*X,B+=n*Q,R+=n*P,Y+=n*O,b+=n*z,u+=n*W,p+=n*re,m+=n*le,w+=n*oe,S+=n*J,n=e[12],E+=n*C,L+=n*Z,H+=n*V,F+=n*K,j+=n*fe,D+=n*A,B+=n*X,R+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*W,m+=n*re,w+=n*le,S+=n*oe,I+=n*J,n=e[13],L+=n*C,H+=n*Z,F+=n*V,j+=n*K,D+=n*fe,B+=n*A,R+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*W,w+=n*re,S+=n*le,I+=n*oe,N+=n*J,n=e[14],H+=n*C,F+=n*Z,j+=n*V,D+=n*K,B+=n*fe,R+=n*A,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*W,S+=n*re,I+=n*le,N+=n*oe,k+=n*J,n=e[15],F+=n*C,j+=n*Z,D+=n*V,B+=n*K,R+=n*fe,Y+=n*A,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*W,I+=n*re,N+=n*le,k+=n*oe,g+=n*J,s+=38*j,a+=38*D,c+=38*B,f+=38*R,l+=38*Y,h+=38*b,d+=38*u,v+=38*p,x+=38*m,y+=38*w,_+=38*S,U+=38*I,E+=38*N,L+=38*k,H+=38*g,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),r[0]=s,r[1]=a,r[2]=c,r[3]=f,r[4]=l,r[5]=h,r[6]=d,r[7]=v,r[8]=x,r[9]=y,r[10]=_,r[11]=U,r[12]=E,r[13]=L,r[14]=H,r[15]=F}o(ot,"mul");function ia(r,e){ot(r,e,e)}o(ia,"square");function Uw(r,e){var t=Te(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=253;n>=0;n--)ia(t,t),n!==2&&n!==4&&ot(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}o(Uw,"inv25519");function ek(r,e){var t=Te(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=250;n>=0;n--)ia(t,t),n!==1&&ot(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}o(ek,"pow2523");function Lm(r,e){var t=Te(),n=Te(),i=Te(),s=Te(),a=Te(),c=Te(),f=Te(),l=Te(),h=Te();sa(t,r[1],r[0]),sa(h,e[1],e[0]),ot(t,t,h),na(n,r[0],r[1]),na(h,e[0],e[1]),ot(n,n,h),ot(i,r[3],e[3]),ot(i,i,XC),ot(s,r[2],e[2]),na(s,s,s),sa(a,n,t),sa(c,s,i),na(f,s,i),na(l,n,t),ot(r[0],a,c),ot(r[1],l,f),ot(r[2],f,c),ot(r[3],a,l)}o(Lm,"edadd");function Nw(r,e,t){for(var n=0;n<4;n++)Ow(r[n],e[n],t)}o(Nw,"cswap");function Km(r,e){var t=Te(),n=Te(),i=Te();Uw(i,e[2]),ot(t,e[0],i),ot(n,e[1],i),_u(r,n),r[31]^=Rw(t)<<7}o(Km,"pack");function Lw(r,e,t){uo(r[0],Um),uo(r[1],Ac),uo(r[2],Ac),uo(r[3],Um);for(var n=255;n>=0;--n){var i=t[n/8|0]>>(n&7)&1;Nw(r,e,i),Lm(e,r),Lm(r,r),Nw(r,e,i)}}o(Lw,"scalarmult");function $m(r,e){var t=[Te(),Te(),Te(),Te()];uo(t[0],Tw),uo(t[1],Mw),uo(t[2],Ac),ot(t[3],Tw,Mw),Lw(r,t,e)}o($m,"scalarbase");function Dw(r){if(r.length!==Jt.SEED_LENGTH)throw new Error("ed25519: seed must be "+Jt.SEED_LENGTH+" bytes");var e=xu.hash(r);e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(32),n=[Te(),Te(),Te(),Te()];$m(n,e),Km(t,n);var i=new Uint8Array(64);return i.set(r),i.set(t,32),{publicKey:t,secretKey:i}}o(Dw,"generateKeyPairFromSeed");Jt.generateKeyPairFromSeed=Dw;function tk(r){var e=JC.randomBytes(32,r),t=Dw(e);return Iw.wipe(e),t}o(tk,"generateKeyPair");Jt.generateKeyPair=tk;function rk(r){if(r.length!==Jt.SECRET_KEY_LENGTH)throw new Error("ed25519: secret key must be "+Jt.SECRET_KEY_LENGTH+" bytes");return new Uint8Array(r.subarray(32))}o(rk,"extractPublicKeyFromSecretKey");Jt.extractPublicKeyFromSecretKey=rk;var Rm=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Kw(r,e){var t,n,i,s;for(n=63;n>=32;--n){for(t=0,i=n-32,s=n-12;i<s;++i)e[i]+=t-16*e[n]*Rm[i-(n-32)],t=Math.floor((e[i]+128)/256),e[i]-=t*256;e[i]+=t,e[n]=0}for(t=0,i=0;i<32;i++)e[i]+=t-(e[31]>>4)*Rm[i],t=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=t*Rm[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,r[n]=e[n]&255}o(Kw,"modL");function Dm(r){for(var e=new Float64Array(64),t=0;t<64;t++)e[t]=r[t];for(var t=0;t<64;t++)r[t]=0;Kw(r,e)}o(Dm,"reduce");function nk(r,e){var t=new Float64Array(64),n=[Te(),Te(),Te(),Te()],i=xu.hash(r.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;var s=new Uint8Array(64);s.set(i.subarray(32),32);var a=new xu.SHA512;a.update(s.subarray(32)),a.update(e);var c=a.digest();a.clean(),Dm(c),$m(n,c),Km(s,n),a.reset(),a.update(s.subarray(0,32)),a.update(r.subarray(32)),a.update(e);var f=a.digest();Dm(f);for(var l=0;l<32;l++)t[l]=c[l];for(var l=0;l<32;l++)for(var h=0;h<32;h++)t[l+h]+=f[l]*i[h];return Kw(s.subarray(32),t),s}o(nk,"sign");Jt.sign=nk;function $w(r,e){var t=Te(),n=Te(),i=Te(),s=Te(),a=Te(),c=Te(),f=Te();return uo(r[2],Ac),QC(r[1],e),ia(i,r[1]),ot(s,i,YC),sa(i,i,r[2]),na(s,r[2],s),ia(a,s),ia(c,a),ot(f,c,a),ot(t,f,i),ot(t,t,s),ek(t,t),ot(t,t,i),ot(t,t,s),ot(t,t,s),ot(r[0],t,s),ia(n,r[0]),ot(n,n,s),Bw(n,i)&&ot(r[0],r[0],ZC),ia(n,r[0]),ot(n,n,s),Bw(n,i)?-1:(Rw(r[0])===e[31]>>7&&sa(r[0],Um,r[0]),ot(r[3],r[0],r[1]),0)}o($w,"unpackneg");function ik(r,e,t){var n=new Uint8Array(32),i=[Te(),Te(),Te(),Te()],s=[Te(),Te(),Te(),Te()];if(t.length!==Jt.SIGNATURE_LENGTH)throw new Error("ed25519: signature must be "+Jt.SIGNATURE_LENGTH+" bytes");if($w(s,r))return!1;var a=new xu.SHA512;a.update(t.subarray(0,32)),a.update(r),a.update(e);var c=a.digest();return Dm(c),Lw(i,s,c),$m(s,t.subarray(32)),Lm(i,s),Km(n,i),!Pw(t,n)}o(ik,"verify");Jt.verify=ik;function sk(r){var e=[Te(),Te(),Te(),Te()];if($w(e,r))throw new Error("Ed25519: invalid public key");var t=Te(),n=Te(),i=e[1];na(t,Ac,i),sa(n,Ac,i),Uw(n,n),ot(t,t,n);var s=new Uint8Array(32);return _u(s,t),s}o(sk,"convertPublicKeyToX25519");Jt.convertPublicKeyToX25519=sk;function ok(r){var e=xu.hash(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(e.subarray(0,32));return Iw.wipe(e),t}o(ok,"convertSecretKeyToX25519");Jt.convertSecretKeyToX25519=ok});var Hw=de((eD,Fw)=>{"use strict";Fw.exports=o(function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{let s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;let s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"},"serialize")});var Vw=de(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});var ak=wc(),ck=xn();qr.PUBLIC_KEY_LENGTH=32;qr.SECRET_KEY_LENGTH=32;qr.SHARED_KEY_LENGTH=32;function Ai(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}o(Ai,"gf");var qw=new Uint8Array(32);qw[0]=9;var fk=Ai([56129,1]);function Fm(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}o(Fm,"car25519");function Au(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var s=n&(r[i]^e[i]);r[i]^=s,e[i]^=s}}o(Au,"sel25519");function uk(r,e){for(var t=Ai(),n=Ai(),i=0;i<16;i++)n[i]=e[i];Fm(n),Fm(n),Fm(n);for(var s=0;s<2;s++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,Au(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}o(uk,"pack25519");function lk(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}o(lk,"unpack25519");function cd(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}o(cd,"add");function fd(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}o(fd,"sub");function ns(r,e,t){var n,i,s=0,a=0,c=0,f=0,l=0,h=0,d=0,v=0,x=0,y=0,_=0,U=0,E=0,L=0,H=0,F=0,j=0,D=0,B=0,R=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,I=0,N=0,k=0,g=0,C=t[0],Z=t[1],V=t[2],K=t[3],fe=t[4],A=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],W=t[11],re=t[12],le=t[13],oe=t[14],J=t[15];n=e[0],s+=n*C,a+=n*Z,c+=n*V,f+=n*K,l+=n*fe,h+=n*A,d+=n*X,v+=n*Q,x+=n*P,y+=n*O,_+=n*z,U+=n*W,E+=n*re,L+=n*le,H+=n*oe,F+=n*J,n=e[1],a+=n*C,c+=n*Z,f+=n*V,l+=n*K,h+=n*fe,d+=n*A,v+=n*X,x+=n*Q,y+=n*P,_+=n*O,U+=n*z,E+=n*W,L+=n*re,H+=n*le,F+=n*oe,j+=n*J,n=e[2],c+=n*C,f+=n*Z,l+=n*V,h+=n*K,d+=n*fe,v+=n*A,x+=n*X,y+=n*Q,_+=n*P,U+=n*O,E+=n*z,L+=n*W,H+=n*re,F+=n*le,j+=n*oe,D+=n*J,n=e[3],f+=n*C,l+=n*Z,h+=n*V,d+=n*K,v+=n*fe,x+=n*A,y+=n*X,_+=n*Q,U+=n*P,E+=n*O,L+=n*z,H+=n*W,F+=n*re,j+=n*le,D+=n*oe,B+=n*J,n=e[4],l+=n*C,h+=n*Z,d+=n*V,v+=n*K,x+=n*fe,y+=n*A,_+=n*X,U+=n*Q,E+=n*P,L+=n*O,H+=n*z,F+=n*W,j+=n*re,D+=n*le,B+=n*oe,R+=n*J,n=e[5],h+=n*C,d+=n*Z,v+=n*V,x+=n*K,y+=n*fe,_+=n*A,U+=n*X,E+=n*Q,L+=n*P,H+=n*O,F+=n*z,j+=n*W,D+=n*re,B+=n*le,R+=n*oe,Y+=n*J,n=e[6],d+=n*C,v+=n*Z,x+=n*V,y+=n*K,_+=n*fe,U+=n*A,E+=n*X,L+=n*Q,H+=n*P,F+=n*O,j+=n*z,D+=n*W,B+=n*re,R+=n*le,Y+=n*oe,b+=n*J,n=e[7],v+=n*C,x+=n*Z,y+=n*V,_+=n*K,U+=n*fe,E+=n*A,L+=n*X,H+=n*Q,F+=n*P,j+=n*O,D+=n*z,B+=n*W,R+=n*re,Y+=n*le,b+=n*oe,u+=n*J,n=e[8],x+=n*C,y+=n*Z,_+=n*V,U+=n*K,E+=n*fe,L+=n*A,H+=n*X,F+=n*Q,j+=n*P,D+=n*O,B+=n*z,R+=n*W,Y+=n*re,b+=n*le,u+=n*oe,p+=n*J,n=e[9],y+=n*C,_+=n*Z,U+=n*V,E+=n*K,L+=n*fe,H+=n*A,F+=n*X,j+=n*Q,D+=n*P,B+=n*O,R+=n*z,Y+=n*W,b+=n*re,u+=n*le,p+=n*oe,m+=n*J,n=e[10],_+=n*C,U+=n*Z,E+=n*V,L+=n*K,H+=n*fe,F+=n*A,j+=n*X,D+=n*Q,B+=n*P,R+=n*O,Y+=n*z,b+=n*W,u+=n*re,p+=n*le,m+=n*oe,w+=n*J,n=e[11],U+=n*C,E+=n*Z,L+=n*V,H+=n*K,F+=n*fe,j+=n*A,D+=n*X,B+=n*Q,R+=n*P,Y+=n*O,b+=n*z,u+=n*W,p+=n*re,m+=n*le,w+=n*oe,S+=n*J,n=e[12],E+=n*C,L+=n*Z,H+=n*V,F+=n*K,j+=n*fe,D+=n*A,B+=n*X,R+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*W,m+=n*re,w+=n*le,S+=n*oe,I+=n*J,n=e[13],L+=n*C,H+=n*Z,F+=n*V,j+=n*K,D+=n*fe,B+=n*A,R+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*W,w+=n*re,S+=n*le,I+=n*oe,N+=n*J,n=e[14],H+=n*C,F+=n*Z,j+=n*V,D+=n*K,B+=n*fe,R+=n*A,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*W,S+=n*re,I+=n*le,N+=n*oe,k+=n*J,n=e[15],F+=n*C,j+=n*Z,D+=n*V,B+=n*K,R+=n*fe,Y+=n*A,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*W,I+=n*re,N+=n*le,k+=n*oe,g+=n*J,s+=38*j,a+=38*D,c+=38*B,f+=38*R,l+=38*Y,h+=38*b,d+=38*u,v+=38*p,x+=38*m,y+=38*w,_+=38*S,U+=38*I,E+=38*N,L+=38*k,H+=38*g,i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),i=1,n=s+i+65535,i=Math.floor(n/65536),s=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=U+i+65535,i=Math.floor(n/65536),U=n-i*65536,n=E+i+65535,i=Math.floor(n/65536),E=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=F+i+65535,i=Math.floor(n/65536),F=n-i*65536,s+=i-1+37*(i-1),r[0]=s,r[1]=a,r[2]=c,r[3]=f,r[4]=l,r[5]=h,r[6]=d,r[7]=v,r[8]=x,r[9]=y,r[10]=_,r[11]=U,r[12]=E,r[13]=L,r[14]=H,r[15]=F}o(ns,"mul");function Eu(r,e){ns(r,e,e)}o(Eu,"square");function hk(r,e){for(var t=Ai(),n=0;n<16;n++)t[n]=e[n];for(var n=253;n>=0;n--)Eu(t,t),n!==2&&n!==4&&ns(t,t,e);for(var n=0;n<16;n++)r[n]=t[n]}o(hk,"inv25519");function Hm(r,e){for(var t=new Uint8Array(32),n=new Float64Array(80),i=Ai(),s=Ai(),a=Ai(),c=Ai(),f=Ai(),l=Ai(),h=0;h<31;h++)t[h]=r[h];t[31]=r[31]&127|64,t[0]&=248,lk(n,e);for(var h=0;h<16;h++)s[h]=n[h];i[0]=c[0]=1;for(var h=254;h>=0;--h){var d=t[h>>>3]>>>(h&7)&1;Au(i,s,d),Au(a,c,d),cd(f,i,a),fd(i,i,a),cd(a,s,c),fd(s,s,c),Eu(c,f),Eu(l,i),ns(i,a,i),ns(a,s,f),cd(f,i,a),fd(i,i,a),Eu(s,i),fd(a,c,l),ns(i,a,fk),cd(i,i,c),ns(a,a,i),ns(i,c,l),ns(c,s,n),Eu(s,f),Au(i,s,d),Au(a,c,d)}for(var h=0;h<16;h++)n[h+16]=i[h],n[h+32]=a[h],n[h+48]=s[h],n[h+64]=c[h];var v=n.subarray(32),x=n.subarray(16);hk(v,v),ns(x,x,v);var y=new Uint8Array(32);return uk(y,x),y}o(Hm,"scalarMult");qr.scalarMult=Hm;function zw(r){return Hm(r,qw)}o(zw,"scalarMultBase");qr.scalarMultBase=zw;function jw(r){if(r.length!==qr.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+qr.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(r),t=zw(e);return{publicKey:t,secretKey:e}}o(jw,"generateKeyPairFromSeed");qr.generateKeyPairFromSeed=jw;function dk(r){var e=ak.randomBytes(32,r),t=jw(e);return ck.wipe(e),t}o(dk,"generateKeyPair");qr.generateKeyPair=dk;function pk(r,e,t){if(t===void 0&&(t=!1),r.length!==qr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==qr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var n=Hm(r,e);if(t){for(var i=0,s=0;s<n.length;s++)i|=n[s];if(i===0)throw new Error("X25519: invalid shared key")}return n}o(pk,"sharedKey");qr.sharedKey=pk});var zm=de(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var vr=Yo(),qm=xn(),mk=20;function bk(r,e,t){for(var n=1634760805,i=857760878,s=2036477234,a=1797285236,c=t[3]<<24|t[2]<<16|t[1]<<8|t[0],f=t[7]<<24|t[6]<<16|t[5]<<8|t[4],l=t[11]<<24|t[10]<<16|t[9]<<8|t[8],h=t[15]<<24|t[14]<<16|t[13]<<8|t[12],d=t[19]<<24|t[18]<<16|t[17]<<8|t[16],v=t[23]<<24|t[22]<<16|t[21]<<8|t[20],x=t[27]<<24|t[26]<<16|t[25]<<8|t[24],y=t[31]<<24|t[30]<<16|t[29]<<8|t[28],_=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],E=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,F=i,j=s,D=a,B=c,R=f,Y=l,b=h,u=d,p=v,m=x,w=y,S=_,I=U,N=E,k=L,g=0;g<mk;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,F=F+R|0,I^=F,I=I>>>32-16|I<<16,p=p+I|0,R^=p,R=R>>>32-12|R<<12,j=j+Y|0,N^=j,N=N>>>32-16|N<<16,m=m+N|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,k^=D,k=k>>>32-16|k<<16,w=w+k|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,N^=j,N=N>>>32-8|N<<8,m=m+N|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,k^=D,k=k>>>32-8|k<<8,w=w+k|0,b^=w,b=b>>>32-7|b<<7,F=F+R|0,I^=F,I=I>>>32-8|I<<8,p=p+I|0,R^=p,R=R>>>32-7|R<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+R|0,k^=H,k=k>>>32-16|k<<16,m=m+k|0,R^=m,R=R>>>32-12|R<<12,F=F+Y|0,S^=F,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,I^=j,I=I>>>32-16|I<<16,u=u+I|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,N^=D,N=N>>>32-16|N<<16,p=p+N|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,I^=j,I=I>>>32-8|I<<8,u=u+I|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,N^=D,N=N>>>32-8|N<<8,p=p+N|0,B^=p,B=B>>>32-7|B<<7,F=F+Y|0,S^=F,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+R|0,k^=H,k=k>>>32-8|k<<8,m=m+k|0,R^=m,R=R>>>32-7|R<<7;vr.writeUint32LE(H+n|0,r,0),vr.writeUint32LE(F+i|0,r,4),vr.writeUint32LE(j+s|0,r,8),vr.writeUint32LE(D+a|0,r,12),vr.writeUint32LE(B+c|0,r,16),vr.writeUint32LE(R+f|0,r,20),vr.writeUint32LE(Y+l|0,r,24),vr.writeUint32LE(b+h|0,r,28),vr.writeUint32LE(u+d|0,r,32),vr.writeUint32LE(p+v|0,r,36),vr.writeUint32LE(m+x|0,r,40),vr.writeUint32LE(w+y|0,r,44),vr.writeUint32LE(S+_|0,r,48),vr.writeUint32LE(I+U|0,r,52),vr.writeUint32LE(N+E|0,r,56),vr.writeUint32LE(k+L|0,r,60)}o(bk,"core");function Gw(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var s,a;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),a=s.length-e.length,s.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,a=i}for(var c=new Uint8Array(64),f=0;f<t.length;f+=64){bk(c,s,r);for(var l=f;l<f+64&&l<t.length;l++)n[l]=t[l]^c[l-f];yk(s,0,a)}return qm.wipe(c),i===0&&qm.wipe(s),n}o(Gw,"streamXOR");ud.streamXOR=Gw;function gk(r,e,t,n){return n===void 0&&(n=0),qm.wipe(t),Gw(r,e,t,t,n)}o(gk,"stream");ud.stream=gk;function yk(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}o(yk,"incrementCounter")});var Xw=de(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});var lo=Yo(),Jw=xn(),vk=zm(),wk=20;function Ww(r,e,t,n){if(e.length!==24)throw new Error("XChaCha20 nonce must be 24 bytes");var i=Yw(r,e.subarray(0,16),new Uint8Array(32)),s=new Uint8Array(12);s.set(e.subarray(16),4);var a=vk.streamXOR(i,s,t,n);return Jw.wipe(i),a}o(Ww,"streamXOR");Su.streamXOR=Ww;function xk(r,e,t){return Jw.wipe(t),Ww(r,e,t,t)}o(xk,"stream");Su.stream=xk;function Yw(r,e,t){for(var n=1634760805,i=857760878,s=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],f=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],v=r[23]<<24|r[22]<<16|r[21]<<8|r[20],x=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],_=e[3]<<24|e[2]<<16|e[1]<<8|e[0],U=e[7]<<24|e[6]<<16|e[5]<<8|e[4],E=e[11]<<24|e[10]<<16|e[9]<<8|e[8],L=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,F=i,j=s,D=a,B=c,R=f,Y=l,b=h,u=d,p=v,m=x,w=y,S=_,I=U,N=E,k=L,g=0;g<wk;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,F=F+R|0,I^=F,I=I>>>32-16|I<<16,p=p+I|0,R^=p,R=R>>>32-12|R<<12,j=j+Y|0,N^=j,N=N>>>32-16|N<<16,m=m+N|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,k^=D,k=k>>>32-16|k<<16,w=w+k|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,N^=j,N=N>>>32-8|N<<8,m=m+N|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,k^=D,k=k>>>32-8|k<<8,w=w+k|0,b^=w,b=b>>>32-7|b<<7,F=F+R|0,I^=F,I=I>>>32-8|I<<8,p=p+I|0,R^=p,R=R>>>32-7|R<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+R|0,k^=H,k=k>>>32-16|k<<16,m=m+k|0,R^=m,R=R>>>32-12|R<<12,F=F+Y|0,S^=F,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,I^=j,I=I>>>32-16|I<<16,u=u+I|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,N^=D,N=N>>>32-16|N<<16,p=p+N|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,I^=j,I=I>>>32-8|I<<8,u=u+I|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,N^=D,N=N>>>32-8|N<<8,p=p+N|0,B^=p,B=B>>>32-7|B<<7,F=F+Y|0,S^=F,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+R|0,k^=H,k=k>>>32-8|k<<8,m=m+k|0,R^=m,R=R>>>32-7|R<<7;return lo.writeUint32LE(H,t,0),lo.writeUint32LE(F,t,4),lo.writeUint32LE(j,t,8),lo.writeUint32LE(D,t,12),lo.writeUint32LE(S,t,16),lo.writeUint32LE(I,t,20),lo.writeUint32LE(N,t,24),lo.writeUint32LE(k,t,28),t}o(Yw,"hchacha");Su.hchacha=Yw});var jm=de(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});function _k(r,e,t){return~(r-1)&e|r-1&t}o(_k,"select");Ec.select=_k;function Ak(r,e){return(r|0)-(e|0)-1>>>31&1}o(Ak,"lessOrEqual");Ec.lessOrEqual=Ak;function Zw(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}o(Zw,"compare");Ec.compare=Zw;function Ek(r,e){return r.length===0||e.length===0?!1:Zw(r,e)!==0}o(Ek,"equal");Ec.equal=Ek});var e6=de(is=>{"use strict";Object.defineProperty(is,"__esModule",{value:!0});var Sk=jm(),ld=xn();is.DIGEST_LENGTH=16;var Qw=function(){function r(e){this.digestLength=is.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var t=e[0]|e[1]<<8;this._r[0]=t&8191;var n=e[2]|e[3]<<8;this._r[1]=(t>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var s=e[6]|e[7]<<8;this._r[3]=(i>>>7|s<<9)&8191;var a=e[8]|e[9]<<8;this._r[4]=(s>>>4|a<<12)&255,this._r[5]=a>>>1&8190;var c=e[10]|e[11]<<8;this._r[6]=(a>>>14|c<<2)&8191;var f=e[12]|e[13]<<8;this._r[7]=(c>>>11|f<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(f>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return o(r,"Poly1305"),r.prototype._blocks=function(e,t,n){for(var i=this._fin?0:2048,s=this._h[0],a=this._h[1],c=this._h[2],f=this._h[3],l=this._h[4],h=this._h[5],d=this._h[6],v=this._h[7],x=this._h[8],y=this._h[9],_=this._r[0],U=this._r[1],E=this._r[2],L=this._r[3],H=this._r[4],F=this._r[5],j=this._r[6],D=this._r[7],B=this._r[8],R=this._r[9];n>=16;){var Y=e[t+0]|e[t+1]<<8;s+=Y&8191;var b=e[t+2]|e[t+3]<<8;a+=(Y>>>13|b<<3)&8191;var u=e[t+4]|e[t+5]<<8;c+=(b>>>10|u<<6)&8191;var p=e[t+6]|e[t+7]<<8;f+=(u>>>7|p<<9)&8191;var m=e[t+8]|e[t+9]<<8;l+=(p>>>4|m<<12)&8191,h+=m>>>1&8191;var w=e[t+10]|e[t+11]<<8;d+=(m>>>14|w<<2)&8191;var S=e[t+12]|e[t+13]<<8;v+=(w>>>11|S<<5)&8191;var I=e[t+14]|e[t+15]<<8;x+=(S>>>8|I<<8)&8191,y+=I>>>5|i;var N=0,k=N;k+=s*_,k+=a*(5*R),k+=c*(5*B),k+=f*(5*D),k+=l*(5*j),N=k>>>13,k&=8191,k+=h*(5*F),k+=d*(5*H),k+=v*(5*L),k+=x*(5*E),k+=y*(5*U),N+=k>>>13,k&=8191;var g=N;g+=s*U,g+=a*_,g+=c*(5*R),g+=f*(5*B),g+=l*(5*D),N=g>>>13,g&=8191,g+=h*(5*j),g+=d*(5*F),g+=v*(5*H),g+=x*(5*L),g+=y*(5*E),N+=g>>>13,g&=8191;var C=N;C+=s*E,C+=a*U,C+=c*_,C+=f*(5*R),C+=l*(5*B),N=C>>>13,C&=8191,C+=h*(5*D),C+=d*(5*j),C+=v*(5*F),C+=x*(5*H),C+=y*(5*L),N+=C>>>13,C&=8191;var Z=N;Z+=s*L,Z+=a*E,Z+=c*U,Z+=f*_,Z+=l*(5*R),N=Z>>>13,Z&=8191,Z+=h*(5*B),Z+=d*(5*D),Z+=v*(5*j),Z+=x*(5*F),Z+=y*(5*H),N+=Z>>>13,Z&=8191;var V=N;V+=s*H,V+=a*L,V+=c*E,V+=f*U,V+=l*_,N=V>>>13,V&=8191,V+=h*(5*R),V+=d*(5*B),V+=v*(5*D),V+=x*(5*j),V+=y*(5*F),N+=V>>>13,V&=8191;var K=N;K+=s*F,K+=a*H,K+=c*L,K+=f*E,K+=l*U,N=K>>>13,K&=8191,K+=h*_,K+=d*(5*R),K+=v*(5*B),K+=x*(5*D),K+=y*(5*j),N+=K>>>13,K&=8191;var fe=N;fe+=s*j,fe+=a*F,fe+=c*H,fe+=f*L,fe+=l*E,N=fe>>>13,fe&=8191,fe+=h*U,fe+=d*_,fe+=v*(5*R),fe+=x*(5*B),fe+=y*(5*D),N+=fe>>>13,fe&=8191;var A=N;A+=s*D,A+=a*j,A+=c*F,A+=f*H,A+=l*L,N=A>>>13,A&=8191,A+=h*E,A+=d*U,A+=v*_,A+=x*(5*R),A+=y*(5*B),N+=A>>>13,A&=8191;var X=N;X+=s*B,X+=a*D,X+=c*j,X+=f*F,X+=l*H,N=X>>>13,X&=8191,X+=h*L,X+=d*E,X+=v*U,X+=x*_,X+=y*(5*R),N+=X>>>13,X&=8191;var Q=N;Q+=s*R,Q+=a*B,Q+=c*D,Q+=f*j,Q+=l*F,N=Q>>>13,Q&=8191,Q+=h*H,Q+=d*L,Q+=v*E,Q+=x*U,Q+=y*_,N+=Q>>>13,Q&=8191,N=(N<<2)+N|0,N=N+k|0,k=N&8191,N=N>>>13,g+=N,s=k,a=g,c=C,f=Z,l=V,h=K,d=fe,v=A,x=X,y=Q,t+=16,n-=16}this._h[0]=s,this._h[1]=a,this._h[2]=c,this._h[3]=f,this._h[4]=l,this._h[5]=h,this._h[6]=d,this._h[7]=v,this._h[8]=x,this._h[9]=y},r.prototype.finish=function(e,t){t===void 0&&(t=0);var n=new Uint16Array(10),i,s,a,c;if(this._leftover){for(c=this._leftover,this._buffer[c++]=1;c<16;c++)this._buffer[c]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,c=2;c<10;c++)this._h[c]+=i,i=this._h[c]>>>13,this._h[c]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,c=1;c<10;c++)n[c]=this._h[c]+i,i=n[c]>>>13,n[c]&=8191;for(n[9]-=1<<13,s=(i^1)-1,c=0;c<10;c++)n[c]&=s;for(s=~s,c=0;c<10;c++)this._h[c]=this._h[c]&s|n[c];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,a=this._h[0]+this._pad[0],this._h[0]=a&65535,c=1;c<8;c++)a=(this._h[c]+this._pad[c]|0)+(a>>>16)|0,this._h[c]=a&65535;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var s=0;s<i;s++)this._buffer[this._leftover+s]=e[t+s];if(n-=i,t+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,t,i),t+=i,n-=i),n){for(var s=0;s<n;s++)this._buffer[this._leftover+s]=e[t+s];this._leftover+=n}return this},r.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},r.prototype.clean=function(){return ld.wipe(this._buffer),ld.wipe(this._r),ld.wipe(this._h),ld.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},r}();is.Poly1305=Qw;function Ck(r,e){var t=new Qw(r);t.update(e);var n=t.digest();return t.clean(),n}o(Ck,"oneTimeAuth");is.oneTimeAuth=Ck;function kk(r,e){return r.length!==is.DIGEST_LENGTH||e.length!==is.DIGEST_LENGTH?!1:Sk.equal(r,e)}o(kk,"equal");is.equal=kk});var n6=de(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});var hd=zm(),Tk=e6(),Cu=xn(),t6=Yo(),Mk=jm();ss.KEY_LENGTH=32;ss.NONCE_LENGTH=12;ss.TAG_LENGTH=16;var r6=new Uint8Array(16),Bk=function(){function r(e){if(this.nonceLength=ss.NONCE_LENGTH,this.tagLength=ss.TAG_LENGTH,e.length!==ss.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return o(r,"ChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);hd.stream(this._key,s,a,4);var c=t.length+this.tagLength,f;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");f=i}else f=new Uint8Array(c);return hd.streamXOR(this._key,s,t,f,4),this._authenticate(f.subarray(f.length-this.tagLength,f.length),a,f.subarray(0,f.length-this.tagLength),n),Cu.wipe(s),f},r.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);hd.stream(this._key,s,a,4);var c=new Uint8Array(this.tagLength);if(this._authenticate(c,a,t.subarray(0,t.length-this.tagLength),n),!Mk.equal(c,t.subarray(t.length-this.tagLength,t.length)))return null;var f=t.length-this.tagLength,l;if(i){if(i.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(f);return hd.streamXOR(this._key,s,t.subarray(0,t.length-this.tagLength),l,4),Cu.wipe(s),l},r.prototype.clean=function(){return Cu.wipe(this._key),this},r.prototype._authenticate=function(e,t,n,i){var s=new Tk.Poly1305(t);i&&(s.update(i),i.length%16>0&&s.update(r6.subarray(i.length%16))),s.update(n),n.length%16>0&&s.update(r6.subarray(n.length%16));var a=new Uint8Array(8);i&&t6.writeUint64LE(i.length,a),s.update(a),t6.writeUint64LE(n.length,a),s.update(a);for(var c=s.digest(),f=0;f<c.length;f++)e[f]=c[f];s.clean(),Cu.wipe(c),Cu.wipe(a)},r}();ss.ChaCha20Poly1305=Bk});var o6=de(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});var i6=Xw(),s6=n6(),ku=xn();os.KEY_LENGTH=32;os.NONCE_LENGTH=24;os.TAG_LENGTH=16;var Nk=function(){function r(e){if(this.nonceLength=os.NONCE_LENGTH,this.tagLength=os.TAG_LENGTH,e.length!==os.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return o(r,"XChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");var s=i6.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var c=new s6.ChaCha20Poly1305(s),f=c.seal(a,t,n,i);return ku.wipe(s),ku.wipe(a),c.clean(),f},r.prototype.open=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=i6.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var c=new s6.ChaCha20Poly1305(s),f=c.open(a,t,n,i);return ku.wipe(s),ku.wipe(a),c.clean(),f},r.prototype.clean=function(){return ku.wipe(this._key),this},r}();os.XChaCha20Poly1305=Nk});var Qn=de((RK,J3)=>{J3.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}});var Uu=de((UK,W3)=>{W3.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}});var Z3=de(lr=>{var Y3=lr,Nd=4294967292,Id=4294967293,v1=4294967294,X3=4294967295,ve=[0,1,3,7,15,31,63,127,255,511,1023],bo=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],XT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),cn=[];XT.forEach(r=>{cn.push(r.charCodeAt(0))});lr.utf8={encode(r){let e=[];return r.forEach(t=>{if(t>=0&&t<=127)e.push(t);else if(t<=2047)e.push(192+(t>>6&ve[5])),e.push(128+(t&ve[6]));else if(t<55296||t>57343&&t<=65535)e.push(224+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]));else if(t>=65536&&t<=1114111){let n=t>>16&ve[5];e.push(240+(n>>2)),e.push(128+((n&ve[2])<<4)+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]))}else throw new RangeError(`utf8.encode: character out of range: char: ${t}`)}),Buffer.from(e)},decode(r,e){function t(y,_){if((_&192)!==128)return Id;let U=((y&ve[5])<<6)+(_&ve[6]);return U<128?Nd:U}o(t,"bytes2");function n(y,_,U){if((U&192)!==128||(_&192)!==128)return Id;let E=((y&ve[4])<<12)+((_&ve[6])<<6)+(U&ve[6]);return E<2048?Nd:E>=55296&&E<=57343?v1:E}o(n,"bytes3");function i(y,_,U,E){if((E&192)!==128||(U&192)!==128||(_&192)!==128)return Id;let L=(((y&ve[3])<<2)+(_>>4&ve[2])<<16)+((_&ve[4])<<12)+((U&ve[6])<<6)+(E&ve[6]);return L<65536?Nd:L>1114111?v1:L}o(i,"bytes4");let s,a,c,f,l,h,d=r.length,v=e?3:0,x=[];for(;v<d;){a=r[v],s=X3;let y=!0;for(;y;){if(a>=0&&a<=127){s=a,h=1;break}if(c=v+1,c<d&&a>=194&&a<=223){s=t(a,r[c]),h=2;break}if(f=v+2,f<d&&a>=224&&a<=239){s=n(a,r[c],r[f]),h=3;break}if(l=v+3,l<d&&a>=240&&a<=244){s=i(a,r[c],r[f],r[l]),h=4;break}break}if(s>1114111){let _=`byte[${v}]`;throw s===X3?new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${_}`):s===Id?new RangeError(`utf8.decode: illegal trailing byte found at: ${_}`):s===v1?new RangeError(`utf8.decode: code point out of range found at: ${_}`):s===Nd?new RangeError(`utf8.decode: non-shortest form found at: ${_}`):new RangeError(`utf8.decode: unrecognized error found at: ${_}`)}x.push(s),v+=h}return x}};lr.utf16be={encode(r){let e=[],t,n,i;for(let s=0;s<r.length;s+=1)if(t=r[s],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t>>8&ve[8]),e.push(t&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n>>8&ve[8]),e.push(n&ve[8]),e.push(i>>8&ve[8]),e.push(i&ve[8]);else throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${s}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,s=0,a,c,f,l,h,d;for(;i<n;){for(;;){if(f=i+1,f<n){if(h=(r[i]<<8)+r[f],h<55296||h>57343){a=h,c=2;break}if(l=i+3,l<n&&(d=(r[i+2]<<8)+r[l],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),c=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${i}]`)}t[s++]=a,i+=c}return t}};lr.utf16le={encode(r){let e=[],t,n,i;for(let s=0;s<r.length;s+=1)if(t=r[s],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t&ve[8]),e.push(t>>8&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n&ve[8]),e.push(n>>8&ve[8]),e.push(i&ve[8]),e.push(i>>8&ve[8]);else throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${s}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,s=0,a,c,f,l,h,d;for(;i<n;){for(;;){if(f=i+1,f<n){if(h=(r[f]<<8)+r[i],h<55296||h>57343){a=h,c=2;break}if(l=i+3,l<n&&(d=(r[l]<<8)+r[i+2],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),c=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${i}]`)}t[s++]=a,i+=c}return t}};lr.utf32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${t/4}]: ${n}`);e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n]<<24)+(r[n+1]<<16)+(r[n+2]<<8)+r[n+3];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};lr.utf32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${t/4}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n+3]<<24)+(r[n+2]<<16)+(r[n+1]<<8)+r[n];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};lr.uint7={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${t}]: ${r[t]}`);e[t]=r[t]}return e}};lr.uint8={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1)e[t]=r[t];return e}};lr.uint16be={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${t/2}]: ${n}`);e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t]<<8)+r[t+1]);return e}};lr.uint16le={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${t/2}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t+1]<<8)+r[t]);return e}};lr.uint32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t]<<24)+(r[t+1]<<16)+(r[t+2]<<8)+r[t+3]);return e}};lr.uint32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t+3]<<24)+(r[t+2]<<16)+(r[t+1]<<8)+r[t]);return e}};lr.string={encode(r){return Y3.utf16le.encode(r).toString("utf16le")},decode(r){return Y3.utf16le.decode(Buffer.from(r,"utf16le"),0)}};lr.escaped={encode(r){let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if(n===96)e.push(n),e.push(n);else if(n===10)e.push(n);else if(n>=32&&n<=126)e.push(n);else{let i="";if(n>=0&&n<=31)i+=`\`x${bo[n]}`;else if(n>=127&&n<=255)i+=`\`x${bo[n]}`;else if(n>=256&&n<=65535)i+=`\`u${bo[n>>8&ve[8]]}${bo[n&ve[8]]}`;else if(n>=65536&&n<=4294967295){i+="`u{";let a=n>>24&ve[8];a>0&&(i+=bo[a]),i+=`${bo[n>>16&ve[8]]+bo[n>>8&ve[8]]+bo[n&ve[8]]}}`}else throw new Error("escape.encode(char): char > 0xffffffff not allowed");Buffer.from(i).forEach(a=>{e.push(a)})}}return Buffer.from(e)},decode(r){function e(d){return d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102}o(e,"isHex");function t(d,v,x){let y={char:null,nexti:d+2,error:!0};if(d+1<v&&e(x[d])&&e(x[d+1])){let _=String.fromCodePoint(x[d],x[d+1]);y.char=parseInt(_,16),Number.isNaN(y.char)||(y.error=!1)}return y}o(t,"getx");function n(d,v,x){let y={char:null,nexti:d+4,error:!0};if(d+3<v&&e(x[d])&&e(x[d+1])&&e(x[d+2])&&e(x[d+3])){let _=String.fromCodePoint(x[d],x[d+1],x[d+2],x[d+3]);y.char=parseInt(_,16),Number.isNaN(y.char)||(y.error=!1)}return y}o(n,"getu");function i(d,v,x){let y={char:null,nexti:d+4,error:!0},_="";for(;d<v&&e(x[d]);)_+=String.fromCodePoint(x[d]),d+=1;return y.char=parseInt(_,16),x[d]===125&&!Number.isNaN(y.char)&&(y.error=!1),y.nexti=d+1,y}o(i,"getU");let s=[],a=r.length,c,f,l,h=0;for(;h<a;){for(;;){if(l=!0,r[h]!==96){s.push(r[h]),h+=1,l=!1;break}if(c=h+1,c>=a)break;if(r[c]===96){s.push(96),h+=2,l=!1;break}if(r[c]===120){if(f=t(c+1,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}if(r[c]===117){if(r[c+1]===123){if(f=i(c+2,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}if(f=n(c+1,a,r),f.error)break;s.push(f.char),h=f.nexti,l=!1;break}break}if(l)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${h}]`)}return s}};var Lu=13,Mn=10;lr.lineEnds={crlf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Lu:t+1<r.length&&r[t+1]===Mn?t+=2:t+=1,e.push(Lu),e.push(Mn);break;case Mn:e.push(Lu),e.push(Mn),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==Mn&&(e.push(Lu),e.push(Mn)),e},lf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Lu:t+1<r.length&&r[t+1]===Mn?t+=2:t+=1,e.push(Mn);break;case Mn:e.push(Mn),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==Mn&&e.push(Mn),e}};lr.base64={encode(r){if(r.length===0)return Buffer.alloc(0);let e,t,n,i=r.length%3;i=i>0?3-i:0;let s=(r.length+i)/3,a=Buffer.alloc(s*4);i>0&&(s-=1),e=0,t=0;for(let c=0;c<s;c+=1)n=r[e++]<<16,n+=r[e++]<<8,n+=r[e++],a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[n>>6&ve[6]],a[t++]=cn[n&ve[6]];if(i===0)return a;if(i===1)return n=r[e++]<<16,n+=r[e]<<8,a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[n>>6&ve[6]],a[t]=cn[64],a;if(i===2)return n=r[e]<<16,a[t++]=cn[n>>18&ve[6]],a[t++]=cn[n>>12&ve[6]],a[t++]=cn[64],a[t]=cn[64],a},decode(r){function e(h){let d=[],v=0;for(let x=0;x<h.length;x+=1){let y=h[x],_=!0;for(;_&&!(y===32||y===9||y===10||y===13);){if(y>=65&&y<=90){d.push(y-65);break}if(y>=97&&y<=122){d.push(y-71);break}if(y>=48&&y<=57){d.push(y+4);break}if(y===43){d.push(62);break}if(y===47){d.push(63);break}if(y===61){d.push(64),v+=1;break}throw new RangeError(`base64.decode: invalid character buf[${x}]: ${y}`)}}if(d.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${d.length}`);switch(v){case 0:break;case 1:if(d[d.length-1]!==64)throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(d[d.length-1]!==64||d[d.length-2]!==64)throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${v}`)}return{tail:v,buf:Buffer.from(d)}}if(o(e,"validate"),r.length===0)return Buffer.alloc(0);let t=e(r),{tail:n}=t,i=t.buf,s,a,c,f=i.length/4,l=Buffer.alloc(f*3-n);n>0&&(f-=1),a=0,s=0;for(let h=0;h<f;h+=1)c=i[s++]<<18,c+=i[s++]<<12,c+=i[s++]<<6,c+=i[s++],l[a++]=c>>16&ve[8],l[a++]=c>>8&ve[8],l[a++]=c&ve[8];return n===1&&(c=i[s++]<<18,c+=i[s++]<<12,c+=i[s]<<6,l[a++]=c>>16&ve[8],l[a]=c>>8&ve[8]),n===2&&(c=i[s++]<<18,c+=i[s++]<<12,l[a]=c>>16&ve[8]),l},toString(r){if(r.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${r.length}`);let e="",t=0;function n(s,a,c,f){switch(t){case 76:e+=`\r
|
16
|
-
${
|
17
|
-
${a}${
|
18
|
-
${
|
19
|
-
${
|
15
|
+
`});var cm=Bt(()=>{to();Wh();is();nm();yf()});var sw={};It(sw,{CID:()=>Ne,bases:()=>vf,bytes:()=>vu,codecs:()=>Y9,digest:()=>ta,hasher:()=>Jh,hashes:()=>J9,varint:()=>gf});var vf,J9,Y9,Qh=Bt(()=>{qv();zv();jv();Vv();Wv();J0();Vh();Z0();em();_u();sm();rw();nw();cm();vf=ne(ne(ne(ne(ne(ne(ne(ne(ne({},q0),z0),j0),V0),W0),G0),Y0),X0),Q0),J9=ne(ne({},im),om),Y9={raw:am,json:fm}});var cw=de(sn=>{"use strict";Object.defineProperty(sn,"__esModule",{value:!0});function Z9(r,e){var t=r>>>16&65535,n=r&65535,i=e>>>16&65535,o=e&65535;return n*o+(t*o+n*i<<16>>>0)|0}s(Z9,"imulShim");sn.mul=Math.imul||Z9;function Q9(r,e){return r+e|0}s(Q9,"add");sn.add=Q9;function e7(r,e){return r-e|0}s(e7,"sub");sn.sub=e7;function t7(r,e){return r<<e|r>>>32-e}s(t7,"rotl");sn.rotl=t7;function r7(r,e){return r<<32-e|r>>>e}s(r7,"rotr");sn.rotr=r7;function n7(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r}s(n7,"isIntegerShim");sn.isInteger=Number.isInteger||n7;sn.MAX_SAFE_INTEGER=9007199254740991;sn.isSafeInteger=function(r){return sn.isInteger(r)&&r>=-sn.MAX_SAFE_INTEGER&&r<=sn.MAX_SAFE_INTEGER}});var na=de(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});var uw=cw();function i7(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])<<16>>16}s(i7,"readInt16BE");Ve.readInt16BE=i7;function o7(r,e){return e===void 0&&(e=0),(r[e+0]<<8|r[e+1])>>>0}s(o7,"readUint16BE");Ve.readUint16BE=o7;function s7(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])<<16>>16}s(s7,"readInt16LE");Ve.readInt16LE=s7;function a7(r,e){return e===void 0&&(e=0),(r[e+1]<<8|r[e])>>>0}s(a7,"readUint16LE");Ve.readUint16LE=a7;function lw(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>8,e[t+1]=r>>>0,e}s(lw,"writeUint16BE");Ve.writeUint16BE=lw;Ve.writeInt16BE=lw;function hw(r,e,t){return e===void 0&&(e=new Uint8Array(2)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e}s(hw,"writeUint16LE");Ve.writeUint16LE=hw;Ve.writeInt16LE=hw;function lm(r,e){return e===void 0&&(e=0),r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3]}s(lm,"readInt32BE");Ve.readInt32BE=lm;function hm(r,e){return e===void 0&&(e=0),(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}s(hm,"readUint32BE");Ve.readUint32BE=hm;function dm(r,e){return e===void 0&&(e=0),r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e]}s(dm,"readInt32LE");Ve.readInt32LE=dm;function pm(r,e){return e===void 0&&(e=0),(r[e+3]<<24|r[e+2]<<16|r[e+1]<<8|r[e])>>>0}s(pm,"readUint32LE");Ve.readUint32LE=pm;function rd(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>24,e[t+1]=r>>>16,e[t+2]=r>>>8,e[t+3]=r>>>0,e}s(rd,"writeUint32BE");Ve.writeUint32BE=rd;Ve.writeInt32BE=rd;function nd(r,e,t){return e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0),e[t+0]=r>>>0,e[t+1]=r>>>8,e[t+2]=r>>>16,e[t+3]=r>>>24,e}s(nd,"writeUint32LE");Ve.writeUint32LE=nd;Ve.writeInt32LE=nd;function f7(r,e){e===void 0&&(e=0);var t=lm(r,e),n=lm(r,e+4);return t*4294967296+n-(n>>31)*4294967296}s(f7,"readInt64BE");Ve.readInt64BE=f7;function c7(r,e){e===void 0&&(e=0);var t=hm(r,e),n=hm(r,e+4);return t*4294967296+n}s(c7,"readUint64BE");Ve.readUint64BE=c7;function u7(r,e){e===void 0&&(e=0);var t=dm(r,e),n=dm(r,e+4);return n*4294967296+t-(t>>31)*4294967296}s(u7,"readInt64LE");Ve.readInt64LE=u7;function l7(r,e){e===void 0&&(e=0);var t=pm(r,e),n=pm(r,e+4);return n*4294967296+t}s(l7,"readUint64LE");Ve.readUint64LE=l7;function dw(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),rd(r/4294967296>>>0,e,t),rd(r>>>0,e,t+4),e}s(dw,"writeUint64BE");Ve.writeUint64BE=dw;Ve.writeInt64BE=dw;function pw(r,e,t){return e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0),nd(r>>>0,e,t),nd(r/4294967296>>>0,e,t+4),e}s(pw,"writeUint64LE");Ve.writeUint64LE=pw;Ve.writeInt64LE=pw;function h7(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=r/8+t-1;o>=t;o--)n+=e[o]*i,i*=256;return n}s(h7,"readUintBE");Ve.readUintBE=h7;function d7(r,e,t){if(t===void 0&&(t=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>e.length-t)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=t;o<t+r/8;o++)n+=e[o]*i,i*=256;return n}s(d7,"readUintLE");Ve.readUintLE=d7;function p7(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!uw.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var i=1,o=r/8+n-1;o>=n;o--)t[o]=e/i&255,i*=256;return t}s(p7,"writeUintBE");Ve.writeUintBE=p7;function m7(r,e,t,n){if(t===void 0&&(t=new Uint8Array(r/8)),n===void 0&&(n=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!uw.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var i=1,o=n;o<n+r/8;o++)t[o]=e/i&255,i*=256;return t}s(m7,"writeUintLE");Ve.writeUintLE=m7;function b7(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e)}s(b7,"readFloat32BE");Ve.readFloat32BE=b7;function g7(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat32(e,!0)}s(g7,"readFloat32LE");Ve.readFloat32LE=g7;function y7(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e)}s(y7,"readFloat64BE");Ve.readFloat64BE=y7;function v7(r,e){e===void 0&&(e=0);var t=new DataView(r.buffer,r.byteOffset,r.byteLength);return t.getFloat64(e,!0)}s(v7,"readFloat64LE");Ve.readFloat64LE=v7;function w7(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r),e}s(w7,"writeFloat32BE");Ve.writeFloat32BE=w7;function x7(r,e,t){e===void 0&&(e=new Uint8Array(4)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat32(t,r,!0),e}s(x7,"writeFloat32LE");Ve.writeFloat32LE=x7;function A7(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r),e}s(A7,"writeFloat64BE");Ve.writeFloat64BE=A7;function _7(r,e,t){e===void 0&&(e=new Uint8Array(8)),t===void 0&&(t=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.setFloat64(t,r,!0),e}s(_7,"writeFloat64LE");Ve.writeFloat64LE=_7});var Sn=de(mm=>{"use strict";Object.defineProperty(mm,"__esModule",{value:!0});function E7(r){for(var e=0;e<r.length;e++)r[e]=0;return r}s(E7,"wipe");mm.wipe=E7});var bw=de(fs=>{"use strict";Object.defineProperty(fs,"__esModule",{value:!0});var od=na(),id=Sn();fs.DIGEST_LENGTH=32;fs.BLOCK_SIZE=64;var mw=function(){function r(){this.digestLength=fs.DIGEST_LENGTH,this.blockSize=fs.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return s(r,"SHA256"),r.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){id.wipe(this._buffer),id.wipe(this._temp),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(bm(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=bm(this._temp,this._state,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,a=t%64<56?64:128;this._buffer[n]=128;for(var f=n+1;f<a-8;f++)this._buffer[f]=0;od.writeUint32BE(i,this._buffer,a-8),od.writeUint32BE(o,this._buffer,a-4),bm(this._temp,this._state,this._buffer,0,a),this._finished=!0}for(var f=0;f<this.digestLength/4;f++)od.writeUint32BE(this._state[f],e,f*4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){id.wipe(e.state),e.buffer&&id.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();fs.SHA256=mw;var S7=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function bm(r,e,t,n,i){for(;i>=64;){for(var o=e[0],a=e[1],f=e[2],c=e[3],l=e[4],h=e[5],d=e[6],y=e[7],A=0;A<16;A++){var v=n+A*4;r[A]=od.readUint32BE(t,v)}for(var A=16;A<64;A++){var x=r[A-2],L=(x>>>17|x<<32-17)^(x>>>19|x<<32-19)^x>>>10;x=r[A-15];var _=(x>>>7|x<<32-7)^(x>>>18|x<<32-18)^x>>>3;r[A]=(L+r[A-7]|0)+(_+r[A-16]|0)}for(var A=0;A<64;A++){var L=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&d)|0)+(y+(S7[A]+r[A]|0)|0)|0,_=((o>>>2|o<<32-2)^(o>>>13|o<<32-13)^(o>>>22|o<<32-22))+(o&a^o&f^a&f)|0;y=d,d=h,h=l,l=c+L|0,c=f,f=a,a=o,o=L+_|0}e[0]+=o,e[1]+=a,e[2]+=f,e[3]+=c,e[4]+=l,e[5]+=h,e[6]+=d,e[7]+=y,n+=64,i-=64}return n}s(bm,"hashBlocks");function C7(r){var e=new mw;e.update(r);var t=e.digest();return e.clean(),t}s(C7,"hash");fs.hash=C7});var gm=de((GD,sd)=>{(function(){"use strict";var r="input is invalid type",e="finalize already called",t=typeof window=="object",n=t?window:{};n.JS_SHA3_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",o=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?n=global:i&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&typeof sd=="object"&&sd.exports,f=typeof define=="function"&&define.amd,c=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",l="0123456789abcdef".split(""),h=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],y=[1,256,65536,16777216],A=[6,1536,393216,100663296],v=[0,8,16,24],x=[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],L=[224,256,384,512],_=[128,256],R=["hex","buffer","arrayBuffer","array","digest"],H={"128":168,"256":136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(E){return Object.prototype.toString.call(E)==="[object Array]"}),c&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(E){return typeof E=="object"&&E.buffer&&E.buffer.constructor===ArrayBuffer});for(var $=s(function(E,X,Q){return function(P){return new V(E,X,E).update(P)[Q]()}},"createOutputMethod"),j=s(function(E,X,Q){return function(P,O){return new V(E,X,O).update(P)[Q]()}},"createShakeOutputMethod"),D=s(function(E,X,Q){return function(P,O,z,J){return w["cshake"+E].update(P,O,z,J)[Q]()}},"createCshakeOutputMethod"),B=s(function(E,X,Q){return function(P,O,z,J){return w["kmac"+E].update(P,O,z,J)[Q]()}},"createKmacOutputMethod"),U=s(function(E,X,Q,P){for(var O=0;O<R.length;++O){var z=R[O];E[z]=X(Q,P,z)}return E},"createOutputMethods"),Y=s(function(E,X){var Q=$(E,X,"hex");return Q.create=function(){return new V(E,X,E)},Q.update=function(P){return Q.create().update(P)},U(Q,$,E,X)},"createMethod"),b=s(function(E,X){var Q=j(E,X,"hex");return Q.create=function(P){return new V(E,X,P)},Q.update=function(P,O){return Q.create(O).update(P)},U(Q,j,E,X)},"createShakeMethod"),u=s(function(E,X){var Q=H[E],P=D(E,X,"hex");return P.create=function(O,z,J){return!z&&!J?w["shake"+E].create(O):new V(E,X,O).bytepad([z,J],Q)},P.update=function(O,z,J,re){return P.create(z,J,re).update(O)},U(P,D,E,X)},"createCshakeMethod"),p=s(function(E,X){var Q=H[E],P=B(E,X,"hex");return P.create=function(O,z,J){return new F(E,X,z).bytepad(["KMAC",J],Q).bytepad([O],Q)},P.update=function(O,z,J,re){return P.create(O,J,re).update(z)},U(P,B,E,X)},"createKmacMethod"),m=[{name:"keccak",padding:y,bits:L,createMethod:Y},{name:"sha3",padding:A,bits:L,createMethod:Y},{name:"shake",padding:h,bits:_,createMethod:b},{name:"cshake",padding:d,bits:_,createMethod:u},{name:"kmac",padding:d,bits:_,createMethod:p}],w={},S=[],N=0;N<m.length;++N)for(var I=m[N],T=I.bits,g=0;g<T.length;++g){var C=I.name+"_"+T[g];if(S.push(C),w[C]=I.createMethod(T[g],I.padding),I.name!=="sha3"){var Z=I.name+T[g];S.push(Z),w[Z]=w[C]}}function V(E,X,Q){this.blocks=[],this.s=[],this.padding=X,this.outputBits=Q,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(E<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Q>>5,this.extraBytes=(Q&31)>>3;for(var P=0;P<50;++P)this.s[P]=0}s(V,"Keccak"),V.prototype.update=function(E){if(this.finalized)throw new Error(e);var X,Q=typeof E;if(Q!=="string"){if(Q==="object"){if(E===null)throw new Error(r);if(c&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!c||!ArrayBuffer.isView(E)))throw new Error(r)}else throw new Error(r);X=!0}for(var P=this.blocks,O=this.byteCount,z=E.length,J=this.blockCount,re=0,le=this.s,se,G;re<z;){if(this.reset)for(this.reset=!1,P[0]=this.block,se=1;se<J+1;++se)P[se]=0;if(X)for(se=this.start;re<z&&se<O;++re)P[se>>2]|=E[re]<<v[se++&3];else for(se=this.start;re<z&&se<O;++re)G=E.charCodeAt(re),G<128?P[se>>2]|=G<<v[se++&3]:G<2048?(P[se>>2]|=(192|G>>6)<<v[se++&3],P[se>>2]|=(128|G&63)<<v[se++&3]):G<55296||G>=57344?(P[se>>2]|=(224|G>>12)<<v[se++&3],P[se>>2]|=(128|G>>6&63)<<v[se++&3],P[se>>2]|=(128|G&63)<<v[se++&3]):(G=65536+((G&1023)<<10|E.charCodeAt(++re)&1023),P[se>>2]|=(240|G>>18)<<v[se++&3],P[se>>2]|=(128|G>>12&63)<<v[se++&3],P[se>>2]|=(128|G>>6&63)<<v[se++&3],P[se>>2]|=(128|G&63)<<v[se++&3]);if(this.lastByteIndex=se,se>=O){for(this.start=se-O,this.block=P[J],se=0;se<J;++se)le[se]^=P[se];ce(le),this.reset=!0}else this.start=se}return this},V.prototype.encode=function(E,X){var Q=E&255,P=1,O=[Q];for(E=E>>8,Q=E&255;Q>0;)O.unshift(Q),E=E>>8,Q=E&255,++P;return X?O.push(P):O.unshift(P),this.update(O),O.length},V.prototype.encodeString=function(E){var X,Q=typeof E;if(Q!=="string"){if(Q==="object"){if(E===null)throw new Error(r);if(c&&E.constructor===ArrayBuffer)E=new Uint8Array(E);else if(!Array.isArray(E)&&(!c||!ArrayBuffer.isView(E)))throw new Error(r)}else throw new Error(r);X=!0}var P=0,O=E.length;if(X)P=O;else for(var z=0;z<E.length;++z){var J=E.charCodeAt(z);J<128?P+=1:J<2048?P+=2:J<55296||J>=57344?P+=3:(J=65536+((J&1023)<<10|E.charCodeAt(++z)&1023),P+=4)}return P+=this.encode(P*8),this.update(E),P},V.prototype.bytepad=function(E,X){for(var Q=this.encode(X),P=0;P<E.length;++P)Q+=this.encodeString(E[P]);var O=X-Q%X,z=[];return z.length=O,this.update(z),this},V.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var E=this.blocks,X=this.lastByteIndex,Q=this.blockCount,P=this.s;if(E[X>>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(E[0]=E[Q],X=1;X<Q+1;++X)E[X]=0;for(E[Q-1]|=2147483648,X=0;X<Q;++X)P[X]^=E[X];ce(P)}},V.prototype.toString=V.prototype.hex=function(){this.finalize();for(var E=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,J="",re;z<Q;){for(O=0;O<E&&z<Q;++O,++z)re=X[O],J+=l[re>>4&15]+l[re&15]+l[re>>12&15]+l[re>>8&15]+l[re>>20&15]+l[re>>16&15]+l[re>>28&15]+l[re>>24&15];z%E===0&&(ce(X),O=0)}return P&&(re=X[O],J+=l[re>>4&15]+l[re&15],P>1&&(J+=l[re>>12&15]+l[re>>8&15]),P>2&&(J+=l[re>>20&15]+l[re>>16&15])),J},V.prototype.arrayBuffer=function(){this.finalize();var E=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,J=this.outputBits>>3,re;P?re=new ArrayBuffer(Q+1<<2):re=new ArrayBuffer(J);for(var le=new Uint32Array(re);z<Q;){for(O=0;O<E&&z<Q;++O,++z)le[z]=X[O];z%E===0&&ce(X)}return P&&(le[O]=X[O],re=re.slice(0,J)),re},V.prototype.buffer=V.prototype.arrayBuffer,V.prototype.digest=V.prototype.array=function(){this.finalize();for(var E=this.blockCount,X=this.s,Q=this.outputBlocks,P=this.extraBytes,O=0,z=0,J=[],re,le;z<Q;){for(O=0;O<E&&z<Q;++O,++z)re=z<<2,le=X[O],J[re]=le&255,J[re+1]=le>>8&255,J[re+2]=le>>16&255,J[re+3]=le>>24&255;z%E===0&&ce(X)}return P&&(re=z<<2,le=X[O],J[re]=le&255,P>1&&(J[re+1]=le>>8&255),P>2&&(J[re+2]=le>>16&255)),J};function F(E,X,Q){V.call(this,E,X,Q)}s(F,"Kmac"),F.prototype=new V,F.prototype.finalize=function(){return this.encode(this.outputBits,!0),V.prototype.finalize.call(this)};var ce=s(function(E){var X,Q,P,O,z,J,re,le,se,G,pe,ee,fe,K,ie,me,Te,Ie,Xe,gn,te,W,k,q,oe,ae,he,ge,it,Pe,Ee,ot,We,st,Ns,pt,mt,Os,bt,gt,Ps,yt,vt,Rs,wt,xt,Us,At,_t,Ls,Et,St,Ds,Ct,Tt,To,ko,Mo,Bo,Io,No,Oo,Po;for(P=0;P<48;P+=2)O=E[0]^E[10]^E[20]^E[30]^E[40],z=E[1]^E[11]^E[21]^E[31]^E[41],J=E[2]^E[12]^E[22]^E[32]^E[42],re=E[3]^E[13]^E[23]^E[33]^E[43],le=E[4]^E[14]^E[24]^E[34]^E[44],se=E[5]^E[15]^E[25]^E[35]^E[45],G=E[6]^E[16]^E[26]^E[36]^E[46],pe=E[7]^E[17]^E[27]^E[37]^E[47],ee=E[8]^E[18]^E[28]^E[38]^E[48],fe=E[9]^E[19]^E[29]^E[39]^E[49],X=ee^(J<<1|re>>>31),Q=fe^(re<<1|J>>>31),E[0]^=X,E[1]^=Q,E[10]^=X,E[11]^=Q,E[20]^=X,E[21]^=Q,E[30]^=X,E[31]^=Q,E[40]^=X,E[41]^=Q,X=O^(le<<1|se>>>31),Q=z^(se<<1|le>>>31),E[2]^=X,E[3]^=Q,E[12]^=X,E[13]^=Q,E[22]^=X,E[23]^=Q,E[32]^=X,E[33]^=Q,E[42]^=X,E[43]^=Q,X=J^(G<<1|pe>>>31),Q=re^(pe<<1|G>>>31),E[4]^=X,E[5]^=Q,E[14]^=X,E[15]^=Q,E[24]^=X,E[25]^=Q,E[34]^=X,E[35]^=Q,E[44]^=X,E[45]^=Q,X=le^(ee<<1|fe>>>31),Q=se^(fe<<1|ee>>>31),E[6]^=X,E[7]^=Q,E[16]^=X,E[17]^=Q,E[26]^=X,E[27]^=Q,E[36]^=X,E[37]^=Q,E[46]^=X,E[47]^=Q,X=G^(O<<1|z>>>31),Q=pe^(z<<1|O>>>31),E[8]^=X,E[9]^=Q,E[18]^=X,E[19]^=Q,E[28]^=X,E[29]^=Q,E[38]^=X,E[39]^=Q,E[48]^=X,E[49]^=Q,K=E[0],ie=E[1],xt=E[11]<<4|E[10]>>>28,Us=E[10]<<4|E[11]>>>28,ge=E[20]<<3|E[21]>>>29,it=E[21]<<3|E[20]>>>29,Io=E[31]<<9|E[30]>>>23,No=E[30]<<9|E[31]>>>23,yt=E[40]<<18|E[41]>>>14,vt=E[41]<<18|E[40]>>>14,st=E[2]<<1|E[3]>>>31,Ns=E[3]<<1|E[2]>>>31,me=E[13]<<12|E[12]>>>20,Te=E[12]<<12|E[13]>>>20,At=E[22]<<10|E[23]>>>22,_t=E[23]<<10|E[22]>>>22,Pe=E[33]<<13|E[32]>>>19,Ee=E[32]<<13|E[33]>>>19,Oo=E[42]<<2|E[43]>>>30,Po=E[43]<<2|E[42]>>>30,Ct=E[5]<<30|E[4]>>>2,Tt=E[4]<<30|E[5]>>>2,pt=E[14]<<6|E[15]>>>26,mt=E[15]<<6|E[14]>>>26,Ie=E[25]<<11|E[24]>>>21,Xe=E[24]<<11|E[25]>>>21,Ls=E[34]<<15|E[35]>>>17,Et=E[35]<<15|E[34]>>>17,ot=E[45]<<29|E[44]>>>3,We=E[44]<<29|E[45]>>>3,q=E[6]<<28|E[7]>>>4,oe=E[7]<<28|E[6]>>>4,To=E[17]<<23|E[16]>>>9,ko=E[16]<<23|E[17]>>>9,Os=E[26]<<25|E[27]>>>7,bt=E[27]<<25|E[26]>>>7,gn=E[36]<<21|E[37]>>>11,te=E[37]<<21|E[36]>>>11,St=E[47]<<24|E[46]>>>8,Ds=E[46]<<24|E[47]>>>8,Rs=E[8]<<27|E[9]>>>5,wt=E[9]<<27|E[8]>>>5,ae=E[18]<<20|E[19]>>>12,he=E[19]<<20|E[18]>>>12,Mo=E[29]<<7|E[28]>>>25,Bo=E[28]<<7|E[29]>>>25,gt=E[38]<<8|E[39]>>>24,Ps=E[39]<<8|E[38]>>>24,W=E[48]<<14|E[49]>>>18,k=E[49]<<14|E[48]>>>18,E[0]=K^~me&Ie,E[1]=ie^~Te&Xe,E[10]=q^~ae&ge,E[11]=oe^~he&it,E[20]=st^~pt&Os,E[21]=Ns^~mt&bt,E[30]=Rs^~xt&At,E[31]=wt^~Us&_t,E[40]=Ct^~To&Mo,E[41]=Tt^~ko&Bo,E[2]=me^~Ie&gn,E[3]=Te^~Xe&te,E[12]=ae^~ge&Pe,E[13]=he^~it&Ee,E[22]=pt^~Os>,E[23]=mt^~bt&Ps,E[32]=xt^~At&Ls,E[33]=Us^~_t&Et,E[42]=To^~Mo&Io,E[43]=ko^~Bo&No,E[4]=Ie^~gn&W,E[5]=Xe^~te&k,E[14]=ge^~Pe&ot,E[15]=it^~Ee&We,E[24]=Os^~gt&yt,E[25]=bt^~Ps&vt,E[34]=At^~Ls&St,E[35]=_t^~Et&Ds,E[44]=Mo^~Io&Oo,E[45]=Bo^~No&Po,E[6]=gn^~W&K,E[7]=te^~k&ie,E[16]=Pe^~ot&q,E[17]=Ee^~We&oe,E[26]=gt^~yt&st,E[27]=Ps^~vt&Ns,E[36]=Ls^~St&Rs,E[37]=Et^~Ds&wt,E[46]=Io^~Oo&Ct,E[47]=No^~Po&Tt,E[8]=W^~K&me,E[9]=k^~ie&Te,E[18]=ot^~q&ae,E[19]=We^~oe&he,E[28]=yt^~st&pt,E[29]=vt^~Ns&mt,E[38]=St^~Rs&xt,E[39]=Ds^~wt&Us,E[48]=Oo^~Ct&To,E[49]=Po^~Tt&ko,E[0]^=x[P],E[1]^=x[P+1]},"f");if(a)sd.exports=w;else{for(N=0;N<S.length;++N)n[S[N]]=w[S[N]];f&&define(function(){return w})}})()});var gw=de((JD,T7)=>{T7.exports={name:"elliptic",version:"6.5.4",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}});var yw=de(()=>{});var Cn=de((vw,ym)=>{(function(r,e){"use strict";function t(b,u){if(!b)throw new Error(u||"Assertion failed")}s(t,"assert");function n(b,u){b.super_=u;var p=s(function(){},"TempCtor");p.prototype=u.prototype,b.prototype=new p,b.prototype.constructor=b}s(n,"inherits");function i(b,u,p){if(i.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((u==="le"||u==="be")&&(p=u,u=10),this._init(b||0,u||10,p||"be"))}s(i,"BN"),typeof r=="object"?r.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window!="undefined"&&typeof window.Buffer!="undefined"?o=window.Buffer:o=yw().Buffer}catch(b){}i.isBN=s(function(u){return u instanceof i?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===i.wordSize&&Array.isArray(u.words)},"isBN"),i.max=s(function(u,p){return u.cmp(p)>0?u:p},"max"),i.min=s(function(u,p){return u.cmp(p)<0?u:p},"min"),i.prototype._init=s(function(u,p,m){if(typeof u=="number")return this._initNumber(u,p,m);if(typeof u=="object")return this._initArray(u,p,m);p==="hex"&&(p=16),t(p===(p|0)&&p>=2&&p<=36),u=u.toString().replace(/\s+/g,"");var w=0;u[0]==="-"&&(w++,this.negative=1),w<u.length&&(p===16?this._parseHex(u,w,m):(this._parseBase(u,p,w),m==="le"&&this._initArray(this.toArray(),p,m)))},"init"),i.prototype._initNumber=s(function(u,p,m){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(t(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),p,m)},"_initNumber"),i.prototype._initArray=s(function(u,p,m){if(t(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S,N,I=0;if(m==="be")for(w=u.length-1,S=0;w>=0;w-=3)N=u[w]|u[w-1]<<8|u[w-2]<<16,this.words[S]|=N<<I&67108863,this.words[S+1]=N>>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);else if(m==="le")for(w=0,S=0;w<u.length;w+=3)N=u[w]|u[w+1]<<8|u[w+2]<<16,this.words[S]|=N<<I&67108863,this.words[S+1]=N>>>26-I&67108863,I+=24,I>=26&&(I-=26,S++);return this.strip()},"_initArray");function a(b,u){var p=b.charCodeAt(u);return p>=65&&p<=70?p-55:p>=97&&p<=102?p-87:p-48&15}s(a,"parseHex4Bits");function f(b,u,p){var m=a(b,p);return p-1>=u&&(m|=a(b,p-1)<<4),m}s(f,"parseHexByte"),i.prototype._parseHex=s(function(u,p,m){this.length=Math.ceil((u.length-p)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S=0,N=0,I;if(m==="be")for(w=u.length-1;w>=p;w-=2)I=f(u,p,w)<<S,this.words[N]|=I&67108863,S>=18?(S-=18,N+=1,this.words[N]|=I>>>26):S+=8;else{var T=u.length-p;for(w=T%2===0?p+1:p;w<u.length;w+=2)I=f(u,p,w)<<S,this.words[N]|=I&67108863,S>=18?(S-=18,N+=1,this.words[N]|=I>>>26):S+=8}this.strip()},"_parseHex");function c(b,u,p,m){for(var w=0,S=Math.min(b.length,p),N=u;N<S;N++){var I=b.charCodeAt(N)-48;w*=m,I>=49?w+=I-49+10:I>=17?w+=I-17+10:w+=I}return w}s(c,"parseBase"),i.prototype._parseBase=s(function(u,p,m){this.words=[0],this.length=1;for(var w=0,S=1;S<=67108863;S*=p)w++;w--,S=S/p|0;for(var N=u.length-m,I=N%w,T=Math.min(N,N-I)+m,g=0,C=m;C<T;C+=w)g=c(u,C,C+w,p),this.imuln(S),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g);if(I!==0){var Z=1;for(g=c(u,C,u.length,p),C=0;C<I;C++)Z*=p;this.imuln(Z),this.words[0]+g<67108864?this.words[0]+=g:this._iaddn(g)}this.strip()},"_parseBase"),i.prototype.copy=s(function(u){u.words=new Array(this.length);for(var p=0;p<this.length;p++)u.words[p]=this.words[p];u.length=this.length,u.negative=this.negative,u.red=this.red},"copy"),i.prototype.clone=s(function(){var u=new i(null);return this.copy(u),u},"clone"),i.prototype._expand=s(function(u){for(;this.length<u;)this.words[this.length++]=0;return this},"_expand"),i.prototype.strip=s(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),i.prototype._normSign=s(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),i.prototype.inspect=s(function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"},"inspect");var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=s(function(u,p){u=u||10,p=p|0||1;var m;if(u===16||u==="hex"){m="";for(var w=0,S=0,N=0;N<this.length;N++){var I=this.words[N],T=((I<<w|S)&16777215).toString(16);S=I>>>24-w&16777215,S!==0||N!==this.length-1?m=l[6-T.length]+T+m:m=T+m,w+=2,w>=26&&(w-=26,N--)}for(S!==0&&(m=S.toString(16)+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(u===(u|0)&&u>=2&&u<=36){var g=h[u],C=d[u];m="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var V=Z.modn(C).toString(u);Z=Z.idivn(C),Z.isZero()?m=V+m:m=l[g-V.length]+V+m}for(this.isZero()&&(m="0"+m);m.length%p!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}t(!1,"Base should be between 2 and 36")},"toString"),i.prototype.toNumber=s(function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&t(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},"toNumber"),i.prototype.toJSON=s(function(){return this.toString(16)},"toJSON"),i.prototype.toBuffer=s(function(u,p){return t(typeof o!="undefined"),this.toArrayLike(o,u,p)},"toBuffer"),i.prototype.toArray=s(function(u,p){return this.toArrayLike(Array,u,p)},"toArray"),i.prototype.toArrayLike=s(function(u,p,m){var w=this.byteLength(),S=m||Math.max(1,w);t(w<=S,"byte array longer than desired length"),t(S>0,"Requested array length <= 0"),this.strip();var N=p==="le",I=new u(S),T,g,C=this.clone();if(N){for(g=0;!C.isZero();g++)T=C.andln(255),C.iushrn(8),I[g]=T;for(;g<S;g++)I[g]=0}else{for(g=0;g<S-w;g++)I[g]=0;for(g=0;!C.isZero();g++)T=C.andln(255),C.iushrn(8),I[S-g-1]=T}return I},"toArrayLike"),Math.clz32?i.prototype._countBits=s(function(u){return 32-Math.clz32(u)},"_countBits"):i.prototype._countBits=s(function(u){var p=u,m=0;return p>=4096&&(m+=13,p>>>=13),p>=64&&(m+=7,p>>>=7),p>=8&&(m+=4,p>>>=4),p>=2&&(m+=2,p>>>=2),m+p},"_countBits"),i.prototype._zeroBits=s(function(u){if(u===0)return 26;var p=u,m=0;return(p&8191)===0&&(m+=13,p>>>=13),(p&127)===0&&(m+=7,p>>>=7),(p&15)===0&&(m+=4,p>>>=4),(p&3)===0&&(m+=2,p>>>=2),(p&1)===0&&m++,m},"_zeroBits"),i.prototype.bitLength=s(function(){var u=this.words[this.length-1],p=this._countBits(u);return(this.length-1)*26+p},"bitLength");function y(b){for(var u=new Array(b.bitLength()),p=0;p<u.length;p++){var m=p/26|0,w=p%26;u[p]=(b.words[m]&1<<w)>>>w}return u}s(y,"toBitArray"),i.prototype.zeroBits=s(function(){if(this.isZero())return 0;for(var u=0,p=0;p<this.length;p++){var m=this._zeroBits(this.words[p]);if(u+=m,m!==26)break}return u},"zeroBits"),i.prototype.byteLength=s(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),i.prototype.toTwos=s(function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},"toTwos"),i.prototype.fromTwos=s(function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},"fromTwos"),i.prototype.isNeg=s(function(){return this.negative!==0},"isNeg"),i.prototype.neg=s(function(){return this.clone().ineg()},"neg"),i.prototype.ineg=s(function(){return this.isZero()||(this.negative^=1),this},"ineg"),i.prototype.iuor=s(function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var p=0;p<u.length;p++)this.words[p]=this.words[p]|u.words[p];return this.strip()},"iuor"),i.prototype.ior=s(function(u){return t((this.negative|u.negative)===0),this.iuor(u)},"ior"),i.prototype.or=s(function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},"or"),i.prototype.uor=s(function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},"uor"),i.prototype.iuand=s(function(u){var p;this.length>u.length?p=u:p=this;for(var m=0;m<p.length;m++)this.words[m]=this.words[m]&u.words[m];return this.length=p.length,this.strip()},"iuand"),i.prototype.iand=s(function(u){return t((this.negative|u.negative)===0),this.iuand(u)},"iand"),i.prototype.and=s(function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},"and"),i.prototype.uand=s(function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},"uand"),i.prototype.iuxor=s(function(u){var p,m;this.length>u.length?(p=this,m=u):(p=u,m=this);for(var w=0;w<m.length;w++)this.words[w]=p.words[w]^m.words[w];if(this!==p)for(;w<p.length;w++)this.words[w]=p.words[w];return this.length=p.length,this.strip()},"iuxor"),i.prototype.ixor=s(function(u){return t((this.negative|u.negative)===0),this.iuxor(u)},"ixor"),i.prototype.xor=s(function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},"xor"),i.prototype.uxor=s(function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},"uxor"),i.prototype.inotn=s(function(u){t(typeof u=="number"&&u>=0);var p=Math.ceil(u/26)|0,m=u%26;this._expand(p),m>0&&p--;for(var w=0;w<p;w++)this.words[w]=~this.words[w]&67108863;return m>0&&(this.words[w]=~this.words[w]&67108863>>26-m),this.strip()},"inotn"),i.prototype.notn=s(function(u){return this.clone().inotn(u)},"notn"),i.prototype.setn=s(function(u,p){t(typeof u=="number"&&u>=0);var m=u/26|0,w=u%26;return this._expand(m+1),p?this.words[m]=this.words[m]|1<<w:this.words[m]=this.words[m]&~(1<<w),this.strip()},"setn"),i.prototype.iadd=s(function(u){var p;if(this.negative!==0&&u.negative===0)return this.negative=0,p=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,p=this.isub(u),u.negative=1,p._normSign();var m,w;this.length>u.length?(m=this,w=u):(m=u,w=this);for(var S=0,N=0;N<w.length;N++)p=(m.words[N]|0)+(w.words[N]|0)+S,this.words[N]=p&67108863,S=p>>>26;for(;S!==0&&N<m.length;N++)p=(m.words[N]|0)+S,this.words[N]=p&67108863,S=p>>>26;if(this.length=m.length,S!==0)this.words[this.length]=S,this.length++;else if(m!==this)for(;N<m.length;N++)this.words[N]=m.words[N];return this},"iadd"),i.prototype.add=s(function(u){var p;return u.negative!==0&&this.negative===0?(u.negative=0,p=this.sub(u),u.negative^=1,p):u.negative===0&&this.negative!==0?(this.negative=0,p=u.sub(this),this.negative=1,p):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},"add"),i.prototype.isub=s(function(u){if(u.negative!==0){u.negative=0;var p=this.iadd(u);return u.negative=1,p._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var m=this.cmp(u);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,S;m>0?(w=this,S=u):(w=u,S=this);for(var N=0,I=0;I<S.length;I++)p=(w.words[I]|0)-(S.words[I]|0)+N,N=p>>26,this.words[I]=p&67108863;for(;N!==0&&I<w.length;I++)p=(w.words[I]|0)+N,N=p>>26,this.words[I]=p&67108863;if(N===0&&I<w.length&&w!==this)for(;I<w.length;I++)this.words[I]=w.words[I];return this.length=Math.max(this.length,I),w!==this&&(this.negative=1),this.strip()},"isub"),i.prototype.sub=s(function(u){return this.clone().isub(u)},"sub");function A(b,u,p){p.negative=u.negative^b.negative;var m=b.length+u.length|0;p.length=m,m=m-1|0;var w=b.words[0]|0,S=u.words[0]|0,N=w*S,I=N&67108863,T=N/67108864|0;p.words[0]=I;for(var g=1;g<m;g++){for(var C=T>>>26,Z=T&67108863,V=Math.min(g,u.length-1),F=Math.max(0,g-b.length+1);F<=V;F++){var ce=g-F|0;w=b.words[ce]|0,S=u.words[F]|0,N=w*S+Z,C+=N/67108864|0,Z=N&67108863}p.words[g]=Z|0,T=C|0}return T!==0?p.words[g]=T|0:p.length--,p.strip()}s(A,"smallMulTo");var v=s(function(u,p,m){var w=u.words,S=p.words,N=m.words,I=0,T,g,C,Z=w[0]|0,V=Z&8191,F=Z>>>13,ce=w[1]|0,E=ce&8191,X=ce>>>13,Q=w[2]|0,P=Q&8191,O=Q>>>13,z=w[3]|0,J=z&8191,re=z>>>13,le=w[4]|0,se=le&8191,G=le>>>13,pe=w[5]|0,ee=pe&8191,fe=pe>>>13,K=w[6]|0,ie=K&8191,me=K>>>13,Te=w[7]|0,Ie=Te&8191,Xe=Te>>>13,gn=w[8]|0,te=gn&8191,W=gn>>>13,k=w[9]|0,q=k&8191,oe=k>>>13,ae=S[0]|0,he=ae&8191,ge=ae>>>13,it=S[1]|0,Pe=it&8191,Ee=it>>>13,ot=S[2]|0,We=ot&8191,st=ot>>>13,Ns=S[3]|0,pt=Ns&8191,mt=Ns>>>13,Os=S[4]|0,bt=Os&8191,gt=Os>>>13,Ps=S[5]|0,yt=Ps&8191,vt=Ps>>>13,Rs=S[6]|0,wt=Rs&8191,xt=Rs>>>13,Us=S[7]|0,At=Us&8191,_t=Us>>>13,Ls=S[8]|0,Et=Ls&8191,St=Ls>>>13,Ds=S[9]|0,Ct=Ds&8191,Tt=Ds>>>13;m.negative=u.negative^p.negative,m.length=19,T=Math.imul(V,he),g=Math.imul(V,ge),g=g+Math.imul(F,he)|0,C=Math.imul(F,ge);var To=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(To>>>26)|0,To&=67108863,T=Math.imul(E,he),g=Math.imul(E,ge),g=g+Math.imul(X,he)|0,C=Math.imul(X,ge),T=T+Math.imul(V,Pe)|0,g=g+Math.imul(V,Ee)|0,g=g+Math.imul(F,Pe)|0,C=C+Math.imul(F,Ee)|0;var ko=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(ko>>>26)|0,ko&=67108863,T=Math.imul(P,he),g=Math.imul(P,ge),g=g+Math.imul(O,he)|0,C=Math.imul(O,ge),T=T+Math.imul(E,Pe)|0,g=g+Math.imul(E,Ee)|0,g=g+Math.imul(X,Pe)|0,C=C+Math.imul(X,Ee)|0,T=T+Math.imul(V,We)|0,g=g+Math.imul(V,st)|0,g=g+Math.imul(F,We)|0,C=C+Math.imul(F,st)|0;var Mo=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Mo>>>26)|0,Mo&=67108863,T=Math.imul(J,he),g=Math.imul(J,ge),g=g+Math.imul(re,he)|0,C=Math.imul(re,ge),T=T+Math.imul(P,Pe)|0,g=g+Math.imul(P,Ee)|0,g=g+Math.imul(O,Pe)|0,C=C+Math.imul(O,Ee)|0,T=T+Math.imul(E,We)|0,g=g+Math.imul(E,st)|0,g=g+Math.imul(X,We)|0,C=C+Math.imul(X,st)|0,T=T+Math.imul(V,pt)|0,g=g+Math.imul(V,mt)|0,g=g+Math.imul(F,pt)|0,C=C+Math.imul(F,mt)|0;var Bo=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Bo>>>26)|0,Bo&=67108863,T=Math.imul(se,he),g=Math.imul(se,ge),g=g+Math.imul(G,he)|0,C=Math.imul(G,ge),T=T+Math.imul(J,Pe)|0,g=g+Math.imul(J,Ee)|0,g=g+Math.imul(re,Pe)|0,C=C+Math.imul(re,Ee)|0,T=T+Math.imul(P,We)|0,g=g+Math.imul(P,st)|0,g=g+Math.imul(O,We)|0,C=C+Math.imul(O,st)|0,T=T+Math.imul(E,pt)|0,g=g+Math.imul(E,mt)|0,g=g+Math.imul(X,pt)|0,C=C+Math.imul(X,mt)|0,T=T+Math.imul(V,bt)|0,g=g+Math.imul(V,gt)|0,g=g+Math.imul(F,bt)|0,C=C+Math.imul(F,gt)|0;var Io=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Io>>>26)|0,Io&=67108863,T=Math.imul(ee,he),g=Math.imul(ee,ge),g=g+Math.imul(fe,he)|0,C=Math.imul(fe,ge),T=T+Math.imul(se,Pe)|0,g=g+Math.imul(se,Ee)|0,g=g+Math.imul(G,Pe)|0,C=C+Math.imul(G,Ee)|0,T=T+Math.imul(J,We)|0,g=g+Math.imul(J,st)|0,g=g+Math.imul(re,We)|0,C=C+Math.imul(re,st)|0,T=T+Math.imul(P,pt)|0,g=g+Math.imul(P,mt)|0,g=g+Math.imul(O,pt)|0,C=C+Math.imul(O,mt)|0,T=T+Math.imul(E,bt)|0,g=g+Math.imul(E,gt)|0,g=g+Math.imul(X,bt)|0,C=C+Math.imul(X,gt)|0,T=T+Math.imul(V,yt)|0,g=g+Math.imul(V,vt)|0,g=g+Math.imul(F,yt)|0,C=C+Math.imul(F,vt)|0;var No=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(No>>>26)|0,No&=67108863,T=Math.imul(ie,he),g=Math.imul(ie,ge),g=g+Math.imul(me,he)|0,C=Math.imul(me,ge),T=T+Math.imul(ee,Pe)|0,g=g+Math.imul(ee,Ee)|0,g=g+Math.imul(fe,Pe)|0,C=C+Math.imul(fe,Ee)|0,T=T+Math.imul(se,We)|0,g=g+Math.imul(se,st)|0,g=g+Math.imul(G,We)|0,C=C+Math.imul(G,st)|0,T=T+Math.imul(J,pt)|0,g=g+Math.imul(J,mt)|0,g=g+Math.imul(re,pt)|0,C=C+Math.imul(re,mt)|0,T=T+Math.imul(P,bt)|0,g=g+Math.imul(P,gt)|0,g=g+Math.imul(O,bt)|0,C=C+Math.imul(O,gt)|0,T=T+Math.imul(E,yt)|0,g=g+Math.imul(E,vt)|0,g=g+Math.imul(X,yt)|0,C=C+Math.imul(X,vt)|0,T=T+Math.imul(V,wt)|0,g=g+Math.imul(V,xt)|0,g=g+Math.imul(F,wt)|0,C=C+Math.imul(F,xt)|0;var Oo=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Oo>>>26)|0,Oo&=67108863,T=Math.imul(Ie,he),g=Math.imul(Ie,ge),g=g+Math.imul(Xe,he)|0,C=Math.imul(Xe,ge),T=T+Math.imul(ie,Pe)|0,g=g+Math.imul(ie,Ee)|0,g=g+Math.imul(me,Pe)|0,C=C+Math.imul(me,Ee)|0,T=T+Math.imul(ee,We)|0,g=g+Math.imul(ee,st)|0,g=g+Math.imul(fe,We)|0,C=C+Math.imul(fe,st)|0,T=T+Math.imul(se,pt)|0,g=g+Math.imul(se,mt)|0,g=g+Math.imul(G,pt)|0,C=C+Math.imul(G,mt)|0,T=T+Math.imul(J,bt)|0,g=g+Math.imul(J,gt)|0,g=g+Math.imul(re,bt)|0,C=C+Math.imul(re,gt)|0,T=T+Math.imul(P,yt)|0,g=g+Math.imul(P,vt)|0,g=g+Math.imul(O,yt)|0,C=C+Math.imul(O,vt)|0,T=T+Math.imul(E,wt)|0,g=g+Math.imul(E,xt)|0,g=g+Math.imul(X,wt)|0,C=C+Math.imul(X,xt)|0,T=T+Math.imul(V,At)|0,g=g+Math.imul(V,_t)|0,g=g+Math.imul(F,At)|0,C=C+Math.imul(F,_t)|0;var Po=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(Po>>>26)|0,Po&=67108863,T=Math.imul(te,he),g=Math.imul(te,ge),g=g+Math.imul(W,he)|0,C=Math.imul(W,ge),T=T+Math.imul(Ie,Pe)|0,g=g+Math.imul(Ie,Ee)|0,g=g+Math.imul(Xe,Pe)|0,C=C+Math.imul(Xe,Ee)|0,T=T+Math.imul(ie,We)|0,g=g+Math.imul(ie,st)|0,g=g+Math.imul(me,We)|0,C=C+Math.imul(me,st)|0,T=T+Math.imul(ee,pt)|0,g=g+Math.imul(ee,mt)|0,g=g+Math.imul(fe,pt)|0,C=C+Math.imul(fe,mt)|0,T=T+Math.imul(se,bt)|0,g=g+Math.imul(se,gt)|0,g=g+Math.imul(G,bt)|0,C=C+Math.imul(G,gt)|0,T=T+Math.imul(J,yt)|0,g=g+Math.imul(J,vt)|0,g=g+Math.imul(re,yt)|0,C=C+Math.imul(re,vt)|0,T=T+Math.imul(P,wt)|0,g=g+Math.imul(P,xt)|0,g=g+Math.imul(O,wt)|0,C=C+Math.imul(O,xt)|0,T=T+Math.imul(E,At)|0,g=g+Math.imul(E,_t)|0,g=g+Math.imul(X,At)|0,C=C+Math.imul(X,_t)|0,T=T+Math.imul(V,Et)|0,g=g+Math.imul(V,St)|0,g=g+Math.imul(F,Et)|0,C=C+Math.imul(F,St)|0;var d0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(d0>>>26)|0,d0&=67108863,T=Math.imul(q,he),g=Math.imul(q,ge),g=g+Math.imul(oe,he)|0,C=Math.imul(oe,ge),T=T+Math.imul(te,Pe)|0,g=g+Math.imul(te,Ee)|0,g=g+Math.imul(W,Pe)|0,C=C+Math.imul(W,Ee)|0,T=T+Math.imul(Ie,We)|0,g=g+Math.imul(Ie,st)|0,g=g+Math.imul(Xe,We)|0,C=C+Math.imul(Xe,st)|0,T=T+Math.imul(ie,pt)|0,g=g+Math.imul(ie,mt)|0,g=g+Math.imul(me,pt)|0,C=C+Math.imul(me,mt)|0,T=T+Math.imul(ee,bt)|0,g=g+Math.imul(ee,gt)|0,g=g+Math.imul(fe,bt)|0,C=C+Math.imul(fe,gt)|0,T=T+Math.imul(se,yt)|0,g=g+Math.imul(se,vt)|0,g=g+Math.imul(G,yt)|0,C=C+Math.imul(G,vt)|0,T=T+Math.imul(J,wt)|0,g=g+Math.imul(J,xt)|0,g=g+Math.imul(re,wt)|0,C=C+Math.imul(re,xt)|0,T=T+Math.imul(P,At)|0,g=g+Math.imul(P,_t)|0,g=g+Math.imul(O,At)|0,C=C+Math.imul(O,_t)|0,T=T+Math.imul(E,Et)|0,g=g+Math.imul(E,St)|0,g=g+Math.imul(X,Et)|0,C=C+Math.imul(X,St)|0,T=T+Math.imul(V,Ct)|0,g=g+Math.imul(V,Tt)|0,g=g+Math.imul(F,Ct)|0,C=C+Math.imul(F,Tt)|0;var p0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(p0>>>26)|0,p0&=67108863,T=Math.imul(q,Pe),g=Math.imul(q,Ee),g=g+Math.imul(oe,Pe)|0,C=Math.imul(oe,Ee),T=T+Math.imul(te,We)|0,g=g+Math.imul(te,st)|0,g=g+Math.imul(W,We)|0,C=C+Math.imul(W,st)|0,T=T+Math.imul(Ie,pt)|0,g=g+Math.imul(Ie,mt)|0,g=g+Math.imul(Xe,pt)|0,C=C+Math.imul(Xe,mt)|0,T=T+Math.imul(ie,bt)|0,g=g+Math.imul(ie,gt)|0,g=g+Math.imul(me,bt)|0,C=C+Math.imul(me,gt)|0,T=T+Math.imul(ee,yt)|0,g=g+Math.imul(ee,vt)|0,g=g+Math.imul(fe,yt)|0,C=C+Math.imul(fe,vt)|0,T=T+Math.imul(se,wt)|0,g=g+Math.imul(se,xt)|0,g=g+Math.imul(G,wt)|0,C=C+Math.imul(G,xt)|0,T=T+Math.imul(J,At)|0,g=g+Math.imul(J,_t)|0,g=g+Math.imul(re,At)|0,C=C+Math.imul(re,_t)|0,T=T+Math.imul(P,Et)|0,g=g+Math.imul(P,St)|0,g=g+Math.imul(O,Et)|0,C=C+Math.imul(O,St)|0,T=T+Math.imul(E,Ct)|0,g=g+Math.imul(E,Tt)|0,g=g+Math.imul(X,Ct)|0,C=C+Math.imul(X,Tt)|0;var m0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(m0>>>26)|0,m0&=67108863,T=Math.imul(q,We),g=Math.imul(q,st),g=g+Math.imul(oe,We)|0,C=Math.imul(oe,st),T=T+Math.imul(te,pt)|0,g=g+Math.imul(te,mt)|0,g=g+Math.imul(W,pt)|0,C=C+Math.imul(W,mt)|0,T=T+Math.imul(Ie,bt)|0,g=g+Math.imul(Ie,gt)|0,g=g+Math.imul(Xe,bt)|0,C=C+Math.imul(Xe,gt)|0,T=T+Math.imul(ie,yt)|0,g=g+Math.imul(ie,vt)|0,g=g+Math.imul(me,yt)|0,C=C+Math.imul(me,vt)|0,T=T+Math.imul(ee,wt)|0,g=g+Math.imul(ee,xt)|0,g=g+Math.imul(fe,wt)|0,C=C+Math.imul(fe,xt)|0,T=T+Math.imul(se,At)|0,g=g+Math.imul(se,_t)|0,g=g+Math.imul(G,At)|0,C=C+Math.imul(G,_t)|0,T=T+Math.imul(J,Et)|0,g=g+Math.imul(J,St)|0,g=g+Math.imul(re,Et)|0,C=C+Math.imul(re,St)|0,T=T+Math.imul(P,Ct)|0,g=g+Math.imul(P,Tt)|0,g=g+Math.imul(O,Ct)|0,C=C+Math.imul(O,Tt)|0;var b0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(b0>>>26)|0,b0&=67108863,T=Math.imul(q,pt),g=Math.imul(q,mt),g=g+Math.imul(oe,pt)|0,C=Math.imul(oe,mt),T=T+Math.imul(te,bt)|0,g=g+Math.imul(te,gt)|0,g=g+Math.imul(W,bt)|0,C=C+Math.imul(W,gt)|0,T=T+Math.imul(Ie,yt)|0,g=g+Math.imul(Ie,vt)|0,g=g+Math.imul(Xe,yt)|0,C=C+Math.imul(Xe,vt)|0,T=T+Math.imul(ie,wt)|0,g=g+Math.imul(ie,xt)|0,g=g+Math.imul(me,wt)|0,C=C+Math.imul(me,xt)|0,T=T+Math.imul(ee,At)|0,g=g+Math.imul(ee,_t)|0,g=g+Math.imul(fe,At)|0,C=C+Math.imul(fe,_t)|0,T=T+Math.imul(se,Et)|0,g=g+Math.imul(se,St)|0,g=g+Math.imul(G,Et)|0,C=C+Math.imul(G,St)|0,T=T+Math.imul(J,Ct)|0,g=g+Math.imul(J,Tt)|0,g=g+Math.imul(re,Ct)|0,C=C+Math.imul(re,Tt)|0;var g0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(g0>>>26)|0,g0&=67108863,T=Math.imul(q,bt),g=Math.imul(q,gt),g=g+Math.imul(oe,bt)|0,C=Math.imul(oe,gt),T=T+Math.imul(te,yt)|0,g=g+Math.imul(te,vt)|0,g=g+Math.imul(W,yt)|0,C=C+Math.imul(W,vt)|0,T=T+Math.imul(Ie,wt)|0,g=g+Math.imul(Ie,xt)|0,g=g+Math.imul(Xe,wt)|0,C=C+Math.imul(Xe,xt)|0,T=T+Math.imul(ie,At)|0,g=g+Math.imul(ie,_t)|0,g=g+Math.imul(me,At)|0,C=C+Math.imul(me,_t)|0,T=T+Math.imul(ee,Et)|0,g=g+Math.imul(ee,St)|0,g=g+Math.imul(fe,Et)|0,C=C+Math.imul(fe,St)|0,T=T+Math.imul(se,Ct)|0,g=g+Math.imul(se,Tt)|0,g=g+Math.imul(G,Ct)|0,C=C+Math.imul(G,Tt)|0;var y0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(y0>>>26)|0,y0&=67108863,T=Math.imul(q,yt),g=Math.imul(q,vt),g=g+Math.imul(oe,yt)|0,C=Math.imul(oe,vt),T=T+Math.imul(te,wt)|0,g=g+Math.imul(te,xt)|0,g=g+Math.imul(W,wt)|0,C=C+Math.imul(W,xt)|0,T=T+Math.imul(Ie,At)|0,g=g+Math.imul(Ie,_t)|0,g=g+Math.imul(Xe,At)|0,C=C+Math.imul(Xe,_t)|0,T=T+Math.imul(ie,Et)|0,g=g+Math.imul(ie,St)|0,g=g+Math.imul(me,Et)|0,C=C+Math.imul(me,St)|0,T=T+Math.imul(ee,Ct)|0,g=g+Math.imul(ee,Tt)|0,g=g+Math.imul(fe,Ct)|0,C=C+Math.imul(fe,Tt)|0;var v0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(v0>>>26)|0,v0&=67108863,T=Math.imul(q,wt),g=Math.imul(q,xt),g=g+Math.imul(oe,wt)|0,C=Math.imul(oe,xt),T=T+Math.imul(te,At)|0,g=g+Math.imul(te,_t)|0,g=g+Math.imul(W,At)|0,C=C+Math.imul(W,_t)|0,T=T+Math.imul(Ie,Et)|0,g=g+Math.imul(Ie,St)|0,g=g+Math.imul(Xe,Et)|0,C=C+Math.imul(Xe,St)|0,T=T+Math.imul(ie,Ct)|0,g=g+Math.imul(ie,Tt)|0,g=g+Math.imul(me,Ct)|0,C=C+Math.imul(me,Tt)|0;var w0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(w0>>>26)|0,w0&=67108863,T=Math.imul(q,At),g=Math.imul(q,_t),g=g+Math.imul(oe,At)|0,C=Math.imul(oe,_t),T=T+Math.imul(te,Et)|0,g=g+Math.imul(te,St)|0,g=g+Math.imul(W,Et)|0,C=C+Math.imul(W,St)|0,T=T+Math.imul(Ie,Ct)|0,g=g+Math.imul(Ie,Tt)|0,g=g+Math.imul(Xe,Ct)|0,C=C+Math.imul(Xe,Tt)|0;var x0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(x0>>>26)|0,x0&=67108863,T=Math.imul(q,Et),g=Math.imul(q,St),g=g+Math.imul(oe,Et)|0,C=Math.imul(oe,St),T=T+Math.imul(te,Ct)|0,g=g+Math.imul(te,Tt)|0,g=g+Math.imul(W,Ct)|0,C=C+Math.imul(W,Tt)|0;var A0=(I+T|0)+((g&8191)<<13)|0;I=(C+(g>>>13)|0)+(A0>>>26)|0,A0&=67108863,T=Math.imul(q,Ct),g=Math.imul(q,Tt),g=g+Math.imul(oe,Ct)|0,C=Math.imul(oe,Tt);var _0=(I+T|0)+((g&8191)<<13)|0;return I=(C+(g>>>13)|0)+(_0>>>26)|0,_0&=67108863,N[0]=To,N[1]=ko,N[2]=Mo,N[3]=Bo,N[4]=Io,N[5]=No,N[6]=Oo,N[7]=Po,N[8]=d0,N[9]=p0,N[10]=m0,N[11]=b0,N[12]=g0,N[13]=y0,N[14]=v0,N[15]=w0,N[16]=x0,N[17]=A0,N[18]=_0,I!==0&&(N[19]=I,m.length++),m},"comb10MulTo");Math.imul||(v=A);function x(b,u,p){p.negative=u.negative^b.negative,p.length=b.length+u.length;for(var m=0,w=0,S=0;S<p.length-1;S++){var N=w;w=0;for(var I=m&67108863,T=Math.min(S,u.length-1),g=Math.max(0,S-b.length+1);g<=T;g++){var C=S-g,Z=b.words[C]|0,V=u.words[g]|0,F=Z*V,ce=F&67108863;N=N+(F/67108864|0)|0,ce=ce+I|0,I=ce&67108863,N=N+(ce>>>26)|0,w+=N>>>26,N&=67108863}p.words[S]=I,m=N,N=w}return m!==0?p.words[S]=m:p.length--,p.strip()}s(x,"bigMulTo");function L(b,u,p){var m=new _;return m.mulp(b,u,p)}s(L,"jumboMulTo"),i.prototype.mulTo=s(function(u,p){var m,w=this.length+u.length;return this.length===10&&u.length===10?m=v(this,u,p):w<63?m=A(this,u,p):w<1024?m=x(this,u,p):m=L(this,u,p),m},"mulTo");function _(b,u){this.x=b,this.y=u}s(_,"FFTM"),_.prototype.makeRBT=s(function(u){for(var p=new Array(u),m=i.prototype._countBits(u)-1,w=0;w<u;w++)p[w]=this.revBin(w,m,u);return p},"makeRBT"),_.prototype.revBin=s(function(u,p,m){if(u===0||u===m-1)return u;for(var w=0,S=0;S<p;S++)w|=(u&1)<<p-S-1,u>>=1;return w},"revBin"),_.prototype.permute=s(function(u,p,m,w,S,N){for(var I=0;I<N;I++)w[I]=p[u[I]],S[I]=m[u[I]]},"permute"),_.prototype.transform=s(function(u,p,m,w,S,N){this.permute(N,u,p,m,w,S);for(var I=1;I<S;I<<=1)for(var T=I<<1,g=Math.cos(2*Math.PI/T),C=Math.sin(2*Math.PI/T),Z=0;Z<S;Z+=T)for(var V=g,F=C,ce=0;ce<I;ce++){var E=m[Z+ce],X=w[Z+ce],Q=m[Z+ce+I],P=w[Z+ce+I],O=V*Q-F*P;P=V*P+F*Q,Q=O,m[Z+ce]=E+Q,w[Z+ce]=X+P,m[Z+ce+I]=E-Q,w[Z+ce+I]=X-P,ce!==T&&(O=g*V-C*F,F=g*F+C*V,V=O)}},"transform"),_.prototype.guessLen13b=s(function(u,p){var m=Math.max(p,u)|1,w=m&1,S=0;for(m=m/2|0;m;m=m>>>1)S++;return 1<<S+1+w},"guessLen13b"),_.prototype.conjugate=s(function(u,p,m){if(!(m<=1))for(var w=0;w<m/2;w++){var S=u[w];u[w]=u[m-w-1],u[m-w-1]=S,S=p[w],p[w]=-p[m-w-1],p[m-w-1]=-S}},"conjugate"),_.prototype.normalize13b=s(function(u,p){for(var m=0,w=0;w<p/2;w++){var S=Math.round(u[2*w+1]/p)*8192+Math.round(u[2*w]/p)+m;u[w]=S&67108863,S<67108864?m=0:m=S/67108864|0}return u},"normalize13b"),_.prototype.convert13b=s(function(u,p,m,w){for(var S=0,N=0;N<p;N++)S=S+(u[N]|0),m[2*N]=S&8191,S=S>>>13,m[2*N+1]=S&8191,S=S>>>13;for(N=2*p;N<w;++N)m[N]=0;t(S===0),t((S&-8192)===0)},"convert13b"),_.prototype.stub=s(function(u){for(var p=new Array(u),m=0;m<u;m++)p[m]=0;return p},"stub"),_.prototype.mulp=s(function(u,p,m){var w=2*this.guessLen13b(u.length,p.length),S=this.makeRBT(w),N=this.stub(w),I=new Array(w),T=new Array(w),g=new Array(w),C=new Array(w),Z=new Array(w),V=new Array(w),F=m.words;F.length=w,this.convert13b(u.words,u.length,I,w),this.convert13b(p.words,p.length,C,w),this.transform(I,N,T,g,w,S),this.transform(C,N,Z,V,w,S);for(var ce=0;ce<w;ce++){var E=T[ce]*Z[ce]-g[ce]*V[ce];g[ce]=T[ce]*V[ce]+g[ce]*Z[ce],T[ce]=E}return this.conjugate(T,g,w),this.transform(T,g,F,N,w,S),this.conjugate(F,N,w),this.normalize13b(F,w),m.negative=u.negative^p.negative,m.length=u.length+p.length,m.strip()},"mulp"),i.prototype.mul=s(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),this.mulTo(u,p)},"mul"),i.prototype.mulf=s(function(u){var p=new i(null);return p.words=new Array(this.length+u.length),L(this,u,p)},"mulf"),i.prototype.imul=s(function(u){return this.clone().mulTo(u,this)},"imul"),i.prototype.imuln=s(function(u){t(typeof u=="number"),t(u<67108864);for(var p=0,m=0;m<this.length;m++){var w=(this.words[m]|0)*u,S=(w&67108863)+(p&67108863);p>>=26,p+=w/67108864|0,p+=S>>>26,this.words[m]=S&67108863}return p!==0&&(this.words[m]=p,this.length++),this},"imuln"),i.prototype.muln=s(function(u){return this.clone().imuln(u)},"muln"),i.prototype.sqr=s(function(){return this.mul(this)},"sqr"),i.prototype.isqr=s(function(){return this.imul(this.clone())},"isqr"),i.prototype.pow=s(function(u){var p=y(u);if(p.length===0)return new i(1);for(var m=this,w=0;w<p.length&&p[w]===0;w++,m=m.sqr());if(++w<p.length)for(var S=m.sqr();w<p.length;w++,S=S.sqr())p[w]!==0&&(m=m.mul(S));return m},"pow"),i.prototype.iushln=s(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=67108863>>>26-p<<26-p,S;if(p!==0){var N=0;for(S=0;S<this.length;S++){var I=this.words[S]&w,T=(this.words[S]|0)-I<<p;this.words[S]=T|N,N=I>>>26-p}N&&(this.words[S]=N,this.length++)}if(m!==0){for(S=this.length-1;S>=0;S--)this.words[S+m]=this.words[S];for(S=0;S<m;S++)this.words[S]=0;this.length+=m}return this.strip()},"iushln"),i.prototype.ishln=s(function(u){return t(this.negative===0),this.iushln(u)},"ishln"),i.prototype.iushrn=s(function(u,p,m){t(typeof u=="number"&&u>=0);var w;p?w=(p-p%26)/26:w=0;var S=u%26,N=Math.min((u-S)/26,this.length),I=67108863^67108863>>>S<<S,T=m;if(w-=N,w=Math.max(0,w),T){for(var g=0;g<N;g++)T.words[g]=this.words[g];T.length=N}if(N!==0)if(this.length>N)for(this.length-=N,g=0;g<this.length;g++)this.words[g]=this.words[g+N];else this.words[0]=0,this.length=1;var C=0;for(g=this.length-1;g>=0&&(C!==0||g>=w);g--){var Z=this.words[g]|0;this.words[g]=C<<26-S|Z>>>S,C=Z&I}return T&&C!==0&&(T.words[T.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},"iushrn"),i.prototype.ishrn=s(function(u,p,m){return t(this.negative===0),this.iushrn(u,p,m)},"ishrn"),i.prototype.shln=s(function(u){return this.clone().ishln(u)},"shln"),i.prototype.ushln=s(function(u){return this.clone().iushln(u)},"ushln"),i.prototype.shrn=s(function(u){return this.clone().ishrn(u)},"shrn"),i.prototype.ushrn=s(function(u){return this.clone().iushrn(u)},"ushrn"),i.prototype.testn=s(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return!1;var S=this.words[m];return!!(S&w)},"testn"),i.prototype.imaskn=s(function(u){t(typeof u=="number"&&u>=0);var p=u%26,m=(u-p)/26;if(t(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(p!==0&&m++,this.length=Math.min(m,this.length),p!==0){var w=67108863^67108863>>>p<<p;this.words[this.length-1]&=w}return this.strip()},"imaskn"),i.prototype.maskn=s(function(u){return this.clone().imaskn(u)},"maskn"),i.prototype.iaddn=s(function(u){return t(typeof u=="number"),t(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},"iaddn"),i.prototype._iaddn=s(function(u){this.words[0]+=u;for(var p=0;p<this.length&&this.words[p]>=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+1),this},"_iaddn"),i.prototype.isubn=s(function(u){if(t(typeof u=="number"),t(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var p=0;p<this.length&&this.words[p]<0;p++)this.words[p]+=67108864,this.words[p+1]-=1;return this.strip()},"isubn"),i.prototype.addn=s(function(u){return this.clone().iaddn(u)},"addn"),i.prototype.subn=s(function(u){return this.clone().isubn(u)},"subn"),i.prototype.iabs=s(function(){return this.negative=0,this},"iabs"),i.prototype.abs=s(function(){return this.clone().iabs()},"abs"),i.prototype._ishlnsubmul=s(function(u,p,m){var w=u.length+m,S;this._expand(w);var N,I=0;for(S=0;S<u.length;S++){N=(this.words[S+m]|0)+I;var T=(u.words[S]|0)*p;N-=T&67108863,I=(N>>26)-(T/67108864|0),this.words[S+m]=N&67108863}for(;S<this.length-m;S++)N=(this.words[S+m]|0)+I,I=N>>26,this.words[S+m]=N&67108863;if(I===0)return this.strip();for(t(I===-1),I=0,S=0;S<this.length;S++)N=-(this.words[S]|0)+I,I=N>>26,this.words[S]=N&67108863;return this.negative=1,this.strip()},"_ishlnsubmul"),i.prototype._wordDiv=s(function(u,p){var m=this.length-u.length,w=this.clone(),S=u,N=S.words[S.length-1]|0,I=this._countBits(N);m=26-I,m!==0&&(S=S.ushln(m),w.iushln(m),N=S.words[S.length-1]|0);var T=w.length-S.length,g;if(p!=="mod"){g=new i(null),g.length=T+1,g.words=new Array(g.length);for(var C=0;C<g.length;C++)g.words[C]=0}var Z=w.clone()._ishlnsubmul(S,1,T);Z.negative===0&&(w=Z,g&&(g.words[T]=1));for(var V=T-1;V>=0;V--){var F=(w.words[S.length+V]|0)*67108864+(w.words[S.length+V-1]|0);for(F=Math.min(F/N|0,67108863),w._ishlnsubmul(S,F,V);w.negative!==0;)F--,w.negative=0,w._ishlnsubmul(S,1,V),w.isZero()||(w.negative^=1);g&&(g.words[V]=F)}return g&&g.strip(),w.strip(),p!=="div"&&m!==0&&w.iushrn(m),{div:g||null,mod:w}},"_wordDiv"),i.prototype.divmod=s(function(u,p,m){if(t(!u.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var w,S,N;return this.negative!==0&&u.negative===0?(N=this.neg().divmod(u,p),p!=="mod"&&(w=N.div.neg()),p!=="div"&&(S=N.mod.neg(),m&&S.negative!==0&&S.iadd(u)),{div:w,mod:S}):this.negative===0&&u.negative!==0?(N=this.divmod(u.neg(),p),p!=="mod"&&(w=N.div.neg()),{div:w,mod:N.mod}):(this.negative&u.negative)!==0?(N=this.neg().divmod(u.neg(),p),p!=="div"&&(S=N.mod.neg(),m&&S.negative!==0&&S.isub(u)),{div:N.div,mod:S}):u.length>this.length||this.cmp(u)<0?{div:new i(0),mod:this}:u.length===1?p==="div"?{div:this.divn(u.words[0]),mod:null}:p==="mod"?{div:null,mod:new i(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new i(this.modn(u.words[0]))}:this._wordDiv(u,p)},"divmod"),i.prototype.div=s(function(u){return this.divmod(u,"div",!1).div},"div"),i.prototype.mod=s(function(u){return this.divmod(u,"mod",!1).mod},"mod"),i.prototype.umod=s(function(u){return this.divmod(u,"mod",!0).mod},"umod"),i.prototype.divRound=s(function(u){var p=this.divmod(u);if(p.mod.isZero())return p.div;var m=p.div.negative!==0?p.mod.isub(u):p.mod,w=u.ushrn(1),S=u.andln(1),N=m.cmp(w);return N<0||S===1&&N===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},"divRound"),i.prototype.modn=s(function(u){t(u<=67108863);for(var p=(1<<26)%u,m=0,w=this.length-1;w>=0;w--)m=(p*m+(this.words[w]|0))%u;return m},"modn"),i.prototype.idivn=s(function(u){t(u<=67108863);for(var p=0,m=this.length-1;m>=0;m--){var w=(this.words[m]|0)+p*67108864;this.words[m]=w/u|0,p=w%u}return this.strip()},"idivn"),i.prototype.divn=s(function(u){return this.clone().idivn(u)},"divn"),i.prototype.egcd=s(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),N=new i(0),I=new i(1),T=0;p.isEven()&&m.isEven();)p.iushrn(1),m.iushrn(1),++T;for(var g=m.clone(),C=p.clone();!p.isZero();){for(var Z=0,V=1;(p.words[0]&V)===0&&Z<26;++Z,V<<=1);if(Z>0)for(p.iushrn(Z);Z-- >0;)(w.isOdd()||S.isOdd())&&(w.iadd(g),S.isub(C)),w.iushrn(1),S.iushrn(1);for(var F=0,ce=1;(m.words[0]&ce)===0&&F<26;++F,ce<<=1);if(F>0)for(m.iushrn(F);F-- >0;)(N.isOdd()||I.isOdd())&&(N.iadd(g),I.isub(C)),N.iushrn(1),I.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(N),S.isub(I)):(m.isub(p),N.isub(w),I.isub(S))}return{a:N,b:I,gcd:m.iushln(T)}},"egcd"),i.prototype._invmp=s(function(u){t(u.negative===0),t(!u.isZero());var p=this,m=u.clone();p.negative!==0?p=p.umod(u):p=p.clone();for(var w=new i(1),S=new i(0),N=m.clone();p.cmpn(1)>0&&m.cmpn(1)>0;){for(var I=0,T=1;(p.words[0]&T)===0&&I<26;++I,T<<=1);if(I>0)for(p.iushrn(I);I-- >0;)w.isOdd()&&w.iadd(N),w.iushrn(1);for(var g=0,C=1;(m.words[0]&C)===0&&g<26;++g,C<<=1);if(g>0)for(m.iushrn(g);g-- >0;)S.isOdd()&&S.iadd(N),S.iushrn(1);p.cmp(m)>=0?(p.isub(m),w.isub(S)):(m.isub(p),S.isub(w))}var Z;return p.cmpn(1)===0?Z=w:Z=S,Z.cmpn(0)<0&&Z.iadd(u),Z},"_invmp"),i.prototype.gcd=s(function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var p=this.clone(),m=u.clone();p.negative=0,m.negative=0;for(var w=0;p.isEven()&&m.isEven();w++)p.iushrn(1),m.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;m.isEven();)m.iushrn(1);var S=p.cmp(m);if(S<0){var N=p;p=m,m=N}else if(S===0||m.cmpn(1)===0)break;p.isub(m)}while(!0);return m.iushln(w)},"gcd"),i.prototype.invm=s(function(u){return this.egcd(u).a.umod(u)},"invm"),i.prototype.isEven=s(function(){return(this.words[0]&1)===0},"isEven"),i.prototype.isOdd=s(function(){return(this.words[0]&1)===1},"isOdd"),i.prototype.andln=s(function(u){return this.words[0]&u},"andln"),i.prototype.bincn=s(function(u){t(typeof u=="number");var p=u%26,m=(u-p)/26,w=1<<p;if(this.length<=m)return this._expand(m+1),this.words[m]|=w,this;for(var S=w,N=m;S!==0&&N<this.length;N++){var I=this.words[N]|0;I+=S,S=I>>>26,I&=67108863,this.words[N]=I}return S!==0&&(this.words[N]=S,this.length++),this},"bincn"),i.prototype.isZero=s(function(){return this.length===1&&this.words[0]===0},"isZero"),i.prototype.cmpn=s(function(u){var p=u<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this.strip();var m;if(this.length>1)m=1;else{p&&(u=-u),t(u<=67108863,"Number is too big");var w=this.words[0]|0;m=w===u?0:w<u?-1:1}return this.negative!==0?-m|0:m},"cmpn"),i.prototype.cmp=s(function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var p=this.ucmp(u);return this.negative!==0?-p|0:p},"cmp"),i.prototype.ucmp=s(function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var p=0,m=this.length-1;m>=0;m--){var w=this.words[m]|0,S=u.words[m]|0;if(w!==S){w<S?p=-1:w>S&&(p=1);break}}return p},"ucmp"),i.prototype.gtn=s(function(u){return this.cmpn(u)===1},"gtn"),i.prototype.gt=s(function(u){return this.cmp(u)===1},"gt"),i.prototype.gten=s(function(u){return this.cmpn(u)>=0},"gten"),i.prototype.gte=s(function(u){return this.cmp(u)>=0},"gte"),i.prototype.ltn=s(function(u){return this.cmpn(u)===-1},"ltn"),i.prototype.lt=s(function(u){return this.cmp(u)===-1},"lt"),i.prototype.lten=s(function(u){return this.cmpn(u)<=0},"lten"),i.prototype.lte=s(function(u){return this.cmp(u)<=0},"lte"),i.prototype.eqn=s(function(u){return this.cmpn(u)===0},"eqn"),i.prototype.eq=s(function(u){return this.cmp(u)===0},"eq"),i.red=s(function(u){return new U(u)},"red"),i.prototype.toRed=s(function(u){return t(!this.red,"Already a number in reduction context"),t(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},"toRed"),i.prototype.fromRed=s(function(){return t(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),i.prototype._forceRed=s(function(u){return this.red=u,this},"_forceRed"),i.prototype.forceRed=s(function(u){return t(!this.red,"Already a number in reduction context"),this._forceRed(u)},"forceRed"),i.prototype.redAdd=s(function(u){return t(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},"redAdd"),i.prototype.redIAdd=s(function(u){return t(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},"redIAdd"),i.prototype.redSub=s(function(u){return t(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},"redSub"),i.prototype.redISub=s(function(u){return t(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},"redISub"),i.prototype.redShl=s(function(u){return t(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},"redShl"),i.prototype.redMul=s(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},"redMul"),i.prototype.redIMul=s(function(u){return t(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},"redIMul"),i.prototype.redSqr=s(function(){return t(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),i.prototype.redISqr=s(function(){return t(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),i.prototype.redSqrt=s(function(){return t(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),i.prototype.redInvm=s(function(){return t(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),i.prototype.redNeg=s(function(){return t(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),i.prototype.redPow=s(function(u){return t(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)},"redPow");var R={k256:null,p224:null,p192:null,p25519:null};function H(b,u){this.name=b,this.p=new i(u,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}s(H,"MPrime"),H.prototype._tmp=s(function(){var u=new i(null);return u.words=new Array(Math.ceil(this.n/13)),u},"_tmp"),H.prototype.ireduce=s(function(u){var p=u,m;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),m=p.bitLength();while(m>this.n);var w=m<this.n?-1:p.ucmp(this.p);return w===0?(p.words[0]=0,p.length=1):w>0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},"ireduce"),H.prototype.split=s(function(u,p){u.iushrn(this.n,0,p)},"split"),H.prototype.imulK=s(function(u){return u.imul(this.k)},"imulK");function $(){H.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s($,"K256"),n($,H),$.prototype.split=s(function(u,p){for(var m=4194303,w=Math.min(u.length,9),S=0;S<w;S++)p.words[S]=u.words[S];if(p.length=w,u.length<=9){u.words[0]=0,u.length=1;return}var N=u.words[9];for(p.words[p.length++]=N&m,S=10;S<u.length;S++){var I=u.words[S]|0;u.words[S-10]=(I&m)<<4|N>>>22,N=I}N>>>=22,u.words[S-10]=N,N===0&&u.length>10?u.length-=10:u.length-=9},"split"),$.prototype.imulK=s(function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var p=0,m=0;m<u.length;m++){var w=u.words[m]|0;p+=w*977,u.words[m]=p&67108863,p=w*64+(p/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u},"imulK");function j(){H.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(j,"P224"),n(j,H);function D(){H.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(D,"P192"),n(D,H);function B(){H.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(B,"P25519"),n(B,H),B.prototype.imulK=s(function(u){for(var p=0,m=0;m<u.length;m++){var w=(u.words[m]|0)*19+p,S=w&67108863;w>>>=26,u.words[m]=S,p=w}return p!==0&&(u.words[u.length++]=p),u},"imulK"),i._prime=s(function(u){if(R[u])return R[u];var p;if(u==="k256")p=new $;else if(u==="p224")p=new j;else if(u==="p192")p=new D;else if(u==="p25519")p=new B;else throw new Error("Unknown prime "+u);return R[u]=p,p},"prime");function U(b){if(typeof b=="string"){var u=i._prime(b);this.m=u.p,this.prime=u}else t(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}s(U,"Red"),U.prototype._verify1=s(function(u){t(u.negative===0,"red works only with positives"),t(u.red,"red works only with red numbers")},"_verify1"),U.prototype._verify2=s(function(u,p){t((u.negative|p.negative)===0,"red works only with positives"),t(u.red&&u.red===p.red,"red works only with red numbers")},"_verify2"),U.prototype.imod=s(function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},"imod"),U.prototype.neg=s(function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},"neg"),U.prototype.add=s(function(u,p){this._verify2(u,p);var m=u.add(p);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},"add"),U.prototype.iadd=s(function(u,p){this._verify2(u,p);var m=u.iadd(p);return m.cmp(this.m)>=0&&m.isub(this.m),m},"iadd"),U.prototype.sub=s(function(u,p){this._verify2(u,p);var m=u.sub(p);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},"sub"),U.prototype.isub=s(function(u,p){this._verify2(u,p);var m=u.isub(p);return m.cmpn(0)<0&&m.iadd(this.m),m},"isub"),U.prototype.shl=s(function(u,p){return this._verify1(u),this.imod(u.ushln(p))},"shl"),U.prototype.imul=s(function(u,p){return this._verify2(u,p),this.imod(u.imul(p))},"imul"),U.prototype.mul=s(function(u,p){return this._verify2(u,p),this.imod(u.mul(p))},"mul"),U.prototype.isqr=s(function(u){return this.imul(u,u.clone())},"isqr"),U.prototype.sqr=s(function(u){return this.mul(u,u)},"sqr"),U.prototype.sqrt=s(function(u){if(u.isZero())return u.clone();var p=this.m.andln(3);if(t(p%2===1),p===3){var m=this.m.add(new i(1)).iushrn(2);return this.pow(u,m)}for(var w=this.m.subn(1),S=0;!w.isZero()&&w.andln(1)===0;)S++,w.iushrn(1);t(!w.isZero());var N=new i(1).toRed(this),I=N.redNeg(),T=this.m.subn(1).iushrn(1),g=this.m.bitLength();for(g=new i(2*g*g).toRed(this);this.pow(g,T).cmp(I)!==0;)g.redIAdd(I);for(var C=this.pow(g,w),Z=this.pow(u,w.addn(1).iushrn(1)),V=this.pow(u,w),F=S;V.cmp(N)!==0;){for(var ce=V,E=0;ce.cmp(N)!==0;E++)ce=ce.redSqr();t(E<F);var X=this.pow(C,new i(1).iushln(F-E-1));Z=Z.redMul(X),C=X.redSqr(),V=V.redMul(C),F=E}return Z},"sqrt"),U.prototype.invm=s(function(u){var p=u._invmp(this.m);return p.negative!==0?(p.negative=0,this.imod(p).redNeg()):this.imod(p)},"invm"),U.prototype.pow=s(function(u,p){if(p.isZero())return new i(1).toRed(this);if(p.cmpn(1)===0)return u.clone();var m=4,w=new Array(1<<m);w[0]=new i(1).toRed(this),w[1]=u;for(var S=2;S<w.length;S++)w[S]=this.mul(w[S-1],u);var N=w[0],I=0,T=0,g=p.bitLength()%26;for(g===0&&(g=26),S=p.length-1;S>=0;S--){for(var C=p.words[S],Z=g-1;Z>=0;Z--){var V=C>>Z&1;if(N!==w[0]&&(N=this.sqr(N)),V===0&&I===0){T=0;continue}I<<=1,I|=V,T++,!(T!==m&&(S!==0||Z!==0))&&(N=this.mul(N,w[I]),T=0,I=0)}g=26}return N},"pow"),U.prototype.convertTo=s(function(u){var p=u.umod(this.m);return p===u?p.clone():p},"convertTo"),U.prototype.convertFrom=s(function(u){var p=u.clone();return p.red=null,p},"convertFrom"),i.mont=s(function(u){return new Y(u)},"mont");function Y(b){U.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(Y,"Mont"),n(Y,U),Y.prototype.convertTo=s(function(u){return this.imod(u.ushln(this.shift))},"convertTo"),Y.prototype.convertFrom=s(function(u){var p=this.imod(u.mul(this.rinv));return p.red=null,p},"convertFrom"),Y.prototype.imul=s(function(u,p){if(u.isZero()||p.isZero())return u.words[0]=0,u.length=1,u;var m=u.imul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),N=S;return S.cmp(this.m)>=0?N=S.isub(this.m):S.cmpn(0)<0&&(N=S.iadd(this.m)),N._forceRed(this)},"imul"),Y.prototype.mul=s(function(u,p){if(u.isZero()||p.isZero())return new i(0)._forceRed(this);var m=u.mul(p),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=m.isub(w).iushrn(this.shift),N=S;return S.cmp(this.m)>=0?N=S.isub(this.m):S.cmpn(0)<0&&(N=S.iadd(this.m)),N._forceRed(this)},"mul"),Y.prototype.invm=s(function(u){var p=this.imod(u._invmp(this.m).mul(this.r2));return p._forceRed(this)},"invm")})(typeof ym=="undefined"||ym,vw)});var cs=de((ZD,xw)=>{xw.exports=ww;function ww(r,e){if(!r)throw new Error(e||"Assertion failed")}s(ww,"assert");ww.equal=s(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual")});var vm=de(Ew=>{"use strict";var ad=Ew;function k7(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r!="string"){for(var n=0;n<r.length;n++)t[n]=r[n]|0;return t}if(e==="hex"){r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r);for(var n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(var n=0;n<r.length;n++){var i=r.charCodeAt(n),o=i>>8,a=i&255;o?t.push(o,a):t.push(a)}return t}s(k7,"toArray");ad.toArray=k7;function Aw(r){return r.length===1?"0"+r:r}s(Aw,"zero2");ad.zero2=Aw;function _w(r){for(var e="",t=0;t<r.length;t++)e+=Aw(r[t].toString(16));return e}s(_w,"toHex");ad.toHex=_w;ad.encode=s(function(e,t){return t==="hex"?_w(e):e},"encode")});var an=de(Sw=>{"use strict";var Yn=Sw,M7=Cn(),B7=cs(),fd=vm();Yn.assert=B7;Yn.toArray=fd.toArray;Yn.zero2=fd.zero2;Yn.toHex=fd.toHex;Yn.encode=fd.encode;function I7(r,e,t){var n=new Array(Math.max(r.bitLength(),t)+1);n.fill(0);for(var i=1<<e+1,o=r.clone(),a=0;a<n.length;a++){var f,c=o.andln(i-1);o.isOdd()?(c>(i>>1)-1?f=(i>>1)-c:f=c,o.isubn(f)):f=0,n[a]=f,o.iushrn(1)}return n}s(I7,"getNAF");Yn.getNAF=I7;function N7(r,e){var t=[[],[]];r=r.clone(),e=e.clone();for(var n=0,i=0,o;r.cmpn(-n)>0||e.cmpn(-i)>0;){var a=r.andln(3)+n&3,f=e.andln(3)+i&3;a===3&&(a=-1),f===3&&(f=-1);var c;(a&1)===0?c=0:(o=r.andln(7)+n&7,(o===3||o===5)&&f===2?c=-a:c=a),t[0].push(c);var l;(f&1)===0?l=0:(o=e.andln(7)+i&7,(o===3||o===5)&&a===2?l=-f:l=f),t[1].push(l),2*n===c+1&&(n=1-n),2*i===l+1&&(i=1-i),r.iushrn(1),e.iushrn(1)}return t}s(N7,"getJSF");Yn.getJSF=N7;function O7(r,e,t){var n="_"+e;r.prototype[e]=s(function(){return this[n]!==void 0?this[n]:this[n]=t.call(this)},"cachedProperty")}s(O7,"cachedProperty");Yn.cachedProperty=O7;function P7(r){return typeof r=="string"?Yn.toArray(r,"hex"):r}s(P7,"parseBytes");Yn.parseBytes=P7;function R7(r){return new M7(r,"hex","le")}s(R7,"intFromLE");Yn.intFromLE=R7});var _m=de((tF,Am)=>{var wm;Am.exports=s(function(e){return wm||(wm=new us(null)),wm.generate(e)},"rand");function us(r){this.rand=r}s(us,"Rand");Am.exports.Rand=us;us.prototype.generate=s(function(e){return this._rand(e)},"generate");us.prototype._rand=s(function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"_rand");if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?us.prototype._rand=s(function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t},"_rand"):self.msCrypto&&self.msCrypto.getRandomValues?us.prototype._rand=s(function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t},"_rand"):typeof window=="object"&&(us.prototype._rand=function(){throw new Error("Not implemented yet")});else try{if(xm=require("crypto"),typeof xm.randomBytes!="function")throw new Error("Not supported");us.prototype._rand=s(function(e){return xm.randomBytes(e)},"_rand")}catch(r){}var xm});var Cu=de((rF,Cw)=>{"use strict";var ia=Cn(),Su=an(),cd=Su.getNAF,U7=Su.getJSF,ud=Su.assert;function ls(r,e){this.type=r,this.p=new ia(e.p,16),this.red=e.prime?ia.red(e.prime):ia.mont(this.p),this.zero=new ia(0).toRed(this.red),this.one=new ia(1).toRed(this.red),this.two=new ia(2).toRed(this.red),this.n=e.n&&new ia(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 t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}s(ls,"BaseCurve");Cw.exports=ls;ls.prototype.point=s(function(){throw new Error("Not implemented")},"point");ls.prototype.validate=s(function(){throw new Error("Not implemented")},"validate");ls.prototype._fixedNafMul=s(function(e,t){ud(e.precomputed);var n=e._getDoubles(),i=cd(t,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var a=[],f,c;for(f=0;f<i.length;f+=n.step){c=0;for(var l=f+n.step-1;l>=f;l--)c=(c<<1)+i[l];a.push(c)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),y=o;y>0;y--){for(f=0;f<a.length;f++)c=a[f],c===y?d=d.mixedAdd(n.points[f]):c===-y&&(d=d.mixedAdd(n.points[f].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");ls.prototype._wnafMul=s(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var o=i.points,a=cd(t,n,this._bitLength),f=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var l=0;c>=0&&a[c]===0;c--)l++;if(c>=0&&l++,f=f.dblp(l),c<0)break;var h=a[c];ud(h!==0),e.type==="affine"?h>0?f=f.mixedAdd(o[h-1>>1]):f=f.mixedAdd(o[-h-1>>1].neg()):h>0?f=f.add(o[h-1>>1]):f=f.add(o[-h-1>>1].neg())}return e.type==="affine"?f.toP():f},"_wnafMul");ls.prototype._wnafMulAdd=s(function(e,t,n,i,o){var a=this._wnafT1,f=this._wnafT2,c=this._wnafT3,l=0,h,d,y;for(h=0;h<i;h++){y=t[h];var A=y._getNAFPoints(e);a[h]=A.wnd,f[h]=A.points}for(h=i-1;h>=1;h-=2){var v=h-1,x=h;if(a[v]!==1||a[x]!==1){c[v]=cd(n[v],a[v],this._bitLength),c[x]=cd(n[x],a[x],this._bitLength),l=Math.max(c[v].length,l),l=Math.max(c[x].length,l);continue}var L=[t[v],null,null,t[x]];t[v].y.cmp(t[x].y)===0?(L[1]=t[v].add(t[x]),L[2]=t[v].toJ().mixedAdd(t[x].neg())):t[v].y.cmp(t[x].y.redNeg())===0?(L[1]=t[v].toJ().mixedAdd(t[x]),L[2]=t[v].add(t[x].neg())):(L[1]=t[v].toJ().mixedAdd(t[x]),L[2]=t[v].toJ().mixedAdd(t[x].neg()));var _=[-3,-1,-5,-7,0,7,5,1,3],R=U7(n[v],n[x]);for(l=Math.max(R[0].length,l),c[v]=new Array(l),c[x]=new Array(l),d=0;d<l;d++){var H=R[0][d]|0,$=R[1][d]|0;c[v][d]=_[(H+1)*3+($+1)],c[x][d]=0,f[v]=L}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var U=!0;for(d=0;d<i;d++)D[d]=c[d][h]|0,D[d]!==0&&(U=!1);if(!U)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?y=f[d][Y-1>>1]:Y<0&&(y=f[d][-Y-1>>1].neg()),y.type==="affine"?j=j.mixedAdd(y):j=j.add(y))}}for(h=0;h<i;h++)f[h]=null;return o?j:j.toP()},"_wnafMulAdd");function Tn(r,e){this.curve=r,this.type=e,this.precomputed=null}s(Tn,"BasePoint");ls.BasePoint=Tn;Tn.prototype.eq=s(function(){throw new Error("Not implemented")},"eq");Tn.prototype.validate=s(function(){return this.curve.validate(this)},"validate");ls.prototype.decodePoint=s(function(e,t){e=Su.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?ud(e[e.length-1]%2===0):e[0]===7&&ud(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");Tn.prototype.encodeCompressed=s(function(e){return this.encode(e,!0)},"encodeCompressed");Tn.prototype._encode=s(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");Tn.prototype.encode=s(function(e,t){return Su.encode(this._encode(t),e)},"encode");Tn.prototype.precompute=s(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");Tn.prototype._hasDoubles=s(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");Tn.prototype._getDoubles=s(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<t;o+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");Tn.prototype._getNAFPoints=s(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),o=1;o<n;o++)t[o]=t[o-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");Tn.prototype._getBeta=s(function(){return null},"_getBeta");Tn.prototype.dblp=s(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp")});var Tu=de((nF,Em)=>{typeof Object.create=="function"?Em.exports=s(function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):Em.exports=s(function(e,t){if(t){e.super_=t;var n=s(function(){},"TempCtor");n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},"inherits")});var kw=de((iF,Tw)=>{"use strict";var L7=an(),Ot=Cn(),Sm=Tu(),wf=Cu(),D7=L7.assert;function kn(r){wf.call(this,"short",r),this.a=new Ot(r.a,16).toRed(this.red),this.b=new Ot(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}s(kn,"ShortCurve");Sm(kn,wf);Tw.exports=kn;kn.prototype._getEndomorphism=s(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Ot(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new Ot(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?n=o[0]:(n=o[1],D7(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new Ot(f.a,16),b:new Ot(f.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");kn.prototype._getEndoRoots=s(function(e){var t=e===this.p?this.red:Ot.mont(e),n=new Ot(2).toRed(t).redInvm(),i=n.redNeg(),o=new Ot(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(o).fromRed(),f=i.redSub(o).fromRed();return[a,f]},"_getEndoRoots");kn.prototype._getEndoBasis=s(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new Ot(1),a=new Ot(0),f=new Ot(0),c=new Ot(1),l,h,d,y,A,v,x,L=0,_,R;n.cmpn(0)!==0;){var H=i.div(n);_=i.sub(H.mul(n)),R=f.sub(H.mul(o));var $=c.sub(H.mul(a));if(!d&&_.cmp(t)<0)l=x.neg(),h=o,d=_.neg(),y=R;else if(d&&++L===2)break;x=_,i=n,n=_,f=o,o=R,c=a,a=$}A=_.neg(),v=R;var j=d.sqr().add(y.sqr()),D=A.sqr().add(v.sqr());return D.cmp(j)>=0&&(A=l,v=h),d.negative&&(d=d.neg(),y=y.neg()),A.negative&&(A=A.neg(),v=v.neg()),[{a:d,b:y},{a:A,b:v}]},"_getEndoBasis");kn.prototype._endoSplit=s(function(e){var t=this.endo.basis,n=t[0],i=t[1],o=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),f=o.mul(n.a),c=a.mul(i.a),l=o.mul(n.b),h=a.mul(i.b),d=e.sub(f).sub(c),y=l.add(h).neg();return{k1:d,k2:y}},"_endoSplit");kn.prototype.pointFromX=s(function(e,t){e=new Ot(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(t&&!o||!t&&o)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");kn.prototype.validate=s(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0},"validate");kn.prototype._endoWnafMulAdd=s(function(e,t,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),c=e[a],l=c._getBeta();f.k1.negative&&(f.k1.ineg(),c=c.neg(!0)),f.k2.negative&&(f.k2.ineg(),l=l.neg(!0)),i[a*2]=c,i[a*2+1]=l,o[a*2]=f.k1,o[a*2+1]=f.k2}for(var h=this._wnafMulAdd(1,i,o,a*2,n),d=0;d<a*2;d++)i[d]=null,o[d]=null;return h},"_endoWnafMulAdd");function tr(r,e,t,n){wf.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ot(e,16),this.y=new Ot(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}s(tr,"Point");Sm(tr,wf.BasePoint);kn.prototype.point=s(function(e,t,n){return new tr(this,e,t,n)},"point");kn.prototype.pointFromJSON=s(function(e,t){return tr.fromJSON(this,e,t)},"pointFromJSON");tr.prototype._getBeta=s(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=s(function(o){return n.point(o.x.redMul(n.endo.beta),o.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");tr.prototype.toJSON=s(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]},"toJSON");tr.fromJSON=s(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function o(f){return e.point(f[0],f[1],n)}s(o,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(o))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(o))}},i},"fromJSON");tr.prototype.inspect=s(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");tr.prototype.isInfinity=s(function(){return this.inf},"isInfinity");tr.prototype.add=s(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");tr.prototype.dbl=s(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=o.redSqr().redISub(this.x.redAdd(this.x)),f=o.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},"dbl");tr.prototype.getX=s(function(){return this.x.fromRed()},"getX");tr.prototype.getY=s(function(){return this.y.fromRed()},"getY");tr.prototype.mul=s(function(e){return e=new Ot(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");tr.prototype.mulAdd=s(function(e,t,n){var i=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},"mulAdd");tr.prototype.jmulAdd=s(function(e,t,n){var i=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)},"jmulAdd");tr.prototype.eq=s(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");tr.prototype.neg=s(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=s(function(o){return o.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");tr.prototype.toJ=s(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function hr(r,e,t,n){wf.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ot(0)):(this.x=new Ot(e,16),this.y=new Ot(t,16),this.z=new Ot(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(hr,"JPoint");Sm(hr,wf.BasePoint);kn.prototype.jpoint=s(function(e,t,n){return new hr(this,e,t,n)},"jpoint");hr.prototype.toP=s(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");hr.prototype.neg=s(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");hr.prototype.add=s(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),o=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(n.redMul(this.z)),c=i.redSub(o),l=a.redSub(f);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=c.redSqr(),d=h.redMul(c),y=i.redMul(h),A=l.redSqr().redIAdd(d).redISub(y).redISub(y),v=l.redMul(y.redISub(A)).redISub(a.redMul(d)),x=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(A,v,x)},"add");hr.prototype.mixedAdd=s(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),o=this.y,a=e.y.redMul(t).redMul(this.z),f=n.redSub(i),c=o.redSub(a);if(f.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=f.redSqr(),h=l.redMul(f),d=n.redMul(l),y=c.redSqr().redIAdd(h).redISub(d).redISub(d),A=c.redMul(d.redISub(y)).redISub(o.redMul(h)),v=this.z.redMul(f);return this.curve.jpoint(y,A,v)},"mixedAdd");hr.prototype.dblp=s(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,o=this.curve.tinv,a=this.x,f=this.y,c=this.z,l=c.redSqr().redSqr(),h=f.redAdd(f);for(t=0;t<e;t++){var d=a.redSqr(),y=h.redSqr(),A=y.redSqr(),v=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),x=a.redMul(y),L=v.redSqr().redISub(x.redAdd(x)),_=x.redISub(L),R=v.redMul(_);R=R.redIAdd(R).redISub(A);var H=h.redMul(c);t+1<e&&(l=l.redMul(A)),a=L,c=H,h=R}return this.curve.jpoint(a,h.redMul(o),c)},"dblp");hr.prototype.dbl=s(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");hr.prototype._zeroDbl=s(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),f=this.x.redAdd(o).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var c=i.redAdd(i).redIAdd(i),l=c.redSqr().redISub(f).redISub(f),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=c.redMul(f.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),y=this.y.redSqr(),A=y.redSqr(),v=this.x.redAdd(y).redSqr().redISub(d).redISub(A);v=v.redIAdd(v);var x=d.redAdd(d).redIAdd(d),L=x.redSqr(),_=A.redIAdd(A);_=_.redIAdd(_),_=_.redIAdd(_),e=L.redISub(v).redISub(v),t=x.redMul(v.redISub(e)).redISub(_),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");hr.prototype._threeDbl=s(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),f=this.x.redAdd(o).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var c=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=c.redSqr().redISub(f).redISub(f);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=c.redMul(f.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),y=this.y.redSqr(),A=this.x.redMul(y),v=this.x.redSub(d).redMul(this.x.redAdd(d));v=v.redAdd(v).redIAdd(v);var x=A.redIAdd(A);x=x.redIAdd(x);var L=x.redAdd(x);e=v.redSqr().redISub(L),n=this.y.redAdd(this.z).redSqr().redISub(y).redISub(d);var _=y.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_),t=v.redMul(x.redISub(e)).redISub(_)}return this.curve.jpoint(e,t,n)},"_threeDbl");hr.prototype._dbl=s(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),a=t.redSqr(),f=n.redSqr(),c=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(o)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(f),d=c.redSqr().redISub(h.redAdd(h)),y=h.redISub(d),A=f.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var v=c.redMul(y).redISub(A),x=n.redAdd(n).redMul(i);return this.curve.jpoint(d,v,x)},"_dbl");hr.prototype.trpl=s(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),o=e.redAdd(e).redIAdd(e),a=o.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(i);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var c=f.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=o.redIAdd(f).redSqr().redISub(a).redISub(c).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var y=this.x.redMul(c).redISub(d);y=y.redIAdd(y),y=y.redIAdd(y);var A=this.y.redMul(h.redMul(l.redISub(h)).redISub(f.redMul(c)));A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var v=this.z.redAdd(f).redSqr().redISub(n).redISub(c);return this.curve.jpoint(y,A,v)},"trpl");hr.prototype.mul=s(function(e,t){return e=new Ot(e,t),this.curve._wnafMul(this,e)},"mul");hr.prototype.eq=s(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");hr.prototype.eqXToP=s(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),o=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}},"eqXToP");hr.prototype.inspect=s(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)+">"},"inspect");hr.prototype.isInfinity=s(function(){return this.z.cmpn(0)===0},"isInfinity")});var Iw=de((oF,Bw)=>{"use strict";var xf=Cn(),Mw=Tu(),ld=Cu(),F7=an();function Af(r){ld.call(this,"mont",r),this.a=new xf(r.a,16).toRed(this.red),this.b=new xf(r.b,16).toRed(this.red),this.i4=new xf(4).toRed(this.red).redInvm(),this.two=new xf(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}s(Af,"MontCurve");Mw(Af,ld);Bw.exports=Af;Af.prototype.validate=s(function(e){var t=e.normalize().x,n=t.redSqr(),i=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t),o=i.redSqrt();return o.redSqr().cmp(i)===0},"validate");function rr(r,e,t){ld.BasePoint.call(this,r,"projective"),e===null&&t===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new xf(e,16),this.z=new xf(t,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}s(rr,"Point");Mw(rr,ld.BasePoint);Af.prototype.decodePoint=s(function(e,t){return this.point(F7.toArray(e,t),1)},"decodePoint");Af.prototype.point=s(function(e,t){return new rr(this,e,t)},"point");Af.prototype.pointFromJSON=s(function(e){return rr.fromJSON(this,e)},"pointFromJSON");rr.prototype.precompute=s(function(){},"precompute");rr.prototype._encode=s(function(){return this.getX().toArray("be",this.curve.p.byteLength())},"_encode");rr.fromJSON=s(function(e,t){return new rr(e,t[0],t[1]||e.one)},"fromJSON");rr.prototype.inspect=s(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");rr.prototype.isInfinity=s(function(){return this.z.cmpn(0)===0},"isInfinity");rr.prototype.dbl=s(function(){var e=this.x.redAdd(this.z),t=e.redSqr(),n=this.x.redSub(this.z),i=n.redSqr(),o=t.redSub(i),a=t.redMul(i),f=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(a,f)},"dbl");rr.prototype.add=s(function(){throw new Error("Not supported on Montgomery curve")},"add");rr.prototype.diffAdd=s(function(e,t){var n=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=e.x.redAdd(e.z),a=e.x.redSub(e.z),f=a.redMul(n),c=o.redMul(i),l=t.z.redMul(f.redAdd(c).redSqr()),h=t.x.redMul(f.redISub(c).redSqr());return this.curve.point(l,h)},"diffAdd");rr.prototype.mul=s(function(e){for(var t=e.clone(),n=this,i=this.curve.point(null,null),o=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var f=a.length-1;f>=0;f--)a[f]===0?(n=n.diffAdd(i,o),i=i.dbl()):(i=n.diffAdd(i,o),n=n.dbl());return i},"mul");rr.prototype.mulAdd=s(function(){throw new Error("Not supported on Montgomery curve")},"mulAdd");rr.prototype.jumlAdd=s(function(){throw new Error("Not supported on Montgomery curve")},"jumlAdd");rr.prototype.eq=s(function(e){return this.getX().cmp(e.getX())===0},"eq");rr.prototype.normalize=s(function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},"normalize");rr.prototype.getX=s(function(){return this.normalize(),this.x.fromRed()},"getX")});var Pw=de((sF,Ow)=>{"use strict";var K7=an(),ro=Cn(),Nw=Tu(),hd=Cu(),$7=K7.assert;function wi(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,hd.call(this,"edwards",r),this.a=new ro(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new ro(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new ro(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),$7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}s(wi,"EdwardsCurve");Nw(wi,hd);Ow.exports=wi;wi.prototype._mulA=s(function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},"_mulA");wi.prototype._mulC=s(function(e){return this.oneC?e:this.c.redMul(e)},"_mulC");wi.prototype.jpoint=s(function(e,t,n,i){return this.point(e,t,n,i)},"jpoint");wi.prototype.pointFromX=s(function(e,t){e=new ro(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),o=this.one.redSub(this.c2.redMul(this.d).redMul(n)),a=i.redMul(o.redInvm()),f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");var c=f.fromRed().isOdd();return(t&&!c||!t&&c)&&(f=f.redNeg()),this.point(e,f)},"pointFromX");wi.prototype.pointFromY=s(function(e,t){e=new ro(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),o=n.redMul(this.d).redMul(this.c2).redSub(this.a),a=i.redMul(o.redInvm());if(a.cmp(this.zero)===0){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var f=a.redSqrt();if(f.redSqr().redSub(a).cmp(this.zero)!==0)throw new Error("invalid point");return f.fromRed().isOdd()!==t&&(f=f.redNeg()),this.point(f,e)},"pointFromY");wi.prototype.validate=s(function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),i=t.redMul(this.a).redAdd(n),o=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return i.cmp(o)===0},"validate");function lt(r,e,t,n,i){hd.BasePoint.call(this,r,"projective"),e===null&&t===null&&n===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new ro(e,16),this.y=new ro(t,16),this.z=n?new ro(n,16):this.curve.one,this.t=i&&new ro(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}s(lt,"Point");Nw(lt,hd.BasePoint);wi.prototype.pointFromJSON=s(function(e){return lt.fromJSON(this,e)},"pointFromJSON");wi.prototype.point=s(function(e,t,n,i){return new lt(this,e,t,n,i)},"point");lt.fromJSON=s(function(e,t){return new lt(e,t[0],t[1],t[2])},"fromJSON");lt.prototype.inspect=s(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect");lt.prototype.isInfinity=s(function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},"isInfinity");lt.prototype._extDbl=s(function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var i=this.curve._mulA(e),o=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=i.redAdd(t),f=a.redSub(n),c=i.redSub(t),l=o.redMul(f),h=a.redMul(c),d=o.redMul(c),y=f.redMul(a);return this.curve.point(l,h,y,d)},"_extDbl");lt.prototype._projDbl=s(function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),i,o,a,f,c,l;if(this.curve.twisted){f=this.curve._mulA(t);var h=f.redAdd(n);this.zOne?(i=e.redSub(t).redSub(n).redMul(h.redSub(this.curve.two)),o=h.redMul(f.redSub(n)),a=h.redSqr().redSub(h).redSub(h)):(c=this.z.redSqr(),l=h.redSub(c).redISub(c),i=e.redSub(t).redISub(n).redMul(l),o=h.redMul(f.redSub(n)),a=h.redMul(l))}else f=t.redAdd(n),c=this.curve._mulC(this.z).redSqr(),l=f.redSub(c).redSub(c),i=this.curve._mulC(e.redISub(f)).redMul(l),o=this.curve._mulC(f).redMul(t.redISub(n)),a=f.redMul(l);return this.curve.point(i,o,a)},"_projDbl");lt.prototype.dbl=s(function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},"dbl");lt.prototype._extAdd=s(function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),i=this.t.redMul(this.curve.dd).redMul(e.t),o=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),f=o.redSub(i),c=o.redAdd(i),l=n.redAdd(t),h=a.redMul(f),d=c.redMul(l),y=a.redMul(l),A=f.redMul(c);return this.curve.point(h,d,A,y)},"_extAdd");lt.prototype._projAdd=s(function(e){var t=this.z.redMul(e.z),n=t.redSqr(),i=this.x.redMul(e.x),o=this.y.redMul(e.y),a=this.curve.d.redMul(i).redMul(o),f=n.redSub(a),c=n.redAdd(a),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(i).redISub(o),h=t.redMul(f).redMul(l),d,y;return this.curve.twisted?(d=t.redMul(c).redMul(o.redSub(this.curve._mulA(i))),y=f.redMul(c)):(d=t.redMul(c).redMul(o.redSub(i)),y=this.curve._mulC(f).redMul(c)),this.curve.point(h,d,y)},"_projAdd");lt.prototype.add=s(function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},"add");lt.prototype.mul=s(function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},"mul");lt.prototype.mulAdd=s(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},"mulAdd");lt.prototype.jmulAdd=s(function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},"jmulAdd");lt.prototype.normalize=s(function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},"normalize");lt.prototype.neg=s(function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},"neg");lt.prototype.getX=s(function(){return this.normalize(),this.x.fromRed()},"getX");lt.prototype.getY=s(function(){return this.normalize(),this.y.fromRed()},"getY");lt.prototype.eq=s(function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},"eq");lt.prototype.eqXToP=s(function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),i=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),this.x.cmp(t)===0)return!0}},"eqXToP");lt.prototype.toP=lt.prototype.normalize;lt.prototype.mixedAdd=lt.prototype.add});var Cm=de(Rw=>{"use strict";var dd=Rw;dd.base=Cu();dd.short=kw();dd.mont=Iw();dd.edwards=Pw()});var Xn=de(ct=>{"use strict";var H7=cs(),q7=Tu();ct.inherits=q7;function z7(r,e){return(r.charCodeAt(e)&64512)!==55296||e<0||e+1>=r.length?!1:(r.charCodeAt(e+1)&64512)===56320}s(z7,"isSurrogatePair");function j7(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if(typeof r=="string")if(e){if(e==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),i=0;i<r.length;i+=2)t.push(parseInt(r[i]+r[i+1],16))}else for(var n=0,i=0;i<r.length;i++){var o=r.charCodeAt(i);o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=o&63|128):z7(r,i)?(o=65536+((o&1023)<<10)+(r.charCodeAt(++i)&1023),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=o&63|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=o&63|128)}else for(i=0;i<r.length;i++)t[i]=r[i]|0;return t}s(j7,"toArray");ct.toArray=j7;function V7(r){for(var e="",t=0;t<r.length;t++)e+=Lw(r[t].toString(16));return e}s(V7,"toHex");ct.toHex=V7;function Uw(r){var e=r>>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return e>>>0}s(Uw,"htonl");ct.htonl=Uw;function W7(r,e){for(var t="",n=0;n<r.length;n++){var i=r[n];e==="little"&&(i=Uw(i)),t+=Dw(i.toString(16))}return t}s(W7,"toHex32");ct.toHex32=W7;function Lw(r){return r.length===1?"0"+r:r}s(Lw,"zero2");ct.zero2=Lw;function Dw(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}s(Dw,"zero8");ct.zero8=Dw;function G7(r,e,t,n){var i=t-e;H7(i%4===0);for(var o=new Array(i/4),a=0,f=e;a<o.length;a++,f+=4){var c;n==="big"?c=r[f]<<24|r[f+1]<<16|r[f+2]<<8|r[f+3]:c=r[f+3]<<24|r[f+2]<<16|r[f+1]<<8|r[f],o[a]=c>>>0}return o}s(G7,"join32");ct.join32=G7;function J7(r,e){for(var t=new Array(r.length*4),n=0,i=0;n<r.length;n++,i+=4){var o=r[n];e==="big"?(t[i]=o>>>24,t[i+1]=o>>>16&255,t[i+2]=o>>>8&255,t[i+3]=o&255):(t[i+3]=o>>>24,t[i+2]=o>>>16&255,t[i+1]=o>>>8&255,t[i]=o&255)}return t}s(J7,"split32");ct.split32=J7;function Y7(r,e){return r>>>e|r<<32-e}s(Y7,"rotr32");ct.rotr32=Y7;function X7(r,e){return r<<e|r>>>32-e}s(X7,"rotl32");ct.rotl32=X7;function Z7(r,e){return r+e>>>0}s(Z7,"sum32");ct.sum32=Z7;function Q7(r,e,t){return r+e+t>>>0}s(Q7,"sum32_3");ct.sum32_3=Q7;function eC(r,e,t,n){return r+e+t+n>>>0}s(eC,"sum32_4");ct.sum32_4=eC;function tC(r,e,t,n,i){return r+e+t+n+i>>>0}s(tC,"sum32_5");ct.sum32_5=tC;function rC(r,e,t,n){var i=r[e],o=r[e+1],a=n+o>>>0,f=(a<n?1:0)+t+i;r[e]=f>>>0,r[e+1]=a}s(rC,"sum64");ct.sum64=rC;function nC(r,e,t,n){var i=e+n>>>0,o=(i<e?1:0)+r+t;return o>>>0}s(nC,"sum64_hi");ct.sum64_hi=nC;function iC(r,e,t,n){var i=e+n;return i>>>0}s(iC,"sum64_lo");ct.sum64_lo=iC;function oC(r,e,t,n,i,o,a,f){var c=0,l=e;l=l+n>>>0,c+=l<e?1:0,l=l+o>>>0,c+=l<o?1:0,l=l+f>>>0,c+=l<f?1:0;var h=r+t+i+a+c;return h>>>0}s(oC,"sum64_4_hi");ct.sum64_4_hi=oC;function sC(r,e,t,n,i,o,a,f){var c=e+n+o+f;return c>>>0}s(sC,"sum64_4_lo");ct.sum64_4_lo=sC;function aC(r,e,t,n,i,o,a,f,c,l){var h=0,d=e;d=d+n>>>0,h+=d<e?1:0,d=d+o>>>0,h+=d<o?1:0,d=d+f>>>0,h+=d<f?1:0,d=d+l>>>0,h+=d<l?1:0;var y=r+t+i+a+c+h;return y>>>0}s(aC,"sum64_5_hi");ct.sum64_5_hi=aC;function fC(r,e,t,n,i,o,a,f,c,l){var h=e+n+o+f+l;return h>>>0}s(fC,"sum64_5_lo");ct.sum64_5_lo=fC;function cC(r,e,t){var n=e<<32-t|r>>>t;return n>>>0}s(cC,"rotr64_hi");ct.rotr64_hi=cC;function uC(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}s(uC,"rotr64_lo");ct.rotr64_lo=uC;function lC(r,e,t){return r>>>t}s(lC,"shr64_hi");ct.shr64_hi=lC;function hC(r,e,t){var n=r<<32-t|e>>>t;return n>>>0}s(hC,"shr64_lo");ct.shr64_lo=hC});var _f=de(Kw=>{"use strict";var Fw=Xn(),dC=cs();function pd(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}s(pd,"BlockHash");Kw.BlockHash=pd;pd.prototype.update=s(function(e,t){if(e=Fw.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Fw.join32(e,0,e.length-n,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},"update");pd.prototype.digest=s(function(e){return this.update(this._pad()),dC(this.pending===null),this._digest(e)},"digest");pd.prototype._pad=s(function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,i=new Array(n+this.padLength);i[0]=128;for(var o=1;o<n;o++)i[o]=0;if(e<<=3,this.endian==="big"){for(var a=8;a<this.padLength;a++)i[o++]=0;i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=e>>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,a=8;a<this.padLength;a++)i[o++]=0;return i},"pad")});var Tm=de(no=>{"use strict";var pC=Xn(),xi=pC.rotr32;function mC(r,e,t,n){if(r===0)return $w(e,t,n);if(r===1||r===3)return qw(e,t,n);if(r===2)return Hw(e,t,n)}s(mC,"ft_1");no.ft_1=mC;function $w(r,e,t){return r&e^~r&t}s($w,"ch32");no.ch32=$w;function Hw(r,e,t){return r&e^r&t^e&t}s(Hw,"maj32");no.maj32=Hw;function qw(r,e,t){return r^e^t}s(qw,"p32");no.p32=qw;function bC(r){return xi(r,2)^xi(r,13)^xi(r,22)}s(bC,"s0_256");no.s0_256=bC;function gC(r){return xi(r,6)^xi(r,11)^xi(r,25)}s(gC,"s1_256");no.s1_256=gC;function yC(r){return xi(r,7)^xi(r,18)^r>>>3}s(yC,"g0_256");no.g0_256=yC;function vC(r){return xi(r,17)^xi(r,19)^r>>>10}s(vC,"g1_256");no.g1_256=vC});var Vw=de((lF,jw)=>{"use strict";var Ef=Xn(),wC=_f(),xC=Tm(),km=Ef.rotl32,ku=Ef.sum32,AC=Ef.sum32_5,_C=xC.ft_1,zw=wC.BlockHash,EC=[1518500249,1859775393,2400959708,3395469782];function Ai(){if(!(this instanceof Ai))return new Ai;zw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}s(Ai,"SHA1");Ef.inherits(Ai,zw);jw.exports=Ai;Ai.blockSize=512;Ai.outSize=160;Ai.hmacStrength=80;Ai.padLength=64;Ai.prototype._update=s(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=km(n[i-3]^n[i-8]^n[i-14]^n[i-16],1);var o=this.h[0],a=this.h[1],f=this.h[2],c=this.h[3],l=this.h[4];for(i=0;i<n.length;i++){var h=~~(i/20),d=AC(km(o,5),_C(h,a,f,c),l,n[i],EC[h]);l=c,c=f,f=km(a,30),a=o,o=d}this.h[0]=ku(this.h[0],o),this.h[1]=ku(this.h[1],a),this.h[2]=ku(this.h[2],f),this.h[3]=ku(this.h[3],c),this.h[4]=ku(this.h[4],l)},"_update");Ai.prototype._digest=s(function(e){return e==="hex"?Ef.toHex32(this.h,"big"):Ef.split32(this.h,"big")},"digest")});var Mm=de((hF,Gw)=>{"use strict";var Sf=Xn(),SC=_f(),Cf=Tm(),CC=cs(),Zn=Sf.sum32,TC=Sf.sum32_4,kC=Sf.sum32_5,MC=Cf.ch32,BC=Cf.maj32,IC=Cf.s0_256,NC=Cf.s1_256,OC=Cf.g0_256,PC=Cf.g1_256,Ww=SC.BlockHash,RC=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function _i(){if(!(this instanceof _i))return new _i;Ww.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=RC,this.W=new Array(64)}s(_i,"SHA256");Sf.inherits(_i,Ww);Gw.exports=_i;_i.blockSize=512;_i.outSize=256;_i.hmacStrength=192;_i.padLength=64;_i.prototype._update=s(function(e,t){for(var n=this.W,i=0;i<16;i++)n[i]=e[t+i];for(;i<n.length;i++)n[i]=TC(PC(n[i-2]),n[i-7],OC(n[i-15]),n[i-16]);var o=this.h[0],a=this.h[1],f=this.h[2],c=this.h[3],l=this.h[4],h=this.h[5],d=this.h[6],y=this.h[7];for(CC(this.k.length===n.length),i=0;i<n.length;i++){var A=kC(y,NC(l),MC(l,h,d),this.k[i],n[i]),v=Zn(IC(o),BC(o,a,f));y=d,d=h,h=l,l=Zn(c,A),c=f,f=a,a=o,o=Zn(A,v)}this.h[0]=Zn(this.h[0],o),this.h[1]=Zn(this.h[1],a),this.h[2]=Zn(this.h[2],f),this.h[3]=Zn(this.h[3],c),this.h[4]=Zn(this.h[4],l),this.h[5]=Zn(this.h[5],h),this.h[6]=Zn(this.h[6],d),this.h[7]=Zn(this.h[7],y)},"_update");_i.prototype._digest=s(function(e){return e==="hex"?Sf.toHex32(this.h,"big"):Sf.split32(this.h,"big")},"digest")});var Xw=de((dF,Yw)=>{"use strict";var Bm=Xn(),Jw=Mm();function io(){if(!(this instanceof io))return new io;Jw.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}s(io,"SHA224");Bm.inherits(io,Jw);Yw.exports=io;io.blockSize=512;io.outSize=224;io.hmacStrength=192;io.padLength=64;io.prototype._digest=s(function(e){return e==="hex"?Bm.toHex32(this.h.slice(0,7),"big"):Bm.split32(this.h.slice(0,7),"big")},"digest")});var Om=de((pF,t2)=>{"use strict";var jr=Xn(),UC=_f(),LC=cs(),Ei=jr.rotr64_hi,Si=jr.rotr64_lo,Zw=jr.shr64_hi,Qw=jr.shr64_lo,hs=jr.sum64,Im=jr.sum64_hi,Nm=jr.sum64_lo,DC=jr.sum64_4_hi,FC=jr.sum64_4_lo,KC=jr.sum64_5_hi,$C=jr.sum64_5_lo,e2=UC.BlockHash,HC=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Qn(){if(!(this instanceof Qn))return new Qn;e2.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=HC,this.W=new Array(160)}s(Qn,"SHA512");jr.inherits(Qn,e2);t2.exports=Qn;Qn.blockSize=1024;Qn.outSize=512;Qn.hmacStrength=192;Qn.padLength=128;Qn.prototype._prepareBlock=s(function(e,t){for(var n=this.W,i=0;i<32;i++)n[i]=e[t+i];for(;i<n.length;i+=2){var o=QC(n[i-4],n[i-3]),a=eT(n[i-4],n[i-3]),f=n[i-14],c=n[i-13],l=XC(n[i-30],n[i-29]),h=ZC(n[i-30],n[i-29]),d=n[i-32],y=n[i-31];n[i]=DC(o,a,f,c,l,h,d,y),n[i+1]=FC(o,a,f,c,l,h,d,y)}},"_prepareBlock");Qn.prototype._update=s(function(e,t){this._prepareBlock(e,t);var n=this.W,i=this.h[0],o=this.h[1],a=this.h[2],f=this.h[3],c=this.h[4],l=this.h[5],h=this.h[6],d=this.h[7],y=this.h[8],A=this.h[9],v=this.h[10],x=this.h[11],L=this.h[12],_=this.h[13],R=this.h[14],H=this.h[15];LC(this.k.length===n.length);for(var $=0;$<n.length;$+=2){var j=R,D=H,B=JC(y,A),U=YC(y,A),Y=qC(y,A,v,x,L,_),b=zC(y,A,v,x,L,_),u=this.k[$],p=this.k[$+1],m=n[$],w=n[$+1],S=KC(j,D,B,U,Y,b,u,p,m,w),N=$C(j,D,B,U,Y,b,u,p,m,w);j=WC(i,o),D=GC(i,o),B=jC(i,o,a,f,c,l),U=VC(i,o,a,f,c,l);var I=Im(j,D,B,U),T=Nm(j,D,B,U);R=L,H=_,L=v,_=x,v=y,x=A,y=Im(h,d,S,N),A=Nm(d,d,S,N),h=c,d=l,c=a,l=f,a=i,f=o,i=Im(S,N,I,T),o=Nm(S,N,I,T)}hs(this.h,0,i,o),hs(this.h,2,a,f),hs(this.h,4,c,l),hs(this.h,6,h,d),hs(this.h,8,y,A),hs(this.h,10,v,x),hs(this.h,12,L,_),hs(this.h,14,R,H)},"_update");Qn.prototype._digest=s(function(e){return e==="hex"?jr.toHex32(this.h,"big"):jr.split32(this.h,"big")},"digest");function qC(r,e,t,n,i){var o=r&t^~r&i;return o<0&&(o+=4294967296),o}s(qC,"ch64_hi");function zC(r,e,t,n,i,o){var a=e&n^~e&o;return a<0&&(a+=4294967296),a}s(zC,"ch64_lo");function jC(r,e,t,n,i){var o=r&t^r&i^t&i;return o<0&&(o+=4294967296),o}s(jC,"maj64_hi");function VC(r,e,t,n,i,o){var a=e&n^e&o^n&o;return a<0&&(a+=4294967296),a}s(VC,"maj64_lo");function WC(r,e){var t=Ei(r,e,28),n=Ei(e,r,2),i=Ei(e,r,7),o=t^n^i;return o<0&&(o+=4294967296),o}s(WC,"s0_512_hi");function GC(r,e){var t=Si(r,e,28),n=Si(e,r,2),i=Si(e,r,7),o=t^n^i;return o<0&&(o+=4294967296),o}s(GC,"s0_512_lo");function JC(r,e){var t=Ei(r,e,14),n=Ei(r,e,18),i=Ei(e,r,9),o=t^n^i;return o<0&&(o+=4294967296),o}s(JC,"s1_512_hi");function YC(r,e){var t=Si(r,e,14),n=Si(r,e,18),i=Si(e,r,9),o=t^n^i;return o<0&&(o+=4294967296),o}s(YC,"s1_512_lo");function XC(r,e){var t=Ei(r,e,1),n=Ei(r,e,8),i=Zw(r,e,7),o=t^n^i;return o<0&&(o+=4294967296),o}s(XC,"g0_512_hi");function ZC(r,e){var t=Si(r,e,1),n=Si(r,e,8),i=Qw(r,e,7),o=t^n^i;return o<0&&(o+=4294967296),o}s(ZC,"g0_512_lo");function QC(r,e){var t=Ei(r,e,19),n=Ei(e,r,29),i=Zw(r,e,6),o=t^n^i;return o<0&&(o+=4294967296),o}s(QC,"g1_512_hi");function eT(r,e){var t=Si(r,e,19),n=Si(e,r,29),i=Qw(r,e,6),o=t^n^i;return o<0&&(o+=4294967296),o}s(eT,"g1_512_lo")});var i2=de((mF,n2)=>{"use strict";var Pm=Xn(),r2=Om();function oo(){if(!(this instanceof oo))return new oo;r2.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}s(oo,"SHA384");Pm.inherits(oo,r2);n2.exports=oo;oo.blockSize=1024;oo.outSize=384;oo.hmacStrength=192;oo.padLength=128;oo.prototype._digest=s(function(e){return e==="hex"?Pm.toHex32(this.h.slice(0,12),"big"):Pm.split32(this.h.slice(0,12),"big")},"digest")});var o2=de(Tf=>{"use strict";Tf.sha1=Vw();Tf.sha224=Xw();Tf.sha256=Mm();Tf.sha384=i2();Tf.sha512=Om()});var l2=de(u2=>{"use strict";var oa=Xn(),tT=_f(),md=oa.rotl32,s2=oa.sum32,Mu=oa.sum32_3,a2=oa.sum32_4,c2=tT.BlockHash;function Ci(){if(!(this instanceof Ci))return new Ci;c2.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}s(Ci,"RIPEMD160");oa.inherits(Ci,c2);u2.ripemd160=Ci;Ci.blockSize=512;Ci.outSize=160;Ci.hmacStrength=192;Ci.padLength=64;Ci.prototype._update=s(function(e,t){for(var n=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],f=this.h[4],c=n,l=i,h=o,d=a,y=f,A=0;A<80;A++){var v=s2(md(a2(n,f2(A,i,o,a),e[iT[A]+t],rT(A)),sT[A]),f);n=f,f=a,a=md(o,10),o=i,i=v,v=s2(md(a2(c,f2(79-A,l,h,d),e[oT[A]+t],nT(A)),aT[A]),y),c=y,y=d,d=md(h,10),h=l,l=v}v=Mu(this.h[1],o,d),this.h[1]=Mu(this.h[2],a,y),this.h[2]=Mu(this.h[3],f,c),this.h[3]=Mu(this.h[4],n,l),this.h[4]=Mu(this.h[0],i,h),this.h[0]=v},"update");Ci.prototype._digest=s(function(e){return e==="hex"?oa.toHex32(this.h,"little"):oa.split32(this.h,"little")},"digest");function f2(r,e,t,n){return r<=15?e^t^n:r<=31?e&t|~e&n:r<=47?(e|~t)^n:r<=63?e&n|t&~n:e^(t|~n)}s(f2,"f");function rT(r){return r<=15?0:r<=31?1518500249:r<=47?1859775393:r<=63?2400959708:2840853838}s(rT,"K");function nT(r){return r<=15?1352829926:r<=31?1548603684:r<=47?1836072691:r<=63?2053994217:0}s(nT,"Kh");var iT=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],oT=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],sT=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],aT=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]});var d2=de((yF,h2)=>{"use strict";var fT=Xn(),cT=cs();function kf(r,e,t){if(!(this instanceof kf))return new kf(r,e,t);this.Hash=r,this.blockSize=r.blockSize/8,this.outSize=r.outSize/8,this.inner=null,this.outer=null,this._init(fT.toArray(e,t))}s(kf,"Hmac");h2.exports=kf;kf.prototype._init=s(function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),cT(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},"init");kf.prototype.update=s(function(e,t){return this.inner.update(e,t),this},"update");kf.prototype.digest=s(function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},"digest")});var Bu=de(p2=>{var dr=p2;dr.utils=Xn();dr.common=_f();dr.sha=o2();dr.ripemd=l2();dr.hmac=d2();dr.sha1=dr.sha.sha1;dr.sha256=dr.sha.sha256;dr.sha224=dr.sha.sha224;dr.sha384=dr.sha.sha384;dr.sha512=dr.sha.sha512;dr.ripemd160=dr.ripemd.ripemd160});var b2=de((wF,m2)=>{m2.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}});var bd=de(v2=>{"use strict";var Um=v2,ds=Bu(),Rm=Cm(),uT=an(),g2=uT.assert;function y2(r){r.type==="short"?this.curve=new Rm.short(r):r.type==="edwards"?this.curve=new Rm.edwards(r):this.curve=new Rm.mont(r),this.g=this.curve.g,this.n=this.curve.n,this.hash=r.hash,g2(this.g.validate(),"Invalid curve"),g2(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}s(y2,"PresetCurve");Um.PresetCurve=y2;function ps(r,e){Object.defineProperty(Um,r,{configurable:!0,enumerable:!0,get:function(){var t=new y2(e);return Object.defineProperty(Um,r,{configurable:!0,enumerable:!0,value:t}),t}})}s(ps,"defineCurve");ps("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:ds.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});ps("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:ds.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});ps("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:ds.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});ps("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:ds.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"]});ps("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:ds.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"]});ps("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:ds.sha256,gRed:!1,g:["9"]});ps("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:ds.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var Lm;try{Lm=b2()}catch(r){Lm=void 0}ps("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:ds.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",Lm]})});var A2=de((AF,x2)=>{"use strict";var lT=Bu(),sa=vm(),w2=cs();function ms(r){if(!(this instanceof ms))return new ms(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=sa.toArray(r.entropy,r.entropyEnc||"hex"),t=sa.toArray(r.nonce,r.nonceEnc||"hex"),n=sa.toArray(r.pers,r.persEnc||"hex");w2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}s(ms,"HmacDRBG");x2.exports=ms;ms.prototype._init=s(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");ms.prototype._hmac=s(function(){return new lT.hmac(this.hash,this.K)},"hmac");ms.prototype._update=s(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");ms.prototype.reseed=s(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=sa.toArray(e,t),n=sa.toArray(n,i),w2(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");ms.prototype.generate=s(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=sa.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,e);return this._update(n),this._reseed++,sa.encode(a,t)},"generate")});var E2=de((_F,_2)=>{"use strict";var hT=Cn(),dT=an(),Dm=dT.assert;function Ar(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}s(Ar,"KeyPair");_2.exports=Ar;Ar.fromPublic=s(function(e,t,n){return t instanceof Ar?t:new Ar(e,{pub:t,pubEnc:n})},"fromPublic");Ar.fromPrivate=s(function(e,t,n){return t instanceof Ar?t:new Ar(e,{priv:t,privEnc:n})},"fromPrivate");Ar.prototype.validate=s(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");Ar.prototype.getPublic=s(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");Ar.prototype.getPrivate=s(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");Ar.prototype._importPrivate=s(function(e,t){this.priv=new hT(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");Ar.prototype._importPublic=s(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?Dm(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Dm(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");Ar.prototype.derive=s(function(e){return e.validate()||Dm(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");Ar.prototype.sign=s(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");Ar.prototype.verify=s(function(e,t){return this.ec.verify(e,t,this)},"verify");Ar.prototype.inspect=s(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect")});var T2=de((EF,C2)=>{"use strict";var gd=Cn(),$m=an(),pT=$m.assert;function yd(r,e){if(r instanceof yd)return r;this._importDER(r,e)||(pT(r.r&&r.s,"Signature without r or s"),this.r=new gd(r.r,16),this.s=new gd(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}s(yd,"Signature");C2.exports=yd;function mT(){this.place=0}s(mT,"Position");function Fm(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}s(Fm,"getLength");function S2(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}s(S2,"rmPadding");yd.prototype._importDER=s(function(e,t){e=$m.toArray(e,t);var n=new mT;if(e[n.place++]!==48)return!1;var i=Fm(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var o=Fm(e,n);if(o===!1)return!1;var a=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var f=Fm(e,n);if(f===!1||e.length!==f+n.place)return!1;var c=e.slice(n.place,f+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new gd(a),this.s=new gd(c),this.recoveryParam=null,!0},"_importDER");function Km(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}s(Km,"constructLength");yd.prototype.toDER=s(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=S2(t),n=S2(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Km(i,t.length),i=i.concat(t),i.push(2),Km(i,n.length);var o=i.concat(n),a=[48];return Km(a,o.length),a=a.concat(o),$m.encode(a,e)},"toDER")});var I2=de((SF,B2)=>{"use strict";var aa=Cn(),k2=A2(),bT=an(),Hm=bd(),gT=_m(),M2=bT.assert,qm=E2(),vd=T2();function Mn(r){if(!(this instanceof Mn))return new Mn(r);typeof r=="string"&&(M2(Object.prototype.hasOwnProperty.call(Hm,r),"Unknown curve "+r),r=Hm[r]),r instanceof Hm.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}s(Mn,"EC");B2.exports=Mn;Mn.prototype.keyPair=s(function(e){return new qm(this,e)},"keyPair");Mn.prototype.keyFromPrivate=s(function(e,t){return qm.fromPrivate(this,e,t)},"keyFromPrivate");Mn.prototype.keyFromPublic=s(function(e,t){return qm.fromPublic(this,e,t)},"keyFromPublic");Mn.prototype.genKeyPair=s(function(e){e||(e={});for(var t=new k2({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||gT(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new aa(2));;){var o=new aa(t.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},"genKeyPair");Mn.prototype._truncateToN=s(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Mn.prototype.sign=s(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new aa(e,16));for(var o=this.n.byteLength(),a=t.getPrivate().toArray("be",o),f=e.toArray("be",o),c=new k2({hash:this.hash,entropy:a,nonce:f,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new aa(1)),h=0;;h++){var d=i.k?i.k(h):new aa(c.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var y=this.g.mul(d);if(!y.isInfinity()){var A=y.getX(),v=A.umod(this.n);if(v.cmpn(0)!==0){var x=d.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(A.cmp(v)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),L^=1),new vd({r:v,s:x,recoveryParam:L})}}}}}},"sign");Mn.prototype.verify=s(function(e,t,n,i){e=this._truncateToN(new aa(e,16)),n=this.keyFromPublic(n,i),t=new vd(t,"hex");var o=t.r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),c=f.mul(e).umod(this.n),l=f.mul(o).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(c,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(o)):(h=this.g.mulAdd(c,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(o)===0)},"verify");Mn.prototype.recoverPubKey=function(r,e,t,n){M2((3&t)===t,"The recovery param is more than two bits"),e=new vd(e,n);var i=this.n,o=new aa(r),a=e.r,f=e.s,c=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),c):a=this.curve.pointFromX(a,c);var h=e.r.invm(i),d=i.sub(o).mul(h).umod(i),y=f.mul(h).umod(i);return this.g.mulAdd(d,a,y)};Mn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new vd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(r,e,i)}catch(a){continue}if(o.eq(t))return i}throw new Error("Unable to find valid recovery factor")}});var R2=de((CF,P2)=>{"use strict";var Iu=an(),O2=Iu.assert,N2=Iu.parseBytes,Mf=Iu.cachedProperty;function nr(r,e){this.eddsa=r,this._secret=N2(e.secret),r.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=N2(e.pub)}s(nr,"KeyPair");nr.fromPublic=s(function(e,t){return t instanceof nr?t:new nr(e,{pub:t})},"fromPublic");nr.fromSecret=s(function(e,t){return t instanceof nr?t:new nr(e,{secret:t})},"fromSecret");nr.prototype.secret=s(function(){return this._secret},"secret");Mf(nr,"pubBytes",s(function(){return this.eddsa.encodePoint(this.pub())},"pubBytes"));Mf(nr,"pub",s(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())},"pub"));Mf(nr,"privBytes",s(function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,i=t.slice(0,e.encodingLength);return i[0]&=248,i[n]&=127,i[n]|=64,i},"privBytes"));Mf(nr,"priv",s(function(){return this.eddsa.decodeInt(this.privBytes())},"priv"));Mf(nr,"hash",s(function(){return this.eddsa.hash().update(this.secret()).digest()},"hash"));Mf(nr,"messagePrefix",s(function(){return this.hash().slice(this.eddsa.encodingLength)},"messagePrefix"));nr.prototype.sign=s(function(e){return O2(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},"sign");nr.prototype.verify=s(function(e,t){return this.eddsa.verify(e,t,this)},"verify");nr.prototype.getSecret=s(function(e){return O2(this._secret,"KeyPair is public only"),Iu.encode(this.secret(),e)},"getSecret");nr.prototype.getPublic=s(function(e){return Iu.encode(this.pubBytes(),e)},"getPublic");P2.exports=nr});var L2=de((TF,U2)=>{"use strict";var yT=Cn(),wd=an(),vT=wd.assert,xd=wd.cachedProperty,wT=wd.parseBytes;function fa(r,e){this.eddsa=r,typeof e!="object"&&(e=wT(e)),Array.isArray(e)&&(e={R:e.slice(0,r.encodingLength),S:e.slice(r.encodingLength)}),vT(e.R&&e.S,"Signature without R or S"),r.isPoint(e.R)&&(this._R=e.R),e.S instanceof yT&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}s(fa,"Signature");xd(fa,"S",s(function(){return this.eddsa.decodeInt(this.Sencoded())},"S"));xd(fa,"R",s(function(){return this.eddsa.decodePoint(this.Rencoded())},"R"));xd(fa,"Rencoded",s(function(){return this.eddsa.encodePoint(this.R())},"Rencoded"));xd(fa,"Sencoded",s(function(){return this.eddsa.encodeInt(this.S())},"Sencoded"));fa.prototype.toBytes=s(function(){return this.Rencoded().concat(this.Sencoded())},"toBytes");fa.prototype.toHex=s(function(){return wd.encode(this.toBytes(),"hex").toUpperCase()},"toHex");U2.exports=fa});var H2=de((kF,$2)=>{"use strict";var xT=Bu(),AT=bd(),Bf=an(),_T=Bf.assert,F2=Bf.parseBytes,K2=R2(),D2=L2();function Vr(r){if(_T(r==="ed25519","only tested with ed25519 so far"),!(this instanceof Vr))return new Vr(r);r=AT[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=xT.sha512}s(Vr,"EDDSA");$2.exports=Vr;Vr.prototype.sign=s(function(e,t){e=F2(e);var n=this.keyFromSecret(t),i=this.hashInt(n.messagePrefix(),e),o=this.g.mul(i),a=this.encodePoint(o),f=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=i.add(f).umod(this.curve.n);return this.makeSignature({R:o,S:c,Rencoded:a})},"sign");Vr.prototype.verify=s(function(e,t,n){e=F2(e),t=this.makeSignature(t);var i=this.keyFromPublic(n),o=this.hashInt(t.Rencoded(),i.pubBytes(),e),a=this.g.mul(t.S()),f=t.R().add(i.pub().mul(o));return f.eq(a)},"verify");Vr.prototype.hashInt=s(function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return Bf.intFromLE(e.digest()).umod(this.curve.n)},"hashInt");Vr.prototype.keyFromPublic=s(function(e){return K2.fromPublic(this,e)},"keyFromPublic");Vr.prototype.keyFromSecret=s(function(e){return K2.fromSecret(this,e)},"keyFromSecret");Vr.prototype.makeSignature=s(function(e){return e instanceof D2?e:new D2(this,e)},"makeSignature");Vr.prototype.encodePoint=s(function(e){var t=e.getY().toArray("le",this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},"encodePoint");Vr.prototype.decodePoint=s(function(e){e=Bf.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),i=(e[t]&128)!==0,o=Bf.intFromLE(n);return this.curve.pointFromY(o,i)},"decodePoint");Vr.prototype.encodeInt=s(function(e){return e.toArray("le",this.encodingLength)},"encodeInt");Vr.prototype.decodeInt=s(function(e){return Bf.intFromLE(e)},"decodeInt");Vr.prototype.isPoint=s(function(e){return e instanceof this.pointClass},"isPoint")});var z2=de(q2=>{"use strict";var ca=q2;ca.version=gw().version;ca.utils=an();ca.rand=_m();ca.curve=Cm();ca.curves=bd();ca.ec=I2();ca.eddsa=H2()});var V2=de(zm=>{"use strict";Object.defineProperty(zm,"__esModule",{value:!0});var j2=65536,ET=function(){function r(){this.isAvailable=!1,this.isInstantiated=!1;var e=typeof self!="undefined"?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return s(r,"BrowserRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),n=0;n<t.length;n+=j2)this._crypto.getRandomValues(t.subarray(n,n+Math.min(t.length-n,j2)));return t},r}();zm.BrowserRandomSource=ET});var W2=de(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var ST=Sn(),CT=function(){function r(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof require!="undefined"){var e=require("crypto");e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}return s(r,"NodeRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var n=new Uint8Array(e),i=0;i<n.length;i++)n[i]=t[i];return ST.wipe(t),n},r}();jm.NodeRandomSource=CT});var G2=de(Vm=>{"use strict";Object.defineProperty(Vm,"__esModule",{value:!0});var TT=V2(),kT=W2(),MT=function(){function r(){if(this.isAvailable=!1,this.name="",this._source=new TT.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new kT.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}return s(r,"SystemRandomSource"),r.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},r}();Vm.SystemRandomSource=MT});var If=de(ei=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var BT=G2(),IT=na(),J2=Sn();ei.defaultRandomSource=new BT.SystemRandomSource;function Wm(r,e){return e===void 0&&(e=ei.defaultRandomSource),e.randomBytes(r)}s(Wm,"randomBytes");ei.randomBytes=Wm;function NT(r){r===void 0&&(r=ei.defaultRandomSource);var e=Wm(4,r),t=IT.readUint32LE(e);return J2.wipe(e),t}s(NT,"randomUint32");ei.randomUint32=NT;var Y2="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function X2(r,e,t){if(e===void 0&&(e=Y2),t===void 0&&(t=ei.defaultRandomSource),e.length<2)throw new Error("randomString charset is too short");if(e.length>256)throw new Error("randomString charset is too long");for(var n="",i=e.length,o=256-256%i;r>0;){for(var a=Wm(Math.ceil(r*256/o),t),f=0;f<a.length&&r>0;f++){var c=a[f];c<o&&(n+=e.charAt(c%i),r--)}J2.wipe(a)}return n}s(X2,"randomString");ei.randomString=X2;function OT(r,e,t){e===void 0&&(e=Y2),t===void 0&&(t=ei.defaultRandomSource);var n=Math.ceil(r/(Math.log(e.length)/Math.LN2));return X2(n,e,t)}s(OT,"randomStringForEntropy");ei.randomStringForEntropy=OT});var ex=de(so=>{"use strict";Object.defineProperty(so,"__esModule",{value:!0});var Of=na(),Nf=Sn();so.DIGEST_LENGTH=64;so.BLOCK_SIZE=128;var Q2=function(){function r(){this.digestLength=so.DIGEST_LENGTH,this.blockSize=so.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return s(r,"SHA512"),r.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},r.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},r.prototype.clean=function(){Nf.wipe(this._buffer),Nf.wipe(this._tempHi),Nf.wipe(this._tempLo),this.reset()},r.prototype.update=function(e,t){if(t===void 0&&(t=e.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var n=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength<so.BLOCK_SIZE&&t>0;)this._buffer[this._bufferLength++]=e[n++],t--;this._bufferLength===this.blockSize&&(Gm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(n=Gm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,e,n,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[n++],t--;return this},r.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,n=this._bufferLength,i=t/536870912|0,o=t<<3,a=t%128<112?128:256;this._buffer[n]=128;for(var f=n+1;f<a-8;f++)this._buffer[f]=0;Of.writeUint32BE(i,this._buffer,a-8),Of.writeUint32BE(o,this._buffer,a-4),Gm(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,a),this._finished=!0}for(var f=0;f<this.digestLength/8;f++)Of.writeUint32BE(this._stateHi[f],e,f*8),Of.writeUint32BE(this._stateLo[f],e,f*8+4);return this},r.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},r.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},r.prototype.restoreState=function(e){return this._stateHi.set(e.stateHi),this._stateLo.set(e.stateLo),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},r.prototype.cleanSavedState=function(e){Nf.wipe(e.stateHi),Nf.wipe(e.stateLo),e.buffer&&Nf.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},r}();so.SHA512=Q2;var Z2=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function Gm(r,e,t,n,i,o,a){for(var f=t[0],c=t[1],l=t[2],h=t[3],d=t[4],y=t[5],A=t[6],v=t[7],x=n[0],L=n[1],_=n[2],R=n[3],H=n[4],$=n[5],j=n[6],D=n[7],B,U,Y,b,u,p,m,w;a>=128;){for(var S=0;S<16;S++){var N=8*S+o;r[S]=Of.readUint32BE(i,N),e[S]=Of.readUint32BE(i,N+4)}for(var S=0;S<80;S++){var I=f,T=c,g=l,C=h,Z=d,V=y,F=A,ce=v,E=x,X=L,Q=_,P=R,O=H,z=$,J=j,re=D;if(B=v,U=D,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=(d>>>14|H<<32-14)^(d>>>18|H<<32-18)^(H>>>41-32|d<<32-(41-32)),U=(H>>>14|d<<32-14)^(H>>>18|d<<32-18)^(d>>>41-32|H<<32-(41-32)),u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,B=d&y^~d&A,U=H&$^~H&j,u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,B=Z2[S*2],U=Z2[S*2+1],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,B=r[S%16],U=e[S%16],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,Y=m&65535|w<<16,b=u&65535|p<<16,B=Y,U=b,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=(f>>>28|x<<32-28)^(x>>>34-32|f<<32-(34-32))^(x>>>39-32|f<<32-(39-32)),U=(x>>>28|f<<32-28)^(f>>>34-32|x<<32-(34-32))^(f>>>39-32|x<<32-(39-32)),u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,B=f&c^f&l^c&l,U=x&L^x&_^L&_,u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,ce=m&65535|w<<16,re=u&65535|p<<16,B=C,U=P,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=Y,U=b,u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,C=m&65535|w<<16,P=u&65535|p<<16,c=I,l=T,h=g,d=C,y=Z,A=V,v=F,f=ce,L=E,_=X,R=Q,H=P,$=O,j=z,D=J,x=re,S%16===15)for(var N=0;N<16;N++)B=r[N],U=e[N],u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=r[(N+9)%16],U=e[(N+9)%16],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,Y=r[(N+1)%16],b=e[(N+1)%16],B=(Y>>>1|b<<32-1)^(Y>>>8|b<<32-8)^Y>>>7,U=(b>>>1|Y<<32-1)^(b>>>8|Y<<32-8)^(b>>>7|Y<<32-7),u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,Y=r[(N+14)%16],b=e[(N+14)%16],B=(Y>>>19|b<<32-19)^(b>>>61-32|Y<<32-(61-32))^Y>>>6,U=(b>>>19|Y<<32-19)^(Y>>>61-32|b<<32-(61-32))^(b>>>6|Y<<32-6),u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,r[N]=m&65535|w<<16,e[N]=u&65535|p<<16}B=f,U=x,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[0],U=n[0],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[0]=f=m&65535|w<<16,n[0]=x=u&65535|p<<16,B=c,U=L,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[1],U=n[1],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[1]=c=m&65535|w<<16,n[1]=L=u&65535|p<<16,B=l,U=_,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[2],U=n[2],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[2]=l=m&65535|w<<16,n[2]=_=u&65535|p<<16,B=h,U=R,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[3],U=n[3],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[3]=h=m&65535|w<<16,n[3]=R=u&65535|p<<16,B=d,U=H,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[4],U=n[4],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[4]=d=m&65535|w<<16,n[4]=H=u&65535|p<<16,B=y,U=$,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[5],U=n[5],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[5]=y=m&65535|w<<16,n[5]=$=u&65535|p<<16,B=A,U=j,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[6],U=n[6],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[6]=A=m&65535|w<<16,n[6]=j=u&65535|p<<16,B=v,U=D,u=U&65535,p=U>>>16,m=B&65535,w=B>>>16,B=t[7],U=n[7],u+=U&65535,p+=U>>>16,m+=B&65535,w+=B>>>16,p+=u>>>16,m+=p>>>16,w+=m>>>16,t[7]=v=m&65535|w<<16,n[7]=D=u&65535|p<<16,o+=128,a-=128}return o}s(Gm,"hashBlocks");function PT(r){var e=new Q2;e.update(r);var t=e.digest();return e.clean(),t}s(PT,"hash");so.hash=PT});var Ad=de(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});var RT=If(),Nu=ex(),ox=Sn();Xt.SIGNATURE_LENGTH=64;Xt.PUBLIC_KEY_LENGTH=32;Xt.SECRET_KEY_LENGTH=64;Xt.SEED_LENGTH=32;function ke(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}s(ke,"gf");var UT=new Uint8Array(32);UT[0]=9;var Xm=ke(),Pf=ke([1]),LT=ke([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),DT=ke([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),tx=ke([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),rx=ke([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),FT=ke([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function bs(r,e){for(var t=0;t<16;t++)r[t]=e[t]|0}s(bs,"set25519");function Jm(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}s(Jm,"car25519");function sx(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var o=n&(r[i]^e[i]);r[i]^=o,e[i]^=o}}s(sx,"sel25519");function Ou(r,e){for(var t=ke(),n=ke(),i=0;i<16;i++)n[i]=e[i];Jm(n),Jm(n),Jm(n);for(var o=0;o<2;o++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,sx(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}s(Ou,"pack25519");function ax(r,e){for(var t=0,n=0;n<32;n++)t|=r[n]^e[n];return(1&t-1>>>8)-1}s(ax,"verify32");function nx(r,e){var t=new Uint8Array(32),n=new Uint8Array(32);return Ou(t,r),Ou(n,e),ax(t,n)}s(nx,"neq25519");function fx(r){var e=new Uint8Array(32);return Ou(e,r),e[0]&1}s(fx,"par25519");function KT(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}s(KT,"unpack25519");function ua(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}s(ua,"add");function ha(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}s(ha,"sub");function ft(r,e,t){var n,i,o=0,a=0,f=0,c=0,l=0,h=0,d=0,y=0,A=0,v=0,x=0,L=0,_=0,R=0,H=0,$=0,j=0,D=0,B=0,U=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,T=0,g=0,C=t[0],Z=t[1],V=t[2],F=t[3],ce=t[4],E=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],J=t[11],re=t[12],le=t[13],se=t[14],G=t[15];n=e[0],o+=n*C,a+=n*Z,f+=n*V,c+=n*F,l+=n*ce,h+=n*E,d+=n*X,y+=n*Q,A+=n*P,v+=n*O,x+=n*z,L+=n*J,_+=n*re,R+=n*le,H+=n*se,$+=n*G,n=e[1],a+=n*C,f+=n*Z,c+=n*V,l+=n*F,h+=n*ce,d+=n*E,y+=n*X,A+=n*Q,v+=n*P,x+=n*O,L+=n*z,_+=n*J,R+=n*re,H+=n*le,$+=n*se,j+=n*G,n=e[2],f+=n*C,c+=n*Z,l+=n*V,h+=n*F,d+=n*ce,y+=n*E,A+=n*X,v+=n*Q,x+=n*P,L+=n*O,_+=n*z,R+=n*J,H+=n*re,$+=n*le,j+=n*se,D+=n*G,n=e[3],c+=n*C,l+=n*Z,h+=n*V,d+=n*F,y+=n*ce,A+=n*E,v+=n*X,x+=n*Q,L+=n*P,_+=n*O,R+=n*z,H+=n*J,$+=n*re,j+=n*le,D+=n*se,B+=n*G,n=e[4],l+=n*C,h+=n*Z,d+=n*V,y+=n*F,A+=n*ce,v+=n*E,x+=n*X,L+=n*Q,_+=n*P,R+=n*O,H+=n*z,$+=n*J,j+=n*re,D+=n*le,B+=n*se,U+=n*G,n=e[5],h+=n*C,d+=n*Z,y+=n*V,A+=n*F,v+=n*ce,x+=n*E,L+=n*X,_+=n*Q,R+=n*P,H+=n*O,$+=n*z,j+=n*J,D+=n*re,B+=n*le,U+=n*se,Y+=n*G,n=e[6],d+=n*C,y+=n*Z,A+=n*V,v+=n*F,x+=n*ce,L+=n*E,_+=n*X,R+=n*Q,H+=n*P,$+=n*O,j+=n*z,D+=n*J,B+=n*re,U+=n*le,Y+=n*se,b+=n*G,n=e[7],y+=n*C,A+=n*Z,v+=n*V,x+=n*F,L+=n*ce,_+=n*E,R+=n*X,H+=n*Q,$+=n*P,j+=n*O,D+=n*z,B+=n*J,U+=n*re,Y+=n*le,b+=n*se,u+=n*G,n=e[8],A+=n*C,v+=n*Z,x+=n*V,L+=n*F,_+=n*ce,R+=n*E,H+=n*X,$+=n*Q,j+=n*P,D+=n*O,B+=n*z,U+=n*J,Y+=n*re,b+=n*le,u+=n*se,p+=n*G,n=e[9],v+=n*C,x+=n*Z,L+=n*V,_+=n*F,R+=n*ce,H+=n*E,$+=n*X,j+=n*Q,D+=n*P,B+=n*O,U+=n*z,Y+=n*J,b+=n*re,u+=n*le,p+=n*se,m+=n*G,n=e[10],x+=n*C,L+=n*Z,_+=n*V,R+=n*F,H+=n*ce,$+=n*E,j+=n*X,D+=n*Q,B+=n*P,U+=n*O,Y+=n*z,b+=n*J,u+=n*re,p+=n*le,m+=n*se,w+=n*G,n=e[11],L+=n*C,_+=n*Z,R+=n*V,H+=n*F,$+=n*ce,j+=n*E,D+=n*X,B+=n*Q,U+=n*P,Y+=n*O,b+=n*z,u+=n*J,p+=n*re,m+=n*le,w+=n*se,S+=n*G,n=e[12],_+=n*C,R+=n*Z,H+=n*V,$+=n*F,j+=n*ce,D+=n*E,B+=n*X,U+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*J,m+=n*re,w+=n*le,S+=n*se,N+=n*G,n=e[13],R+=n*C,H+=n*Z,$+=n*V,j+=n*F,D+=n*ce,B+=n*E,U+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*J,w+=n*re,S+=n*le,N+=n*se,I+=n*G,n=e[14],H+=n*C,$+=n*Z,j+=n*V,D+=n*F,B+=n*ce,U+=n*E,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*J,S+=n*re,N+=n*le,I+=n*se,T+=n*G,n=e[15],$+=n*C,j+=n*Z,D+=n*V,B+=n*F,U+=n*ce,Y+=n*E,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*J,N+=n*re,I+=n*le,T+=n*se,g+=n*G,o+=38*j,a+=38*D,f+=38*B,c+=38*U,l+=38*Y,h+=38*b,d+=38*u,y+=38*p,A+=38*m,v+=38*w,x+=38*S,L+=38*N,_+=38*I,R+=38*T,H+=38*g,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=$+i+65535,i=Math.floor(n/65536),$=n-i*65536,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=$+i+65535,i=Math.floor(n/65536),$=n-i*65536,o+=i-1+37*(i-1),r[0]=o,r[1]=a,r[2]=f,r[3]=c,r[4]=l,r[5]=h,r[6]=d,r[7]=y,r[8]=A,r[9]=v,r[10]=x,r[11]=L,r[12]=_,r[13]=R,r[14]=H,r[15]=$}s(ft,"mul");function la(r,e){ft(r,e,e)}s(la,"square");function cx(r,e){var t=ke(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=253;n>=0;n--)la(t,t),n!==2&&n!==4&&ft(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}s(cx,"inv25519");function $T(r,e){var t=ke(),n;for(n=0;n<16;n++)t[n]=e[n];for(n=250;n>=0;n--)la(t,t),n!==1&&ft(t,t,e);for(n=0;n<16;n++)r[n]=t[n]}s($T,"pow2523");function Zm(r,e){var t=ke(),n=ke(),i=ke(),o=ke(),a=ke(),f=ke(),c=ke(),l=ke(),h=ke();ha(t,r[1],r[0]),ha(h,e[1],e[0]),ft(t,t,h),ua(n,r[0],r[1]),ua(h,e[0],e[1]),ft(n,n,h),ft(i,r[3],e[3]),ft(i,i,DT),ft(o,r[2],e[2]),ua(o,o,o),ha(a,n,t),ha(f,o,i),ua(c,o,i),ua(l,n,t),ft(r[0],a,f),ft(r[1],l,c),ft(r[2],c,f),ft(r[3],a,l)}s(Zm,"edadd");function ix(r,e,t){for(var n=0;n<4;n++)sx(r[n],e[n],t)}s(ix,"cswap");function e1(r,e){var t=ke(),n=ke(),i=ke();cx(i,e[2]),ft(t,e[0],i),ft(n,e[1],i),Ou(r,n),r[31]^=fx(t)<<7}s(e1,"pack");function ux(r,e,t){bs(r[0],Xm),bs(r[1],Pf),bs(r[2],Pf),bs(r[3],Xm);for(var n=255;n>=0;--n){var i=t[n/8|0]>>(n&7)&1;ix(r,e,i),Zm(e,r),Zm(r,r),ix(r,e,i)}}s(ux,"scalarmult");function t1(r,e){var t=[ke(),ke(),ke(),ke()];bs(t[0],tx),bs(t[1],rx),bs(t[2],Pf),ft(t[3],tx,rx),ux(r,t,e)}s(t1,"scalarbase");function lx(r){if(r.length!==Xt.SEED_LENGTH)throw new Error("ed25519: seed must be "+Xt.SEED_LENGTH+" bytes");var e=Nu.hash(r);e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(32),n=[ke(),ke(),ke(),ke()];t1(n,e),e1(t,n);var i=new Uint8Array(64);return i.set(r),i.set(t,32),{publicKey:t,secretKey:i}}s(lx,"generateKeyPairFromSeed");Xt.generateKeyPairFromSeed=lx;function HT(r){var e=RT.randomBytes(32,r),t=lx(e);return ox.wipe(e),t}s(HT,"generateKeyPair");Xt.generateKeyPair=HT;function qT(r){if(r.length!==Xt.SECRET_KEY_LENGTH)throw new Error("ed25519: secret key must be "+Xt.SECRET_KEY_LENGTH+" bytes");return new Uint8Array(r.subarray(32))}s(qT,"extractPublicKeyFromSecretKey");Xt.extractPublicKeyFromSecretKey=qT;var Ym=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function hx(r,e){var t,n,i,o;for(n=63;n>=32;--n){for(t=0,i=n-32,o=n-12;i<o;++i)e[i]+=t-16*e[n]*Ym[i-(n-32)],t=Math.floor((e[i]+128)/256),e[i]-=t*256;e[i]+=t,e[n]=0}for(t=0,i=0;i<32;i++)e[i]+=t-(e[31]>>4)*Ym[i],t=e[i]>>8,e[i]&=255;for(i=0;i<32;i++)e[i]-=t*Ym[i];for(n=0;n<32;n++)e[n+1]+=e[n]>>8,r[n]=e[n]&255}s(hx,"modL");function Qm(r){for(var e=new Float64Array(64),t=0;t<64;t++)e[t]=r[t];for(var t=0;t<64;t++)r[t]=0;hx(r,e)}s(Qm,"reduce");function zT(r,e){var t=new Float64Array(64),n=[ke(),ke(),ke(),ke()],i=Nu.hash(r.subarray(0,32));i[0]&=248,i[31]&=127,i[31]|=64;var o=new Uint8Array(64);o.set(i.subarray(32),32);var a=new Nu.SHA512;a.update(o.subarray(32)),a.update(e);var f=a.digest();a.clean(),Qm(f),t1(n,f),e1(o,n),a.reset(),a.update(o.subarray(0,32)),a.update(r.subarray(32)),a.update(e);var c=a.digest();Qm(c);for(var l=0;l<32;l++)t[l]=f[l];for(var l=0;l<32;l++)for(var h=0;h<32;h++)t[l+h]+=c[l]*i[h];return hx(o.subarray(32),t),o}s(zT,"sign");Xt.sign=zT;function dx(r,e){var t=ke(),n=ke(),i=ke(),o=ke(),a=ke(),f=ke(),c=ke();return bs(r[2],Pf),KT(r[1],e),la(i,r[1]),ft(o,i,LT),ha(i,i,r[2]),ua(o,r[2],o),la(a,o),la(f,a),ft(c,f,a),ft(t,c,i),ft(t,t,o),$T(t,t),ft(t,t,i),ft(t,t,o),ft(t,t,o),ft(r[0],t,o),la(n,r[0]),ft(n,n,o),nx(n,i)&&ft(r[0],r[0],FT),la(n,r[0]),ft(n,n,o),nx(n,i)?-1:(fx(r[0])===e[31]>>7&&ha(r[0],Xm,r[0]),ft(r[3],r[0],r[1]),0)}s(dx,"unpackneg");function jT(r,e,t){var n=new Uint8Array(32),i=[ke(),ke(),ke(),ke()],o=[ke(),ke(),ke(),ke()];if(t.length!==Xt.SIGNATURE_LENGTH)throw new Error("ed25519: signature must be "+Xt.SIGNATURE_LENGTH+" bytes");if(dx(o,r))return!1;var a=new Nu.SHA512;a.update(t.subarray(0,32)),a.update(r),a.update(e);var f=a.digest();return Qm(f),ux(i,o,f),t1(o,t.subarray(32)),Zm(i,o),e1(n,i),!ax(t,n)}s(jT,"verify");Xt.verify=jT;function VT(r){var e=[ke(),ke(),ke(),ke()];if(dx(e,r))throw new Error("Ed25519: invalid public key");var t=ke(),n=ke(),i=e[1];ua(t,Pf,i),ha(n,Pf,i),cx(n,n),ft(t,t,n);var o=new Uint8Array(32);return Ou(o,t),o}s(VT,"convertPublicKeyToX25519");Xt.convertPublicKeyToX25519=VT;function WT(r){var e=Nu.hash(r.subarray(0,32));e[0]&=248,e[31]&=127,e[31]|=64;var t=new Uint8Array(e.subarray(0,32));return ox.wipe(e),t}s(WT,"convertSecretKeyToX25519");Xt.convertSecretKeyToX25519=WT});var mx=de((UF,px)=>{"use strict";px.exports=s(function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{let o=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+o+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;let o=t.length===0?"":",";return t+o+r(n)+":"+r(e[n])},"")+"}"},"serialize")});var vx=de(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});var GT=If(),JT=Sn();Wr.PUBLIC_KEY_LENGTH=32;Wr.SECRET_KEY_LENGTH=32;Wr.SHARED_KEY_LENGTH=32;function Ti(r){var e=new Float64Array(16);if(r)for(var t=0;t<r.length;t++)e[t]=r[t];return e}s(Ti,"gf");var bx=new Uint8Array(32);bx[0]=9;var YT=Ti([56129,1]);function r1(r){for(var e=1,t=0;t<16;t++){var n=r[t]+e+65535;e=Math.floor(n/65536),r[t]=n-e*65536}r[0]+=e-1+37*(e-1)}s(r1,"car25519");function Pu(r,e,t){for(var n=~(t-1),i=0;i<16;i++){var o=n&(r[i]^e[i]);r[i]^=o,e[i]^=o}}s(Pu,"sel25519");function XT(r,e){for(var t=Ti(),n=Ti(),i=0;i<16;i++)n[i]=e[i];r1(n),r1(n),r1(n);for(var o=0;o<2;o++){t[0]=n[0]-65517;for(var i=1;i<15;i++)t[i]=n[i]-65535-(t[i-1]>>16&1),t[i-1]&=65535;t[15]=n[15]-32767-(t[14]>>16&1);var a=t[15]>>16&1;t[14]&=65535,Pu(n,t,1-a)}for(var i=0;i<16;i++)r[2*i]=n[i]&255,r[2*i+1]=n[i]>>8}s(XT,"pack25519");function ZT(r,e){for(var t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}s(ZT,"unpack25519");function _d(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]+t[n]}s(_d,"add");function Ed(r,e,t){for(var n=0;n<16;n++)r[n]=e[n]-t[n]}s(Ed,"sub");function ao(r,e,t){var n,i,o=0,a=0,f=0,c=0,l=0,h=0,d=0,y=0,A=0,v=0,x=0,L=0,_=0,R=0,H=0,$=0,j=0,D=0,B=0,U=0,Y=0,b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,T=0,g=0,C=t[0],Z=t[1],V=t[2],F=t[3],ce=t[4],E=t[5],X=t[6],Q=t[7],P=t[8],O=t[9],z=t[10],J=t[11],re=t[12],le=t[13],se=t[14],G=t[15];n=e[0],o+=n*C,a+=n*Z,f+=n*V,c+=n*F,l+=n*ce,h+=n*E,d+=n*X,y+=n*Q,A+=n*P,v+=n*O,x+=n*z,L+=n*J,_+=n*re,R+=n*le,H+=n*se,$+=n*G,n=e[1],a+=n*C,f+=n*Z,c+=n*V,l+=n*F,h+=n*ce,d+=n*E,y+=n*X,A+=n*Q,v+=n*P,x+=n*O,L+=n*z,_+=n*J,R+=n*re,H+=n*le,$+=n*se,j+=n*G,n=e[2],f+=n*C,c+=n*Z,l+=n*V,h+=n*F,d+=n*ce,y+=n*E,A+=n*X,v+=n*Q,x+=n*P,L+=n*O,_+=n*z,R+=n*J,H+=n*re,$+=n*le,j+=n*se,D+=n*G,n=e[3],c+=n*C,l+=n*Z,h+=n*V,d+=n*F,y+=n*ce,A+=n*E,v+=n*X,x+=n*Q,L+=n*P,_+=n*O,R+=n*z,H+=n*J,$+=n*re,j+=n*le,D+=n*se,B+=n*G,n=e[4],l+=n*C,h+=n*Z,d+=n*V,y+=n*F,A+=n*ce,v+=n*E,x+=n*X,L+=n*Q,_+=n*P,R+=n*O,H+=n*z,$+=n*J,j+=n*re,D+=n*le,B+=n*se,U+=n*G,n=e[5],h+=n*C,d+=n*Z,y+=n*V,A+=n*F,v+=n*ce,x+=n*E,L+=n*X,_+=n*Q,R+=n*P,H+=n*O,$+=n*z,j+=n*J,D+=n*re,B+=n*le,U+=n*se,Y+=n*G,n=e[6],d+=n*C,y+=n*Z,A+=n*V,v+=n*F,x+=n*ce,L+=n*E,_+=n*X,R+=n*Q,H+=n*P,$+=n*O,j+=n*z,D+=n*J,B+=n*re,U+=n*le,Y+=n*se,b+=n*G,n=e[7],y+=n*C,A+=n*Z,v+=n*V,x+=n*F,L+=n*ce,_+=n*E,R+=n*X,H+=n*Q,$+=n*P,j+=n*O,D+=n*z,B+=n*J,U+=n*re,Y+=n*le,b+=n*se,u+=n*G,n=e[8],A+=n*C,v+=n*Z,x+=n*V,L+=n*F,_+=n*ce,R+=n*E,H+=n*X,$+=n*Q,j+=n*P,D+=n*O,B+=n*z,U+=n*J,Y+=n*re,b+=n*le,u+=n*se,p+=n*G,n=e[9],v+=n*C,x+=n*Z,L+=n*V,_+=n*F,R+=n*ce,H+=n*E,$+=n*X,j+=n*Q,D+=n*P,B+=n*O,U+=n*z,Y+=n*J,b+=n*re,u+=n*le,p+=n*se,m+=n*G,n=e[10],x+=n*C,L+=n*Z,_+=n*V,R+=n*F,H+=n*ce,$+=n*E,j+=n*X,D+=n*Q,B+=n*P,U+=n*O,Y+=n*z,b+=n*J,u+=n*re,p+=n*le,m+=n*se,w+=n*G,n=e[11],L+=n*C,_+=n*Z,R+=n*V,H+=n*F,$+=n*ce,j+=n*E,D+=n*X,B+=n*Q,U+=n*P,Y+=n*O,b+=n*z,u+=n*J,p+=n*re,m+=n*le,w+=n*se,S+=n*G,n=e[12],_+=n*C,R+=n*Z,H+=n*V,$+=n*F,j+=n*ce,D+=n*E,B+=n*X,U+=n*Q,Y+=n*P,b+=n*O,u+=n*z,p+=n*J,m+=n*re,w+=n*le,S+=n*se,N+=n*G,n=e[13],R+=n*C,H+=n*Z,$+=n*V,j+=n*F,D+=n*ce,B+=n*E,U+=n*X,Y+=n*Q,b+=n*P,u+=n*O,p+=n*z,m+=n*J,w+=n*re,S+=n*le,N+=n*se,I+=n*G,n=e[14],H+=n*C,$+=n*Z,j+=n*V,D+=n*F,B+=n*ce,U+=n*E,Y+=n*X,b+=n*Q,u+=n*P,p+=n*O,m+=n*z,w+=n*J,S+=n*re,N+=n*le,I+=n*se,T+=n*G,n=e[15],$+=n*C,j+=n*Z,D+=n*V,B+=n*F,U+=n*ce,Y+=n*E,b+=n*X,u+=n*Q,p+=n*P,m+=n*O,w+=n*z,S+=n*J,N+=n*re,I+=n*le,T+=n*se,g+=n*G,o+=38*j,a+=38*D,f+=38*B,c+=38*U,l+=38*Y,h+=38*b,d+=38*u,y+=38*p,A+=38*m,v+=38*w,x+=38*S,L+=38*N,_+=38*I,R+=38*T,H+=38*g,i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=$+i+65535,i=Math.floor(n/65536),$=n-i*65536,o+=i-1+37*(i-1),i=1,n=o+i+65535,i=Math.floor(n/65536),o=n-i*65536,n=a+i+65535,i=Math.floor(n/65536),a=n-i*65536,n=f+i+65535,i=Math.floor(n/65536),f=n-i*65536,n=c+i+65535,i=Math.floor(n/65536),c=n-i*65536,n=l+i+65535,i=Math.floor(n/65536),l=n-i*65536,n=h+i+65535,i=Math.floor(n/65536),h=n-i*65536,n=d+i+65535,i=Math.floor(n/65536),d=n-i*65536,n=y+i+65535,i=Math.floor(n/65536),y=n-i*65536,n=A+i+65535,i=Math.floor(n/65536),A=n-i*65536,n=v+i+65535,i=Math.floor(n/65536),v=n-i*65536,n=x+i+65535,i=Math.floor(n/65536),x=n-i*65536,n=L+i+65535,i=Math.floor(n/65536),L=n-i*65536,n=_+i+65535,i=Math.floor(n/65536),_=n-i*65536,n=R+i+65535,i=Math.floor(n/65536),R=n-i*65536,n=H+i+65535,i=Math.floor(n/65536),H=n-i*65536,n=$+i+65535,i=Math.floor(n/65536),$=n-i*65536,o+=i-1+37*(i-1),r[0]=o,r[1]=a,r[2]=f,r[3]=c,r[4]=l,r[5]=h,r[6]=d,r[7]=y,r[8]=A,r[9]=v,r[10]=x,r[11]=L,r[12]=_,r[13]=R,r[14]=H,r[15]=$}s(ao,"mul");function Ru(r,e){ao(r,e,e)}s(Ru,"square");function QT(r,e){for(var t=Ti(),n=0;n<16;n++)t[n]=e[n];for(var n=253;n>=0;n--)Ru(t,t),n!==2&&n!==4&&ao(t,t,e);for(var n=0;n<16;n++)r[n]=t[n]}s(QT,"inv25519");function n1(r,e){for(var t=new Uint8Array(32),n=new Float64Array(80),i=Ti(),o=Ti(),a=Ti(),f=Ti(),c=Ti(),l=Ti(),h=0;h<31;h++)t[h]=r[h];t[31]=r[31]&127|64,t[0]&=248,ZT(n,e);for(var h=0;h<16;h++)o[h]=n[h];i[0]=f[0]=1;for(var h=254;h>=0;--h){var d=t[h>>>3]>>>(h&7)&1;Pu(i,o,d),Pu(a,f,d),_d(c,i,a),Ed(i,i,a),_d(a,o,f),Ed(o,o,f),Ru(f,c),Ru(l,i),ao(i,a,i),ao(a,o,c),_d(c,i,a),Ed(i,i,a),Ru(o,i),Ed(a,f,l),ao(i,a,YT),_d(i,i,f),ao(a,a,i),ao(i,f,l),ao(f,o,n),Ru(o,c),Pu(i,o,d),Pu(a,f,d)}for(var h=0;h<16;h++)n[h+16]=i[h],n[h+32]=a[h],n[h+48]=o[h],n[h+64]=f[h];var y=n.subarray(32),A=n.subarray(16);QT(y,y),ao(A,A,y);var v=new Uint8Array(32);return XT(v,A),v}s(n1,"scalarMult");Wr.scalarMult=n1;function gx(r){return n1(r,bx)}s(gx,"scalarMultBase");Wr.scalarMultBase=gx;function yx(r){if(r.length!==Wr.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+Wr.SECRET_KEY_LENGTH+" bytes");var e=new Uint8Array(r),t=gx(e);return{publicKey:t,secretKey:e}}s(yx,"generateKeyPairFromSeed");Wr.generateKeyPairFromSeed=yx;function ek(r){var e=GT.randomBytes(32,r),t=yx(e);return JT.wipe(e),t}s(ek,"generateKeyPair");Wr.generateKeyPair=ek;function tk(r,e,t){if(t===void 0&&(t=!1),r.length!==Wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(e.length!==Wr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var n=n1(r,e);if(t){for(var i=0,o=0;o<n.length;o++)i|=n[o];if(i===0)throw new Error("X25519: invalid shared key")}return n}s(tk,"sharedKey");Wr.sharedKey=tk});var o1=de(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:!0});var _r=na(),i1=Sn(),rk=20;function nk(r,e,t){for(var n=1634760805,i=857760878,o=2036477234,a=1797285236,f=t[3]<<24|t[2]<<16|t[1]<<8|t[0],c=t[7]<<24|t[6]<<16|t[5]<<8|t[4],l=t[11]<<24|t[10]<<16|t[9]<<8|t[8],h=t[15]<<24|t[14]<<16|t[13]<<8|t[12],d=t[19]<<24|t[18]<<16|t[17]<<8|t[16],y=t[23]<<24|t[22]<<16|t[21]<<8|t[20],A=t[27]<<24|t[26]<<16|t[25]<<8|t[24],v=t[31]<<24|t[30]<<16|t[29]<<8|t[28],x=e[3]<<24|e[2]<<16|e[1]<<8|e[0],L=e[7]<<24|e[6]<<16|e[5]<<8|e[4],_=e[11]<<24|e[10]<<16|e[9]<<8|e[8],R=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,$=i,j=o,D=a,B=f,U=c,Y=l,b=h,u=d,p=y,m=A,w=v,S=x,N=L,I=_,T=R,g=0;g<rk;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,$=$+U|0,N^=$,N=N>>>32-16|N<<16,p=p+N|0,U^=p,U=U>>>32-12|U<<12,j=j+Y|0,I^=j,I=I>>>32-16|I<<16,m=m+I|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,T^=D,T=T>>>32-16|T<<16,w=w+T|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,I^=j,I=I>>>32-8|I<<8,m=m+I|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,T^=D,T=T>>>32-8|T<<8,w=w+T|0,b^=w,b=b>>>32-7|b<<7,$=$+U|0,N^=$,N=N>>>32-8|N<<8,p=p+N|0,U^=p,U=U>>>32-7|U<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+U|0,T^=H,T=T>>>32-16|T<<16,m=m+T|0,U^=m,U=U>>>32-12|U<<12,$=$+Y|0,S^=$,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,N^=j,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,I^=D,I=I>>>32-16|I<<16,p=p+I|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,N^=j,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,I^=D,I=I>>>32-8|I<<8,p=p+I|0,B^=p,B=B>>>32-7|B<<7,$=$+Y|0,S^=$,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+U|0,T^=H,T=T>>>32-8|T<<8,m=m+T|0,U^=m,U=U>>>32-7|U<<7;_r.writeUint32LE(H+n|0,r,0),_r.writeUint32LE($+i|0,r,4),_r.writeUint32LE(j+o|0,r,8),_r.writeUint32LE(D+a|0,r,12),_r.writeUint32LE(B+f|0,r,16),_r.writeUint32LE(U+c|0,r,20),_r.writeUint32LE(Y+l|0,r,24),_r.writeUint32LE(b+h|0,r,28),_r.writeUint32LE(u+d|0,r,32),_r.writeUint32LE(p+y|0,r,36),_r.writeUint32LE(m+A|0,r,40),_r.writeUint32LE(w+v|0,r,44),_r.writeUint32LE(S+x|0,r,48),_r.writeUint32LE(N+L|0,r,52),_r.writeUint32LE(I+_|0,r,56),_r.writeUint32LE(T+R|0,r,60)}s(nk,"core");function wx(r,e,t,n,i){if(i===void 0&&(i=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<t.length)throw new Error("ChaCha: destination is shorter than source");var o,a;if(i===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");o=new Uint8Array(16),a=o.length-e.length,o.set(e,a)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");o=e,a=i}for(var f=new Uint8Array(64),c=0;c<t.length;c+=64){nk(f,o,r);for(var l=c;l<c+64&&l<t.length;l++)n[l]=t[l]^f[l-c];ok(o,0,a)}return i1.wipe(f),i===0&&i1.wipe(o),n}s(wx,"streamXOR");Sd.streamXOR=wx;function ik(r,e,t,n){return n===void 0&&(n=0),i1.wipe(t),wx(r,e,t,t,n)}s(ik,"stream");Sd.stream=ik;function ok(r,e,t){for(var n=1;t--;)n=n+(r[e]&255)|0,r[e]=n&255,n>>>=8,e++;if(n>0)throw new Error("ChaCha: counter overflow")}s(ok,"incrementCounter")});var Ex=de(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});var gs=na(),xx=Sn(),sk=o1(),ak=20;function Ax(r,e,t,n){if(e.length!==24)throw new Error("XChaCha20 nonce must be 24 bytes");var i=_x(r,e.subarray(0,16),new Uint8Array(32)),o=new Uint8Array(12);o.set(e.subarray(16),4);var a=sk.streamXOR(i,o,t,n);return xx.wipe(i),a}s(Ax,"streamXOR");Uu.streamXOR=Ax;function fk(r,e,t){return xx.wipe(t),Ax(r,e,t,t)}s(fk,"stream");Uu.stream=fk;function _x(r,e,t){for(var n=1634760805,i=857760878,o=2036477234,a=1797285236,f=r[3]<<24|r[2]<<16|r[1]<<8|r[0],c=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],y=r[23]<<24|r[22]<<16|r[21]<<8|r[20],A=r[27]<<24|r[26]<<16|r[25]<<8|r[24],v=r[31]<<24|r[30]<<16|r[29]<<8|r[28],x=e[3]<<24|e[2]<<16|e[1]<<8|e[0],L=e[7]<<24|e[6]<<16|e[5]<<8|e[4],_=e[11]<<24|e[10]<<16|e[9]<<8|e[8],R=e[15]<<24|e[14]<<16|e[13]<<8|e[12],H=n,$=i,j=o,D=a,B=f,U=c,Y=l,b=h,u=d,p=y,m=A,w=v,S=x,N=L,I=_,T=R,g=0;g<ak;g+=2)H=H+B|0,S^=H,S=S>>>32-16|S<<16,u=u+S|0,B^=u,B=B>>>32-12|B<<12,$=$+U|0,N^=$,N=N>>>32-16|N<<16,p=p+N|0,U^=p,U=U>>>32-12|U<<12,j=j+Y|0,I^=j,I=I>>>32-16|I<<16,m=m+I|0,Y^=m,Y=Y>>>32-12|Y<<12,D=D+b|0,T^=D,T=T>>>32-16|T<<16,w=w+T|0,b^=w,b=b>>>32-12|b<<12,j=j+Y|0,I^=j,I=I>>>32-8|I<<8,m=m+I|0,Y^=m,Y=Y>>>32-7|Y<<7,D=D+b|0,T^=D,T=T>>>32-8|T<<8,w=w+T|0,b^=w,b=b>>>32-7|b<<7,$=$+U|0,N^=$,N=N>>>32-8|N<<8,p=p+N|0,U^=p,U=U>>>32-7|U<<7,H=H+B|0,S^=H,S=S>>>32-8|S<<8,u=u+S|0,B^=u,B=B>>>32-7|B<<7,H=H+U|0,T^=H,T=T>>>32-16|T<<16,m=m+T|0,U^=m,U=U>>>32-12|U<<12,$=$+Y|0,S^=$,S=S>>>32-16|S<<16,w=w+S|0,Y^=w,Y=Y>>>32-12|Y<<12,j=j+b|0,N^=j,N=N>>>32-16|N<<16,u=u+N|0,b^=u,b=b>>>32-12|b<<12,D=D+B|0,I^=D,I=I>>>32-16|I<<16,p=p+I|0,B^=p,B=B>>>32-12|B<<12,j=j+b|0,N^=j,N=N>>>32-8|N<<8,u=u+N|0,b^=u,b=b>>>32-7|b<<7,D=D+B|0,I^=D,I=I>>>32-8|I<<8,p=p+I|0,B^=p,B=B>>>32-7|B<<7,$=$+Y|0,S^=$,S=S>>>32-8|S<<8,w=w+S|0,Y^=w,Y=Y>>>32-7|Y<<7,H=H+U|0,T^=H,T=T>>>32-8|T<<8,m=m+T|0,U^=m,U=U>>>32-7|U<<7;return gs.writeUint32LE(H,t,0),gs.writeUint32LE($,t,4),gs.writeUint32LE(j,t,8),gs.writeUint32LE(D,t,12),gs.writeUint32LE(S,t,16),gs.writeUint32LE(N,t,20),gs.writeUint32LE(I,t,24),gs.writeUint32LE(T,t,28),t}s(_x,"hchacha");Uu.hchacha=_x});var s1=de(Rf=>{"use strict";Object.defineProperty(Rf,"__esModule",{value:!0});function ck(r,e,t){return~(r-1)&e|r-1&t}s(ck,"select");Rf.select=ck;function uk(r,e){return(r|0)-(e|0)-1>>>31&1}s(uk,"lessOrEqual");Rf.lessOrEqual=uk;function Sx(r,e){if(r.length!==e.length)return 0;for(var t=0,n=0;n<r.length;n++)t|=r[n]^e[n];return 1&t-1>>>8}s(Sx,"compare");Rf.compare=Sx;function lk(r,e){return r.length===0||e.length===0?!1:Sx(r,e)!==0}s(lk,"equal");Rf.equal=lk});var Tx=de(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});var hk=s1(),Cd=Sn();fo.DIGEST_LENGTH=16;var Cx=function(){function r(e){this.digestLength=fo.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var t=e[0]|e[1]<<8;this._r[0]=t&8191;var n=e[2]|e[3]<<8;this._r[1]=(t>>>13|n<<3)&8191;var i=e[4]|e[5]<<8;this._r[2]=(n>>>10|i<<6)&7939;var o=e[6]|e[7]<<8;this._r[3]=(i>>>7|o<<9)&8191;var a=e[8]|e[9]<<8;this._r[4]=(o>>>4|a<<12)&255,this._r[5]=a>>>1&8190;var f=e[10]|e[11]<<8;this._r[6]=(a>>>14|f<<2)&8191;var c=e[12]|e[13]<<8;this._r[7]=(f>>>11|c<<5)&8065;var l=e[14]|e[15]<<8;this._r[8]=(c>>>8|l<<8)&8191,this._r[9]=l>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return s(r,"Poly1305"),r.prototype._blocks=function(e,t,n){for(var i=this._fin?0:2048,o=this._h[0],a=this._h[1],f=this._h[2],c=this._h[3],l=this._h[4],h=this._h[5],d=this._h[6],y=this._h[7],A=this._h[8],v=this._h[9],x=this._r[0],L=this._r[1],_=this._r[2],R=this._r[3],H=this._r[4],$=this._r[5],j=this._r[6],D=this._r[7],B=this._r[8],U=this._r[9];n>=16;){var Y=e[t+0]|e[t+1]<<8;o+=Y&8191;var b=e[t+2]|e[t+3]<<8;a+=(Y>>>13|b<<3)&8191;var u=e[t+4]|e[t+5]<<8;f+=(b>>>10|u<<6)&8191;var p=e[t+6]|e[t+7]<<8;c+=(u>>>7|p<<9)&8191;var m=e[t+8]|e[t+9]<<8;l+=(p>>>4|m<<12)&8191,h+=m>>>1&8191;var w=e[t+10]|e[t+11]<<8;d+=(m>>>14|w<<2)&8191;var S=e[t+12]|e[t+13]<<8;y+=(w>>>11|S<<5)&8191;var N=e[t+14]|e[t+15]<<8;A+=(S>>>8|N<<8)&8191,v+=N>>>5|i;var I=0,T=I;T+=o*x,T+=a*(5*U),T+=f*(5*B),T+=c*(5*D),T+=l*(5*j),I=T>>>13,T&=8191,T+=h*(5*$),T+=d*(5*H),T+=y*(5*R),T+=A*(5*_),T+=v*(5*L),I+=T>>>13,T&=8191;var g=I;g+=o*L,g+=a*x,g+=f*(5*U),g+=c*(5*B),g+=l*(5*D),I=g>>>13,g&=8191,g+=h*(5*j),g+=d*(5*$),g+=y*(5*H),g+=A*(5*R),g+=v*(5*_),I+=g>>>13,g&=8191;var C=I;C+=o*_,C+=a*L,C+=f*x,C+=c*(5*U),C+=l*(5*B),I=C>>>13,C&=8191,C+=h*(5*D),C+=d*(5*j),C+=y*(5*$),C+=A*(5*H),C+=v*(5*R),I+=C>>>13,C&=8191;var Z=I;Z+=o*R,Z+=a*_,Z+=f*L,Z+=c*x,Z+=l*(5*U),I=Z>>>13,Z&=8191,Z+=h*(5*B),Z+=d*(5*D),Z+=y*(5*j),Z+=A*(5*$),Z+=v*(5*H),I+=Z>>>13,Z&=8191;var V=I;V+=o*H,V+=a*R,V+=f*_,V+=c*L,V+=l*x,I=V>>>13,V&=8191,V+=h*(5*U),V+=d*(5*B),V+=y*(5*D),V+=A*(5*j),V+=v*(5*$),I+=V>>>13,V&=8191;var F=I;F+=o*$,F+=a*H,F+=f*R,F+=c*_,F+=l*L,I=F>>>13,F&=8191,F+=h*x,F+=d*(5*U),F+=y*(5*B),F+=A*(5*D),F+=v*(5*j),I+=F>>>13,F&=8191;var ce=I;ce+=o*j,ce+=a*$,ce+=f*H,ce+=c*R,ce+=l*_,I=ce>>>13,ce&=8191,ce+=h*L,ce+=d*x,ce+=y*(5*U),ce+=A*(5*B),ce+=v*(5*D),I+=ce>>>13,ce&=8191;var E=I;E+=o*D,E+=a*j,E+=f*$,E+=c*H,E+=l*R,I=E>>>13,E&=8191,E+=h*_,E+=d*L,E+=y*x,E+=A*(5*U),E+=v*(5*B),I+=E>>>13,E&=8191;var X=I;X+=o*B,X+=a*D,X+=f*j,X+=c*$,X+=l*H,I=X>>>13,X&=8191,X+=h*R,X+=d*_,X+=y*L,X+=A*x,X+=v*(5*U),I+=X>>>13,X&=8191;var Q=I;Q+=o*U,Q+=a*B,Q+=f*D,Q+=c*j,Q+=l*$,I=Q>>>13,Q&=8191,Q+=h*H,Q+=d*R,Q+=y*_,Q+=A*L,Q+=v*x,I+=Q>>>13,Q&=8191,I=(I<<2)+I|0,I=I+T|0,T=I&8191,I=I>>>13,g+=I,o=T,a=g,f=C,c=Z,l=V,h=F,d=ce,y=E,A=X,v=Q,t+=16,n-=16}this._h[0]=o,this._h[1]=a,this._h[2]=f,this._h[3]=c,this._h[4]=l,this._h[5]=h,this._h[6]=d,this._h[7]=y,this._h[8]=A,this._h[9]=v},r.prototype.finish=function(e,t){t===void 0&&(t=0);var n=new Uint16Array(10),i,o,a,f;if(this._leftover){for(f=this._leftover,this._buffer[f++]=1;f<16;f++)this._buffer[f]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(i=this._h[1]>>>13,this._h[1]&=8191,f=2;f<10;f++)this._h[f]+=i,i=this._h[f]>>>13,this._h[f]&=8191;for(this._h[0]+=i*5,i=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=i,i=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=i,n[0]=this._h[0]+5,i=n[0]>>>13,n[0]&=8191,f=1;f<10;f++)n[f]=this._h[f]+i,i=n[f]>>>13,n[f]&=8191;for(n[9]-=1<<13,o=(i^1)-1,f=0;f<10;f++)n[f]&=o;for(o=~o,f=0;f<10;f++)this._h[f]=this._h[f]&o|n[f];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,a=this._h[0]+this._pad[0],this._h[0]=a&65535,f=1;f<8;f++)a=(this._h[f]+this._pad[f]|0)+(a>>>16)|0,this._h[f]=a&65535;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},r.prototype.update=function(e){var t=0,n=e.length,i;if(this._leftover){i=16-this._leftover,i>n&&(i=n);for(var o=0;o<i;o++)this._buffer[this._leftover+o]=e[t+o];if(n-=i,t+=i,this._leftover+=i,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(i=n-n%16,this._blocks(e,t,i),t+=i,n-=i),n){for(var o=0;o<n;o++)this._buffer[this._leftover+o]=e[t+o];this._leftover+=n}return this},r.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},r.prototype.clean=function(){return Cd.wipe(this._buffer),Cd.wipe(this._r),Cd.wipe(this._h),Cd.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},r}();fo.Poly1305=Cx;function dk(r,e){var t=new Cx(r);t.update(e);var n=t.digest();return t.clean(),n}s(dk,"oneTimeAuth");fo.oneTimeAuth=dk;function pk(r,e){return r.length!==fo.DIGEST_LENGTH||e.length!==fo.DIGEST_LENGTH?!1:hk.equal(r,e)}s(pk,"equal");fo.equal=pk});var Bx=de(co=>{"use strict";Object.defineProperty(co,"__esModule",{value:!0});var Td=o1(),mk=Tx(),Lu=Sn(),kx=na(),bk=s1();co.KEY_LENGTH=32;co.NONCE_LENGTH=12;co.TAG_LENGTH=16;var Mx=new Uint8Array(16),gk=function(){function r(e){if(this.nonceLength=co.NONCE_LENGTH,this.tagLength=co.TAG_LENGTH,e.length!==co.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return s(r,"ChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);Td.stream(this._key,o,a,4);var f=t.length+this.tagLength,c;if(i){if(i.length!==f)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(f);return Td.streamXOR(this._key,o,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),n),Lu.wipe(o),c},r.prototype.open=function(e,t,n,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);Td.stream(this._key,o,a,4);var f=new Uint8Array(this.tagLength);if(this._authenticate(f,a,t.subarray(0,t.length-this.tagLength),n),!bk.equal(f,t.subarray(t.length-this.tagLength,t.length)))return null;var c=t.length-this.tagLength,l;if(i){if(i.length!==c)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(c);return Td.streamXOR(this._key,o,t.subarray(0,t.length-this.tagLength),l,4),Lu.wipe(o),l},r.prototype.clean=function(){return Lu.wipe(this._key),this},r.prototype._authenticate=function(e,t,n,i){var o=new mk.Poly1305(t);i&&(o.update(i),i.length%16>0&&o.update(Mx.subarray(i.length%16))),o.update(n),n.length%16>0&&o.update(Mx.subarray(n.length%16));var a=new Uint8Array(8);i&&kx.writeUint64LE(i.length,a),o.update(a),kx.writeUint64LE(n.length,a),o.update(a);for(var f=o.digest(),c=0;c<f.length;c++)e[c]=f[c];o.clean(),Lu.wipe(f),Lu.wipe(a)},r}();co.ChaCha20Poly1305=gk});var Ox=de(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var Ix=Ex(),Nx=Bx(),Du=Sn();uo.KEY_LENGTH=32;uo.NONCE_LENGTH=24;uo.TAG_LENGTH=16;var yk=function(){function r(e){if(this.nonceLength=uo.NONCE_LENGTH,this.tagLength=uo.TAG_LENGTH,e.length!==uo.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return s(r,"XChaCha20Poly1305"),r.prototype.seal=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");var o=Ix.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var f=new Nx.ChaCha20Poly1305(o),c=f.seal(a,t,n,i);return Du.wipe(o),Du.wipe(a),f.clean(),c},r.prototype.open=function(e,t,n,i){if(e.length!==24)throw new Error("XChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=Ix.hchacha(this._key,e.subarray(0,16),new Uint8Array(32)),a=new Uint8Array(12);a.set(e.subarray(16),4);var f=new Nx.ChaCha20Poly1305(o),c=f.open(a,t,n,i);return Du.wipe(o),Du.wipe(a),f.clean(),c},r.prototype.clean=function(){return Du.wipe(this._key),this},r}();uo.XChaCha20Poly1305=yk});var ni=de((g$,x3)=>{x3.exports={ALT:1,CAT:2,REP:3,RNM:4,TRG:5,TBS:6,TLS:7,UDT:11,AND:12,NOT:13,BKR:14,BKA:15,BKN:16,ABG:17,AEN:18,ACTIVE:100,MATCH:101,EMPTY:102,NOMATCH:103,SEM_PRE:200,SEM_POST:201,SEM_OK:300,SEM_SKIP:301,ATTR_N:400,ATTR_R:401,ATTR_MR:402,LOOKAROUND_NONE:500,LOOKAROUND_AHEAD:501,LOOKAROUND_BEHIND:502,BKR_MODE_UM:601,BKR_MODE_PM:602,BKR_MODE_CS:603,BKR_MODE_CI:604}});var Wu=de((y$,A3)=>{A3.exports={CLASS_MONOSPACE:"apg-mono",CLASS_ACTIVE:"apg-active",CLASS_EMPTY:"apg-empty",CLASS_MATCH:"apg-match",CLASS_NOMATCH:"apg-nomatch",CLASS_LOOKAHEAD:"apg-lh-match",CLASS_LOOKBEHIND:"apg-lb-match",CLASS_REMAINDER:"apg-remainder",CLASS_CTRLCHAR:"apg-ctrl-char",CLASS_LINEEND:"apg-line-end",CLASS_ERROR:"apg-error",CLASS_PHRASE:"apg-phrase",CLASS_EMPTYPHRASE:"apg-empty-phrase",CLASS_STATE:"apg-state",CLASS_STATS:"apg-stats",CLASS_TRACE:"apg-trace",CLASS_GRAMMAR:"apg-grammar",CLASS_RULES:"apg-rules",CLASS_RULESLINK:"apg-rules-link",CLASS_ATTRIBUTES:"apg-attrs"}});var S3=de(mr=>{var _3=mr,Vd=4294967292,Wd=4294967293,P1=4294967294,E3=4294967295,ve=[0,1,3,7,15,31,63,127,255,511,1023],xs=["00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F","10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F","20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F","30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F","40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F","50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F","60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F","70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F","80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F","90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF","B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF","C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF","D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF","E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF","F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF"],DM="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split(""),hn=[];DM.forEach(r=>{hn.push(r.charCodeAt(0))});mr.utf8={encode(r){let e=[];return r.forEach(t=>{if(t>=0&&t<=127)e.push(t);else if(t<=2047)e.push(192+(t>>6&ve[5])),e.push(128+(t&ve[6]));else if(t<55296||t>57343&&t<=65535)e.push(224+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]));else if(t>=65536&&t<=1114111){let n=t>>16&ve[5];e.push(240+(n>>2)),e.push(128+((n&ve[2])<<4)+(t>>12&ve[4])),e.push(128+(t>>6&ve[6])),e.push(128+(t&ve[6]))}else throw new RangeError(`utf8.encode: character out of range: char: ${t}`)}),Buffer.from(e)},decode(r,e){function t(v,x){if((x&192)!==128)return Wd;let L=((v&ve[5])<<6)+(x&ve[6]);return L<128?Vd:L}s(t,"bytes2");function n(v,x,L){if((L&192)!==128||(x&192)!==128)return Wd;let _=((v&ve[4])<<12)+((x&ve[6])<<6)+(L&ve[6]);return _<2048?Vd:_>=55296&&_<=57343?P1:_}s(n,"bytes3");function i(v,x,L,_){if((_&192)!==128||(L&192)!==128||(x&192)!==128)return Wd;let R=(((v&ve[3])<<2)+(x>>4&ve[2])<<16)+((x&ve[4])<<12)+((L&ve[6])<<6)+(_&ve[6]);return R<65536?Vd:R>1114111?P1:R}s(i,"bytes4");let o,a,f,c,l,h,d=r.length,y=e?3:0,A=[];for(;y<d;){a=r[y],o=E3;let v=!0;for(;v;){if(a>=0&&a<=127){o=a,h=1;break}if(f=y+1,f<d&&a>=194&&a<=223){o=t(a,r[f]),h=2;break}if(c=y+2,c<d&&a>=224&&a<=239){o=n(a,r[f],r[c]),h=3;break}if(l=y+3,l<d&&a>=240&&a<=244){o=i(a,r[f],r[c],r[l]),h=4;break}break}if(o>1114111){let x=`byte[${y}]`;throw o===E3?new RangeError(`utf8.decode: ill-formed UTF8 byte sequence found at: ${x}`):o===Wd?new RangeError(`utf8.decode: illegal trailing byte found at: ${x}`):o===P1?new RangeError(`utf8.decode: code point out of range found at: ${x}`):o===Vd?new RangeError(`utf8.decode: non-shortest form found at: ${x}`):new RangeError(`utf8.decode: unrecognized error found at: ${x}`)}A.push(o),y+=h}return A}};mr.utf16be={encode(r){let e=[],t,n,i;for(let o=0;o<r.length;o+=1)if(t=r[o],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t>>8&ve[8]),e.push(t&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n>>8&ve[8]),e.push(n&ve[8]),e.push(i>>8&ve[8]),e.push(i&ve[8]);else throw new RangeError(`utf16be.encode: UTF16BE value out of range: char[${o}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16be.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,o=0,a,f,c,l,h,d;for(;i<n;){for(;;){if(c=i+1,c<n){if(h=(r[i]<<8)+r[c],h<55296||h>57343){a=h,f=2;break}if(l=i+3,l<n&&(d=(r[i+2]<<8)+r[l],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),f=4;break}}throw new RangeError(`utf16be.decode: ill-formed UTF16BE byte sequence found: byte[${i}]`)}t[o++]=a,i+=f}return t}};mr.utf16le={encode(r){let e=[],t,n,i;for(let o=0;o<r.length;o+=1)if(t=r[o],t>=0&&t<=55295||t>=57344&&t<=65535)e.push(t&ve[8]),e.push(t>>8&ve[8]);else if(t>=65536&&t<=1114111)i=t-65536,n=55296+(i>>10),i=56320+(i&ve[10]),e.push(n&ve[8]),e.push(n>>8&ve[8]),e.push(i&ve[8]),e.push(i>>8&ve[8]);else throw new RangeError(`utf16le.encode: UTF16LE value out of range: char[${o}]: ${t}`);return Buffer.from(e)},decode(r,e){if(r.length%2>0)throw new RangeError(`utf16le.decode: data length must be even multiple of 2: length: ${r.length}`);let t=[],n=r.length,i=e?2:0,o=0,a,f,c,l,h,d;for(;i<n;){for(;;){if(c=i+1,c<n){if(h=(r[c]<<8)+r[i],h<55296||h>57343){a=h,f=2;break}if(l=i+3,l<n&&(d=(r[l]<<8)+r[i+2],h<=56319&&d>=56320&&d<=57343)){a=65536+(h-55296<<10)+(d-56320),f=4;break}}throw new RangeError(`utf16le.decode: ill-formed UTF16LE byte sequence found: byte[${i}]`)}t[o++]=a,i+=f}return t}};mr.utf32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32be.encode: UTF32BE character code out of range: char[${t/4}]: ${n}`);e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32BE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n]<<24)+(r[n+1]<<16)+(r[n+2]<<8)+r[n+3];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32be.decode: UTF32BE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};mr.utf32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{if(n>=55296&&n<=57343||n>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${t/4}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r,e){if(r.length%4>0)throw new RangeError(`utf32be.decode: UTF32LE byte length must be even multiple of 4: length: ${r.length}`);let t=[],n=e?4:0;for(;n<r.length;n+=4){let i=(r[n+3]<<24)+(r[n+2]<<16)+(r[n+1]<<8)+r[n];if(i>=55296&&i<=57343||i>1114111)throw new RangeError(`utf32le.encode: UTF32LE character code out of range: char[${n/4}]: ${i}`);t.push(i)}return t}};mr.uint7={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.encode: UINT7 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1){if(r[t]>127)throw new RangeError(`uint7.decode: UINT7 character code out of range: byte[${t}]: ${r[t]}`);e[t]=r[t]}return e}};mr.uint8={encode(r){let e=Buffer.alloc(r.length);for(let t=0;t<r.length;t+=1){if(r[t]>255)throw new RangeError(`uint8.encode: UINT8 character code out of range: char[${t}]: ${r[t]}`);e[t]=r[t]}return e},decode(r){let e=[];for(let t=0;t<r.length;t+=1)e[t]=r[t];return e}};mr.uint16be={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16be.encode: UINT16BE character code out of range: char[${t/2}]: ${n}`);e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16be.decode: UINT16BE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t]<<8)+r[t+1]);return e}};mr.uint16le={encode(r){let e=Buffer.alloc(r.length*2),t=0;return r.forEach(n=>{if(n>65535)throw new RangeError(`uint16le.encode: UINT16LE character code out of range: char[${t/2}]: ${n}`);e[t++]=n&ve[8],e[t++]=n>>8&ve[8]}),e},decode(r){if(r.length%2>0)throw new RangeError(`uint16le.decode: UINT16LE byte length must be even multiple of 2: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=2)e.push((r[t+1]<<8)+r[t]);return e}};mr.uint32be={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n>>24&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>8&ve[8],e[t++]=n&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32be.decode: UINT32BE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t]<<24)+(r[t+1]<<16)+(r[t+2]<<8)+r[t+3]);return e}};mr.uint32le={encode(r){let e=Buffer.alloc(r.length*4),t=0;return r.forEach(n=>{e[t++]=n&ve[8],e[t++]=n>>8&ve[8],e[t++]=n>>16&ve[8],e[t++]=n>>24&ve[8]}),e},decode(r){if(r.length%4>0)throw new RangeError(`uint32le.decode: UINT32LE byte length must be even multiple of 4: length: ${r.length}`);let e=[];for(let t=0;t<r.length;t+=4)e.push((r[t+3]<<24)+(r[t+2]<<16)+(r[t+1]<<8)+r[t]);return e}};mr.string={encode(r){return _3.utf16le.encode(r).toString("utf16le")},decode(r){return _3.utf16le.decode(Buffer.from(r,"utf16le"),0)}};mr.escaped={encode(r){let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if(n===96)e.push(n),e.push(n);else if(n===10)e.push(n);else if(n>=32&&n<=126)e.push(n);else{let i="";if(n>=0&&n<=31)i+=`\`x${xs[n]}`;else if(n>=127&&n<=255)i+=`\`x${xs[n]}`;else if(n>=256&&n<=65535)i+=`\`u${xs[n>>8&ve[8]]}${xs[n&ve[8]]}`;else if(n>=65536&&n<=4294967295){i+="`u{";let a=n>>24&ve[8];a>0&&(i+=xs[a]),i+=`${xs[n>>16&ve[8]]+xs[n>>8&ve[8]]+xs[n&ve[8]]}}`}else throw new Error("escape.encode(char): char > 0xffffffff not allowed");Buffer.from(i).forEach(a=>{e.push(a)})}}return Buffer.from(e)},decode(r){function e(d){return d>=48&&d<=57||d>=65&&d<=70||d>=97&&d<=102}s(e,"isHex");function t(d,y,A){let v={char:null,nexti:d+2,error:!0};if(d+1<y&&e(A[d])&&e(A[d+1])){let x=String.fromCodePoint(A[d],A[d+1]);v.char=parseInt(x,16),Number.isNaN(v.char)||(v.error=!1)}return v}s(t,"getx");function n(d,y,A){let v={char:null,nexti:d+4,error:!0};if(d+3<y&&e(A[d])&&e(A[d+1])&&e(A[d+2])&&e(A[d+3])){let x=String.fromCodePoint(A[d],A[d+1],A[d+2],A[d+3]);v.char=parseInt(x,16),Number.isNaN(v.char)||(v.error=!1)}return v}s(n,"getu");function i(d,y,A){let v={char:null,nexti:d+4,error:!0},x="";for(;d<y&&e(A[d]);)x+=String.fromCodePoint(A[d]),d+=1;return v.char=parseInt(x,16),A[d]===125&&!Number.isNaN(v.char)&&(v.error=!1),v.nexti=d+1,v}s(i,"getU");let o=[],a=r.length,f,c,l,h=0;for(;h<a;){for(;;){if(l=!0,r[h]!==96){o.push(r[h]),h+=1,l=!1;break}if(f=h+1,f>=a)break;if(r[f]===96){o.push(96),h+=2,l=!1;break}if(r[f]===120){if(c=t(f+1,a,r),c.error)break;o.push(c.char),h=c.nexti,l=!1;break}if(r[f]===117){if(r[f+1]===123){if(c=i(f+2,a,r),c.error)break;o.push(c.char),h=c.nexti,l=!1;break}if(c=n(f+1,a,r),c.error)break;o.push(c.char),h=c.nexti,l=!1;break}break}if(l)throw new Error(`escaped.decode: ill-formed escape sequence at buf[${h}]`)}return o}};var Gu=13,On=10;mr.lineEnds={crlf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Gu:t+1<r.length&&r[t+1]===On?t+=2:t+=1,e.push(Gu),e.push(On);break;case On:e.push(Gu),e.push(On),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==On&&(e.push(Gu),e.push(On)),e},lf(r){let e=[],t=0;for(;t<r.length;)switch(r[t]){case Gu:t+1<r.length&&r[t+1]===On?t+=2:t+=1,e.push(On);break;case On:e.push(On),t+=1;break;default:e.push(r[t]),t+=1;break}return e.length>0&&e[e.length-1]!==On&&e.push(On),e}};mr.base64={encode(r){if(r.length===0)return Buffer.alloc(0);let e,t,n,i=r.length%3;i=i>0?3-i:0;let o=(r.length+i)/3,a=Buffer.alloc(o*4);i>0&&(o-=1),e=0,t=0;for(let f=0;f<o;f+=1)n=r[e++]<<16,n+=r[e++]<<8,n+=r[e++],a[t++]=hn[n>>18&ve[6]],a[t++]=hn[n>>12&ve[6]],a[t++]=hn[n>>6&ve[6]],a[t++]=hn[n&ve[6]];if(i===0)return a;if(i===1)return n=r[e++]<<16,n+=r[e]<<8,a[t++]=hn[n>>18&ve[6]],a[t++]=hn[n>>12&ve[6]],a[t++]=hn[n>>6&ve[6]],a[t]=hn[64],a;if(i===2)return n=r[e]<<16,a[t++]=hn[n>>18&ve[6]],a[t++]=hn[n>>12&ve[6]],a[t++]=hn[64],a[t]=hn[64],a},decode(r){function e(h){let d=[],y=0;for(let A=0;A<h.length;A+=1){let v=h[A],x=!0;for(;x&&!(v===32||v===9||v===10||v===13);){if(v>=65&&v<=90){d.push(v-65);break}if(v>=97&&v<=122){d.push(v-71);break}if(v>=48&&v<=57){d.push(v+4);break}if(v===43){d.push(62);break}if(v===47){d.push(63);break}if(v===61){d.push(64),y+=1;break}throw new RangeError(`base64.decode: invalid character buf[${A}]: ${v}`)}}if(d.length%4>0)throw new RangeError(`base64.decode: string length not integral multiple of 4: ${d.length}`);switch(y){case 0:break;case 1:if(d[d.length-1]!==64)throw new RangeError("base64.decode: one tail character found: not last character");break;case 2:if(d[d.length-1]!==64||d[d.length-2]!==64)throw new RangeError("base64.decode: two tail characters found: not last characters");break;default:throw new RangeError(`base64.decode: more than two tail characters found: ${y}`)}return{tail:y,buf:Buffer.from(d)}}if(s(e,"validate"),r.length===0)return Buffer.alloc(0);let t=e(r),{tail:n}=t,i=t.buf,o,a,f,c=i.length/4,l=Buffer.alloc(c*3-n);n>0&&(c-=1),a=0,o=0;for(let h=0;h<c;h+=1)f=i[o++]<<18,f+=i[o++]<<12,f+=i[o++]<<6,f+=i[o++],l[a++]=f>>16&ve[8],l[a++]=f>>8&ve[8],l[a++]=f&ve[8];return n===1&&(f=i[o++]<<18,f+=i[o++]<<12,f+=i[o]<<6,l[a++]=f>>16&ve[8],l[a]=f>>8&ve[8]),n===2&&(f=i[o++]<<18,f+=i[o++]<<12,l[a]=f>>16&ve[8]),l},toString(r){if(r.length%4>0)throw new RangeError(`base64.toString: input buffer length not multiple of 4: ${r.length}`);let e="",t=0;function n(o,a,f,c){switch(t){case 76:e+=`\r
|
16
|
+
${o}${a}${f}${c}`,t=4;break;case 75:e+=`${o}\r
|
17
|
+
${a}${f}${c}`,t=3;break;case 74:e+=`${o+a}\r
|
18
|
+
${f}${c}`,t=2;break;case 73:e+=`${o+a+f}\r
|
19
|
+
${c}`,t=1;break;default:e+=o+a+f+c,t+=4;break}}s(n,"buildLine");function i(o){return o>=65&&o<=90||o>=97&&o<=122||o>=48&&o<=57||o===43||o===47||o===61}s(i,"validate");for(let o=0;o<r.length;o+=4){for(let a=o;a<o+4;a+=1)if(!i(r[a]))throw new RangeError(`base64.toString: buf[${a}]: ${r[a]} : not valid base64 character code`);n(String.fromCharCode(r[o]),String.fromCharCode(r[o+1]),String.fromCharCode(r[o+2]),String.fromCharCode(r[o+3]))}return e}}});var D1=de(Yu=>{var C3=Yu,tt=S3(),Ju="UTF8",U1="UTF16",Mi="UTF16BE",po="UTF16LE",L1="UTF32",Bi="UTF32BE",mo="UTF32LE",qf="UINT7",T3="ASCII",k3="BINARY",zf="UINT8",M3="UINT16",Gd="UINT16LE",jf="UINT16BE",B3="UINT32",Jd="UINT32LE",Vf="UINT32BE",Yd="ESCAPED",As="STRING",FM=s(function(e){e.type=Ju;let t=e.data;e.bom=0,t.length>=3&&t[0]===239&&t[1]===187&&t[2]===191&&(e.bom=3)},"bom8"),KM=s(function(e){let t=e.data;switch(e.bom=0,e.type){case U1:e.type=Mi,t.length>=2&&(t[0]===254&&t[1]===255?e.bom=2:t[0]===255&&t[1]===254&&(e.type=po,e.bom=2));break;case Mi:if(e.type=Mi,t.length>=2){if(t[0]===254&&t[1]===255)e.bom=2;else if(t[0]===255&&t[1]===254)throw new TypeError(`src type: "${Mi}" specified but BOM is for "${po}"`)}break;case po:if(e.type=po,t.length>=0){if(t[0]===254&&t[1]===255)throw new TypeError(`src type: "${po}" specified but BOM is for "${Mi}"`);t[0]===255&&t[1]===254&&(e.bom=2)}break;default:throw new TypeError(`UTF16 BOM: src type "${e.type}" unrecognized`)}},"bom16"),$M=s(function(e){let t=e.data;switch(e.bom=0,e.type){case L1:e.type=Bi,t.length>=4&&(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255&&(e.bom=4),t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0&&(e.type=mo,e.bom=4));break;case Bi:if(e.type=Bi,t.length>=4&&(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255&&(e.bom=4),t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0))throw new TypeError(`src type: ${Bi} specified but BOM is for ${mo}"`);break;case mo:if(e.type=mo,t.length>=4){if(t[0]===0&&t[1]===0&&t[2]===254&&t[3]===255)throw new TypeError(`src type: "${mo}" specified but BOM is for "${Bi}"`);t[0]===255&&t[1]===254&&t[2]===0&&t[3]===0&&(e.bom=4)}break;default:throw new TypeError(`UTF32 BOM: src type "${e.type}" unrecognized`)}},"bom32"),HM=s(function(e,t){function n(o){let a={type:"",base64:!1},c=/^(base64:)?([a-zA-Z0-9]+)$/i.exec(o);return c&&(c[2]&&(a.type=c[2].toUpperCase()),c[1]&&(a.base64=!0)),a}if(s(n,"getType"),typeof e!="string"||e==="")throw new TypeError(`type: "${e}" not recognized`);let i=n(e.toUpperCase());if(i.base64){if(i.type===As)throw new TypeError(`type: "${e} "BASE64:" prefix not allowed with type ${As}`);if(Buffer.isBuffer(t))i.data=tt.base64.decode(t);else if(typeof t=="string"){let o=Buffer.from(t,"ascii");i.data=tt.base64.decode(o)}else throw new TypeError(`type: "${e} unrecognized data type: typeof(data): ${typeof t}`)}else i.data=t;switch(i.type){case Ju:FM(i);break;case U1:case Mi:case po:KM(i);break;case L1:case Bi:case mo:$M(i);break;case M3:i.type=jf;break;case B3:i.type=Vf;break;case T3:i.type=qf;break;case k3:i.type=zf;break;case qf:case zf:case Gd:case jf:case Jd:case Vf:case As:case Yd:break;default:throw new TypeError(`type: "${e}" not recognized`)}if(i.type===As){if(typeof i.data!="string")throw new TypeError(`type: "${e}" but data is not a string`)}else if(!Buffer.isBuffer(i.data))throw new TypeError(`type: "${e}" but data is not a Buffer`);return i},"validateSrc"),qM=s(function(e,t){function n(o){let a,f,c={crlf:!1,lf:!1,base64:!1,type:""},l=!0;for(;l;){if(f=o,a=o.slice(0,5),a==="CRLF:"){c.crlf=!0,f=o.slice(5);break}if(a=o.slice(0,3),a==="LF:"){c.lf=!0,f=o.slice(3);break}break}return a=f.split(":"),a.length===1?c.type=a[0]:a.length===2&&a[1]==="BASE64"&&(c.base64=!0,c.type=a[0]),c}if(s(n,"getType"),!Array.isArray(t))throw new TypeError(`dst chars: not array: "${typeof t}`);if(typeof e!="string")throw new TypeError(`dst type: not string: "${typeof e}`);let i=n(e.toUpperCase());switch(i.type){case Ju:case Mi:case po:case Bi:case mo:case qf:case zf:case Gd:case jf:case Jd:case Vf:case Yd:break;case As:if(i.base64)throw new TypeError(`":BASE64" suffix not allowed with type ${As}`);break;case T3:i.type=qf;break;case k3:i.type=zf;break;case U1:i.type=Mi;break;case L1:i.type=Bi;break;case M3:i.type=jf;break;case B3:i.type=Vf;break;default:throw new TypeError(`dst type unrecognized: "${e}" : must have form [crlf:|lf:]type[:base64]`)}return i},"validateDst"),R1=s(function(e,t){switch(e){case Ju:return tt.utf8.encode(t);case Mi:return tt.utf16be.encode(t);case po:return tt.utf16le.encode(t);case Bi:return tt.utf32be.encode(t);case mo:return tt.utf32le.encode(t);case qf:return tt.uint7.encode(t);case zf:return tt.uint8.encode(t);case jf:return tt.uint16be.encode(t);case Gd:return tt.uint16le.encode(t);case Vf:return tt.uint32be.encode(t);case Jd:return tt.uint32le.encode(t);case As:return tt.string.encode(t);case Yd:return tt.escaped.encode(t);default:throw new TypeError(`encode type "${e}" not recognized`)}},"encode"),zM=s(function(e){switch(e.type){case Ju:return tt.utf8.decode(e.data,e.bom);case po:return tt.utf16le.decode(e.data,e.bom);case Mi:return tt.utf16be.decode(e.data,e.bom);case Bi:return tt.utf32be.decode(e.data,e.bom);case mo:return tt.utf32le.decode(e.data,e.bom);case qf:return tt.uint7.decode(e.data);case zf:return tt.uint8.decode(e.data);case jf:return tt.uint16be.decode(e.data);case Gd:return tt.uint16le.decode(e.data);case Vf:return tt.uint32be.decode(e.data);case Jd:return tt.uint32le.decode(e.data);case As:return tt.string.decode(e.data);case Yd:return tt.escaped.decode(e.data);default:throw new TypeError(`decode type "${e.type}" not recognized`)}},"decode");Yu.decode=s(function(e,t){let n=HM(e,t);return zM(n)},"exportsDecode");Yu.encode=s(function(e,t){let n,i,o=qM(e,t);return o.crlf?(n=tt.lineEnds.crlf(t),i=R1(o.type,n)):o.lf?(n=tt.lineEnds.lf(t),i=R1(o.type,n)):i=R1(o.type,t),o.base64&&(i=tt.base64.encode(i)),i},"exportsEncode");Yu.convert=s(function(e,t,n){return C3.encode(n,C3.decode(e,t))},"convert")});var F1=de((x$,I3)=>{I3.exports=s(function(){return`/* This file automatically generated by jsonToless() and LESS. */
|
20
20
|
.apg-mono {
|
21
21
|
font-family: monospace;
|
22
22
|
}
|
@@ -230,63 +230,63 @@ table.apg-attrs a {
|
|
230
230
|
table.apg-attrs a:hover {
|
231
231
|
color: #8caae6 !important;
|
232
232
|
}
|
233
|
-
`},"emittcss")});var
|
233
|
+
`},"emittcss")});var va=de(or=>{var Yr=Wu(),K1=D1(),jM=F1(),Pt=ni(),_s="utilities.js: ",bo=or,ya=s(function(r,e,t){let n,i=e,o=!0;for(;o;){if(r<=0){i=0,n=0;break}if(typeof i!="number"){i=0,n=r;break}if(i>=r){i=r,n=r;break}if(typeof t!="number"){n=r;break}if(n=i+t,n>r){n=r;break}break}return{beg:i,end:n}},"getBounds");or.htmlToPage=function(r,e){let t;if(typeof r!="string")throw new Error(`${_s}htmlToPage: input HTML is not a string`);typeof e!="string"?t="htmlToPage":t=e;let n="";return n+=`<!DOCTYPE html>
|
234
234
|
`,n+=`<html lang="en">
|
235
235
|
`,n+=`<head>
|
236
236
|
`,n+=`<meta charset="utf-8">
|
237
237
|
`,n+=`<title>${t}</title>
|
238
238
|
`,n+=`<style>
|
239
|
-
`,n+=
|
239
|
+
`,n+=jM(),n+=`</style>
|
240
240
|
`,n+=`</head>
|
241
241
|
<body>
|
242
242
|
`,n+=`<p>${new Date}</p>
|
243
243
|
`,n+=r,n+=`</body>
|
244
244
|
</html>
|
245
|
-
`,n};
|
246
|
-
`,t&&(
|
247
|
-
`),
|
248
|
-
`,
|
249
|
-
`,
|
250
|
-
`,
|
251
|
-
`,
|
252
|
-
`,
|
253
|
-
`,
|
254
|
-
`,
|
255
|
-
`,
|
256
|
-
`,
|
257
|
-
`,
|
258
|
-
`,
|
259
|
-
`,
|
260
|
-
`,
|
261
|
-
`,
|
262
|
-
`,
|
263
|
-
`,
|
264
|
-
`,
|
265
|
-
`,
|
266
|
-
`,
|
267
|
-
`,
|
268
|
-
`,
|
269
|
-
`,
|
270
|
-
`):(
|
271
|
-
`,H-=1)}),
|
272
|
-
`,L},"toSml"),this.phrases=o(function(){let _={},U,E;for(U=0;U<v.length;U+=1)E=v[U],E.state===e.SEM_PRE&&(Array.isArray(_[E.name])||(_[E.name]=[]),_[E.name].push({index:E.phraseIndex,length:E.phraseLength}));return _},"phrases")},"exportsAst")});var C1=de((HK,ax)=>{ax.exports=o(function(){let e="circular-buffer.js: ",t=-1,n=0;this.init=o(function(s){if(typeof s!="number"||s<=0)throw new Error(`${e}init: circular buffer size must an integer > 0`);n=Math.ceil(s),t=-1},"init"),this.increment=o(function(){return t+=1,(t+n)%n},"increment"),this.maxSize=o(function(){return n},"maxSize"),this.items=o(function(){return t+1},"items"),this.getListIndex=o(function(s){return t===-1||s<0||s>t||t-s>=n?-1:(s+n)%n},"getListIndex"),this.forEach=o(function(s){if(t!==-1){if(t<n){for(let a=0;a<=t;a+=1)s(a,a);return}for(let a=t-n+1;a<=t;a+=1){let c=(a+n)%n;s(c,a)}}},"forEach")},"exportsCircularBuffer")});var fx=de((qK,cx)=>{cx.exports=o(function(){let e=Qn(),t=ha(),n="parser.js: ",i=this,s;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let a=null,c=null,f,l,h,d,v=0,x=0,y=0,_=null,U=null,E=null,L=null,H=null,F=0,j=1/0,D=1/0,B=o(function(G,T,q){let se=`${n}evaluateRule(): `;if(G>=E.length)throw new Error(`${se}rule index: ${G} out of range`);if(T>=h)throw new Error(`${se}phrase index: ${T} out of range`);let{length:ae}=a;a.push({type:e.RNM,index:G}),s(ae,T,q),a.pop()},"evaluateRule"),R=o(function(te,G,T){let q=`${n}evaluateUdt(): `;if(te>=L.length)throw new Error(`${q}udt index: ${te} out of range`);if(G>=h)throw new Error(`${q}phrase index: ${G} out of range`);let{length:se}=a;a.push({type:e.UDT,empty:L[te].empty,index:te}),s(se,G,T),a.pop()},"evaluateUdt"),Y=o(function(){v=0,x=0,y=0,F=0,d=[{lookAround:e.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],E=null,L=null,c=null,f=0,l=0,h=0,_=null,U=null,H=null,a=null},"clear"),b=o(function(){let te=[],G=o(function(){let q={};E.forEach(se=>{se.isBkr&&(q[se.lower]=null)}),L.length>0&&L.forEach(se=>{se.isBkr&&(q[se.lower]=null)}),te.push(q)},"init"),T=o(function(){let q=te[te.length-1],se={};for(let ae in q)se[ae]=q[ae];return se},"copy");this.push=o(function(){te.push(T())},"push"),this.pop=o(function(se){let ae=se;if(ae||(ae=te.length-1),ae<1||ae>te.length)throw new Error(`${n}backRef.pop(): bad length: ${ae}`);return te.length=ae,te[te.length-1]},"pop"),this.length=o(function(){return te.length},"length"),this.savePhrase=o(function(se,ae,he){te[te.length-1][se]={phraseIndex:ae,phraseLength:he}},"savePhrase"),this.getPhrase=function(q){return te[te.length-1][q]},G()},"backRef"),u=o(function(){let G=this;this.state=e.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=d[d.length-1],this.uFrame=new b,this.pFrame=new b,this.evaluateRule=B,this.evaluateUdt=R,this.refresh=o(function(){G.state=e.ACTIVE,G.phraseLength=0,G.lookAround=d[d.length-1]},"refresh")},"systemData"),p=o(function(){return d[d.length-1]},"lookAroundValue"),m=o(function(){return d.length>1},"inLookAround"),w=o(function(){return d[d.length-1].lookAround===e.LOOKAROUND_BEHIND},"inLookBehind"),S=o(function(){let te=`${n}initializeAst(): `,G=!0;for(;G;){if(i.ast===void 0){i.ast=null;break}if(i.ast===null)break;if(i.ast.astObject!=="astObject")throw new Error(`${te}ast object not recognized`);break}i.ast!==null&&i.ast.init(E,L,c)},"initializeAst"),I=o(function(){let te=`${n}initializeTrace(): `,G=!0;for(;G;){if(i.trace===void 0){i.trace=null;break}if(i.trace===null)break;if(i.trace.traceObject!=="traceObject")throw new Error(`${te}trace object not recognized`);break}i.trace!==null&&i.trace.init(E,L,c)},"initializeTrace"),N=o(function(){let te=`${n}initializeStats(): `,G=!0;for(;G;){if(i.stats===void 0){i.stats=null;break}if(i.stats===null)break;if(i.stats.statsObject!=="statsObject")throw new Error(`${te}stats object not recognized`);break}i.stats!==null&&i.stats.init(E,L)},"initializeStats"),k=o(function(te){let G=`${n}initializeGrammar(): `;if(!te)throw new Error(`${G}grammar object undefined`);if(te.grammarObject!=="grammarObject")throw new Error(`${G}bad grammar object`);E=te.rules,L=te.udts},"initializeGrammar"),g=o(function(te){let G=`${n}initializeStartRule(): `,T=null;if(typeof te=="number"){if(te>=E.length)throw new Error(`${G}start rule index too large: max: ${E.length}: index: ${te}`);T=te}else if(typeof te=="string"){let q=te.toLowerCase();for(let se=0;se<E.length;se+=1)if(q===E[se].lower){T=E[se].index;break}if(T===null)throw new Error(`${G}start rule name '${te}' not recognized`)}else throw new Error(`${G}type of start rule '${typeof te}' not recognized`);return T},"initializeStartRule"),C=o(function(G,T,q){let se=`${n}initializeInputChars(): `,ae=G,he=T,ge=q;if(ae===void 0)throw new Error(`${se}input string is undefined`);if(ae===null)throw new Error(`${se}input string is null`);if(typeof ae=="string")ae=t.stringToChars(ae);else if(!Array.isArray(ae))throw new Error(`${se}input string is not a string or array`);if(ae.length>0&&typeof ae[0]!="number")throw new Error(`${se}input string not an array of integers`);if(typeof he!="number")he=0;else if(he=Math.floor(he),he<0||he>ae.length)throw new Error(`${se}input beginning index out of range: ${he}`);if(typeof ge!="number")ge=ae.length-he;else if(ge=Math.floor(ge),ge<0||ge>ae.length-he)throw new Error(`${se}input length out of range: ${ge}`);c=ae,f=he,l=ge,h=f+l},"initializeInputChars"),Z=o(function(){let te=`${n}initializeCallbacks(): `,G;for(_=[],U=[],G=0;G<E.length;G+=1)_[G]=null;for(G=0;G<L.length;G+=1)U[G]=null;let T,q=[];for(G=0;G<E.length;G+=1)q.push(E[G].lower);for(G=0;G<L.length;G+=1)q.push(L[G].lower);for(let se in i.callbacks){if(G=q.indexOf(se.toLowerCase()),G<0)throw new Error(`${te}syntax callback '${se}' not a rule or udt name`);if(T=i.callbacks[se],T||(T=null),typeof T=="function"||T===null)G<E.length?_[G]=T:U[G-E.length]=T;else throw new Error(`${te}syntax callback[${se}] must be function reference or 'false' (false/null/undefined/etc.)`)}for(G=0;G<L.length;G+=1)if(U[G]===null)throw new Error(`${te}all UDT callbacks must be defined. UDT callback[${L[G].lower}] not a function reference`)},"initializeCallbacks");this.setMaxTreeDepth=function(te){if(typeof te!="number")throw new Error(`parser: max tree depth must be integer > 0: ${te}`);if(j=Math.floor(te),j<=0)throw new Error(`parser: max tree depth must be integer > 0: ${te}`)},this.setMaxNodeHits=function(te){if(typeof te!="number")throw new Error(`parser: max node hits must be integer > 0: ${te}`);if(D=Math.floor(te),D<=0)throw new Error(`parser: max node hits must be integer > 0: ${te}`)};let V=o(function(te,G,T){let q,se=`${n}parse(): `;k(te);let ae=g(G);Z(),I(),N(),S();let he=new u;switch(T!=null&&(H=T),a=[{type:e.RNM,index:ae}],s(0,f,he),a=null,he.state){case e.ACTIVE:throw new Error(`${se}final state should never be 'ACTIVE'`);case e.NOMATCH:q=!1;break;case e.EMPTY:case e.MATCH:he.phraseLength===l?q=!0:q=!1;break;default:throw new Error("unrecognized state")}return{success:q,state:he.state,length:l,matched:he.phraseLength,maxMatched:F,maxTreeDepth:x,nodeHits:y,inputLength:c.length,subBegin:f,subEnd:h,subLength:l}},"privateParse");this.parseSubstring=o(function(G,T,q,se,ae,he){return Y(),C(q,se,ae),V(G,T,he)},"parseSubstring"),this.parse=o(function(G,T,q,se){return Y(),C(q,0,q.length),V(G,T,se)},"parse");let K=o(function(te,G,T){let q=a[te];for(let se=0;se<q.children.length&&(s(q.children[se],G,T),T.state===e.NOMATCH);se+=1);},"opALT"),fe=o(function(te,G,T){let q,se,ae,he,ge=a[te],rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(se=i.ast.getLength()),q=!0,ae=G,he=0;for(let Ee=0;Ee<ge.children.length;Ee+=1)if(s(ge.children[Ee],ae,T),T.state===e.NOMATCH){q=!1;break}else ae+=T.phraseLength,he+=T.phraseLength;q?(T.state=he===0?e.EMPTY:e.MATCH,T.phraseLength=he):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(se))},"opCAT"),A=o(function(te,G,T){let q,se,ae,he,ge=a[te];se=G,ae=0,he=0;let rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(se>=h||(s(te+1,se,T),T.state===e.NOMATCH)||T.state===e.EMPTY||(he+=1,ae+=T.phraseLength,se+=T.phraseLength,he===ge.max)););T.state===e.EMPTY||he>=ge.min?(T.state=ae===0?e.EMPTY:e.MATCH,T.phraseLength=ae):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREP"),X=o(function(te,G,T,q){if(G.phraseLength>T){let se=`${n}opRNM(${te.name}): callback function error: `;throw se+=`sysData.phraseLength: ${G.phraseLength}`,se+=` must be <= remaining chars: ${T}`,new Error(se)}switch(G.state){case e.ACTIVE:if(q!==!0)throw new Error(`${n}opRNM(${te.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:G.phraseLength=0;break;case e.MATCH:G.phraseLength===0&&(G.state=e.EMPTY);break;case e.NOMATCH:G.phraseLength=0;break;default:throw new Error(`${n}opRNM(${te.name}): callback function return error. Unrecognized return state: ${G.state}`)}},"validateRnmCallbackResult"),Q=o(function(te,G,T){let q,se,ae,he,ge,rt,Pe=a[te],Ee=E[Pe.index],nt=_[Ee.index],Ge=!m();if(Ge&&(se=i.ast&&i.ast.ruleDefined(Pe.index),se&&(q=i.ast.getLength(),i.ast.down(Pe.index,E[Pe.index].name)),he=T.uFrame.length(),ge=T.pFrame.length(),T.uFrame.push(),T.pFrame.push(),rt=T.pFrame,T.pFrame=new b),nt===null)ae=a,a=Ee.opcodes,s(0,G,T),a=ae;else{let it=h-G;T.ruleIndex=Ee.index,nt(T,c,G,H),X(Ee,T,it,!0),T.state===e.ACTIVE&&(ae=a,a=Ee.opcodes,s(0,G,T),a=ae,T.ruleIndex=Ee.index,nt(T,c,G,H),X(Ee,T,it,!1))}Ge&&(se&&(T.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(Pe.index,Ee.name,G,T.phraseLength)),T.pFrame=rt,T.state===e.NOMATCH?(T.uFrame.pop(he),T.pFrame.pop(ge)):Ee.isBkr&&(T.pFrame.savePhrase(Ee.lower,G,T.phraseLength),T.uFrame.savePhrase(Ee.lower,G,T.phraseLength)))},"opRNM"),P=o(function(te,G,T){if(G.phraseLength>T){let q=`${n}opUDT(${te.name}): callback function error: `;throw q+=`sysData.phraseLength: ${G.phraseLength}`,q+=` must be <= remaining chars: ${T}`,new Error(q)}switch(G.state){case e.ACTIVE:throw new Error(`${n}opUDT(${te.name}): callback function return error. ACTIVE state not allowed.`);case e.EMPTY:if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);G.phraseLength=0;break;case e.MATCH:if(G.phraseLength===0){if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);G.state=e.EMPTY}break;case e.NOMATCH:G.phraseLength=0;break;default:throw new Error(`${n}opUDT(${te.name}): callback function return error. Unrecognized return state: ${G.state}`)}},"validateUdtCallbackResult"),O=o(function(te,G,T){let q,se,ae,he,ge,rt,Pe=a[te],Ee=L[Pe.index];T.UdtIndex=Ee.index;let nt=!m();nt&&(ae=i.ast&&i.ast.udtDefined(Pe.index),ae&&(se=E.length+Pe.index,q=i.ast.getLength(),i.ast.down(se,Ee.name)),he=T.uFrame.length(),ge=T.pFrame.length(),T.uFrame.push(),T.pFrame.push(),rt=T.pFrame,T.pFrame=new b);let Ge=h-G;U[Pe.index](T,c,G,H),P(Ee,T,Ge),nt&&(ae&&(T.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(se,Ee.name,G,T.phraseLength)),T.pFrame=rt,T.state===e.NOMATCH?(T.uFrame.pop(he),T.pFrame.pop(ge)):Ee.isBkr&&(T.pFrame.savePhrase(Ee.lower,G,T.phraseLength),T.uFrame.savePhrase(Ee.lower,G,T.phraseLength)))},"opUDT"),z=o(function(te,G,T){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:G,charsEnd:h,charsLength:l}),h=c.length,l=c.length-f,s(te+1,G,T);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,T.phraseLength=0,T.state){case e.EMPTY:T.state=e.EMPTY;break;case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${T.state}`)}},"opAND"),W=o(function(te,G,T){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:G,charsEnd:h,charsLength:l}),h=c.length,l=c.length-f,s(te+1,G,T);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${T.state}`)}},"opNOT"),re=o(function(te,G,T){let q=a[te];T.state=e.NOMATCH,G<h&&q.min<=c[G]&&c[G]<=q.max&&(T.state=e.MATCH,T.phraseLength=1)},"opTRG"),le=o(function(te,G,T){let q,se=a[te],ae=se.string.length;if(T.state=e.NOMATCH,G+ae<=h){for(q=0;q<ae;q+=1)if(c[G+q]!==se.string[q])return;T.state=e.MATCH,T.phraseLength=ae}},"opTBS"),oe=o(function(te,G,T){let q,se,ae=a[te];T.state=e.NOMATCH;let he=ae.string.length;if(he===0){T.state=e.EMPTY;return}if(G+he<=h){for(q=0;q<he;q+=1)if(se=c[G+q],se>=65&&se<=90&&(se+=32),se!==ae.string[q])return;T.state=e.MATCH,T.phraseLength=he}},"opTLS"),J=o(function(te,G,T){T.state=e.NOMATCH,T.phraseLength=0,T.state=G===0?e.EMPTY:e.NOMATCH},"opABG"),pe=o(function(te,G,T){T.state=e.NOMATCH,T.phraseLength=0,T.state=G===c.length?e.EMPTY:e.NOMATCH},"opAEN"),ee=o(function(te,G,T){let q,se,ae,he,ge=a[te];T.state=e.NOMATCH,ge.index<E.length?he=E[ge.index].lower:he=L[ge.index-E.length].lower;let rt=ge.bkrMode===e.BKR_MODE_PM?T.pFrame.getPhrase(he):T.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(rt===null)return;let Ee=rt.phraseIndex,nt=rt.phraseLength;if(nt===0){T.state=e.EMPTY;return}if(G+nt<=h){if(Pe){for(q=0;q<nt;q+=1)if(se=c[G+q],ae=c[Ee+q],se>=65&&se<=90&&(se+=32),ae>=65&&ae<=90&&(ae+=32),se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}else for(q=0;q<nt;q+=1)if(se=c[G+q],ae=c[Ee+q],se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}},"opBKR"),ce=o(function(te,G,T){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:G}),s(te+1,G,T),d.pop(),T.phraseLength=0,T.state){case e.EMPTY:T.state=e.EMPTY;break;case e.MATCH:T.state=e.EMPTY;break;case e.NOMATCH:T.state=e.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${T.state}`)}},"opBKA"),$=o(function(te,G,T){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:G}),s(te+1,G,T),d.pop(),T.phraseLength=0,T.state){case e.EMPTY:case e.MATCH:T.state=e.NOMATCH;break;case e.NOMATCH:T.state=e.EMPTY;break;default:throw new Error(`opBKN: invalid state ${T.state}`)}},"opBKN"),ie=o(function(te,G,T){let q,se,ae,he,ge=a[te],rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(se=i.ast.getLength()),q=!0,ae=G,he=0;for(let Ee=ge.children.length-1;Ee>=0;Ee-=1)if(s(ge.children[Ee],ae,T),ae-=T.phraseLength,he+=T.phraseLength,T.state===e.NOMATCH){q=!1;break}q?(T.state=he===0?e.EMPTY:e.MATCH,T.phraseLength=he):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(se))},"opCATBehind"),me=o(function(te,G,T){let q,se,ae,he,ge=a[te];se=G,ae=0,he=0;let rt=T.uFrame.length(),Pe=T.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(se<=0||(s(te+1,se,T),T.state===e.NOMATCH)||T.state===e.EMPTY||(he+=1,ae+=T.phraseLength,se-=T.phraseLength,he===ge.max)););T.state===e.EMPTY||he>=ge.min?(T.state=ae===0?e.EMPTY:e.MATCH,T.phraseLength=ae):(T.state=e.NOMATCH,T.phraseLength=0,T.uFrame.pop(rt),T.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREPBehind"),ke=o(function(te,G,T){let q=a[te];if(T.state=e.NOMATCH,T.phraseLength=0,G>0){let se=c[G-1];q.min<=se&&se<=q.max&&(T.state=e.MATCH,T.phraseLength=1)}},"opTRGBehind"),Ne=o(function(te,G,T){let q,se=a[te];T.state=e.NOMATCH;let ae=se.string.length,he=G-ae;if(he>=0){for(q=0;q<ae;q+=1)if(c[he+q]!==se.string[q])return;T.state=e.MATCH,T.phraseLength=ae}},"opTBSBehind"),Xe=o(function(te,G,T){let q,se=a[te];T.state=e.NOMATCH;let ae=se.string.length;if(ae===0){T.state=e.EMPTY;return}let he=G-ae;if(he>=0){for(let ge=0;ge<ae;ge+=1)if(q=c[he+ge],q>=65&&q<=90&&(q+=32),q!==se.string[ge])return;T.state=e.MATCH,T.phraseLength=ae}},"opTLSBehind"),dn=o(function(te,G,T){let q,se,ae,he,ge=a[te];T.state=e.NOMATCH,T.phraseLength=0,ge.index<E.length?he=E[ge.index].lower:he=L[ge.index-E.length].lower;let rt=ge.bkrMode===e.BKR_MODE_PM?T.pFrame.getPhrase(he):T.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(rt===null)return;let Ee=rt.phraseIndex,nt=rt.phraseLength;if(nt===0){T.state=e.EMPTY,T.phraseLength=0;return}let Ge=G-nt;if(Ge>=0){if(Pe){for(q=0;q<nt;q+=1)if(se=c[Ge+q],ae=c[Ee+q],se>=65&&se<=90&&(se+=32),ae>=65&&ae<=90&&(ae+=32),se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}else for(q=0;q<nt;q+=1)if(se=c[Ge+q],ae=c[Ee+q],se!==ae)return;T.state=e.MATCH,T.phraseLength=nt}},"opBKRBehind");s=o(function(G,T,q){let se=!0,ae=a[G];if(y+=1,y>D)throw new Error(`parser: maximum number of node hits exceeded: ${D}`);if(v+=1,v>x&&(x=v,x>j))throw new Error(`parser: maximum parse tree depth exceeded: ${j}`);if(q.refresh(),i.trace!==null){let he=p();i.trace.down(ae,q.state,T,q.phraseLength,he.anchor,he.lookAround)}if(w())switch(ae.type){case e.ALT:K(G,T,q);break;case e.CAT:ie(G,T,q);break;case e.REP:me(G,T,q);break;case e.RNM:Q(G,T,q);break;case e.UDT:O(G,T,q);break;case e.AND:z(G,T,q);break;case e.NOT:W(G,T,q);break;case e.TRG:ke(G,T,q);break;case e.TBS:Ne(G,T,q);break;case e.TLS:Xe(G,T,q);break;case e.BKR:dn(G,T,q);break;case e.BKA:ce(G,T,q);break;case e.BKN:$(G,T,q);break;case e.ABG:J(G,T,q);break;case e.AEN:pe(G,T,q);break;default:se=!1;break}else switch(ae.type){case e.ALT:K(G,T,q);break;case e.CAT:fe(G,T,q);break;case e.REP:A(G,T,q);break;case e.RNM:Q(G,T,q);break;case e.UDT:O(G,T,q);break;case e.AND:z(G,T,q);break;case e.NOT:W(G,T,q);break;case e.TRG:re(G,T,q);break;case e.TBS:le(G,T,q);break;case e.TLS:oe(G,T,q);break;case e.BKR:ee(G,T,q);break;case e.BKA:ce(G,T,q);break;case e.BKN:$(G,T,q);break;case e.ABG:J(G,T,q);break;case e.AEN:pe(G,T,q);break;default:se=!1;break}if(!m()&&T+q.phraseLength>F&&(F=T+q.phraseLength),i.stats!==null&&i.stats.collect(ae,q),i.trace!==null){let he=p();i.trace.up(ae,q.state,T,q.phraseLength,he.anchor,he.lookAround)}return v-=1,se},"opExecuteFunc")},"parser")});var lx=de((zK,ux)=>{ux.exports=o(function(){let e=Qn(),t=ha(),n=Uu(),i="stats.js: ",s=[],a=[],c=[],f,l=[],h=[];this.statsObject="statsObject";let d="stats",v=o(function(D,B){return D.lower<B.lower?-1:D.lower>B.lower?1:0},"sortAlpha"),x=o(function(D,B){return D.total<B.total?1:D.total>B.total?-1:v(D,B)},"sortHits"),y=o(function(D,B){return D.index<B.index?-1:D.index>B.index?1:0},"sortIndex"),_=o(function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},"EmptyStat"),U=o(function(){c.length=0,f=new _,c[e.ALT]=new _,c[e.CAT]=new _,c[e.REP]=new _,c[e.RNM]=new _,c[e.TRG]=new _,c[e.TBS]=new _,c[e.TLS]=new _,c[e.UDT]=new _,c[e.AND]=new _,c[e.NOT]=new _,c[e.BKR]=new _,c[e.BKA]=new _,c[e.BKN]=new _,c[e.ABG]=new _,c[e.AEN]=new _,l.length=0;for(let D=0;D<s.length;D+=1)l.push({empty:0,match:0,nomatch:0,total:0,name:s[D].name,lower:s[D].lower,index:s[D].index});if(a.length>0){h.length=0;for(let D=0;D<a.length;D+=1)h.push({empty:0,match:0,nomatch:0,total:0,name:a[D].name,lower:a[D].lower,index:a[D].index})}},"clear"),E=o(function(D,B){switch(D.total+=1,B){case e.EMPTY:D.empty+=1;break;case e.MATCH:D.match+=1;break;case e.NOMATCH:D.nomatch+=1;break;default:throw new Error(`${i}collect(): incStat(): unrecognized state: ${B}`)}},"incStat"),L=o(function(D,B){let R="";return R+="<tr>",R+=`<td class="${n.CLASS_ACTIVE}">${D}</td>`,R+=`<td class="${n.CLASS_EMPTY}">${B.empty}</td>`,R+=`<td class="${n.CLASS_MATCH}">${B.match}</td>`,R+=`<td class="${n.CLASS_NOMATCH}">${B.nomatch}</td>`,R+=`<td class="${n.CLASS_ACTIVE}">${B.total}</td>`,R+=`</tr>
|
273
|
-
`,
|
245
|
+
`,n};or.parserResultToHtml=function(r,e){let t=null;typeof e=="string"&&e!==""&&(t=e);let n,i;r.success===!0?n=`<span class="${Yr.CLASS_MATCH}">true</span>`:n=`<span class="${Yr.CLASS_NOMATCH}">false</span>`,r.state===Pt.EMPTY?i=`<span class="${Yr.CLASS_EMPTY}">EMPTY</span>`:r.state===Pt.MATCH?i=`<span class="${Yr.CLASS_MATCH}">MATCH</span>`:r.state===Pt.NOMATCH?i=`<span class="${Yr.CLASS_NOMATCH}">NOMATCH</span>`:i=`<span class="${Yr.CLASS_NOMATCH}">unrecognized</span>`;let o="";return o+=`<table class="${Yr.CLASS_STATE}">
|
246
|
+
`,t&&(o+=`<caption>${t}</caption>
|
247
|
+
`),o+=`<tr><th>state item</th><th>value</th><th>description</th></tr>
|
248
|
+
`,o+=`<tr><td>parser success</td><td>${n}</td>
|
249
|
+
`,o+=`<td><span class="${Yr.CLASS_MATCH}">true</span> if the parse succeeded,
|
250
|
+
`,o+=` <span class="${Yr.CLASS_NOMATCH}">false</span> otherwise`,o+=`<br><i>NOTE: for success, entire string must be matched</i></td></tr>
|
251
|
+
`,o+=`<tr><td>parser state</td><td>${i}</td>
|
252
|
+
`,o+=`<td><span class="${Yr.CLASS_EMPTY}">EMPTY</span>, `,o+=`<span class="${Yr.CLASS_MATCH}">MATCH</span> or
|
253
|
+
`,o+=`<span class="${Yr.CLASS_NOMATCH}">NOMATCH</span></td></tr>
|
254
|
+
`,o+=`<tr><td>string length</td><td>${r.length}</td><td>length of the input (sub)string</td></tr>
|
255
|
+
`,o+=`<tr><td>matched length</td><td>${r.matched}</td><td>number of input string characters matched</td></tr>
|
256
|
+
`,o+=`<tr><td>max matched</td><td>${r.maxMatched}</td><td>maximum number of input string characters matched</td></tr>
|
257
|
+
`,o+=`<tr><td>max tree depth</td><td>${r.maxTreeDepth}</td><td>maximum depth of the parse tree reached</td></tr>
|
258
|
+
`,o+=`<tr><td>node hits</td><td>${r.nodeHits}</td><td>number of parse tree node hits (opcode function calls)</td></tr>
|
259
|
+
`,o+=`<tr><td>input length</td><td>${r.inputLength}</td><td>length of full input string</td></tr>
|
260
|
+
`,o+=`<tr><td>sub-string begin</td><td>${r.subBegin}</td><td>sub-string first character index</td></tr>
|
261
|
+
`,o+=`<tr><td>sub-string end</td><td>${r.subEnd}</td><td>sub-string end-of-string index</td></tr>
|
262
|
+
`,o+=`<tr><td>sub-string length</td><td>${r.subLength}</td><td>sub-string length</td></tr>
|
263
|
+
`,o+=`</table>
|
264
|
+
`,o};or.charsToString=function(r,e,t){let n,i;if(typeof e=="number"){if(e>=r.length)return"";n=e<0?0:e}else n=0;if(typeof t=="number"){if(t<=0)return"";i=t>r.length-n?r.length:n+t}else i=r.length;return n<i?K1.encode("UTF16LE",r.slice(n,i)).toString("utf16le"):""};or.stringToChars=function(r){return K1.decode("STRING",r)};or.opcodeToString=function(r){let e="unknown";switch(r){case Pt.ALT:e="ALT";break;case Pt.CAT:e="CAT";break;case Pt.RNM:e="RNM";break;case Pt.UDT:e="UDT";break;case Pt.AND:e="AND";break;case Pt.NOT:e="NOT";break;case Pt.REP:e="REP";break;case Pt.TRG:e="TRG";break;case Pt.TBS:e="TBS";break;case Pt.TLS:e="TLS";break;case Pt.BKR:e="BKR";break;case Pt.BKA:e="BKA";break;case Pt.BKN:e="BKN";break;case Pt.ABG:e="ABG";break;case Pt.AEN:e="AEN";break;default:throw new Error("unrecognized opcode")}return e};or.stateToString=function(r){let e="unknown";switch(r){case Pt.ACTIVE:e="ACTIVE";break;case Pt.MATCH:e="MATCH";break;case Pt.EMPTY:e="EMPTY";break;case Pt.NOMATCH:e="NOMATCH";break;default:throw new Error("unrecognized state")}return e};or.asciiChars=["NUL","SOH","STX","ETX","EOT","ENQ","ACK","BEL","BS","TAB","LF","VT","FF","CR","SO","SI","DLE","DC1","DC2","DC3","DC4","NAK","SYN","ETB","CAN","EM","SUB","ESC","FS","GS","RS","US"," ","!",""","#","$","%","&","'","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","\","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","DEL"];or.charToHex=function(r){let e=r.toString(16).toUpperCase();switch(e.length){case 1:case 3:case 7:e=`0${e}`;break;case 2:case 6:e=`00${e}`;break;case 4:break;case 5:e=`000${e}`;break;default:throw new Error("unrecognized option")}return e};or.charsToDec=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToDec: input must be an array of integers`);let i=ya(r.length,e,t);if(i.end>i.beg){n+=r[i.beg];for(let o=i.beg+1;o<i.end;o+=1)n+=`,${r[o]}`}return n};or.charsToHex=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToHex: input must be an array of integers`);let i=ya(r.length,e,t);if(i.end>i.beg){n+=`\\x${bo.charToHex(r[i.beg])}`;for(let o=i.beg+1;o<i.end;o+=1)n+=`,\\x${bo.charToHex(r[o])}`}return n};or.charsToHtmlEntities=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToHex: input must be an array of integers`);let i=ya(r.length,e,t);if(i.end>i.beg)for(let o=i.beg;o<i.end;o+=1)n+=`&#x${r[o].toString(16)};`;return n};function VM(r){return!(r>=55296&&r<=57343||r>1114111)}s(VM,"isUnicode");or.charsToUnicode=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToUnicode: input must be an array of integers`);let i=ya(r.length,e,t);if(i.end>i.beg)for(let o=i.beg;o<i.end;o+=1)VM(r[o])?n+=`&#${r[o]};`:n+=` U+${bo.charToHex(r[o])}`;return n};or.charsToJsUnicode=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToJsUnicode: input must be an array of integers`);let i=ya(r.length,e,t);if(i.end>i.beg){n+=`\\u${bo.charToHex(r[i.beg])}`;for(let o=i.beg+1;o<i.end;o+=1)n+=`,\\u${bo.charToHex(r[o])}`}return n};or.charsToAscii=function(r,e,t){let n="";if(!Array.isArray(r))throw new Error(`${_s}charsToAscii: input must be an array of integers`);let i=ya(r.length,e,t);for(let o=i.beg;o<i.end;o+=1){let a=r[o];a>=32&&a<=126?n+=String.fromCharCode(a):n+=`\\x${bo.charToHex(a)}`}return n};or.charsToAsciiHtml=function(r,e,t){if(!Array.isArray(r))throw new Error(`${_s}charsToAsciiHtml: input must be an array of integers`);let n="",i,o=ya(r.length,e,t);for(let a=o.beg;a<o.end;a+=1)i=r[a],i<32||i===127?n+=`<span class="${Yr.CLASS_CTRLCHAR}">${bo.asciiChars[i]}</span>`:i>127?n+=`<span class="${Yr.CLASS_CTRLCHAR}">U+${bo.charToHex(i)}</span>`:n+=bo.asciiChars[i];return n};or.stringToAsciiHtml=function(r){let e=K1.decode("STRING",r);return this.charsToAsciiHtml(e)}});var O3=de((_$,N3)=>{N3.exports=s(function(){let e=ni(),t=va(),n="ast.js: ",i=this,o=null,a=null,f=null,c=0,l=[],h=[],d=[],y=[];this.callbacks=[],this.astObject="astObject",this.init=s(function(x,L,_){d.length=0,y.length=0,l.length=0,c=0,o=x,a=L,f=_;let R,H=[];for(R=0;R<o.length;R+=1)H.push(o[R].lower);for(R=0;R<a.length;R+=1)H.push(a[R].lower);for(c=o.length+a.length,R=0;R<c;R+=1)l[R]=!1,h[R]=null;for(let $ in i.callbacks){let j=$.toLowerCase();if(R=H.indexOf(j),R<0)throw new Error(`${n}init: node '${$}' not a rule or udt name`);typeof i.callbacks[$]=="function"&&(l[R]=!0,h[R]=i.callbacks[$]),i.callbacks[$]===!0&&(l[R]=!0)}},"init"),this.ruleDefined=s(function(x){return l[x]!==!1},"ruleDefined"),this.udtDefined=s(function(x){return l[o.length+x]!==!1},"udtDefined"),this.down=s(function(x,L){let _=y.length;return d.push(_),y.push({name:L,thisIndex:_,thatIndex:null,state:e.SEM_PRE,callbackIndex:x,phraseIndex:null,phraseLength:null,stack:d.length}),_},"down"),this.up=s(function(x,L,_,R){let H=y.length,$=d.pop();return y.push({name:L,thisIndex:H,thatIndex:$,state:e.SEM_POST,callbackIndex:x,phraseIndex:_,phraseLength:R,stack:d.length}),y[$].thatIndex=H,y[$].phraseIndex=_,y[$].phraseLength=R,H},"up"),this.translate=s(function(x){let L,_,R;for(let H=0;H<y.length;H+=1)R=y[H],_=h[R.callbackIndex],R.state===e.SEM_PRE?_!==null&&(L=_(e.SEM_PRE,f,R.phraseIndex,R.phraseLength,x),L===e.SEM_SKIP&&(H=R.thatIndex)):_!==null&&_(e.SEM_POST,f,R.phraseIndex,R.phraseLength,x)},"translate"),this.setLength=s(function(x){y.length=x,x>0?d.length=y[x-1].stack:d.length=0},"setLength"),this.getLength=s(function(){return y.length},"getLength");function A(v){let x="";for(let L=0;L<v;L+=1)x+=" ";return x}s(A,"indent"),this.toXml=s(function(x){let L=t.charsToDec,_="decimal integer character codes";if(typeof mode=="string"&&x.length>=3){let $=x.slice(0,3).toLowerCase();$==="asc"?(L=t.charsToAscii,_="ASCII for printing characters, hex for non-printing"):$==="hex"?(L=t.charsToHex,_="hexidecimal integer character codes"):$==="uni"&&(L=t.charsToUnicode,_="Unicode UTF-32 integer character codes")}let R="",H=0;return R+=`<?xml version="1.0" encoding="utf-8"?>
|
265
|
+
`,R+=`<root nodes="${y.length/2}" characters="${f.length}">
|
266
|
+
`,R+=`<!-- input string, ${_} -->
|
267
|
+
`,R+=A(H+2),R+=L(f),R+=`
|
268
|
+
`,y.forEach($=>{$.state===e.SEM_PRE?(H+=1,R+=A(H),R+=`<node name="${$.name}" index="${$.phraseIndex}" length="${$.phraseLength}">
|
269
|
+
`,R+=A(H+2),R+=L(f,$.phraseIndex,$.phraseLength),R+=`
|
270
|
+
`):(R+=A(H),R+=`</node><!-- name="${$.name}" -->
|
271
|
+
`,H-=1)}),R+=`</root>
|
272
|
+
`,R},"toSml"),this.phrases=s(function(){let x={},L,_;for(L=0;L<y.length;L+=1)_=y[L],_.state===e.SEM_PRE&&(Array.isArray(x[_.name])||(x[_.name]=[]),x[_.name].push({index:_.phraseIndex,length:_.phraseLength}));return x},"phrases")},"exportsAst")});var $1=de((E$,P3)=>{P3.exports=s(function(){let e="circular-buffer.js: ",t=-1,n=0;this.init=s(function(o){if(typeof o!="number"||o<=0)throw new Error(`${e}init: circular buffer size must an integer > 0`);n=Math.ceil(o),t=-1},"init"),this.increment=s(function(){return t+=1,(t+n)%n},"increment"),this.maxSize=s(function(){return n},"maxSize"),this.items=s(function(){return t+1},"items"),this.getListIndex=s(function(o){return t===-1||o<0||o>t||t-o>=n?-1:(o+n)%n},"getListIndex"),this.forEach=s(function(o){if(t!==-1){if(t<n){for(let a=0;a<=t;a+=1)o(a,a);return}for(let a=t-n+1;a<=t;a+=1){let f=(a+n)%n;o(f,a)}}},"forEach")},"exportsCircularBuffer")});var U3=de((S$,R3)=>{R3.exports=s(function(){let e=ni(),t=va(),n="parser.js: ",i=this,o;this.ast=null,this.stats=null,this.trace=null,this.callbacks=[];let a=null,f=null,c,l,h,d,y=0,A=0,v=0,x=null,L=null,_=null,R=null,H=null,$=0,j=1/0,D=1/0,B=s(function(W,k,q){let oe=`${n}evaluateRule(): `;if(W>=_.length)throw new Error(`${oe}rule index: ${W} out of range`);if(k>=h)throw new Error(`${oe}phrase index: ${k} out of range`);let{length:ae}=a;a.push({type:e.RNM,index:W}),o(ae,k,q),a.pop()},"evaluateRule"),U=s(function(te,W,k){let q=`${n}evaluateUdt(): `;if(te>=R.length)throw new Error(`${q}udt index: ${te} out of range`);if(W>=h)throw new Error(`${q}phrase index: ${W} out of range`);let{length:oe}=a;a.push({type:e.UDT,empty:R[te].empty,index:te}),o(oe,W,k),a.pop()},"evaluateUdt"),Y=s(function(){y=0,A=0,v=0,$=0,d=[{lookAround:e.LOOKAROUND_NONE,anchor:0,charsEnd:0,charsLength:0}],_=null,R=null,f=null,c=0,l=0,h=0,x=null,L=null,H=null,a=null},"clear"),b=s(function(){let te=[],W=s(function(){let q={};_.forEach(oe=>{oe.isBkr&&(q[oe.lower]=null)}),R.length>0&&R.forEach(oe=>{oe.isBkr&&(q[oe.lower]=null)}),te.push(q)},"init"),k=s(function(){let q=te[te.length-1],oe={};for(let ae in q)oe[ae]=q[ae];return oe},"copy");this.push=s(function(){te.push(k())},"push"),this.pop=s(function(oe){let ae=oe;if(ae||(ae=te.length-1),ae<1||ae>te.length)throw new Error(`${n}backRef.pop(): bad length: ${ae}`);return te.length=ae,te[te.length-1]},"pop"),this.length=s(function(){return te.length},"length"),this.savePhrase=s(function(oe,ae,he){te[te.length-1][oe]={phraseIndex:ae,phraseLength:he}},"savePhrase"),this.getPhrase=function(q){return te[te.length-1][q]},W()},"backRef"),u=s(function(){let W=this;this.state=e.ACTIVE,this.phraseLength=0,this.ruleIndex=0,this.udtIndex=0,this.lookAround=d[d.length-1],this.uFrame=new b,this.pFrame=new b,this.evaluateRule=B,this.evaluateUdt=U,this.refresh=s(function(){W.state=e.ACTIVE,W.phraseLength=0,W.lookAround=d[d.length-1]},"refresh")},"systemData"),p=s(function(){return d[d.length-1]},"lookAroundValue"),m=s(function(){return d.length>1},"inLookAround"),w=s(function(){return d[d.length-1].lookAround===e.LOOKAROUND_BEHIND},"inLookBehind"),S=s(function(){let te=`${n}initializeAst(): `,W=!0;for(;W;){if(i.ast===void 0){i.ast=null;break}if(i.ast===null)break;if(i.ast.astObject!=="astObject")throw new Error(`${te}ast object not recognized`);break}i.ast!==null&&i.ast.init(_,R,f)},"initializeAst"),N=s(function(){let te=`${n}initializeTrace(): `,W=!0;for(;W;){if(i.trace===void 0){i.trace=null;break}if(i.trace===null)break;if(i.trace.traceObject!=="traceObject")throw new Error(`${te}trace object not recognized`);break}i.trace!==null&&i.trace.init(_,R,f)},"initializeTrace"),I=s(function(){let te=`${n}initializeStats(): `,W=!0;for(;W;){if(i.stats===void 0){i.stats=null;break}if(i.stats===null)break;if(i.stats.statsObject!=="statsObject")throw new Error(`${te}stats object not recognized`);break}i.stats!==null&&i.stats.init(_,R)},"initializeStats"),T=s(function(te){let W=`${n}initializeGrammar(): `;if(!te)throw new Error(`${W}grammar object undefined`);if(te.grammarObject!=="grammarObject")throw new Error(`${W}bad grammar object`);_=te.rules,R=te.udts},"initializeGrammar"),g=s(function(te){let W=`${n}initializeStartRule(): `,k=null;if(typeof te=="number"){if(te>=_.length)throw new Error(`${W}start rule index too large: max: ${_.length}: index: ${te}`);k=te}else if(typeof te=="string"){let q=te.toLowerCase();for(let oe=0;oe<_.length;oe+=1)if(q===_[oe].lower){k=_[oe].index;break}if(k===null)throw new Error(`${W}start rule name '${te}' not recognized`)}else throw new Error(`${W}type of start rule '${typeof te}' not recognized`);return k},"initializeStartRule"),C=s(function(W,k,q){let oe=`${n}initializeInputChars(): `,ae=W,he=k,ge=q;if(ae===void 0)throw new Error(`${oe}input string is undefined`);if(ae===null)throw new Error(`${oe}input string is null`);if(typeof ae=="string")ae=t.stringToChars(ae);else if(!Array.isArray(ae))throw new Error(`${oe}input string is not a string or array`);if(ae.length>0&&typeof ae[0]!="number")throw new Error(`${oe}input string not an array of integers`);if(typeof he!="number")he=0;else if(he=Math.floor(he),he<0||he>ae.length)throw new Error(`${oe}input beginning index out of range: ${he}`);if(typeof ge!="number")ge=ae.length-he;else if(ge=Math.floor(ge),ge<0||ge>ae.length-he)throw new Error(`${oe}input length out of range: ${ge}`);f=ae,c=he,l=ge,h=c+l},"initializeInputChars"),Z=s(function(){let te=`${n}initializeCallbacks(): `,W;for(x=[],L=[],W=0;W<_.length;W+=1)x[W]=null;for(W=0;W<R.length;W+=1)L[W]=null;let k,q=[];for(W=0;W<_.length;W+=1)q.push(_[W].lower);for(W=0;W<R.length;W+=1)q.push(R[W].lower);for(let oe in i.callbacks){if(W=q.indexOf(oe.toLowerCase()),W<0)throw new Error(`${te}syntax callback '${oe}' not a rule or udt name`);if(k=i.callbacks[oe],k||(k=null),typeof k=="function"||k===null)W<_.length?x[W]=k:L[W-_.length]=k;else throw new Error(`${te}syntax callback[${oe}] must be function reference or 'false' (false/null/undefined/etc.)`)}for(W=0;W<R.length;W+=1)if(L[W]===null)throw new Error(`${te}all UDT callbacks must be defined. UDT callback[${R[W].lower}] not a function reference`)},"initializeCallbacks");this.setMaxTreeDepth=function(te){if(typeof te!="number")throw new Error(`parser: max tree depth must be integer > 0: ${te}`);if(j=Math.floor(te),j<=0)throw new Error(`parser: max tree depth must be integer > 0: ${te}`)},this.setMaxNodeHits=function(te){if(typeof te!="number")throw new Error(`parser: max node hits must be integer > 0: ${te}`);if(D=Math.floor(te),D<=0)throw new Error(`parser: max node hits must be integer > 0: ${te}`)};let V=s(function(te,W,k){let q,oe=`${n}parse(): `;T(te);let ae=g(W);Z(),N(),I(),S();let he=new u;switch(k!=null&&(H=k),a=[{type:e.RNM,index:ae}],o(0,c,he),a=null,he.state){case e.ACTIVE:throw new Error(`${oe}final state should never be 'ACTIVE'`);case e.NOMATCH:q=!1;break;case e.EMPTY:case e.MATCH:he.phraseLength===l?q=!0:q=!1;break;default:throw new Error("unrecognized state")}return{success:q,state:he.state,length:l,matched:he.phraseLength,maxMatched:$,maxTreeDepth:A,nodeHits:v,inputLength:f.length,subBegin:c,subEnd:h,subLength:l}},"privateParse");this.parseSubstring=s(function(W,k,q,oe,ae,he){return Y(),C(q,oe,ae),V(W,k,he)},"parseSubstring"),this.parse=s(function(W,k,q,oe){return Y(),C(q,0,q.length),V(W,k,oe)},"parse");let F=s(function(te,W,k){let q=a[te];for(let oe=0;oe<q.children.length&&(o(q.children[oe],W,k),k.state===e.NOMATCH);oe+=1);},"opALT"),ce=s(function(te,W,k){let q,oe,ae,he,ge=a[te],it=k.uFrame.length(),Pe=k.pFrame.length();i.ast&&(oe=i.ast.getLength()),q=!0,ae=W,he=0;for(let Ee=0;Ee<ge.children.length;Ee+=1)if(o(ge.children[Ee],ae,k),k.state===e.NOMATCH){q=!1;break}else ae+=k.phraseLength,he+=k.phraseLength;q?(k.state=he===0?e.EMPTY:e.MATCH,k.phraseLength=he):(k.state=e.NOMATCH,k.phraseLength=0,k.uFrame.pop(it),k.pFrame.pop(Pe),i.ast&&i.ast.setLength(oe))},"opCAT"),E=s(function(te,W,k){let q,oe,ae,he,ge=a[te];oe=W,ae=0,he=0;let it=k.uFrame.length(),Pe=k.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(oe>=h||(o(te+1,oe,k),k.state===e.NOMATCH)||k.state===e.EMPTY||(he+=1,ae+=k.phraseLength,oe+=k.phraseLength,he===ge.max)););k.state===e.EMPTY||he>=ge.min?(k.state=ae===0?e.EMPTY:e.MATCH,k.phraseLength=ae):(k.state=e.NOMATCH,k.phraseLength=0,k.uFrame.pop(it),k.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREP"),X=s(function(te,W,k,q){if(W.phraseLength>k){let oe=`${n}opRNM(${te.name}): callback function error: `;throw oe+=`sysData.phraseLength: ${W.phraseLength}`,oe+=` must be <= remaining chars: ${k}`,new Error(oe)}switch(W.state){case e.ACTIVE:if(q!==!0)throw new Error(`${n}opRNM(${te.name}): callback function return error. ACTIVE state not allowed.`);break;case e.EMPTY:W.phraseLength=0;break;case e.MATCH:W.phraseLength===0&&(W.state=e.EMPTY);break;case e.NOMATCH:W.phraseLength=0;break;default:throw new Error(`${n}opRNM(${te.name}): callback function return error. Unrecognized return state: ${W.state}`)}},"validateRnmCallbackResult"),Q=s(function(te,W,k){let q,oe,ae,he,ge,it,Pe=a[te],Ee=_[Pe.index],ot=x[Ee.index],We=!m();if(We&&(oe=i.ast&&i.ast.ruleDefined(Pe.index),oe&&(q=i.ast.getLength(),i.ast.down(Pe.index,_[Pe.index].name)),he=k.uFrame.length(),ge=k.pFrame.length(),k.uFrame.push(),k.pFrame.push(),it=k.pFrame,k.pFrame=new b),ot===null)ae=a,a=Ee.opcodes,o(0,W,k),a=ae;else{let st=h-W;k.ruleIndex=Ee.index,ot(k,f,W,H),X(Ee,k,st,!0),k.state===e.ACTIVE&&(ae=a,a=Ee.opcodes,o(0,W,k),a=ae,k.ruleIndex=Ee.index,ot(k,f,W,H),X(Ee,k,st,!1))}We&&(oe&&(k.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(Pe.index,Ee.name,W,k.phraseLength)),k.pFrame=it,k.state===e.NOMATCH?(k.uFrame.pop(he),k.pFrame.pop(ge)):Ee.isBkr&&(k.pFrame.savePhrase(Ee.lower,W,k.phraseLength),k.uFrame.savePhrase(Ee.lower,W,k.phraseLength)))},"opRNM"),P=s(function(te,W,k){if(W.phraseLength>k){let q=`${n}opUDT(${te.name}): callback function error: `;throw q+=`sysData.phraseLength: ${W.phraseLength}`,q+=` must be <= remaining chars: ${k}`,new Error(q)}switch(W.state){case e.ACTIVE:throw new Error(`${n}opUDT(${te.name}): callback function return error. ACTIVE state not allowed.`);case e.EMPTY:if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);W.phraseLength=0;break;case e.MATCH:if(W.phraseLength===0){if(te.empty===!1)throw new Error(`${n}opUDT(${te.name}): callback function return error. May not return EMPTY.`);W.state=e.EMPTY}break;case e.NOMATCH:W.phraseLength=0;break;default:throw new Error(`${n}opUDT(${te.name}): callback function return error. Unrecognized return state: ${W.state}`)}},"validateUdtCallbackResult"),O=s(function(te,W,k){let q,oe,ae,he,ge,it,Pe=a[te],Ee=R[Pe.index];k.UdtIndex=Ee.index;let ot=!m();ot&&(ae=i.ast&&i.ast.udtDefined(Pe.index),ae&&(oe=_.length+Pe.index,q=i.ast.getLength(),i.ast.down(oe,Ee.name)),he=k.uFrame.length(),ge=k.pFrame.length(),k.uFrame.push(),k.pFrame.push(),it=k.pFrame,k.pFrame=new b);let We=h-W;L[Pe.index](k,f,W,H),P(Ee,k,We),ot&&(ae&&(k.state===e.NOMATCH?i.ast.setLength(q):i.ast.up(oe,Ee.name,W,k.phraseLength)),k.pFrame=it,k.state===e.NOMATCH?(k.uFrame.pop(he),k.pFrame.pop(ge)):Ee.isBkr&&(k.pFrame.savePhrase(Ee.lower,W,k.phraseLength),k.uFrame.savePhrase(Ee.lower,W,k.phraseLength)))},"opUDT"),z=s(function(te,W,k){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:W,charsEnd:h,charsLength:l}),h=f.length,l=f.length-c,o(te+1,W,k);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,k.phraseLength=0,k.state){case e.EMPTY:k.state=e.EMPTY;break;case e.MATCH:k.state=e.EMPTY;break;case e.NOMATCH:k.state=e.NOMATCH;break;default:throw new Error(`opAND: invalid state ${k.state}`)}},"opAND"),J=s(function(te,W,k){d.push({lookAround:e.LOOKAROUND_AHEAD,anchor:W,charsEnd:h,charsLength:l}),h=f.length,l=f.length-c,o(te+1,W,k);let q=d.pop();switch(h=q.charsEnd,l=q.charsLength,k.phraseLength=0,k.state){case e.EMPTY:case e.MATCH:k.state=e.NOMATCH;break;case e.NOMATCH:k.state=e.EMPTY;break;default:throw new Error(`opNOT: invalid state ${k.state}`)}},"opNOT"),re=s(function(te,W,k){let q=a[te];k.state=e.NOMATCH,W<h&&q.min<=f[W]&&f[W]<=q.max&&(k.state=e.MATCH,k.phraseLength=1)},"opTRG"),le=s(function(te,W,k){let q,oe=a[te],ae=oe.string.length;if(k.state=e.NOMATCH,W+ae<=h){for(q=0;q<ae;q+=1)if(f[W+q]!==oe.string[q])return;k.state=e.MATCH,k.phraseLength=ae}},"opTBS"),se=s(function(te,W,k){let q,oe,ae=a[te];k.state=e.NOMATCH;let he=ae.string.length;if(he===0){k.state=e.EMPTY;return}if(W+he<=h){for(q=0;q<he;q+=1)if(oe=f[W+q],oe>=65&&oe<=90&&(oe+=32),oe!==ae.string[q])return;k.state=e.MATCH,k.phraseLength=he}},"opTLS"),G=s(function(te,W,k){k.state=e.NOMATCH,k.phraseLength=0,k.state=W===0?e.EMPTY:e.NOMATCH},"opABG"),pe=s(function(te,W,k){k.state=e.NOMATCH,k.phraseLength=0,k.state=W===f.length?e.EMPTY:e.NOMATCH},"opAEN"),ee=s(function(te,W,k){let q,oe,ae,he,ge=a[te];k.state=e.NOMATCH,ge.index<_.length?he=_[ge.index].lower:he=R[ge.index-_.length].lower;let it=ge.bkrMode===e.BKR_MODE_PM?k.pFrame.getPhrase(he):k.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(it===null)return;let Ee=it.phraseIndex,ot=it.phraseLength;if(ot===0){k.state=e.EMPTY;return}if(W+ot<=h){if(Pe){for(q=0;q<ot;q+=1)if(oe=f[W+q],ae=f[Ee+q],oe>=65&&oe<=90&&(oe+=32),ae>=65&&ae<=90&&(ae+=32),oe!==ae)return;k.state=e.MATCH,k.phraseLength=ot}else for(q=0;q<ot;q+=1)if(oe=f[W+q],ae=f[Ee+q],oe!==ae)return;k.state=e.MATCH,k.phraseLength=ot}},"opBKR"),fe=s(function(te,W,k){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:W}),o(te+1,W,k),d.pop(),k.phraseLength=0,k.state){case e.EMPTY:k.state=e.EMPTY;break;case e.MATCH:k.state=e.EMPTY;break;case e.NOMATCH:k.state=e.NOMATCH;break;default:throw new Error(`opBKA: invalid state ${k.state}`)}},"opBKA"),K=s(function(te,W,k){switch(d.push({lookAround:e.LOOKAROUND_BEHIND,anchor:W}),o(te+1,W,k),d.pop(),k.phraseLength=0,k.state){case e.EMPTY:case e.MATCH:k.state=e.NOMATCH;break;case e.NOMATCH:k.state=e.EMPTY;break;default:throw new Error(`opBKN: invalid state ${k.state}`)}},"opBKN"),ie=s(function(te,W,k){let q,oe,ae,he,ge=a[te],it=k.uFrame.length(),Pe=k.pFrame.length();i.ast&&(oe=i.ast.getLength()),q=!0,ae=W,he=0;for(let Ee=ge.children.length-1;Ee>=0;Ee-=1)if(o(ge.children[Ee],ae,k),ae-=k.phraseLength,he+=k.phraseLength,k.state===e.NOMATCH){q=!1;break}q?(k.state=he===0?e.EMPTY:e.MATCH,k.phraseLength=he):(k.state=e.NOMATCH,k.phraseLength=0,k.uFrame.pop(it),k.pFrame.pop(Pe),i.ast&&i.ast.setLength(oe))},"opCATBehind"),me=s(function(te,W,k){let q,oe,ae,he,ge=a[te];oe=W,ae=0,he=0;let it=k.uFrame.length(),Pe=k.pFrame.length();i.ast&&(q=i.ast.getLength());let Ee=!0;for(;Ee&&!(oe<=0||(o(te+1,oe,k),k.state===e.NOMATCH)||k.state===e.EMPTY||(he+=1,ae+=k.phraseLength,oe-=k.phraseLength,he===ge.max)););k.state===e.EMPTY||he>=ge.min?(k.state=ae===0?e.EMPTY:e.MATCH,k.phraseLength=ae):(k.state=e.NOMATCH,k.phraseLength=0,k.uFrame.pop(it),k.pFrame.pop(Pe),i.ast&&i.ast.setLength(q))},"opREPBehind"),Te=s(function(te,W,k){let q=a[te];if(k.state=e.NOMATCH,k.phraseLength=0,W>0){let oe=f[W-1];q.min<=oe&&oe<=q.max&&(k.state=e.MATCH,k.phraseLength=1)}},"opTRGBehind"),Ie=s(function(te,W,k){let q,oe=a[te];k.state=e.NOMATCH;let ae=oe.string.length,he=W-ae;if(he>=0){for(q=0;q<ae;q+=1)if(f[he+q]!==oe.string[q])return;k.state=e.MATCH,k.phraseLength=ae}},"opTBSBehind"),Xe=s(function(te,W,k){let q,oe=a[te];k.state=e.NOMATCH;let ae=oe.string.length;if(ae===0){k.state=e.EMPTY;return}let he=W-ae;if(he>=0){for(let ge=0;ge<ae;ge+=1)if(q=f[he+ge],q>=65&&q<=90&&(q+=32),q!==oe.string[ge])return;k.state=e.MATCH,k.phraseLength=ae}},"opTLSBehind"),gn=s(function(te,W,k){let q,oe,ae,he,ge=a[te];k.state=e.NOMATCH,k.phraseLength=0,ge.index<_.length?he=_[ge.index].lower:he=R[ge.index-_.length].lower;let it=ge.bkrMode===e.BKR_MODE_PM?k.pFrame.getPhrase(he):k.uFrame.getPhrase(he),Pe=ge.bkrCase===e.BKR_MODE_CI;if(it===null)return;let Ee=it.phraseIndex,ot=it.phraseLength;if(ot===0){k.state=e.EMPTY,k.phraseLength=0;return}let We=W-ot;if(We>=0){if(Pe){for(q=0;q<ot;q+=1)if(oe=f[We+q],ae=f[Ee+q],oe>=65&&oe<=90&&(oe+=32),ae>=65&&ae<=90&&(ae+=32),oe!==ae)return;k.state=e.MATCH,k.phraseLength=ot}else for(q=0;q<ot;q+=1)if(oe=f[We+q],ae=f[Ee+q],oe!==ae)return;k.state=e.MATCH,k.phraseLength=ot}},"opBKRBehind");o=s(function(W,k,q){let oe=!0,ae=a[W];if(v+=1,v>D)throw new Error(`parser: maximum number of node hits exceeded: ${D}`);if(y+=1,y>A&&(A=y,A>j))throw new Error(`parser: maximum parse tree depth exceeded: ${j}`);if(q.refresh(),i.trace!==null){let he=p();i.trace.down(ae,q.state,k,q.phraseLength,he.anchor,he.lookAround)}if(w())switch(ae.type){case e.ALT:F(W,k,q);break;case e.CAT:ie(W,k,q);break;case e.REP:me(W,k,q);break;case e.RNM:Q(W,k,q);break;case e.UDT:O(W,k,q);break;case e.AND:z(W,k,q);break;case e.NOT:J(W,k,q);break;case e.TRG:Te(W,k,q);break;case e.TBS:Ie(W,k,q);break;case e.TLS:Xe(W,k,q);break;case e.BKR:gn(W,k,q);break;case e.BKA:fe(W,k,q);break;case e.BKN:K(W,k,q);break;case e.ABG:G(W,k,q);break;case e.AEN:pe(W,k,q);break;default:oe=!1;break}else switch(ae.type){case e.ALT:F(W,k,q);break;case e.CAT:ce(W,k,q);break;case e.REP:E(W,k,q);break;case e.RNM:Q(W,k,q);break;case e.UDT:O(W,k,q);break;case e.AND:z(W,k,q);break;case e.NOT:J(W,k,q);break;case e.TRG:re(W,k,q);break;case e.TBS:le(W,k,q);break;case e.TLS:se(W,k,q);break;case e.BKR:ee(W,k,q);break;case e.BKA:fe(W,k,q);break;case e.BKN:K(W,k,q);break;case e.ABG:G(W,k,q);break;case e.AEN:pe(W,k,q);break;default:oe=!1;break}if(!m()&&k+q.phraseLength>$&&($=k+q.phraseLength),i.stats!==null&&i.stats.collect(ae,q),i.trace!==null){let he=p();i.trace.up(ae,q.state,k,q.phraseLength,he.anchor,he.lookAround)}return y-=1,oe},"opExecuteFunc")},"parser")});var D3=de((C$,L3)=>{L3.exports=s(function(){let e=ni(),t=va(),n=Wu(),i="stats.js: ",o=[],a=[],f=[],c,l=[],h=[];this.statsObject="statsObject";let d="stats",y=s(function(D,B){return D.lower<B.lower?-1:D.lower>B.lower?1:0},"sortAlpha"),A=s(function(D,B){return D.total<B.total?1:D.total>B.total?-1:y(D,B)},"sortHits"),v=s(function(D,B){return D.index<B.index?-1:D.index>B.index?1:0},"sortIndex"),x=s(function(){this.empty=0,this.match=0,this.nomatch=0,this.total=0},"EmptyStat"),L=s(function(){f.length=0,c=new x,f[e.ALT]=new x,f[e.CAT]=new x,f[e.REP]=new x,f[e.RNM]=new x,f[e.TRG]=new x,f[e.TBS]=new x,f[e.TLS]=new x,f[e.UDT]=new x,f[e.AND]=new x,f[e.NOT]=new x,f[e.BKR]=new x,f[e.BKA]=new x,f[e.BKN]=new x,f[e.ABG]=new x,f[e.AEN]=new x,l.length=0;for(let D=0;D<o.length;D+=1)l.push({empty:0,match:0,nomatch:0,total:0,name:o[D].name,lower:o[D].lower,index:o[D].index});if(a.length>0){h.length=0;for(let D=0;D<a.length;D+=1)h.push({empty:0,match:0,nomatch:0,total:0,name:a[D].name,lower:a[D].lower,index:a[D].index})}},"clear"),_=s(function(D,B){switch(D.total+=1,B){case e.EMPTY:D.empty+=1;break;case e.MATCH:D.match+=1;break;case e.NOMATCH:D.nomatch+=1;break;default:throw new Error(`${i}collect(): incStat(): unrecognized state: ${B}`)}},"incStat"),R=s(function(D,B){let U="";return U+="<tr>",U+=`<td class="${n.CLASS_ACTIVE}">${D}</td>`,U+=`<td class="${n.CLASS_EMPTY}">${B.empty}</td>`,U+=`<td class="${n.CLASS_MATCH}">${B.match}</td>`,U+=`<td class="${n.CLASS_NOMATCH}">${B.nomatch}</td>`,U+=`<td class="${n.CLASS_ACTIVE}">${B.total}</td>`,U+=`</tr>
|
273
|
+
`,U},"displayRow"),H=s(function(){let D="";return D+=R("ALT",f[e.ALT]),D+=R("CAT",f[e.CAT]),D+=R("REP",f[e.REP]),D+=R("RNM",f[e.RNM]),D+=R("TRG",f[e.TRG]),D+=R("TBS",f[e.TBS]),D+=R("TLS",f[e.TLS]),D+=R("UDT",f[e.UDT]),D+=R("AND",f[e.AND]),D+=R("NOT",f[e.NOT]),D+=R("BKR",f[e.BKR]),D+=R("BKA",f[e.BKA]),D+=R("BKN",f[e.BKN]),D+=R("ABG",f[e.ABG]),D+=R("AEN",f[e.AEN]),D+=R("totals",c),D},"displayOpsOnly"),$=s(function(){let D="";D+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
274
274
|
`,D+=`<tr><th>rules</th><th></th><th></th><th></th><th></th></tr>
|
275
|
-
`;for(let B=0;B<
|
275
|
+
`;for(let B=0;B<o.length;B+=1)l[B].total>0&&(D+="<tr>",D+=`<td class="${n.CLASS_ACTIVE}">${l[B].name}</td>`,D+=`<td class="${n.CLASS_EMPTY}">${l[B].empty}</td>`,D+=`<td class="${n.CLASS_MATCH}">${l[B].match}</td>`,D+=`<td class="${n.CLASS_NOMATCH}">${l[B].nomatch}</td>`,D+=`<td class="${n.CLASS_ACTIVE}">${l[B].total}</td>`,D+=`</tr>
|
276
276
|
`);if(a.length>0){D+=`<tr><th></th><th></th><th></th><th></th><th></th></tr>
|
277
277
|
`,D+=`<tr><th>udts</th><th></th><th></th><th></th><th></th></tr>
|
278
278
|
`;for(let B=0;B<a.length;B+=1)h[B].total>0&&(D+="<tr>",D+=`<td class="${n.CLASS_ACTIVE}">${h[B].name}</td>`,D+=`<td class="${n.CLASS_EMPTY}">${h[B].empty}</td>`,D+=`<td class="${n.CLASS_MATCH}">${h[B].match}</td>`,D+=`<td class="${n.CLASS_NOMATCH}">${h[B].nomatch}</td>`,D+=`<td class="${n.CLASS_ACTIVE}">${h[B].total}</td>`,D+=`</tr>
|
279
|
-
`)}return D},"displayRules");this.validate=
|
280
|
-
`,typeof B=="string"&&(
|
281
|
-
`),
|
282
|
-
`,
|
283
|
-
`,
|
284
|
-
`,
|
285
|
-
`,
|
286
|
-
`;let Y=!0;for(;Y;){if(D===void 0){
|
287
|
-
`,
|
288
|
-
`,
|
289
|
-
`,typeof O=="string"&&(
|
279
|
+
`)}return D},"displayRules");this.validate=s(function(D){let B=!1;return typeof D=="string"&&d===D&&(B=!0),B},"validate"),this.init=s(function(D,B){o=D,a=B,L()},"init"),this.collect=s(function(D,B){_(c,B.state,B.phraseLength),_(f[D.type],B.state,B.phraseLength),D.type===e.RNM&&_(l[D.index],B.state,B.phraseLength),D.type===e.UDT&&_(h[D.index],B.state,B.phraseLength)},"collect"),this.toHtml=s(function(D,B){let U="";U+=`<table class="${n.CLASS_STATS}">
|
280
|
+
`,typeof B=="string"&&(U+=`<caption>${B}</caption>
|
281
|
+
`),U+=`<tr><th class="${n.CLASS_ACTIVE}">ops</th>
|
282
|
+
`,U+=`<th class="${n.CLASS_EMPTY}">EMPTY</th>
|
283
|
+
`,U+=`<th class="${n.CLASS_MATCH}">MATCH</th>
|
284
|
+
`,U+=`<th class="${n.CLASS_NOMATCH}">NOMATCH</th>
|
285
|
+
`,U+=`<th class="${n.CLASS_ACTIVE}">totals</th></tr>
|
286
|
+
`;let Y=!0;for(;Y;){if(D===void 0){U+=H();break}if(D===null){U+=H();break}if(D==="ops"){U+=H();break}if(D==="index"){l.sort(v),h.length>0&&h.sort(v),U+=H(),U+=$();break}if(D==="hits"){l.sort(A),h.length>0&&h.sort(v),U+=H(),U+=$();break}if(D==="alpha"){l.sort(y),h.length>0&&h.sort(y),U+=H(),U+=$();break}break}return U+=`</table>
|
287
|
+
`,U},"toHtml"),this.toHtmlPage=s(function(D,B,U){return t.htmlToPage(this.toHtml(D,B),U)},"toHtmlPage")},"statsFunc")});var K3=de((T$,F3)=>{F3.exports=s(function(){let e=va(),t=Wu(),n=new($1()),i=ni(),o="trace.js: ",a=this,f=16,c=10,l=8,h=32,d=80,y=5,A=[],v=5e3,x=-1,L=0,_=0,R=[],H=null,$=null,j=null,D=[],B=[],U=`<span class="${t.CLASS_LINEEND}">•</span>`,Y=`<span class="${t.CLASS_LINEEND}">…</span>`,b=`<span class="${t.CLASS_EMPTY}">𝜺</span>`,u=s(function(){let P=s(function(z){D[i.ALT]=z,D[i.CAT]=z,D[i.REP]=z,D[i.TLS]=z,D[i.TBS]=z,D[i.TRG]=z,D[i.AND]=z,D[i.NOT]=z,D[i.BKR]=z,D[i.BKA]=z,D[i.BKN]=z,D[i.ABG]=z,D[i.AEN]=z},"setOperators"),O=0;for(let z in a.filter.operators)O+=1;if(O===0){P(!1);return}for(let z in a.filter.operators){let J=z.toUpperCase();if(J==="<ALL>"){P(!0);return}if(J==="<NONE>"){P(!1);return}}P(!1);for(let z in a.filter.operators){let J=z.toUpperCase();if(J==="ALT")D[i.ALT]=a.filter.operators[z]===!0;else if(J==="CAT")D[i.CAT]=a.filter.operators[z]===!0;else if(J==="REP")D[i.REP]=a.filter.operators[z]===!0;else if(J==="AND")D[i.AND]=a.filter.operators[z]===!0;else if(J==="NOT")D[i.NOT]=a.filter.operators[z]===!0;else if(J==="TLS")D[i.TLS]=a.filter.operators[z]===!0;else if(J==="TBS")D[i.TBS]=a.filter.operators[z]===!0;else if(J==="TRG")D[i.TRG]=a.filter.operators[z]===!0;else if(J==="BKR")D[i.BKR]=a.filter.operators[z]===!0;else if(J==="BKA")D[i.BKA]=a.filter.operators[z]===!0;else if(J==="BKN")D[i.BKN]=a.filter.operators[z]===!0;else if(J==="ABG")D[i.ABG]=a.filter.operators[z]===!0;else if(J==="AEN")D[i.AEN]=a.filter.operators[z]===!0;else throw new Error(`${o}initOpratorFilter: '${z}' not a valid operator name. Must be <all>, <none>, alt, cat, rep, tls, tbs, trg, and, not, bkr, bka or bkn`)}},"initOperatorFilter"),p=s(function(){let P=s(function(re){D[i.RNM]=re,D[i.UDT]=re;let le=$.length+j.length;B.length=0;for(let se=0;se<le;se+=1)B.push(re)},"setRules"),O,z,J=[];for(z=0;z<$.length;z+=1)J.push($[z].lower);for(z=0;z<j.length;z+=1)J.push(j[z].lower);B.length=0,O=0;for(let re in a.filter.rules)O+=1;if(O===0){P(!0);return}for(let re in a.filter.rules){let le=re.toLowerCase();if(le==="<all>"){P(!0);return}if(le==="<none>"){P(!1);return}}P(!1),D[i.RNM]=!0,D[i.UDT]=!0;for(let re in a.filter.rules){let le=re.toLowerCase();if(z=J.indexOf(le),z<0)throw new Error(`${o}initRuleFilter: '${re}' not a valid rule or udt name`);B[z]=a.filter.rules[re]===!0}},"initRuleFilter");this.traceObject="traceObject",this.filter={operators:[],rules:[]},this.setMaxRecords=function(P,O){if(x=-1,typeof P=="number"&&P>0)v=Math.ceil(P);else{v=0;return}typeof O=="number"&&(x=Math.floor(O),x<0&&(x=-1))},this.getMaxRecords=function(){return v},this.getLastRecord=function(){return x},this.init=function(P,O,z){A.length=0,R.length=0,L=0,_=0,H=z,$=P,j=O,u(),p(),n.init(v)};let m=s(function(P){let O=!1;return P.type===i.RNM?D[P.type]&&B[P.index]?O=!0:O=!1:P.type===i.UDT?D[P.type]&&B[$.length+P.index]?O=!0:O=!1:O=D[P.type],O},"filterOps"),w=s(function(P){return x===-1||P<=x},"filterRecords");this.down=function(P,O,z,J,re,le){w(L)&&m(P)&&(R.push(L),A[n.increment()]={dirUp:!1,depth:_,thisLine:L,thatLine:void 0,opcode:P,state:O,phraseIndex:z,phraseLength:J,lookAnchor:re,lookAround:le},L+=1,_+=1)},this.up=function(P,O,z,J,re,le){if(w(L)&&m(P)){let se=L,G=R.pop(),pe=n.getListIndex(G);pe!==-1&&(A[pe].thatLine=se),_-=1,A[n.increment()]={dirUp:!0,depth:_,thisLine:se,thatLine:G,opcode:P,state:O,phraseIndex:z,phraseLength:J,lookAnchor:re,lookAround:le},L+=1}};let S=s(function(){function P(k,q){let oe,ae,he;if(q)switch(k.op={id:q.type,name:e.opcodeToString(q.type)},k.opData=void 0,q.type){case i.RNM:k.opData=$[q.index].name;break;case i.UDT:k.opData=j[q.index].name;break;case i.BKR:q.index<$.length?oe=$[q.index].name:oe=j[q.index-$.length].name,ae=q.bkrCase===i.BKR_MODE_CI?"%i":"%s",he=q.bkrMode===i.BKR_MODE_UM?"%u":"%p",k.opData=`\\\\${ae}${he}${oe}`;break;case i.TLS:k.opData=[];for(let ge=0;ge<q.string.length;ge+=1)k.opData.push(q.string[ge]);break;case i.TBS:k.opData=[];for(let ge=0;ge<q.string.length;ge+=1)k.opData.push(q.string[ge]);break;case i.TRG:k.opData=[q.min,q.max];break;case i.REP:k.opData=[q.min,q.max];break;default:throw new Error("unrecognized opcode")}else k.op={id:void 0,name:void 0},k.opData=void 0}s(P,"nodeOpcode");function O(k,q,oe){return k===i.MATCH?{index:q,length:oe}:k===i.NOMATCH?{index:q,length:0}:k===i.EMPTY?{index:q,length:0}:null}s(O,"nodePhrase");let z=-1;function J(k,q,oe){let ae={id:z++,branch:-1,parent:k,up:!1,down:!1,depth:oe,children:[]};return q?(ae.down=!0,ae.state={id:q.state,name:e.stateToString(q.state)},ae.phrase=null,P(ae,q.opcode)):(ae.state={id:void 0,name:void 0},ae.phrase=O(),P(ae,void 0)),ae}s(J,"nodeDown");function re(k,q){q&&(k.up=!0,k.state={id:q.state,name:e.stateToString(q.state)},k.phrase=O(q.state,q.phraseIndex,q.phraseLength),k.down||P(k,q.opcode))}s(re,"nodeUp");let le=0,se=-1,G=1;function pe(k){if(se+=1,k.branch=G,se>_&&(_=se),k.children.length===0)le+=1;else for(let q=0;q<k.children.length;q+=1)q>0&&(G+=1),k.children[q].leftMost=!1,k.children[q].rightMost=!1,k.leftMost&&(k.children[q].leftMost=q===0),k.rightMost&&(k.children[q].rightMost=q===k.children.length-1),pe(k.children[q]);se-=1}s(pe,"walk");function ee(k,q){let oe,ae={};if(ae.id=k.id,ae.branch=k.branch,ae.leftMost=k.leftMost,ae.rightMost=k.rightMost,oe=k.state.name?k.state.name:"ACTIVE",ae.state={id:k.state.id,name:oe},oe=k.op.name?k.op.name:"?",ae.op={id:k.op.id,name:oe},typeof k.opData=="string")ae.opData=k.opData;else if(Array.isArray(k.opData)){ae.opData=[];for(let he=0;he<k.opData.length;he+=1)ae.opData[he]=k.opData[he]}else ae.opData=void 0;k.phrase?ae.phrase={index:k.phrase.index,length:k.phrase.length}:ae.phrase=null,ae.depth=k.depth,ae.children=[];for(let he=0;he<k.children.length;he+=1){let ge=he!==k.children.length-1;ae.children[he]=ee(k.children[he],q,ge)}return ae}s(ee,"display");let fe=[],K,ie,me,Te,Ie=!0,Xe=J(null,null,-1);for(fe.push(Xe),ie=Xe,n.forEach(k=>{if(Te=A[k],Ie&&(Ie=!1,Te.depth>0)){let q=Te.dirUp?Te.depth+1:Te.depth;for(let oe=0;oe<q;oe+=1)me=ie,ie=J(ie,null,oe),fe.push(ie),me.children.push(ie)}Te.dirUp?(ie=fe.pop(),re(ie,Te),ie=fe[fe.length-1]):(me=ie,ie=J(ie,Te,Te.depth),fe.push(ie),me.children.push(ie))});fe.length>1;)ie=fe.pop(),re(ie,null);if(Xe.children.length===0)throw new Error("trace.toTree(): parse tree has no nodes");if(fe.length===0)throw new Error("trace.toTree(): integrity check: dummy root node disappeared?");K=Xe.children[0];let gn=K;for(;K&&!K.down&&!K.up;)gn=K,K=K.children[0];K=gn,K.leftMost=!0,K.rightMost=!0,pe(K),K.branch=0;let te={};te.string=[];for(let k=0;k<H.length;k+=1)te.string[k]=H[k];te.rules=[];for(let k=0;k<$.length;k+=1)te.rules[k]=$[k].name;te.udts=[];for(let k=0;k<j.length;k+=1)te.udts[k]=j[k].name;te.id={},te.id.ALT={id:i.ALT,name:"ALT"},te.id.CAT={id:i.CAT,name:"CAT"},te.id.REP={id:i.REP,name:"REP"},te.id.RNM={id:i.RNM,name:"RNM"},te.id.TLS={id:i.TLS,name:"TLS"},te.id.TBS={id:i.TBS,name:"TBS"},te.id.TRG={id:i.TRG,name:"TRG"},te.id.UDT={id:i.UDT,name:"UDT"},te.id.AND={id:i.AND,name:"AND"},te.id.NOT={id:i.NOT,name:"NOT"},te.id.BKR={id:i.BKR,name:"BKR"},te.id.BKA={id:i.BKA,name:"BKA"},te.id.BKN={id:i.BKN,name:"BKN"},te.id.ABG={id:i.ABG,name:"ABG"},te.id.AEN={id:i.AEN,name:"AEN"},te.id.ACTIVE={id:i.ACTIVE,name:"ACTIVE"},te.id.MATCH={id:i.MATCH,name:"MATCH"},te.id.EMPTY={id:i.EMPTY,name:"EMPTY"},te.id.NOMATCH={id:i.NOMATCH,name:"NOMATCH"},te.treeDepth=_,te.leafNodes=le;let W;return K.down?K.up?W="none":W="right":K.up?W="left":W="both",te.branchesIncomplete=W,te.tree=ee(K,K.depth,!1),te},"toTreeObj");this.toTree=function(P){let O=S();return P?JSON.stringify(O):O},this.toHtmlPage=function(P,O,z){return e.htmlToPage(this.toHtml(P,O),z)};let N=s(function(P,O){let z;switch(P){case f:z="hexidecimal";break;case c:z="decimal";break;case l:z="ASCII";break;case h:z="UNICODE";break;default:throw new Error(`${o}htmlHeader: unrecognized mode: ${P}`)}let J="";return J+=`<p>display mode: ${z}</p>
|
288
|
+
`,J+=`<table class="${t.CLASS_TRACE}">
|
289
|
+
`,typeof O=="string"&&(J+=`<caption>${O}</caption>`),J},"htmlHeader"),I=s(function(){let P="";return P+=`</table>
|
290
290
|
`,P+=`<p class="${t.CLASS_MONOSPACE}">legend:<br>
|
291
291
|
`,P+=`(a) - line number<br>
|
292
292
|
`,P+=`(b) - matching line number<br>
|
@@ -306,7 +306,7 @@ table.apg-attrs a:hover {
|
|
306
306
|
`,P+=` - <span class="${t.CLASS_REMAINDER}">remainder characters(not yet examined by parser)</span><br>
|
307
307
|
`,P+=` - <span class="${t.CLASS_CTRLCHAR}">control characters, TAB, LF, CR, etc. (ASCII mode only)</span><br>
|
308
308
|
`,P+=` - ${b} empty string<br>
|
309
|
-
`,P+=` - ${
|
309
|
+
`,P+=` - ${U} end of input string<br>
|
310
310
|
`,P+=` - ${Y} input string display truncated<br>
|
311
311
|
`,P+=`</p>
|
312
312
|
`,P+=`<p class="${t.CLASS_MONOSPACE}">
|
@@ -329,11 +329,11 @@ table.apg-attrs a:hover {
|
|
329
329
|
`,P+=`ABG - anchor - begin of input string<br>
|
330
330
|
`,P+=`AEN - anchor - end of input string<br>
|
331
331
|
`,P+=`</p>
|
332
|
-
`,P},"htmlFooter");this.indent=function(P){let O="";for(let z=0;z<P;z+=1)O+=".";return O};let
|
333
|
-
`,n.forEach(pe=>{let ee=
|
332
|
+
`,P},"htmlFooter");this.indent=function(P){let O="";for(let z=0;z<P;z+=1)O+=".";return O};let T=s(function(P,O){let z="";if(O.type===i.TRG)if(P===f||P===h){let J=O.min.toString(16).toUpperCase();J.length%2!==0&&(J=`0${J}`),z+=P===f?"%x":"U+",z+=J,J=O.max.toString(16).toUpperCase(),J.length%2!==0&&(J=`0${J}`),z+=`–${J}`}else z=`%d${O.min.toString(10)}–${O.max.toString(10)}`;return z},"displayTrg"),g=s(function(P,O){let z="";if(O.type===i.REP)if(P===f){let J=O.min.toString(16).toUpperCase();J.length%2!==0&&(J=`0${J}`),z=`x${J}`,O.max<1/0?(J=O.max.toString(16).toUpperCase(),J.length%2!==0&&(J=`0${J}`)):J="inf",z+=`–${J}`}else O.max<1/0?z=`${O.min.toString(10)}–${O.max.toString(10)}`:z=`${O.min.toString(10)}–inf`;return z},"displayRep"),C=s(function(P,O){let z="";if(O.type===i.TBS){let J=Math.min(O.string.length,y*2);if(P===f||P===h){z+=P===f?"%x":"U+";for(let re=0;re<J;re+=1){let le;re>0&&(z+="."),le=O.string[re].toString(16).toUpperCase(),le.length%2!==0&&(le=`0${le}`),z+=le}}else{z="%d";for(let re=0;re<J;re+=1)re>0&&(z+="."),z+=O.string[re].toString(10)}J<O.string.length&&(z+=Y)}return z},"displayTbs"),Z=s(function(P,O){let z="";if(O.type===i.TLS){let J=Math.min(O.string.length,y);if(P===f||P===c){let re,le,se;P===f?(z="%x",se=16):(z="%d",se=10);for(let G=0;G<J;G+=1)G>0&&(z+="."),le=O.string[G],le>=97&&le<=122?(re=le-32,z+=`${re.toString(se)}/${le.toString(se)}`.toUpperCase()):le>=65&&le<=90?(re=le,le+=32,z+=`${re.toString(se)}/${le.toString(se)}`.toUpperCase()):z+=le.toString(se).toUpperCase();J<O.string.length&&(z+=Y)}else{z='"';for(let re=0;re<J;re+=1)z+=e.asciiChars[O.string[re]];J<O.string.length&&(z+=Y),z+='"'}}return z},"displayTls"),V=s(function(P,O,z,J,re){if(J===0)return"";let le="",se=re?",":"";switch(P){case f:le=se+e.charsToHex(O,z,J);break;case c:if(re)return`,${e.charsToDec(O,z,J)}`;le=se+e.charsToDec(O,z,J);break;case h:le=e.charsToUnicode(O,z,J);break;case l:default:le=e.charsToAsciiHtml(O,z,J);break}return le},"subPhrase"),F=s(function(P,O,z,J,re,le){let se="",G,pe,ee,fe,K=U,ie=`<span class="${t.CLASS_LOOKBEHIND}">`,me=`<span class="${t.CLASS_REMAINDER}">`,Te="</span>",Ie=!1;switch(z){case i.EMPTY:se+=b;case i.NOMATCH:case i.MATCH:case i.ACTIVE:G=J-re,pe=le-G,ee=le,fe=O.length-ee;break;default:throw new Error("unrecognized state")}return K=U,pe>d?(pe=d,K=Y,fe=0):pe+fe>d&&(K=Y,fe=d-pe),pe>0&&(se+=ie,se+=V(P,O,G,pe,Ie),se+=Te,Ie=!0),fe>0&&(se+=me,se+=V(P,O,ee,fe,Ie),se+=Te),se+K},"displayBehind"),ce=s(function(P,O,z,J,re,le){let se="",G,pe,ee,fe,K=U,ie=`<span class="${t.CLASS_REMAINDER}">`,me="</span>",Te=!1;switch(z){case i.EMPTY:se+=b;case i.NOMATCH:case i.ACTIVE:G=J,pe=0,ee=J,fe=O.length-ee;break;case i.MATCH:G=J,pe=re,ee=J+pe,fe=O.length-ee;break;default:throw new Error("unrecognized state")}return K=U,pe>d?(pe=d,K=Y,fe=0):pe+fe>d&&(K=Y,fe=d-pe),pe>0&&(se+=le,se+=V(P,O,G,pe,Te),se+=me,Te=!0),fe>0&&(se+=ie,se+=V(P,O,ee,fe,Te),se+=me),se+K},"displayForward"),E=s(function(P,O,z,J,re){let le=`<span class="${t.CLASS_LOOKAHEAD}">`;return ce(P,O,z,J,re,le)},"displayAhead"),X=s(function(P,O,z,J,re){let le=`<span class="${t.CLASS_MATCH}">`;return ce(P,O,z,J,re,le)},"displayNone"),Q=s(function(P){if($===null)return"";let O="",z,J,re,le,se,G;return O+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",O+=`<th>operator</th><th>phrase</th></tr>
|
333
|
+
`,n.forEach(pe=>{let ee=A[pe];switch(z=ee.thisLine,J=ee.thatLine!==void 0?ee.thatLine:"--",re=!1,le=!1,se=!1,ee.lookAround===i.LOOKAROUND_AHEAD&&(re=!0,se=!0,G=ee.lookAnchor),(ee.opcode.type===i.AND||ee.opcode.type===i.NOT)&&(re=!0,se=!0,G=ee.phraseIndex),ee.lookAround===i.LOOKAROUND_BEHIND&&(le=!0,se=!0,G=ee.lookAnchor),(ee.opcode.type===i.BKA||ee.opcode.type===i.BKN)&&(le=!0,se=!0,G=ee.phraseIndex),O+="<tr>",O+=`<td>${z}</td><td>${J}</td>`,O+=`<td>${ee.phraseIndex}</td>`,O+=`<td>${ee.phraseLength}</td>`,O+=`<td>${ee.depth}</td>`,O+="<td>",ee.state){case i.ACTIVE:O+=`<span class="${t.CLASS_ACTIVE}">↓ </span>`;break;case i.MATCH:O+=`<span class="${t.CLASS_MATCH}">↑M</span>`;break;case i.NOMATCH:O+=`<span class="${t.CLASS_NOMATCH}">↑N</span>`;break;case i.EMPTY:O+=`<span class="${t.CLASS_EMPTY}">↑E</span>`;break;default:O+=`<span class="${t.CLASS_ACTIVE}">--</span>`;break}if(O+="</td>",O+="<td>",O+=a.indent(ee.depth),re?O+=`<span class="${t.CLASS_LOOKAHEAD}">`:le&&(O+=`<span class="${t.CLASS_LOOKBEHIND}">`),O+=e.opcodeToString(ee.opcode.type),ee.opcode.type===i.RNM&&(O+=`(${$[ee.opcode.index].name}) `),ee.opcode.type===i.BKR){let fe=ee.opcode.bkrCase===i.BKR_MODE_CI?"%i":"%s",K=ee.opcode.bkrMode===i.BKR_MODE_UM?"%u":"%p";O+=`(\\${fe}${K}${$[ee.opcode.index].name}) `}ee.opcode.type===i.UDT&&(O+=`(${j[ee.opcode.index].name}) `),ee.opcode.type===i.TRG&&(O+=`(${T(P,ee.opcode)}) `),ee.opcode.type===i.TBS&&(O+=`(${C(P,ee.opcode)}) `),ee.opcode.type===i.TLS&&(O+=`(${Z(P,ee.opcode)}) `),ee.opcode.type===i.REP&&(O+=`(${g(P,ee.opcode)}) `),se&&(O+="</span>"),O+="</td>",O+="<td>",le?O+=F(P,H,ee.state,ee.phraseIndex,ee.phraseLength,G):re?O+=E(P,H,ee.state,ee.phraseIndex,ee.phraseLength):O+=X(P,H,ee.state,ee.phraseIndex,ee.phraseLength),O+=`</td></tr>
|
334
334
|
`}),O+="<tr><th>(a)</th><th>(b)</th><th>(c)</th><th>(d)</th><th>(e)</th><th>(f)</th>",O+=`<th>operator</th><th>phrase</th></tr>
|
335
335
|
`,O+=`</table>
|
336
|
-
`,O},"htmlTable");this.toHtml=function(P,O){let z=l;if(typeof P=="string"&&P.length>=3){let re=P.toLowerCase().slice(0,3);re==="hex"?z=
|
336
|
+
`,O},"htmlTable");this.toHtml=function(P,O){let z=l;if(typeof P=="string"&&P.length>=3){let re=P.toLowerCase().slice(0,3);re==="hex"?z=f:re==="dec"?z=c:re==="uni"&&(z=h)}let J="";return J+=N(z,O),J+=Q(z),J+=I(),J}},"exportTrace")});var wa=de((k$,$3)=>{$3.exports={ast:O3(),circular:$1(),ids:ni(),parser:U3(),stats:D3(),trace:K3(),utils:va(),emitcss:F1(),style:Wu()}});var q3=de((M$,H3)=>{H3.exports=s(function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"file",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"line",lower:"line",index:1,isBkr:!1},this.rules[2]={name:"line-text",lower:"line-text",index:2,isBkr:!1},this.rules[3]={name:"last-line",lower:"last-line",index:3,isBkr:!1},this.rules[4]={name:"valid",lower:"valid",index:4,isBkr:!1},this.rules[5]={name:"invalid",lower:"invalid",index:5,isBkr:!1},this.rules[6]={name:"end",lower:"end",index:6,isBkr:!1},this.rules[7]={name:"CRLF",lower:"crlf",index:7,isBkr:!1},this.rules[8]={name:"LF",lower:"lf",index:8,isBkr:!1},this.rules[9]={name:"CR",lower:"cr",index:9,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:2,children:[1,3]},this.rules[0].opcodes[1]={type:3,min:0,max:1/0},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:3,min:0,max:1},this.rules[0].opcodes[4]={type:4,index:3},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,2]},this.rules[1].opcodes[1]={type:4,index:2},this.rules[1].opcodes[2]={type:4,index:6},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:3,min:0,max:1/0},this.rules[2].opcodes[1]={type:1,children:[2,3]},this.rules[2].opcodes[2]={type:4,index:4},this.rules[2].opcodes[3]={type:4,index:5},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:3,min:1,max:1/0},this.rules[3].opcodes[1]={type:1,children:[2,3]},this.rules[3].opcodes[2]={type:4,index:4},this.rules[3].opcodes[3]={type:4,index:5},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:5,min:32,max:126},this.rules[4].opcodes[2]={type:6,string:[9]},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[5].opcodes[1]={type:5,min:0,max:8},this.rules[5].opcodes[2]={type:5,min:11,max:12},this.rules[5].opcodes[3]={type:5,min:14,max:31},this.rules[5].opcodes[4]={type:5,min:127,max:4294967295},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:1,children:[1,2,3]},this.rules[6].opcodes[1]={type:4,index:7},this.rules[6].opcodes[2]={type:4,index:8},this.rules[6].opcodes[3]={type:4,index:9},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:6,string:[13,10]},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:6,string:[10]},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:6,string:[13]},this.toString=s(function(){let t="";return t+=`file = *line [last-line]
|
337
337
|
`,t+=`line = line-text end
|
338
338
|
`,t+=`line-text = *(valid/invalid)
|
339
339
|
`,t+=`last-line = 1*(valid/invalid)
|
@@ -343,7 +343,7 @@ table.apg-attrs a:hover {
|
|
343
343
|
`,t+=`CRLF = %d13.10
|
344
344
|
`,t+=`LF = %d10
|
345
345
|
`,t+=`CR = %d13
|
346
|
-
`,t},"toString")},"grammar")});var yx=de(gx=>{var wr=Qn(),oM=ha();function aM(r,e,t,n,i){return r===wr.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:i.textLength,endType:i.endType,invalidChars:i.invalidCount}),wr.SEM_OK}o(aM,"semLine");function cM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.textLength=n),wr.SEM_OK}o(cM,"semLineText");function fM(r,e,t,n,i){return r===wr.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.strict?(i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:n,endType:"none",invalidChars:i.invalidCount}),i.errors.push({line:i.lineNo,char:t+n,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(e.push(10),i.lines.push({lineNo:i.lines.length,beginChar:t,length:n+1,textLength:n,endType:"LF",invalidChars:i.invalidCount})),wr.SEM_OK}o(fM,"semLastLine");function uM(r,e,t,n,i){return r===wr.SEM_PRE&&i.errors.push({line:i.lineNo,char:t,msg:`invalid character found '\\x${oM.charToHex(e[t])}'`}),wr.SEM_OK}o(uM,"semInvalid");function lM(r,e,t,n,i){return r===wr.SEM_POST&&(i.lineNo+=1),wr.SEM_OK}o(lM,"semEnd");function hM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="LF",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),wr.SEM_OK}o(hM,"semLF");function dM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="CR",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),wr.SEM_OK}o(dM,"semCR");function pM(r,e,t,n,i){return r===wr.SEM_PRE&&(i.endType="CRLF"),wr.SEM_OK}o(pM,"semCRLF");var hs=[];hs.line=aM;hs["line-text"]=cM;hs["last-line"]=fM;hs.invalid=uM;hs.end=lM;hs.lf=hM;hs.cr=dM;hs.crlf=pM;gx.callbacks=hs});var wx=de((WK,vx)=>{vx.exports=o(function(e,t,n,i){let s="scanner.js: ",a=da(),c=new(bx()),{callbacks:f}=yx(),l=[],h=new a.parser;if(h.ast=new a.ast,h.ast.callbacks=f,i){if(i.traceObject!=="traceObject")throw new TypeError(`${s}trace argument is not a trace object`);h.trace=i}if(h.parse(c,"file",e).success!==!0){t.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});return}let v={lines:l,lineNo:0,errors:t,strict:!!n};return h.ast.translate(v),l},"exports")});var _x=de((YK,xx)=>{xx.exports=o(function(){let e="syntax-callbacks.js: ",t=da(),n=t.ids,i,s=o(function(Z,V,K,fe){switch(Z.state){case n.ACTIVE:fe.altStack=[],fe.repCount=0;break;case n.EMPTY:fe.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:fe.ruleCount===0&&fe.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${e}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${e}synFile: unrecognized case.`)}},"synFile"),a=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;case n.EMPTY:throw new Error(`${e}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:K.ruleCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRule"),c=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleError"),f=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleNameError"),l=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synDefinedAsError"),h=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAndOp"),d=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synNotOp"),v=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Positive look-behind operator(&&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkaOp"),x=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Negative look-behind operator(!!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBknOp"),y=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Beginning of string anchor(%^) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAbgOp"),_=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"End of string anchor(%$) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAenOp"),U=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(K.strict){let fe=t.utils.charsToString(Z,V,C.phraseLength);K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`Back reference operator(${fe}) found - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkrOp"),E=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(K.strict){let fe=t.utils.charsToString(Z,V,C.phraseLength);K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`UDT operator found(${fe}) - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synUdtOp"),L=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.tlsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsOpen"),H=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsString"),F=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synStringTab"),j=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsClose"),D=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.clsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsOpen"),B=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsString"),R=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:K.strict&&K.errors.push({line:K.findLine(K.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsClose"),Y=o(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.prosValOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValOpen"),b=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:K.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.stringTabChar!==!1&&K.errors.push({line:K.findLine(K.lines,K.stringTabChar),char:K.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValString"),u=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValClose"),p=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:V,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupOpen"),m=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=K.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=K.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupClose"),w=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:V,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},K.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionOpen"),S=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.errors.push({line:K.findLine(K.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=K.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=K.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionClose"),I=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.basicError===!1&&K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBasicElementError"),N=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(C.phraseLength===1&&K.strict){let fe=Z[V]===13?"CR":"LF";K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:`Line end '${fe}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEnd"),k=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:K.errors.push({line:K.findLine(K.lines,V,K.charsLength),char:V,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEndError"),g=o(function(C,Z,V,K){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:K.repCount+=1;break;case n.MATCH:K.repCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRepetition");this.callbacks=[],this.callbacks.andop=h,this.callbacks.basicelementerr=I,this.callbacks.clsclose=R,this.callbacks.clsopen=D,this.callbacks.clsstring=B,this.callbacks.definedaserror=l,this.callbacks.file=s,this.callbacks.groupclose=m,this.callbacks.groupopen=p,this.callbacks.lineenderror=k,this.callbacks.lineend=N,this.callbacks.notop=d,this.callbacks.optionclose=S,this.callbacks.optionopen=w,this.callbacks.prosvalclose=u,this.callbacks.prosvalopen=Y,this.callbacks.prosvalstring=b,this.callbacks.repetition=g,this.callbacks.rule=a,this.callbacks.ruleerror=c,this.callbacks.rulenameerror=f,this.callbacks.stringtab=F,this.callbacks.tlsclose=j,this.callbacks.tlsopen=L,this.callbacks.tlsstring=H,this.callbacks.udtop=E,this.callbacks.bkaop=v,this.callbacks.bknop=x,this.callbacks.bkrop=U,this.callbacks.abgop=y,this.callbacks.aenop=_},"exports")});var Ex=de((XK,Ax)=>{Ax.exports=o(function(){let e=da(),t=e.ids,n=o(function(){this.names=[],this.add=o(function(ee){let ce=-1;return this.get(ee)===-1&&(ce={name:ee,lower:ee.toLowerCase(),index:this.names.length},this.names.push(ce)),ce},"add"),this.get=o(function(ee){let ce=-1,$=ee.toLowerCase();for(let ie=0;ie<this.names.length;ie+=1)if(this.names[ie].lower===$){ce=this.names[ie];break}return ce},"get")},"NameList"),i=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1)$=10*$+pe[ie]-48;return $},"decnum"),s=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1)$=2*$+pe[ie]-48;return $},"binnum"),a=o(function(pe,ee,ce){let $=0;for(let ie=ee;ie<ee+ce;ie+=1){let me=pe[ie];if(me>=48&&me<=57)me-=48;else if(me>=65&&me<=70)me-=55;else if(me>=97&&me<=102)me-=87;else throw new Error("hexnum out of range");$=16*$+me}return $},"hexnum");function c(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)$.ruleNames=new n,$.udtNames=new n,$.rules=[],$.udts=[],$.rulesLineMap=[],$.opcodes=[],$.altStack=[],$.topStack=null,$.topRule=null;else if(J===t.SEM_POST){let me;$.rules.forEach(ke=>{ke.isBkr=!1,ke.opcodes.forEach(Ne=>{Ne.type===t.RNM&&(me=$.ruleNames.get(Ne.index.name),me===-1?($.errors.push({line:$.findLine($.lines,Ne.index.phraseIndex,$.charsLength),char:Ne.index.phraseIndex,msg:`Rule name '${Ne.index.name}' used but not defined.`}),Ne.index=-1):Ne.index=me.index)})}),$.udts.forEach(ke=>{ke.isBkr=!1}),$.rules.forEach(ke=>{ke.opcodes.forEach(Ne=>{Ne.type===t.BKR&&(ke.hasBkr=!0,me=$.ruleNames.get(Ne.index.name),me!==-1?($.rules[me.index].isBkr=!0,Ne.index=me.index):(me=$.udtNames.get(Ne.index.name),me!==-1?($.udts[me.index].isBkr=!0,Ne.index=$.rules.length+me.index):($.errors.push({line:$.findLine($.lines,Ne.index.phraseIndex,$.charsLength),char:Ne.index.phraseIndex,msg:`Back reference name '${Ne.index.name}' refers to undefined rule or unamed UDT.`}),Ne.index=-1)))})})}return ie}o(c,"semFile");function f(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.altStack.length=0,$.topStack=null,$.rulesLineMap.push({line:$.findLine($.lines,ee,$.charsLength),char:ee})),ie}o(f,"semRule");function l(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)$.ruleName="",$.definedas="";else if(J===t.SEM_POST){let me;$.definedas==="="?(me=$.ruleNames.add($.ruleName),me===-1?($.definedas=null,$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`Rule name '${$.ruleName}' previously defined.`})):($.topRule={name:me.name,lower:me.lower,opcodes:[],index:me.index},$.rules.push($.topRule),$.opcodes=$.topRule.opcodes)):(me=$.ruleNames.get($.ruleName),me===-1?($.definedas=null,$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`Rule name '${$.ruleName}' for incremental alternate not previously defined.`})):($.topRule=$.rules[me.index],$.opcodes=$.topRule.opcodes))}return ie}o(l,"semRuleLookup");function h(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_PRE)for(;;){if($.definedas===null){ie=t.SEM_SKIP;break}if($.topStack===null){if($.definedas==="="){$.topStack={alt:{type:t.ALT,children:[]},cat:null},$.altStack.push($.topStack),$.opcodes.push($.topStack.alt);break}$.topStack={alt:$.opcodes[0],cat:null},$.altStack.push($.topStack);break}$.topStack={alt:{type:t.ALT,children:[]},cat:null},$.altStack.push($.topStack),$.opcodes.push($.topStack.alt);break}else J===t.SEM_POST&&($.altStack.pop(),$.altStack.length>0?$.topStack=$.altStack[$.altStack.length-1]:$.topStack=null);return ie}o(h,"semAlternation");function d(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.topStack.alt.children.push($.opcodes.length),$.topStack.cat={type:t.CAT,children:[]},$.opcodes.push($.topStack.cat)):J===t.SEM_POST&&($.topStack.cat=null),ie}o(d,"semConcatenation");function v(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&$.topStack.cat.children.push($.opcodes.length),ie}o(v,"semRepetition");function x(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.REP,min:0,max:1,char:ee}),ie}o(x,"semOptionOpen");function y(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.ruleName=e.utils.charsToString(pe,ee,ce)),ie}o(y,"semRuleName");function _(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.definedas="="),ie}o(_,"semDefined");function U(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.definedas="=/"),ie}o(U,"semIncAlt");function E(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.min=0,$.max=1/0,$.topRep={type:t.REP,min:0,max:1/0},$.opcodes.push($.topRep)):J===t.SEM_POST&&($.min>$.max&&$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`repetition min cannot be greater than max: min: ${$.min}: max: ${$.max}`}),$.topRep.min=$.min,$.topRep.max=$.max),ie}o(E,"semRepOp");function L(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=i(pe,ee,ce)),ie}o(L,"semRepMin");function H(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce)),ie}o(H,"semRepMax");function F(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce),$.min=$.max),ie}o(F,"semRepMinMax");function j(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.AND}),ie}o(j,"semAndOp");function D(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.NOT}),ie}o(D,"semNotOp");function B(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.RNM,index:{phraseIndex:ee,name:e.utils.charsToString(pe,ee,ce)}}),ie}o(B,"semRnmOp");function R(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.ABG}),ie}o(R,"semAbgOp");function Y(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.AEN}),ie}o(Y,"semAenOp");function b(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.BKA}),ie}o(b,"semBkaOp");function u(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.opcodes.push({type:t.BKN}),ie}o(u,"semBknOp");function p(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.ci=!0,$.cs=!1,$.um=!0,$.pm=!1):J===t.SEM_POST&&$.opcodes.push({type:t.BKR,bkrCase:$.cs===!0?t.BKR_MODE_CS:t.BKR_MODE_CI,bkrMode:$.pm===!0?t.BKR_MODE_PM:t.BKR_MODE_UM,index:{phraseIndex:$.bkrname.phraseIndex,name:e.utils.charsToString(pe,$.bkrname.phraseIndex,$.bkrname.phraseLength)}}),ie}o(p,"semBkrOp");function m(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.ci=!0),ie}o(m,"semBkrCi");function w(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.cs=!0),ie}o(w,"semBkrCs");function S(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.um=!0),ie}o(S,"semBkrUm");function I(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.pm=!0),ie}o(I,"semBkrPm");function N(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.bkrname={phraseIndex:ee,phraseLength:ce}),ie}o(N,"semBkrName");function k(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST){let me=e.utils.charsToString(pe,ee,ce),ke=$.udtNames.add(me);if(ke===-1){if(ke=$.udtNames.get(me),ke===-1)throw new Error("semUdtEmpty: name look up error")}else $.udts.push({name:ke.name,lower:ke.lower,index:ke.index,empty:!0});$.opcodes.push({type:t.UDT,empty:!0,index:ke.index})}return ie}o(k,"semUdtEmpty");function g(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST){let me=e.utils.charsToString(pe,ee,ce),ke=$.udtNames.add(me);if(ke===-1){if(ke=$.udtNames.get(me),ke===-1)throw new Error("semUdtNonEmpty: name look up error")}else $.udts.push({name:ke.name,lower:ke.lower,index:ke.index,empty:!1});$.opcodes.push({type:t.UDT,empty:!1,index:ke.index,syntax:null,semantic:null})}return ie}o(g,"semUdtNonEmpty");function C(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE&&($.tlscase=!0),ie}o(C,"semTlsOp");function Z(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&ce>0&&(pe[ee+1]===83||pe[ee+1]===115)&&($.tlscase=!1),ie}o(Z,"semTlsCase");function V(J,pe,ee,ce,$){let ie=t.SEM_OK;if(J===t.SEM_POST)if($.tlscase){let me=pe.slice(ee,ee+ce);for(let ke=0;ke<me.length;ke+=1)me[ke]>=65&&me[ke]<=90&&(me[ke]+=32);$.opcodes.push({type:t.TLS,string:me})}else $.opcodes.push({type:t.TBS,string:pe.slice(ee,ee+ce)});return ie}o(V,"semTlsString");function K(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&(ce<=2?$.opcodes.push({type:t.TLS,string:[]}):$.opcodes.push({type:t.TBS,string:pe.slice(ee+1,ee+ce-1)})),ie}o(K,"semClsOp");function fe(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?$.tbsstr=[]:J===t.SEM_POST&&$.opcodes.push({type:t.TBS,string:$.tbsstr}),ie}o(fe,"semTbsOp");function A(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_PRE?($.min=0,$.max=0):J===t.SEM_POST&&($.min>$.max&&$.errors.push({line:$.findLine($.lines,ee,$.charsLength),char:ee,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${$.min}: max: ${$.max}`}),$.opcodes.push({type:t.TRG,min:$.min,max:$.max})),ie}o(A,"semTrgOp");function X(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=i(pe,ee,ce)),ie}o(X,"semDmin");function Q(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=i(pe,ee,ce)),ie}o(Q,"semDmax");function P(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=s(pe,ee,ce)),ie}o(P,"semBmin");function O(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=s(pe,ee,ce)),ie}o(O,"semBmax");function z(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.min=a(pe,ee,ce)),ie}o(z,"semXmin");function W(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&($.max=a(pe,ee,ce)),ie}o(W,"semXmax");function re(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(i(pe,ee,ce)),ie}o(re,"semDstring");function le(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(s(pe,ee,ce)),ie}o(le,"semBstring");function oe(J,pe,ee,ce,$){let ie=t.SEM_OK;return J===t.SEM_POST&&$.tbsstr.push(a(pe,ee,ce)),ie}o(oe,"semXstring"),this.callbacks=[],this.callbacks.abgop=R,this.callbacks.aenop=Y,this.callbacks.alternation=h,this.callbacks.andop=j,this.callbacks.bmax=O,this.callbacks.bmin=P,this.callbacks.bkaop=b,this.callbacks.bknop=u,this.callbacks.bkrop=p,this.callbacks["bkr-name"]=N,this.callbacks.bstring=le,this.callbacks.clsop=K,this.callbacks.ci=m,this.callbacks.cs=w,this.callbacks.um=S,this.callbacks.pm=I,this.callbacks.concatenation=d,this.callbacks.defined=_,this.callbacks.dmax=Q,this.callbacks.dmin=X,this.callbacks.dstring=re,this.callbacks.file=c,this.callbacks.incalt=U,this.callbacks.notop=D,this.callbacks.optionopen=x,this.callbacks["rep-max"]=H,this.callbacks["rep-min"]=L,this.callbacks["rep-min-max"]=F,this.callbacks.repetition=v,this.callbacks.repop=E,this.callbacks.rnmop=B,this.callbacks.rule=f,this.callbacks.rulelookup=l,this.callbacks.rulename=y,this.callbacks.tbsop=fe,this.callbacks.tlscase=Z,this.callbacks.tlsstring=V,this.callbacks.tlsop=C,this.callbacks.trgop=A,this.callbacks["udt-empty"]=k,this.callbacks["udt-non-empty"]=g,this.callbacks.xmax=W,this.callbacks.xmin=z,this.callbacks.xstring=oe},"exports")});var Cx=de((ZK,Sx)=>{Sx.exports=o(function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=o(function(){let t="";return t+=`;
|
346
|
+
`,t},"toString")},"grammar")});var j3=de(z3=>{var Er=ni(),WM=va();function GM(r,e,t,n,i){return r===Er.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:i.textLength,endType:i.endType,invalidChars:i.invalidCount}),Er.SEM_OK}s(GM,"semLine");function JM(r,e,t,n,i){return r===Er.SEM_PRE&&(i.textLength=n),Er.SEM_OK}s(JM,"semLineText");function YM(r,e,t,n,i){return r===Er.SEM_PRE?(i.endLength=0,i.textLength=0,i.invalidCount=0):i.strict?(i.lines.push({lineNo:i.lines.length,beginChar:t,length:n,textLength:n,endType:"none",invalidChars:i.invalidCount}),i.errors.push({line:i.lineNo,char:t+n,msg:"no line end on last line - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})):(e.push(10),i.lines.push({lineNo:i.lines.length,beginChar:t,length:n+1,textLength:n,endType:"LF",invalidChars:i.invalidCount})),Er.SEM_OK}s(YM,"semLastLine");function XM(r,e,t,n,i){return r===Er.SEM_PRE&&i.errors.push({line:i.lineNo,char:t,msg:`invalid character found '\\x${WM.charToHex(e[t])}'`}),Er.SEM_OK}s(XM,"semInvalid");function ZM(r,e,t,n,i){return r===Er.SEM_POST&&(i.lineNo+=1),Er.SEM_OK}s(ZM,"semEnd");function QM(r,e,t,n,i){return r===Er.SEM_PRE&&(i.endType="LF",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character LF(\\n, \\x0A) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),Er.SEM_OK}s(QM,"semLF");function eB(r,e,t,n,i){return r===Er.SEM_PRE&&(i.endType="CR",i.strict&&i.errors.push({line:i.lineNo,char:t,msg:"line end character CR(\\r, \\x0D) - strict ABNF specifies CRLF(\\r\\n, \\x0D\\x0A)"})),Er.SEM_OK}s(eB,"semCR");function tB(r,e,t,n,i){return r===Er.SEM_PRE&&(i.endType="CRLF"),Er.SEM_OK}s(tB,"semCRLF");var go=[];go.line=GM;go["line-text"]=JM;go["last-line"]=YM;go.invalid=XM;go.end=ZM;go.lf=QM;go.cr=eB;go.crlf=tB;z3.callbacks=go});var W3=de((I$,V3)=>{V3.exports=s(function(e,t,n,i){let o="scanner.js: ",a=wa(),f=new(q3()),{callbacks:c}=j3(),l=[],h=new a.parser;if(h.ast=new a.ast,h.ast.callbacks=c,i){if(i.traceObject!=="traceObject")throw new TypeError(`${o}trace argument is not a trace object`);h.trace=i}if(h.parse(f,"file",e).success!==!0){t.push({line:0,char:0,msg:"syntax analysis error analyzing input SABNF grammar"});return}let y={lines:l,lineNo:0,errors:t,strict:!!n};return h.ast.translate(y),l},"exports")});var J3=de((N$,G3)=>{G3.exports=s(function(){let e="syntax-callbacks.js: ",t=wa(),n=t.ids,i,o=s(function(Z,V,F,ce){switch(Z.state){case n.ACTIVE:ce.altStack=[],ce.repCount=0;break;case n.EMPTY:ce.errors.push({line:0,char:0,msg:"grammar file is empty"});break;case n.MATCH:ce.ruleCount===0&&ce.errors.push({line:0,char:0,msg:"no rules defined"});break;case n.NOMATCH:throw new Error(`${e}synFile: grammar file NOMATCH: design error: should never happen.`);default:throw new Error(`${e}synFile: unrecognized case.`)}},"synFile"),a=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:F.altStack.length=0,i={groupOpen:null,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},F.altStack.push(i);break;case n.EMPTY:throw new Error(`${e}synRule: EMPTY: rule cannot be empty`);case n.NOMATCH:break;case n.MATCH:F.ruleCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRule"),f=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Unrecognized SABNF line. Invalid rule, comment or blank line."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleError"),c=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Rule names must be alphanum and begin with alphabetic character."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRuleNameError"),l=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Expected '=' or '=/'. Not found."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synDefinedAsError"),h=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"AND operator(&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAndOp"),d=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"NOT operator(!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synNotOp"),y=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Positive look-behind operator(&&) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkaOp"),A=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Negative look-behind operator(!!) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBknOp"),v=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Beginning of string anchor(%^) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAbgOp"),x=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"End of string anchor(%$) found - strict ABNF specified."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synAenOp"),L=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(F.strict){let ce=t.utils.charsToString(Z,V,C.phraseLength);F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:`Back reference operator(${ce}) found - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBkrOp"),_=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(F.strict){let ce=t.utils.charsToString(Z,V,C.phraseLength);F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:`UDT operator found(${ce}) - strict ABNF specified.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synUdtOp"),R=s(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.tlsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsOpen"),H=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:F.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.stringTabChar!==!1&&F.errors.push({line:F.findLine(F.lines,F.stringTabChar),char:F.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string (see 'quoted-string' definition, RFC 7405.)"});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsString"),$=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.stringTabChar=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synStringTab"),j=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.errors.push({line:F.findLine(F.lines,i.tlsOpen),char:i.tlsOpen,msg:'Case-insensitive literal string("...") opened but not closed.'}),i.basicError=!0,i.tlsOpen=null;break;case n.MATCH:i.tlsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synTlsClose"),D=s(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.clsOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsOpen"),B=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:F.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.stringTabChar!==!1&&F.errors.push({line:F.findLine(F.lines,F.stringTabChar),char:F.stringTabChar,msg:"Tab character (\\t, x09) not allowed in literal string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsString"),U=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.errors.push({line:F.findLine(F.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive literal string('...') opened but not closed."}),i.clsOpen=null,i.basicError=!0;break;case n.MATCH:F.strict&&F.errors.push({line:F.findLine(F.lines,i.clsOpen),char:i.clsOpen,msg:"Case-sensitive string operator('...') found - strict ABNF specified."}),i.clsOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synClsClose"),Y=s(function(C,Z,V){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.prosValOpen=V;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValOpen"),b=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:F.stringTabChar=!1;break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.stringTabChar!==!1&&F.errors.push({line:F.findLine(F.lines,F.stringTabChar),char:F.stringTabChar,msg:"Tab character (\\t, x09) not allowed in prose value string."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValString"),u=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.errors.push({line:F.findLine(F.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) opened but not closed."}),i.basicError=!0,i.prosValOpen=null;break;case n.MATCH:F.errors.push({line:F.findLine(F.lines,i.prosValOpen),char:i.prosValOpen,msg:"Prose value operator(<...>) found. The ABNF syntax is valid, but a parser cannot be generated from this grammar."}),i.prosValOpen=null;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synProsValClose"),p=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:V,groupError:!1,optionOpen:null,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},F.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupOpen"),m=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.errors.push({line:F.findLine(F.lines,i.groupOpen),char:i.groupOpen,msg:'Group "(...)" opened but not closed.'}),i=F.altStack.pop(),i.groupError=!0;break;case n.MATCH:i=F.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synGroupClose"),w=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i={groupOpen:null,groupError:!1,optionOpen:V,optionError:!1,tlsOpen:null,clsOpen:null,prosValOpen:null,basicError:!1},F.altStack.push(i);break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionOpen"),S=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.errors.push({line:F.findLine(F.lines,i.optionOpen),char:i.optionOpen,msg:'Option "[...]" opened but not closed.'}),i=F.altStack.pop(),i.optionError=!0;break;case n.MATCH:i=F.altStack.pop();break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synOptionClose"),N=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:i.basicError===!1&&F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Unrecognized SABNF element."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synBasicElementError"),I=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:if(C.phraseLength===1&&F.strict){let ce=Z[V]===13?"CR":"LF";F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:`Line end '${ce}' found - strict ABNF specified, only CRLF allowed.`})}break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEnd"),T=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:break;case n.MATCH:F.errors.push({line:F.findLine(F.lines,V,F.charsLength),char:V,msg:"Unrecognized grammar element or characters."});break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synLineEndError"),g=s(function(C,Z,V,F){switch(C.state){case n.ACTIVE:break;case n.EMPTY:break;case n.NOMATCH:F.repCount+=1;break;case n.MATCH:F.repCount+=1;break;default:throw new Error(`${e}synFile: unrecognized case.`)}},"synRepetition");this.callbacks=[],this.callbacks.andop=h,this.callbacks.basicelementerr=N,this.callbacks.clsclose=U,this.callbacks.clsopen=D,this.callbacks.clsstring=B,this.callbacks.definedaserror=l,this.callbacks.file=o,this.callbacks.groupclose=m,this.callbacks.groupopen=p,this.callbacks.lineenderror=T,this.callbacks.lineend=I,this.callbacks.notop=d,this.callbacks.optionclose=S,this.callbacks.optionopen=w,this.callbacks.prosvalclose=u,this.callbacks.prosvalopen=Y,this.callbacks.prosvalstring=b,this.callbacks.repetition=g,this.callbacks.rule=a,this.callbacks.ruleerror=f,this.callbacks.rulenameerror=c,this.callbacks.stringtab=$,this.callbacks.tlsclose=j,this.callbacks.tlsopen=R,this.callbacks.tlsstring=H,this.callbacks.udtop=_,this.callbacks.bkaop=y,this.callbacks.bknop=A,this.callbacks.bkrop=L,this.callbacks.abgop=v,this.callbacks.aenop=x},"exports")});var X3=de((O$,Y3)=>{Y3.exports=s(function(){let e=wa(),t=e.ids,n=s(function(){this.names=[],this.add=s(function(ee){let fe=-1;return this.get(ee)===-1&&(fe={name:ee,lower:ee.toLowerCase(),index:this.names.length},this.names.push(fe)),fe},"add"),this.get=s(function(ee){let fe=-1,K=ee.toLowerCase();for(let ie=0;ie<this.names.length;ie+=1)if(this.names[ie].lower===K){fe=this.names[ie];break}return fe},"get")},"NameList"),i=s(function(pe,ee,fe){let K=0;for(let ie=ee;ie<ee+fe;ie+=1)K=10*K+pe[ie]-48;return K},"decnum"),o=s(function(pe,ee,fe){let K=0;for(let ie=ee;ie<ee+fe;ie+=1)K=2*K+pe[ie]-48;return K},"binnum"),a=s(function(pe,ee,fe){let K=0;for(let ie=ee;ie<ee+fe;ie+=1){let me=pe[ie];if(me>=48&&me<=57)me-=48;else if(me>=65&&me<=70)me-=55;else if(me>=97&&me<=102)me-=87;else throw new Error("hexnum out of range");K=16*K+me}return K},"hexnum");function f(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_PRE)K.ruleNames=new n,K.udtNames=new n,K.rules=[],K.udts=[],K.rulesLineMap=[],K.opcodes=[],K.altStack=[],K.topStack=null,K.topRule=null;else if(G===t.SEM_POST){let me;K.rules.forEach(Te=>{Te.isBkr=!1,Te.opcodes.forEach(Ie=>{Ie.type===t.RNM&&(me=K.ruleNames.get(Ie.index.name),me===-1?(K.errors.push({line:K.findLine(K.lines,Ie.index.phraseIndex,K.charsLength),char:Ie.index.phraseIndex,msg:`Rule name '${Ie.index.name}' used but not defined.`}),Ie.index=-1):Ie.index=me.index)})}),K.udts.forEach(Te=>{Te.isBkr=!1}),K.rules.forEach(Te=>{Te.opcodes.forEach(Ie=>{Ie.type===t.BKR&&(Te.hasBkr=!0,me=K.ruleNames.get(Ie.index.name),me!==-1?(K.rules[me.index].isBkr=!0,Ie.index=me.index):(me=K.udtNames.get(Ie.index.name),me!==-1?(K.udts[me.index].isBkr=!0,Ie.index=K.rules.length+me.index):(K.errors.push({line:K.findLine(K.lines,Ie.index.phraseIndex,K.charsLength),char:Ie.index.phraseIndex,msg:`Back reference name '${Ie.index.name}' refers to undefined rule or unamed UDT.`}),Ie.index=-1)))})})}return ie}s(f,"semFile");function c(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE&&(K.altStack.length=0,K.topStack=null,K.rulesLineMap.push({line:K.findLine(K.lines,ee,K.charsLength),char:ee})),ie}s(c,"semRule");function l(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_PRE)K.ruleName="",K.definedas="";else if(G===t.SEM_POST){let me;K.definedas==="="?(me=K.ruleNames.add(K.ruleName),me===-1?(K.definedas=null,K.errors.push({line:K.findLine(K.lines,ee,K.charsLength),char:ee,msg:`Rule name '${K.ruleName}' previously defined.`})):(K.topRule={name:me.name,lower:me.lower,opcodes:[],index:me.index},K.rules.push(K.topRule),K.opcodes=K.topRule.opcodes)):(me=K.ruleNames.get(K.ruleName),me===-1?(K.definedas=null,K.errors.push({line:K.findLine(K.lines,ee,K.charsLength),char:ee,msg:`Rule name '${K.ruleName}' for incremental alternate not previously defined.`})):(K.topRule=K.rules[me.index],K.opcodes=K.topRule.opcodes))}return ie}s(l,"semRuleLookup");function h(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_PRE)for(;;){if(K.definedas===null){ie=t.SEM_SKIP;break}if(K.topStack===null){if(K.definedas==="="){K.topStack={alt:{type:t.ALT,children:[]},cat:null},K.altStack.push(K.topStack),K.opcodes.push(K.topStack.alt);break}K.topStack={alt:K.opcodes[0],cat:null},K.altStack.push(K.topStack);break}K.topStack={alt:{type:t.ALT,children:[]},cat:null},K.altStack.push(K.topStack),K.opcodes.push(K.topStack.alt);break}else G===t.SEM_POST&&(K.altStack.pop(),K.altStack.length>0?K.topStack=K.altStack[K.altStack.length-1]:K.topStack=null);return ie}s(h,"semAlternation");function d(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE?(K.topStack.alt.children.push(K.opcodes.length),K.topStack.cat={type:t.CAT,children:[]},K.opcodes.push(K.topStack.cat)):G===t.SEM_POST&&(K.topStack.cat=null),ie}s(d,"semConcatenation");function y(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE&&K.topStack.cat.children.push(K.opcodes.length),ie}s(y,"semRepetition");function A(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.REP,min:0,max:1,char:ee}),ie}s(A,"semOptionOpen");function v(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE&&(K.ruleName=e.utils.charsToString(pe,ee,fe)),ie}s(v,"semRuleName");function x(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.definedas="="),ie}s(x,"semDefined");function L(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.definedas="=/"),ie}s(L,"semIncAlt");function _(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE?(K.min=0,K.max=1/0,K.topRep={type:t.REP,min:0,max:1/0},K.opcodes.push(K.topRep)):G===t.SEM_POST&&(K.min>K.max&&K.errors.push({line:K.findLine(K.lines,ee,K.charsLength),char:ee,msg:`repetition min cannot be greater than max: min: ${K.min}: max: ${K.max}`}),K.topRep.min=K.min,K.topRep.max=K.max),ie}s(_,"semRepOp");function R(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.min=i(pe,ee,fe)),ie}s(R,"semRepMin");function H(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.max=i(pe,ee,fe)),ie}s(H,"semRepMax");function $(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.max=i(pe,ee,fe),K.min=K.max),ie}s($,"semRepMinMax");function j(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.AND}),ie}s(j,"semAndOp");function D(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.NOT}),ie}s(D,"semNotOp");function B(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.RNM,index:{phraseIndex:ee,name:e.utils.charsToString(pe,ee,fe)}}),ie}s(B,"semRnmOp");function U(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.ABG}),ie}s(U,"semAbgOp");function Y(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.AEN}),ie}s(Y,"semAenOp");function b(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.BKA}),ie}s(b,"semBkaOp");function u(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.opcodes.push({type:t.BKN}),ie}s(u,"semBknOp");function p(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE?(K.ci=!0,K.cs=!1,K.um=!0,K.pm=!1):G===t.SEM_POST&&K.opcodes.push({type:t.BKR,bkrCase:K.cs===!0?t.BKR_MODE_CS:t.BKR_MODE_CI,bkrMode:K.pm===!0?t.BKR_MODE_PM:t.BKR_MODE_UM,index:{phraseIndex:K.bkrname.phraseIndex,name:e.utils.charsToString(pe,K.bkrname.phraseIndex,K.bkrname.phraseLength)}}),ie}s(p,"semBkrOp");function m(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.ci=!0),ie}s(m,"semBkrCi");function w(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.cs=!0),ie}s(w,"semBkrCs");function S(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.um=!0),ie}s(S,"semBkrUm");function N(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.pm=!0),ie}s(N,"semBkrPm");function I(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.bkrname={phraseIndex:ee,phraseLength:fe}),ie}s(I,"semBkrName");function T(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_POST){let me=e.utils.charsToString(pe,ee,fe),Te=K.udtNames.add(me);if(Te===-1){if(Te=K.udtNames.get(me),Te===-1)throw new Error("semUdtEmpty: name look up error")}else K.udts.push({name:Te.name,lower:Te.lower,index:Te.index,empty:!0});K.opcodes.push({type:t.UDT,empty:!0,index:Te.index})}return ie}s(T,"semUdtEmpty");function g(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_POST){let me=e.utils.charsToString(pe,ee,fe),Te=K.udtNames.add(me);if(Te===-1){if(Te=K.udtNames.get(me),Te===-1)throw new Error("semUdtNonEmpty: name look up error")}else K.udts.push({name:Te.name,lower:Te.lower,index:Te.index,empty:!1});K.opcodes.push({type:t.UDT,empty:!1,index:Te.index,syntax:null,semantic:null})}return ie}s(g,"semUdtNonEmpty");function C(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE&&(K.tlscase=!0),ie}s(C,"semTlsOp");function Z(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&fe>0&&(pe[ee+1]===83||pe[ee+1]===115)&&(K.tlscase=!1),ie}s(Z,"semTlsCase");function V(G,pe,ee,fe,K){let ie=t.SEM_OK;if(G===t.SEM_POST)if(K.tlscase){let me=pe.slice(ee,ee+fe);for(let Te=0;Te<me.length;Te+=1)me[Te]>=65&&me[Te]<=90&&(me[Te]+=32);K.opcodes.push({type:t.TLS,string:me})}else K.opcodes.push({type:t.TBS,string:pe.slice(ee,ee+fe)});return ie}s(V,"semTlsString");function F(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(fe<=2?K.opcodes.push({type:t.TLS,string:[]}):K.opcodes.push({type:t.TBS,string:pe.slice(ee+1,ee+fe-1)})),ie}s(F,"semClsOp");function ce(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE?K.tbsstr=[]:G===t.SEM_POST&&K.opcodes.push({type:t.TBS,string:K.tbsstr}),ie}s(ce,"semTbsOp");function E(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_PRE?(K.min=0,K.max=0):G===t.SEM_POST&&(K.min>K.max&&K.errors.push({line:K.findLine(K.lines,ee,K.charsLength),char:ee,msg:`TRG, (%dmin-max), min cannot be greater than max: min: ${K.min}: max: ${K.max}`}),K.opcodes.push({type:t.TRG,min:K.min,max:K.max})),ie}s(E,"semTrgOp");function X(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.min=i(pe,ee,fe)),ie}s(X,"semDmin");function Q(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.max=i(pe,ee,fe)),ie}s(Q,"semDmax");function P(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.min=o(pe,ee,fe)),ie}s(P,"semBmin");function O(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.max=o(pe,ee,fe)),ie}s(O,"semBmax");function z(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.min=a(pe,ee,fe)),ie}s(z,"semXmin");function J(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&(K.max=a(pe,ee,fe)),ie}s(J,"semXmax");function re(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.tbsstr.push(i(pe,ee,fe)),ie}s(re,"semDstring");function le(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.tbsstr.push(o(pe,ee,fe)),ie}s(le,"semBstring");function se(G,pe,ee,fe,K){let ie=t.SEM_OK;return G===t.SEM_POST&&K.tbsstr.push(a(pe,ee,fe)),ie}s(se,"semXstring"),this.callbacks=[],this.callbacks.abgop=U,this.callbacks.aenop=Y,this.callbacks.alternation=h,this.callbacks.andop=j,this.callbacks.bmax=O,this.callbacks.bmin=P,this.callbacks.bkaop=b,this.callbacks.bknop=u,this.callbacks.bkrop=p,this.callbacks["bkr-name"]=I,this.callbacks.bstring=le,this.callbacks.clsop=F,this.callbacks.ci=m,this.callbacks.cs=w,this.callbacks.um=S,this.callbacks.pm=N,this.callbacks.concatenation=d,this.callbacks.defined=x,this.callbacks.dmax=Q,this.callbacks.dmin=X,this.callbacks.dstring=re,this.callbacks.file=f,this.callbacks.incalt=L,this.callbacks.notop=D,this.callbacks.optionopen=A,this.callbacks["rep-max"]=H,this.callbacks["rep-min"]=R,this.callbacks["rep-min-max"]=$,this.callbacks.repetition=y,this.callbacks.repop=_,this.callbacks.rnmop=B,this.callbacks.rule=c,this.callbacks.rulelookup=l,this.callbacks.rulename=v,this.callbacks.tbsop=ce,this.callbacks.tlscase=Z,this.callbacks.tlsstring=V,this.callbacks.tlsop=C,this.callbacks.trgop=E,this.callbacks["udt-empty"]=T,this.callbacks["udt-non-empty"]=g,this.callbacks.xmax=J,this.callbacks.xmin=z,this.callbacks.xstring=se},"exports")});var Q3=de((P$,Z3)=>{Z3.exports=s(function(){this.grammarObject="grammarObject",this.rules=[],this.rules[0]={name:"File",lower:"file",index:0,isBkr:!1},this.rules[1]={name:"BlankLine",lower:"blankline",index:1,isBkr:!1},this.rules[2]={name:"Rule",lower:"rule",index:2,isBkr:!1},this.rules[3]={name:"RuleLookup",lower:"rulelookup",index:3,isBkr:!1},this.rules[4]={name:"RuleNameTest",lower:"rulenametest",index:4,isBkr:!1},this.rules[5]={name:"RuleName",lower:"rulename",index:5,isBkr:!1},this.rules[6]={name:"RuleNameError",lower:"rulenameerror",index:6,isBkr:!1},this.rules[7]={name:"DefinedAsTest",lower:"definedastest",index:7,isBkr:!1},this.rules[8]={name:"DefinedAsError",lower:"definedaserror",index:8,isBkr:!1},this.rules[9]={name:"DefinedAs",lower:"definedas",index:9,isBkr:!1},this.rules[10]={name:"Defined",lower:"defined",index:10,isBkr:!1},this.rules[11]={name:"IncAlt",lower:"incalt",index:11,isBkr:!1},this.rules[12]={name:"RuleError",lower:"ruleerror",index:12,isBkr:!1},this.rules[13]={name:"LineEndError",lower:"lineenderror",index:13,isBkr:!1},this.rules[14]={name:"Alternation",lower:"alternation",index:14,isBkr:!1},this.rules[15]={name:"Concatenation",lower:"concatenation",index:15,isBkr:!1},this.rules[16]={name:"Repetition",lower:"repetition",index:16,isBkr:!1},this.rules[17]={name:"Modifier",lower:"modifier",index:17,isBkr:!1},this.rules[18]={name:"Predicate",lower:"predicate",index:18,isBkr:!1},this.rules[19]={name:"BasicElement",lower:"basicelement",index:19,isBkr:!1},this.rules[20]={name:"BasicElementErr",lower:"basicelementerr",index:20,isBkr:!1},this.rules[21]={name:"Group",lower:"group",index:21,isBkr:!1},this.rules[22]={name:"GroupError",lower:"grouperror",index:22,isBkr:!1},this.rules[23]={name:"GroupOpen",lower:"groupopen",index:23,isBkr:!1},this.rules[24]={name:"GroupClose",lower:"groupclose",index:24,isBkr:!1},this.rules[25]={name:"Option",lower:"option",index:25,isBkr:!1},this.rules[26]={name:"OptionError",lower:"optionerror",index:26,isBkr:!1},this.rules[27]={name:"OptionOpen",lower:"optionopen",index:27,isBkr:!1},this.rules[28]={name:"OptionClose",lower:"optionclose",index:28,isBkr:!1},this.rules[29]={name:"RnmOp",lower:"rnmop",index:29,isBkr:!1},this.rules[30]={name:"BkrOp",lower:"bkrop",index:30,isBkr:!1},this.rules[31]={name:"bkrModifier",lower:"bkrmodifier",index:31,isBkr:!1},this.rules[32]={name:"cs",lower:"cs",index:32,isBkr:!1},this.rules[33]={name:"ci",lower:"ci",index:33,isBkr:!1},this.rules[34]={name:"um",lower:"um",index:34,isBkr:!1},this.rules[35]={name:"pm",lower:"pm",index:35,isBkr:!1},this.rules[36]={name:"bkr-name",lower:"bkr-name",index:36,isBkr:!1},this.rules[37]={name:"rname",lower:"rname",index:37,isBkr:!1},this.rules[38]={name:"uname",lower:"uname",index:38,isBkr:!1},this.rules[39]={name:"ename",lower:"ename",index:39,isBkr:!1},this.rules[40]={name:"UdtOp",lower:"udtop",index:40,isBkr:!1},this.rules[41]={name:"udt-non-empty",lower:"udt-non-empty",index:41,isBkr:!1},this.rules[42]={name:"udt-empty",lower:"udt-empty",index:42,isBkr:!1},this.rules[43]={name:"RepOp",lower:"repop",index:43,isBkr:!1},this.rules[44]={name:"AltOp",lower:"altop",index:44,isBkr:!1},this.rules[45]={name:"CatOp",lower:"catop",index:45,isBkr:!1},this.rules[46]={name:"StarOp",lower:"starop",index:46,isBkr:!1},this.rules[47]={name:"AndOp",lower:"andop",index:47,isBkr:!1},this.rules[48]={name:"NotOp",lower:"notop",index:48,isBkr:!1},this.rules[49]={name:"BkaOp",lower:"bkaop",index:49,isBkr:!1},this.rules[50]={name:"BknOp",lower:"bknop",index:50,isBkr:!1},this.rules[51]={name:"AbgOp",lower:"abgop",index:51,isBkr:!1},this.rules[52]={name:"AenOp",lower:"aenop",index:52,isBkr:!1},this.rules[53]={name:"TrgOp",lower:"trgop",index:53,isBkr:!1},this.rules[54]={name:"TbsOp",lower:"tbsop",index:54,isBkr:!1},this.rules[55]={name:"TlsOp",lower:"tlsop",index:55,isBkr:!1},this.rules[56]={name:"TlsCase",lower:"tlscase",index:56,isBkr:!1},this.rules[57]={name:"TlsOpen",lower:"tlsopen",index:57,isBkr:!1},this.rules[58]={name:"TlsClose",lower:"tlsclose",index:58,isBkr:!1},this.rules[59]={name:"TlsString",lower:"tlsstring",index:59,isBkr:!1},this.rules[60]={name:"StringTab",lower:"stringtab",index:60,isBkr:!1},this.rules[61]={name:"ClsOp",lower:"clsop",index:61,isBkr:!1},this.rules[62]={name:"ClsOpen",lower:"clsopen",index:62,isBkr:!1},this.rules[63]={name:"ClsClose",lower:"clsclose",index:63,isBkr:!1},this.rules[64]={name:"ClsString",lower:"clsstring",index:64,isBkr:!1},this.rules[65]={name:"ProsVal",lower:"prosval",index:65,isBkr:!1},this.rules[66]={name:"ProsValOpen",lower:"prosvalopen",index:66,isBkr:!1},this.rules[67]={name:"ProsValString",lower:"prosvalstring",index:67,isBkr:!1},this.rules[68]={name:"ProsValClose",lower:"prosvalclose",index:68,isBkr:!1},this.rules[69]={name:"rep-min",lower:"rep-min",index:69,isBkr:!1},this.rules[70]={name:"rep-min-max",lower:"rep-min-max",index:70,isBkr:!1},this.rules[71]={name:"rep-max",lower:"rep-max",index:71,isBkr:!1},this.rules[72]={name:"rep-num",lower:"rep-num",index:72,isBkr:!1},this.rules[73]={name:"dString",lower:"dstring",index:73,isBkr:!1},this.rules[74]={name:"xString",lower:"xstring",index:74,isBkr:!1},this.rules[75]={name:"bString",lower:"bstring",index:75,isBkr:!1},this.rules[76]={name:"Dec",lower:"dec",index:76,isBkr:!1},this.rules[77]={name:"Hex",lower:"hex",index:77,isBkr:!1},this.rules[78]={name:"Bin",lower:"bin",index:78,isBkr:!1},this.rules[79]={name:"dmin",lower:"dmin",index:79,isBkr:!1},this.rules[80]={name:"dmax",lower:"dmax",index:80,isBkr:!1},this.rules[81]={name:"bmin",lower:"bmin",index:81,isBkr:!1},this.rules[82]={name:"bmax",lower:"bmax",index:82,isBkr:!1},this.rules[83]={name:"xmin",lower:"xmin",index:83,isBkr:!1},this.rules[84]={name:"xmax",lower:"xmax",index:84,isBkr:!1},this.rules[85]={name:"dnum",lower:"dnum",index:85,isBkr:!1},this.rules[86]={name:"bnum",lower:"bnum",index:86,isBkr:!1},this.rules[87]={name:"xnum",lower:"xnum",index:87,isBkr:!1},this.rules[88]={name:"alphanum",lower:"alphanum",index:88,isBkr:!1},this.rules[89]={name:"owsp",lower:"owsp",index:89,isBkr:!1},this.rules[90]={name:"wsp",lower:"wsp",index:90,isBkr:!1},this.rules[91]={name:"space",lower:"space",index:91,isBkr:!1},this.rules[92]={name:"comment",lower:"comment",index:92,isBkr:!1},this.rules[93]={name:"LineEnd",lower:"lineend",index:93,isBkr:!1},this.rules[94]={name:"LineContinue",lower:"linecontinue",index:94,isBkr:!1},this.udts=[],this.rules[0].opcodes=[],this.rules[0].opcodes[0]={type:3,min:0,max:1/0},this.rules[0].opcodes[1]={type:1,children:[2,3,4]},this.rules[0].opcodes[2]={type:4,index:1},this.rules[0].opcodes[3]={type:4,index:2},this.rules[0].opcodes[4]={type:4,index:12},this.rules[1].opcodes=[],this.rules[1].opcodes[0]={type:2,children:[1,5,7]},this.rules[1].opcodes[1]={type:3,min:0,max:1/0},this.rules[1].opcodes[2]={type:1,children:[3,4]},this.rules[1].opcodes[3]={type:6,string:[32]},this.rules[1].opcodes[4]={type:6,string:[9]},this.rules[1].opcodes[5]={type:3,min:0,max:1},this.rules[1].opcodes[6]={type:4,index:92},this.rules[1].opcodes[7]={type:4,index:93},this.rules[2].opcodes=[],this.rules[2].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[2].opcodes[1]={type:4,index:3},this.rules[2].opcodes[2]={type:4,index:89},this.rules[2].opcodes[3]={type:4,index:14},this.rules[2].opcodes[4]={type:1,children:[5,8]},this.rules[2].opcodes[5]={type:2,children:[6,7]},this.rules[2].opcodes[6]={type:4,index:89},this.rules[2].opcodes[7]={type:4,index:93},this.rules[2].opcodes[8]={type:2,children:[9,10]},this.rules[2].opcodes[9]={type:4,index:13},this.rules[2].opcodes[10]={type:4,index:93},this.rules[3].opcodes=[],this.rules[3].opcodes[0]={type:2,children:[1,2,3]},this.rules[3].opcodes[1]={type:4,index:4},this.rules[3].opcodes[2]={type:4,index:89},this.rules[3].opcodes[3]={type:4,index:7},this.rules[4].opcodes=[],this.rules[4].opcodes[0]={type:1,children:[1,2]},this.rules[4].opcodes[1]={type:4,index:5},this.rules[4].opcodes[2]={type:4,index:6},this.rules[5].opcodes=[],this.rules[5].opcodes[0]={type:4,index:88},this.rules[6].opcodes=[],this.rules[6].opcodes[0]={type:3,min:1,max:1/0},this.rules[6].opcodes[1]={type:1,children:[2,3]},this.rules[6].opcodes[2]={type:5,min:33,max:60},this.rules[6].opcodes[3]={type:5,min:62,max:126},this.rules[7].opcodes=[],this.rules[7].opcodes[0]={type:1,children:[1,2]},this.rules[7].opcodes[1]={type:4,index:9},this.rules[7].opcodes[2]={type:4,index:8},this.rules[8].opcodes=[],this.rules[8].opcodes[0]={type:3,min:1,max:2},this.rules[8].opcodes[1]={type:5,min:33,max:126},this.rules[9].opcodes=[],this.rules[9].opcodes[0]={type:1,children:[1,2]},this.rules[9].opcodes[1]={type:4,index:11},this.rules[9].opcodes[2]={type:4,index:10},this.rules[10].opcodes=[],this.rules[10].opcodes[0]={type:6,string:[61]},this.rules[11].opcodes=[],this.rules[11].opcodes[0]={type:6,string:[61,47]},this.rules[12].opcodes=[],this.rules[12].opcodes[0]={type:2,children:[1,6]},this.rules[12].opcodes[1]={type:3,min:1,max:1/0},this.rules[12].opcodes[2]={type:1,children:[3,4,5]},this.rules[12].opcodes[3]={type:5,min:32,max:126},this.rules[12].opcodes[4]={type:6,string:[9]},this.rules[12].opcodes[5]={type:4,index:94},this.rules[12].opcodes[6]={type:4,index:93},this.rules[13].opcodes=[],this.rules[13].opcodes[0]={type:3,min:1,max:1/0},this.rules[13].opcodes[1]={type:1,children:[2,3,4]},this.rules[13].opcodes[2]={type:5,min:32,max:126},this.rules[13].opcodes[3]={type:6,string:[9]},this.rules[13].opcodes[4]={type:4,index:94},this.rules[14].opcodes=[],this.rules[14].opcodes[0]={type:2,children:[1,2]},this.rules[14].opcodes[1]={type:4,index:15},this.rules[14].opcodes[2]={type:3,min:0,max:1/0},this.rules[14].opcodes[3]={type:2,children:[4,5,6]},this.rules[14].opcodes[4]={type:4,index:89},this.rules[14].opcodes[5]={type:4,index:44},this.rules[14].opcodes[6]={type:4,index:15},this.rules[15].opcodes=[],this.rules[15].opcodes[0]={type:2,children:[1,2]},this.rules[15].opcodes[1]={type:4,index:16},this.rules[15].opcodes[2]={type:3,min:0,max:1/0},this.rules[15].opcodes[3]={type:2,children:[4,5]},this.rules[15].opcodes[4]={type:4,index:45},this.rules[15].opcodes[5]={type:4,index:16},this.rules[16].opcodes=[],this.rules[16].opcodes[0]={type:2,children:[1,3]},this.rules[16].opcodes[1]={type:3,min:0,max:1},this.rules[16].opcodes[2]={type:4,index:17},this.rules[16].opcodes[3]={type:1,children:[4,5,6,7]},this.rules[16].opcodes[4]={type:4,index:21},this.rules[16].opcodes[5]={type:4,index:25},this.rules[16].opcodes[6]={type:4,index:19},this.rules[16].opcodes[7]={type:4,index:20},this.rules[17].opcodes=[],this.rules[17].opcodes[0]={type:1,children:[1,5]},this.rules[17].opcodes[1]={type:2,children:[2,3]},this.rules[17].opcodes[2]={type:4,index:18},this.rules[17].opcodes[3]={type:3,min:0,max:1},this.rules[17].opcodes[4]={type:4,index:43},this.rules[17].opcodes[5]={type:4,index:43},this.rules[18].opcodes=[],this.rules[18].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[18].opcodes[1]={type:4,index:49},this.rules[18].opcodes[2]={type:4,index:50},this.rules[18].opcodes[3]={type:4,index:47},this.rules[18].opcodes[4]={type:4,index:48},this.rules[19].opcodes=[],this.rules[19].opcodes[0]={type:1,children:[1,2,3,4,5,6,7,8,9,10]},this.rules[19].opcodes[1]={type:4,index:40},this.rules[19].opcodes[2]={type:4,index:29},this.rules[19].opcodes[3]={type:4,index:53},this.rules[19].opcodes[4]={type:4,index:54},this.rules[19].opcodes[5]={type:4,index:55},this.rules[19].opcodes[6]={type:4,index:61},this.rules[19].opcodes[7]={type:4,index:30},this.rules[19].opcodes[8]={type:4,index:51},this.rules[19].opcodes[9]={type:4,index:52},this.rules[19].opcodes[10]={type:4,index:65},this.rules[20].opcodes=[],this.rules[20].opcodes[0]={type:3,min:1,max:1/0},this.rules[20].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[20].opcodes[2]={type:5,min:33,max:40},this.rules[20].opcodes[3]={type:5,min:42,max:46},this.rules[20].opcodes[4]={type:5,min:48,max:92},this.rules[20].opcodes[5]={type:5,min:94,max:126},this.rules[21].opcodes=[],this.rules[21].opcodes[0]={type:2,children:[1,2,3]},this.rules[21].opcodes[1]={type:4,index:23},this.rules[21].opcodes[2]={type:4,index:14},this.rules[21].opcodes[3]={type:1,children:[4,5]},this.rules[21].opcodes[4]={type:4,index:24},this.rules[21].opcodes[5]={type:4,index:22},this.rules[22].opcodes=[],this.rules[22].opcodes[0]={type:3,min:1,max:1/0},this.rules[22].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[22].opcodes[2]={type:5,min:33,max:40},this.rules[22].opcodes[3]={type:5,min:42,max:46},this.rules[22].opcodes[4]={type:5,min:48,max:92},this.rules[22].opcodes[5]={type:5,min:94,max:126},this.rules[23].opcodes=[],this.rules[23].opcodes[0]={type:2,children:[1,2]},this.rules[23].opcodes[1]={type:6,string:[40]},this.rules[23].opcodes[2]={type:4,index:89},this.rules[24].opcodes=[],this.rules[24].opcodes[0]={type:2,children:[1,2]},this.rules[24].opcodes[1]={type:4,index:89},this.rules[24].opcodes[2]={type:6,string:[41]},this.rules[25].opcodes=[],this.rules[25].opcodes[0]={type:2,children:[1,2,3]},this.rules[25].opcodes[1]={type:4,index:27},this.rules[25].opcodes[2]={type:4,index:14},this.rules[25].opcodes[3]={type:1,children:[4,5]},this.rules[25].opcodes[4]={type:4,index:28},this.rules[25].opcodes[5]={type:4,index:26},this.rules[26].opcodes=[],this.rules[26].opcodes[0]={type:3,min:1,max:1/0},this.rules[26].opcodes[1]={type:1,children:[2,3,4,5]},this.rules[26].opcodes[2]={type:5,min:33,max:40},this.rules[26].opcodes[3]={type:5,min:42,max:46},this.rules[26].opcodes[4]={type:5,min:48,max:92},this.rules[26].opcodes[5]={type:5,min:94,max:126},this.rules[27].opcodes=[],this.rules[27].opcodes[0]={type:2,children:[1,2]},this.rules[27].opcodes[1]={type:6,string:[91]},this.rules[27].opcodes[2]={type:4,index:89},this.rules[28].opcodes=[],this.rules[28].opcodes[0]={type:2,children:[1,2]},this.rules[28].opcodes[1]={type:4,index:89},this.rules[28].opcodes[2]={type:6,string:[93]},this.rules[29].opcodes=[],this.rules[29].opcodes[0]={type:4,index:88},this.rules[30].opcodes=[],this.rules[30].opcodes[0]={type:2,children:[1,2,4]},this.rules[30].opcodes[1]={type:6,string:[92]},this.rules[30].opcodes[2]={type:3,min:0,max:1},this.rules[30].opcodes[3]={type:4,index:31},this.rules[30].opcodes[4]={type:4,index:36},this.rules[31].opcodes=[],this.rules[31].opcodes[0]={type:1,children:[1,7,13,19]},this.rules[31].opcodes[1]={type:2,children:[2,3]},this.rules[31].opcodes[2]={type:4,index:32},this.rules[31].opcodes[3]={type:3,min:0,max:1},this.rules[31].opcodes[4]={type:1,children:[5,6]},this.rules[31].opcodes[5]={type:4,index:34},this.rules[31].opcodes[6]={type:4,index:35},this.rules[31].opcodes[7]={type:2,children:[8,9]},this.rules[31].opcodes[8]={type:4,index:33},this.rules[31].opcodes[9]={type:3,min:0,max:1},this.rules[31].opcodes[10]={type:1,children:[11,12]},this.rules[31].opcodes[11]={type:4,index:34},this.rules[31].opcodes[12]={type:4,index:35},this.rules[31].opcodes[13]={type:2,children:[14,15]},this.rules[31].opcodes[14]={type:4,index:34},this.rules[31].opcodes[15]={type:3,min:0,max:1},this.rules[31].opcodes[16]={type:1,children:[17,18]},this.rules[31].opcodes[17]={type:4,index:32},this.rules[31].opcodes[18]={type:4,index:33},this.rules[31].opcodes[19]={type:2,children:[20,21]},this.rules[31].opcodes[20]={type:4,index:35},this.rules[31].opcodes[21]={type:3,min:0,max:1},this.rules[31].opcodes[22]={type:1,children:[23,24]},this.rules[31].opcodes[23]={type:4,index:32},this.rules[31].opcodes[24]={type:4,index:33},this.rules[32].opcodes=[],this.rules[32].opcodes[0]={type:6,string:[37,115]},this.rules[33].opcodes=[],this.rules[33].opcodes[0]={type:6,string:[37,105]},this.rules[34].opcodes=[],this.rules[34].opcodes[0]={type:6,string:[37,117]},this.rules[35].opcodes=[],this.rules[35].opcodes[0]={type:6,string:[37,112]},this.rules[36].opcodes=[],this.rules[36].opcodes[0]={type:1,children:[1,2,3]},this.rules[36].opcodes[1]={type:4,index:38},this.rules[36].opcodes[2]={type:4,index:39},this.rules[36].opcodes[3]={type:4,index:37},this.rules[37].opcodes=[],this.rules[37].opcodes[0]={type:4,index:88},this.rules[38].opcodes=[],this.rules[38].opcodes[0]={type:2,children:[1,2]},this.rules[38].opcodes[1]={type:6,string:[117,95]},this.rules[38].opcodes[2]={type:4,index:88},this.rules[39].opcodes=[],this.rules[39].opcodes[0]={type:2,children:[1,2]},this.rules[39].opcodes[1]={type:6,string:[101,95]},this.rules[39].opcodes[2]={type:4,index:88},this.rules[40].opcodes=[],this.rules[40].opcodes[0]={type:1,children:[1,2]},this.rules[40].opcodes[1]={type:4,index:42},this.rules[40].opcodes[2]={type:4,index:41},this.rules[41].opcodes=[],this.rules[41].opcodes[0]={type:2,children:[1,2]},this.rules[41].opcodes[1]={type:6,string:[117,95]},this.rules[41].opcodes[2]={type:4,index:88},this.rules[42].opcodes=[],this.rules[42].opcodes[0]={type:2,children:[1,2]},this.rules[42].opcodes[1]={type:6,string:[101,95]},this.rules[42].opcodes[2]={type:4,index:88},this.rules[43].opcodes=[],this.rules[43].opcodes[0]={type:1,children:[1,5,8,11,12]},this.rules[43].opcodes[1]={type:2,children:[2,3,4]},this.rules[43].opcodes[2]={type:4,index:69},this.rules[43].opcodes[3]={type:4,index:46},this.rules[43].opcodes[4]={type:4,index:71},this.rules[43].opcodes[5]={type:2,children:[6,7]},this.rules[43].opcodes[6]={type:4,index:69},this.rules[43].opcodes[7]={type:4,index:46},this.rules[43].opcodes[8]={type:2,children:[9,10]},this.rules[43].opcodes[9]={type:4,index:46},this.rules[43].opcodes[10]={type:4,index:71},this.rules[43].opcodes[11]={type:4,index:46},this.rules[43].opcodes[12]={type:4,index:70},this.rules[44].opcodes=[],this.rules[44].opcodes[0]={type:2,children:[1,2]},this.rules[44].opcodes[1]={type:6,string:[47]},this.rules[44].opcodes[2]={type:4,index:89},this.rules[45].opcodes=[],this.rules[45].opcodes[0]={type:4,index:90},this.rules[46].opcodes=[],this.rules[46].opcodes[0]={type:6,string:[42]},this.rules[47].opcodes=[],this.rules[47].opcodes[0]={type:6,string:[38]},this.rules[48].opcodes=[],this.rules[48].opcodes[0]={type:6,string:[33]},this.rules[49].opcodes=[],this.rules[49].opcodes[0]={type:6,string:[38,38]},this.rules[50].opcodes=[],this.rules[50].opcodes[0]={type:6,string:[33,33]},this.rules[51].opcodes=[],this.rules[51].opcodes[0]={type:6,string:[37,94]},this.rules[52].opcodes=[],this.rules[52].opcodes[0]={type:6,string:[37,36]},this.rules[53].opcodes=[],this.rules[53].opcodes[0]={type:2,children:[1,2]},this.rules[53].opcodes[1]={type:6,string:[37]},this.rules[53].opcodes[2]={type:1,children:[3,8,13]},this.rules[53].opcodes[3]={type:2,children:[4,5,6,7]},this.rules[53].opcodes[4]={type:4,index:76},this.rules[53].opcodes[5]={type:4,index:79},this.rules[53].opcodes[6]={type:6,string:[45]},this.rules[53].opcodes[7]={type:4,index:80},this.rules[53].opcodes[8]={type:2,children:[9,10,11,12]},this.rules[53].opcodes[9]={type:4,index:77},this.rules[53].opcodes[10]={type:4,index:83},this.rules[53].opcodes[11]={type:6,string:[45]},this.rules[53].opcodes[12]={type:4,index:84},this.rules[53].opcodes[13]={type:2,children:[14,15,16,17]},this.rules[53].opcodes[14]={type:4,index:78},this.rules[53].opcodes[15]={type:4,index:81},this.rules[53].opcodes[16]={type:6,string:[45]},this.rules[53].opcodes[17]={type:4,index:82},this.rules[54].opcodes=[],this.rules[54].opcodes[0]={type:2,children:[1,2]},this.rules[54].opcodes[1]={type:6,string:[37]},this.rules[54].opcodes[2]={type:1,children:[3,10,17]},this.rules[54].opcodes[3]={type:2,children:[4,5,6]},this.rules[54].opcodes[4]={type:4,index:76},this.rules[54].opcodes[5]={type:4,index:73},this.rules[54].opcodes[6]={type:3,min:0,max:1/0},this.rules[54].opcodes[7]={type:2,children:[8,9]},this.rules[54].opcodes[8]={type:6,string:[46]},this.rules[54].opcodes[9]={type:4,index:73},this.rules[54].opcodes[10]={type:2,children:[11,12,13]},this.rules[54].opcodes[11]={type:4,index:77},this.rules[54].opcodes[12]={type:4,index:74},this.rules[54].opcodes[13]={type:3,min:0,max:1/0},this.rules[54].opcodes[14]={type:2,children:[15,16]},this.rules[54].opcodes[15]={type:6,string:[46]},this.rules[54].opcodes[16]={type:4,index:74},this.rules[54].opcodes[17]={type:2,children:[18,19,20]},this.rules[54].opcodes[18]={type:4,index:78},this.rules[54].opcodes[19]={type:4,index:75},this.rules[54].opcodes[20]={type:3,min:0,max:1/0},this.rules[54].opcodes[21]={type:2,children:[22,23]},this.rules[54].opcodes[22]={type:6,string:[46]},this.rules[54].opcodes[23]={type:4,index:75},this.rules[55].opcodes=[],this.rules[55].opcodes[0]={type:2,children:[1,2,3,4]},this.rules[55].opcodes[1]={type:4,index:56},this.rules[55].opcodes[2]={type:4,index:57},this.rules[55].opcodes[3]={type:4,index:59},this.rules[55].opcodes[4]={type:4,index:58},this.rules[56].opcodes=[],this.rules[56].opcodes[0]={type:3,min:0,max:1},this.rules[56].opcodes[1]={type:1,children:[2,3]},this.rules[56].opcodes[2]={type:7,string:[37,105]},this.rules[56].opcodes[3]={type:7,string:[37,115]},this.rules[57].opcodes=[],this.rules[57].opcodes[0]={type:6,string:[34]},this.rules[58].opcodes=[],this.rules[58].opcodes[0]={type:6,string:[34]},this.rules[59].opcodes=[],this.rules[59].opcodes[0]={type:3,min:0,max:1/0},this.rules[59].opcodes[1]={type:1,children:[2,3,4]},this.rules[59].opcodes[2]={type:5,min:32,max:33},this.rules[59].opcodes[3]={type:5,min:35,max:126},this.rules[59].opcodes[4]={type:4,index:60},this.rules[60].opcodes=[],this.rules[60].opcodes[0]={type:6,string:[9]},this.rules[61].opcodes=[],this.rules[61].opcodes[0]={type:2,children:[1,2,3]},this.rules[61].opcodes[1]={type:4,index:62},this.rules[61].opcodes[2]={type:4,index:64},this.rules[61].opcodes[3]={type:4,index:63},this.rules[62].opcodes=[],this.rules[62].opcodes[0]={type:6,string:[39]},this.rules[63].opcodes=[],this.rules[63].opcodes[0]={type:6,string:[39]},this.rules[64].opcodes=[],this.rules[64].opcodes[0]={type:3,min:0,max:1/0},this.rules[64].opcodes[1]={type:1,children:[2,3,4]},this.rules[64].opcodes[2]={type:5,min:32,max:38},this.rules[64].opcodes[3]={type:5,min:40,max:126},this.rules[64].opcodes[4]={type:4,index:60},this.rules[65].opcodes=[],this.rules[65].opcodes[0]={type:2,children:[1,2,3]},this.rules[65].opcodes[1]={type:4,index:66},this.rules[65].opcodes[2]={type:4,index:67},this.rules[65].opcodes[3]={type:4,index:68},this.rules[66].opcodes=[],this.rules[66].opcodes[0]={type:6,string:[60]},this.rules[67].opcodes=[],this.rules[67].opcodes[0]={type:3,min:0,max:1/0},this.rules[67].opcodes[1]={type:1,children:[2,3,4]},this.rules[67].opcodes[2]={type:5,min:32,max:61},this.rules[67].opcodes[3]={type:5,min:63,max:126},this.rules[67].opcodes[4]={type:4,index:60},this.rules[68].opcodes=[],this.rules[68].opcodes[0]={type:6,string:[62]},this.rules[69].opcodes=[],this.rules[69].opcodes[0]={type:4,index:72},this.rules[70].opcodes=[],this.rules[70].opcodes[0]={type:4,index:72},this.rules[71].opcodes=[],this.rules[71].opcodes[0]={type:4,index:72},this.rules[72].opcodes=[],this.rules[72].opcodes[0]={type:3,min:1,max:1/0},this.rules[72].opcodes[1]={type:5,min:48,max:57},this.rules[73].opcodes=[],this.rules[73].opcodes[0]={type:4,index:85},this.rules[74].opcodes=[],this.rules[74].opcodes[0]={type:4,index:87},this.rules[75].opcodes=[],this.rules[75].opcodes[0]={type:4,index:86},this.rules[76].opcodes=[],this.rules[76].opcodes[0]={type:1,children:[1,2]},this.rules[76].opcodes[1]={type:6,string:[68]},this.rules[76].opcodes[2]={type:6,string:[100]},this.rules[77].opcodes=[],this.rules[77].opcodes[0]={type:1,children:[1,2]},this.rules[77].opcodes[1]={type:6,string:[88]},this.rules[77].opcodes[2]={type:6,string:[120]},this.rules[78].opcodes=[],this.rules[78].opcodes[0]={type:1,children:[1,2]},this.rules[78].opcodes[1]={type:6,string:[66]},this.rules[78].opcodes[2]={type:6,string:[98]},this.rules[79].opcodes=[],this.rules[79].opcodes[0]={type:4,index:85},this.rules[80].opcodes=[],this.rules[80].opcodes[0]={type:4,index:85},this.rules[81].opcodes=[],this.rules[81].opcodes[0]={type:4,index:86},this.rules[82].opcodes=[],this.rules[82].opcodes[0]={type:4,index:86},this.rules[83].opcodes=[],this.rules[83].opcodes[0]={type:4,index:87},this.rules[84].opcodes=[],this.rules[84].opcodes[0]={type:4,index:87},this.rules[85].opcodes=[],this.rules[85].opcodes[0]={type:3,min:1,max:1/0},this.rules[85].opcodes[1]={type:5,min:48,max:57},this.rules[86].opcodes=[],this.rules[86].opcodes[0]={type:3,min:1,max:1/0},this.rules[86].opcodes[1]={type:5,min:48,max:49},this.rules[87].opcodes=[],this.rules[87].opcodes[0]={type:3,min:1,max:1/0},this.rules[87].opcodes[1]={type:1,children:[2,3,4]},this.rules[87].opcodes[2]={type:5,min:48,max:57},this.rules[87].opcodes[3]={type:5,min:65,max:70},this.rules[87].opcodes[4]={type:5,min:97,max:102},this.rules[88].opcodes=[],this.rules[88].opcodes[0]={type:2,children:[1,4]},this.rules[88].opcodes[1]={type:1,children:[2,3]},this.rules[88].opcodes[2]={type:5,min:97,max:122},this.rules[88].opcodes[3]={type:5,min:65,max:90},this.rules[88].opcodes[4]={type:3,min:0,max:1/0},this.rules[88].opcodes[5]={type:1,children:[6,7,8,9]},this.rules[88].opcodes[6]={type:5,min:97,max:122},this.rules[88].opcodes[7]={type:5,min:65,max:90},this.rules[88].opcodes[8]={type:5,min:48,max:57},this.rules[88].opcodes[9]={type:6,string:[45]},this.rules[89].opcodes=[],this.rules[89].opcodes[0]={type:3,min:0,max:1/0},this.rules[89].opcodes[1]={type:4,index:91},this.rules[90].opcodes=[],this.rules[90].opcodes[0]={type:3,min:1,max:1/0},this.rules[90].opcodes[1]={type:4,index:91},this.rules[91].opcodes=[],this.rules[91].opcodes[0]={type:1,children:[1,2,3,4]},this.rules[91].opcodes[1]={type:6,string:[32]},this.rules[91].opcodes[2]={type:6,string:[9]},this.rules[91].opcodes[3]={type:4,index:92},this.rules[91].opcodes[4]={type:4,index:94},this.rules[92].opcodes=[],this.rules[92].opcodes[0]={type:2,children:[1,2]},this.rules[92].opcodes[1]={type:6,string:[59]},this.rules[92].opcodes[2]={type:3,min:0,max:1/0},this.rules[92].opcodes[3]={type:1,children:[4,5]},this.rules[92].opcodes[4]={type:5,min:32,max:126},this.rules[92].opcodes[5]={type:6,string:[9]},this.rules[93].opcodes=[],this.rules[93].opcodes[0]={type:1,children:[1,2,3]},this.rules[93].opcodes[1]={type:6,string:[13,10]},this.rules[93].opcodes[2]={type:6,string:[10]},this.rules[93].opcodes[3]={type:6,string:[13]},this.rules[94].opcodes=[],this.rules[94].opcodes[0]={type:2,children:[1,5]},this.rules[94].opcodes[1]={type:1,children:[2,3,4]},this.rules[94].opcodes[2]={type:6,string:[13,10]},this.rules[94].opcodes[3]={type:6,string:[10]},this.rules[94].opcodes[4]={type:6,string:[13]},this.rules[94].opcodes[5]={type:1,children:[6,7]},this.rules[94].opcodes[6]={type:6,string:[32]},this.rules[94].opcodes[7]={type:6,string:[9]},this.toString=s(function(){let t="";return t+=`;
|
347
347
|
`,t+=`; ABNF for JavaScript APG 2.0 SABNF
|
348
348
|
`,t+=`; RFC 5234 with some restrictions and additions.
|
349
349
|
`,t+=`; Updated 11/24/2015 for RFC 7405 case-sensitive literal string notation
|
@@ -514,150 +514,150 @@ table.apg-attrs a:hover {
|
|
514
514
|
`,t+=` / %d10
|
515
515
|
`,t+=` / %d13
|
516
516
|
`,t+=`LineContinue = (%d13.10 / %d10 / %d13) (%d32 / %d9)
|
517
|
-
`,t},"toString")},"grammar")});var
|
518
|
-
`,
|
519
|
-
`,
|
520
|
-
`,
|
521
|
-
`,
|
522
|
-
`,
|
523
|
-
`,
|
524
|
-
`,
|
525
|
-
`,
|
526
|
-
`,
|
527
|
-
`,
|
528
|
-
`,
|
529
|
-
`,
|
530
|
-
`,
|
531
|
-
`,
|
532
|
-
`,
|
533
|
-
`,
|
534
|
-
`,
|
535
|
-
`,
|
536
|
-
`,
|
537
|
-
`,
|
538
|
-
`,
|
539
|
-
`,
|
540
|
-
`,
|
541
|
-
`,
|
542
|
-
`,
|
543
|
-
`,
|
544
|
-
`,
|
545
|
-
`,
|
546
|
-
`,
|
547
|
-
`,
|
548
|
-
`,
|
549
|
-
`,
|
550
|
-
`,
|
551
|
-
`,
|
552
|
-
`,
|
553
|
-
`,
|
554
|
-
`,
|
555
|
-
`,
|
556
|
-
`,
|
557
|
-
`),
|
558
|
-
`,
|
559
|
-
`,Q.opcodes.forEach((O,z)=>{let
|
560
|
-
`;break;case n.CAT:
|
561
|
-
`;break;case n.RNM:
|
562
|
-
`;break;case n.BKR:O.index>=
|
563
|
-
`;break;case n.UDT:
|
564
|
-
`;break;case n.REP:
|
565
|
-
`;break;case n.AND:
|
566
|
-
`;break;case n.NOT:
|
567
|
-
`;break;case n.ABG:
|
568
|
-
`;break;case n.AEN:
|
569
|
-
`;break;case n.BKA:
|
570
|
-
`;break;case n.BKN:
|
571
|
-
`;break;case n.TLS:
|
572
|
-
`;break;case n.TBS:
|
573
|
-
`;break;case n.TRG:
|
574
|
-
`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}})}),
|
575
|
-
`,
|
576
|
-
`,
|
577
|
-
`;let X;return
|
578
|
-
`}),
|
579
|
-
`,
|
580
|
-
`,
|
581
|
-
`,
|
582
|
-
`,w},"showAttr"),D=
|
517
|
+
`,t},"toString")},"grammar")});var t5=de((R$,e5)=>{e5.exports=s(function(){let e="parser: ",t=wa(),n=t.ids,i=new(J3()),o=new(X3()),a=new(Q3()),f=new t.parser;f.ast=new t.ast,f.callbacks=i.callbacks,f.ast.callbacks=o.callbacks;let c=s(function(y,A,v){if(A<0||A>=v)return-1;for(let x=0;x<y.length;x+=1)if(A>=y[x].beginChar&&A<y[x].beginChar+y[x].length)return x;return-1},"findLine"),l=s(function(y,A){let v=-1;if(A<y.length){for(let x=A;x<y.length;x+=1)if(y[x]!==null){v=y[x];break}}return v},"translateIndex"),h=s(function(y){y.forEach(A=>{let v=[],x=[],L=0;A.opcodes.forEach(_=>{_.type===n.ALT&&_.children.length===1||_.type===n.CAT&&_.children.length===1||_.type===n.REP&&_.min===1&&_.max===1?x.push(null):(x.push(L),v.push(_),L+=1)}),x.push(L),v.forEach(_=>{if(_.type===n.ALT||_.type===n.CAT)for(let R=0;R<_.children.length;R+=1)_.children[R]=l(x,_.children[R])}),A.opcodes=v})},"reduceOpcodes");this.syntax=s(function(y,A,v,x,L){if(L){if(L.traceObject!=="traceObject")throw new TypeError(`${e}trace argument is not a trace object`);f.trace=L}let _={};_.errors=v,_.strict=!!x,_.lines=A,_.findLine=c,_.charsLength=y.length,_.ruleCount=0,f.parse(a,"file",y,_).success||v.push({line:0,char:0,msg:"syntax analysis of input grammar failed"})},"syntax"),this.semantic=s(function(y,A,v){let x={};return x.errors=v,x.lines=A,x.findLine=c,x.charsLength=y.length,f.ast.translate(x),v.length?null:(h(x.rules),{rules:x.rules,udts:x.udts,lineMap:x.rulesLineMap})},"semantic"),this.generateSource=s(function(y,A,v,x,L){let _="",R,H,$,j=0,D=1/0,B=0,U=[],Y=[],b=0,u=0,p=0,m=0,w=0,S=0,N=0,I=0,T=0,g=0,C=0,Z=0,V=0,F=0,ce=0;v.forEach(Q=>{U.push(Q.lower),j+=Q.opcodes.length,Q.opcodes.forEach(P=>{switch(P.type){case n.ALT:b+=1;break;case n.CAT:u+=1;break;case n.RNM:p+=1;break;case n.UDT:m+=1;break;case n.REP:w+=1;break;case n.AND:S+=1;break;case n.NOT:N+=1;break;case n.BKA:Z+=1;break;case n.BKN:V+=1;break;case n.BKR:C+=1;break;case n.ABG:F+=1;break;case n.AEN:ce+=1;break;case n.TLS:for(I+=1,R=0;R<P.string.length;R+=1)P.string[R]<D&&(D=P.string[R]),P.string[R]>B&&(B=P.string[R]);break;case n.TBS:for(T+=1,R=0;R<P.string.length;R+=1)P.string[R]<D&&(D=P.string[R]),P.string[R]>B&&(B=P.string[R]);break;case n.TRG:g+=1,P.min<D&&(D=P.min),P.max>B&&(B=P.max);break;default:throw new Error("generateSource: unrecognized opcode")}})}),U.sort(),x.length>0&&(x.forEach(Q=>{Y.push(Q.lower)}),Y.sort());let E="module.exports";L&&typeof L=="string"&&(E=`let ${L}`),_+=`// copyright: Copyright (c) 2021 Lowell D. Thomas, all rights reserved<br>
|
518
|
+
`,_+=`// license: BSD-2-Clause (https://opensource.org/licenses/BSD-2-Clause)<br>
|
519
|
+
`,_+=`//
|
520
|
+
`,_+=`// Generated by apg-js, Version 4.0.0 [apg-js](https://github.com/ldthomas/apg-js)
|
521
|
+
`,_+=`${E} = function grammar(){
|
522
|
+
`,_+=" // ```\n",_+=` // SUMMARY
|
523
|
+
`,_+=` // rules = ${v.length}
|
524
|
+
`,_+=` // udts = ${x.length}
|
525
|
+
`,_+=` // opcodes = ${j}
|
526
|
+
`,_+=` // --- ABNF original opcodes
|
527
|
+
`,_+=` // ALT = ${b}
|
528
|
+
`,_+=` // CAT = ${u}
|
529
|
+
`,_+=` // REP = ${w}
|
530
|
+
`,_+=` // RNM = ${p}
|
531
|
+
`,_+=` // TLS = ${I}
|
532
|
+
`,_+=` // TBS = ${T}
|
533
|
+
`,_+=` // TRG = ${g}
|
534
|
+
`,_+=` // --- SABNF superset opcodes
|
535
|
+
`,_+=` // UDT = ${m}
|
536
|
+
`,_+=` // AND = ${S}
|
537
|
+
`,_+=` // NOT = ${N}
|
538
|
+
`,_+=` // BKA = ${Z}
|
539
|
+
`,_+=` // BKN = ${V}
|
540
|
+
`,_+=` // BKR = ${C}
|
541
|
+
`,_+=` // ABG = ${F}
|
542
|
+
`,_+=` // AEN = ${ce}
|
543
|
+
`,_+=" // characters = [",I+T+g===0?_+=" none defined ]":_+=`${D} - ${B}]`,m>0&&(_+=" + user defined"),_+=`
|
544
|
+
`,_+=" // ```\n",_+=` /* OBJECT IDENTIFIER (for internal parser use) */
|
545
|
+
`,_+=` this.grammarObject = 'grammarObject';
|
546
|
+
`,_+=`
|
547
|
+
`,_+=` /* RULES */
|
548
|
+
`,_+=` this.rules = [];
|
549
|
+
`,v.forEach((Q,P)=>{let O=" this.rules[";O+=P,O+="] = {name: '",O+=Q.name,O+="', lower: '",O+=Q.lower,O+="', index: ",O+=Q.index,O+=", isBkr: ",O+=Q.isBkr,O+=`};
|
550
|
+
`,_+=O}),_+=`
|
551
|
+
`,_+=` /* UDTS */
|
552
|
+
`,_+=` this.udts = [];
|
553
|
+
`,x.length>0&&x.forEach((Q,P)=>{let O=" this.udts[";O+=P,O+="] = {name: '",O+=Q.name,O+="', lower: '",O+=Q.lower,O+="', index: ",O+=Q.index,O+=", empty: ",O+=Q.empty,O+=", isBkr: ",O+=Q.isBkr,O+=`};
|
554
|
+
`,_+=O}),_+=`
|
555
|
+
`,_+=` /* OPCODES */
|
556
|
+
`,v.forEach((Q,P)=>{P>0&&(_+=`
|
557
|
+
`),_+=` /* ${Q.name} */
|
558
|
+
`,_+=` this.rules[${P}].opcodes = [];
|
559
|
+
`,Q.opcodes.forEach((O,z)=>{let J;switch(O.type){case n.ALT:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, children: [${O.children.toString()}]};// ALT
|
560
|
+
`;break;case n.CAT:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, children: [${O.children.toString()}]};// CAT
|
561
|
+
`;break;case n.RNM:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, index: ${O.index}};// RNM(${v[O.index].name})
|
562
|
+
`;break;case n.BKR:O.index>=v.length?(H=x[O.index-v.length].name,$=x[O.index-v.length].lower):(H=v[O.index].name,$=v[O.index].lower),J="%i",O.bkrCase===n.BKR_MODE_CS&&(J="%s"),O.bkrMode===n.BKR_MODE_UM?J+="%u":J+="%p",H=J+H,_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, index: ${O.index}, lower: '${$}', bkrCase: ${O.bkrCase}, bkrMode: ${O.bkrMode}};// BKR(\\${H})
|
563
|
+
`;break;case n.UDT:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, empty: ${O.empty}, index: ${O.index}};// UDT(${x[O.index].name})
|
564
|
+
`;break;case n.REP:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, min: ${O.min}, max: ${O.max}};// REP
|
565
|
+
`;break;case n.AND:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// AND
|
566
|
+
`;break;case n.NOT:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// NOT
|
567
|
+
`;break;case n.ABG:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// ABG(%^)
|
568
|
+
`;break;case n.AEN:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// AEN(%$)
|
569
|
+
`;break;case n.BKA:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// BKA
|
570
|
+
`;break;case n.BKN:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}};// BKN
|
571
|
+
`;break;case n.TLS:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, string: [${O.string.toString()}]};// TLS
|
572
|
+
`;break;case n.TBS:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, string: [${O.string.toString()}]};// TBS
|
573
|
+
`;break;case n.TRG:_+=` this.rules[${P}].opcodes[${z}] = {type: ${O.type}, min: ${O.min}, max: ${O.max}};// TRG
|
574
|
+
`;break;default:throw new Error("parser.js: ~143: unrecognized opcode")}})}),_+=`
|
575
|
+
`,_+=" // The `toString()` function will display the original grammar file(s) that produced these opcodes.\n",_+=` this.toString = function toString(){
|
576
|
+
`,_+=` let str = "";
|
577
|
+
`;let X;return A.forEach(Q=>{let P=Q.beginChar+Q.length;X="",_+=' str += "';for(let O=Q.beginChar;O<P;O+=1){switch(y[O]){case 9:X=" ";break;case 10:X="\\n";break;case 13:X="\\r";break;case 34:X='\\"';break;case 92:X="\\\\";break;default:X=String.fromCharCode(y[O]);break}_+=X}_+=`";
|
578
|
+
`}),_+=` return str;
|
579
|
+
`,_+=` }
|
580
|
+
`,_+=`}
|
581
|
+
`,_},"generateSource"),this.generateObject=s(function(y,A,v){let x={},L=[],_=[],R=y.slice(0);return x.grammarObject="grammarObject",A.forEach(H=>{L.push(H.lower)}),L.sort(),v.length>0&&(v.forEach(H=>{_.push(H.lower)}),_.sort()),x.callbacks=[],L.forEach(H=>{x.callbacks[H]=!1}),v.length>0&&_.forEach(H=>{x.callbacks[H]=!1}),x.rules=A,x.udts=v,x.toString=s(function(){return R},"toStringFunc"),x},"generateObject")},"exportParser")});var n5=de((U$,r5)=>{r5.exports=s(function(){let e=ni(),t="rule-attributes.js",n=null;function i(b){return b.left||b.nested||b.right||b.cyclic?!1:b.empty}s(i,"isEmptyOnly");function o(b){return!!(b.left||b.nested||b.right||b.cyclic)}s(o,"isRecursive");function a(b,u){let p=0,m=0,w=0;for(p=0;p<u;p+=1)if(b[p].nested)return!0;for(p=0;p<u;p+=1)if(b[p].right&&!b[p].leaf){for(m=p+1;m<u;m+=1)if(!i(b[m]))return!0}for(p=u-1;p>=0;p-=1)if(b[p].left&&!b[p].leaf){for(m=p-1;m>=0;m-=1)if(!i(b[m]))return!0}for(p=0;p<u;p+=1)if(!b[p].empty&&!o(b[p])){for(m=p+1;m<u;m+=1)if(o(b[m])){for(w=m+1;w<u;w+=1)if(!b[w].empty&&!o(b[w]))return!0}}return!1}s(a,"isCatNested");function f(b,u){for(let p=0;p<u;p+=1)if(!b[p].cyclic)return!1;return!0}s(f,"isCatCyclic");function c(b,u){for(let p=0;p<u;p+=1){if(b[p].left)return!0;if(!b[p].empty)return!1}return!1}s(c,"isCatLeft");function l(b,u){for(let p=u-1;p>=0;p-=1){if(b[p].right)return!0;if(!b[p].empty)return!1}return!1}s(l,"isCatRight");function h(b,u){for(let p=0;p<u;p+=1)if(!b[p].empty)return!1;return!0}s(h,"isCatEmpty");function d(b,u){for(let p=0;p<u;p+=1)if(!b[p].finite)return!1;return!0}s(d,"isCatFinite");function y(b,u,p,m){let w=0,S=u[p],N=S.children.length,I=[];for(w=0;w<N;w+=1)I.push(b.attrGen());for(w=0;w<N;w+=1)x(b,u,S.children[w],I[w]);m.left=c(I,N),m.right=l(I,N),m.nested=a(I,N),m.empty=h(I,N),m.finite=d(I,N),m.cyclic=f(I,N)}s(y,"cat");function A(b,u,p,m){let w=0,S=u[p],N=S.children.length,I=[];for(w=0;w<N;w+=1)I.push(b.attrGen());for(w=0;w<N;w+=1)x(b,u,S.children[w],I[w]);for(m.left=!1,m.right=!1,m.nested=!1,m.empty=!1,m.finite=!1,m.cyclic=!1,w=0;w<N;w+=1)I[w].left&&(m.left=!0),I[w].nested&&(m.nested=!0),I[w].right&&(m.right=!0),I[w].empty&&(m.empty=!0),I[w].finite&&(m.finite=!0),I[w].cyclic&&(m.cyclic=!0)}s(A,"alt");function v(b,u,p,m){let w=u[p];w.index>=b.ruleCount?(m.empty=b.udts[w.index-b.ruleCount].empty,m.finite=!0):(L(b,w.index,m),m.left=!1,m.nested=!1,m.right=!1,m.cyclic=!1)}s(v,"bkr");function x(b,u,p,m){b.attrInit(m);let w=u[p];switch(w.type){case e.ALT:A(b,u,p,m);break;case e.CAT:y(b,u,p,m);break;case e.REP:x(b,u,p+1,m),w.min===0&&(m.empty=!0,m.finite=!0);break;case e.RNM:L(b,u[p].index,m);break;case e.BKR:v(b,u,p,m);break;case e.AND:case e.NOT:case e.BKA:case e.BKN:x(b,u,p+1,m),m.empty=!0;break;case e.TLS:m.empty=!u[p].string.length,m.finite=!0,m.cyclic=!1;break;case e.TBS:case e.TRG:m.empty=!1,m.finite=!0,m.cyclic=!1;break;case e.UDT:m.empty=w.empty,m.finite=!0,m.cyclic=!1;break;case e.ABG:case e.AEN:m.empty=!0,m.finite=!0,m.cyclic=!1;break;default:throw new Error(`unknown opcode type: ${w}`)}}s(x,"opEval");function L(b,u,p){let m=b.attrsWorking[u];m.isComplete?b.attrCopy(p,m):m.isOpen?u===b.startRule?u===b.startRule&&(p.left=!0,p.right=!0,p.cyclic=!0,p.leaf=!0):p.finite=!0:(m.isOpen=!0,x(b,m.rule.opcodes,0,p),m.left=p.left,m.right=p.right,m.nested=p.nested,m.empty=p.empty,m.finite=p.finite,m.cyclic=p.cyclic,m.leaf=!1,m.isOpen=!1,m.isComplete=!0)}s(L,"ruleAttrsEval");let _=s(b=>{n=b;let u=0,p=0,m=n.attrGen();for(u=0;u<n.ruleCount;u+=1){for(p=0;p<n.ruleCount;p+=1)n.attrInit(n.attrsWorking[p]);n.startRule=u,L(n,u,m),n.attrCopy(n.attrs[u],n.attrsWorking[u])}n.attributesComplete=!0;let w=null;for(u=0;u<n.ruleCount;u+=1)if(w=n.attrs[u],w.left||!w.finite||w.cyclic){let S=n.attrGen(w.rule);n.attrCopy(S,w),n.attrsErrors.push(S),n.attrsErrorCount+=1}},"ruleAttributes"),R=s(b=>b?"t":"f","truth"),H=s(b=>b?"e":"f","tError"),$=s(b=>b?"t":"e","fError"),j=s((b,u,p,m)=>{let w=`${b}:${u}:`;return w+=`${H(p.left)} `,w+=`${R(p.nested)} `,w+=`${R(p.right)} `,w+=`${H(p.cyclic)} `,w+=`${$(p.finite)} `,w+=`${R(p.empty)}:`,w+=`${n.typeToString(m.recursiveType)}:`,w+=m.recursiveType===e.ATTR_MR?m.groupNumber:"-",w+=`:${p.rule.name}
|
582
|
+
`,w},"showAttr"),D=s(()=>{let b=`LEGEND - t=true, f=false, e=error
|
583
583
|
`;return b+=`sequence:rule index:left nested right cyclic finite empty:type:group number:rule name
|
584
|
-
`,b},"showLegend"),B=
|
584
|
+
`,b},"showLegend"),B=s(()=>{let b=null,u=null,p="";if(p+=`RULE ATTRIBUTES WITH ERRORS
|
585
585
|
`,p+=D(),n.attrsErrorCount)for(let m=0;m<n.attrsErrorCount;m+=1)b=n.attrsErrors[m],u=n.ruleDeps[b.rule.index],p+=j(m,b.rule.index,b,u);else p+=`<none>
|
586
|
-
`;return p},"showAttributeErrors"),
|
586
|
+
`;return p},"showAttributeErrors"),U=s(b=>{let u=0,p=0,m=null,w=null,S="",{ruleIndexes:N}=n;for(b===97?N=n.ruleAlphaIndexes:b===116&&(N=n.ruleTypeIndexes),u=0;u<n.ruleCount;u+=1)p=N[u],m=n.attrs[p],w=n.ruleDeps[p],S+=j(u,p,m,w);return S},"show");return{ruleAttributes:_,showAttributes:s((b="index")=>{if(!n.attributesComplete)throw new Error(`${t}:showAttributes: attributes not available`);let u="",p=`RULE ATTRIBUTES
|
587
587
|
`;return b.charCodeAt(0)===97?(u+=`alphabetical by rule name
|
588
|
-
`,u+=p,u+=D(),u+=
|
589
|
-
`,u+=p,u+=D(),u+=
|
590
|
-
`,u+=p,u+=D(),u+=
|
591
|
-
`,
|
592
|
-
${
|
593
|
-
${
|
594
|
-
`),
|
595
|
-
`),
|
596
|
-
${
|
597
|
-
`),
|
598
|
-
`),
|
599
|
-
`}return
|
600
|
-
`;return
|
601
|
-
`,
|
602
|
-
`,e.dependenciesComplete&&(a.charCodeAt(0)===97?(
|
603
|
-
`,
|
604
|
-
`,
|
605
|
-
`,
|
606
|
-
`,
|
607
|
-
`;if(
|
608
|
-
`}else{for(
|
609
|
-
`,
|
610
|
-
`;if(
|
611
|
-
`}return
|
612
|
-
`,u+=`line no: ${p.lineNo}`,u+=` : char index: ${p.beginChar}`,u+=` : length: ${p.length}`,u+=` : abnf: ${
|
613
|
-
`,u},"linesToAscii"),
|
588
|
+
`,u+=p,u+=D(),u+=U(97)):b.charCodeAt(0)===116?(u+=`ordered by rule type
|
589
|
+
`,u+=p,u+=D(),u+=U(116)):(u+=`ordered by rule index
|
590
|
+
`,u+=p,u+=D(),u+=U()),u},"showAttributes"),showAttributeErrors:B}},"exportRuleAttributes")()});var o5=de((L$,i5)=>{i5.exports=(()=>{let r=ni(),e=null,t=s((a,f,c,l)=>{let h=0,d=0,y=f[c];l[c]=!0;let A=y.rule.opcodes;for(h=0;h<A.length;h+=1){let v=A[h];if(v.type===r.RNM)for(y.refersTo[v.index]=!0,l[v.index]||t(a,f,v.index,l),d=0;d<a;d+=1)f[v.index].refersTo[d]&&(y.refersTo[d]=!0);else v.type===r.UDT?y.refersToUdt[v.index]=!0:v.type===r.BKR&&(v.index<a?(y.refersTo[v.index]=!0,l[v.index]||t(a,f,v.index,l)):y.refersToUdt[a-v.index]=!0)}},"scan"),n=s(a=>{e=a;let f=0,c=0,l=0,h=null,d=null,y=!1;e.dependenciesComplete=!1;let A=e.falseArray(e.ruleCount);for(f=0;f<e.ruleCount;f+=1)e.falsifyArray(A),t(e.ruleCount,e.ruleDeps,f,A);for(f=0;f<e.ruleCount;f+=1)for(c=0;c<e.ruleCount;c+=1)f!==c&&e.ruleDeps[c].refersTo[f]&&(e.ruleDeps[f].referencedBy[c]=!0);for(f=0;f<e.ruleCount;f+=1)e.ruleDeps[f].recursiveType=r.ATTR_N,e.ruleDeps[f].refersTo[f]&&(e.ruleDeps[f].recursiveType=r.ATTR_R);for(l=-1,f=0;f<e.ruleCount;f+=1)if(h=e.ruleDeps[f],h.recursiveType===r.ATTR_R)for(y=!0,c=0;c<e.ruleCount;c+=1)f!==c&&(d=e.ruleDeps[c],d.recursiveType===r.ATTR_R&&h.refersTo[c]&&d.refersTo[f]&&(y&&(l+=1,h.recursiveType=r.ATTR_MR,h.groupNumber=l,y=!1),d.recursiveType=r.ATTR_MR,d.groupNumber=l));e.isMutuallyRecursive=l>-1,e.ruleAlphaIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesAlpha),e.ruleTypeIndexes.sort(e.compRulesType),e.isMutuallyRecursive&&e.ruleTypeIndexes.sort(e.compRulesGroup),e.udtCount&&e.udtAlphaIndexes.sort(e.compUdtsAlpha),e.dependenciesComplete=!0},"ruleDependencies"),i=s((a=null)=>{let f=0,c=0,l=0,h=0,d=e.ruleCount-1,y=e.udtCount-1,A=100,v="",x="",L="=> ",_="<= ",R=!1,H=null,{ruleIndexes:$}=e,{udtIndexes:j}=e;for(a===97?($=e.ruleAlphaIndexes,j=e.udtAlphaIndexes):a===116&&($=e.ruleTypeIndexes,j=e.udtAlphaIndexes),f=0;f<e.ruleCount;f+=1){for(H=e.ruleDeps[$[f]],x=`${$[f]}:${e.typeToString(H.recursiveType)}:`,e.isMutuallyRecursive&&(x+=H.groupNumber>-1?H.groupNumber:"-",x+=":"),x+=" ",v+=`${x+e.rules[$[f]].name}
|
591
|
+
`,R=!0,l=0,h=v.length,v+=x,c=0;c<e.ruleCount;c+=1)H.refersTo[$[c]]&&(R?(v+=L,R=!1,v+=e.ruleDeps[$[c]].rule.name):v+=`, ${e.ruleDeps[$[c]].rule.name}`,l+=1),v.length-h>A&&c!==d&&(v+=`
|
592
|
+
${x}${L}`,h=v.length);if(e.udtCount)for(c=0;c<e.udtCount;c+=1)H.refersToUdt[j[c]]&&(R?(v+=L,R=!1,v+=e.udts[j[c]].name):v+=`, ${e.udts[j[c]].name}`,l+=1),v.length-h>A&&c!==y&&(v+=`
|
593
|
+
${x}${L}`,h=v.length);for(l===0&&(v+=`=> <none>
|
594
|
+
`),R===!1&&(v+=`
|
595
|
+
`),R=!0,l=0,h=v.length,v+=x,c=0;c<e.ruleCount;c+=1)H.referencedBy[$[c]]&&(R?(v+=_,R=!1,v+=e.ruleDeps[$[c]].rule.name):v+=`, ${e.ruleDeps[$[c]].rule.name}`,l+=1),v.length-h>A&&c!==d&&(v+=`
|
596
|
+
${x}${L}`,h=v.length);l===0&&(v+=`<= <none>
|
597
|
+
`),R===!1&&(v+=`
|
598
|
+
`),v+=`
|
599
|
+
`}return v},"show");return{ruleDependencies:n,showRuleDependencies:s((a="index")=>{let f=`RULE DEPENDENCIES(index:type:[group number:])
|
600
|
+
`;return f+=`=> refers to rule names
|
601
|
+
`,f+=`<= referenced by rule names
|
602
|
+
`,e.dependenciesComplete&&(a.charCodeAt(0)===97?(f+=`alphabetical by rule name
|
603
|
+
`,f+=i(97)):a.charCodeAt(0)===116?(f+=`ordered by rule type
|
604
|
+
`,f+=i(116)):(f+=`ordered by rule index
|
605
|
+
`,f+=i(null))),f},"showRuleDependencies")}})()});var a5=de((D$,s5)=>{s5.exports=s(function(){let e=ni(),{ruleAttributes:t,showAttributes:n,showAttributeErrors:i}=n5(),{ruleDependencies:o,showRuleDependencies:a}=o5();class f{constructor(h,d){this.rules=h,this.udts=d,this.ruleCount=h.length,this.udtCount=d.length,this.startRule=0,this.dependenciesComplete=!1,this.attributesComplete=!1,this.isMutuallyRecursive=!1,this.ruleIndexes=this.indexArray(this.ruleCount),this.ruleAlphaIndexes=this.indexArray(this.ruleCount),this.ruleTypeIndexes=this.indexArray(this.ruleCount),this.udtIndexes=this.indexArray(this.udtCount),this.udtAlphaIndexes=this.indexArray(this.udtCount),this.attrsErrorCount=0,this.attrs=[],this.attrsErrors=[],this.attrsWorking=[],this.ruleDeps=[];for(let y=0;y<this.ruleCount;y+=1)this.attrs.push(this.attrGen(this.rules[y])),this.attrsWorking.push(this.attrGen(this.rules[y])),this.ruleDeps.push(this.rdGen(h[y],this.ruleCount,this.udtCount));this.compRulesAlpha=this.compRulesAlpha.bind(this),this.compUdtsAlpha=this.compUdtsAlpha.bind(this),this.compRulesType=this.compRulesType.bind(this),this.compRulesGroup=this.compRulesGroup.bind(this)}attrGen(h){return{left:!1,nested:!1,right:!1,empty:!1,finite:!1,cyclic:!1,leaf:!1,isOpen:!1,isComplete:!1,rule:h}}attrInit(h){h.left=!1,h.nested=!1,h.right=!1,h.empty=!1,h.finite=!1,h.cyclic=!1,h.leaf=!1,h.isOpen=!1,h.isComplete=!1}attrCopy(h,d){h.left=d.left,h.nested=d.nested,h.right=d.right,h.empty=d.empty,h.finite=d.finite,h.cyclic=d.cyclic,h.leaf=d.leaf,h.isOpen=d.isOpen,h.isComplete=d.isComplete,h.rule=d.rule}rdGen(h,d,y){return{rule:h,recursiveType:e.ATTR_N,groupNumber:-1,refersTo:this.falseArray(d),refersToUdt:this.falseArray(y),referencedBy:this.falseArray(d)}}typeToString(h){switch(h){case e.ATTR_N:return" N";case e.ATTR_R:return" R";case e.ATTR_MR:return"MR";default:return"UNKNOWN"}}falseArray(h){let d=[];if(h>0)for(let y=0;y<h;y+=1)d.push(!1);return d}falsifyArray(h){for(let d=0;d<h.length;d+=1)h[d]=!1}indexArray(h){let d=[];if(h>0)for(let y=0;y<h;y+=1)d.push(y);return d}compRulesAlpha(h,d){return this.rules[h].lower<this.rules[d].lower?-1:this.rules[h].lower>this.rules[d].lower?1:0}compUdtsAlpha(h,d){return this.udts[h].lower<this.udts[d].lower?-1:this.udts[h].lower>this.udts[d].lower?1:0}compRulesType(h,d){return this.ruleDeps[h].recursiveType<this.ruleDeps[d].recursiveType?-1:this.ruleDeps[h].recursiveType>this.ruleDeps[d].recursiveType?1:0}compRulesGroup(h,d){if(this.ruleDeps[h].recursiveType===e.ATTR_MR&&this.ruleDeps[d].recursiveType===e.ATTR_MR){if(this.ruleDeps[h].groupNumber<this.ruleDeps[d].groupNumber)return-1;if(this.ruleDeps[h].groupNumber>this.ruleDeps[d].groupNumber)return 1}return 0}}return s(f,"State"),{attributes:s(function(h=[],d=[],y=[],A=[]){let v=new f(h,d);return o(v),t(v),v.attrsErrorCount&&A.push({line:0,char:0,msg:`${v.attrsErrorCount} attribute errors`}),v.attrsErrorCount},"attributes"),showAttributes:n,showAttributeErrors:i,showRuleDependencies:a}},"exportAttributes")()});var c5=de((F$,f5)=>{f5.exports=s(function(){let e="show-rules.js";return s(function(i=[],o=[],a="index"){let f="showRules",c=[],l=[],h=[],d=[],y=i,A=o,v=i.length,x=o.length,L="RULE/UDT NAMES",_;function R($,j){return y[$].lower<y[j].lower?-1:y[$].lower>y[j].lower?1:0}s(R,"compRulesAlpha");function H($,j){return A[$].lower<A[j].lower?-1:A[$].lower>A[j].lower?1:0}if(s(H,"compUdtsAlpha"),!(Array.isArray(i)&&i.length))throw new Error(`${e}:${f}: rules arg must be array with length > 0`);if(!Array.isArray(o))throw new Error(`${e}:${f}: udts arg must be array`);for(_=0;_<v;_+=1)h.push(_);if(c=h.slice(0),c.sort(R),x){for(_=0;_<x;_+=1)d.push(_);l=d.slice(0),l.sort(H)}if(a.charCodeAt(0)===97){for(L+=` - alphabetical by rule/UDT name
|
606
|
+
`,_=0;_<v;_+=1)L+=`${_}: ${c[_]}: ${y[c[_]].name}
|
607
|
+
`;if(x)for(_=0;_<x;_+=1)L+=`${_}: ${l[_]}: ${A[l[_]].name}
|
608
|
+
`}else{for(L+=` - ordered by rule/UDT index
|
609
|
+
`,_=0;_<v;_+=1)L+=`${_}: ${y[_].name}
|
610
|
+
`;if(x)for(_=0;_<x;_+=1)L+=`${_}: ${A[_].name}
|
611
|
+
`}return L},"showRules")},"exports")()});var l5=de((K$,u5)=>{u5.exports=s(function(e){let t="api.js: ",n=this,i=wa(),o=D1(),a=W3(),f=new(t5()),{attributes:c,showAttributes:l,showAttributeErrors:h,showRuleDependencies:d}=a5(),y=c5(),A=s(function(b,u,p){let N=`<span class="${i.style.CLASS_CTRLCHAR}">`,I="</span>",T=`<span class="${i.style.CLASS_NOMATCH}">`,g="</span>",C,Z="",V=!0;for(;V&&!(!Array.isArray(b)||b.length===0);){if(typeof u!="number")throw new Error("abnfToHtml: beg must be type number");if(u>=b.length)break;typeof p!="number"||u+p>=b.length?C=b.length:C=u+p;let F=0;for(let ce=u;ce<C;ce+=1){let E=b[ce];if(E>=32&&E<=126)switch(F===1?(Z+=I,F=0):F===2&&(Z+=g,F=0),E){case 32:Z+=" ";break;case 60:Z+="<";break;case 62:Z+=">";break;case 38:Z+="&";break;case 34:Z+=""";break;case 39:Z+="'";break;case 92:Z+="\";break;default:Z+=String.fromCharCode(E);break}else E===9||E===10||E===13?(F===0?(Z+=N,F=1):F===2&&(Z+=g+N,F=1),E===9&&(Z+="TAB"),E===10&&(Z+="LF"),E===13&&(Z+="CR")):(F===0?(Z+=T,F=2):F===1&&(Z+=I+T,F=2),Z+=`\\x${i.utils.charToHex(E)}`)}F===2&&(Z+=g),F===1&&(Z+=I);break}return Z},"abnfToHtml"),v=s(function(b,u,p){let m="";for(let w=u;w<u+p;w+=1){let S=b[w];if(S>=32&&S<=126)m+=String.fromCharCode(S);else switch(S){case 9:m+="\\t";break;case 10:m+="\\n";break;case 13:m+="\\r";break;default:m+="\\unknown";break}}return m},"abnfToAscii"),x=s(function(b){let u="Annotated Input Grammar";return b.forEach(p=>{u+=`
|
612
|
+
`,u+=`line no: ${p.lineNo}`,u+=` : char index: ${p.beginChar}`,u+=` : length: ${p.length}`,u+=` : abnf: ${v(n.chars,p.beginChar,p.length)}`}),u+=`
|
613
|
+
`,u},"linesToAscii"),L=s(function(b){let u="";return u+=`<table class="${i.style.CLASS_GRAMMAR}">
|
614
614
|
`,u+=`<caption>Annotated Input Grammar</caption>
|
615
615
|
`,u+="<tr>",u+="<th>line<br>no.</th><th>first<br>char</th><th><br>length</th><th><br>text</th>",u+=`</tr>
|
616
|
-
`,b.forEach(m=>{u+="<tr>",u+=`<td>${m.lineNo}`,u+=`</td><td>${m.beginChar}`,u+=`</td><td>${m.length}`,u+=`</td><td>${
|
616
|
+
`,b.forEach(m=>{u+="<tr>",u+=`<td>${m.lineNo}`,u+=`</td><td>${m.beginChar}`,u+=`</td><td>${m.length}`,u+=`</td><td>${A(n.chars,m.beginChar,m.length)}`,u+="</td>",u+=`</tr>
|
617
617
|
`}),u+=`</table>
|
618
|
-
`,u},"linesToHtml"),
|
618
|
+
`,u},"linesToHtml"),_=s(function(b,u,p,m){let[w]=i,S="",N=`<span class="${w.CLASS_NOMATCH}">»</span>`;return S+=`<p><table class="${w.CLASS_GRAMMAR}">
|
619
619
|
`,m&&typeof m=="string"&&(S+=`<caption>${m}</caption>
|
620
620
|
`),S+=`<tr><th>line<br>no.</th><th>line<br>offset</th><th>error<br>offset</th><th><br>text</th></tr>
|
621
|
-
`,b.forEach(
|
622
|
-
`,S+="<tr>",S+=`<td colspan="3"></td><td>↑: ${i.utils.stringToAsciiHtml(
|
621
|
+
`,b.forEach(I=>{let T,g,C,Z,V,F="",ce="";u.length===0?(V=N,g=0):(T=u[I.line],C=T.beginChar,I.char>C&&(F=A(p,C,I.char-C)),C=I.char,Z=T.beginChar+T.length,C<Z&&(ce=A(p,C,Z-C)),V=F+N+ce,g=I.char-T.beginChar,S+="<tr>",S+=`<td>${I.line}</td><td>${T.beginChar}</td><td>${g}</td><td>${V}</td>`,S+=`</tr>
|
622
|
+
`,S+="<tr>",S+=`<td colspan="3"></td><td>↑: ${i.utils.stringToAsciiHtml(I.msg)}</td>`,S+=`</tr>
|
623
623
|
`)}),S+=`</table></p>
|
624
|
-
`,S},"errorsToHtml"),
|
625
|
-
`,m+=`${w.lineNo}: `,m+=`${w.beginChar}: `,m+=`${
|
626
|
-
`}),m},"errorsToAscii"),H=!1,F=!1,j=!1,D=!1,B=0,R;if(this.errors=[],Buffer.isBuffer(e))this.chars=s.decode("BINARY",e);else if(Array.isArray(e))this.chars=e.slice();else if(typeof e=="string")this.chars=s.decode("STRING",e);else throw new Error(`${t}input source is not a string, byte Buffer or character array`);this.sabnf=s.encode("STRING",this.chars),this.scan=o(function(b,u){this.lines=a(this.chars,this.errors,b,u),H=!0},"scan"),this.parse=o(function(b,u){if(!H)throw new Error(`${t}grammar not scanned`);c.syntax(this.chars,this.lines,this.errors,b,u),F=!0},"parse"),this.translate=o(function(){if(!F)throw new Error(`${t}grammar not scanned and parsed`);let b=c.semantic(this.chars,this.lines,this.errors);this.errors.length===0&&(this.rules=b.rules,this.udts=b.udts,R=b.lineMap,j=!0)},"translate"),this.attributes=o(function(){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return B=f(this.rules,this.udts,R,this.errors),D=!0,B},"attrs"),this.generate=o(function(b){if(this.lines=a(this.chars,this.errors,b),this.errors.length||(c.syntax(this.chars,this.lines,this.errors,b),this.errors.length))return;let u=c.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=u.rules,this.udts=u.udts,R=u.lineMap,B=f(this.rules,this.udts,R,this.errors),D=!0)},"generate"),this.displayRules=o(function(b="index"){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return v(this.rules,this.udts,b)},"displayRules"),this.displayRuleDependencies=o(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return d(b)},"displayRuleDependencies"),this.displayAttributes=o(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return B&&h(b),l(b)},"displayAttributes"),this.displayAttributeErrors=o(function(){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return h()},"displayAttributeErrors"),this.toSource=o(function(b){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return c.generateSource(this.chars,this.lines,this.rules,this.udts,b)},"toSource"),this.toObject=o(function(){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return c.generateObject(this.sabnf,this.rules,this.udts)},"toObject"),this.errorsToAscii=o(function(){return L(this.errors,this.lines,this.chars)},"errorsToAsciiFunc"),this.errorsToHtml=o(function(b){return E(this.errors,this.lines,this.chars,b)},"errorsToHtmlFunc"),this.linesToAscii=o(function(){return _(this.lines)},"linesToAsciiFunc"),this.linesToHtml=o(function(){return U(this.lines)},"linesToHtmlFunc")},"api")});var R5=de((qF,P5)=>{P5.exports=J1;var O5=128,HM=127,qM=~HM,zM=Math.pow(2,31);function J1(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw J1.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=zM;)e[t++]=r&255|O5,r/=128;for(;r&qM;)e[t++]=r&255|O5,r>>>=7;return e[t]=r|0,J1.bytes=t-n+1,e}o(J1,"encode")});var D5=de((zF,L5)=>{L5.exports=W1;var jM=128,U5=127;function W1(r,n){var t=0,n=n||0,i=0,s=n,a,c=r.length;do{if(s>=c||i>49)throw W1.bytes=0,new RangeError("Could not decode varint");a=r[s++],t+=i<28?(a&U5)<<i:(a&U5)*Math.pow(2,i),i+=7}while(a>=jM);return W1.bytes=s-n,t}o(W1,"read")});var $5=de((jF,K5)=>{var VM=Math.pow(2,7),GM=Math.pow(2,14),JM=Math.pow(2,21),WM=Math.pow(2,28),YM=Math.pow(2,35),XM=Math.pow(2,42),ZM=Math.pow(2,49),QM=Math.pow(2,56),eB=Math.pow(2,63);K5.exports=function(r){return r<VM?1:r<GM?2:r<JM?3:r<WM?4:r<YM?5:r<XM?6:r<ZM?7:r<QM?8:r<eB?9:10}});var Ju=de((VF,F5)=>{F5.exports={encode:R5(),decode:D5(),encodingLength:$5()}});var q5=de((GF,H5)=>{"use strict";function tB(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var n=0;n<r.length;n++){var i=r.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var a=r.length,c=r.charAt(0),f=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var y=0,_=0,U=0,E=x.length;U!==E&&x[U]===0;)U++,y++;for(var L=(E-U)*l+1>>>0,H=new Uint8Array(L);U!==E;){for(var F=x[U],j=0,D=L-1;(F!==0||j<_)&&D!==-1;D--,j++)F+=256*H[D]>>>0,H[D]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");_=j,U++}for(var B=L-_;B!==L&&H[B]===0;)B++;for(var R=c.repeat(y);B<L;++B)R+=r.charAt(H[B]);return R}o(h,"encode");function d(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var y=0;if(x[y]!==" "){for(var _=0,U=0;x[y]===c;)_++,y++;for(var E=(x.length-y)*f+1>>>0,L=new Uint8Array(E);x[y];){var H=e[x.charCodeAt(y)];if(H===255)return;for(var F=0,j=E-1;(H!==0||F<U)&&j!==-1;j--,F++)H+=a*L[j]>>>0,L[j]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");U=F,y++}if(x[y]!==" "){for(var D=E-U;D!==E&&L[D]===0;)D++;for(var B=new Uint8Array(_+(E-D)),R=_;D!==E;)B[R++]=L[D++];return B}}}o(d,"decodeUnsafe");function v(x){var y=d(x);if(y)return y;throw new Error("Non-base"+a+" character")}return o(v,"decode"),{encode:h,decodeUnsafe:d,decode:v}}o(tB,"base");H5.exports=tB});var Xd=de((JF,z5)=>{"use strict";var rB=new TextDecoder,nB=o(r=>rB.decode(r),"decodeText"),iB=new TextEncoder,sB=o(r=>iB.encode(r),"encodeText");function oB(r,e){let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(oB,"concat");z5.exports={decodeText:nB,encodeText:sB,concat:oB}});var V5=de((WF,j5)=>{"use strict";var{encodeText:aB}=Xd(),Zd=class{constructor(e,t,n,i){this.name=e,this.code=t,this.codeBuf=aB(this.code),this.alphabet=i,this.codec=n(i)}encode(e){return this.codec.encode(e)}decode(e){for(let t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}};o(Zd,"Base");j5.exports=Zd});var J5=de((YF,G5)=>{"use strict";var cB=o((r,e,t)=>{let n={};for(let l=0;l<e.length;++l)n[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let s=new Uint8Array(i*t/8|0),a=0,c=0,f=0;for(let l=0;l<i;++l){let h=n[r[l]];if(h===void 0)throw new SyntaxError("Invalid character "+r[l]);c=c<<t|h,a+=t,a>=8&&(a-=8,s[f++]=255&c>>a)}if(a>=t||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s},"decode"),fB=o((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,s="",a=0,c=0;for(let f=0;f<r.length;++f)for(c=c<<8|r[f],a+=8;a>t;)a-=t,s+=e[i&c>>a];if(a&&(s+=e[i&c<<t-a]),n)for(;s.length*t&7;)s+="=";return s},"encode"),uB=o(r=>e=>({encode(t){return fB(t,e,r)},decode(t){return cB(t,e,r)}}),"rfc4648");G5.exports={rfc4648:uB}});var Z5=de((XF,X5)=>{"use strict";var Wu=q5(),lB=V5(),{rfc4648:dr}=J5(),{decodeText:hB,encodeText:dB}=Xd(),pB=o(()=>({encode:hB,decode:dB}),"identity"),W5=[["identity","\0",pB,""],["base2","0",dr(1),"01"],["base8","7",dr(3),"01234567"],["base10","9",Wu,"0123456789"],["base16","f",dr(4),"0123456789abcdef"],["base16upper","F",dr(4),"0123456789ABCDEF"],["base32hex","v",dr(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",dr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",dr(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",dr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",dr(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",dr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",dr(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",dr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",dr(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",Wu,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",Wu,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",Wu,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",Wu,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",dr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],Y5=W5.reduce((r,e)=>(r[e[0]]=new lB(e[0],e[1],e[2],e[3]),r),{}),mB=W5.reduce((r,e)=>(r[e[1]]=Y5[e[0]],r),{});X5.exports={names:Y5,codes:mB}});var t4=de((ds,e4)=>{"use strict";var Hc=Z5(),{encodeText:bB,decodeText:Qd,concat:Q5}=Xd();function gB(r,e){if(!e)throw new Error("requires an encoded Uint8Array");let{name:t,codeBuf:n}=ya(r);return xB(t,e),Q5([n,e],n.length+e.length)}o(gB,"multibase");function yB(r,e){let t=ya(r),n=bB(t.encode(e));return Q5([t.codeBuf,n],t.codeBuf.length+n.length)}o(yB,"encode");function vB(r){r instanceof Uint8Array&&(r=Qd(r));let e=r[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(e)&&(r=r.toLowerCase()),ya(r[0]).decode(r.substring(1))}o(vB,"decode");function wB(r){if(r instanceof Uint8Array&&(r=Qd(r)),Object.prototype.toString.call(r)!=="[object String]")return!1;try{return ya(r[0]).name}catch(e){return!1}}o(wB,"isEncoded");function xB(r,e){ya(r).decode(Qd(e))}o(xB,"validEncode");function ya(r){if(Object.prototype.hasOwnProperty.call(Hc.names,r))return Hc.names[r];if(Object.prototype.hasOwnProperty.call(Hc.codes,r))return Hc.codes[r];throw new Error(`Unsupported encoding: ${r}`)}o(ya,"encoding");function _B(r){return r instanceof Uint8Array&&(r=Qd(r)),ya(r[0])}o(_B,"encodingFromData");ds=e4.exports=gB;ds.encode=yB;ds.decode=vB;ds.isEncoded=wB;ds.encoding=ya;ds.encodingFromData=_B;var AB=Object.freeze(Hc.names),EB=Object.freeze(Hc.codes);ds.names=AB;ds.codes=EB});var n4=de((ZF,r4)=>{"use strict";function SB(r,e){for(let t=0;t<r.byteLength;t++){if(r[t]<e[t])return-1;if(r[t]>e[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength<e.byteLength?-1:0}o(SB,"compare");r4.exports=SB});var s4=de((QF,i4)=>{"use strict";function CB(r,e){e||(e=r.reduce((i,s)=>i+s.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(CB,"concat");i4.exports=CB});var a4=de((eH,o4)=>{"use strict";function kB(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}o(kB,"equals");o4.exports=kB});var X1=de((tH,l4)=>{"use strict";var{bases:c4}=(Dh(),hg(Ov));function u4(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}o(u4,"createCodec");var f4=u4("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),Y1=u4("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),TB=ne({utf8:f4,"utf-8":f4,hex:c4.base16,latin1:Y1,ascii:Y1,binary:Y1},c4);l4.exports=TB});var d4=de((rH,h4)=>{"use strict";var MB=X1();function BB(r,e="utf8"){let t=MB[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}o(BB,"fromString");h4.exports=BB});var m4=de((nH,p4)=>{"use strict";var NB=X1();function IB(r,e="utf8"){let t=NB[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}o(IB,"toString");p4.exports=IB});var g4=de((iH,b4)=>{"use strict";function OB(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r[n]^e[n];return t}o(OB,"xor");b4.exports=OB});var Z1=de((sH,y4)=>{"use strict";var PB=n4(),RB=s4(),UB=a4(),LB=d4(),DB=m4(),KB=g4();y4.exports={compare:PB,concat:RB,equals:UB,fromString:LB,toString:DB,xor:KB}});var v4=de(Mi=>{"use strict";var $B=Mi&&Mi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),FB=Mi&&Mi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),HB=Mi&&Mi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&$B(e,r,t);return FB(e,r),e};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.keyToDidDoc=void 0;var qB=HB(Z1());function zB(r,e){let t=`did:key:${e}`,n=`${t}#${e}`;return{id:t,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:t,publicKeyBase58:qB.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}o(zB,"keyToDidDoc");Mi.keyToDidDoc=zB});var w4=de(Bi=>{"use strict";var jB=Bi&&Bi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),VB=Bi&&Bi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),GB=Bi&&Bi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&jB(e,r,t);return VB(e,r),e};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.keyToDidDoc=void 0;var Q1=GB(Z1()),JB=ad();function WB(r){let e=new Uint8Array(r.length+2);return e[0]=236,e[1]=1,e.set(r,2),`z${Q1.toString(e,"base58btc")}`}o(WB,"encodeKey");function YB(r,e){let t=`did:key:${e}`,n=`${t}#${e}`,i=JB.convertPublicKeyToX25519(r),s=`${t}#${WB(i)}`;return{id:t,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:Q1.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:s,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:Q1.toString(i,"base58btc")}]}}o(YB,"keyToDidDoc");Bi.keyToDidDoc=YB});var S4=de(On=>{"use strict";var XB=On&&On.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ZB=On&&On.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),A4=On&&On.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&XB(e,r,t);return ZB(e,r),e},E4=On&&On.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(On,"__esModule",{value:!0});var x4=E4(Ju()),QB=E4(t4()),eN=A4(v4()),tN=A4(w4()),rN="application/did+ld+json",_4="application/did+json",nN={231:eN,237:tN};On.default={getResolver:()=>({key:(r,e,t,n)=>M(On,null,function*(){let i=n.accept||_4,s={didResolutionMetadata:{contentType:i},didDocument:null,didDocumentMetadata:{}};try{let a=QB.default.decode(e.id),c=x4.default.decode(a),f=a.slice(x4.default.decode.bytes),l=yield nN[c].keyToDidDoc(f,e.id);i===rN?(l["@context"]="https://w3id.org/did/v1",s.didDocument=l):i===_4?s.didDocument=l:(delete s.didResolutionMetadata.contentType,s.didResolutionMetadata.error="representationNotSupported")}catch(a){s.didResolutionMetadata.error="invalidDid",s.didResolutionMetadata.message=a.toString()}return s})})}});var k4=de((fH,C4)=>{"use strict";C4.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&function(s){return function(a){return function(c,f){var l={key:c,value:a[c]},h={key:f,value:a[f]};return s(l,h)}}}(e.cmp),i=[];return o(function s(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var c,f;if(Array.isArray(a)){for(f="[",c=0;c<a.length;c++)c&&(f+=","),f+=s(a[c])||"null";return f+"]"}if(a===null)return"null";if(i.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=i.push(a)-1,h=Object.keys(a).sort(n&&n(a));for(f="",c=0;c<h.length;c++){var d=h[c],v=s(a[d]);!v||(f&&(f+=","),f+=JSON.stringify(d)+":"+v)}return i.splice(l,1),"{"+f+"}"}},"stringify")(r)}});var Mb=de((il,Gc)=>{var MN=200,t8="__lodash_hash_undefined__",r8=9007199254740991,_b="[object Arguments]",BN="[object Array]",n8="[object Boolean]",i8="[object Date]",NN="[object Error]",Ab="[object Function]",s8="[object GeneratorFunction]",fp="[object Map]",o8="[object Number]",Eb="[object Object]",z4="[object Promise]",a8="[object RegExp]",up="[object Set]",c8="[object String]",f8="[object Symbol]",bb="[object WeakMap]",u8="[object ArrayBuffer]",lp="[object DataView]",l8="[object Float32Array]",h8="[object Float64Array]",d8="[object Int8Array]",p8="[object Int16Array]",m8="[object Int32Array]",b8="[object Uint8Array]",g8="[object Uint8ClampedArray]",y8="[object Uint16Array]",v8="[object Uint32Array]",IN=/[\\^$.*+?()[\]{}|]/g,ON=/\w*$/,PN=/^\[object .+?Constructor\]$/,RN=/^(?:0|[1-9]\d*)$/,ut={};ut[_b]=ut[BN]=ut[u8]=ut[lp]=ut[n8]=ut[i8]=ut[l8]=ut[h8]=ut[d8]=ut[p8]=ut[m8]=ut[fp]=ut[o8]=ut[Eb]=ut[a8]=ut[up]=ut[c8]=ut[f8]=ut[b8]=ut[g8]=ut[y8]=ut[v8]=!0;ut[NN]=ut[Ab]=ut[bb]=!1;var UN=typeof global=="object"&&global&&global.Object===Object&&global,LN=typeof self=="object"&&self&&self.Object===Object&&self,ms=UN||LN||Function("return this")(),w8=typeof il=="object"&&il&&!il.nodeType&&il,j4=w8&&typeof Gc=="object"&&Gc&&!Gc.nodeType&&Gc,DN=j4&&j4.exports===w8;function KN(r,e){return r.set(e[0],e[1]),r}o(KN,"addMapEntry");function $N(r,e){return r.add(e),r}o($N,"addSetEntry");function FN(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}o(FN,"arrayEach");function HN(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}o(HN,"arrayPush");function x8(r,e,t,n){var i=-1,s=r?r.length:0;for(n&&s&&(t=r[++i]);++i<s;)t=e(t,r[i],i,r);return t}o(x8,"arrayReduce");function qN(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}o(qN,"baseTimes");function zN(r,e){return r==null?void 0:r[e]}o(zN,"getValue");function _8(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch(t){}return e}o(_8,"isHostObject");function V4(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}o(V4,"mapToArray");function Sb(r,e){return function(t){return r(e(t))}}o(Sb,"overArg");function G4(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}o(G4,"setToArray");var jN=Array.prototype,VN=Function.prototype,hp=Object.prototype,mb=ms["__core-js_shared__"],J4=function(){var r=/[^.]+$/.exec(mb&&mb.keys&&mb.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),A8=VN.toString,Ao=hp.hasOwnProperty,dp=hp.toString,GN=RegExp("^"+A8.call(Ao).replace(IN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),W4=DN?ms.Buffer:void 0,Y4=ms.Symbol,X4=ms.Uint8Array,JN=Sb(Object.getPrototypeOf,Object),WN=Object.create,YN=hp.propertyIsEnumerable,XN=jN.splice,Z4=Object.getOwnPropertySymbols,ZN=W4?W4.isBuffer:void 0,QN=Sb(Object.keys,Object),gb=Yc(ms,"DataView"),sl=Yc(ms,"Map"),yb=Yc(ms,"Promise"),vb=Yc(ms,"Set"),wb=Yc(ms,"WeakMap"),ol=Yc(Object,"create"),eI=Aa(gb),tI=Aa(sl),rI=Aa(yb),nI=Aa(vb),iI=Aa(wb),Q4=Y4?Y4.prototype:void 0,e8=Q4?Q4.valueOf:void 0;function _a(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(_a,"Hash");function sI(){this.__data__=ol?ol(null):{}}o(sI,"hashClear");function oI(r){return this.has(r)&&delete this.__data__[r]}o(oI,"hashDelete");function aI(r){var e=this.__data__;if(ol){var t=e[r];return t===t8?void 0:t}return Ao.call(e,r)?e[r]:void 0}o(aI,"hashGet");function cI(r){var e=this.__data__;return ol?e[r]!==void 0:Ao.call(e,r)}o(cI,"hashHas");function fI(r,e){var t=this.__data__;return t[r]=ol&&e===void 0?t8:e,this}o(fI,"hashSet");_a.prototype.clear=sI;_a.prototype.delete=oI;_a.prototype.get=aI;_a.prototype.has=cI;_a.prototype.set=fI;function bs(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(bs,"ListCache");function uI(){this.__data__=[]}o(uI,"listCacheClear");function lI(r){var e=this.__data__,t=pp(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():XN.call(e,t,1),!0}o(lI,"listCacheDelete");function hI(r){var e=this.__data__,t=pp(e,r);return t<0?void 0:e[t][1]}o(hI,"listCacheGet");function dI(r){return pp(this.__data__,r)>-1}o(dI,"listCacheHas");function pI(r,e){var t=this.__data__,n=pp(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}o(pI,"listCacheSet");bs.prototype.clear=uI;bs.prototype.delete=lI;bs.prototype.get=hI;bs.prototype.has=dI;bs.prototype.set=pI;function Jc(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}o(Jc,"MapCache");function mI(){this.__data__={hash:new _a,map:new(sl||bs),string:new _a}}o(mI,"mapCacheClear");function bI(r){return mp(this,r).delete(r)}o(bI,"mapCacheDelete");function gI(r){return mp(this,r).get(r)}o(gI,"mapCacheGet");function yI(r){return mp(this,r).has(r)}o(yI,"mapCacheHas");function vI(r,e){return mp(this,r).set(r,e),this}o(vI,"mapCacheSet");Jc.prototype.clear=mI;Jc.prototype.delete=bI;Jc.prototype.get=gI;Jc.prototype.has=yI;Jc.prototype.set=vI;function Wc(r){this.__data__=new bs(r)}o(Wc,"Stack");function wI(){this.__data__=new bs}o(wI,"stackClear");function xI(r){return this.__data__.delete(r)}o(xI,"stackDelete");function _I(r){return this.__data__.get(r)}o(_I,"stackGet");function AI(r){return this.__data__.has(r)}o(AI,"stackHas");function EI(r,e){var t=this.__data__;if(t instanceof bs){var n=t.__data__;if(!sl||n.length<MN-1)return n.push([r,e]),this;t=this.__data__=new Jc(n)}return t.set(r,e),this}o(EI,"stackSet");Wc.prototype.clear=wI;Wc.prototype.delete=xI;Wc.prototype.get=_I;Wc.prototype.has=AI;Wc.prototype.set=EI;function SI(r,e){var t=kb(r)||WI(r)?qN(r.length,String):[],n=t.length,i=!!n;for(var s in r)(e||Ao.call(r,s))&&!(i&&(s=="length"||jI(s,n)))&&t.push(s);return t}o(SI,"arrayLikeKeys");function E8(r,e,t){var n=r[e];(!(Ao.call(r,e)&&T8(n,t))||t===void 0&&!(e in r))&&(r[e]=t)}o(E8,"assignValue");function pp(r,e){for(var t=r.length;t--;)if(T8(r[t][0],e))return t;return-1}o(pp,"assocIndexOf");function CI(r,e){return r&&S8(e,Tb(e),r)}o(CI,"baseAssign");function xb(r,e,t,n,i,s,a){var c;if(n&&(c=s?n(r,i,s,a):n(r)),c!==void 0)return c;if(!bp(r))return r;var f=kb(r);if(f){if(c=HI(r),!e)return KI(r,c)}else{var l=xa(r),h=l==Ab||l==s8;if(XI(r))return II(r,e);if(l==Eb||l==_b||h&&!s){if(_8(r))return s?r:{};if(c=qI(h?{}:r),!e)return $I(r,CI(c,r))}else{if(!ut[l])return s?r:{};c=zI(r,l,xb,e)}}a||(a=new Wc);var d=a.get(r);if(d)return d;if(a.set(r,c),!f)var v=t?FI(r):Tb(r);return FN(v||r,function(x,y){v&&(y=x,x=r[y]),E8(c,y,xb(x,e,t,n,y,r,a))}),c}o(xb,"baseClone");function kI(r){return bp(r)?WN(r):{}}o(kI,"baseCreate");function TI(r,e,t){var n=e(r);return kb(r)?n:HN(n,t(r))}o(TI,"baseGetAllKeys");function MI(r){return dp.call(r)}o(MI,"baseGetTag");function BI(r){if(!bp(r)||GI(r))return!1;var e=B8(r)||_8(r)?GN:PN;return e.test(Aa(r))}o(BI,"baseIsNative");function NI(r){if(!k8(r))return QN(r);var e=[];for(var t in Object(r))Ao.call(r,t)&&t!="constructor"&&e.push(t);return e}o(NI,"baseKeys");function II(r,e){if(e)return r.slice();var t=new r.constructor(r.length);return r.copy(t),t}o(II,"cloneBuffer");function Cb(r){var e=new r.constructor(r.byteLength);return new X4(e).set(new X4(r)),e}o(Cb,"cloneArrayBuffer");function OI(r,e){var t=e?Cb(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}o(OI,"cloneDataView");function PI(r,e,t){var n=e?t(V4(r),!0):V4(r);return x8(n,KN,new r.constructor)}o(PI,"cloneMap");function RI(r){var e=new r.constructor(r.source,ON.exec(r));return e.lastIndex=r.lastIndex,e}o(RI,"cloneRegExp");function UI(r,e,t){var n=e?t(G4(r),!0):G4(r);return x8(n,$N,new r.constructor)}o(UI,"cloneSet");function LI(r){return e8?Object(e8.call(r)):{}}o(LI,"cloneSymbol");function DI(r,e){var t=e?Cb(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}o(DI,"cloneTypedArray");function KI(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}o(KI,"copyArray");function S8(r,e,t,n){t||(t={});for(var i=-1,s=e.length;++i<s;){var a=e[i],c=n?n(t[a],r[a],a,t,r):void 0;E8(t,a,c===void 0?r[a]:c)}return t}o(S8,"copyObject");function $I(r,e){return S8(r,C8(r),e)}o($I,"copySymbols");function FI(r){return TI(r,Tb,C8)}o(FI,"getAllKeys");function mp(r,e){var t=r.__data__;return VI(e)?t[typeof e=="string"?"string":"hash"]:t.map}o(mp,"getMapData");function Yc(r,e){var t=zN(r,e);return BI(t)?t:void 0}o(Yc,"getNative");var C8=Z4?Sb(Z4,Object):eO,xa=MI;(gb&&xa(new gb(new ArrayBuffer(1)))!=lp||sl&&xa(new sl)!=fp||yb&&xa(yb.resolve())!=z4||vb&&xa(new vb)!=up||wb&&xa(new wb)!=bb)&&(xa=o(function(r){var e=dp.call(r),t=e==Eb?r.constructor:void 0,n=t?Aa(t):void 0;if(n)switch(n){case eI:return lp;case tI:return fp;case rI:return z4;case nI:return up;case iI:return bb}return e},"getTag"));function HI(r){var e=r.length,t=r.constructor(e);return e&&typeof r[0]=="string"&&Ao.call(r,"index")&&(t.index=r.index,t.input=r.input),t}o(HI,"initCloneArray");function qI(r){return typeof r.constructor=="function"&&!k8(r)?kI(JN(r)):{}}o(qI,"initCloneObject");function zI(r,e,t,n){var i=r.constructor;switch(e){case u8:return Cb(r);case n8:case i8:return new i(+r);case lp:return OI(r,n);case l8:case h8:case d8:case p8:case m8:case b8:case g8:case y8:case v8:return DI(r,n);case fp:return PI(r,n,t);case o8:case c8:return new i(r);case a8:return RI(r);case up:return UI(r,n,t);case f8:return LI(r)}}o(zI,"initCloneByTag");function jI(r,e){return e=e==null?r8:e,!!e&&(typeof r=="number"||RN.test(r))&&r>-1&&r%1==0&&r<e}o(jI,"isIndex");function VI(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}o(VI,"isKeyable");function GI(r){return!!J4&&J4 in r}o(GI,"isMasked");function k8(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||hp;return r===t}o(k8,"isPrototype");function Aa(r){if(r!=null){try{return A8.call(r)}catch(e){}try{return r+""}catch(e){}}return""}o(Aa,"toSource");function JI(r){return xb(r,!0,!0)}o(JI,"cloneDeep");function T8(r,e){return r===e||r!==r&&e!==e}o(T8,"eq");function WI(r){return YI(r)&&Ao.call(r,"callee")&&(!YN.call(r,"callee")||dp.call(r)==_b)}o(WI,"isArguments");var kb=Array.isArray;function M8(r){return r!=null&&ZI(r.length)&&!B8(r)}o(M8,"isArrayLike");function YI(r){return QI(r)&&M8(r)}o(YI,"isArrayLikeObject");var XI=ZN||tO;function B8(r){var e=bp(r)?dp.call(r):"";return e==Ab||e==s8}o(B8,"isFunction");function ZI(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=r8}o(ZI,"isLength");function bp(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}o(bp,"isObject");function QI(r){return!!r&&typeof r=="object"}o(QI,"isObjectLike");function Tb(r){return M8(r)?SI(r):NI(r)}o(Tb,"keys");function eO(){return[]}o(eO,"stubArray");function tO(){return!1}o(tO,"stubFalse");Gc.exports=JI});var d_=de((gs,h_)=>{var l_=typeof self!="undefined"?self:gs,Kp=function(){function r(){this.fetch=!1,this.DOMException=l_.DOMException}return o(r,"F"),r.prototype=l_,new r}();(function(r){var e=function(t){var n={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(b){return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function i(b){return b&&DataView.prototype.isPrototypeOf(b)}if(o(i,"isDataView"),n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(b){return b&&s.indexOf(Object.prototype.toString.call(b))>-1};function c(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(b))throw new TypeError("Invalid character in header field name");return b.toLowerCase()}o(c,"normalizeName");function f(b){return typeof b!="string"&&(b=String(b)),b}o(f,"normalizeValue");function l(b){var u={next:function(){var p=b.shift();return{done:p===void 0,value:p}}};return n.iterable&&(u[Symbol.iterator]=function(){return u}),u}o(l,"iteratorFor");function h(b){this.map={},b instanceof h?b.forEach(function(u,p){this.append(p,u)},this):Array.isArray(b)?b.forEach(function(u){this.append(u[0],u[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(u){this.append(u,b[u])},this)}o(h,"Headers"),h.prototype.append=function(b,u){b=c(b),u=f(u);var p=this.map[b];this.map[b]=p?p+", "+u:u},h.prototype.delete=function(b){delete this.map[c(b)]},h.prototype.get=function(b){return b=c(b),this.has(b)?this.map[b]:null},h.prototype.has=function(b){return this.map.hasOwnProperty(c(b))},h.prototype.set=function(b,u){this.map[c(b)]=f(u)},h.prototype.forEach=function(b,u){for(var p in this.map)this.map.hasOwnProperty(p)&&b.call(u,this.map[p],p,this)},h.prototype.keys=function(){var b=[];return this.forEach(function(u,p){b.push(p)}),l(b)},h.prototype.values=function(){var b=[];return this.forEach(function(u){b.push(u)}),l(b)},h.prototype.entries=function(){var b=[];return this.forEach(function(u,p){b.push([p,u])}),l(b)},n.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function d(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}o(d,"consumed");function v(b){return new Promise(function(u,p){b.onload=function(){u(b.result)},b.onerror=function(){p(b.error)}})}o(v,"fileReaderReady");function x(b){var u=new FileReader,p=v(u);return u.readAsArrayBuffer(b),p}o(x,"readBlobAsArrayBuffer");function y(b){var u=new FileReader,p=v(u);return u.readAsText(b),p}o(y,"readBlobAsText");function _(b){for(var u=new Uint8Array(b),p=new Array(u.length),m=0;m<u.length;m++)p[m]=String.fromCharCode(u[m]);return p.join("")}o(_,"readArrayBufferAsText");function U(b){if(b.slice)return b.slice(0);var u=new Uint8Array(b.byteLength);return u.set(new Uint8Array(b)),u.buffer}o(U,"bufferClone");function E(){return this.bodyUsed=!1,this._initBody=function(b){this._bodyInit=b,b?typeof b=="string"?this._bodyText=b:n.blob&&Blob.prototype.isPrototypeOf(b)?this._bodyBlob=b:n.formData&&FormData.prototype.isPrototypeOf(b)?this._bodyFormData=b:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)?this._bodyText=b.toString():n.arrayBuffer&&n.blob&&i(b)?(this._bodyArrayBuffer=U(b.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(b)||a(b))?this._bodyArrayBuffer=U(b):this._bodyText=b=Object.prototype.toString.call(b):this._bodyText="",this.headers.get("content-type")||(typeof b=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(x)}),this.text=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return y(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(_(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(j)}),this.json=function(){return this.text().then(JSON.parse)},this}o(E,"Body");var L=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(b){var u=b.toUpperCase();return L.indexOf(u)>-1?u:b}o(H,"normalizeMethod");function F(b,u){u=u||{};var p=u.body;if(b instanceof F){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,u.headers||(this.headers=new h(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!p&&b._bodyInit!=null&&(p=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=u.credentials||this.credentials||"same-origin",(u.headers||!this.headers)&&(this.headers=new h(u.headers)),this.method=H(u.method||this.method||"GET"),this.mode=u.mode||this.mode||null,this.signal=u.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&p)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(p)}o(F,"Request"),F.prototype.clone=function(){return new F(this,{body:this._bodyInit})};function j(b){var u=new FormData;return b.trim().split("&").forEach(function(p){if(p){var m=p.split("="),w=m.shift().replace(/\+/g," "),S=m.join("=").replace(/\+/g," ");u.append(decodeURIComponent(w),decodeURIComponent(S))}}),u}o(j,"decode");function D(b){var u=new h,p=b.replace(/\r?\n[\t ]+/g," ");return p.split(/\r?\n/).forEach(function(m){var w=m.split(":"),S=w.shift().trim();if(S){var I=w.join(":").trim();u.append(S,I)}}),u}o(D,"parseHeaders"),E.call(F.prototype);function B(b,u){u||(u={}),this.type="default",this.status=u.status===void 0?200:u.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in u?u.statusText:"OK",this.headers=new h(u.headers),this.url=u.url||"",this._initBody(b)}o(B,"Response"),E.call(B.prototype),B.prototype.clone=function(){return new B(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},B.error=function(){var b=new B(null,{status:0,statusText:""});return b.type="error",b};var R=[301,302,303,307,308];B.redirect=function(b,u){if(R.indexOf(u)===-1)throw new RangeError("Invalid status code");return new B(null,{status:u,headers:{location:b}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(b){t.DOMException=function(u,p){this.message=u,this.name=p;var m=Error(u);this.stack=m.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function Y(b,u){return new Promise(function(p,m){var w=new F(b,u);if(w.signal&&w.signal.aborted)return m(new t.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function I(){S.abort()}o(I,"abortXhr"),S.onload=function(){var N={status:S.status,statusText:S.statusText,headers:D(S.getAllResponseHeaders()||"")};N.url="responseURL"in S?S.responseURL:N.headers.get("X-Request-URL");var k="response"in S?S.response:S.responseText;p(new B(k,N))},S.onerror=function(){m(new TypeError("Network request failed"))},S.ontimeout=function(){m(new TypeError("Network request failed"))},S.onabort=function(){m(new t.DOMException("Aborted","AbortError"))},S.open(w.method,w.url,!0),w.credentials==="include"?S.withCredentials=!0:w.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&n.blob&&(S.responseType="blob"),w.headers.forEach(function(N,k){S.setRequestHeader(k,N)}),w.signal&&(w.signal.addEventListener("abort",I),S.onreadystatechange=function(){S.readyState===4&&w.signal.removeEventListener("abort",I)}),S.send(typeof w._bodyInit=="undefined"?null:w._bodyInit)})}return o(Y,"fetch"),Y.polyfill=!0,r.fetch||(r.fetch=Y,r.Headers=h,r.Request=F,r.Response=B),t.Headers=h,t.Request=F,t.Response=B,t.fetch=Y,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(Kp);Kp.fetch.ponyfill=!0;delete Kp.fetch.polyfill;var nf=Kp;gs=nf.fetch;gs.default=nf.fetch;gs.fetch=nf.fetch;gs.Headers=nf.Headers;gs.Request=nf.Request;gs.Response=nf.Response;h_.exports=gs});var m_=de((_G,$p)=>{"use strict";var{AbortController:p_,AbortSignal:TO}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;$p.exports=p_;$p.exports.AbortSignal=TO;$p.exports.default=p_});var C_=de((VG,S_)=>{"use strict";var IO=function(){function r(t,n){if(typeof t!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+t+"."));this._batchLoadFn=t,this._maxBatchSize=UO(n),this._batchScheduleFn=LO(n),this._cacheKeyFn=DO(n),this._cacheMap=KO(n),this._batch=null}o(r,"DataLoader");var e=r.prototype;return e.load=o(function(n){if(n==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(n)+"."));var i=PO(this),s=this._cacheMap,a=this._cacheKeyFn(n);if(s){var c=s.get(a);if(c){var f=i.cacheHits||(i.cacheHits=[]);return new Promise(function(h){f.push(function(){h(c)})})}}i.keys.push(n);var l=new Promise(function(h,d){i.callbacks.push({resolve:h,reject:d})});return s&&s.set(a,l),l},"load"),e.loadMany=o(function(n){if(!E_(n))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+n+"."));for(var i=[],s=0;s<n.length;s++)i.push(this.load(n[s]).catch(function(a){return a}));return Promise.all(i)},"loadMany"),e.clear=o(function(n){var i=this._cacheMap;if(i){var s=this._cacheKeyFn(n);i.delete(s)}return this},"clear"),e.clearAll=o(function(){var n=this._cacheMap;return n&&n.clear(),this},"clearAll"),e.prime=o(function(n,i){var s=this._cacheMap;if(s){var a=this._cacheKeyFn(n);if(s.get(a)===void 0){var c;i instanceof Error?(c=Promise.reject(i),c.catch(function(){})):c=Promise.resolve(i),s.set(a,c)}}return this},"prime"),r}(),OO=typeof process=="object"&&typeof process.nextTick=="function"?function(r){Vb||(Vb=Promise.resolve()),Vb.then(function(){process.nextTick(r)})}:typeof setImmediate=="function"?function(r){setImmediate(r)}:function(r){setTimeout(r)},Vb;function PO(r){var e=r._batch;if(e!==null&&!e.hasDispatched&&e.keys.length<r._maxBatchSize&&(!e.cacheHits||e.cacheHits.length<r._maxBatchSize))return e;var t={hasDispatched:!1,keys:[],callbacks:[]};return r._batch=t,r._batchScheduleFn(function(){RO(r,t)}),t}o(PO,"getCurrentBatch");function RO(r,e){if(e.hasDispatched=!0,e.keys.length===0){Gb(e);return}var t=r._batchLoadFn(e.keys);if(!t||typeof t.then!="function")return A_(r,e,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(t)+".")));t.then(function(n){if(!E_(n))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(n)+"."));if(n.length!==e.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(`
|
624
|
+
`,S},"errorsToHtml"),R=s(function(b,u,p){let m,w,S,N;return m="",b.forEach(I=>{w=u[I.line],m+=`${w.lineNo}: `,m+=`${w.beginChar}: `,m+=`${I.char-w.beginChar}: `,S=w.beginChar,N=I.char-w.beginChar,m+=v(p,S,N),m+=" >> ",S=I.char,N=w.beginChar+w.length-I.char,m+=v(p,S,N),m+=`
|
625
|
+
`,m+=`${w.lineNo}: `,m+=`${w.beginChar}: `,m+=`${I.char-w.beginChar}: `,m+="error: ",m+=I.msg,m+=`
|
626
|
+
`}),m},"errorsToAscii"),H=!1,$=!1,j=!1,D=!1,B=0,U;if(this.errors=[],Buffer.isBuffer(e))this.chars=o.decode("BINARY",e);else if(Array.isArray(e))this.chars=e.slice();else if(typeof e=="string")this.chars=o.decode("STRING",e);else throw new Error(`${t}input source is not a string, byte Buffer or character array`);this.sabnf=o.encode("STRING",this.chars),this.scan=s(function(b,u){this.lines=a(this.chars,this.errors,b,u),H=!0},"scan"),this.parse=s(function(b,u){if(!H)throw new Error(`${t}grammar not scanned`);f.syntax(this.chars,this.lines,this.errors,b,u),$=!0},"parse"),this.translate=s(function(){if(!$)throw new Error(`${t}grammar not scanned and parsed`);let b=f.semantic(this.chars,this.lines,this.errors);this.errors.length===0&&(this.rules=b.rules,this.udts=b.udts,U=b.lineMap,j=!0)},"translate"),this.attributes=s(function(){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return B=c(this.rules,this.udts,U,this.errors),D=!0,B},"attrs"),this.generate=s(function(b){if(this.lines=a(this.chars,this.errors,b),this.errors.length||(f.syntax(this.chars,this.lines,this.errors,b),this.errors.length))return;let u=f.semantic(this.chars,this.lines,this.errors);this.errors.length||(this.rules=u.rules,this.udts=u.udts,U=u.lineMap,B=c(this.rules,this.udts,U,this.errors),D=!0)},"generate"),this.displayRules=s(function(b="index"){if(!j)throw new Error(`${t}grammar not scanned, parsed and translated`);return y(this.rules,this.udts,b)},"displayRules"),this.displayRuleDependencies=s(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return d(b)},"displayRuleDependencies"),this.displayAttributes=s(function(b="index"){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return B&&h(b),l(b)},"displayAttributes"),this.displayAttributeErrors=s(function(){if(!D)throw new Error(`${t}no attributes - must be preceeded by call to attributes()`);return h()},"displayAttributeErrors"),this.toSource=s(function(b){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return f.generateSource(this.chars,this.lines,this.rules,this.udts,b)},"toSource"),this.toObject=s(function(){if(!D)throw new Error(`${t}can't generate parser source - must be preceeded by call to attributes()`);if(B)throw new Error(`${t}can't generate parser source - attributes have ${B} errors`);return f.generateObject(this.sabnf,this.rules,this.udts)},"toObject"),this.errorsToAscii=s(function(){return R(this.errors,this.lines,this.chars)},"errorsToAsciiFunc"),this.errorsToHtml=s(function(b){return _(this.errors,this.lines,this.chars,b)},"errorsToHtmlFunc"),this.linesToAscii=s(function(){return x(this.lines)},"linesToAsciiFunc"),this.linesToHtml=s(function(){return L(this.lines)},"linesToHtmlFunc")},"api")});var f4=de((Sq,a4)=>{a4.exports=cb;var s4=128,MB=127,BB=~MB,IB=Math.pow(2,31);function cb(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw cb.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=IB;)e[t++]=r&255|s4,r/=128;for(;r&BB;)e[t++]=r&255|s4,r>>>=7;return e[t]=r|0,cb.bytes=t-n+1,e}s(cb,"encode")});var l4=de((Cq,u4)=>{u4.exports=ub;var NB=128,c4=127;function ub(r,n){var t=0,n=n||0,i=0,o=n,a,f=r.length;do{if(o>=f||i>49)throw ub.bytes=0,new RangeError("Could not decode varint");a=r[o++],t+=i<28?(a&c4)<<i:(a&c4)*Math.pow(2,i),i+=7}while(a>=NB);return ub.bytes=o-n,t}s(ub,"read")});var d4=de((Tq,h4)=>{var OB=Math.pow(2,7),PB=Math.pow(2,14),RB=Math.pow(2,21),UB=Math.pow(2,28),LB=Math.pow(2,35),DB=Math.pow(2,42),FB=Math.pow(2,49),KB=Math.pow(2,56),$B=Math.pow(2,63);h4.exports=function(r){return r<OB?1:r<PB?2:r<RB?3:r<UB?4:r<LB?5:r<DB?6:r<FB?7:r<KB?8:r<$B?9:10}});var ol=de((kq,p4)=>{p4.exports={encode:f4(),decode:l4(),encodingLength:d4()}});var b4=de((Mq,m4)=>{"use strict";function HB(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var n=0;n<r.length;n++){var i=r.charAt(n),o=i.charCodeAt(0);if(e[o]!==255)throw new TypeError(i+" is ambiguous");e[o]=n}var a=r.length,f=r.charAt(0),c=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(A){if(A instanceof Uint8Array||(ArrayBuffer.isView(A)?A=new Uint8Array(A.buffer,A.byteOffset,A.byteLength):Array.isArray(A)&&(A=Uint8Array.from(A))),!(A instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(A.length===0)return"";for(var v=0,x=0,L=0,_=A.length;L!==_&&A[L]===0;)L++,v++;for(var R=(_-L)*l+1>>>0,H=new Uint8Array(R);L!==_;){for(var $=A[L],j=0,D=R-1;($!==0||j<x)&&D!==-1;D--,j++)$+=256*H[D]>>>0,H[D]=$%a>>>0,$=$/a>>>0;if($!==0)throw new Error("Non-zero carry");x=j,L++}for(var B=R-x;B!==R&&H[B]===0;)B++;for(var U=f.repeat(v);B<R;++B)U+=r.charAt(H[B]);return U}s(h,"encode");function d(A){if(typeof A!="string")throw new TypeError("Expected String");if(A.length===0)return new Uint8Array;var v=0;if(A[v]!==" "){for(var x=0,L=0;A[v]===f;)x++,v++;for(var _=(A.length-v)*c+1>>>0,R=new Uint8Array(_);A[v];){var H=e[A.charCodeAt(v)];if(H===255)return;for(var $=0,j=_-1;(H!==0||$<L)&&j!==-1;j--,$++)H+=a*R[j]>>>0,R[j]=H%256>>>0,H=H/256>>>0;if(H!==0)throw new Error("Non-zero carry");L=$,v++}if(A[v]!==" "){for(var D=_-L;D!==_&&R[D]===0;)D++;for(var B=new Uint8Array(x+(_-D)),U=x;D!==_;)B[U++]=R[D++];return B}}}s(d,"decodeUnsafe");function y(A){var v=d(A);if(v)return v;throw new Error("Non-base"+a+" character")}return s(y,"decode"),{encode:h,decodeUnsafe:d,decode:y}}s(HB,"base");m4.exports=HB});var hp=de((Bq,g4)=>{"use strict";var qB=new TextDecoder,zB=s(r=>qB.decode(r),"decodeText"),jB=new TextEncoder,VB=s(r=>jB.encode(r),"encodeText");function WB(r,e){let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}s(WB,"concat");g4.exports={decodeText:zB,encodeText:VB,concat:WB}});var v4=de((Iq,y4)=>{"use strict";var{encodeText:GB}=hp(),dp=class{constructor(e,t,n,i){this.name=e,this.code=t,this.codeBuf=GB(this.code),this.alphabet=i,this.codec=n(i)}encode(e){return this.codec.encode(e)}decode(e){for(let t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error(`invalid character '${t}' in '${e}'`);return this.codec.decode(e)}};s(dp,"Base");y4.exports=dp});var x4=de((Nq,w4)=>{"use strict";var JB=s((r,e,t)=>{let n={};for(let l=0;l<e.length;++l)n[e[l]]=l;let i=r.length;for(;r[i-1]==="=";)--i;let o=new Uint8Array(i*t/8|0),a=0,f=0,c=0;for(let l=0;l<i;++l){let h=n[r[l]];if(h===void 0)throw new SyntaxError("Invalid character "+r[l]);f=f<<t|h,a+=t,a>=8&&(a-=8,o[c++]=255&f>>a)}if(a>=t||255&f<<8-a)throw new SyntaxError("Unexpected end of data");return o},"decode"),YB=s((r,e,t)=>{let n=e[e.length-1]==="=",i=(1<<t)-1,o="",a=0,f=0;for(let c=0;c<r.length;++c)for(f=f<<8|r[c],a+=8;a>t;)a-=t,o+=e[i&f>>a];if(a&&(o+=e[i&f<<t-a]),n)for(;o.length*t&7;)o+="=";return o},"encode"),XB=s(r=>e=>({encode(t){return YB(t,e,r)},decode(t){return JB(t,e,r)}}),"rfc4648");w4.exports={rfc4648:XB}});var S4=de((Oq,E4)=>{"use strict";var sl=b4(),ZB=v4(),{rfc4648:gr}=x4(),{decodeText:QB,encodeText:eI}=hp(),tI=s(()=>({encode:QB,decode:eI}),"identity"),A4=[["identity","\0",tI,""],["base2","0",gr(1),"01"],["base8","7",gr(3),"01234567"],["base10","9",sl,"0123456789"],["base16","f",gr(4),"0123456789abcdef"],["base16upper","F",gr(4),"0123456789ABCDEF"],["base32hex","v",gr(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",gr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",gr(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",gr(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",gr(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",gr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",gr(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",gr(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",gr(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",sl,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",sl,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",sl,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",sl,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",gr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",gr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",gr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",gr(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],_4=A4.reduce((r,e)=>(r[e[0]]=new ZB(e[0],e[1],e[2],e[3]),r),{}),rI=A4.reduce((r,e)=>(r[e[1]]=_4[e[0]],r),{});E4.exports={names:_4,codes:rI}});var k4=de((yo,T4)=>{"use strict";var Qf=S4(),{encodeText:nI,decodeText:pp,concat:C4}=hp();function iI(r,e){if(!e)throw new Error("requires an encoded Uint8Array");let{name:t,codeBuf:n}=Sa(r);return fI(t,e),C4([n,e],n.length+e.length)}s(iI,"multibase");function oI(r,e){let t=Sa(r),n=nI(t.encode(e));return C4([t.codeBuf,n],t.codeBuf.length+n.length)}s(oI,"encode");function sI(r){r instanceof Uint8Array&&(r=pp(r));let e=r[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(e)&&(r=r.toLowerCase()),Sa(r[0]).decode(r.substring(1))}s(sI,"decode");function aI(r){if(r instanceof Uint8Array&&(r=pp(r)),Object.prototype.toString.call(r)!=="[object String]")return!1;try{return Sa(r[0]).name}catch(e){return!1}}s(aI,"isEncoded");function fI(r,e){Sa(r).decode(pp(e))}s(fI,"validEncode");function Sa(r){if(Object.prototype.hasOwnProperty.call(Qf.names,r))return Qf.names[r];if(Object.prototype.hasOwnProperty.call(Qf.codes,r))return Qf.codes[r];throw new Error(`Unsupported encoding: ${r}`)}s(Sa,"encoding");function cI(r){return r instanceof Uint8Array&&(r=pp(r)),Sa(r[0])}s(cI,"encodingFromData");yo=T4.exports=iI;yo.encode=oI;yo.decode=sI;yo.isEncoded=aI;yo.encoding=Sa;yo.encodingFromData=cI;var uI=Object.freeze(Qf.names),lI=Object.freeze(Qf.codes);yo.names=uI;yo.codes=lI});var B4=de((Pq,M4)=>{"use strict";function hI(r,e){for(let t=0;t<r.byteLength;t++){if(r[t]<e[t])return-1;if(r[t]>e[t])return 1}return r.byteLength>e.byteLength?1:r.byteLength<e.byteLength?-1:0}s(hI,"compare");M4.exports=hI});var N4=de((Rq,I4)=>{"use strict";function dI(r,e){e||(e=r.reduce((i,o)=>i+o.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}s(dI,"concat");I4.exports=dI});var P4=de((Uq,O4)=>{"use strict";function pI(r,e){if(r===e)return!0;if(r.byteLength!==e.byteLength)return!1;for(let t=0;t<r.byteLength;t++)if(r[t]!==e[t])return!1;return!0}s(pI,"equals");O4.exports=pI});var hb=de((Lq,D4)=>{"use strict";var{bases:R4}=(Qh(),Fg(sw));function L4(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}s(L4,"createCodec");var U4=L4("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),lb=L4("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),mI=ne({utf8:U4,"utf-8":U4,hex:R4.base16,latin1:lb,ascii:lb,binary:lb},R4);D4.exports=mI});var K4=de((Dq,F4)=>{"use strict";var bI=hb();function gI(r,e="utf8"){let t=bI[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}s(gI,"fromString");F4.exports=gI});var H4=de((Fq,$4)=>{"use strict";var yI=hb();function vI(r,e="utf8"){let t=yI[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}s(vI,"toString");$4.exports=vI});var z4=de((Kq,q4)=>{"use strict";function wI(r,e){if(r.length!==e.length)throw new Error("Inputs should have the same length");let t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r[n]^e[n];return t}s(wI,"xor");q4.exports=wI});var db=de(($q,j4)=>{"use strict";var xI=B4(),AI=N4(),_I=P4(),EI=K4(),SI=H4(),CI=z4();j4.exports={compare:xI,concat:AI,equals:_I,fromString:EI,toString:SI,xor:CI}});var V4=de(Oi=>{"use strict";var TI=Oi&&Oi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),kI=Oi&&Oi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),MI=Oi&&Oi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&TI(e,r,t);return kI(e,r),e};Object.defineProperty(Oi,"__esModule",{value:!0});Oi.keyToDidDoc=void 0;var BI=MI(db());function II(r,e){let t=`did:key:${e}`,n=`${t}#${e}`;return{id:t,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:t,publicKeyBase58:BI.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}s(II,"keyToDidDoc");Oi.keyToDidDoc=II});var W4=de(Pi=>{"use strict";var NI=Pi&&Pi.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),OI=Pi&&Pi.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),PI=Pi&&Pi.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&NI(e,r,t);return OI(e,r),e};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.keyToDidDoc=void 0;var pb=PI(db()),RI=Ad();function UI(r){let e=new Uint8Array(r.length+2);return e[0]=236,e[1]=1,e.set(r,2),`z${pb.toString(e,"base58btc")}`}s(UI,"encodeKey");function LI(r,e){let t=`did:key:${e}`,n=`${t}#${e}`,i=RI.convertPublicKeyToX25519(r),o=`${t}#${UI(i)}`;return{id:t,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:t,publicKeyBase58:pb.toString(r,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:o,type:"X25519KeyAgreementKey2019",controller:t,publicKeyBase58:pb.toString(i,"base58btc")}]}}s(LI,"keyToDidDoc");Pi.keyToDidDoc=LI});var Z4=de(Ln=>{"use strict";var DI=Ln&&Ln.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),FI=Ln&&Ln.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Y4=Ln&&Ln.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&DI(e,r,t);return FI(e,r),e},X4=Ln&&Ln.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ln,"__esModule",{value:!0});var G4=X4(ol()),KI=X4(k4()),$I=Y4(V4()),HI=Y4(W4()),qI="application/did+ld+json",J4="application/did+json",zI={231:$I,237:HI};Ln.default={getResolver:()=>({key:(r,e,t,n)=>M(Ln,null,function*(){let i=n.accept||J4,o={didResolutionMetadata:{contentType:i},didDocument:null,didDocumentMetadata:{}};try{let a=KI.default.decode(e.id),f=G4.default.decode(a),c=a.slice(G4.default.decode.bytes),l=yield zI[f].keyToDidDoc(c,e.id);i===qI?(l["@context"]="https://w3id.org/did/v1",o.didDocument=l):i===J4?o.didDocument=l:(delete o.didResolutionMetadata.contentType,o.didResolutionMetadata.error="representationNotSupported")}catch(a){o.didResolutionMetadata.error="invalidDid",o.didResolutionMetadata.message=a.toString()}return o})})}});var e8=de((jq,Q4)=>{"use strict";Q4.exports=function(r,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,n=e.cmp&&function(o){return function(a){return function(f,c){var l={key:f,value:a[f]},h={key:c,value:a[c]};return o(l,h)}}}(e.cmp),i=[];return s(function o(a){if(a&&a.toJSON&&typeof a.toJSON=="function"&&(a=a.toJSON()),a!==void 0){if(typeof a=="number")return isFinite(a)?""+a:"null";if(typeof a!="object")return JSON.stringify(a);var f,c;if(Array.isArray(a)){for(c="[",f=0;f<a.length;f++)f&&(c+=","),c+=o(a[f])||"null";return c+"]"}if(a===null)return"null";if(i.indexOf(a)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var l=i.push(a)-1,h=Object.keys(a).sort(n&&n(a));for(c="",f=0;f<h.length;f++){var d=h[f],y=o(a[d]);!y||(c&&(c+=","),c+=JSON.stringify(d)+":"+y)}return i.splice(l,1),"{"+c+"}"}},"stringify")(r)}});var zb=de((ml,ic)=>{var bN=200,k8="__lodash_hash_undefined__",M8=9007199254740991,Lb="[object Arguments]",gN="[object Array]",B8="[object Boolean]",I8="[object Date]",yN="[object Error]",Db="[object Function]",N8="[object GeneratorFunction]",Ep="[object Map]",O8="[object Number]",Fb="[object Object]",g8="[object Promise]",P8="[object RegExp]",Sp="[object Set]",R8="[object String]",U8="[object Symbol]",Ib="[object WeakMap]",L8="[object ArrayBuffer]",Cp="[object DataView]",D8="[object Float32Array]",F8="[object Float64Array]",K8="[object Int8Array]",$8="[object Int16Array]",H8="[object Int32Array]",q8="[object Uint8Array]",z8="[object Uint8ClampedArray]",j8="[object Uint16Array]",V8="[object Uint32Array]",vN=/[\\^$.*+?()[\]{}|]/g,wN=/\w*$/,xN=/^\[object .+?Constructor\]$/,AN=/^(?:0|[1-9]\d*)$/,ht={};ht[Lb]=ht[gN]=ht[L8]=ht[Cp]=ht[B8]=ht[I8]=ht[D8]=ht[F8]=ht[K8]=ht[$8]=ht[H8]=ht[Ep]=ht[O8]=ht[Fb]=ht[P8]=ht[Sp]=ht[R8]=ht[U8]=ht[q8]=ht[z8]=ht[j8]=ht[V8]=!0;ht[yN]=ht[Db]=ht[Ib]=!1;var _N=typeof global=="object"&&global&&global.Object===Object&&global,EN=typeof self=="object"&&self&&self.Object===Object&&self,wo=_N||EN||Function("return this")(),W8=typeof ml=="object"&&ml&&!ml.nodeType&&ml,y8=W8&&typeof ic=="object"&&ic&&!ic.nodeType&&ic,SN=y8&&y8.exports===W8;function CN(r,e){return r.set(e[0],e[1]),r}s(CN,"addMapEntry");function TN(r,e){return r.add(e),r}s(TN,"addSetEntry");function kN(r,e){for(var t=-1,n=r?r.length:0;++t<n&&e(r[t],t,r)!==!1;);return r}s(kN,"arrayEach");function MN(r,e){for(var t=-1,n=e.length,i=r.length;++t<n;)r[i+t]=e[t];return r}s(MN,"arrayPush");function G8(r,e,t,n){var i=-1,o=r?r.length:0;for(n&&o&&(t=r[++i]);++i<o;)t=e(t,r[i],i,r);return t}s(G8,"arrayReduce");function BN(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}s(BN,"baseTimes");function IN(r,e){return r==null?void 0:r[e]}s(IN,"getValue");function J8(r){var e=!1;if(r!=null&&typeof r.toString!="function")try{e=!!(r+"")}catch(t){}return e}s(J8,"isHostObject");function v8(r){var e=-1,t=Array(r.size);return r.forEach(function(n,i){t[++e]=[i,n]}),t}s(v8,"mapToArray");function Kb(r,e){return function(t){return r(e(t))}}s(Kb,"overArg");function w8(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}s(w8,"setToArray");var NN=Array.prototype,ON=Function.prototype,Tp=Object.prototype,Bb=wo["__core-js_shared__"],x8=function(){var r=/[^.]+$/.exec(Bb&&Bb.keys&&Bb.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),Y8=ON.toString,ks=Tp.hasOwnProperty,kp=Tp.toString,PN=RegExp("^"+Y8.call(ks).replace(vN,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),A8=SN?wo.Buffer:void 0,_8=wo.Symbol,E8=wo.Uint8Array,RN=Kb(Object.getPrototypeOf,Object),UN=Object.create,LN=Tp.propertyIsEnumerable,DN=NN.splice,S8=Object.getOwnPropertySymbols,FN=A8?A8.isBuffer:void 0,KN=Kb(Object.keys,Object),Nb=ac(wo,"DataView"),bl=ac(wo,"Map"),Ob=ac(wo,"Promise"),Pb=ac(wo,"Set"),Rb=ac(wo,"WeakMap"),gl=ac(Object,"create"),$N=Ba(Nb),HN=Ba(bl),qN=Ba(Ob),zN=Ba(Pb),jN=Ba(Rb),C8=_8?_8.prototype:void 0,T8=C8?C8.valueOf:void 0;function Ma(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}s(Ma,"Hash");function VN(){this.__data__=gl?gl(null):{}}s(VN,"hashClear");function WN(r){return this.has(r)&&delete this.__data__[r]}s(WN,"hashDelete");function GN(r){var e=this.__data__;if(gl){var t=e[r];return t===k8?void 0:t}return ks.call(e,r)?e[r]:void 0}s(GN,"hashGet");function JN(r){var e=this.__data__;return gl?e[r]!==void 0:ks.call(e,r)}s(JN,"hashHas");function YN(r,e){var t=this.__data__;return t[r]=gl&&e===void 0?k8:e,this}s(YN,"hashSet");Ma.prototype.clear=VN;Ma.prototype.delete=WN;Ma.prototype.get=GN;Ma.prototype.has=JN;Ma.prototype.set=YN;function xo(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}s(xo,"ListCache");function XN(){this.__data__=[]}s(XN,"listCacheClear");function ZN(r){var e=this.__data__,t=Mp(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():DN.call(e,t,1),!0}s(ZN,"listCacheDelete");function QN(r){var e=this.__data__,t=Mp(e,r);return t<0?void 0:e[t][1]}s(QN,"listCacheGet");function eO(r){return Mp(this.__data__,r)>-1}s(eO,"listCacheHas");function tO(r,e){var t=this.__data__,n=Mp(t,r);return n<0?t.push([r,e]):t[n][1]=e,this}s(tO,"listCacheSet");xo.prototype.clear=XN;xo.prototype.delete=ZN;xo.prototype.get=QN;xo.prototype.has=eO;xo.prototype.set=tO;function oc(r){var e=-1,t=r?r.length:0;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}s(oc,"MapCache");function rO(){this.__data__={hash:new Ma,map:new(bl||xo),string:new Ma}}s(rO,"mapCacheClear");function nO(r){return Bp(this,r).delete(r)}s(nO,"mapCacheDelete");function iO(r){return Bp(this,r).get(r)}s(iO,"mapCacheGet");function oO(r){return Bp(this,r).has(r)}s(oO,"mapCacheHas");function sO(r,e){return Bp(this,r).set(r,e),this}s(sO,"mapCacheSet");oc.prototype.clear=rO;oc.prototype.delete=nO;oc.prototype.get=iO;oc.prototype.has=oO;oc.prototype.set=sO;function sc(r){this.__data__=new xo(r)}s(sc,"Stack");function aO(){this.__data__=new xo}s(aO,"stackClear");function fO(r){return this.__data__.delete(r)}s(fO,"stackDelete");function cO(r){return this.__data__.get(r)}s(cO,"stackGet");function uO(r){return this.__data__.has(r)}s(uO,"stackHas");function lO(r,e){var t=this.__data__;if(t instanceof xo){var n=t.__data__;if(!bl||n.length<bN-1)return n.push([r,e]),this;t=this.__data__=new oc(n)}return t.set(r,e),this}s(lO,"stackSet");sc.prototype.clear=aO;sc.prototype.delete=fO;sc.prototype.get=cO;sc.prototype.has=uO;sc.prototype.set=lO;function hO(r,e){var t=Hb(r)||UO(r)?BN(r.length,String):[],n=t.length,i=!!n;for(var o in r)(e||ks.call(r,o))&&!(i&&(o=="length"||NO(o,n)))&&t.push(o);return t}s(hO,"arrayLikeKeys");function X8(r,e,t){var n=r[e];(!(ks.call(r,e)&&tA(n,t))||t===void 0&&!(e in r))&&(r[e]=t)}s(X8,"assignValue");function Mp(r,e){for(var t=r.length;t--;)if(tA(r[t][0],e))return t;return-1}s(Mp,"assocIndexOf");function dO(r,e){return r&&Z8(e,qb(e),r)}s(dO,"baseAssign");function Ub(r,e,t,n,i,o,a){var f;if(n&&(f=o?n(r,i,o,a):n(r)),f!==void 0)return f;if(!Ip(r))return r;var c=Hb(r);if(c){if(f=MO(r),!e)return CO(r,f)}else{var l=ka(r),h=l==Db||l==N8;if(DO(r))return vO(r,e);if(l==Fb||l==Lb||h&&!o){if(J8(r))return o?r:{};if(f=BO(h?{}:r),!e)return TO(r,dO(f,r))}else{if(!ht[l])return o?r:{};f=IO(r,l,Ub,e)}}a||(a=new sc);var d=a.get(r);if(d)return d;if(a.set(r,f),!c)var y=t?kO(r):qb(r);return kN(y||r,function(A,v){y&&(v=A,A=r[v]),X8(f,v,Ub(A,e,t,n,v,r,a))}),f}s(Ub,"baseClone");function pO(r){return Ip(r)?UN(r):{}}s(pO,"baseCreate");function mO(r,e,t){var n=e(r);return Hb(r)?n:MN(n,t(r))}s(mO,"baseGetAllKeys");function bO(r){return kp.call(r)}s(bO,"baseGetTag");function gO(r){if(!Ip(r)||PO(r))return!1;var e=nA(r)||J8(r)?PN:xN;return e.test(Ba(r))}s(gO,"baseIsNative");function yO(r){if(!eA(r))return KN(r);var e=[];for(var t in Object(r))ks.call(r,t)&&t!="constructor"&&e.push(t);return e}s(yO,"baseKeys");function vO(r,e){if(e)return r.slice();var t=new r.constructor(r.length);return r.copy(t),t}s(vO,"cloneBuffer");function $b(r){var e=new r.constructor(r.byteLength);return new E8(e).set(new E8(r)),e}s($b,"cloneArrayBuffer");function wO(r,e){var t=e?$b(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}s(wO,"cloneDataView");function xO(r,e,t){var n=e?t(v8(r),!0):v8(r);return G8(n,CN,new r.constructor)}s(xO,"cloneMap");function AO(r){var e=new r.constructor(r.source,wN.exec(r));return e.lastIndex=r.lastIndex,e}s(AO,"cloneRegExp");function _O(r,e,t){var n=e?t(w8(r),!0):w8(r);return G8(n,TN,new r.constructor)}s(_O,"cloneSet");function EO(r){return T8?Object(T8.call(r)):{}}s(EO,"cloneSymbol");function SO(r,e){var t=e?$b(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}s(SO,"cloneTypedArray");function CO(r,e){var t=-1,n=r.length;for(e||(e=Array(n));++t<n;)e[t]=r[t];return e}s(CO,"copyArray");function Z8(r,e,t,n){t||(t={});for(var i=-1,o=e.length;++i<o;){var a=e[i],f=n?n(t[a],r[a],a,t,r):void 0;X8(t,a,f===void 0?r[a]:f)}return t}s(Z8,"copyObject");function TO(r,e){return Z8(r,Q8(r),e)}s(TO,"copySymbols");function kO(r){return mO(r,qb,Q8)}s(kO,"getAllKeys");function Bp(r,e){var t=r.__data__;return OO(e)?t[typeof e=="string"?"string":"hash"]:t.map}s(Bp,"getMapData");function ac(r,e){var t=IN(r,e);return gO(t)?t:void 0}s(ac,"getNative");var Q8=S8?Kb(S8,Object):$O,ka=bO;(Nb&&ka(new Nb(new ArrayBuffer(1)))!=Cp||bl&&ka(new bl)!=Ep||Ob&&ka(Ob.resolve())!=g8||Pb&&ka(new Pb)!=Sp||Rb&&ka(new Rb)!=Ib)&&(ka=s(function(r){var e=kp.call(r),t=e==Fb?r.constructor:void 0,n=t?Ba(t):void 0;if(n)switch(n){case $N:return Cp;case HN:return Ep;case qN:return g8;case zN:return Sp;case jN:return Ib}return e},"getTag"));function MO(r){var e=r.length,t=r.constructor(e);return e&&typeof r[0]=="string"&&ks.call(r,"index")&&(t.index=r.index,t.input=r.input),t}s(MO,"initCloneArray");function BO(r){return typeof r.constructor=="function"&&!eA(r)?pO(RN(r)):{}}s(BO,"initCloneObject");function IO(r,e,t,n){var i=r.constructor;switch(e){case L8:return $b(r);case B8:case I8:return new i(+r);case Cp:return wO(r,n);case D8:case F8:case K8:case $8:case H8:case q8:case z8:case j8:case V8:return SO(r,n);case Ep:return xO(r,n,t);case O8:case R8:return new i(r);case P8:return AO(r);case Sp:return _O(r,n,t);case U8:return EO(r)}}s(IO,"initCloneByTag");function NO(r,e){return e=e==null?M8:e,!!e&&(typeof r=="number"||AN.test(r))&&r>-1&&r%1==0&&r<e}s(NO,"isIndex");function OO(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}s(OO,"isKeyable");function PO(r){return!!x8&&x8 in r}s(PO,"isMasked");function eA(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Tp;return r===t}s(eA,"isPrototype");function Ba(r){if(r!=null){try{return Y8.call(r)}catch(e){}try{return r+""}catch(e){}}return""}s(Ba,"toSource");function RO(r){return Ub(r,!0,!0)}s(RO,"cloneDeep");function tA(r,e){return r===e||r!==r&&e!==e}s(tA,"eq");function UO(r){return LO(r)&&ks.call(r,"callee")&&(!LN.call(r,"callee")||kp.call(r)==Lb)}s(UO,"isArguments");var Hb=Array.isArray;function rA(r){return r!=null&&FO(r.length)&&!nA(r)}s(rA,"isArrayLike");function LO(r){return KO(r)&&rA(r)}s(LO,"isArrayLikeObject");var DO=FN||HO;function nA(r){var e=Ip(r)?kp.call(r):"";return e==Db||e==N8}s(nA,"isFunction");function FO(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=M8}s(FO,"isLength");function Ip(r){var e=typeof r;return!!r&&(e=="object"||e=="function")}s(Ip,"isObject");function KO(r){return!!r&&typeof r=="object"}s(KO,"isObjectLike");function qb(r){return rA(r)?hO(r):yO(r)}s(qb,"keys");function $O(){return[]}s($O,"stubArray");function HO(){return!1}s(HO,"stubFalse");ic.exports=RO});var KA=de((Ao,FA)=>{var DA=typeof self!="undefined"?self:Ao,e0=function(){function r(){this.fetch=!1,this.DOMException=DA.DOMException}return s(r,"F"),r.prototype=DA,new r}();(function(r){var e=function(t){var n={searchParams:"URLSearchParams"in r,iterable:"Symbol"in r&&"iterator"in Symbol,blob:"FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(b){return!1}}(),formData:"FormData"in r,arrayBuffer:"ArrayBuffer"in r};function i(b){return b&&DataView.prototype.isPrototypeOf(b)}if(s(i,"isDataView"),n.arrayBuffer)var o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(b){return b&&o.indexOf(Object.prototype.toString.call(b))>-1};function f(b){if(typeof b!="string"&&(b=String(b)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(b))throw new TypeError("Invalid character in header field name");return b.toLowerCase()}s(f,"normalizeName");function c(b){return typeof b!="string"&&(b=String(b)),b}s(c,"normalizeValue");function l(b){var u={next:function(){var p=b.shift();return{done:p===void 0,value:p}}};return n.iterable&&(u[Symbol.iterator]=function(){return u}),u}s(l,"iteratorFor");function h(b){this.map={},b instanceof h?b.forEach(function(u,p){this.append(p,u)},this):Array.isArray(b)?b.forEach(function(u){this.append(u[0],u[1])},this):b&&Object.getOwnPropertyNames(b).forEach(function(u){this.append(u,b[u])},this)}s(h,"Headers"),h.prototype.append=function(b,u){b=f(b),u=c(u);var p=this.map[b];this.map[b]=p?p+", "+u:u},h.prototype.delete=function(b){delete this.map[f(b)]},h.prototype.get=function(b){return b=f(b),this.has(b)?this.map[b]:null},h.prototype.has=function(b){return this.map.hasOwnProperty(f(b))},h.prototype.set=function(b,u){this.map[f(b)]=c(u)},h.prototype.forEach=function(b,u){for(var p in this.map)this.map.hasOwnProperty(p)&&b.call(u,this.map[p],p,this)},h.prototype.keys=function(){var b=[];return this.forEach(function(u,p){b.push(p)}),l(b)},h.prototype.values=function(){var b=[];return this.forEach(function(u){b.push(u)}),l(b)},h.prototype.entries=function(){var b=[];return this.forEach(function(u,p){b.push([p,u])}),l(b)},n.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function d(b){if(b.bodyUsed)return Promise.reject(new TypeError("Already read"));b.bodyUsed=!0}s(d,"consumed");function y(b){return new Promise(function(u,p){b.onload=function(){u(b.result)},b.onerror=function(){p(b.error)}})}s(y,"fileReaderReady");function A(b){var u=new FileReader,p=y(u);return u.readAsArrayBuffer(b),p}s(A,"readBlobAsArrayBuffer");function v(b){var u=new FileReader,p=y(u);return u.readAsText(b),p}s(v,"readBlobAsText");function x(b){for(var u=new Uint8Array(b),p=new Array(u.length),m=0;m<u.length;m++)p[m]=String.fromCharCode(u[m]);return p.join("")}s(x,"readArrayBufferAsText");function L(b){if(b.slice)return b.slice(0);var u=new Uint8Array(b.byteLength);return u.set(new Uint8Array(b)),u.buffer}s(L,"bufferClone");function _(){return this.bodyUsed=!1,this._initBody=function(b){this._bodyInit=b,b?typeof b=="string"?this._bodyText=b:n.blob&&Blob.prototype.isPrototypeOf(b)?this._bodyBlob=b:n.formData&&FormData.prototype.isPrototypeOf(b)?this._bodyFormData=b:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)?this._bodyText=b.toString():n.arrayBuffer&&n.blob&&i(b)?(this._bodyArrayBuffer=L(b.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(b)||a(b))?this._bodyArrayBuffer=L(b):this._bodyText=b=Object.prototype.toString.call(b):this._bodyText="",this.headers.get("content-type")||(typeof b=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(b)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(A)}),this.text=function(){var b=d(this);if(b)return b;if(this._bodyBlob)return v(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(x(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(j)}),this.json=function(){return this.text().then(JSON.parse)},this}s(_,"Body");var R=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function H(b){var u=b.toUpperCase();return R.indexOf(u)>-1?u:b}s(H,"normalizeMethod");function $(b,u){u=u||{};var p=u.body;if(b instanceof $){if(b.bodyUsed)throw new TypeError("Already read");this.url=b.url,this.credentials=b.credentials,u.headers||(this.headers=new h(b.headers)),this.method=b.method,this.mode=b.mode,this.signal=b.signal,!p&&b._bodyInit!=null&&(p=b._bodyInit,b.bodyUsed=!0)}else this.url=String(b);if(this.credentials=u.credentials||this.credentials||"same-origin",(u.headers||!this.headers)&&(this.headers=new h(u.headers)),this.method=H(u.method||this.method||"GET"),this.mode=u.mode||this.mode||null,this.signal=u.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&p)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(p)}s($,"Request"),$.prototype.clone=function(){return new $(this,{body:this._bodyInit})};function j(b){var u=new FormData;return b.trim().split("&").forEach(function(p){if(p){var m=p.split("="),w=m.shift().replace(/\+/g," "),S=m.join("=").replace(/\+/g," ");u.append(decodeURIComponent(w),decodeURIComponent(S))}}),u}s(j,"decode");function D(b){var u=new h,p=b.replace(/\r?\n[\t ]+/g," ");return p.split(/\r?\n/).forEach(function(m){var w=m.split(":"),S=w.shift().trim();if(S){var N=w.join(":").trim();u.append(S,N)}}),u}s(D,"parseHeaders"),_.call($.prototype);function B(b,u){u||(u={}),this.type="default",this.status=u.status===void 0?200:u.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in u?u.statusText:"OK",this.headers=new h(u.headers),this.url=u.url||"",this._initBody(b)}s(B,"Response"),_.call(B.prototype),B.prototype.clone=function(){return new B(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},B.error=function(){var b=new B(null,{status:0,statusText:""});return b.type="error",b};var U=[301,302,303,307,308];B.redirect=function(b,u){if(U.indexOf(u)===-1)throw new RangeError("Invalid status code");return new B(null,{status:u,headers:{location:b}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(b){t.DOMException=function(u,p){this.message=u,this.name=p;var m=Error(u);this.stack=m.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function Y(b,u){return new Promise(function(p,m){var w=new $(b,u);if(w.signal&&w.signal.aborted)return m(new t.DOMException("Aborted","AbortError"));var S=new XMLHttpRequest;function N(){S.abort()}s(N,"abortXhr"),S.onload=function(){var I={status:S.status,statusText:S.statusText,headers:D(S.getAllResponseHeaders()||"")};I.url="responseURL"in S?S.responseURL:I.headers.get("X-Request-URL");var T="response"in S?S.response:S.responseText;p(new B(T,I))},S.onerror=function(){m(new TypeError("Network request failed"))},S.ontimeout=function(){m(new TypeError("Network request failed"))},S.onabort=function(){m(new t.DOMException("Aborted","AbortError"))},S.open(w.method,w.url,!0),w.credentials==="include"?S.withCredentials=!0:w.credentials==="omit"&&(S.withCredentials=!1),"responseType"in S&&n.blob&&(S.responseType="blob"),w.headers.forEach(function(I,T){S.setRequestHeader(T,I)}),w.signal&&(w.signal.addEventListener("abort",N),S.onreadystatechange=function(){S.readyState===4&&w.signal.removeEventListener("abort",N)}),S.send(typeof w._bodyInit=="undefined"?null:w._bodyInit)})}return s(Y,"fetch"),Y.polyfill=!0,r.fetch||(r.fetch=Y,r.Headers=h,r.Request=$,r.Response=B),t.Headers=h,t.Request=$,t.Response=B,t.fetch=Y,Object.defineProperty(t,"__esModule",{value:!0}),t}({})})(e0);e0.fetch.ponyfill=!0;delete e0.fetch.polyfill;var pc=e0;Ao=pc.fetch;Ao.default=pc.fetch;Ao.fetch=pc.fetch;Ao.Headers=pc.Headers;Ao.Request=pc.Request;Ao.Response=pc.Response;FA.exports=Ao});var HA=de((iJ,t0)=>{"use strict";var{AbortController:$A,AbortSignal:mP}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;t0.exports=$A;t0.exports.AbortSignal=mP;t0.exports.default=$A});var QA=de((kJ,ZA)=>{"use strict";var vP=function(){function r(t,n){if(typeof t!="function")throw new TypeError("DataLoader must be constructed with a function which accepts "+("Array<key> and returns Promise<Array<value>>, but got: "+t+"."));this._batchLoadFn=t,this._maxBatchSize=_P(n),this._batchScheduleFn=EP(n),this._cacheKeyFn=SP(n),this._cacheMap=CP(n),this._batch=null}s(r,"DataLoader");var e=r.prototype;return e.load=s(function(n){if(n==null)throw new TypeError("The loader.load() function must be called with a value, "+("but got: "+String(n)+"."));var i=xP(this),o=this._cacheMap,a=this._cacheKeyFn(n);if(o){var f=o.get(a);if(f){var c=i.cacheHits||(i.cacheHits=[]);return new Promise(function(h){c.push(function(){h(f)})})}}i.keys.push(n);var l=new Promise(function(h,d){i.callbacks.push({resolve:h,reject:d})});return o&&o.set(a,l),l},"load"),e.loadMany=s(function(n){if(!XA(n))throw new TypeError("The loader.loadMany() function must be called with Array<key> "+("but got: "+n+"."));for(var i=[],o=0;o<n.length;o++)i.push(this.load(n[o]).catch(function(a){return a}));return Promise.all(i)},"loadMany"),e.clear=s(function(n){var i=this._cacheMap;if(i){var o=this._cacheKeyFn(n);i.delete(o)}return this},"clear"),e.clearAll=s(function(){var n=this._cacheMap;return n&&n.clear(),this},"clearAll"),e.prime=s(function(n,i){var o=this._cacheMap;if(o){var a=this._cacheKeyFn(n);if(o.get(a)===void 0){var f;i instanceof Error?(f=Promise.reject(i),f.catch(function(){})):f=Promise.resolve(i),o.set(a,f)}}return this},"prime"),r}(),wP=typeof process=="object"&&typeof process.nextTick=="function"?function(r){ag||(ag=Promise.resolve()),ag.then(function(){process.nextTick(r)})}:typeof setImmediate=="function"?function(r){setImmediate(r)}:function(r){setTimeout(r)},ag;function xP(r){var e=r._batch;if(e!==null&&!e.hasDispatched&&e.keys.length<r._maxBatchSize&&(!e.cacheHits||e.cacheHits.length<r._maxBatchSize))return e;var t={hasDispatched:!1,keys:[],callbacks:[]};return r._batch=t,r._batchScheduleFn(function(){AP(r,t)}),t}s(xP,"getCurrentBatch");function AP(r,e){if(e.hasDispatched=!0,e.keys.length===0){fg(e);return}var t=r._batchLoadFn(e.keys);if(!t||typeof t.then!="function")return YA(r,e,new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise: "+String(t)+".")));t.then(function(n){if(!XA(n))throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did "+("not return a Promise of an Array: "+String(n)+"."));if(n.length!==e.keys.length)throw new TypeError("DataLoader must be constructed with a function which accepts Array<key> and returns Promise<Array<value>>, but the function did not return a Promise of an Array of the same length as the Array of keys."+(`
|
627
627
|
|
628
628
|
Keys:
|
629
629
|
`+String(e.keys))+(`
|
630
630
|
|
631
631
|
Values:
|
632
|
-
`+String(n)));Gb(e);for(var i=0;i<e.callbacks.length;i++){var s=n[i];s instanceof Error?e.callbacks[i].reject(s):e.callbacks[i].resolve(s)}}).catch(function(n){A_(r,e,n)})}o(RO,"dispatchBatch");function A_(r,e,t){Gb(e);for(var n=0;n<e.keys.length;n++)r.clear(e.keys[n]),e.callbacks[n].reject(t)}o(A_,"failedDispatch");function Gb(r){if(r.cacheHits)for(var e=0;e<r.cacheHits.length;e++)r.cacheHits[e]()}o(Gb,"resolveCacheHits");function UO(r){var e=!r||r.batch!==!1;if(!e)return 1;var t=r&&r.maxBatchSize;if(t===void 0)return 1/0;if(typeof t!="number"||t<1)throw new TypeError("maxBatchSize must be a positive number: "+t);return t}o(UO,"getValidMaxBatchSize");function LO(r){var e=r&&r.batchScheduleFn;if(e===void 0)return OO;if(typeof e!="function")throw new TypeError("batchScheduleFn must be a function: "+e);return e}o(LO,"getValidBatchScheduleFn");function DO(r){var e=r&&r.cacheKeyFn;if(e===void 0)return function(t){return t};if(typeof e!="function")throw new TypeError("cacheKeyFn must be a function: "+e);return e}o(DO,"getValidCacheKeyFn");function KO(r){var e=!r||r.cache!==!1;if(!e)return null;var t=r&&r.cacheMap;if(t===void 0)return new Map;if(t!==null){var n=["get","set","delete","clear"],i=n.filter(function(s){return t&&typeof t[s]!="function"});if(i.length!==0)throw new TypeError("Custom cacheMap missing methods: "+i.join(", "))}return t}o(KO,"getValidCacheMap");function E_(r){return typeof r=="object"&&r!==null&&typeof r.length=="number"&&(r.length===0||r.length>0&&Object.prototype.hasOwnProperty.call(r,r.length-1))}o(E_,"isArrayLike");S_.exports=IO});var L_=de((fJ,U_)=>{"use strict";U_.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var H_=de((uJ,F_)=>{"use strict";var $_="%[a-f0-9]{2}",D_=new RegExp($_,"gi"),K_=new RegExp("("+$_+")+","gi");function ng(r,e){try{return decodeURIComponent(r.join(""))}catch(i){}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],ng(t),ng(n))}o(ng,"decodeComponents");function nP(r){try{return decodeURIComponent(r)}catch(n){for(var e=r.match(D_),t=1;t<e.length;t++)r=ng(e,t).join(""),e=r.match(D_);return r}}o(nP,"decode");function iP(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=K_.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(c){var n=nP(t[0]);n!==t[0]&&(e[t[0]]=n)}t=K_.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),s=0;s<i.length;s++){var a=i[s];r=r.replace(new RegExp(a,"g"),e[a])}return r}o(iP,"customDecodeURIComponent");F_.exports=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return iP(r)}}});var z_=de((lJ,q_)=>{"use strict";q_.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var V_=de((hJ,j_)=>{"use strict";j_.exports=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),s=0;s<n.length;s++){var a=n[s],c=r[a];(i?e.indexOf(a)!==-1:e(a,c,r))&&(t[a]=c)}return t}});var eA=de(Wr=>{"use strict";var sP=L_(),oP=H_(),J_=z_(),aP=V_(),cP=o(r=>r==null,"isNullOrUndefined"),ig=Symbol("encodeFragmentIdentifier");function fP(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{let i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),"[",i,"]"].join("")]:[...t,[Ft(e,r),"[",Ft(i,r),"]=",Ft(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),"[]"].join("")]:[...t,[Ft(e,r),"[]=",Ft(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[Ft(e,r),":list="].join("")]:[...t,[Ft(e,r),":list=",Ft(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[Ft(t,r),e,Ft(i,r)].join("")]:[[n,Ft(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,Ft(e,r)]:[...t,[Ft(e,r),"=",Ft(n,r)].join("")]}}o(fP,"encoderForArrayFormat");function uP(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"comma":case"separator":return(t,n,i)=>{let s=typeof n=="string"&&n.includes(r.arrayFormatSeparator),a=typeof n=="string"&&!s&&ws(n,r).includes(r.arrayFormatSeparator);n=a?ws(n,r):n;let c=s||a?n.split(r.arrayFormatSeparator).map(f=>ws(f,r)):n===null?n:ws(n,r);i[t]=c};case"bracket-separator":return(t,n,i)=>{let s=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!s){i[t]=n&&ws(n,r);return}let a=n===null?[]:n.split(r.arrayFormatSeparator).map(c=>ws(c,r));if(i[t]===void 0){i[t]=a;return}i[t]=[].concat(i[t],a)};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[].concat(i[t],n)}}}o(uP,"parserForArrayFormat");function W_(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}o(W_,"validateArrayFormatSeparator");function Ft(r,e){return e.encode?e.strict?sP(r):encodeURIComponent(r):r}o(Ft,"encode");function ws(r,e){return e.decode?oP(r):r}o(ws,"decode");function Y_(r){return Array.isArray(r)?r.sort():typeof r=="object"?Y_(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}o(Y_,"keysSorter");function X_(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}o(X_,"removeHash");function lP(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}o(lP,"getHash");function Z_(r){r=X_(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}o(Z_,"extract");function G_(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}o(G_,"parseValue");function Q_(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),W_(e.arrayFormatSeparator);let t=uP(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(let i of r.split("&")){if(i==="")continue;let[s,a]=J_(e.decode?i.replace(/\+/g," "):i,"=");a=a===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?a:ws(a,e),t(ws(s,e),a,n)}for(let i of Object.keys(n)){let s=n[i];if(typeof s=="object"&&s!==null)for(let a of Object.keys(s))s[a]=G_(s[a],e);else n[i]=G_(s,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,s)=>{let a=n[s];return Boolean(a)&&typeof a=="object"&&!Array.isArray(a)?i[s]=Y_(a):i[s]=a,i},Object.create(null))}o(Q_,"parse");Wr.extract=Z_;Wr.parse=Q_;Wr.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),W_(e.arrayFormatSeparator);let t=o(a=>e.skipNull&&cP(r[a])||e.skipEmptyString&&r[a]==="","shouldFilter"),n=fP(e),i={};for(let a of Object.keys(r))t(a)||(i[a]=r[a]);let s=Object.keys(i);return e.sort!==!1&&s.sort(e.sort),s.map(a=>{let c=r[a];return c===void 0?"":c===null?Ft(a,e):Array.isArray(c)?c.length===0&&e.arrayFormat==="bracket-separator"?Ft(a,e)+"[]":c.reduce(n(a),[]).join("&"):Ft(a,e)+"="+Ft(c,e)}).filter(a=>a.length>0).join("&")};Wr.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,n]=J_(r,"#");return Object.assign({url:t.split("?")[0]||"",query:Q_(Z_(r),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:ws(n,e)}:{})};Wr.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[ig]:!0},e);let t=X_(r.url).split("?")[0]||"",n=Wr.extract(r.url),i=Wr.parse(n,{sort:!1}),s=Object.assign(i,r.query),a=Wr.stringify(s,e);a&&(a=`?${a}`);let c=lP(r.url);return r.fragmentIdentifier&&(c=`#${e[ig]?Ft(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${a}${c}`};Wr.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[ig]:!1},t);let{url:n,query:i,fragmentIdentifier:s}=Wr.parseUrl(r,t);return Wr.stringifyUrl({url:n,query:aP(i,e),fragmentIdentifier:s},t)};Wr.exclude=(r,e,t)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,s)=>!e(i,s);return Wr.pick(r,n,t)}});var wP={};Mt(wP,{walletFromKey:()=>dA});module.exports=hg(wP);var Ce,dg=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});dg.decode();var _l=null;function Oa(){return(_l===null||_l.buffer!==Ce.memory.buffer)&&(_l=new Uint8Array(Ce.memory.buffer)),_l}o(Oa,"getUint8Memory0");function Ui(r,e){return dg.decode(Oa().subarray(r,r+e))}o(Ui,"getStringFromWasm0");var Li=new Array(32).fill(void 0);Li.push(void 0,null,!0,!1);var cf=Li.length;function Ue(r){cf===Li.length&&Li.push(Li.length+1);let e=cf;return cf=Li[e],Li[e]=r,e}o(Ue,"addHeapObject");function Me(r){return Li[r]}o(Me,"getObject");function wA(r){r<36||(Li[r]=cf,cf=r)}o(wA,"dropObject");function Di(r){let e=Me(r);return wA(r),e}o(Di,"takeObject");var Pt=0,El=new TextEncoder("utf-8"),xA=typeof El.encodeInto=="function"?function(r,e){return El.encodeInto(r,e)}:function(r,e){let t=El.encode(r);return e.set(t),{read:r.length,written:t.length}};function sr(r,e,t){if(t===void 0){let c=El.encode(r),f=e(c.length);return Oa().subarray(f,f+c.length).set(c),Pt=c.length,f}let n=r.length,i=e(n),s=Oa(),a=0;for(;a<n;a++){let c=r.charCodeAt(a);if(c>127)break;s[i+a]=c}if(a!==n){a!==0&&(r=r.slice(a)),i=t(i,n,n=a+r.length*3);let c=Oa().subarray(i+a,i+n);a+=xA(r,c).written}return Pt=a,i}o(sr,"passStringToWasm0");function _A(r){return r==null}o(_A,"isLikeNone");var Al=null;function Pr(){return(Al===null||Al.buffer!==Ce.memory.buffer)&&(Al=new Int32Array(Ce.memory.buffer)),Al}o(Pr,"getInt32Memory0");function h0(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){let i=r.length,s="[";i>0&&(s+=h0(r[0]));for(let a=1;a<i;a++)s+=", "+h0(r[a]);return s+="]",s}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(i){return"Object"}return r instanceof Error?`${r.name}: ${r.message}
|
633
|
-
${r.stack}`:n}o(h0,"debugString");function AA(r,e,t,n){let i={a:r,b:e,cnt:1,dtor:t},s=o((...a)=>{i.cnt++;let c=i.a;i.a=0;try{return n(c,i.b,...a)}finally{--i.cnt===0?Ce.__wbindgen_export_2.get(i.dtor)(c,i.b):i.a=c}},"real");return s.original=i,s}o(AA,"makeMutClosure");function EA(r,e,t){Ce._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(r,e,Ue(t))}o(EA,"__wbg_adapter_24");function SA(r,e){let t=e(r.length*1);return Oa().set(r,t/1),Pt=r.length,t}o(SA,"passArray8ToWasm0");function pg(r){try{let c=Ce.__wbindgen_add_to_stack_pointer(-16),f=SA(r,Ce.__wbindgen_malloc),l=Pt;Ce.generateEd25519KeyFromBytes(c,f,l);var e=Pr()[c/4+0],t=Pr()[c/4+1],n=Pr()[c/4+2],i=Pr()[c/4+3],s=e,a=t;if(i)throw s=0,a=0,Di(n);return Ui(s,a)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(s,a)}}o(pg,"generateEd25519KeyFromBytes");function mg(r,e){try{let f=Ce.__wbindgen_add_to_stack_pointer(-16),l=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),h=Pt,d=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),v=Pt;Ce.keyToDID(f,l,h,d,v);var t=Pr()[f/4+0],n=Pr()[f/4+1],i=Pr()[f/4+2],s=Pr()[f/4+3],a=t,c=n;if(s)throw a=0,c=0,Di(i);return Ui(a,c)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(a,c)}}o(mg,"keyToDID");function Sl(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.keyToVerificationMethod(t,n,i,s);return Di(a)}o(Sl,"keyToVerificationMethod");function bg(r,e,t){let n=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Pt,s=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Pt,c=sr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt,l=Ce.issueCredential(n,i,s,a,c,f);return Di(l)}o(bg,"issueCredential");function gg(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.verifyCredential(t,n,i,s);return Di(a)}o(gg,"verifyCredential");function yg(r,e,t){let n=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Pt,s=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Pt,c=sr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt,l=Ce.issuePresentation(n,i,s,a,c,f);return Di(l)}o(yg,"issuePresentation");function vg(r,e){let t=sr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Pt,i=sr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),s=Pt,a=Ce.verifyPresentation(t,n,i,s);return Di(a)}o(vg,"verifyPresentation");function mr(r,e){try{return r.apply(this,e)}catch(t){Ce.__wbindgen_exn_store(Ue(t))}}o(mr,"handleError");function CA(r,e){return Oa().subarray(r/1,r/1+e)}o(CA,"getArrayU8FromWasm0");function kA(r,e,t,n){Ce.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(r,e,Ue(t),Ue(n))}o(kA,"__wbg_adapter_108");function TA(r,e){return M(this,null,function*(){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return yield WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=yield r.arrayBuffer();return yield WebAssembly.instantiate(t,e)}else{let t=yield WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}})}o(TA,"load");function wg(r){return M(this,null,function*(){let e={};e.wbg={},e.wbg.__wbindgen_string_new=function(i,s){let a=Ui(i,s);return Ue(a)},e.wbg.__wbindgen_object_drop_ref=function(i){Di(i)},e.wbg.__wbindgen_cb_drop=function(i){let s=Di(i).original;return s.cnt--==1?(s.a=0,!0):!1},e.wbg.__wbindgen_object_clone_ref=function(i){let s=Me(i);return Ue(s)},e.wbg.__wbg_fetch_811d43d6bdcad5b1=function(i){let s=fetch(Me(i));return Ue(s)},e.wbg.__wbg_fetch_bf56e2a9f0644e3f=function(i,s){let a=Me(i).fetch(Me(s));return Ue(a)},e.wbg.__wbg_new_89d7f088c1c45353=function(){return mr(function(){let i=new Headers;return Ue(i)},arguments)},e.wbg.__wbg_append_f4f93bc73c45ee3e=function(){return mr(function(i,s,a,c,f){Me(i).append(Ui(s,a),Ui(c,f))},arguments)},e.wbg.__wbindgen_string_get=function(i,s){let a=Me(s),c=typeof a=="string"?a:void 0;var f=_A(c)?0:sr(c,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),l=Pt;Pr()[i/4+1]=l,Pr()[i/4+0]=f},e.wbg.__wbg_instanceof_Response_ccfeb62399355bcd=function(i){return Me(i)instanceof Response},e.wbg.__wbg_url_06c0f822d68d195c=function(i,s){let a=Me(s).url,c=sr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt;Pr()[i/4+1]=f,Pr()[i/4+0]=c},e.wbg.__wbg_status_600fd8b881393898=function(i){return Me(i).status},e.wbg.__wbg_headers_9e7f2c05a9b962ea=function(i){let s=Me(i).headers;return Ue(s)},e.wbg.__wbg_arrayBuffer_5a99283a3954c850=function(){return mr(function(i){let s=Me(i).arrayBuffer();return Ue(s)},arguments)},e.wbg.__wbg_newwithstrandinit_fd99688f189f053e=function(){return mr(function(i,s,a){let c=new Request(Ui(i,s),Me(a));return Ue(c)},arguments)},e.wbg.__wbindgen_is_object=function(i){let s=Me(i);return typeof s=="object"&&s!==null},e.wbg.__wbg_self_86b4b13392c7af56=function(){return mr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_crypto_b8c92eaac23d0d80=function(i){let s=Me(i).crypto;return Ue(s)},e.wbg.__wbg_msCrypto_9ad6677321a08dd8=function(i){let s=Me(i).msCrypto;return Ue(s)},e.wbg.__wbindgen_is_undefined=function(i){return Me(i)===void 0},e.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81=function(){return Ue(n)},e.wbg.__wbg_require_f5521a5b85ad2542=function(i,s,a){let c=Me(i).require(Ui(s,a));return Ue(c)},e.wbg.__wbg_getRandomValues_dd27e6b0652b3236=function(i){let s=Me(i).getRandomValues;return Ue(s)},e.wbg.__wbg_getRandomValues_e57c9b75ddead065=function(i,s){Me(i).getRandomValues(Me(s))},e.wbg.__wbg_randomFillSync_d2ba53160aec6aba=function(i,s,a){Me(i).randomFillSync(CA(s,a))},e.wbg.__wbindgen_is_function=function(i){return typeof Me(i)=="function"},e.wbg.__wbg_newnoargs_e23b458e372830de=function(i,s){let a=new Function(Ui(i,s));return Ue(a)},e.wbg.__wbg_next_cabb70b365520721=function(i){let s=Me(i).next;return Ue(s)},e.wbg.__wbg_next_bf3d83fc18df496e=function(){return mr(function(i){let s=Me(i).next();return Ue(s)},arguments)},e.wbg.__wbg_done_040f966faa9a72b3=function(i){return Me(i).done},e.wbg.__wbg_value_419afbd9b9574c4c=function(i){let s=Me(i).value;return Ue(s)},e.wbg.__wbg_iterator_4832ef1f15b0382b=function(){return Ue(Symbol.iterator)},e.wbg.__wbg_get_a9cab131e3152c49=function(){return mr(function(i,s){let a=Reflect.get(Me(i),Me(s));return Ue(a)},arguments)},e.wbg.__wbg_call_ae78342adc33730a=function(){return mr(function(i,s){let a=Me(i).call(Me(s));return Ue(a)},arguments)},e.wbg.__wbg_new_36359baae5a47e27=function(){let i=new Object;return Ue(i)},e.wbg.__wbg_call_3ed288a247f13ea5=function(){return mr(function(i,s,a){let c=Me(i).call(Me(s),Me(a));return Ue(c)},arguments)},e.wbg.__wbg_getTime_bffb1c09df09618b=function(i){return Me(i).getTime()},e.wbg.__wbg_new0_0ff7eb5c1486f3ec=function(){let i=new Date;return Ue(i)},e.wbg.__wbg_new_37705eed627d5ed9=function(i,s){try{var a={a:i,b:s},c=o((l,h)=>{let d=a.a;a.a=0;try{return kA(d,a.b,l,h)}finally{a.a=d}},"cb0");let f=new Promise(c);return Ue(f)}finally{a.a=a.b=0}},e.wbg.__wbg_resolve_a9a87bdd64e9e62c=function(i){let s=Promise.resolve(Me(i));return Ue(s)},e.wbg.__wbg_then_ce526c837d07b68f=function(i,s){let a=Me(i).then(Me(s));return Ue(a)},e.wbg.__wbg_then_842e65b843962f56=function(i,s,a){let c=Me(i).then(Me(s),Me(a));return Ue(c)},e.wbg.__wbg_self_99737b4dcdf6f0d8=function(){return mr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_window_9b61fbbf3564c4fb=function(){return mr(function(){let i=window.window;return Ue(i)},arguments)},e.wbg.__wbg_globalThis_8e275ef40caea3a3=function(){return mr(function(){let i=globalThis.globalThis;return Ue(i)},arguments)},e.wbg.__wbg_global_5de1e0f82bddcd27=function(){return mr(function(){let i=global.global;return Ue(i)},arguments)},e.wbg.__wbg_buffer_7af23f65f6c64548=function(i){let s=Me(i).buffer;return Ue(s)},e.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974=function(i,s,a){let c=new Uint8Array(Me(i),s>>>0,a>>>0);return Ue(c)},e.wbg.__wbg_new_cc9018bd6f283b6f=function(i){let s=new Uint8Array(Me(i));return Ue(s)},e.wbg.__wbg_set_f25e869e4565d2a2=function(i,s,a){Me(i).set(Me(s),a>>>0)},e.wbg.__wbg_length_0acb1cf9bbaf8519=function(i){return Me(i).length},e.wbg.__wbg_newwithlength_8f0657faca9f1422=function(i){let s=new Uint8Array(i>>>0);return Ue(s)},e.wbg.__wbg_subarray_da527dbd24eafb6b=function(i,s,a){let c=Me(i).subarray(s>>>0,a>>>0);return Ue(c)},e.wbg.__wbg_has_ce995ec88636803d=function(){return mr(function(i,s){return Reflect.has(Me(i),Me(s))},arguments)},e.wbg.__wbg_set_93b1c87ee2af852e=function(){return mr(function(i,s,a){return Reflect.set(Me(i),Me(s),Me(a))},arguments)},e.wbg.__wbg_stringify_c760003feffcc1f2=function(){return mr(function(i){let s=JSON.stringify(Me(i));return Ue(s)},arguments)},e.wbg.__wbindgen_debug_string=function(i,s){let a=h0(Me(s)),c=sr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),f=Pt;Pr()[i/4+1]=f,Pr()[i/4+0]=c},e.wbg.__wbindgen_throw=function(i,s){throw new Error(Ui(i,s))},e.wbg.__wbindgen_memory=function(){let i=Ce.memory;return Ue(i)},e.wbg.__wbindgen_closure_wrapper10902=function(i,s,a){let c=AA(i,s,3717,EA);return Ue(c)},(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:t,module:n}=yield TA(yield r,e);return Ce=t.exports,wg.__wbindgen_wasm_module=n,Ce})}o(wg,"init");var xg=wg;var _g=!1,MA=o((r="https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy")=>M(void 0,null,function*(){if(!_g)return _g=!0,xg(r)}),"init"),Ag=MA;var $e=ze(Ms()),ui=ze(Ms());var zi={};Mt(zi,{Any:()=>$n,BaseBlock:()=>Rt,BaseStringBlock:()=>Pa,BitString:()=>Ki,BmpString:()=>Rs,Boolean:()=>Is,CharacterString:()=>zs,Choice:()=>Ro,Constructed:()=>Ht,DATE:()=>$a,DateTime:()=>Ha,Duration:()=>qa,EndOfContent:()=>Ra,Enumerated:()=>Os,GeneralString:()=>qs,GeneralizedTime:()=>js,GraphicString:()=>Hs,HexBlock:()=>ai,IA5String:()=>Fs,Integer:()=>or,Null:()=>pn,NumericString:()=>Ls,ObjectIdentifier:()=>Ps,OctetString:()=>Kn,Primitive:()=>oi,PrintableString:()=>Ds,RawData:()=>kl,RelativeObjectIdentifier:()=>Ka,Repeated:()=>Vs,Sequence:()=>Cr,Set:()=>kr,TIME:()=>za,TeletexString:()=>Ks,TimeOfDay:()=>Fa,UTCTime:()=>Fi,UniversalString:()=>Us,Utf8String:()=>Zr,ValueBlock:()=>Yt,VideotexString:()=>$s,ViewWriter:()=>Po,VisibleString:()=>$i,compareSchema:()=>Ns,fromBER:()=>qi,verifySchema:()=>GA});var je=ze(Ms());function Oo(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}o(Oo,"utilFromBase");function Bs(r,e,t=-1){let n=t,i=r,s=0,a=Math.pow(2,e);for(let c=1;c<8;c++){if(r<a){let f;if(n<0)f=new ArrayBuffer(c),s=c;else{if(n<c)return new ArrayBuffer(0);f=new ArrayBuffer(n),s=n}let l=new Uint8Array(f);for(let h=c-1;h>=0;h--){let d=Math.pow(2,h*e);l[s-h-1]=Math.floor(i/d),i-=l[s-h-1]*d}return f}a*=Math.pow(2,e)}return new ArrayBuffer(0)}o(Bs,"utilToBase");function Cl(...r){let e=0,t=0;for(let s of r)e+=s.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let s of r)i.set(s,t),t+=s.length;return i}o(Cl,"utilConcatView");function d0(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let c=r[0]===255&&r[1]&128,f=r[0]===0&&(r[1]&128)===0;(c||f)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=r[0]&128;let n=Oo(t,8),i=new ArrayBuffer(this.valueHex.byteLength),s=new Uint8Array(i);for(let c=0;c<this.valueHex.byteLength;c++)s[c]=r[c];return s[0]&=127,Oo(s,8)-n}o(d0,"utilDecodeTC");function Eg(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,c=Bs(a,8,n),f=new Uint8Array(c);return f[0]|=128,c}let i=Bs(e,8,n),s=new Uint8Array(i);if(s[0]&128){let a=i.slice(0),c=new Uint8Array(a);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let f=0;f<a.byteLength;f++)s[f+1]=c[f];s[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}o(Eg,"utilEncodeTC");function Sg(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}o(Sg,"isEqualBuffer");function Rr(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,i=new Array(n);for(let a=0;a<n;a++)i[a]="0";return i.join("").concat(t)}o(Rr,"padNumber");var TP=Math.log(2);function Tl(){if(typeof BigInt=="undefined")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}o(Tl,"assertBigInt");function m0(r){let e=0,t=0;for(let i=0;i<r.length;i++)e+=r[i].byteLength;let n=new Uint8Array(e);for(let i=0;i<r.length;i++){let s=r[i];n.set(new Uint8Array(s),t),t+=s.byteLength}return n.buffer}o(m0,"concat");function Hi(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}o(Hi,"checkBufferParams");var Po=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return m0(this.items)}};o(Po,"ViewWriter");var uf=[new Uint8Array([1])],Cg="0123456789",p0="name",kg="valueHexView",RA="isHexOnly",UA="idBlock",LA="tagClass",DA="tagNumber",KA="isConstructed",$A="fromBER",FA="toBER",HA="local",Ur="",Fn=new ArrayBuffer(0),Ml=new Uint8Array(0),Sf="EndOfContent",Mg="OCTET STRING",Bg="BIT STRING";function ai(r){var e;return e=o(class extends r{constructor(...n){var i;super(...n);let s=n[0]||{};this.isHexOnly=(i=s.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=s.valueHex?je.BufferSourceConverter.toUint8Array(s.valueHex):Ml}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,s){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Hi(this,a,i,s))return-1;let c=i+s;return this.valueHexView=a.subarray(i,c),this.valueHexView.length?(this.blockLength=s,c):(this.warnings.push("Zero buffer length"),i)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",Fn)}toJSON(){return be(ne({},super.toJSON()),{isHexOnly:this.isHexOnly,valueHex:je.Convert.ToHex(this.valueHexView)})}},"Some"),e.NAME="hexBlock",e}o(ai,"HexBlock");var si=class{constructor({blockLength:e=0,error:t=Ur,warnings:n=[],valueBeforeDecode:i=Ml}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=je.BufferSourceConverter.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:je.Convert.ToHex(this.valueBeforeDecodeView)}}};o(si,"LocalBaseBlock");si.NAME="baseBlock";var Yt=class extends si{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};o(Yt,"ValueBlock");Yt.NAME="valueBlock";var lf=class extends ai(si){constructor({idBlock:e={}}={}){var t,n,i,s;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?je.BufferSourceConverter.toUint8Array(e.valueHex):Ml,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(s=e.isConstructed)!==null&&s!==void 0?s:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",Fn}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let s=this.tagNumber;s&=31,t|=s,i[0]=t}return i.buffer}if(!this.isHexOnly){let i=Bs(this.tagNumber,7),s=new Uint8Array(i),a=i.byteLength,c=new Uint8Array(a+1);if(c[0]=t|31,!e){for(let f=0;f<a-1;f++)c[f+1]=s[f]|128;c[a]=s[a-1]}return c.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let i=this.valueHexView;for(let s=0;s<i.length-1;s++)n[s+1]=i[s]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);if(s.length===0)return this.error="Zero buffer length",-1;switch(s[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(s[0]&32)===32,this.isHexOnly=!1;let c=s[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let f=1,l=this.valueHexView=new Uint8Array(255),h=255;for(;s[f]&128;){if(l[f-1]=s[f]&127,f++,f>=s.length)return this.error="End of input reached before message was fully decoded",-1;if(f===h){h+=255;let v=new Uint8Array(h);for(let x=0;x<l.length;x++)v[x]=l[x];l=this.valueHexView=new Uint8Array(h)}}this.blockLength=f+1,l[f-1]=s[f]&127;let d=new Uint8Array(f);for(let v=0;v<f;v++)d[v]=l[v];l=this.valueHexView=new Uint8Array(f),l.set(d),this.blockLength<=9?this.tagNumber=Oo(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return be(ne({},super.toJSON()),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})}};o(lf,"LocalIdentificationBlock");lf.NAME="identificationBlock";var hf=class extends si{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);if(s.length===0)return this.error="Zero buffer length",-1;if(s[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=s[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(s[0]&128),this.longFormUsed===!1)return this.length=s[0],this.blockLength=1,t+this.blockLength;let a=s[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>s.length)return this.error="End of input reached before message was fully decoded",-1;let c=t+1,f=i.subarray(c,c+a);return f[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Oo(f,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let i=Bs(this.length,8);if(i.byteLength>127)return this.error="Too big length",Fn;if(t=new ArrayBuffer(i.byteLength+1),e)return t;let s=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)n[a+1]=s[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return be(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})}};o(hf,"LocalLengthBlock");hf.NAME="lengthBlock";var _e={},Rt=class extends si{constructor(a={},s){var c=a,{name:e=Ur,optional:t=!1,primitiveSchema:n}=c,i=kt(c,["name","optional","primitiveSchema"]);super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new lf(i),this.lenBlock=new hf(i),this.valueBlock=s?new s(i):new Yt(i)}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,t){let n=t||new Po;t||Ng(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let s=this.valueBlock.toBER(e);this.lenBlock.length=s.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(s)}return t?Fn:n.final()}toJSON(){let e=be(ne({},super.toJSON()),{idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional});return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():je.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Sg(t,n)}};o(Rt,"BaseBlock");Rt.NAME="BaseBlock";function Ng(r){if(r instanceof _e.Constructed)for(let e of r.valueBlock.value)Ng(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}o(Ng,"prepareIndefiniteForm");var Pa=class extends Rt{constructor(i={},n){var s=i,{value:e=Ur}=s,t=kt(s,["value"]);super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};o(Pa,"BaseStringBlock");Pa.NAME="BaseStringBlock";var df=class extends ai(Yt){constructor(n={}){var i=n,{isHexOnly:e=!0}=i,t=kt(i,["isHexOnly"]);super(t),this.isHexOnly=e}};o(df,"LocalPrimitiveValueBlock");df.NAME="PrimitiveValueBlock";var Ig,oi=class extends Rt{constructor(e={}){super(e,df),this.idBlock.isConstructed=!1}};o(oi,"Primitive");Ig=oi;_e.Primitive=Ig;oi.NAME="PRIMITIVE";function qA(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}o(qA,"localChangeType");function ja(r,e=0,t=r.length){let n=e,i=new Rt({},Yt),s=new si;if(!Hi(s,r,e,t))return i.error=s.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let c=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),c===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=c,t-=i.idBlock.blockLength,c=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),c===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=c,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let f=Rt;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};f=_e.EndOfContent;break;case 1:f=_e.Boolean;break;case 2:f=_e.Integer;break;case 3:f=_e.BitString;break;case 4:f=_e.OctetString;break;case 5:f=_e.Null;break;case 6:f=_e.ObjectIdentifier;break;case 10:f=_e.Enumerated;break;case 12:f=_e.Utf8String;break;case 13:f=_e.RelativeObjectIdentifier;break;case 14:f=_e.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:f=_e.Sequence;break;case 17:f=_e.Set;break;case 18:f=_e.NumericString;break;case 19:f=_e.PrintableString;break;case 20:f=_e.TeletexString;break;case 21:f=_e.VideotexString;break;case 22:f=_e.IA5String;break;case 23:f=_e.UTCTime;break;case 24:f=_e.GeneralizedTime;break;case 25:f=_e.GraphicString;break;case 26:f=_e.VisibleString;break;case 27:f=_e.GeneralString;break;case 28:f=_e.UniversalString;break;case 29:f=_e.CharacterString;break;case 30:f=_e.BmpString;break;case 31:f=_e.DATE;break;case 32:f=_e.TimeOfDay;break;case 33:f=_e.DateTime;break;case 34:f=_e.Duration;break;default:{let l=i.idBlock.isConstructed?new _e.Constructed:new _e.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:f=i.idBlock.isConstructed?_e.Constructed:_e.Primitive}return i=qA(i,f),c=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:c,result:i}}o(ja,"localFromBER");function qi(r){if(!r.byteLength){let e=new Rt({},Yt);return e.error="Input buffer has zero length",{offset:-1,result:e}}return ja(je.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}o(qi,"fromBER");function zA(r,e){return r?1:e}o(zA,"checkLen");var Dn=class extends Yt{constructor(i={}){var s=i,{value:e=[],isIndefiniteForm:t=!1}=s,n=kt(s,["value","isIndefiniteForm"]);super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let s=t;for(;zA(this.isIndefiniteForm,n)>0;){let a=ja(i,s,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(s=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===Sf)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Sf?this.value.pop():this.warnings.push("No EndOfContent block encoded")),s}toBER(e,t){let n=t||new Po;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?Fn:n.final()}toJSON(){let e=be(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(let t of this.value)e.value.push(t.toJSON());return e}};o(Dn,"LocalConstructedValueBlock");Dn.NAME="ConstructedValueBlock";var Og,Ht=class extends Rt{constructor(e={}){super(e,Dn),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
632
|
+
`+String(n)));fg(e);for(var i=0;i<e.callbacks.length;i++){var o=n[i];o instanceof Error?e.callbacks[i].reject(o):e.callbacks[i].resolve(o)}}).catch(function(n){YA(r,e,n)})}s(AP,"dispatchBatch");function YA(r,e,t){fg(e);for(var n=0;n<e.keys.length;n++)r.clear(e.keys[n]),e.callbacks[n].reject(t)}s(YA,"failedDispatch");function fg(r){if(r.cacheHits)for(var e=0;e<r.cacheHits.length;e++)r.cacheHits[e]()}s(fg,"resolveCacheHits");function _P(r){var e=!r||r.batch!==!1;if(!e)return 1;var t=r&&r.maxBatchSize;if(t===void 0)return 1/0;if(typeof t!="number"||t<1)throw new TypeError("maxBatchSize must be a positive number: "+t);return t}s(_P,"getValidMaxBatchSize");function EP(r){var e=r&&r.batchScheduleFn;if(e===void 0)return wP;if(typeof e!="function")throw new TypeError("batchScheduleFn must be a function: "+e);return e}s(EP,"getValidBatchScheduleFn");function SP(r){var e=r&&r.cacheKeyFn;if(e===void 0)return function(t){return t};if(typeof e!="function")throw new TypeError("cacheKeyFn must be a function: "+e);return e}s(SP,"getValidCacheKeyFn");function CP(r){var e=!r||r.cache!==!1;if(!e)return null;var t=r&&r.cacheMap;if(t===void 0)return new Map;if(t!==null){var n=["get","set","delete","clear"],i=n.filter(function(o){return t&&typeof t[o]!="function"});if(i.length!==0)throw new TypeError("Custom cacheMap missing methods: "+i.join(", "))}return t}s(CP,"getValidCacheMap");function XA(r){return typeof r=="object"&&r!==null&&typeof r.length=="number"&&(r.length===0||r.length>0&&Object.prototype.hasOwnProperty.call(r,r.length-1))}s(XA,"isArrayLike");ZA.exports=vP});var u_=de((jJ,c_)=>{"use strict";c_.exports=r=>encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)});var m_=de((VJ,p_)=>{"use strict";var d_="%[a-f0-9]{2}",l_=new RegExp(d_,"gi"),h_=new RegExp("("+d_+")+","gi");function yg(r,e){try{return decodeURIComponent(r.join(""))}catch(i){}if(r.length===1)return r;e=e||1;var t=r.slice(0,e),n=r.slice(e);return Array.prototype.concat.call([],yg(t),yg(n))}s(yg,"decodeComponents");function zP(r){try{return decodeURIComponent(r)}catch(n){for(var e=r.match(l_),t=1;t<e.length;t++)r=yg(e,t).join(""),e=r.match(l_);return r}}s(zP,"decode");function jP(r){for(var e={"%FE%FF":"\uFFFD\uFFFD","%FF%FE":"\uFFFD\uFFFD"},t=h_.exec(r);t;){try{e[t[0]]=decodeURIComponent(t[0])}catch(f){var n=zP(t[0]);n!==t[0]&&(e[t[0]]=n)}t=h_.exec(r)}e["%C2"]="\uFFFD";for(var i=Object.keys(e),o=0;o<i.length;o++){var a=i[o];r=r.replace(new RegExp(a,"g"),e[a])}return r}s(jP,"customDecodeURIComponent");p_.exports=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch(e){return jP(r)}}});var g_=de((WJ,b_)=>{"use strict";b_.exports=(r,e)=>{if(!(typeof r=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[r];let t=r.indexOf(e);return t===-1?[r]:[r.slice(0,t),r.slice(t+e.length)]}});var v_=de((GJ,y_)=>{"use strict";y_.exports=function(r,e){for(var t={},n=Object.keys(r),i=Array.isArray(e),o=0;o<n.length;o++){var a=n[o],f=r[a];(i?e.indexOf(a)!==-1:e(a,f,r))&&(t[a]=f)}return t}});var T_=de(Qr=>{"use strict";var VP=u_(),WP=m_(),x_=g_(),GP=v_(),JP=s(r=>r==null,"isNullOrUndefined"),vg=Symbol("encodeFragmentIdentifier");function YP(r){switch(r.arrayFormat){case"index":return e=>(t,n)=>{let i=t.length;return n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[qt(e,r),"[",i,"]"].join("")]:[...t,[qt(e,r),"[",qt(i,r),"]=",qt(n,r)].join("")]};case"bracket":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[qt(e,r),"[]"].join("")]:[...t,[qt(e,r),"[]=",qt(n,r)].join("")];case"colon-list-separator":return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,[qt(e,r),":list="].join("")]:[...t,[qt(e,r),":list=",qt(n,r)].join("")];case"comma":case"separator":case"bracket-separator":{let e=r.arrayFormat==="bracket-separator"?"[]=":"=";return t=>(n,i)=>i===void 0||r.skipNull&&i===null||r.skipEmptyString&&i===""?n:(i=i===null?"":i,n.length===0?[[qt(t,r),e,qt(i,r)].join("")]:[[n,qt(i,r)].join(r.arrayFormatSeparator)])}default:return e=>(t,n)=>n===void 0||r.skipNull&&n===null||r.skipEmptyString&&n===""?t:n===null?[...t,qt(e,r)]:[...t,[qt(e,r),"=",qt(n,r)].join("")]}}s(YP,"encoderForArrayFormat");function XP(r){let e;switch(r.arrayFormat){case"index":return(t,n,i)=>{if(e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),!e){i[t]=n;return}i[t]===void 0&&(i[t]={}),i[t][e[1]]=n};case"bracket":return(t,n,i)=>{if(e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"colon-list-separator":return(t,n,i)=>{if(e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),!e){i[t]=n;return}if(i[t]===void 0){i[t]=[n];return}i[t]=[].concat(i[t],n)};case"comma":case"separator":return(t,n,i)=>{let o=typeof n=="string"&&n.includes(r.arrayFormatSeparator),a=typeof n=="string"&&!o&&So(n,r).includes(r.arrayFormatSeparator);n=a?So(n,r):n;let f=o||a?n.split(r.arrayFormatSeparator).map(c=>So(c,r)):n===null?n:So(n,r);i[t]=f};case"bracket-separator":return(t,n,i)=>{let o=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!o){i[t]=n&&So(n,r);return}let a=n===null?[]:n.split(r.arrayFormatSeparator).map(f=>So(f,r));if(i[t]===void 0){i[t]=a;return}i[t]=[].concat(i[t],a)};default:return(t,n,i)=>{if(i[t]===void 0){i[t]=n;return}i[t]=[].concat(i[t],n)}}}s(XP,"parserForArrayFormat");function A_(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}s(A_,"validateArrayFormatSeparator");function qt(r,e){return e.encode?e.strict?VP(r):encodeURIComponent(r):r}s(qt,"encode");function So(r,e){return e.decode?WP(r):r}s(So,"decode");function __(r){return Array.isArray(r)?r.sort():typeof r=="object"?__(Object.keys(r)).sort((e,t)=>Number(e)-Number(t)).map(e=>r[e]):r}s(__,"keysSorter");function E_(r){let e=r.indexOf("#");return e!==-1&&(r=r.slice(0,e)),r}s(E_,"removeHash");function ZP(r){let e="",t=r.indexOf("#");return t!==-1&&(e=r.slice(t)),e}s(ZP,"getHash");function S_(r){r=E_(r);let e=r.indexOf("?");return e===-1?"":r.slice(e+1)}s(S_,"extract");function w_(r,e){return e.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):e.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}s(w_,"parseValue");function C_(r,e){e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e),A_(e.arrayFormatSeparator);let t=XP(e),n=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return n;for(let i of r.split("&")){if(i==="")continue;let[o,a]=x_(e.decode?i.replace(/\+/g," "):i,"=");a=a===void 0?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?a:So(a,e),t(So(o,e),a,n)}for(let i of Object.keys(n)){let o=n[i];if(typeof o=="object"&&o!==null)for(let a of Object.keys(o))o[a]=w_(o[a],e);else n[i]=w_(o,e)}return e.sort===!1?n:(e.sort===!0?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce((i,o)=>{let a=n[o];return Boolean(a)&&typeof a=="object"&&!Array.isArray(a)?i[o]=__(a):i[o]=a,i},Object.create(null))}s(C_,"parse");Qr.extract=S_;Qr.parse=C_;Qr.stringify=(r,e)=>{if(!r)return"";e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e),A_(e.arrayFormatSeparator);let t=s(a=>e.skipNull&&JP(r[a])||e.skipEmptyString&&r[a]==="","shouldFilter"),n=YP(e),i={};for(let a of Object.keys(r))t(a)||(i[a]=r[a]);let o=Object.keys(i);return e.sort!==!1&&o.sort(e.sort),o.map(a=>{let f=r[a];return f===void 0?"":f===null?qt(a,e):Array.isArray(f)?f.length===0&&e.arrayFormat==="bracket-separator"?qt(a,e)+"[]":f.reduce(n(a),[]).join("&"):qt(a,e)+"="+qt(f,e)}).filter(a=>a.length>0).join("&")};Qr.parseUrl=(r,e)=>{e=Object.assign({decode:!0},e);let[t,n]=x_(r,"#");return Object.assign({url:t.split("?")[0]||"",query:C_(S_(r),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:So(n,e)}:{})};Qr.stringifyUrl=(r,e)=>{e=Object.assign({encode:!0,strict:!0,[vg]:!0},e);let t=E_(r.url).split("?")[0]||"",n=Qr.extract(r.url),i=Qr.parse(n,{sort:!1}),o=Object.assign(i,r.query),a=Qr.stringify(o,e);a&&(a=`?${a}`);let f=ZP(r.url);return r.fragmentIdentifier&&(f=`#${e[vg]?qt(r.fragmentIdentifier,e):r.fragmentIdentifier}`),`${t}${a}${f}`};Qr.pick=(r,e,t)=>{t=Object.assign({parseFragmentIdentifier:!0,[vg]:!1},t);let{url:n,query:i,fragmentIdentifier:o}=Qr.parseUrl(r,t);return Qr.stringifyUrl({url:n,query:GP(i,e),fragmentIdentifier:o},t)};Qr.exclude=(r,e,t)=>{let n=Array.isArray(e)?i=>!e.includes(i):(i,o)=>!e(i,o);return Qr.pick(r,n,t)}});var rU={};It(rU,{walletFromKey:()=>eE});module.exports=Fg(rU);var Ce,Kg=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});Kg.decode();var Ll=null;function qa(){return(Ll===null||Ll.buffer!==Ce.memory.buffer)&&(Ll=new Uint8Array(Ce.memory.buffer)),Ll}s(qa,"getUint8Memory0");function Ki(r,e){return Kg.decode(qa().subarray(r,r+e))}s(Ki,"getStringFromWasm0");var $i=new Array(32).fill(void 0);$i.push(void 0,null,!0,!1);var vc=$i.length;function Ue(r){vc===$i.length&&$i.push($i.length+1);let e=vc;return vc=$i[e],$i[e]=r,e}s(Ue,"addHeapObject");function Me(r){return $i[r]}s(Me,"getObject");function aE(r){r<36||($i[r]=vc,vc=r)}s(aE,"dropObject");function Hi(r){let e=Me(r);return aE(r),e}s(Hi,"takeObject");var Ut=0,Fl=new TextEncoder("utf-8"),fE=typeof Fl.encodeInto=="function"?function(r,e){return Fl.encodeInto(r,e)}:function(r,e){let t=Fl.encode(r);return e.set(t),{read:r.length,written:t.length}};function cr(r,e,t){if(t===void 0){let f=Fl.encode(r),c=e(f.length);return qa().subarray(c,c+f.length).set(f),Ut=f.length,c}let n=r.length,i=e(n),o=qa(),a=0;for(;a<n;a++){let f=r.charCodeAt(a);if(f>127)break;o[i+a]=f}if(a!==n){a!==0&&(r=r.slice(a)),i=t(i,n,n=a+r.length*3);let f=qa().subarray(i+a,i+n);a+=fE(r,f).written}return Ut=a,i}s(cr,"passStringToWasm0");function cE(r){return r==null}s(cE,"isLikeNone");var Dl=null;function Dr(){return(Dl===null||Dl.buffer!==Ce.memory.buffer)&&(Dl=new Int32Array(Ce.memory.buffer)),Dl}s(Dr,"getInt32Memory0");function T0(r){let e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){let i=r.description;return i==null?"Symbol":`Symbol(${i})`}if(e=="function"){let i=r.name;return typeof i=="string"&&i.length>0?`Function(${i})`:"Function"}if(Array.isArray(r)){let i=r.length,o="[";i>0&&(o+=T0(r[0]));for(let a=1;a<i;a++)o+=", "+T0(r[a]);return o+="]",o}let t=/\[object ([^\]]+)\]/.exec(toString.call(r)),n;if(t.length>1)n=t[1];else return toString.call(r);if(n=="Object")try{return"Object("+JSON.stringify(r)+")"}catch(i){return"Object"}return r instanceof Error?`${r.name}: ${r.message}
|
633
|
+
${r.stack}`:n}s(T0,"debugString");function uE(r,e,t,n){let i={a:r,b:e,cnt:1,dtor:t},o=s((...a)=>{i.cnt++;let f=i.a;i.a=0;try{return n(f,i.b,...a)}finally{--i.cnt===0?Ce.__wbindgen_export_2.get(i.dtor)(f,i.b):i.a=f}},"real");return o.original=i,o}s(uE,"makeMutClosure");function lE(r,e,t){Ce._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h91a8814f66f14b17(r,e,Ue(t))}s(lE,"__wbg_adapter_24");function hE(r,e){let t=e(r.length*1);return qa().set(r,t/1),Ut=r.length,t}s(hE,"passArray8ToWasm0");function $g(r){try{let f=Ce.__wbindgen_add_to_stack_pointer(-16),c=hE(r,Ce.__wbindgen_malloc),l=Ut;Ce.generateEd25519KeyFromBytes(f,c,l);var e=Dr()[f/4+0],t=Dr()[f/4+1],n=Dr()[f/4+2],i=Dr()[f/4+3],o=e,a=t;if(i)throw o=0,a=0,Hi(n);return Ki(o,a)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(o,a)}}s($g,"generateEd25519KeyFromBytes");function Hg(r,e){try{let c=Ce.__wbindgen_add_to_stack_pointer(-16),l=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),h=Ut,d=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),y=Ut;Ce.keyToDID(c,l,h,d,y);var t=Dr()[c/4+0],n=Dr()[c/4+1],i=Dr()[c/4+2],o=Dr()[c/4+3],a=t,f=n;if(o)throw a=0,f=0,Hi(i);return Ki(a,f)}finally{Ce.__wbindgen_add_to_stack_pointer(16),Ce.__wbindgen_free(a,f)}}s(Hg,"keyToDID");function Kl(r,e){let t=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Ut,i=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),o=Ut,a=Ce.keyToVerificationMethod(t,n,i,o);return Hi(a)}s(Kl,"keyToVerificationMethod");function qg(r,e,t){let n=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Ut,o=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Ut,f=cr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),c=Ut,l=Ce.issueCredential(n,i,o,a,f,c);return Hi(l)}s(qg,"issueCredential");function zg(r,e){let t=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Ut,i=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),o=Ut,a=Ce.verifyCredential(t,n,i,o);return Hi(a)}s(zg,"verifyCredential");function jg(r,e,t){let n=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),i=Ut,o=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),a=Ut,f=cr(t,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),c=Ut,l=Ce.issuePresentation(n,i,o,a,f,c);return Hi(l)}s(jg,"issuePresentation");function Vg(r,e){let t=cr(r,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),n=Ut,i=cr(e,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),o=Ut,a=Ce.verifyPresentation(t,n,i,o);return Hi(a)}s(Vg,"verifyPresentation");function vr(r,e){try{return r.apply(this,e)}catch(t){Ce.__wbindgen_exn_store(Ue(t))}}s(vr,"handleError");function dE(r,e){return qa().subarray(r/1,r/1+e)}s(dE,"getArrayU8FromWasm0");function pE(r,e,t,n){Ce.wasm_bindgen__convert__closures__invoke2_mut__h3ecfeb7a01c1be81(r,e,Ue(t),Ue(n))}s(pE,"__wbg_adapter_108");function mE(r,e){return M(this,null,function*(){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return yield WebAssembly.instantiateStreaming(r,e)}catch(n){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=yield r.arrayBuffer();return yield WebAssembly.instantiate(t,e)}else{let t=yield WebAssembly.instantiate(r,e);return t instanceof WebAssembly.Instance?{instance:t,module:r}:t}})}s(mE,"load");function Wg(r){return M(this,null,function*(){let e={};e.wbg={},e.wbg.__wbindgen_string_new=function(i,o){let a=Ki(i,o);return Ue(a)},e.wbg.__wbindgen_object_drop_ref=function(i){Hi(i)},e.wbg.__wbindgen_cb_drop=function(i){let o=Hi(i).original;return o.cnt--==1?(o.a=0,!0):!1},e.wbg.__wbindgen_object_clone_ref=function(i){let o=Me(i);return Ue(o)},e.wbg.__wbg_fetch_811d43d6bdcad5b1=function(i){let o=fetch(Me(i));return Ue(o)},e.wbg.__wbg_fetch_bf56e2a9f0644e3f=function(i,o){let a=Me(i).fetch(Me(o));return Ue(a)},e.wbg.__wbg_new_89d7f088c1c45353=function(){return vr(function(){let i=new Headers;return Ue(i)},arguments)},e.wbg.__wbg_append_f4f93bc73c45ee3e=function(){return vr(function(i,o,a,f,c){Me(i).append(Ki(o,a),Ki(f,c))},arguments)},e.wbg.__wbindgen_string_get=function(i,o){let a=Me(o),f=typeof a=="string"?a:void 0;var c=cE(f)?0:cr(f,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),l=Ut;Dr()[i/4+1]=l,Dr()[i/4+0]=c},e.wbg.__wbg_instanceof_Response_ccfeb62399355bcd=function(i){return Me(i)instanceof Response},e.wbg.__wbg_url_06c0f822d68d195c=function(i,o){let a=Me(o).url,f=cr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),c=Ut;Dr()[i/4+1]=c,Dr()[i/4+0]=f},e.wbg.__wbg_status_600fd8b881393898=function(i){return Me(i).status},e.wbg.__wbg_headers_9e7f2c05a9b962ea=function(i){let o=Me(i).headers;return Ue(o)},e.wbg.__wbg_arrayBuffer_5a99283a3954c850=function(){return vr(function(i){let o=Me(i).arrayBuffer();return Ue(o)},arguments)},e.wbg.__wbg_newwithstrandinit_fd99688f189f053e=function(){return vr(function(i,o,a){let f=new Request(Ki(i,o),Me(a));return Ue(f)},arguments)},e.wbg.__wbindgen_is_object=function(i){let o=Me(i);return typeof o=="object"&&o!==null},e.wbg.__wbg_self_86b4b13392c7af56=function(){return vr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_crypto_b8c92eaac23d0d80=function(i){let o=Me(i).crypto;return Ue(o)},e.wbg.__wbg_msCrypto_9ad6677321a08dd8=function(i){let o=Me(i).msCrypto;return Ue(o)},e.wbg.__wbindgen_is_undefined=function(i){return Me(i)===void 0},e.wbg.__wbg_static_accessor_MODULE_452b4680e8614c81=function(){return Ue(n)},e.wbg.__wbg_require_f5521a5b85ad2542=function(i,o,a){let f=Me(i).require(Ki(o,a));return Ue(f)},e.wbg.__wbg_getRandomValues_dd27e6b0652b3236=function(i){let o=Me(i).getRandomValues;return Ue(o)},e.wbg.__wbg_getRandomValues_e57c9b75ddead065=function(i,o){Me(i).getRandomValues(Me(o))},e.wbg.__wbg_randomFillSync_d2ba53160aec6aba=function(i,o,a){Me(i).randomFillSync(dE(o,a))},e.wbg.__wbindgen_is_function=function(i){return typeof Me(i)=="function"},e.wbg.__wbg_newnoargs_e23b458e372830de=function(i,o){let a=new Function(Ki(i,o));return Ue(a)},e.wbg.__wbg_next_cabb70b365520721=function(i){let o=Me(i).next;return Ue(o)},e.wbg.__wbg_next_bf3d83fc18df496e=function(){return vr(function(i){let o=Me(i).next();return Ue(o)},arguments)},e.wbg.__wbg_done_040f966faa9a72b3=function(i){return Me(i).done},e.wbg.__wbg_value_419afbd9b9574c4c=function(i){let o=Me(i).value;return Ue(o)},e.wbg.__wbg_iterator_4832ef1f15b0382b=function(){return Ue(Symbol.iterator)},e.wbg.__wbg_get_a9cab131e3152c49=function(){return vr(function(i,o){let a=Reflect.get(Me(i),Me(o));return Ue(a)},arguments)},e.wbg.__wbg_call_ae78342adc33730a=function(){return vr(function(i,o){let a=Me(i).call(Me(o));return Ue(a)},arguments)},e.wbg.__wbg_new_36359baae5a47e27=function(){let i=new Object;return Ue(i)},e.wbg.__wbg_call_3ed288a247f13ea5=function(){return vr(function(i,o,a){let f=Me(i).call(Me(o),Me(a));return Ue(f)},arguments)},e.wbg.__wbg_getTime_bffb1c09df09618b=function(i){return Me(i).getTime()},e.wbg.__wbg_new0_0ff7eb5c1486f3ec=function(){let i=new Date;return Ue(i)},e.wbg.__wbg_new_37705eed627d5ed9=function(i,o){try{var a={a:i,b:o},f=s((l,h)=>{let d=a.a;a.a=0;try{return pE(d,a.b,l,h)}finally{a.a=d}},"cb0");let c=new Promise(f);return Ue(c)}finally{a.a=a.b=0}},e.wbg.__wbg_resolve_a9a87bdd64e9e62c=function(i){let o=Promise.resolve(Me(i));return Ue(o)},e.wbg.__wbg_then_ce526c837d07b68f=function(i,o){let a=Me(i).then(Me(o));return Ue(a)},e.wbg.__wbg_then_842e65b843962f56=function(i,o,a){let f=Me(i).then(Me(o),Me(a));return Ue(f)},e.wbg.__wbg_self_99737b4dcdf6f0d8=function(){return vr(function(){let i=self.self;return Ue(i)},arguments)},e.wbg.__wbg_window_9b61fbbf3564c4fb=function(){return vr(function(){let i=window.window;return Ue(i)},arguments)},e.wbg.__wbg_globalThis_8e275ef40caea3a3=function(){return vr(function(){let i=globalThis.globalThis;return Ue(i)},arguments)},e.wbg.__wbg_global_5de1e0f82bddcd27=function(){return vr(function(){let i=global.global;return Ue(i)},arguments)},e.wbg.__wbg_buffer_7af23f65f6c64548=function(i){let o=Me(i).buffer;return Ue(o)},e.wbg.__wbg_newwithbyteoffsetandlength_ce1e75f0ce5f7974=function(i,o,a){let f=new Uint8Array(Me(i),o>>>0,a>>>0);return Ue(f)},e.wbg.__wbg_new_cc9018bd6f283b6f=function(i){let o=new Uint8Array(Me(i));return Ue(o)},e.wbg.__wbg_set_f25e869e4565d2a2=function(i,o,a){Me(i).set(Me(o),a>>>0)},e.wbg.__wbg_length_0acb1cf9bbaf8519=function(i){return Me(i).length},e.wbg.__wbg_newwithlength_8f0657faca9f1422=function(i){let o=new Uint8Array(i>>>0);return Ue(o)},e.wbg.__wbg_subarray_da527dbd24eafb6b=function(i,o,a){let f=Me(i).subarray(o>>>0,a>>>0);return Ue(f)},e.wbg.__wbg_has_ce995ec88636803d=function(){return vr(function(i,o){return Reflect.has(Me(i),Me(o))},arguments)},e.wbg.__wbg_set_93b1c87ee2af852e=function(){return vr(function(i,o,a){return Reflect.set(Me(i),Me(o),Me(a))},arguments)},e.wbg.__wbg_stringify_c760003feffcc1f2=function(){return vr(function(i){let o=JSON.stringify(Me(i));return Ue(o)},arguments)},e.wbg.__wbindgen_debug_string=function(i,o){let a=T0(Me(o)),f=cr(a,Ce.__wbindgen_malloc,Ce.__wbindgen_realloc),c=Ut;Dr()[i/4+1]=c,Dr()[i/4+0]=f},e.wbg.__wbindgen_throw=function(i,o){throw new Error(Ki(i,o))},e.wbg.__wbindgen_memory=function(){let i=Ce.memory;return Ue(i)},e.wbg.__wbindgen_closure_wrapper10902=function(i,o,a){let f=uE(i,o,3717,lE);return Ue(f)},(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));let{instance:t,module:n}=yield mE(yield r,e);return Ce=t.exports,Wg.__wbindgen_wasm_module=n,Ce})}s(Wg,"init");var Gg=Wg;var Jg=!1,bE=s((r="https://cdn.filestackcontent.com/jXExSjNXSerFVDMIYOgy")=>M(void 0,null,function*(){if(!Jg)return Jg=!0,Gg(r)}),"init"),Yg=bE;var Ke=ze(Ro()),pi=ze(Ro());var Gi={};It(Gi,{Any:()=>zn,BaseBlock:()=>Lt,BaseStringBlock:()=>za,BitString:()=>qi,BmpString:()=>$o,Boolean:()=>Do,CharacterString:()=>Yo,Choice:()=>Hs,Constructed:()=>jt,DATE:()=>Ya,DateTime:()=>Za,Duration:()=>Qa,EndOfContent:()=>ja,Enumerated:()=>Fo,GeneralString:()=>Jo,GeneralizedTime:()=>Xo,GraphicString:()=>Go,HexBlock:()=>li,IA5String:()=>Wo,Integer:()=>ur,Null:()=>yn,NumericString:()=>qo,ObjectIdentifier:()=>Ko,OctetString:()=>qn,Primitive:()=>ui,PrintableString:()=>zo,RawData:()=>Hl,RelativeObjectIdentifier:()=>Ja,Repeated:()=>Zo,Sequence:()=>Br,Set:()=>Ir,TIME:()=>ef,TeletexString:()=>jo,TimeOfDay:()=>Xa,UTCTime:()=>ji,UniversalString:()=>Ho,Utf8String:()=>rn,ValueBlock:()=>er,VideotexString:()=>Vo,ViewWriter:()=>$s,VisibleString:()=>zi,compareSchema:()=>Lo,fromBER:()=>Wi,verifySchema:()=>PE});var je=ze(Ro());function Ks(r,e){let t=0;if(r.length===1)return r[0];for(let n=r.length-1;n>=0;n--)t+=r[r.length-1-n]*Math.pow(2,e*n);return t}s(Ks,"utilFromBase");function Uo(r,e,t=-1){let n=t,i=r,o=0,a=Math.pow(2,e);for(let f=1;f<8;f++){if(r<a){let c;if(n<0)c=new ArrayBuffer(f),o=f;else{if(n<f)return new ArrayBuffer(0);c=new ArrayBuffer(n),o=n}let l=new Uint8Array(c);for(let h=f-1;h>=0;h--){let d=Math.pow(2,h*e);l[o-h-1]=Math.floor(i/d),i-=l[o-h-1]*d}return c}a*=Math.pow(2,e)}return new ArrayBuffer(0)}s(Uo,"utilToBase");function $l(...r){let e=0,t=0;for(let o of r)e+=o.length;let n=new ArrayBuffer(e),i=new Uint8Array(n);for(let o of r)i.set(o,t),t+=o.length;return i}s($l,"utilConcatView");function k0(){let r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){let f=r[0]===255&&r[1]&128,c=r[0]===0&&(r[1]&128)===0;(f||c)&&this.warnings.push("Needlessly long format")}let e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let f=0;f<this.valueHex.byteLength;f++)t[f]=0;t[0]=r[0]&128;let n=Ks(t,8),i=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(i);for(let f=0;f<this.valueHex.byteLength;f++)o[f]=r[f];return o[0]&=127,Ks(o,8)-n}s(k0,"utilDecodeTC");function Xg(r){let e=r<0?r*-1:r,t=128;for(let n=1;n<8;n++){if(e<=t){if(r<0){let a=t-e,f=Uo(a,8,n),c=new Uint8Array(f);return c[0]|=128,f}let i=Uo(e,8,n),o=new Uint8Array(i);if(o[0]&128){let a=i.slice(0),f=new Uint8Array(a);i=new ArrayBuffer(i.byteLength+1),o=new Uint8Array(i);for(let c=0;c<a.byteLength;c++)o[c+1]=f[c];o[0]=0}return i}t*=Math.pow(2,8)}return new ArrayBuffer(0)}s(Xg,"utilEncodeTC");function Zg(r,e){if(r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return!1;return!0}s(Zg,"isEqualBuffer");function Fr(r,e){let t=r.toString(10);if(e<t.length)return"";let n=e-t.length,i=new Array(n);for(let a=0;a<n;a++)i[a]="0";return i.join("").concat(t)}s(Fr,"padNumber");var uU=Math.log(2);function ql(){if(typeof BigInt=="undefined")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}s(ql,"assertBigInt");function B0(r){let e=0,t=0;for(let i=0;i<r.length;i++)e+=r[i].byteLength;let n=new Uint8Array(e);for(let i=0;i<r.length;i++){let o=r[i];n.set(new Uint8Array(o),t),t+=o.byteLength}return n.buffer}s(B0,"concat");function Vi(r,e,t,n){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):n<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-n<0?(r.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(r.error="Wrong parameter: inputBuffer has zero length",!1):(r.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}s(Vi,"checkBufferParams");var $s=class{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return B0(this.items)}};s($s,"ViewWriter");var xc=[new Uint8Array([1])],Qg="0123456789",M0="name",ey="valueHexView",AE="isHexOnly",_E="idBlock",EE="tagClass",SE="tagNumber",CE="isConstructed",TE="fromBER",kE="toBER",ME="local",Kr="",jn=new ArrayBuffer(0),zl=new Uint8Array(0),Uc="EndOfContent",ry="OCTET STRING",ny="BIT STRING";function li(r){var e;return e=s(class extends r{constructor(...n){var i;super(...n);let o=n[0]||{};this.isHexOnly=(i=o.isHexOnly)!==null&&i!==void 0?i:!1,this.valueHexView=o.valueHex?je.BufferSourceConverter.toUint8Array(o.valueHex):zl}get valueHex(){return this.valueHexView.slice().buffer}set valueHex(n){this.valueHexView=new Uint8Array(n)}fromBER(n,i,o){let a=n instanceof ArrayBuffer?new Uint8Array(n):n;if(!Vi(this,a,i,o))return-1;let f=i+o;return this.valueHexView=a.subarray(i,f),this.valueHexView.length?(this.blockLength=o,f):(this.warnings.push("Zero buffer length"),i)}toBER(n=!1){return this.isHexOnly?n?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.byteLength===this.valueHexView.buffer.byteLength?this.valueHexView.buffer:this.valueHexView.slice().buffer:(this.error="Flag 'isHexOnly' is not set, abort",jn)}toJSON(){return be(ne({},super.toJSON()),{isHexOnly:this.isHexOnly,valueHex:je.Convert.ToHex(this.valueHexView)})}},"Some"),e.NAME="hexBlock",e}s(li,"HexBlock");var ci=class{constructor({blockLength:e=0,error:t=Kr,warnings:n=[],valueBeforeDecode:i=zl}={}){this.blockLength=e,this.error=t,this.warnings=n,this.valueBeforeDecodeView=je.BufferSourceConverter.toUint8Array(i)}static blockName(){return this.NAME}get valueBeforeDecode(){return this.valueBeforeDecodeView.slice().buffer}set valueBeforeDecode(e){this.valueBeforeDecodeView=new Uint8Array(e)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:je.Convert.ToHex(this.valueBeforeDecodeView)}}};s(ci,"LocalBaseBlock");ci.NAME="baseBlock";var er=class extends ci{fromBER(e,t,n){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,t){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}};s(er,"ValueBlock");er.NAME="valueBlock";var Ac=class extends li(ci){constructor({idBlock:e={}}={}){var t,n,i,o;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?je.BufferSourceConverter.toUint8Array(e.valueHex):zl,this.tagClass=(n=e.tagClass)!==null&&n!==void 0?n:-1,this.tagNumber=(i=e.tagNumber)!==null&&i!==void 0?i:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let t=0;switch(this.tagClass){case 1:t|=0;break;case 2:t|=64;break;case 3:t|=128;break;case 4:t|=192;break;default:return this.error="Unknown tag class",jn}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){let i=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,t|=o,i[0]=t}return i.buffer}if(!this.isHexOnly){let i=Uo(this.tagNumber,7),o=new Uint8Array(i),a=i.byteLength,f=new Uint8Array(a+1);if(f[0]=t|31,!e){for(let c=0;c<a-1;c++)f[c+1]=o[c]|128;f[a]=o[a-1]}return f.buffer}let n=new Uint8Array(this.valueHexView.byteLength+1);if(n[0]=t|31,!e){let i=this.valueHexView;for(let o=0;o<i.length-1;o++)n[o+1]=i[o]|128;n[this.valueHexView.byteLength]=i[i.length-1]}return n.buffer}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,i,t,n))return-1;let o=i.subarray(t,t+n);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[0]&192){case 0:this.tagClass=1;break;case 64:this.tagClass=2;break;case 128:this.tagClass=3;break;case 192:this.tagClass=4;break;default:return this.error="Unknown tag class",-1}this.isConstructed=(o[0]&32)===32,this.isHexOnly=!1;let f=o[0]&31;if(f!==31)this.tagNumber=f,this.blockLength=1;else{let c=1,l=this.valueHexView=new Uint8Array(255),h=255;for(;o[c]&128;){if(l[c-1]=o[c]&127,c++,c>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(c===h){h+=255;let y=new Uint8Array(h);for(let A=0;A<l.length;A++)y[A]=l[A];l=this.valueHexView=new Uint8Array(h)}}this.blockLength=c+1,l[c-1]=o[c]&127;let d=new Uint8Array(c);for(let y=0;y<c;y++)d[y]=l[y];l=this.valueHexView=new Uint8Array(c),l.set(d),this.blockLength<=9?this.tagNumber=Ks(l,7):(this.isHexOnly=!0,this.warnings.push("Tag too long, represented as hex-coded"))}if(this.tagClass===1&&this.isConstructed)switch(this.tagNumber){case 1:case 2:case 5:case 6:case 9:case 13:case 14:case 23:case 24:case 31:case 32:case 33:case 34:return this.error="Constructed encoding used for primitive type",-1}return t+this.blockLength}toJSON(){return be(ne({},super.toJSON()),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})}};s(Ac,"LocalIdentificationBlock");Ac.NAME="identificationBlock";var _c=class extends ci{constructor({lenBlock:e={}}={}){var t,n,i;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(n=e.longFormUsed)!==null&&n!==void 0?n:!1,this.length=(i=e.length)!==null&&i!==void 0?i:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,i,t,n))return-1;let o=i.subarray(t,t+n);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,t+this.blockLength;let a=o[0]&127;if(a>8)return this.error="Too big integer",-1;if(a+1>o.length)return this.error="End of input reached before message was fully decoded",-1;let f=t+1,c=i.subarray(f,f+a);return c[a-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Ks(c,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=a+1,t+this.blockLength}toBER(e=!1){let t,n;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=128),t;if(this.longFormUsed){let i=Uo(this.length,8);if(i.byteLength>127)return this.error="Too big length",jn;if(t=new ArrayBuffer(i.byteLength+1),e)return t;let o=new Uint8Array(i);n=new Uint8Array(t),n[0]=i.byteLength|128;for(let a=0;a<i.byteLength;a++)n[a+1]=o[a];return t}return t=new ArrayBuffer(1),e===!1&&(n=new Uint8Array(t),n[0]=this.length),t}toJSON(){return be(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})}};s(_c,"LocalLengthBlock");_c.NAME="lengthBlock";var Ae={},Lt=class extends ci{constructor(a={},o){var f=a,{name:e=Kr,optional:t=!1,primitiveSchema:n}=f,i=Mt(f,["name","optional","primitiveSchema"]);super(i),this.name=e,this.optional=t,n&&(this.primitiveSchema=n),this.idBlock=new Ac(i),this.lenBlock=new _c(i),this.valueBlock=o?new o(i):new er(i)}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}toBER(e,t){let n=t||new $s;t||iy(this);let i=this.idBlock.toBER(e);if(n.write(i),this.lenBlock.isIndefiniteForm)n.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,n),n.write(new ArrayBuffer(2));else{let o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;let a=this.lenBlock.toBER(e);n.write(a),n.write(o)}return t?jn:n.final()}toJSON(){let e=be(ne({},super.toJSON()),{idBlock:this.idBlock.toJSON(),lenBlock:this.lenBlock.toJSON(),valueBlock:this.valueBlock.toJSON(),name:this.name,optional:this.optional});return this.primitiveSchema&&(e.primitiveSchema=this.primitiveSchema.toJSON()),e}toString(e="ascii"){return e==="ascii"?this.onAsciiEncoding():je.Convert.ToHex(this.toBER())}onAsciiEncoding(){return`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueBeforeDecodeView)}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;let t=this.toBER(),n=e.toBER();return Zg(t,n)}};s(Lt,"BaseBlock");Lt.NAME="BaseBlock";function iy(r){if(r instanceof Ae.Constructed)for(let e of r.valueBlock.value)iy(e)&&(r.lenBlock.isIndefiniteForm=!0);return!!r.lenBlock.isIndefiniteForm}s(iy,"prepareIndefiniteForm");var za=class extends Lt{constructor(i={},n){var o=i,{value:e=Kr}=o,t=Mt(o,["value"]);super(t,n),e&&this.fromString(e)}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}fromBER(e,t,n){let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.fromBuffer(this.valueBlock.valueHexView),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}};s(za,"BaseStringBlock");za.NAME="BaseStringBlock";var Ec=class extends li(er){constructor(n={}){var i=n,{isHexOnly:e=!0}=i,t=Mt(i,["isHexOnly"]);super(t),this.isHexOnly=e}};s(Ec,"LocalPrimitiveValueBlock");Ec.NAME="PrimitiveValueBlock";var oy,ui=class extends Lt{constructor(e={}){super(e,Ec),this.idBlock.isConstructed=!1}};s(ui,"Primitive");oy=ui;Ae.Primitive=oy;ui.NAME="PRIMITIVE";function BE(r,e){if(r instanceof e)return r;let t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}s(BE,"localChangeType");function tf(r,e=0,t=r.length){let n=e,i=new Lt({},er),o=new ci;if(!Vi(o,r,e,t))return i.error=o.error,{offset:-1,result:i};if(!r.subarray(e,e+t).length)return i.error="Zero buffer length",{offset:-1,result:i};let f=i.idBlock.fromBER(r,e,t);if(i.idBlock.warnings.length&&i.warnings.concat(i.idBlock.warnings),f===-1)return i.error=i.idBlock.error,{offset:-1,result:i};if(e=f,t-=i.idBlock.blockLength,f=i.lenBlock.fromBER(r,e,t),i.lenBlock.warnings.length&&i.warnings.concat(i.lenBlock.warnings),f===-1)return i.error=i.lenBlock.error,{offset:-1,result:i};if(e=f,t-=i.lenBlock.blockLength,!i.idBlock.isConstructed&&i.lenBlock.isIndefiniteForm)return i.error="Indefinite length form used for primitive encoding form",{offset:-1,result:i};let c=Lt;switch(i.idBlock.tagClass){case 1:if(i.idBlock.tagNumber>=37&&i.idBlock.isHexOnly===!1)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};c=Ae.EndOfContent;break;case 1:c=Ae.Boolean;break;case 2:c=Ae.Integer;break;case 3:c=Ae.BitString;break;case 4:c=Ae.OctetString;break;case 5:c=Ae.Null;break;case 6:c=Ae.ObjectIdentifier;break;case 10:c=Ae.Enumerated;break;case 12:c=Ae.Utf8String;break;case 13:c=Ae.RelativeObjectIdentifier;break;case 14:c=Ae.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:c=Ae.Sequence;break;case 17:c=Ae.Set;break;case 18:c=Ae.NumericString;break;case 19:c=Ae.PrintableString;break;case 20:c=Ae.TeletexString;break;case 21:c=Ae.VideotexString;break;case 22:c=Ae.IA5String;break;case 23:c=Ae.UTCTime;break;case 24:c=Ae.GeneralizedTime;break;case 25:c=Ae.GraphicString;break;case 26:c=Ae.VisibleString;break;case 27:c=Ae.GeneralString;break;case 28:c=Ae.UniversalString;break;case 29:c=Ae.CharacterString;break;case 30:c=Ae.BmpString;break;case 31:c=Ae.DATE;break;case 32:c=Ae.TimeOfDay;break;case 33:c=Ae.DateTime;break;case 34:c=Ae.Duration;break;default:{let l=i.idBlock.isConstructed?new Ae.Constructed:new Ae.Primitive;l.idBlock=i.idBlock,l.lenBlock=i.lenBlock,l.warnings=i.warnings,i=l}}break;case 2:case 3:case 4:default:c=i.idBlock.isConstructed?Ae.Constructed:Ae.Primitive}return i=BE(i,c),f=i.fromBER(r,e,i.lenBlock.isIndefiniteForm?t:i.lenBlock.length),i.valueBeforeDecodeView=r.subarray(n,n+i.blockLength),{offset:f,result:i}}s(tf,"localFromBER");function Wi(r){if(!r.byteLength){let e=new Lt({},er);return e.error="Input buffer has zero length",{offset:-1,result:e}}return tf(je.BufferSourceConverter.toUint8Array(r).slice(),0,r.byteLength)}s(Wi,"fromBER");function IE(r,e){return r?1:e}s(IE,"checkLen");var Hn=class extends er{constructor(i={}){var o=i,{value:e=[],isIndefiniteForm:t=!1}=o,n=Mt(o,["value","isIndefiniteForm"]);super(n),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,i,t,n))return-1;if(this.valueBeforeDecodeView=i.subarray(t,t+n),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let o=t;for(;IE(this.isIndefiniteForm,n)>0;){let a=tf(i,o,n);if(a.offset===-1)return this.error=a.result.error,this.warnings.concat(a.result.warnings),-1;if(o=a.offset,this.blockLength+=a.result.blockLength,n-=a.result.blockLength,this.value.push(a.result),this.isIndefiniteForm&&a.result.constructor.NAME===Uc)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===Uc?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){let n=t||new $s;for(let i=0;i<this.value.length;i++)this.value[i].toBER(e,n);return t?jn:n.final()}toJSON(){let e=be(ne({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(let t of this.value)e.value.push(t.toJSON());return e}};s(Hn,"LocalConstructedValueBlock");Hn.NAME="ConstructedValueBlock";var sy,jt=class extends Lt{constructor(e={}){super(e,Hn),this.idBlock.isConstructed=!0}fromBER(e,t,n){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;let i=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?n:this.lenBlock.length);return i===-1?(this.error=this.valueBlock.error,i):(this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.valueBlock.error.length||(this.blockLength+=this.valueBlock.blockLength),i)}onAsciiEncoding(){let e=[];for(let n of this.valueBlock.value)e.push(n.toString("ascii").split(`
|
634
634
|
`).map(i=>` ${i}`).join(`
|
635
635
|
`));let t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
|
636
636
|
${e.join(`
|
637
|
-
`)}`:`${t} :`}};o(Ht,"Constructed");Og=Ht;_e.Constructed=Og;Ht.NAME="CONSTRUCTED";var pf=class extends Yt{fromBER(e,t,n){return t}toBER(e){return Fn}};o(pf,"LocalEndOfContentValueBlock");pf.override="EndOfContentValueBlock";var Pg,Ra=class extends Rt{constructor(e={}){super(e,pf),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};o(Ra,"EndOfContent");Pg=Ra;_e.EndOfContent=Pg;Ra.NAME=Sf;var Rg,pn=class extends Rt{constructor(e={}){super(e,Yt),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let i=new Uint8Array(n);i[0]=5,i[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};o(pn,"Null");Rg=pn;_e.Null=Rg;pn.NAME="NULL";var mf=class extends ai(Yt){constructor(n={}){var i=n,{value:e}=i,t=kt(i,["value"]);super(t),t.valueHex?this.valueHexView=je.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);return Hi(this,i,t,n)?(this.valueHexView=i.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,d0.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return be(ne({},super.toJSON()),{value:this.value})}};o(mf,"LocalBooleanValueBlock");mf.NAME="BooleanValueBlock";var Ug,Is=class extends Rt{constructor(e={}){super(e,mf),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};o(Is,"Boolean");Ug=Is;_e.Boolean=Ug;Is.NAME="BOOLEAN";var bf=class extends ai(Dn){constructor(n={}){var i=n,{isConstructed:e=!1}=i,t=kt(i,["isConstructed"]);super(t),this.isConstructed=e}fromBER(e,t,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Dn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let s=0;s<this.value.length;s++){let a=this.value[s].constructor.NAME;if(a===Sf){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==Mg)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,t,n),this.blockLength=n;return i}toBER(e,t){return this.isConstructed?Dn.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return be(ne({},super.toJSON()),{isConstructed:this.isConstructed})}};o(bf,"LocalOctetStringValueBlock");bf.NAME="OctetStringValueBlock";var Lg,Kn=class extends Rt{constructor(i={}){var s=i,{idBlock:e={},lenBlock:t={}}=s,n=kt(s,["idBlock","lenBlock"]);var a,c;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((c=n.value)===null||c===void 0)&&c.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:be(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),bf),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let s=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(s.byteLength){let a=ja(s,0,s.byteLength);a.offset!==-1&&a.offset===n&&(this.valueBlock.value=[a.result])}}catch(a){}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?Ht.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof Kn&&e.push(t.valueBlock.valueHexView);return je.BufferSourceConverter.concat(e)}};o(Kn,"OctetString");Lg=Kn;_e.OctetString=Lg;Kn.NAME=Mg;var gf=class extends ai(Dn){constructor(i={}){var s=i,{unusedBits:e=0,isConstructed:t=!1}=s,n=kt(s,["unusedBits","isConstructed"]);super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let i=-1;if(this.isConstructed){if(i=Dn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let c of this.value){let f=c.constructor.NAME;if(f===Sf){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(f!==Bg)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let l=c.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return i}let s=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,s,t,n))return-1;let a=s.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let c=a.subarray(1);try{if(c.byteLength){let f=ja(c,0,c.byteLength);f.offset!==-1&&f.offset===n-1&&(this.value=[f.result])}}catch(f){}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return Dn.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return Fn;let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return be(ne({},super.toJSON()),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})}};o(gf,"LocalBitStringValueBlock");gf.NAME="BitStringValueBlock";var Dg,Ki=class extends Rt{constructor(i={}){var s=i,{idBlock:e={},lenBlock:t={}}=s,n=kt(s,["idBlock","lenBlock"]);var a,c;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((c=n.value)===null||c===void 0)&&c.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:be(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),gf),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ht.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let i of t)e.push(i.toString(2).padStart(8,"0"));let n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};o(Ki,"BitString");Dg=Ki;_e.BitString=Dg;Ki.NAME=Bg;var Kg;function jA(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),a=s.length-1,c=i.slice(0),f=c.length-1,l=0,h=f<a?a:f,d=0;for(let v=h;v>=0;v--,d++){switch(!0){case d<c.length:l=s[a-d]+c[f-d]+t[0];break;default:l=s[a-d]+t[0]}switch(t[0]=l/10,!0){case d>=s.length:s=Cl(new Uint8Array([l%10]),s);break;default:s[a-d]=l%10}}return t[0]>0&&(s=Cl(t,s)),s}o(jA,"viewAdd");function Tg(r){if(r>=uf.length)for(let e=uf.length;e<=r;e++){let t=new Uint8Array([0]),n=uf[e-1].slice(0);for(let i=n.length-1;i>=0;i--){let s=new Uint8Array([(n[i]<<1)+t[0]]);t[0]=s[0]/10,n[i]=s[0]%10}t[0]>0&&(n=Cl(t,n)),uf.push(n)}return uf[r]}o(Tg,"power2");function VA(r,e){let t=0,n=new Uint8Array(r),i=new Uint8Array(e),s=n.slice(0),a=s.length-1,c=i.slice(0),f=c.length-1,l,h=0;for(let d=f;d>=0;d--,h++)switch(l=s[a-h]-c[f-h]-t,!0){case l<0:t=1,s[a-h]=l+10;break;default:t=0,s[a-h]=l}if(t>0)for(let d=a-f+1;d>=0;d--,h++)if(l=s[a-h]-t,l<0)t=1,s[a-h]=l+10;else{t=0,s[a-h]=l;break}return s.slice()}o(VA,"viewSub");var Ua=class extends ai(Yt){constructor(n={}){var i=n,{value:e}=i,t=kt(i,["value"]);super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=d0.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Eg(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,i=0){let s=this.fromBER(e,t,n);if(s===-1)return s;let a=this.valueHexView;return a[0]===0&&(a[1]&128)!==0?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),s}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let i=super.fromBER(e,t,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec})}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,i,s=this.valueHexView,a="",c=!1;for(let f=s.byteLength-1;f>=0;f--){i=s[f];for(let l=0;l<8;l++){if((i&1)===1)switch(n){case e:t=VA(Tg(n),t),a="-";break;default:t=jA(t,Tg(n))}n++,i>>=1}}for(let f=0;f<t.length;f++)t[f]&&(c=!0),c&&(a+=Cg.charAt(t[f]));return c===!1&&(a+=Cg.charAt(0)),a}};o(Ua,"LocalIntegerValueBlock");Kg=Ua;Ua.NAME="IntegerValueBlock";Object.defineProperty(Kg.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var $g,or=class extends Rt{constructor(e={}){super(e,Ua),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Tl(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Tl();let t=BigInt(e),n=new Po,i=t.toString(16).replace(/^-/,""),s=new Uint8Array(je.Convert.FromHex(i));if(t<0){let c=new Uint8Array(s.length+(s[0]&128?1:0));c[0]|=128;let l=BigInt(`0x${je.Convert.ToHex(c)}`)+t,h=je.BufferSourceConverter.toUint8Array(je.Convert.FromHex(l.toString(16)));h[0]|=128,n.write(h)}else s[0]&128&&n.write(new Uint8Array([0])),n.write(s);return new or({valueHex:n.final()})}convertToDER(){let e=new or({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new or({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};o(or,"Integer");$g=or;_e.Integer=$g;or.NAME="INTEGER";var Fg,Os=class extends or{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};o(Os,"Enumerated");Fg=Os;_e.Enumerated=Fg;Os.NAME="ENUMERATED";var La=class extends ai(Yt){constructor(i={}){var s=i,{valueDec:e=-1,isFirstSid:t=!1}=s,n=kt(s,["valueDec","isFirstSid"]);super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,(s[c]&128)!==0);c++);let a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Oo(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Tl();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let t=Bs(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Fn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)n[a]=i[a]|128;n[s]=i[s]}return n}toString(){let e="";if(this.isHexOnly)e=je.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})}};o(La,"LocalSidValueBlock");La.NAME="sidBlock";var yf=class extends Yt{constructor(n={}){var i=n,{value:e=Ur}=i,t=kt(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let s=new La;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.value.length===0&&(s.isFirstSid=!0),this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,Fn;t.push(i)}return m0(t)}fromString(e){this.value=[];let t=0,n=0,i="",s=!1;do if(n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1,s){let a=this.value[0],c=0;switch(a.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}let f=parseInt(i,10);if(isNaN(f))return;a.valueDec=f+c,s=!1}else{let a=new La;if(i>Number.MAX_SAFE_INTEGER){Tl();let c=BigInt(i);a.valueBigInt=c}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,s=!0),this.value.push(a)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){let e=be(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};o(yf,"LocalObjectIdentifierValueBlock");yf.NAME="ObjectIdentifierValueBlock";var Hg,Ps=class extends Rt{constructor(e={}){super(e,yf),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return be(ne({},super.toJSON()),{value:this.getValue()})}};o(Ps,"ObjectIdentifier");Hg=Ps;_e.ObjectIdentifier=Hg;Ps.NAME="OBJECT IDENTIFIER";var Da=class extends ai(si){constructor(n={}){var i=n,{valueDec:e=0}=i,t=kt(i,["valueDec"]);super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Hi(this,i,t,n))return-1;let s=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let c=0;c<n&&(this.valueHexView[c]=s[c]&127,this.blockLength++,(s[c]&128)!==0);c++);let a=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)a[c]=this.valueHexView[c];return this.valueHexView=a,(s[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Oo(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,s=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)s[a]=i[a]|128;return s[this.blockLength-1]=i[this.blockLength-1],s.buffer}let t=Bs(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",Fn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),s=t.byteLength-1;for(let a=0;a<s;a++)n[a]=i[a]|128;n[s]=i[s]}return n.buffer}toString(){let e="";return this.isHexOnly?e=je.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec})}};o(Da,"LocalRelativeSidValueBlock");Da.NAME="relativeSidBlock";var vf=class extends Yt{constructor(n={}){var i=n,{value:e=Ur}=i,t=kt(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let s=new Da;if(i=s.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=s.error,i;this.blockLength+=s.blockLength,n-=s.blockLength,this.value.push(s)}return i}toBER(e,t){let n=[];for(let i=0;i<this.value.length;i++){let s=this.value[i].toBER(e);if(s.byteLength===0)return this.error=this.value[i].error,Fn;n.push(s)}return m0(n)}fromString(e){this.value=[];let t=0,n=0,i="";do{n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1;let s=new Da;if(s.valueDec=parseInt(i,10),isNaN(s.valueDec))return!0;this.value.push(s)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(i=`{${i}}`),e+=i}return e}toJSON(){let e=be(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};o(vf,"LocalRelativeObjectIdentifierValueBlock");vf.NAME="RelativeObjectIdentifierValueBlock";var qg,Ka=class extends Rt{constructor(e={}){super(e,vf),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return be(ne({},super.toJSON()),{value:this.getValue()})}};o(Ka,"RelativeObjectIdentifier");qg=Ka;_e.RelativeObjectIdentifier=qg;Ka.NAME="RelativeObjectIdentifier";var zg,Cr=class extends Ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};o(Cr,"Sequence");zg=Cr;_e.Sequence=zg;Cr.NAME="SEQUENCE";var jg,kr=class extends Ht{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};o(kr,"Set");jg=kr;_e.Set=jg;kr.NAME="SET";var wf=class extends ai(Yt){constructor(t={}){var e=kt(t,[]);super(e),this.isHexOnly=!0,this.value=Ur}toJSON(){return be(ne({},super.toJSON()),{value:this.value})}};o(wf,"LocalStringValueBlock");wf.NAME="StringValueBlock";var xf=class extends wf{};o(xf,"LocalSimpleStringValueBlock");xf.NAME="SimpleStringValueBlock";var br=class extends Pa{constructor(t={}){var e=kt(t,[]);super(e,xf)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}};o(br,"LocalSimpleStringBlock");br.NAME="SIMPLE STRING";var _f=class extends br{fromBuffer(e){this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=je.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=je.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf8String(e)),this.valueBlock.value=e}};o(_f,"LocalUtf8StringValueBlock");_f.NAME="Utf8StringValueBlock";var Vg,Zr=class extends _f{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};o(Zr,"Utf8String");Vg=Zr;_e.Utf8String=Vg;Zr.NAME="UTF8String";var Af=class extends br{fromBuffer(e){this.valueBlock.value=je.Convert.ToUtf16String(e),this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf16String(e))}};o(Af,"LocalBmpStringValueBlock");Af.NAME="BmpStringValueBlock";var Gg,Rs=class extends Af{constructor(t={}){var e=kt(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};o(Rs,"BmpString");Gg=Rs;_e.BmpString=Gg;Rs.NAME="BMPString";var Ef=class extends br{fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let i=0;i<t;i++){let s=Bs(e.charCodeAt(i),8),a=new Uint8Array(s);if(a.length>4)continue;let c=4-a.length;for(let f=a.length-1;f>=0;f--)n[i*4+f+c]=a[f]}this.valueBlock.value=e}};o(Ef,"LocalUniversalStringValueBlock");Ef.NAME="UniversalStringValueBlock";var Jg,Us=class extends Ef{constructor(t={}){var e=kt(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};o(Us,"UniversalString");Jg=Us;_e.UniversalString=Jg;Us.NAME="UniversalString";var Wg,Ls=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};o(Ls,"NumericString");Wg=Ls;_e.NumericString=Wg;Ls.NAME="NumericString";var Yg,Ds=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};o(Ds,"PrintableString");Yg=Ds;_e.PrintableString=Yg;Ds.NAME="PrintableString";var Xg,Ks=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};o(Ks,"TeletexString");Xg=Ks;_e.TeletexString=Xg;Ks.NAME="TeletexString";var Zg,$s=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};o($s,"VideotexString");Zg=$s;_e.VideotexString=Zg;$s.NAME="VideotexString";var Qg,Fs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};o(Fs,"IA5String");Qg=Fs;_e.IA5String=Qg;Fs.NAME="IA5String";var ey,Hs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};o(Hs,"GraphicString");ey=Hs;_e.GraphicString=ey;Hs.NAME="GraphicString";var ty,$i=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};o($i,"VisibleString");ty=$i;_e.VisibleString=ty;$i.NAME="VisibleString";var ry,qs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};o(qs,"GeneralString");ry=qs;_e.GeneralString=ry;qs.NAME="GeneralString";var ny,zs=class extends br{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};o(zs,"CharacterString");ny=zs;_e.CharacterString=ny;zs.NAME="CharacterString";var iy,Fi=class extends $i{constructor(i={}){var s=i,{value:e,valueDate:t}=s,n=kt(s,["value","valueDate"]);if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let a=0;a<e.length;a++)this.valueBlock.valueHexView[a]=e.charCodeAt(a)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=Rr(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Rr(this.month,2),t[2]=Rr(this.day,2),t[3]=Rr(this.hour,2),t[4]=Rr(this.minute,2),t[5]=Rr(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return be(ne({},super.toJSON()),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})}};o(Fi,"UTCTime");iy=Fi;_e.UTCTime=iy;Fi.NAME="UTCTime";var sy,js=class extends Fi{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,n="",i="",s=0,a,c=0,f=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let d=new Number(e[e.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,v=n.indexOf("+"),x="";if(v===-1&&(v=n.indexOf("-"),d=-1),v!==-1){if(x=n.substring(v+1),n=n.substring(0,v),x.length!==2&&x.length!==4)throw new Error("Wrong input string for conversion");let y=parseInt(x.substring(0,2),10);if(isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");if(c=d*y,x.length===4){if(y=parseInt(x.substring(2,4),10),isNaN(y.valueOf()))throw new Error("Wrong input string for conversion");f=d*y}}}let l=n.indexOf(".");if(l===-1&&(l=n.indexOf(",")),l!==-1){let d=new Number(`0${n.substring(l)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");s=d.valueOf(),i=n.substring(0,l)}else i=n;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*s;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*s;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=1e3*s;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}let h=a.exec(i);if(h===null)throw new Error("Wrong input string for conversion");for(let d=1;d<h.length;d++)switch(d){case 1:this.year=parseInt(h[d],10);break;case 2:this.month=parseInt(h[d],10);break;case 3:this.day=parseInt(h[d],10);break;case 4:this.hour=parseInt(h[d],10)+c;break;case 5:this.minute=parseInt(h[d],10)+f;break;case 6:this.second=parseInt(h[d],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push(Rr(this.year,4)),t.push(Rr(this.month,2)),t.push(Rr(this.day,2)),t.push(Rr(this.hour,2)),t.push(Rr(this.minute,2)),t.push(Rr(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Rr(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return be(ne({},super.toJSON()),{millisecond:this.millisecond})}};o(js,"GeneralizedTime");sy=js;_e.GeneralizedTime=sy;js.NAME="GeneralizedTime";var oy,$a=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};o($a,"DATE");oy=$a;_e.DATE=oy;$a.NAME="DATE";var ay,Fa=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};o(Fa,"TimeOfDay");ay=Fa;_e.TimeOfDay=ay;Fa.NAME="TimeOfDay";var cy,Ha=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};o(Ha,"DateTime");cy=Ha;_e.DateTime=cy;Ha.NAME="DateTime";var fy,qa=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};o(qa,"Duration");fy=qa;_e.Duration=fy;qa.NAME="Duration";var uy,za=class extends Zr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};o(za,"TIME");uy=za;_e.TIME=uy;za.NAME="TIME";var $n=class{constructor({name:e=Ur,optional:t=!1}={}){this.name=e,this.optional=t}};o($n,"Any");var Ro=class extends $n{constructor(n={}){var i=n,{value:e=[]}=i,t=kt(i,["value"]);super(t),this.value=e}};o(Ro,"Choice");var Vs=class extends $n{constructor(i={}){var s=i,{value:e=new $n,local:t=!1}=s,n=kt(s,["value","local"]);super(n),this.value=e,this.local=t}};o(Vs,"Repeated");var kl=class{constructor({data:e=Ml}={}){this.dataView=je.BufferSourceConverter.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=je.BufferSourceConverter.toUint8Array(e)}fromBER(e,t,n){let i=t+n;return this.dataView=je.BufferSourceConverter.toUint8Array(e).subarray(t,i),i}toBER(e){return this.dataView.slice().buffer}};o(kl,"RawData");function Ns(r,e,t){if(t instanceof Ro){for(let s=0;s<t.value.length;s++)if(Ns(r,e,t.value[s]).verified)return{verified:!0,result:r};{let s={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(p0)&&(s.name=t.name),s}}if(t instanceof $n)return t.hasOwnProperty(p0)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(UA in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!($A in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(FA in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(LA)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(DA)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(KA)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(RA in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(kg in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let s=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(s.length!==a.length)return{verified:!1,result:r};for(let c=0;c<s.length;c++)if(s[c]!==a[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(r[t.name]=e)),t instanceof _e.Constructed){let s=0,a={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof Vs&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let f=!0;for(let l=0;l<t.valueBlock.value.length;l++)f=f&&(t.valueBlock.value[l].optional||!1);return f?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let f=0;f<c;f++)if(f-s>=e.valueBlock.value.length){if(t.valueBlock.value[f].optional===!1){let l={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],l.name=t.name)),l}}else if(t.valueBlock.value[0]instanceof Vs){if(a=Ns(r,e.valueBlock.value[f],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),a;if(p0 in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let l={};HA in t.valueBlock.value[0]&&t.valueBlock.value[0].local?l=e:l=r,typeof l[t.valueBlock.value[0].name]=="undefined"&&(l[t.valueBlock.value[0].name]=[]),l[t.valueBlock.value[0].name].push(e.valueBlock.value[f])}}else if(a=Ns(r,e.valueBlock.value[f-s],t.valueBlock.value[f]),a.verified===!1)if(t.valueBlock.value[f].optional)s++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&delete r[t.name]),a;if(a.verified===!1){let f={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],f.name=t.name)),f}return{verified:!0,result:r}}if(t.primitiveSchema&&kg in e.valueBlock){let s=ja(e.valueBlock.valueHexView);if(s.offset===-1){let a={verified:!1,result:s.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Ur),t.name&&(delete r[t.name],a.name=t.name)),a}return Ns(r,s.result,t.primitiveSchema)}return{verified:!0,result:r}}o(Ns,"compareSchema");function GA(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let t=ja(je.BufferSourceConverter.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:Ns(t.result,t.result,e)}o(GA,"verifySchema");var Ut;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(Ut||(Ut={}));var Se;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(Se||(Se={}));var JA={fromASN:r=>r instanceof pn?null:r.valueBeforeDecode,toASN:r=>{if(r===null)return new pn;let e=qi(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Bl={fromASN:r=>r.valueBlock.valueHex.byteLength>4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new or({value:r})},WA={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new Os({value:r})};var YA={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new Ki({valueHex:r})},XA={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Ps({value:r})},ZA={fromASN:r=>r.valueBlock.value,toASN:r=>new Is({value:r})},QA={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new Kn({valueHex:r})};function mn(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}o(mn,"createStringConverter");var eE=mn(Zr),tE=mn(Rs),rE=mn(Us),nE=mn(Ls),iE=mn(Ds),sE=mn(Ks),oE=mn($s),aE=mn(Fs),cE=mn(Hs),fE=mn($i),uE=mn(qs),lE=mn(zs),hE={fromASN:r=>r.toDate(),toASN:r=>new Fi({valueDate:r})},dE={fromASN:r=>r.toDate(),toASN:r=>new js({valueDate:r})},pE={fromASN:r=>null,toASN:r=>new pn};function Va(r){switch(r){case Se.Any:return JA;case Se.BitString:return YA;case Se.BmpString:return tE;case Se.Boolean:return ZA;case Se.CharacterString:return lE;case Se.Enumerated:return WA;case Se.GeneralString:return uE;case Se.GeneralizedTime:return dE;case Se.GraphicString:return cE;case Se.IA5String:return aE;case Se.Integer:return Bl;case Se.Null:return pE;case Se.NumericString:return nE;case Se.ObjectIdentifier:return XA;case Se.OctetString:return QA;case Se.PrintableString:return iE;case Se.TeletexString:return sE;case Se.UTCTime:return hE;case Se.UniversalString:return rE;case Se.Utf8String:return eE;case Se.VideotexString:return oE;case Se.VisibleString:return fE;default:return null}}o(Va,"defaultConverter");var mE=ze(Ms());var bE=ze(Ms());function bn(r){return r&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:bn(r.prototype):!!(r&&r.toASN&&r.fromASN)}o(bn,"isConvertible");function g0(r){var e;if(r){let t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:g0(t)}return!1}o(g0,"isTypeOfArray");function ly(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}o(ly,"isArrayEqual");var Cf=class{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e){var t,n,i;let s=this.items.get(e);if(!s)throw new Error(`Cannot get schema for '${(i=(n=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:e}' target`);return s}cache(e){let t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){let t={type:Ut.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(t,n),t.items=Object.assign({},t.items,n.items)),t}create(e,t){let n=this.items.get(e)||this.createDefault(e),i=[];for(let s in n.items){let a=n.items[s],c=t?s:"",f;if(typeof a.type=="number"){let h=Se[a.type],d=zi[h];if(!d)throw new Error(`Cannot get ASN1 class by name '${h}'`);f=new d({name:c})}else bn(a.type)?f=new a.type().toSchema(c):a.optional?this.get(a.type).type===Ut.Choice?f=new $n({name:c}):(f=this.create(a.type,!1),f.name=c):f=new $n({name:c});let l=!!a.optional||a.defaultValue!==void 0;if(a.repeated){f.name="";let h=a.repeated==="set"?kr:Cr;f=new h({name:"",value:[new Vs({name:c,value:f})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||bn(a.type)){let h=a.repeated?Ht:oi;i.push(new h({name:c,optional:l,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);let h=!!a.repeated,d=h?f:this.get(a.type).schema;d=d.valueBlock?d.valueBlock.value:d.value,i.push(new Ht({name:h?"":c,optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:d}))}else i.push(new Ht({optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:[f]}));else f.optional=l,i.push(f)}switch(n.type){case Ut.Sequence:return new Cr({value:i,name:""});case Ut.Set:return new kr({value:i,name:""});case Ut.Choice:return new Ro({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};o(Cf,"AsnSchemaStorage");var Tr=new Cf;var Uo=o(r=>e=>{let t;Tr.has(e)?t=Tr.get(e):(t=Tr.createDefault(e),Tr.set(e,t)),Object.assign(t,r)},"AsnType"),Je=o(r=>(e,t)=>{let n;Tr.has(e.constructor)?n=Tr.get(e.constructor):(n=Tr.createDefault(e.constructor),Tr.set(e.constructor,n));let i=Object.assign({},r);if(typeof i.type=="number"&&!i.converter){let s=Va(r.type);if(!s)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);i.converter=s}n.items[t]=i},"AsnProp");var Ga=class extends Error{constructor(){super(...arguments),this.schemas=[]}};o(Ga,"AsnSchemaValidationError");var We=class{static parse(e,t){let n;if(e instanceof ArrayBuffer)n=e;else if(typeof Buffer!="undefined"&&Buffer.isBuffer(e))n=new Uint8Array(e).buffer;else if(ArrayBuffer.isView(e)||e.buffer instanceof ArrayBuffer)n=e.buffer;else throw new TypeError("Wrong type of 'data' argument");let i=qi(n);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var n;try{if(bn(t))return new t().fromASN(e);let i=Tr.get(t);Tr.cache(t);let s=i.schema;if(e.constructor===Ht&&i.type!==Ut.Choice){s=new Ht({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(let f in i.items)delete e[f]}let a=Ns(e,e,s);if(!a.verified)throw new Ga(`Data does not match to ${t.name} ASN1 schema. ${a.result.error}`);let c=new t;if(g0(t))if(typeof i.itemType=="number"){let f=Va(i.itemType);if(!f)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,l=>f.fromASN(l))}else return t.from(e.valueBlock.value,f=>this.fromASN(f,i.itemType));for(let f in i.items){if(!e[f])continue;let l=i.items[f];if(typeof l.type=="number"||bn(l.type)){let h=(n=l.converter)!==null&&n!==void 0?n:bn(l.type)?new l.type:null;if(!h)throw new Error("Converter is empty");if(l.repeated)if(l.implicit){let d=l.repeated==="sequence"?Cr:kr,v=new d;v.valueBlock=e[f].valueBlock;let x=qi(v.toBER(!1)).result.valueBlock.value;c[f]=Array.from(x,y=>h.fromASN(y))}else c[f]=Array.from(e[f],d=>h.fromASN(d));else{let d=e[f];if(l.implicit){let v;if(bn(l.type))v=new l.type().toSchema("");else{let x=Se[l.type],y=zi[x];if(!y)throw new Error(`Cannot get '${x}' class from asn1js module`);v=new y}v.valueBlock=d.valueBlock,d=qi(v.toBER(!1)).result}c[f]=h.fromASN(d)}}else l.repeated?c[f]=Array.from(e[f],h=>this.fromASN(h,l.type)):c[f]=this.fromASN(e[f],l.type)}return c}catch(i){throw i instanceof Ga&&i.schemas.push(t.name),i}}};o(We,"AsnParser");var Ye=class{static serialize(e){return e instanceof Rt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&bn(e.constructor))return e.toASN();let t=e.constructor,n=Tr.get(t);Tr.cache(t);let i=[];if(n.itemType)if(typeof n.itemType=="number"){let a=Va(n.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(c=>a.toASN(c))}else i=e.map(a=>this.toAsnItem({type:n.itemType},"[]",t,a));else for(let a in n.items){let c=n.items[a],f=e[a];if(f===void 0||c.defaultValue===f||typeof c.defaultValue=="object"&&typeof f=="object"&&ly(this.serialize(c.defaultValue),this.serialize(f)))continue;let l=Ye.toAsnItem(c,a,t,f);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||bn(c.type))){let h={};h.valueHex=l instanceof pn?l.valueBeforeDecode:l.valueBlock.toBER(),i.push(new oi(ne({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context}},h)))}else i.push(new Ht({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:l.valueBlock.value}));else i.push(new Ht({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[l]}));else c.repeated?i=i.concat(l):i.push(l)}let s;switch(n.type){case Ut.Sequence:s=new Cr({value:i});break;case Ut.Set:s=new kr({value:i});break;case Ut.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);s=i[0];break}return s}static toAsnItem(e,t,n,i){let s;if(typeof e.type=="number"){let a=e.converter;if(!a)throw new Error(`Property '${t}' doesn't have converter for type ${Se[e.type]} in schema '${n.name}'`);if(e.repeated){let c=Array.from(i,l=>a.toASN(l)),f=e.repeated==="sequence"?Cr:kr;s=new f({value:c})}else s=a.toASN(i)}else if(e.repeated){let a=Array.from(i,f=>this.toASN(f)),c=e.repeated==="sequence"?Cr:kr;s=new c({value:a})}else s=this.toASN(i);return s}};o(Ye,"AsnSerializer");var y0=ze(Ms());var Lo=class{static serialize(e){return Ye.serialize(e)}static parse(e,t){return We.parse(e,t)}static toString(e){let t=y0.BufferSourceConverter.isBufferSource(e)?y0.BufferSourceConverter.toArrayBuffer(e):Lo.serialize(e),n=qi(t);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}};o(Lo,"AsnConvert");var Py=ze(Oy(),1),{__extends:gr,__assign:wR,__rest:xR,__decorate:Re,__param:_R,__metadata:AR,__awaiter:Ry,__generator:Pl,__exportStar:ER,__createBinding:SR,__values:Do,__read:Qr,__spread:CR,__spreadArrays:kR,__spreadArray:Hn,__await:Rl,__asyncGenerator:Uy,__asyncDelegator:TR,__asyncValues:Ly,__makeTemplateObject:MR,__importStar:BR,__importDefault:NR,__classPrivateFieldGet:IR,__classPrivateFieldSet:OR,__classPrivateFieldIn:PR}=Py.default;var Ko=class extends Error{constructor(e,t){super(t?`${e}. See the inner exception for more details.`:e),this.message=e,this.innerError=t}};o(Ko,"JsonError");var Ul=class extends Ko{constructor(e,t,n){super(t,n),this.schema=e}};o(Ul,"TransformError");var $o=class extends Ul{constructor(e,t,n){super(e,`JSON doesn't match to '${e.target.name}' schema. ${t}`,n)}};o($o,"ParserError");var zn=class extends Ko{};o(zn,"ValidationError");var Wa=class extends Ko{constructor(e,t,n){super(`Cannot serialize by '${e}' schema. ${t}`,n),this.schemaName=e}};o(Wa,"SerializerError");var kf=class extends $o{constructor(e,t,n={}){super(e,"Some keys doesn't match to schema"),this.keys=t,this.errors=n}};o(kf,"KeyError");var Lt;(function(r){r[r.Any=0]="Any",r[r.Boolean=1]="Boolean",r[r.Number=2]="Number",r[r.String=3]="String"})(Lt||(Lt={}));function gE(r,e){switch(e){case Lt.Boolean:return typeof r=="boolean";case Lt.Number:return typeof r=="number";case Lt.String:return typeof r=="string"}return!0}o(gE,"checkType");function Hl(r,e){if(!gE(r,e))throw new TypeError(`Value must be ${Lt[e]}`)}o(Hl,"throwIfTypeIsWrong");function ql(r){return r&&r.prototype?r.prototype.toJSON&&r.prototype.fromJSON?!0:ql(r.prototype):!!(r&&r.toJSON&&r.fromJSON)}o(ql,"isConvertible");var Ll=class{constructor(){this.items=new Map}has(e){return this.items.has(e)||!!this.findParentSchema(e)}get(e){let t=this.items.get(e)||this.findParentSchema(e);if(!t)throw new Error("Cannot get schema for current target");return t}create(e){let t={names:{}},n=this.findParentSchema(e);if(n){Object.assign(t,n),t.names={};for(let i in n.names)t.names[i]=Object.assign({},n.names[i])}return t.target=e,t}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};o(Ll,"JsonSchemaStorage");var Bf="default",qn=new Ll,Dl=class{constructor(e){this.pattern=new RegExp(e)}validate(e){let t=new RegExp(this.pattern.source,this.pattern.flags);if(typeof e!="string")throw new zn("Incoming value must be string");if(!t.exec(e))throw new zn(`Value doesn't match to pattern '${t.toString()}'`)}};o(Dl,"PatternValidation");var Kl=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(Hl(e,Lt.Number),!(this.min<=e&&e<=this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new zn(`Value doesn't match to diapason [${t},${n}]`)}}};o(Kl,"InclusiveValidation");var $l=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(Hl(e,Lt.Number),!(this.min<e&&e<this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new zn(`Value doesn't match to diapason (${t},${n})`)}}};o($l,"ExclusiveValidation");var Tf=class{constructor(e,t,n){this.length=e,this.minLength=t,this.maxLength=n}validate(e){if(this.length!==void 0){if(e.length!==this.length)throw new zn(`Value length must be exactly ${this.length}.`);return}if(this.minLength!==void 0&&e.length<this.minLength)throw new zn(`Value length must be more than ${this.minLength}.`);if(this.maxLength!==void 0&&e.length>this.maxLength)throw new zn(`Value length must be less than ${this.maxLength}.`)}};o(Tf,"LengthValidation");var Fl=class{constructor(e){this.enumeration=e}validate(e){if(Hl(e,Lt.String),!this.enumeration.includes(e))throw new zn(`Value must be one of ${this.enumeration.map(t=>`'${t}'`).join(", ")}`)}};o(Fl,"EnumerationValidation");var Mf=class{static checkValues(e,t){let n=Array.isArray(e)?e:[e];for(let i of n)for(let s of t.validations)s instanceof Tf&&t.repeated?s.validate(e):s.validate(i)}static checkTypes(e,t){if(t.repeated&&!Array.isArray(e))throw new TypeError("Value must be Array");if(typeof t.type=="number"){let n=Array.isArray(e)?e:[e];for(let i of n)Hl(i,t.type)}}static getSchemaByName(e,t=Bf){return ne(ne({},e.names[Bf]),e.names[t])}};o(Mf,"JsonTransform");var Mr=class extends Mf{static serialize(e,t,n,i){let s=this.toJSON(e,t);return JSON.stringify(s,n,i)}static toJSON(e,t={}){let n,i=t.targetSchema,s=t.schemaName||Bf;if(ql(e))return e.toJSON();if(Array.isArray(e)){n=[];for(let a of e)n.push(this.toJSON(a,t))}else if(typeof e=="object"){if(i&&!qn.has(i))throw new Ko("Cannot get schema for `targetSchema` param");if(i=i||e.constructor,qn.has(i)){let a=qn.get(i);n={};let c=this.getSchemaByName(a,s);for(let f in c)try{let l=c[f],h=e[f],d;if(l.optional&&h===void 0||l.defaultValue!==void 0&&h===l.defaultValue)continue;if(!l.optional&&h===void 0)throw new Wa(i.name,`Property '${f}' is required.`);typeof l.type=="number"?l.converter?l.repeated?d=h.map(v=>l.converter.toJSON(v,e)):d=l.converter.toJSON(h,e):d=h:l.repeated?d=h.map(v=>this.toJSON(v,{schemaName:s})):d=this.toJSON(h,{schemaName:s}),this.checkTypes(d,l),this.checkValues(d,l),n[l.name||f]=d}catch(l){throw l instanceof Wa?l:new Wa(a.target.name,`Property '${f}' is wrong. ${l.message}`,l)}}else{n={};for(let a in e)n[a]=this.toJSON(e[a],{schemaName:s})}}else n=e;return n}};o(Mr,"JsonSerializer");var Vt=class extends Mf{static parse(e,t){let n=JSON.parse(e);return this.fromJSON(n,t)}static fromJSON(e,t){let n=t.targetSchema,i=t.schemaName||Bf,s=new n;if(ql(s))return s.fromJSON(e);let a=qn.get(n),c=this.getSchemaByName(a,i),f={};t.strictProperty&&!Array.isArray(e)&&Vt.checkStrictProperty(e,c,a);for(let h in c)try{let d=c[h],v=d.name||h,x=e[v];if(x===void 0&&(d.optional||d.defaultValue!==void 0))continue;if(!d.optional&&x===void 0)throw new $o(a,`Property '${v}' is required.`);if(this.checkTypes(x,d),this.checkValues(x,d),typeof d.type=="number")d.converter?d.repeated?s[h]=x.map(y=>d.converter.fromJSON(y,s)):s[h]=d.converter.fromJSON(x,s):s[h]=x;else{let y=be(ne({},t),{targetSchema:d.type,schemaName:i});d.repeated?s[h]=x.map(_=>this.fromJSON(_,y)):s[h]=this.fromJSON(x,y)}}catch(d){if(d instanceof $o||(d=new $o(a,`Property '${h}' is wrong. ${d.message}`,d)),t.strictAllKeys)f[h]=d;else throw d}let l=Object.keys(f);if(l.length)throw new kf(a,l,f);return s}static checkStrictProperty(e,t,n){let i=Object.keys(e),s=Object.keys(t),a=[];for(let c of i)s.indexOf(c)===-1&&a.push(c);if(a.length)throw new kf(n,a)}};o(Vt,"JsonParser");function yE(r){let e=[];return r.pattern&&e.push(new Dl(r.pattern)),(r.type===Lt.Number||r.type===Lt.Any)&&((r.minInclusive!==void 0||r.maxInclusive!==void 0)&&e.push(new Kl(r.minInclusive,r.maxInclusive)),(r.minExclusive!==void 0||r.maxExclusive!==void 0)&&e.push(new $l(r.minExclusive,r.maxExclusive)),r.enumeration!==void 0&&e.push(new Fl(r.enumeration))),(r.type===Lt.String||r.repeated||r.type===Lt.Any)&&(r.length!==void 0||r.minLength!==void 0||r.maxLength!==void 0)&&e.push(new Tf(r.length,r.minLength,r.maxLength)),e}o(yE,"getValidations");var qt=o((r={})=>(e,t)=>{let n=`Cannot set type for ${t} property of ${e.constructor.name} schema`,i;qn.has(e.constructor)?(i=qn.get(e.constructor),i.target!==e.constructor&&(i=qn.create(e.constructor),qn.set(e.constructor,i))):(i=qn.create(e.constructor),qn.set(e.constructor,i));let s={type:Lt.Any,validations:[]},a=Object.assign(s,r);if(a.validations=yE(a),typeof a.type!="number"&&!qn.has(a.type)&&!ql(a.type))throw new Error(`${n}. Assigning type doesn't have schema.`);let c;Array.isArray(r.schema)?c=r.schema:c=[r.schema||Bf];for(let f of c){i.names[f]||(i.names[f]={});let l=i.names[f];l[t]=a}},"JsonProp");var Lr=class extends Error{};o(Lr,"CryptoError");var Gs=class extends Lr{};o(Gs,"AlgorithmError");var gn=class extends Lr{constructor(e){super(`Unsupported operation: ${e?`${e}`:""}`)}};o(gn,"UnsupportedOperationError");var Oe=class extends Lr{};o(Oe,"OperationError");var zl=class extends Lr{constructor(e){super(`${e}: Missing required property`)}};o(zl,"RequiredPropertyError");function vE(r){return typeof r=="object"&&"kty"in r}o(vE,"isJWK");var zt=class{digest(...e){return M(this,null,function*(){return this.checkDigest.apply(this,e),this.onDigest.apply(this,e)})}checkDigest(e,t){this.checkAlgorithmName(e)}onDigest(e,t){return M(this,null,function*(){throw new gn("digest")})}generateKey(...e){return M(this,null,function*(){return this.checkGenerateKey.apply(this,e),this.onGenerateKey.apply(this,e)})}checkGenerateKey(e,t,n,...i){if(this.checkAlgorithmName(e),this.checkGenerateKeyParams(e),!(n&&n.length))throw new TypeError("Usages cannot be empty when creating a key.");let s;Array.isArray(this.usages)?s=this.usages:s=this.usages.privateKey.concat(this.usages.publicKey),this.checkKeyUsages(n,s)}checkGenerateKeyParams(e){}onGenerateKey(e,t,n,...i){return M(this,null,function*(){throw new gn("generateKey")})}sign(...e){return M(this,null,function*(){return this.checkSign.apply(this,e),this.onSign.apply(this,e)})}checkSign(e,t,n,...i){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"sign")}onSign(e,t,n,...i){return M(this,null,function*(){throw new gn("sign")})}verify(...e){return M(this,null,function*(){return this.checkVerify.apply(this,e),this.onVerify.apply(this,e)})}checkVerify(e,t,n,i,...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"verify")}onVerify(e,t,n,i,...s){return M(this,null,function*(){throw new gn("verify")})}encrypt(...e){return M(this,null,function*(){return this.checkEncrypt.apply(this,e),this.onEncrypt.apply(this,e)})}checkEncrypt(e,t,n,i={},...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"encrypt":void 0)}onEncrypt(e,t,n,...i){return M(this,null,function*(){throw new gn("encrypt")})}decrypt(...e){return M(this,null,function*(){return this.checkDecrypt.apply(this,e),this.onDecrypt.apply(this,e)})}checkDecrypt(e,t,n,i={},...s){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"decrypt":void 0)}onDecrypt(e,t,n,...i){return M(this,null,function*(){throw new gn("decrypt")})}deriveBits(...e){return M(this,null,function*(){return this.checkDeriveBits.apply(this,e),this.onDeriveBits.apply(this,e)})}checkDeriveBits(e,t,n,i={},...s){if(this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"deriveBits":void 0),n%8!==0)throw new Oe("length: Is not multiple of 8")}onDeriveBits(e,t,n,...i){return M(this,null,function*(){throw new gn("deriveBits")})}exportKey(...e){return M(this,null,function*(){return this.checkExportKey.apply(this,e),this.onExportKey.apply(this,e)})}checkExportKey(e,t,...n){if(this.checkKeyFormat(e),this.checkCryptoKey(t),!t.extractable)throw new Lr("key: Is not extractable")}onExportKey(e,t,...n){return M(this,null,function*(){throw new gn("exportKey")})}importKey(...e){return M(this,null,function*(){return this.checkImportKey.apply(this,e),this.onImportKey.apply(this,e)})}checkImportKey(e,t,n,i,s,...a){this.checkKeyFormat(e),this.checkKeyData(e,t),this.checkAlgorithmName(n),this.checkImportParams(n),Array.isArray(this.usages)&&this.checkKeyUsages(s,this.usages)}onImportKey(e,t,n,i,s,...a){return M(this,null,function*(){throw new gn("importKey")})}checkAlgorithmName(e){if(e.name.toLowerCase()!==this.name.toLowerCase())throw new Gs("Unrecognized name")}checkAlgorithmParams(e){}checkDerivedKeyParams(e){}checkKeyUsages(e,t){for(let n of e)if(t.indexOf(n)===-1)throw new TypeError("Cannot create a key using the specified key usages")}checkCryptoKey(e,t){if(this.checkAlgorithmName(e.algorithm),t&&e.usages.indexOf(t)===-1)throw new Lr("key does not match that of operation")}checkRequiredProperty(e,t){if(!(t in e))throw new zl(t)}checkHashAlgorithm(e,t){for(let n of t)if(n.toLowerCase()===e.name.toLowerCase())return;throw new Oe(`hash: Must be one of ${t.join(", ")}`)}checkImportParams(e){}checkKeyFormat(e){switch(e){case"raw":case"pkcs8":case"spki":case"jwk":break;default:throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'")}}checkKeyData(e,t){if(!t)throw new TypeError("keyData: Cannot be empty on empty on key importing");if(e==="jwk"){if(!vE(t))throw new TypeError("keyData: Is not JsonWebToken")}else if(!$e.BufferSourceConverter.isBufferSource(t))throw new TypeError("keyData: Is not ArrayBufferView or ArrayBuffer")}prepareData(e){return $e.BufferSourceConverter.toArrayBuffer(e)}};o(zt,"ProviderCrypto");var ji=class extends zt{checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");switch(e.length){case 128:case 192:case 256:break;default:throw new TypeError("length: Must be 128, 192, or 256")}}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};o(ji,"AesProvider");var Nf=class extends ji{constructor(){super(...arguments),this.name="AES-CBC",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes")}};o(Nf,"AesCbcProvider");var If=class extends ji{constructor(){super(...arguments),this.name="AES-CMAC",this.usages=["sign","verify"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};o(If,"AesCmacProvider");var Of=class extends ji{constructor(){super(...arguments),this.name="AES-CTR",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"counter"),!(e.counter instanceof ArrayBuffer||ArrayBuffer.isView(e.counter)))throw new TypeError("counter: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.counter.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes");if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};o(Of,"AesCtrProvider");var Pf=class extends ji{constructor(){super(...arguments),this.name="AES-ECB",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}};o(Pf,"AesEcbProvider");var Rf=class extends ji{constructor(){super(...arguments),this.name="AES-GCM",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength<1)throw new Oe("iv: Must have length more than 0 and less than 2^64 - 1");switch("tagLength"in e||(e.tagLength=128),e.tagLength){case 32:case 64:case 96:case 104:case 112:case 120:case 128:break;default:throw new Oe("tagLength: Must be one of 32, 64, 96, 104, 112, 120 or 128")}}};o(Rf,"AesGcmProvider");var Uf=class extends ji{constructor(){super(...arguments),this.name="AES-KW",this.usages=["wrapKey","unwrapKey"]}};o(Uf,"AesKwProvider");var Ya=class extends zt{constructor(){super(...arguments),this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.ivSize){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==this.ivSize)throw new TypeError(`iv: Must have length ${this.ivSize} bytes`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");if(e.length!==this.keySizeBits)throw new Oe(`algorithm.length: Must be ${this.keySizeBits}`)}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};o(Ya,"DesProvider");var Xa=class extends zt{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"]}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"publicExponent"),!(e.publicExponent&&e.publicExponent instanceof Uint8Array))throw new TypeError("publicExponent: Missing or not a Uint8Array");let t=$e.Convert.ToBase64(e.publicExponent);if(!(t==="Aw=="||t==="AQAB"))throw new TypeError("publicExponent: Must be [3] or [1,0,1]");if(this.checkRequiredProperty(e,"modulusLength"),e.modulusLength%8||e.modulusLength<256||e.modulusLength>16384)throw new TypeError("The modulus length must be a multiple of 8 bits and >= 256 and <= 16384")}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o(Xa,"RsaProvider");var Lf=class extends Xa{constructor(){super(...arguments),this.name="RSASSA-PKCS1-v1_5",this.usages={privateKey:["sign"],publicKey:["verify"]}}};o(Lf,"RsaSsaProvider");var Df=class extends Xa{constructor(){super(...arguments),this.name="RSA-PSS",this.usages={privateKey:["sign"],publicKey:["verify"]}}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"saltLength"),typeof e.saltLength!="number")throw new TypeError("saltLength: Is not a Number");if(e.saltLength<0)throw new RangeError("saltLength: Must be positive number")}};o(Df,"RsaPssProvider");var Kf=class extends Xa{constructor(){super(...arguments),this.name="RSA-OAEP",this.usages={privateKey:["decrypt","unwrapKey"],publicKey:["encrypt","wrapKey"]}}checkAlgorithmParams(e){if(e.label&&!(e.label instanceof ArrayBuffer||ArrayBuffer.isView(e.label)))throw new TypeError("label: Is not of type '(ArrayBuffer or ArrayBufferView)'")}};o(Kf,"RsaOaepProvider");var Za=class extends zt{checkGenerateKeyParams(e){this.checkRequiredProperty(e,"namedCurve"),this.checkNamedCurve(e.namedCurve)}checkNamedCurve(e){for(let t of this.namedCurves)if(t.toLowerCase()===e.toLowerCase())return;throw new Oe(`namedCurve: Must be one of ${this.namedCurves.join(", ")}`)}};o(Za,"EllipticProvider");var $f=class extends Za{constructor(){super(...arguments),this.name="ECDSA",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o($f,"EcdsaProvider");var wE=["secret","private","public"],Vi=class{static create(e,t,n,i){let s=new this;return s.algorithm=e,s.type=t,s.extractable=n,s.usages=i,s}static isKeyType(e){return wE.indexOf(e)!==-1}get[Symbol.toStringTag](){return"CryptoKey"}};o(Vi,"CryptoKey");var Qa=class extends Za{constructor(){super(...arguments),this.name="ECDH",this.usages={privateKey:["deriveBits","deriveKey"],publicKey:[]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"public"),!(e.public instanceof Vi))throw new TypeError("public: Is not a CryptoKey");if(e.public.type!=="public")throw new Oe("public: Is not a public key");if(e.public.algorithm.name!==this.name)throw new Oe(`public: Is not ${this.name} key`)}};o(Qa,"EcdhProvider");var Ff=class extends Qa{constructor(){super(...arguments),this.name="ECDH-ES",this.namedCurves=["X25519","X448"]}};o(Ff,"EcdhEsProvider");var Hf=class extends Za{constructor(){super(...arguments),this.name="EdDSA",this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["Ed25519","Ed448"]}};o(Hf,"EdDsaProvider");var Xf=o(class{constructor(e){e&&(this.value=e)}},"ObjectIdentifier");Re([Je({type:Se.ObjectIdentifier})],Xf.prototype,"value",void 0);Xf=Re([Uo({type:Ut.Choice})],Xf);var ci=class{constructor(e){Object.assign(this,e)}};o(ci,"AlgorithmIdentifier");Re([Je({type:Se.ObjectIdentifier})],ci.prototype,"algorithm",void 0);Re([Je({type:Se.Any,optional:!0})],ci.prototype,"parameters",void 0);var Gi=class{constructor(){this.version=0,this.privateKeyAlgorithm=new ci,this.privateKey=new ArrayBuffer(0)}};o(Gi,"PrivateKeyInfo");Re([Je({type:Se.Integer})],Gi.prototype,"version",void 0);Re([Je({type:ci})],Gi.prototype,"privateKeyAlgorithm",void 0);Re([Je({type:Se.OctetString})],Gi.prototype,"privateKey",void 0);Re([Je({type:Se.Any,optional:!0})],Gi.prototype,"attributes",void 0);var ec=class{constructor(){this.publicKeyAlgorithm=new ci,this.publicKey=new ArrayBuffer(0)}};o(ec,"PublicKeyInfo");Re([Je({type:ci})],ec.prototype,"publicKeyAlgorithm",void 0);Re([Je({type:Se.BitString})],ec.prototype,"publicKey",void 0);var jn={fromJSON:r=>$e.Convert.FromBase64Url(r),toJSON:r=>$e.Convert.ToBase64Url(new Uint8Array(r))},fi={fromASN:r=>{let e=r.valueBlock.valueHex;return new Uint8Array(e)[0]?r.valueBlock.valueHex:r.valueBlock.valueHex.slice(1)},toASN:r=>{let e=new Uint8Array(r)[0]>127?(0,$e.combine)(new Uint8Array([0]).buffer,r):r;return new or({valueHex:e})}};var Dr=class{constructor(){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0)}};o(Dr,"RsaPrivateKey");Re([Je({type:Se.Integer,converter:Bl})],Dr.prototype,"version",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"n",converter:jn})],Dr.prototype,"modulus",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"e",converter:jn})],Dr.prototype,"publicExponent",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"d",converter:jn})],Dr.prototype,"privateExponent",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"p",converter:jn})],Dr.prototype,"prime1",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"q",converter:jn})],Dr.prototype,"prime2",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"dp",converter:jn})],Dr.prototype,"exponent1",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"dq",converter:jn})],Dr.prototype,"exponent2",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"qi",converter:jn})],Dr.prototype,"coefficient",void 0);Re([Je({type:Se.Any,optional:!0})],Dr.prototype,"otherPrimeInfos",void 0);var tc=class{constructor(){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0)}};o(tc,"RsaPublicKey");Re([Je({type:Se.Integer,converter:fi}),qt({name:"n",converter:jn})],tc.prototype,"modulus",void 0);Re([Je({type:Se.Integer,converter:fi}),qt({name:"e",converter:jn})],tc.prototype,"publicExponent",void 0);var rc=o(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){let e=new Uint8Array(this.value);if(e[0]!==4)throw new Lr("Wrong ECPoint. Current version supports only Uncompressed (0x04) point");e=new Uint8Array(this.value.slice(1));let t=e.length/2,n=0;return{x:$e.Convert.ToBase64Url(e.buffer.slice(n,n+t)),y:$e.Convert.ToBase64Url(e.buffer.slice(n+t,n+t+t))}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");if(!("y"in e))throw new Error("y: Missing required property");let t=$e.Convert.FromBase64Url(e.x),n=$e.Convert.FromBase64Url(e.y),i=(0,$e.combine)(new Uint8Array([4]).buffer,t,n);return this.value=new Uint8Array(i).buffer,this}},"EcPublicKey");Re([Je({type:Se.OctetString})],rc.prototype,"value",void 0);rc=Re([Uo({type:Ut.Choice})],rc);var Js=class{constructor(){this.version=1,this.privateKey=new ArrayBuffer(0)}fromJSON(e){if(!("d"in e))throw new Error("d: Missing required property");if(this.privateKey=$e.Convert.FromBase64Url(e.d),"x"in e){let t=new rc;t.fromJSON(e),this.publicKey=Ye.toASN(t).valueBlock.valueHex}return this}toJSON(){let e={};return e.d=$e.Convert.ToBase64Url(this.privateKey),this.publicKey&&Object.assign(e,new rc(this.publicKey).toJSON()),e}};o(Js,"EcPrivateKey");Re([Je({type:Se.Integer,converter:Bl})],Js.prototype,"version",void 0);Re([Je({type:Se.OctetString})],Js.prototype,"privateKey",void 0);Re([Je({context:0,type:Se.Any,optional:!0})],Js.prototype,"parameters",void 0);Re([Je({context:1,type:Se.BitString,optional:!0})],Js.prototype,"publicKey",void 0);var w0={fromASN:r=>{let e=new Uint8Array(r.valueBlock.valueHex);return e[0]===0?e.buffer.slice(1):e.buffer},toASN:r=>{let e=new Uint8Array(r);if(e[0]>127){let t=new Uint8Array(e.length+1);return t.set(e,1),new or({valueHex:t.buffer})}return new or({valueHex:r})}},xE=Object.freeze({__proto__:null,AsnIntegerWithoutPaddingConverter:w0}),Ws=class{static decodePoint(e,t){let n=$e.BufferSourceConverter.toUint8Array(e);if(n.length===0||n[0]!==4)throw new Error("Only uncompressed point format supported");let i=(n.length-1)/2;if(i!==Math.ceil(t/8))throw new Error("Point does not match field size");let s=n.slice(1,i+1),a=n.slice(i+1,i+1+i);return{x:s,y:a}}static encodePoint(e,t){let n=Math.ceil(t/8);if(e.x.byteLength!==n||e.y.byteLength!==n)throw new Error("X,Y coordinates don't match point size criteria");let i=$e.BufferSourceConverter.toUint8Array(e.x),s=$e.BufferSourceConverter.toUint8Array(e.y),a=new Uint8Array(n*2+1);return a[0]=4,a.set(i,1),a.set(s,n+1),a}static getSize(e){return Math.ceil(e/8)}static encodeSignature(e,t){let n=this.getSize(t),i=$e.BufferSourceConverter.toUint8Array(e.r),s=$e.BufferSourceConverter.toUint8Array(e.s),a=new Uint8Array(n*2);return a.set(this.padStart(i,n)),a.set(this.padStart(s,n),n),a}static decodeSignature(e,t){let n=this.getSize(t),i=$e.BufferSourceConverter.toUint8Array(e);if(i.length!==n*2)throw new Error("Incorrect size of the signature");let s=i.slice(0,n),a=i.slice(n);return{r:this.trimStart(s),s:this.trimStart(a)}}static trimStart(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;return t===0?e:e.slice(t,e.length)}static padStart(e,t){if(t===e.length)return e;let n=new Uint8Array(t);return n.set(e,t-e.length),n}};o(Ws,"EcUtils");var Ys=class{constructor(){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0)}static fromWebCryptoSignature(e){let t=e.byteLength/2,n=Ws.decodeSignature(e,t*8),i=new Ys;return i.r=$e.BufferSourceConverter.toArrayBuffer(n.r),i.s=$e.BufferSourceConverter.toArrayBuffer(n.s),i}toWebCryptoSignature(e){return e!=null||(e=Math.max(this.r.byteLength,this.s.byteLength)*8),Ws.encodeSignature(this,e).buffer}};o(Ys,"EcDsaSignature");Re([Je({type:Se.Integer,converter:w0})],Ys.prototype,"r",void 0);Re([Je({type:Se.Integer,converter:w0})],Ys.prototype,"s",void 0);var qf=class extends Gi{};o(qf,"OneAsymmetricKey");Re([Je({context:1,implicit:!0,type:Se.BitString,optional:!0})],qf.prototype,"publicKey",void 0);var Vl=o(class{constructor(){this.value=new ArrayBuffer(0)}fromJSON(e){if(!e.d)throw new Error("d: Missing required property");return this.value=$e.Convert.FromBase64Url(e.d),this}toJSON(){return{d:$e.Convert.ToBase64Url(this.value)}}},"EdPrivateKey");Re([Je({type:Se.OctetString})],Vl.prototype,"value",void 0);Vl=Re([Uo({type:Ut.Choice})],Vl);var Gl=o(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){return{x:$e.Convert.ToBase64Url(this.value)}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");return this.value=$e.Convert.FromBase64Url(e.x),this}},"EdPublicKey");Re([Je({type:Se.BitString})],Gl.prototype,"value",void 0);Gl=Re([Uo({type:Ut.Choice})],Gl);var Jl=o(class{},"CurvePrivateKey");Re([Je({type:Se.OctetString}),qt({type:Lt.String,converter:jn})],Jl.prototype,"d",void 0);Jl=Re([Uo({type:Ut.Choice})],Jl);var Dy="1.2.840.10045.3.1.7",Wl="1.3.132.0",Ky=`${Wl}.34`,$y=`${Wl}.35`,Fy=`${Wl}.10`,Br="1.3.36.3.3.2.8.1.1",Hy=`${Br}.1`,qy=`${Br}.2`,zy=`${Br}.3`,jy=`${Br}.4`,Vy=`${Br}.5`,Gy=`${Br}.6`,Jy=`${Br}.7`,Wy=`${Br}.8`,Yy=`${Br}.9`,Xy=`${Br}.10`,Zy=`${Br}.11`,Qy=`${Br}.12`,ev=`${Br}.13`,tv=`${Br}.14`,_E="1.3.101.110",AE="1.3.101.111",EE="1.3.101.112",SE="1.3.101.113",Ae=Object.freeze({__proto__:null,converters:xE,get ObjectIdentifier(){return Xf},AlgorithmIdentifier:ci,PrivateKeyInfo:Gi,PublicKeyInfo:ec,RsaPrivateKey:Dr,RsaPublicKey:tc,EcPrivateKey:Js,get EcPublicKey(){return rc},EcDsaSignature:Ys,OneAsymmetricKey:qf,get EdPrivateKey(){return Vl},get EdPublicKey(){return Gl},get CurvePrivateKey(){return Jl},idSecp256r1:Dy,idEllipticCurve:Wl,idSecp384r1:Ky,idSecp521r1:$y,idSecp256k1:Fy,idVersionOne:Br,idBrainpoolP160r1:Hy,idBrainpoolP160t1:qy,idBrainpoolP192r1:zy,idBrainpoolP192t1:jy,idBrainpoolP224r1:Vy,idBrainpoolP224t1:Gy,idBrainpoolP256r1:Jy,idBrainpoolP256t1:Wy,idBrainpoolP320r1:Yy,idBrainpoolP320t1:Xy,idBrainpoolP384r1:Zy,idBrainpoolP384t1:Qy,idBrainpoolP512r1:ev,idBrainpoolP512t1:tv,idX25519:_E,idX448:AE,idEd25519:EE,idEd448:SE}),st=class{constructor(){}static register(e){let t=new Xf;t.value=e.id;let n=Lo.serialize(t);this.items.push(be(ne({},e),{raw:n})),this.names.push(e.name)}static find(e){e=e.toUpperCase();for(let t of this.items)if(t.name.toUpperCase()===e||t.id.toUpperCase()===e)return t;return null}static get(e){let t=this.find(e);if(!t)throw new Error(`Unsupported EC named curve '${e}'`);return t}};o(st,"EcCurves");st.items=[];st.names=[];st.register({name:"P-256",id:Dy,size:256});st.register({name:"P-384",id:Ky,size:384});st.register({name:"P-521",id:$y,size:521});st.register({name:"K-256",id:Fy,size:256});st.register({name:"brainpoolP160r1",id:Hy,size:160});st.register({name:"brainpoolP160t1",id:qy,size:160});st.register({name:"brainpoolP192r1",id:zy,size:192});st.register({name:"brainpoolP192t1",id:jy,size:192});st.register({name:"brainpoolP224r1",id:Vy,size:224});st.register({name:"brainpoolP224t1",id:Gy,size:224});st.register({name:"brainpoolP256r1",id:Jy,size:256});st.register({name:"brainpoolP256t1",id:Wy,size:256});st.register({name:"brainpoolP320r1",id:Yy,size:320});st.register({name:"brainpoolP320t1",id:Xy,size:320});st.register({name:"brainpoolP384r1",id:Zy,size:384});st.register({name:"brainpoolP384t1",id:Qy,size:384});st.register({name:"brainpoolP512r1",id:ev,size:512});st.register({name:"brainpoolP512t1",id:tv,size:512});var zf=class extends zt{constructor(){super(...arguments),this.name="HMAC",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["sign","verify"]}getDefaultLength(e){switch(e.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":return 512;default:throw new Error(`Unknown algorithm name '${e}'`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),"length"in e){if(typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new RangeError("length: Number is out of range")}}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};o(zf,"HmacProvider");var jf=class extends zt{constructor(){super(...arguments),this.name="PBKDF2",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveBits","deriveKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!(e.salt instanceof ArrayBuffer||ArrayBuffer.isView(e.salt)))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"iterations"),typeof e.iterations!="number")throw new TypeError("iterations: Is not a Number");if(e.iterations<1)throw new TypeError("iterations: Is less than 1")}checkImportKey(e,t,n,i,s,...a){if(super.checkImportKey(e,t,n,i,s),i)throw new SyntaxError("extractable: Must be 'false'")}};o(jf,"Pbkdf2Provider");var Vf=class extends zt{constructor(){super(...arguments),this.name="HKDF",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveKey","deriveBits"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!$e.BufferSourceConverter.isBufferSource(e.salt))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"info"),!$e.BufferSourceConverter.isBufferSource(e.info))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'")}checkImportKey(e,t,n,i,s,...a){if(super.checkImportKey(e,t,n,i,s),i)throw new SyntaxError("extractable: Must be 'false'")}};o(Vf,"HkdfProvider");var Gf=class extends zt{constructor(){super(...arguments),this.usages=[],this.defaultLength=0}digest(...e){return e[0]=ne({length:this.defaultLength},e[0]),super.digest.apply(this,e)}checkDigest(e,t){super.checkDigest(e,t);let n=e.length||0;if(typeof n!="number")throw new TypeError("length: Is not a Number");if(n<0)throw new TypeError("length: Is negative")}};o(Gf,"ShakeProvider");var Jf=class extends Gf{constructor(){super(...arguments),this.name="shake128",this.defaultLength=16}};o(Jf,"Shake128Provider");var Wf=class extends Gf{constructor(){super(...arguments),this.name="shake256",this.defaultLength=32}};o(Wf,"Shake256Provider");var Yf=class{get[Symbol.toStringTag](){return"Crypto"}randomUUID(){let e=this.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=$e.Convert.ToHex(e).toLowerCase();return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16)}`}};o(Yf,"Crypto");var jl=class{constructor(){this.items={}}get(e){return this.items[e.toLowerCase()]||null}set(e){this.items[e.name.toLowerCase()]=e}removeAt(e){let t=this.get(e.toLowerCase());return t&&delete this.items[e],t}has(e){return!!this.get(e)}get length(){return Object.keys(this.items).length}get algorithms(){let e=[];for(let t in this.items){let n=this.items[t];e.push(n.name)}return e.sort()}};o(jl,"ProviderStorage");var Fo=class{constructor(){this.providers=new jl}static isHashedAlgorithm(e){return!!(e&&typeof e=="object"&&"name"in e&&"hash"in e)}get[Symbol.toStringTag](){return"SubtleCrypto"}digest(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"digest");let[t,n,...i]=e,s=this.prepareAlgorithm(t),a=$e.BufferSourceConverter.toArrayBuffer(n);return yield this.getProvider(s.name).digest(s,a,...i)})}generateKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"generateKey");let[t,n,i,...s]=e,a=this.prepareAlgorithm(t),c=this.getProvider(a.name);return yield c.generateKey(be(ne({},a),{name:c.name}),n,i,...s)})}sign(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"sign");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.sign(be(ne({},a),{name:f.name}),n,c,...s)})}verify(...e){return M(this,null,function*(){this.checkRequiredArguments(e,4,"verify");let[t,n,i,s,...a]=e;this.checkCryptoKey(n);let c=this.prepareAlgorithm(t),f=$e.BufferSourceConverter.toArrayBuffer(s),l=$e.BufferSourceConverter.toArrayBuffer(i),h=this.getProvider(c.name);return yield h.verify(be(ne({},c),{name:h.name}),n,l,f,...a)})}encrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"encrypt");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.encrypt(be(ne({},a),{name:f.name}),n,c,{keyUsage:!0},...s)})}decrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"decrypt");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=$e.BufferSourceConverter.toArrayBuffer(i),f=this.getProvider(a.name);return yield f.decrypt(be(ne({},a),{name:f.name}),n,c,{keyUsage:!0},...s)})}deriveBits(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"deriveBits");let[t,n,i,...s]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),c=this.getProvider(a.name);return yield c.deriveBits(be(ne({},a),{name:c.name}),n,i,{keyUsage:!0},...s)})}deriveKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"deriveKey");let[t,n,i,s,a,...c]=e,f=this.prepareAlgorithm(i);this.getProvider(f.name).checkDerivedKeyParams(f);let h=this.prepareAlgorithm(t),d=this.getProvider(h.name);d.checkCryptoKey(n,"deriveKey");let v=yield d.deriveBits(be(ne({},h),{name:d.name}),n,i.length||512,{keyUsage:!1},...c);return this.importKey("raw",v,i,s,a,...c)})}exportKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"exportKey");let[t,n,...i]=e;return this.checkCryptoKey(n),yield this.getProvider(n.algorithm.name).exportKey(t,n,...i)})}importKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"importKey");let[t,n,i,s,a,...c]=e,f=this.prepareAlgorithm(i),l=this.getProvider(f.name);if(["pkcs8","spki","raw"].indexOf(t)!==-1){let h=$e.BufferSourceConverter.toArrayBuffer(n);return l.importKey(t,h,be(ne({},f),{name:l.name}),s,a,...c)}else if(!n.kty)throw new TypeError("keyData: Is not JSON");return l.importKey(t,n,be(ne({},f),{name:l.name}),s,a,...c)})}wrapKey(e,t,n,i,...s){return M(this,null,function*(){let a=yield this.exportKey(e,t,...s);if(e==="jwk"){let h=JSON.stringify(a);a=$e.Convert.FromUtf8String(h)}let c=this.prepareAlgorithm(i),f=$e.BufferSourceConverter.toArrayBuffer(a),l=this.getProvider(c.name);return l.encrypt(be(ne({},c),{name:l.name}),n,f,{keyUsage:!1},...s)})}unwrapKey(e,t,n,i,s,a,c,...f){return M(this,null,function*(){let l=this.prepareAlgorithm(i),h=$e.BufferSourceConverter.toArrayBuffer(t),d=this.getProvider(l.name),v=yield d.decrypt(be(ne({},l),{name:d.name}),n,h,{keyUsage:!1},...f);if(e==="jwk")try{v=JSON.parse($e.Convert.ToUtf8String(v))}catch(x){let y=new TypeError("wrappedKey: Is not a JSON");throw y.internal=x,y}return this.importKey(e,v,s,a,c,...f)})}checkRequiredArguments(e,t,n){if(e.length<t)throw new TypeError(`Failed to execute '${n}' on 'SubtleCrypto': ${t} arguments required, but only ${e.length} present`)}prepareAlgorithm(e){if(typeof e=="string")return{name:e};if(Fo.isHashedAlgorithm(e)){let t=ne({},e);return t.hash=this.prepareAlgorithm(e.hash),t}return ne({},e)}getProvider(e){let t=this.providers.get(e);if(!t)throw new Gs("Unrecognized name");return t}checkCryptoKey(e){if(!(e instanceof Vi))throw new TypeError("Key is not of type 'CryptoKey'")}};o(Fo,"SubtleCrypto");var hi=ze(require("crypto")),Be=ze(require("crypto")),sv=ze(require("process"));var yn=ze(Ms());var _0={fromJSON:r=>Buffer.from(yn.Convert.FromBase64Url(r)),toJSON:r=>yn.Convert.ToBase64Url(r)},vn=class extends Vi{constructor(){super(...arguments),this.data=Buffer.alloc(0),this.algorithm={name:""},this.extractable=!1,this.type="secret",this.usages=[],this.kty="oct",this.alg=""}};o(vn,"CryptoKey");Re([qt({name:"ext",type:Lt.Boolean,optional:!0})],vn.prototype,"extractable",void 0);Re([qt({name:"key_ops",type:Lt.String,repeated:!0,optional:!0})],vn.prototype,"usages",void 0);Re([qt({type:Lt.String})],vn.prototype,"kty",void 0);Re([qt({type:Lt.String,optional:!0})],vn.prototype,"alg",void 0);var Zf=class extends vn{constructor(){super(...arguments),this.kty="oct",this.type="secret"}};o(Zf,"SymmetricKey");var Ji=class extends vn{};o(Ji,"AsymmetricKey");var Nr=class extends Zf{get alg(){switch(this.algorithm.name.toUpperCase()){case"AES-CBC":return`A${this.algorithm.length}CBC`;case"AES-CTR":return`A${this.algorithm.length}CTR`;case"AES-GCM":return`A${this.algorithm.length}GCM`;case"AES-KW":return`A${this.algorithm.length}KW`;case"AES-CMAC":return`A${this.algorithm.length}CMAC`;case"AES-ECB":return`A${this.algorithm.length}ECB`;default:throw new Gs("Unsupported algorithm name")}}set alg(e){}};o(Nr,"AesCryptoKey");Re([qt({name:"k",converter:_0})],Nr.prototype,"data",void 0);var ov=new WeakMap;function xe(r){let e=ov.get(r);if(!e)throw new Oe("Cannot get CryptoKey from secure storage");return e}o(xe,"getCryptoKey");function Le(r){let e=Vi.create(r.algorithm,r.type,r.extractable,r.usages);return Object.freeze(e),ov.set(e,r),e}o(Le,"setCryptoKey");var Ze=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Nr;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){if(!(t instanceof Nr))throw new Error("key: Is not AesCryptoKey");switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:Nr});break;case"raw":a=new Nr,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}switch(a.algorithm=n,a.algorithm.length=a.data.length<<3,a.extractable=i,a.usages=s,a.algorithm.length){case 128:case 192:case 256:break;default:throw new Oe("keyData: Is wrong key length")}return a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"AES-CBC":return this.encryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.encryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.encryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.encryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.encryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof Nr))throw new Error("key: Is not AesCryptoKey");switch(e.name.toUpperCase()){case"AES-CBC":return this.decryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.decryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.decryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.decryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.decryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ctr`,t.data,Buffer.from(e.counter)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ctr`,t.data,new Uint8Array(e.counter)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-gcm`,t.data,Buffer.from(e.iv),{authTagLength:(e.tagLength||128)>>3});e.additionalData&&i.setAAD(Buffer.from(e.additionalData));let s=i.update(n);return s=Buffer.concat([s,i.final(),i.getAuthTag()]),new Uint8Array(s).buffer})}static decryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-gcm`,t.data,new Uint8Array(e.iv)),s=(e.tagLength||128)>>3,a=n.slice(0,n.length-s),c=n.slice(n.length-s);e.additionalData&&i.setAAD(Buffer.from(e.additionalData)),i.setAuthTag(c);let f=i.update(a);return f=Buffer.concat([f,i.final()]),new Uint8Array(f).buffer})}static encryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}};o(Ze,"AesCrypto");Ze.AES_KW_IV=Buffer.from("A6A6A6A6A6A6A6A6","hex");var Yl=class extends Nf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(Yl,"AesCbcProvider");var A0=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),rv=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135]),Ho=16;function nv(r){let e=Buffer.alloc(r.length),t=r.length-1;for(let n=0;n<t;n++)e[n]=r[n]<<1,r[n+1]&128&&(e[n]+=1);return e[t]=r[t]<<1,e}o(nv,"bitShiftLeft");function nc(r,e){let t=Math.min(r.length,e.length),n=Buffer.alloc(t);for(let i=0;i<t;i++)n[i]=r[i]^e[i];return n}o(nc,"xor");function x0(r,e){let t=hi.createCipheriv(`aes${r.length<<3}`,r,A0),n=t.update(e);return t.final(),n}o(x0,"aes");function iv(r,e){let t=Buffer.alloc(Ho),n=e*Ho,i=n+Ho;return r.copy(t,0,n,i),t}o(iv,"getMessageBlock");function kE(r,e){let t=Buffer.alloc(Ho),n=e*Ho,i=r.length;return t.fill(0),r.copy(t,0,n,i),t[i-n]=128,t}o(kE,"getPaddedMessageBlock");function TE(r){let e=x0(r,A0),t=nv(e);e[0]&128&&(t=nc(t,rv));let n=nv(t);return t[0]&128&&(n=nc(n,rv)),{subkey1:t,subkey2:n}}o(TE,"generateSubkeys");function ME(r,e){let t=TE(r),n=Math.ceil(e.length/Ho),i,s;n===0?(n=1,i=!1):i=e.length%Ho===0;let a=n-1;i?s=nc(iv(e,a),t.subkey1):s=nc(kE(e,a),t.subkey2);let c=A0,f;for(let l=0;l<a;l++)f=nc(c,iv(e,l)),c=x0(r,f);return f=nc(s,c),x0(r,f)}o(ME,"aesCmac");var Xl=class extends If{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onSign(e,t,n){return M(this,null,function*(){let i=ME(xe(t).data,Buffer.from(n));return new Uint8Array(i).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let s=yield this.sign(e,t,i);return Buffer.from(n).compare(Buffer.from(s))===0})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(Xl,"AesCmacProvider");var Zl=class extends Of{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(Zl,"AesCtrProvider");var Ql=class extends Rf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(Ql,"AesGcmProvider");var eh=class extends Uf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(eh,"AesKwProvider");var th=class extends Pf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,s);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Nr))throw new TypeError("key: Is not a AesCryptoKey")}};o(th,"AesEcbProvider");var li=class extends Zf{get alg(){switch(this.algorithm.name.toUpperCase()){case"DES-CBC":return"DES-CBC";case"DES-EDE3-CBC":return"3DES-CBC";default:throw new Gs("Unsupported algorithm name")}}set alg(e){}};o(li,"DesCryptoKey");Re([qt({name:"k",converter:_0})],li.prototype,"data",void 0);var en=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new li;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:li});break;case"raw":a=new li,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm=n,a.extractable=i,a.usages=s,a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"DES-CBC":return this.encryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.encryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof li))throw new Error("key: Is not DesCryptoKey");switch(e.name.toUpperCase()){case"DES-CBC":return this.decryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.decryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static encryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-ede3-cbc",t.data,Buffer.from(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}static decryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-ede3-cbc",t.data,new Uint8Array(e.iv)),s=i.update(n);return s=Buffer.concat([s,i.final()]),new Uint8Array(s).buffer})}};o(en,"DesCrypto");var rh=class extends Ya{constructor(){super(...arguments),this.keySizeBits=64,this.ivSize=8,this.name="DES-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield en.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return en.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return en.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return en.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield en.importKey(e,t,{name:this.name,length:this.keySizeBits},i,s);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof li))throw new TypeError("key: Is not a DesCryptoKey")}};o(rh,"DesCbcProvider");var nh=class extends Ya{constructor(){super(...arguments),this.keySizeBits=192,this.ivSize=8,this.name="DES-EDE3-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield en.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return en.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return en.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return en.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield en.importKey(e,t,{name:this.name,length:this.keySizeBits},i,s);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof li))throw new TypeError("key: Is not a DesCryptoKey")}};o(nh,"DesEde3CbcProvider");function av(r){switch(r.name.toUpperCase()){case"RSA-OAEP":{let e=/(\d+)$/.exec(r.hash.name)[1];return`RSA-OAEP${e!=="1"?`-${e}`:""}`}case"RSASSA-PKCS1-V1_5":return`RS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PSS":return`PS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PKCS1":return"RS1";default:throw new Oe("algorithm: Is not recognized")}}o(av,"getJwkAlgorithm");var Wi=class extends Ji{constructor(){super(...arguments),this.type="private"}getKey(){let e=We.parse(this.data,Ae.PrivateKeyInfo);return We.parse(e.privateKey,Ae.RsaPrivateKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:av(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){let t=Vt.fromJSON(e,{targetSchema:Ae.RsaPrivateKey}),n=new Ae.PrivateKeyInfo;n.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.privateKeyAlgorithm.parameters=null,n.privateKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};o(Wi,"RsaPrivateKey");var Yi=class extends Ji{constructor(){super(...arguments),this.type="public"}getKey(){let e=We.parse(this.data,Ae.PublicKeyInfo);return We.parse(e.publicKey,Ae.RsaPublicKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:av(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Mr.toJSON(e))}fromJSON(e){let t=Vt.fromJSON(e,{targetSchema:Ae.RsaPublicKey}),n=new Ae.PublicKeyInfo;n.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.publicKeyAlgorithm.parameters=null,n.publicKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};o(Yi,"RsaPublicKey");var Dt=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Wi;i.algorithm=e,i.extractable=t,i.usages=n.filter(l=>this.privateKeyUsages.indexOf(l)!==-1);let s=new Yi;s.algorithm=e,s.extractable=!0,s.usages=n.filter(l=>this.publicKeyUsages.indexOf(l)!==-1);let a=Buffer.concat([Buffer.alloc(4-e.publicExponent.byteLength,0),Buffer.from(e.publicExponent)]).readInt32BE(0),c=Be.default.generateKeyPairSync("rsa",{modulusLength:e.modulusLength,publicExponent:a,publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=c.privateKey,s.data=c.publicKey,{privateKey:i,publicKey:s}})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":if(t.d){let c=Vt.fromJSON(t,{targetSchema:Ae.RsaPrivateKey});return this.importPrivateKey(c,n,i,s)}else{let c=Vt.fromJSON(t,{targetSchema:Ae.RsaPublicKey});return this.importPublicKey(c,n,i,s)}case"spki":{let a=We.parse(new Uint8Array(t),Ae.PublicKeyInfo),c=We.parse(a.publicKey,Ae.RsaPublicKey);return this.importPublicKey(c,n,i,s)}case"pkcs8":{let a=We.parse(new Uint8Array(t),Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.RsaPrivateKey);return this.importPrivateKey(c,n,i,s)}default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static sign(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.signRsa(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static verify(e,t,n,i){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.verifySSA(e,t,i,n);default:throw new Oe("algorithm: Is not recognized")}})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.encryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.decryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static importPrivateKey(e,t,n,i){let s=new Ae.PrivateKeyInfo;s.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",s.privateKeyAlgorithm.parameters=null,s.privateKey=Ye.serialize(e);let a=new Wi;return a.data=Buffer.from(Ye.serialize(s)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static importPublicKey(e,t,n,i){let s=new Ae.PublicKeyInfo;s.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",s.publicKeyAlgorithm.parameters=null,s.publicKey=Ye.serialize(e);let a=new Yi;return a.data=Buffer.from(Ye.serialize(s)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static getCryptoAlgorithm(e){switch(e.hash.name.toUpperCase()){case"SHA-1":return"RSA-SHA1";case"SHA-256":return"RSA-SHA256";case"SHA-384":return"RSA-SHA384";case"SHA-512":return"RSA-SHA512";case"SHA3-256":return"RSA-SHA3-256";case"SHA3-384":return"RSA-SHA3-384";case"SHA3-512":return"RSA-SHA3-512";default:throw new Oe("algorithm.hash: Is not recognized")}}static signRsa(e,t,n){let i=this.getCryptoAlgorithm(t.algorithm),s=Be.default.createSign(i);s.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
637
|
+
`)}`:`${t} :`}};s(jt,"Constructed");sy=jt;Ae.Constructed=sy;jt.NAME="CONSTRUCTED";var Sc=class extends er{fromBER(e,t,n){return t}toBER(e){return jn}};s(Sc,"LocalEndOfContentValueBlock");Sc.override="EndOfContentValueBlock";var ay,ja=class extends Lt{constructor(e={}){super(e,Sc),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}};s(ja,"EndOfContent");ay=ja;Ae.EndOfContent=ay;ja.NAME=Uc;var fy,yn=class extends Lt{constructor(e={}){super(e,er),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,n){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=n,t+n>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+n}toBER(e,t){let n=new ArrayBuffer(2);if(!e){let i=new Uint8Array(n);i[0]=5,i[1]=0}return t&&t.write(n),n}onAsciiEncoding(){return`${this.constructor.NAME}`}};s(yn,"Null");fy=yn;Ae.Null=fy;yn.NAME="NULL";var Cc=class extends li(er){constructor(n={}){var i=n,{value:e}=i,t=Mt(i,["value"]);super(t),t.valueHex?this.valueHexView=je.BufferSourceConverter.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}get value(){for(let e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}fromBER(e,t,n){let i=je.BufferSourceConverter.toUint8Array(e);return Vi(this,i,t,n)?(this.valueHexView=i.subarray(t,t+n),n>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,k0.call(this),this.blockLength=n,t+n):-1}toBER(){return this.valueHexView.slice()}toJSON(){return be(ne({},super.toJSON()),{value:this.value})}};s(Cc,"LocalBooleanValueBlock");Cc.NAME="BooleanValueBlock";var cy,Do=class extends Lt{constructor(e={}){super(e,Cc),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};s(Do,"Boolean");cy=Do;Ae.Boolean=cy;Do.NAME="BOOLEAN";var Tc=class extends li(Hn){constructor(n={}){var i=n,{isConstructed:e=!1}=i,t=Mt(i,["isConstructed"]);super(t),this.isConstructed=e}fromBER(e,t,n){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=Hn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let o=0;o<this.value.length;o++){let a=this.value[o].constructor.NAME;if(a===Uc){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==ry)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,t,n),this.blockLength=n;return i}toBER(e,t){return this.isConstructed?Hn.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return be(ne({},super.toJSON()),{isConstructed:this.isConstructed})}};s(Tc,"LocalOctetStringValueBlock");Tc.NAME="OctetStringValueBlock";var uy,qn=class extends Lt{constructor(i={}){var o=i,{idBlock:e={},lenBlock:t={}}=o,n=Mt(o,["idBlock","lenBlock"]);var a,f;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((f=n.value)===null||f===void 0)&&f.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:be(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),Tc),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,n){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,n===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){let o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+n);try{if(o.byteLength){let a=tf(o,0,o.byteLength);a.offset!==-1&&a.offset===n&&(this.valueBlock.value=[a.result])}}catch(a){}}return super.fromBER(e,t,n)}onAsciiEncoding(){return this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length?jt.prototype.onAsciiEncoding.call(this):`${this.constructor.NAME} : ${je.Convert.ToHex(this.valueBlock.valueHexView)}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;let e=[];for(let t of this.valueBlock.value)t instanceof qn&&e.push(t.valueBlock.valueHexView);return je.BufferSourceConverter.concat(e)}};s(qn,"OctetString");uy=qn;Ae.OctetString=uy;qn.NAME=ry;var kc=class extends li(Hn){constructor(i={}){var o=i,{unusedBits:e=0,isConstructed:t=!1}=o,n=Mt(o,["unusedBits","isConstructed"]);super(n),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,n){if(!n)return t;let i=-1;if(this.isConstructed){if(i=Hn.prototype.fromBER.call(this,e,t,n),i===-1)return i;for(let f of this.value){let c=f.constructor.NAME;if(c===Uc){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(c!==ny)return this.error="BIT STRING may consists of BIT STRINGs only",-1;let l=f.valueBlock;if(this.unusedBits>0&&l.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=l.unusedBits}return i}let o=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,o,t,n))return-1;let a=o.subarray(t,t+n);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){let f=a.subarray(1);try{if(f.byteLength){let c=tf(f,0,f.byteLength);c.offset!==-1&&c.offset===n-1&&(this.value=[c.result])}}catch(c){}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,t+n}toBER(e,t){if(this.isConstructed)return Hn.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return jn;let n=new Uint8Array(this.valueHexView.length+1);return n[0]=this.unusedBits,n.set(this.valueHexView,1),n.buffer}toJSON(){return be(ne({},super.toJSON()),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})}};s(kc,"LocalBitStringValueBlock");kc.NAME="BitStringValueBlock";var ly,qi=class extends Lt{constructor(i={}){var o=i,{idBlock:e={},lenBlock:t={}}=o,n=Mt(o,["idBlock","lenBlock"]);var a,f;(a=n.isConstructed)!==null&&a!==void 0||(n.isConstructed=!!(!((f=n.value)===null||f===void 0)&&f.length)),super(ne({idBlock:ne({isConstructed:n.isConstructed},e),lenBlock:be(ne({},t),{isIndefiniteForm:!!n.isIndefiniteForm})},n),kc),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,n){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,n)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return jt.prototype.onAsciiEncoding.call(this);{let e=[],t=this.valueBlock.valueHexView;for(let i of t)e.push(i.toString(2).padStart(8,"0"));let n=e.join("");return`${this.constructor.NAME} : ${n.substring(0,n.length-this.valueBlock.unusedBits)}`}}};s(qi,"BitString");ly=qi;Ae.BitString=ly;qi.NAME=ny;var hy;function NE(r,e){let t=new Uint8Array([0]),n=new Uint8Array(r),i=new Uint8Array(e),o=n.slice(0),a=o.length-1,f=i.slice(0),c=f.length-1,l=0,h=c<a?a:c,d=0;for(let y=h;y>=0;y--,d++){switch(!0){case d<f.length:l=o[a-d]+f[c-d]+t[0];break;default:l=o[a-d]+t[0]}switch(t[0]=l/10,!0){case d>=o.length:o=$l(new Uint8Array([l%10]),o);break;default:o[a-d]=l%10}}return t[0]>0&&(o=$l(t,o)),o}s(NE,"viewAdd");function ty(r){if(r>=xc.length)for(let e=xc.length;e<=r;e++){let t=new Uint8Array([0]),n=xc[e-1].slice(0);for(let i=n.length-1;i>=0;i--){let o=new Uint8Array([(n[i]<<1)+t[0]]);t[0]=o[0]/10,n[i]=o[0]%10}t[0]>0&&(n=$l(t,n)),xc.push(n)}return xc[r]}s(ty,"power2");function OE(r,e){let t=0,n=new Uint8Array(r),i=new Uint8Array(e),o=n.slice(0),a=o.length-1,f=i.slice(0),c=f.length-1,l,h=0;for(let d=c;d>=0;d--,h++)switch(l=o[a-h]-f[c-h]-t,!0){case l<0:t=1,o[a-h]=l+10;break;default:t=0,o[a-h]=l}if(t>0)for(let d=a-c+1;d>=0;d--,h++)if(l=o[a-h]-t,l<0)t=1,o[a-h]=l+10;else{t=0,o[a-h]=l;break}return o.slice()}s(OE,"viewSub");var Va=class extends li(er){constructor(n={}){var i=n,{value:e}=i,t=Mt(i,["value"]);super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=k0.call(this)))}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Xg(e))}get valueDec(){return this._valueDec}fromDER(e,t,n,i=0){let o=this.fromBER(e,t,n);if(o===-1)return o;let a=this.valueHexView;return a[0]===0&&(a[1]&128)!==0?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),o}toDER(e=!1){let t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{let n=new Uint8Array(this.valueHexView.length+1);n[0]=0,n.set(t,1),this.valueHexView=n}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,n){let i=super.fromBER(e,t,n);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec})}toString(){let e=this.valueHexView.length*8-1,t=new Uint8Array(this.valueHexView.length*8/3),n=0,i,o=this.valueHexView,a="",f=!1;for(let c=o.byteLength-1;c>=0;c--){i=o[c];for(let l=0;l<8;l++){if((i&1)===1)switch(n){case e:t=OE(ty(n),t),a="-";break;default:t=NE(t,ty(n))}n++,i>>=1}}for(let c=0;c<t.length;c++)t[c]&&(f=!0),f&&(a+=Qg.charAt(t[c]));return f===!1&&(a+=Qg.charAt(0)),a}};s(Va,"LocalIntegerValueBlock");hy=Va;Va.NAME="IntegerValueBlock";Object.defineProperty(hy.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var dy,ur=class extends Lt{constructor(e={}){super(e,Va),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return ql(),BigInt(this.valueBlock.toString())}static fromBigInt(e){ql();let t=BigInt(e),n=new $s,i=t.toString(16).replace(/^-/,""),o=new Uint8Array(je.Convert.FromHex(i));if(t<0){let f=new Uint8Array(o.length+(o[0]&128?1:0));f[0]|=128;let l=BigInt(`0x${je.Convert.ToHex(f)}`)+t,h=je.BufferSourceConverter.toUint8Array(je.Convert.FromHex(l.toString(16)));h[0]|=128,n.write(h)}else o[0]&128&&n.write(new Uint8Array([0])),n.write(o);return new ur({valueHex:n.final()})}convertToDER(){let e=new ur({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new ur({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}};s(ur,"Integer");dy=ur;Ae.Integer=dy;ur.NAME="INTEGER";var py,Fo=class extends ur{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}};s(Fo,"Enumerated");py=Fo;Ae.Enumerated=py;Fo.NAME="ENUMERATED";var Wa=class extends li(er){constructor(i={}){var o=i,{valueDec:e=-1,isFirstSid:t=!1}=o,n=Mt(o,["valueDec","isFirstSid"]);super(n),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,n){if(!n)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,i,t,n))return-1;let o=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let f=0;f<n&&(this.valueHexView[f]=o[f]&127,this.blockLength++,(o[f]&128)!==0);f++);let a=new Uint8Array(this.blockLength);for(let f=0;f<this.blockLength;f++)a[f]=this.valueHexView[f];return this.valueHexView=a,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ks(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){ql();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;let n=new Uint8Array(t.length/7);for(let i=0;i<n.length;i++)n[i]=parseInt(t.slice(i*7,i*7+7),2)+(i+1<n.length?128:0);this.fromBER(n.buffer,0,n.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}let t=Uo(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",jn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),o=t.byteLength-1;for(let a=0;a<o;a++)n[a]=i[a]|128;n[o]=i[o]}return n}toString(){let e="";if(this.isHexOnly)e=je.Convert.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})}};s(Wa,"LocalSidValueBlock");Wa.NAME="sidBlock";var Mc=class extends er{constructor(n={}){var i=n,{value:e=Kr}=i,t=Mt(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let o=new Wa;if(i=o.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,n-=o.blockLength,this.value.push(o)}return i}toBER(e){let t=[];for(let n=0;n<this.value.length;n++){let i=this.value[n].toBER(e);if(i.byteLength===0)return this.error=this.value[n].error,jn;t.push(i)}return B0(t)}fromString(e){this.value=[];let t=0,n=0,i="",o=!1;do if(n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1,o){let a=this.value[0],f=0;switch(a.valueDec){case 0:break;case 1:f=40;break;case 2:f=80;break;default:this.value=[];return}let c=parseInt(i,10);if(isNaN(c))return;a.valueDec=c+f,o=!1}else{let a=new Wa;if(i>Number.MAX_SAFE_INTEGER){ql();let f=BigInt(i);a.valueBigInt=f}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,o=!0),this.value.push(a)}while(n!==-1)}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t?(i=`{${i}}`,this.value[n].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){let e=be(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};s(Mc,"LocalObjectIdentifierValueBlock");Mc.NAME="ObjectIdentifierValueBlock";var my,Ko=class extends Lt{constructor(e={}){super(e,Mc),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return be(ne({},super.toJSON()),{value:this.getValue()})}};s(Ko,"ObjectIdentifier");my=Ko;Ae.ObjectIdentifier=my;Ko.NAME="OBJECT IDENTIFIER";var Ga=class extends li(ci){constructor(n={}){var i=n,{valueDec:e=0}=i,t=Mt(i,["valueDec"]);super(t),this.valueDec=e}fromBER(e,t,n){if(n===0)return t;let i=je.BufferSourceConverter.toUint8Array(e);if(!Vi(this,i,t,n))return-1;let o=i.subarray(t,t+n);this.valueHexView=new Uint8Array(n);for(let f=0;f<n&&(this.valueHexView[f]=o[f]&127,this.blockLength++,(o[f]&128)!==0);f++);let a=new Uint8Array(this.blockLength);for(let f=0;f<this.blockLength;f++)a[f]=this.valueHexView[f];return this.valueHexView=a,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ks(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);let i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}let t=Uo(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",jn;let n=new Uint8Array(t.byteLength);if(!e){let i=new Uint8Array(t),o=t.byteLength-1;for(let a=0;a<o;a++)n[a]=i[a]|128;n[o]=i[o]}return n.buffer}toString(){let e="";return this.isHexOnly?e=je.Convert.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return be(ne({},super.toJSON()),{valueDec:this.valueDec})}};s(Ga,"LocalRelativeSidValueBlock");Ga.NAME="relativeSidBlock";var Bc=class extends er{constructor(n={}){var i=n,{value:e=Kr}=i,t=Mt(i,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,n){let i=t;for(;n>0;){let o=new Ga;if(i=o.fromBER(e,i,n),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,n-=o.blockLength,this.value.push(o)}return i}toBER(e,t){let n=[];for(let i=0;i<this.value.length;i++){let o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,jn;n.push(o)}return B0(n)}fromString(e){this.value=[];let t=0,n=0,i="";do{n=e.indexOf(".",t),n===-1?i=e.substring(t):i=e.substring(t,n),t=n+1;let o=new Ga;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(n!==-1);return!0}toString(){let e="",t=!1;for(let n=0;n<this.value.length;n++){t=this.value[n].isHexOnly;let i=this.value[n].toString();n!==0&&(e=`${e}.`),t&&(i=`{${i}}`),e+=i}return e}toJSON(){let e=be(ne({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}};s(Bc,"LocalRelativeObjectIdentifierValueBlock");Bc.NAME="RelativeObjectIdentifierValueBlock";var by,Ja=class extends Lt{constructor(e={}){super(e,Bc),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return be(ne({},super.toJSON()),{value:this.getValue()})}};s(Ja,"RelativeObjectIdentifier");by=Ja;Ae.RelativeObjectIdentifier=by;Ja.NAME="RelativeObjectIdentifier";var gy,Br=class extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}};s(Br,"Sequence");gy=Br;Ae.Sequence=gy;Br.NAME="SEQUENCE";var yy,Ir=class extends jt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};s(Ir,"Set");yy=Ir;Ae.Set=yy;Ir.NAME="SET";var Ic=class extends li(er){constructor(t={}){var e=Mt(t,[]);super(e),this.isHexOnly=!0,this.value=Kr}toJSON(){return be(ne({},super.toJSON()),{value:this.value})}};s(Ic,"LocalStringValueBlock");Ic.NAME="StringValueBlock";var Nc=class extends Ic{};s(Nc,"LocalSimpleStringValueBlock");Nc.NAME="SimpleStringValueBlock";var wr=class extends za{constructor(t={}){var e=Mt(t,[]);super(e,Nc)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t);for(let i=0;i<t;i++)n[i]=e.charCodeAt(i);this.valueBlock.value=e}};s(wr,"LocalSimpleStringBlock");wr.NAME="SIMPLE STRING";var Oc=class extends wr{fromBuffer(e){this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e);try{this.valueBlock.value=je.Convert.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=je.Convert.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf8String(e)),this.valueBlock.value=e}};s(Oc,"LocalUtf8StringValueBlock");Oc.NAME="Utf8StringValueBlock";var vy,rn=class extends Oc{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}};s(rn,"Utf8String");vy=rn;Ae.Utf8String=vy;rn.NAME="UTF8String";var Pc=class extends wr{fromBuffer(e){this.valueBlock.value=je.Convert.ToUtf16String(e),this.valueBlock.valueHexView=je.BufferSourceConverter.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(je.Convert.FromUtf16String(e))}};s(Pc,"LocalBmpStringValueBlock");Pc.NAME="BmpStringValueBlock";var wy,$o=class extends Pc{constructor(t={}){var e=Mt(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}};s($o,"BmpString");wy=$o;Ae.BmpString=wy;$o.NAME="BMPString";var Rc=class extends wr{fromBuffer(e){let t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),n=new Uint8Array(t);for(let i=0;i<n.length;i+=4)n[i]=n[i+3],n[i+1]=n[i+2],n[i+2]=0,n[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){let t=e.length,n=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let i=0;i<t;i++){let o=Uo(e.charCodeAt(i),8),a=new Uint8Array(o);if(a.length>4)continue;let f=4-a.length;for(let c=a.length-1;c>=0;c--)n[i*4+c+f]=a[c]}this.valueBlock.value=e}};s(Rc,"LocalUniversalStringValueBlock");Rc.NAME="UniversalStringValueBlock";var xy,Ho=class extends Rc{constructor(t={}){var e=Mt(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}};s(Ho,"UniversalString");xy=Ho;Ae.UniversalString=xy;Ho.NAME="UniversalString";var Ay,qo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}};s(qo,"NumericString");Ay=qo;Ae.NumericString=Ay;qo.NAME="NumericString";var _y,zo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}};s(zo,"PrintableString");_y=zo;Ae.PrintableString=_y;zo.NAME="PrintableString";var Ey,jo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}};s(jo,"TeletexString");Ey=jo;Ae.TeletexString=Ey;jo.NAME="TeletexString";var Sy,Vo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}};s(Vo,"VideotexString");Sy=Vo;Ae.VideotexString=Sy;Vo.NAME="VideotexString";var Cy,Wo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}};s(Wo,"IA5String");Cy=Wo;Ae.IA5String=Cy;Wo.NAME="IA5String";var Ty,Go=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}};s(Go,"GraphicString");Ty=Go;Ae.GraphicString=Ty;Go.NAME="GraphicString";var ky,zi=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}};s(zi,"VisibleString");ky=zi;Ae.VisibleString=ky;zi.NAME="VisibleString";var My,Jo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}};s(Jo,"GeneralString");My=Jo;Ae.GeneralString=My;Jo.NAME="GeneralString";var By,Yo=class extends wr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}};s(Yo,"CharacterString");By=Yo;Ae.CharacterString=By;Yo.NAME="CharacterString";var Iy,ji=class extends zi{constructor(i={}){var o=i,{value:e,valueDate:t}=o,n=Mt(o,["value","valueDate"]);if(super(n),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let a=0;a<e.length;a++)this.valueBlock.valueHexView[a]=e.charCodeAt(a)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,je.BufferSourceConverter.toUint8Array(e)))}toBuffer(){let e=this.toString(),t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<e.length;i++)n[i]=e.charCodeAt(i);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){let n=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(n===null){this.error="Wrong input string for conversion";return}let i=parseInt(n[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(n[2],10),this.day=parseInt(n[3],10),this.hour=parseInt(n[4],10),this.minute=parseInt(n[5],10),this.second=parseInt(n[6],10)}toString(e="iso"){if(e==="iso"){let t=new Array(7);return t[0]=Fr(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=Fr(this.month,2),t[2]=Fr(this.day,2),t[3]=Fr(this.hour,2),t[4]=Fr(this.minute,2),t[5]=Fr(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return be(ne({},super.toJSON()),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})}};s(ji,"UTCTime");Iy=ji;Ae.UTCTime=Iy;ji.NAME="UTCTime";var Ny,Xo=class extends ji{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(e){let t=!1,n="",i="",o=0,a,f=0,c=0;if(e[e.length-1]==="Z")n=e.substring(0,e.length-1),t=!0;else{let d=new Number(e[e.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(t){if(n.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(n.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,y=n.indexOf("+"),A="";if(y===-1&&(y=n.indexOf("-"),d=-1),y!==-1){if(A=n.substring(y+1),n=n.substring(0,y),A.length!==2&&A.length!==4)throw new Error("Wrong input string for conversion");let v=parseInt(A.substring(0,2),10);if(isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");if(f=d*v,A.length===4){if(v=parseInt(A.substring(2,4),10),isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");c=d*v}}}let l=n.indexOf(".");if(l===-1&&(l=n.indexOf(",")),l!==-1){let d=new Number(`0${n.substring(l)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");o=d.valueOf(),i=n.substring(0,l)}else i=n;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,l!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*o;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=60*o;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,l!==-1){let d=1e3*o;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}let h=a.exec(i);if(h===null)throw new Error("Wrong input string for conversion");for(let d=1;d<h.length;d++)switch(d){case 1:this.year=parseInt(h[d],10);break;case 2:this.month=parseInt(h[d],10);break;case 3:this.day=parseInt(h[d],10);break;case 4:this.hour=parseInt(h[d],10)+f;break;case 5:this.minute=parseInt(h[d],10)+c;break;case 6:this.second=parseInt(h[d],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){let d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){let t=[];return t.push(Fr(this.year,4)),t.push(Fr(this.month,2)),t.push(Fr(this.day,2)),t.push(Fr(this.hour,2)),t.push(Fr(this.minute,2)),t.push(Fr(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(Fr(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return be(ne({},super.toJSON()),{millisecond:this.millisecond})}};s(Xo,"GeneralizedTime");Ny=Xo;Ae.GeneralizedTime=Ny;Xo.NAME="GeneralizedTime";var Oy,Ya=class extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}};s(Ya,"DATE");Oy=Ya;Ae.DATE=Oy;Ya.NAME="DATE";var Py,Xa=class extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}};s(Xa,"TimeOfDay");Py=Xa;Ae.TimeOfDay=Py;Xa.NAME="TimeOfDay";var Ry,Za=class extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}};s(Za,"DateTime");Ry=Za;Ae.DateTime=Ry;Za.NAME="DateTime";var Uy,Qa=class extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}};s(Qa,"Duration");Uy=Qa;Ae.Duration=Uy;Qa.NAME="Duration";var Ly,ef=class extends rn{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}};s(ef,"TIME");Ly=ef;Ae.TIME=Ly;ef.NAME="TIME";var zn=class{constructor({name:e=Kr,optional:t=!1}={}){this.name=e,this.optional=t}};s(zn,"Any");var Hs=class extends zn{constructor(n={}){var i=n,{value:e=[]}=i,t=Mt(i,["value"]);super(t),this.value=e}};s(Hs,"Choice");var Zo=class extends zn{constructor(i={}){var o=i,{value:e=new zn,local:t=!1}=o,n=Mt(o,["value","local"]);super(n),this.value=e,this.local=t}};s(Zo,"Repeated");var Hl=class{constructor({data:e=zl}={}){this.dataView=je.BufferSourceConverter.toUint8Array(e)}get data(){return this.dataView.slice().buffer}set data(e){this.dataView=je.BufferSourceConverter.toUint8Array(e)}fromBER(e,t,n){let i=t+n;return this.dataView=je.BufferSourceConverter.toUint8Array(e).subarray(t,i),i}toBER(e){return this.dataView.slice().buffer}};s(Hl,"RawData");function Lo(r,e,t){if(t instanceof Hs){for(let o=0;o<t.value.length;o++)if(Lo(r,e,t.value[o]).verified)return{verified:!0,result:r};{let o={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(M0)&&(o.name=t.name),o}}if(t instanceof zn)return t.hasOwnProperty(M0)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(_E in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(TE in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(kE in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let n=t.idBlock.toBER(!1);if(n.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(n,0,n.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(EE)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(SE)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(CE)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(AE in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(ey in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};let o=t.idBlock.valueHexView,a=e.idBlock.valueHexView;if(o.length!==a.length)return{verified:!1,result:r};for(let f=0;f<o.length;f++)if(o[f]!==a[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&(r[t.name]=e)),t instanceof Ae.Constructed){let o=0,a={verified:!1,result:{error:"Unknown error"}},f=t.valueBlock.value.length;if(f>0&&t.valueBlock.value[0]instanceof Zo&&(f=e.valueBlock.value.length),f===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let c=!0;for(let l=0;l<t.valueBlock.value.length;l++)c=c&&(t.valueBlock.value[l].optional||!1);return c?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let c=0;c<f;c++)if(c-o>=e.valueBlock.value.length){if(t.valueBlock.value[c].optional===!1){let l={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&(delete r[t.name],l.name=t.name)),l}}else if(t.valueBlock.value[0]instanceof Zo){if(a=Lo(r,e.valueBlock.value[c],t.valueBlock.value[0].value),a.verified===!1)if(t.valueBlock.value[0].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&delete r[t.name]),a;if(M0 in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let l={};ME in t.valueBlock.value[0]&&t.valueBlock.value[0].local?l=e:l=r,typeof l[t.valueBlock.value[0].name]=="undefined"&&(l[t.valueBlock.value[0].name]=[]),l[t.valueBlock.value[0].name].push(e.valueBlock.value[c])}}else if(a=Lo(r,e.valueBlock.value[c-o],t.valueBlock.value[c]),a.verified===!1)if(t.valueBlock.value[c].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&delete r[t.name]),a;if(a.verified===!1){let c={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&(delete r[t.name],c.name=t.name)),c}return{verified:!0,result:r}}if(t.primitiveSchema&&ey in e.valueBlock){let o=tf(e.valueBlock.valueHexView);if(o.offset===-1){let a={verified:!1,result:o.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,Kr),t.name&&(delete r[t.name],a.name=t.name)),a}return Lo(r,o.result,t.primitiveSchema)}return{verified:!0,result:r}}s(Lo,"compareSchema");function PE(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};let t=tf(je.BufferSourceConverter.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:Lo(t.result,t.result,e)}s(PE,"verifySchema");var Dt;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(Dt||(Dt={}));var Se;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(Se||(Se={}));var RE={fromASN:r=>r instanceof yn?null:r.valueBeforeDecode,toASN:r=>{if(r===null)return new yn;let e=Wi(r);if(e.result.error)throw new Error(e.result.error);return e.result}},jl={fromASN:r=>r.valueBlock.valueHex.byteLength>4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new ur({value:r})},UE={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new Fo({value:r})};var LE={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new qi({valueHex:r})},DE={fromASN:r=>r.valueBlock.toString(),toASN:r=>new Ko({value:r})},FE={fromASN:r=>r.valueBlock.value,toASN:r=>new Do({value:r})},KE={fromASN:r=>r.valueBlock.valueHex,toASN:r=>new qn({valueHex:r})};function vn(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}s(vn,"createStringConverter");var $E=vn(rn),HE=vn($o),qE=vn(Ho),zE=vn(qo),jE=vn(zo),VE=vn(jo),WE=vn(Vo),GE=vn(Wo),JE=vn(Go),YE=vn(zi),XE=vn(Jo),ZE=vn(Yo),QE={fromASN:r=>r.toDate(),toASN:r=>new ji({valueDate:r})},eS={fromASN:r=>r.toDate(),toASN:r=>new Xo({valueDate:r})},tS={fromASN:r=>null,toASN:r=>new yn};function rf(r){switch(r){case Se.Any:return RE;case Se.BitString:return LE;case Se.BmpString:return HE;case Se.Boolean:return FE;case Se.CharacterString:return ZE;case Se.Enumerated:return UE;case Se.GeneralString:return XE;case Se.GeneralizedTime:return eS;case Se.GraphicString:return JE;case Se.IA5String:return GE;case Se.Integer:return jl;case Se.Null:return tS;case Se.NumericString:return zE;case Se.ObjectIdentifier:return DE;case Se.OctetString:return KE;case Se.PrintableString:return jE;case Se.TeletexString:return VE;case Se.UTCTime:return QE;case Se.UniversalString:return qE;case Se.Utf8String:return $E;case Se.VideotexString:return WE;case Se.VisibleString:return YE;default:return null}}s(rf,"defaultConverter");var rS=ze(Ro());var nS=ze(Ro());function wn(r){return r&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:wn(r.prototype):!!(r&&r.toASN&&r.fromASN)}s(wn,"isConvertible");function N0(r){var e;if(r){let t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:N0(t)}return!1}s(N0,"isTypeOfArray");function Dy(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<r.byteLength;i++)if(t[i]!==n[i])return!1;return!0}s(Dy,"isArrayEqual");var Lc=class{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e){var t,n,i;let o=this.items.get(e);if(!o)throw new Error(`Cannot get schema for '${(i=(n=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)!==null&&i!==void 0?i:e}' target`);return o}cache(e){let t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){let t={type:Dt.Sequence,items:{}},n=this.findParentSchema(e);return n&&(Object.assign(t,n),t.items=Object.assign({},t.items,n.items)),t}create(e,t){let n=this.items.get(e)||this.createDefault(e),i=[];for(let o in n.items){let a=n.items[o],f=t?o:"",c;if(typeof a.type=="number"){let h=Se[a.type],d=Gi[h];if(!d)throw new Error(`Cannot get ASN1 class by name '${h}'`);c=new d({name:f})}else wn(a.type)?c=new a.type().toSchema(f):a.optional?this.get(a.type).type===Dt.Choice?c=new zn({name:f}):(c=this.create(a.type,!1),c.name=f):c=new zn({name:f});let l=!!a.optional||a.defaultValue!==void 0;if(a.repeated){c.name="";let h=a.repeated==="set"?Ir:Br;c=new h({name:"",value:[new Zo({name:f,value:c})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||wn(a.type)){let h=a.repeated?jt:ui;i.push(new h({name:f,optional:l,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);let h=!!a.repeated,d=h?c:this.get(a.type).schema;d=d.valueBlock?d.valueBlock.value:d.value,i.push(new jt({name:h?"":f,optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:d}))}else i.push(new jt({optional:l,idBlock:{tagClass:3,tagNumber:a.context},value:[c]}));else c.optional=l,i.push(c)}switch(n.type){case Dt.Sequence:return new Br({value:i,name:""});case Dt.Set:return new Ir({value:i,name:""});case Dt.Choice:return new Hs({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};s(Lc,"AsnSchemaStorage");var Nr=new Lc;var qs=s(r=>e=>{let t;Nr.has(e)?t=Nr.get(e):(t=Nr.createDefault(e),Nr.set(e,t)),Object.assign(t,r)},"AsnType"),Ge=s(r=>(e,t)=>{let n;Nr.has(e.constructor)?n=Nr.get(e.constructor):(n=Nr.createDefault(e.constructor),Nr.set(e.constructor,n));let i=Object.assign({},r);if(typeof i.type=="number"&&!i.converter){let o=rf(r.type);if(!o)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);i.converter=o}n.items[t]=i},"AsnProp");var nf=class extends Error{constructor(){super(...arguments),this.schemas=[]}};s(nf,"AsnSchemaValidationError");var Je=class{static parse(e,t){let n;if(e instanceof ArrayBuffer)n=e;else if(typeof Buffer!="undefined"&&Buffer.isBuffer(e))n=new Uint8Array(e).buffer;else if(ArrayBuffer.isView(e)||e.buffer instanceof ArrayBuffer)n=e.buffer;else throw new TypeError("Wrong type of 'data' argument");let i=Wi(n);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){var n;try{if(wn(t))return new t().fromASN(e);let i=Nr.get(t);Nr.cache(t);let o=i.schema;if(e.constructor===jt&&i.type!==Dt.Choice){o=new jt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:i.schema.valueBlock.value});for(let c in i.items)delete e[c]}let a=Lo(e,e,o);if(!a.verified)throw new nf(`Data does not match to ${t.name} ASN1 schema. ${a.result.error}`);let f=new t;if(N0(t))if(typeof i.itemType=="number"){let c=rf(i.itemType);if(!c)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);return t.from(e.valueBlock.value,l=>c.fromASN(l))}else return t.from(e.valueBlock.value,c=>this.fromASN(c,i.itemType));for(let c in i.items){if(!e[c])continue;let l=i.items[c];if(typeof l.type=="number"||wn(l.type)){let h=(n=l.converter)!==null&&n!==void 0?n:wn(l.type)?new l.type:null;if(!h)throw new Error("Converter is empty");if(l.repeated)if(l.implicit){let d=l.repeated==="sequence"?Br:Ir,y=new d;y.valueBlock=e[c].valueBlock;let A=Wi(y.toBER(!1)).result.valueBlock.value;f[c]=Array.from(A,v=>h.fromASN(v))}else f[c]=Array.from(e[c],d=>h.fromASN(d));else{let d=e[c];if(l.implicit){let y;if(wn(l.type))y=new l.type().toSchema("");else{let A=Se[l.type],v=Gi[A];if(!v)throw new Error(`Cannot get '${A}' class from asn1js module`);y=new v}y.valueBlock=d.valueBlock,d=Wi(y.toBER(!1)).result}f[c]=h.fromASN(d)}}else l.repeated?f[c]=Array.from(e[c],h=>this.fromASN(h,l.type)):f[c]=this.fromASN(e[c],l.type)}return f}catch(i){throw i instanceof nf&&i.schemas.push(t.name),i}}};s(Je,"AsnParser");var Ye=class{static serialize(e){return e instanceof Lt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&wn(e.constructor))return e.toASN();let t=e.constructor,n=Nr.get(t);Nr.cache(t);let i=[];if(n.itemType)if(typeof n.itemType=="number"){let a=rf(n.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(f=>a.toASN(f))}else i=e.map(a=>this.toAsnItem({type:n.itemType},"[]",t,a));else for(let a in n.items){let f=n.items[a],c=e[a];if(c===void 0||f.defaultValue===c||typeof f.defaultValue=="object"&&typeof c=="object"&&Dy(this.serialize(f.defaultValue),this.serialize(c)))continue;let l=Ye.toAsnItem(f,a,t,c);if(typeof f.context=="number")if(f.implicit)if(!f.repeated&&(typeof f.type=="number"||wn(f.type))){let h={};h.valueHex=l instanceof yn?l.valueBeforeDecode:l.valueBlock.toBER(),i.push(new ui(ne({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context}},h)))}else i.push(new jt({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:l.valueBlock.value}));else i.push(new jt({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:[l]}));else f.repeated?i=i.concat(l):i.push(l)}let o;switch(n.type){case Dt.Sequence:o=new Br({value:i});break;case Dt.Set:o=new Ir({value:i});break;case Dt.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,t,n,i){let o;if(typeof e.type=="number"){let a=e.converter;if(!a)throw new Error(`Property '${t}' doesn't have converter for type ${Se[e.type]} in schema '${n.name}'`);if(e.repeated){let f=Array.from(i,l=>a.toASN(l)),c=e.repeated==="sequence"?Br:Ir;o=new c({value:f})}else o=a.toASN(i)}else if(e.repeated){let a=Array.from(i,c=>this.toASN(c)),f=e.repeated==="sequence"?Br:Ir;o=new f({value:a})}else o=this.toASN(i);return o}};s(Ye,"AsnSerializer");var O0=ze(Ro());var zs=class{static serialize(e){return Ye.serialize(e)}static parse(e,t){return Je.parse(e,t)}static toString(e){let t=O0.BufferSourceConverter.isBufferSource(e)?O0.BufferSourceConverter.toArrayBuffer(e):zs.serialize(e),n=Wi(t);if(n.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${n.result.error}`);return n.result.toString()}};s(zs,"AsnConvert");var av=ze(sv(),1),{__extends:xr,__assign:rL,__rest:nL,__decorate:Re,__param:iL,__metadata:oL,__awaiter:fv,__generator:Jl,__exportStar:sL,__createBinding:aL,__values:js,__read:nn,__spread:fL,__spreadArrays:cL,__spreadArray:Vn,__await:Yl,__asyncGenerator:cv,__asyncDelegator:uL,__asyncValues:uv,__makeTemplateObject:lL,__importStar:hL,__importDefault:dL,__classPrivateFieldGet:pL,__classPrivateFieldSet:mL,__classPrivateFieldIn:bL}=av.default;var Vs=class extends Error{constructor(e,t){super(t?`${e}. See the inner exception for more details.`:e),this.message=e,this.innerError=t}};s(Vs,"JsonError");var Xl=class extends Vs{constructor(e,t,n){super(t,n),this.schema=e}};s(Xl,"TransformError");var Ws=class extends Xl{constructor(e,t,n){super(e,`JSON doesn't match to '${e.target.name}' schema. ${t}`,n)}};s(Ws,"ParserError");var Gn=class extends Vs{};s(Gn,"ValidationError");var sf=class extends Vs{constructor(e,t,n){super(`Cannot serialize by '${e}' schema. ${t}`,n),this.schemaName=e}};s(sf,"SerializerError");var Dc=class extends Ws{constructor(e,t,n={}){super(e,"Some keys doesn't match to schema"),this.keys=t,this.errors=n}};s(Dc,"KeyError");var Ft;(function(r){r[r.Any=0]="Any",r[r.Boolean=1]="Boolean",r[r.Number=2]="Number",r[r.String=3]="String"})(Ft||(Ft={}));function iS(r,e){switch(e){case Ft.Boolean:return typeof r=="boolean";case Ft.Number:return typeof r=="number";case Ft.String:return typeof r=="string"}return!0}s(iS,"checkType");function nh(r,e){if(!iS(r,e))throw new TypeError(`Value must be ${Ft[e]}`)}s(nh,"throwIfTypeIsWrong");function ih(r){return r&&r.prototype?r.prototype.toJSON&&r.prototype.fromJSON?!0:ih(r.prototype):!!(r&&r.toJSON&&r.fromJSON)}s(ih,"isConvertible");var Zl=class{constructor(){this.items=new Map}has(e){return this.items.has(e)||!!this.findParentSchema(e)}get(e){let t=this.items.get(e)||this.findParentSchema(e);if(!t)throw new Error("Cannot get schema for current target");return t}create(e){let t={names:{}},n=this.findParentSchema(e);if(n){Object.assign(t,n),t.names={};for(let i in n.names)t.names[i]=Object.assign({},n.names[i])}return t.target=e,t}set(e,t){return this.items.set(e,t),this}findParentSchema(e){let t=e.__proto__;return t?this.items.get(t)||this.findParentSchema(t):null}};s(Zl,"JsonSchemaStorage");var $c="default",Wn=new Zl,Ql=class{constructor(e){this.pattern=new RegExp(e)}validate(e){let t=new RegExp(this.pattern.source,this.pattern.flags);if(typeof e!="string")throw new Gn("Incoming value must be string");if(!t.exec(e))throw new Gn(`Value doesn't match to pattern '${t.toString()}'`)}};s(Ql,"PatternValidation");var eh=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(nh(e,Ft.Number),!(this.min<=e&&e<=this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new Gn(`Value doesn't match to diapason [${t},${n}]`)}}};s(eh,"InclusiveValidation");var th=class{constructor(e=Number.MIN_VALUE,t=Number.MAX_VALUE){this.min=e,this.max=t}validate(e){if(nh(e,Ft.Number),!(this.min<e&&e<this.max)){let t=this.min===Number.MIN_VALUE?"MIN":this.min,n=this.max===Number.MAX_VALUE?"MAX":this.max;throw new Gn(`Value doesn't match to diapason (${t},${n})`)}}};s(th,"ExclusiveValidation");var Fc=class{constructor(e,t,n){this.length=e,this.minLength=t,this.maxLength=n}validate(e){if(this.length!==void 0){if(e.length!==this.length)throw new Gn(`Value length must be exactly ${this.length}.`);return}if(this.minLength!==void 0&&e.length<this.minLength)throw new Gn(`Value length must be more than ${this.minLength}.`);if(this.maxLength!==void 0&&e.length>this.maxLength)throw new Gn(`Value length must be less than ${this.maxLength}.`)}};s(Fc,"LengthValidation");var rh=class{constructor(e){this.enumeration=e}validate(e){if(nh(e,Ft.String),!this.enumeration.includes(e))throw new Gn(`Value must be one of ${this.enumeration.map(t=>`'${t}'`).join(", ")}`)}};s(rh,"EnumerationValidation");var Kc=class{static checkValues(e,t){let n=Array.isArray(e)?e:[e];for(let i of n)for(let o of t.validations)o instanceof Fc&&t.repeated?o.validate(e):o.validate(i)}static checkTypes(e,t){if(t.repeated&&!Array.isArray(e))throw new TypeError("Value must be Array");if(typeof t.type=="number"){let n=Array.isArray(e)?e:[e];for(let i of n)nh(i,t.type)}}static getSchemaByName(e,t=$c){return ne(ne({},e.names[$c]),e.names[t])}};s(Kc,"JsonTransform");var Or=class extends Kc{static serialize(e,t,n,i){let o=this.toJSON(e,t);return JSON.stringify(o,n,i)}static toJSON(e,t={}){let n,i=t.targetSchema,o=t.schemaName||$c;if(ih(e))return e.toJSON();if(Array.isArray(e)){n=[];for(let a of e)n.push(this.toJSON(a,t))}else if(typeof e=="object"){if(i&&!Wn.has(i))throw new Vs("Cannot get schema for `targetSchema` param");if(i=i||e.constructor,Wn.has(i)){let a=Wn.get(i);n={};let f=this.getSchemaByName(a,o);for(let c in f)try{let l=f[c],h=e[c],d;if(l.optional&&h===void 0||l.defaultValue!==void 0&&h===l.defaultValue)continue;if(!l.optional&&h===void 0)throw new sf(i.name,`Property '${c}' is required.`);typeof l.type=="number"?l.converter?l.repeated?d=h.map(y=>l.converter.toJSON(y,e)):d=l.converter.toJSON(h,e):d=h:l.repeated?d=h.map(y=>this.toJSON(y,{schemaName:o})):d=this.toJSON(h,{schemaName:o}),this.checkTypes(d,l),this.checkValues(d,l),n[l.name||c]=d}catch(l){throw l instanceof sf?l:new sf(a.target.name,`Property '${c}' is wrong. ${l.message}`,l)}}else{n={};for(let a in e)n[a]=this.toJSON(e[a],{schemaName:o})}}else n=e;return n}};s(Or,"JsonSerializer");var Jt=class extends Kc{static parse(e,t){let n=JSON.parse(e);return this.fromJSON(n,t)}static fromJSON(e,t){let n=t.targetSchema,i=t.schemaName||$c,o=new n;if(ih(o))return o.fromJSON(e);let a=Wn.get(n),f=this.getSchemaByName(a,i),c={};t.strictProperty&&!Array.isArray(e)&&Jt.checkStrictProperty(e,f,a);for(let h in f)try{let d=f[h],y=d.name||h,A=e[y];if(A===void 0&&(d.optional||d.defaultValue!==void 0))continue;if(!d.optional&&A===void 0)throw new Ws(a,`Property '${y}' is required.`);if(this.checkTypes(A,d),this.checkValues(A,d),typeof d.type=="number")d.converter?d.repeated?o[h]=A.map(v=>d.converter.fromJSON(v,o)):o[h]=d.converter.fromJSON(A,o):o[h]=A;else{let v=be(ne({},t),{targetSchema:d.type,schemaName:i});d.repeated?o[h]=A.map(x=>this.fromJSON(x,v)):o[h]=this.fromJSON(A,v)}}catch(d){if(d instanceof Ws||(d=new Ws(a,`Property '${h}' is wrong. ${d.message}`,d)),t.strictAllKeys)c[h]=d;else throw d}let l=Object.keys(c);if(l.length)throw new Dc(a,l,c);return o}static checkStrictProperty(e,t,n){let i=Object.keys(e),o=Object.keys(t),a=[];for(let f of i)o.indexOf(f)===-1&&a.push(f);if(a.length)throw new Dc(n,a)}};s(Jt,"JsonParser");function oS(r){let e=[];return r.pattern&&e.push(new Ql(r.pattern)),(r.type===Ft.Number||r.type===Ft.Any)&&((r.minInclusive!==void 0||r.maxInclusive!==void 0)&&e.push(new eh(r.minInclusive,r.maxInclusive)),(r.minExclusive!==void 0||r.maxExclusive!==void 0)&&e.push(new th(r.minExclusive,r.maxExclusive)),r.enumeration!==void 0&&e.push(new rh(r.enumeration))),(r.type===Ft.String||r.repeated||r.type===Ft.Any)&&(r.length!==void 0||r.minLength!==void 0||r.maxLength!==void 0)&&e.push(new Fc(r.length,r.minLength,r.maxLength)),e}s(oS,"getValidations");var Vt=s((r={})=>(e,t)=>{let n=`Cannot set type for ${t} property of ${e.constructor.name} schema`,i;Wn.has(e.constructor)?(i=Wn.get(e.constructor),i.target!==e.constructor&&(i=Wn.create(e.constructor),Wn.set(e.constructor,i))):(i=Wn.create(e.constructor),Wn.set(e.constructor,i));let o={type:Ft.Any,validations:[]},a=Object.assign(o,r);if(a.validations=oS(a),typeof a.type!="number"&&!Wn.has(a.type)&&!ih(a.type))throw new Error(`${n}. Assigning type doesn't have schema.`);let f;Array.isArray(r.schema)?f=r.schema:f=[r.schema||$c];for(let c of f){i.names[c]||(i.names[c]={});let l=i.names[c];l[t]=a}},"JsonProp");var $r=class extends Error{};s($r,"CryptoError");var Qo=class extends $r{};s(Qo,"AlgorithmError");var xn=class extends $r{constructor(e){super(`Unsupported operation: ${e?`${e}`:""}`)}};s(xn,"UnsupportedOperationError");var Oe=class extends $r{};s(Oe,"OperationError");var oh=class extends $r{constructor(e){super(`${e}: Missing required property`)}};s(oh,"RequiredPropertyError");function sS(r){return typeof r=="object"&&"kty"in r}s(sS,"isJWK");var Wt=class{digest(...e){return M(this,null,function*(){return this.checkDigest.apply(this,e),this.onDigest.apply(this,e)})}checkDigest(e,t){this.checkAlgorithmName(e)}onDigest(e,t){return M(this,null,function*(){throw new xn("digest")})}generateKey(...e){return M(this,null,function*(){return this.checkGenerateKey.apply(this,e),this.onGenerateKey.apply(this,e)})}checkGenerateKey(e,t,n,...i){if(this.checkAlgorithmName(e),this.checkGenerateKeyParams(e),!(n&&n.length))throw new TypeError("Usages cannot be empty when creating a key.");let o;Array.isArray(this.usages)?o=this.usages:o=this.usages.privateKey.concat(this.usages.publicKey),this.checkKeyUsages(n,o)}checkGenerateKeyParams(e){}onGenerateKey(e,t,n,...i){return M(this,null,function*(){throw new xn("generateKey")})}sign(...e){return M(this,null,function*(){return this.checkSign.apply(this,e),this.onSign.apply(this,e)})}checkSign(e,t,n,...i){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"sign")}onSign(e,t,n,...i){return M(this,null,function*(){throw new xn("sign")})}verify(...e){return M(this,null,function*(){return this.checkVerify.apply(this,e),this.onVerify.apply(this,e)})}checkVerify(e,t,n,i,...o){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,"verify")}onVerify(e,t,n,i,...o){return M(this,null,function*(){throw new xn("verify")})}encrypt(...e){return M(this,null,function*(){return this.checkEncrypt.apply(this,e),this.onEncrypt.apply(this,e)})}checkEncrypt(e,t,n,i={},...o){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"encrypt":void 0)}onEncrypt(e,t,n,...i){return M(this,null,function*(){throw new xn("encrypt")})}decrypt(...e){return M(this,null,function*(){return this.checkDecrypt.apply(this,e),this.onDecrypt.apply(this,e)})}checkDecrypt(e,t,n,i={},...o){this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"decrypt":void 0)}onDecrypt(e,t,n,...i){return M(this,null,function*(){throw new xn("decrypt")})}deriveBits(...e){return M(this,null,function*(){return this.checkDeriveBits.apply(this,e),this.onDeriveBits.apply(this,e)})}checkDeriveBits(e,t,n,i={},...o){if(this.checkAlgorithmName(e),this.checkAlgorithmParams(e),this.checkCryptoKey(t,i.keyUsage?"deriveBits":void 0),n%8!==0)throw new Oe("length: Is not multiple of 8")}onDeriveBits(e,t,n,...i){return M(this,null,function*(){throw new xn("deriveBits")})}exportKey(...e){return M(this,null,function*(){return this.checkExportKey.apply(this,e),this.onExportKey.apply(this,e)})}checkExportKey(e,t,...n){if(this.checkKeyFormat(e),this.checkCryptoKey(t),!t.extractable)throw new $r("key: Is not extractable")}onExportKey(e,t,...n){return M(this,null,function*(){throw new xn("exportKey")})}importKey(...e){return M(this,null,function*(){return this.checkImportKey.apply(this,e),this.onImportKey.apply(this,e)})}checkImportKey(e,t,n,i,o,...a){this.checkKeyFormat(e),this.checkKeyData(e,t),this.checkAlgorithmName(n),this.checkImportParams(n),Array.isArray(this.usages)&&this.checkKeyUsages(o,this.usages)}onImportKey(e,t,n,i,o,...a){return M(this,null,function*(){throw new xn("importKey")})}checkAlgorithmName(e){if(e.name.toLowerCase()!==this.name.toLowerCase())throw new Qo("Unrecognized name")}checkAlgorithmParams(e){}checkDerivedKeyParams(e){}checkKeyUsages(e,t){for(let n of e)if(t.indexOf(n)===-1)throw new TypeError("Cannot create a key using the specified key usages")}checkCryptoKey(e,t){if(this.checkAlgorithmName(e.algorithm),t&&e.usages.indexOf(t)===-1)throw new $r("key does not match that of operation")}checkRequiredProperty(e,t){if(!(t in e))throw new oh(t)}checkHashAlgorithm(e,t){for(let n of t)if(n.toLowerCase()===e.name.toLowerCase())return;throw new Oe(`hash: Must be one of ${t.join(", ")}`)}checkImportParams(e){}checkKeyFormat(e){switch(e){case"raw":case"pkcs8":case"spki":case"jwk":break;default:throw new TypeError("format: Is invalid value. Must be 'jwk', 'raw', 'spki', or 'pkcs8'")}}checkKeyData(e,t){if(!t)throw new TypeError("keyData: Cannot be empty on empty on key importing");if(e==="jwk"){if(!sS(t))throw new TypeError("keyData: Is not JsonWebToken")}else if(!Ke.BufferSourceConverter.isBufferSource(t))throw new TypeError("keyData: Is not ArrayBufferView or ArrayBuffer")}prepareData(e){return Ke.BufferSourceConverter.toArrayBuffer(e)}};s(Wt,"ProviderCrypto");var Ji=class extends Wt{checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");switch(e.length){case 128:case 192:case 256:break;default:throw new TypeError("length: Must be 128, 192, or 256")}}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};s(Ji,"AesProvider");var Hc=class extends Ji{constructor(){super(...arguments),this.name="AES-CBC",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes")}};s(Hc,"AesCbcProvider");var qc=class extends Ji{constructor(){super(...arguments),this.name="AES-CMAC",this.usages=["sign","verify"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};s(qc,"AesCmacProvider");var zc=class extends Ji{constructor(){super(...arguments),this.name="AES-CTR",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"counter"),!(e.counter instanceof ArrayBuffer||ArrayBuffer.isView(e.counter)))throw new TypeError("counter: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.counter.byteLength!==16)throw new TypeError("iv: Must have length 16 bytes");if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new Oe("length: Must be more than 0")}};s(zc,"AesCtrProvider");var jc=class extends Ji{constructor(){super(...arguments),this.name="AES-ECB",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}};s(jc,"AesEcbProvider");var Vc=class extends Ji{constructor(){super(...arguments),this.name="AES-GCM",this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength<1)throw new Oe("iv: Must have length more than 0 and less than 2^64 - 1");switch("tagLength"in e||(e.tagLength=128),e.tagLength){case 32:case 64:case 96:case 104:case 112:case 120:case 128:break;default:throw new Oe("tagLength: Must be one of 32, 64, 96, 104, 112, 120 or 128")}}};s(Vc,"AesGcmProvider");var Wc=class extends Ji{constructor(){super(...arguments),this.name="AES-KW",this.usages=["wrapKey","unwrapKey"]}};s(Wc,"AesKwProvider");var af=class extends Wt{constructor(){super(...arguments),this.usages=["encrypt","decrypt","wrapKey","unwrapKey"]}checkAlgorithmParams(e){if(this.ivSize){if(this.checkRequiredProperty(e,"iv"),!(e.iv instanceof ArrayBuffer||ArrayBuffer.isView(e.iv)))throw new TypeError("iv: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(e.iv.byteLength!==this.ivSize)throw new TypeError(`iv: Must have length ${this.ivSize} bytes`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"length"),typeof e.length!="number")throw new TypeError("length: Is not of type Number");if(e.length!==this.keySizeBits)throw new Oe(`algorithm.length: Must be ${this.keySizeBits}`)}checkDerivedKeyParams(e){this.checkGenerateKeyParams(e)}};s(af,"DesProvider");var ff=class extends Wt{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"]}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"publicExponent"),!(e.publicExponent&&e.publicExponent instanceof Uint8Array))throw new TypeError("publicExponent: Missing or not a Uint8Array");let t=Ke.Convert.ToBase64(e.publicExponent);if(!(t==="Aw=="||t==="AQAB"))throw new TypeError("publicExponent: Must be [3] or [1,0,1]");if(this.checkRequiredProperty(e,"modulusLength"),e.modulusLength%8||e.modulusLength<256||e.modulusLength>16384)throw new TypeError("The modulus length must be a multiple of 8 bits and >= 256 and <= 16384")}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};s(ff,"RsaProvider");var Gc=class extends ff{constructor(){super(...arguments),this.name="RSASSA-PKCS1-v1_5",this.usages={privateKey:["sign"],publicKey:["verify"]}}};s(Gc,"RsaSsaProvider");var Jc=class extends ff{constructor(){super(...arguments),this.name="RSA-PSS",this.usages={privateKey:["sign"],publicKey:["verify"]}}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"saltLength"),typeof e.saltLength!="number")throw new TypeError("saltLength: Is not a Number");if(e.saltLength<0)throw new RangeError("saltLength: Must be positive number")}};s(Jc,"RsaPssProvider");var Yc=class extends ff{constructor(){super(...arguments),this.name="RSA-OAEP",this.usages={privateKey:["decrypt","unwrapKey"],publicKey:["encrypt","wrapKey"]}}checkAlgorithmParams(e){if(e.label&&!(e.label instanceof ArrayBuffer||ArrayBuffer.isView(e.label)))throw new TypeError("label: Is not of type '(ArrayBuffer or ArrayBufferView)'")}};s(Yc,"RsaOaepProvider");var cf=class extends Wt{checkGenerateKeyParams(e){this.checkRequiredProperty(e,"namedCurve"),this.checkNamedCurve(e.namedCurve)}checkNamedCurve(e){for(let t of this.namedCurves)if(t.toLowerCase()===e.toLowerCase())return;throw new Oe(`namedCurve: Must be one of ${this.namedCurves.join(", ")}`)}};s(cf,"EllipticProvider");var Xc=class extends cf{constructor(){super(...arguments),this.name="ECDSA",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};s(Xc,"EcdsaProvider");var aS=["secret","private","public"],Yi=class{static create(e,t,n,i){let o=new this;return o.algorithm=e,o.type=t,o.extractable=n,o.usages=i,o}static isKeyType(e){return aS.indexOf(e)!==-1}get[Symbol.toStringTag](){return"CryptoKey"}};s(Yi,"CryptoKey");var uf=class extends cf{constructor(){super(...arguments),this.name="ECDH",this.usages={privateKey:["deriveBits","deriveKey"],publicKey:[]},this.namedCurves=["P-256","P-384","P-521","K-256"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"public"),!(e.public instanceof Yi))throw new TypeError("public: Is not a CryptoKey");if(e.public.type!=="public")throw new Oe("public: Is not a public key");if(e.public.algorithm.name!==this.name)throw new Oe(`public: Is not ${this.name} key`)}};s(uf,"EcdhProvider");var Zc=class extends uf{constructor(){super(...arguments),this.name="ECDH-ES",this.namedCurves=["X25519","X448"]}};s(Zc,"EcdhEsProvider");var Qc=class extends cf{constructor(){super(...arguments),this.name="EdDSA",this.usages={privateKey:["sign"],publicKey:["verify"]},this.namedCurves=["Ed25519","Ed448"]}};s(Qc,"EdDsaProvider");var fu=s(class{constructor(e){e&&(this.value=e)}},"ObjectIdentifier");Re([Ge({type:Se.ObjectIdentifier})],fu.prototype,"value",void 0);fu=Re([qs({type:Dt.Choice})],fu);var hi=class{constructor(e){Object.assign(this,e)}};s(hi,"AlgorithmIdentifier");Re([Ge({type:Se.ObjectIdentifier})],hi.prototype,"algorithm",void 0);Re([Ge({type:Se.Any,optional:!0})],hi.prototype,"parameters",void 0);var Xi=class{constructor(){this.version=0,this.privateKeyAlgorithm=new hi,this.privateKey=new ArrayBuffer(0)}};s(Xi,"PrivateKeyInfo");Re([Ge({type:Se.Integer})],Xi.prototype,"version",void 0);Re([Ge({type:hi})],Xi.prototype,"privateKeyAlgorithm",void 0);Re([Ge({type:Se.OctetString})],Xi.prototype,"privateKey",void 0);Re([Ge({type:Se.Any,optional:!0})],Xi.prototype,"attributes",void 0);var lf=class{constructor(){this.publicKeyAlgorithm=new hi,this.publicKey=new ArrayBuffer(0)}};s(lf,"PublicKeyInfo");Re([Ge({type:hi})],lf.prototype,"publicKeyAlgorithm",void 0);Re([Ge({type:Se.BitString})],lf.prototype,"publicKey",void 0);var Jn={fromJSON:r=>Ke.Convert.FromBase64Url(r),toJSON:r=>Ke.Convert.ToBase64Url(new Uint8Array(r))},di={fromASN:r=>{let e=r.valueBlock.valueHex;return new Uint8Array(e)[0]?r.valueBlock.valueHex:r.valueBlock.valueHex.slice(1)},toASN:r=>{let e=new Uint8Array(r)[0]>127?(0,Ke.combine)(new Uint8Array([0]).buffer,r):r;return new ur({valueHex:e})}};var Hr=class{constructor(){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0)}};s(Hr,"RsaPrivateKey");Re([Ge({type:Se.Integer,converter:jl})],Hr.prototype,"version",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"n",converter:Jn})],Hr.prototype,"modulus",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"e",converter:Jn})],Hr.prototype,"publicExponent",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"d",converter:Jn})],Hr.prototype,"privateExponent",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"p",converter:Jn})],Hr.prototype,"prime1",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"q",converter:Jn})],Hr.prototype,"prime2",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"dp",converter:Jn})],Hr.prototype,"exponent1",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"dq",converter:Jn})],Hr.prototype,"exponent2",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"qi",converter:Jn})],Hr.prototype,"coefficient",void 0);Re([Ge({type:Se.Any,optional:!0})],Hr.prototype,"otherPrimeInfos",void 0);var hf=class{constructor(){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0)}};s(hf,"RsaPublicKey");Re([Ge({type:Se.Integer,converter:di}),Vt({name:"n",converter:Jn})],hf.prototype,"modulus",void 0);Re([Ge({type:Se.Integer,converter:di}),Vt({name:"e",converter:Jn})],hf.prototype,"publicExponent",void 0);var df=s(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){let e=new Uint8Array(this.value);if(e[0]!==4)throw new $r("Wrong ECPoint. Current version supports only Uncompressed (0x04) point");e=new Uint8Array(this.value.slice(1));let t=e.length/2,n=0;return{x:Ke.Convert.ToBase64Url(e.buffer.slice(n,n+t)),y:Ke.Convert.ToBase64Url(e.buffer.slice(n+t,n+t+t))}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");if(!("y"in e))throw new Error("y: Missing required property");let t=Ke.Convert.FromBase64Url(e.x),n=Ke.Convert.FromBase64Url(e.y),i=(0,Ke.combine)(new Uint8Array([4]).buffer,t,n);return this.value=new Uint8Array(i).buffer,this}},"EcPublicKey");Re([Ge({type:Se.OctetString})],df.prototype,"value",void 0);df=Re([qs({type:Dt.Choice})],df);var es=class{constructor(){this.version=1,this.privateKey=new ArrayBuffer(0)}fromJSON(e){if(!("d"in e))throw new Error("d: Missing required property");if(this.privateKey=Ke.Convert.FromBase64Url(e.d),"x"in e){let t=new df;t.fromJSON(e),this.publicKey=Ye.toASN(t).valueBlock.valueHex}return this}toJSON(){let e={};return e.d=Ke.Convert.ToBase64Url(this.privateKey),this.publicKey&&Object.assign(e,new df(this.publicKey).toJSON()),e}};s(es,"EcPrivateKey");Re([Ge({type:Se.Integer,converter:jl})],es.prototype,"version",void 0);Re([Ge({type:Se.OctetString})],es.prototype,"privateKey",void 0);Re([Ge({context:0,type:Se.Any,optional:!0})],es.prototype,"parameters",void 0);Re([Ge({context:1,type:Se.BitString,optional:!0})],es.prototype,"publicKey",void 0);var R0={fromASN:r=>{let e=new Uint8Array(r.valueBlock.valueHex);return e[0]===0?e.buffer.slice(1):e.buffer},toASN:r=>{let e=new Uint8Array(r);if(e[0]>127){let t=new Uint8Array(e.length+1);return t.set(e,1),new ur({valueHex:t.buffer})}return new ur({valueHex:r})}},fS=Object.freeze({__proto__:null,AsnIntegerWithoutPaddingConverter:R0}),ts=class{static decodePoint(e,t){let n=Ke.BufferSourceConverter.toUint8Array(e);if(n.length===0||n[0]!==4)throw new Error("Only uncompressed point format supported");let i=(n.length-1)/2;if(i!==Math.ceil(t/8))throw new Error("Point does not match field size");let o=n.slice(1,i+1),a=n.slice(i+1,i+1+i);return{x:o,y:a}}static encodePoint(e,t){let n=Math.ceil(t/8);if(e.x.byteLength!==n||e.y.byteLength!==n)throw new Error("X,Y coordinates don't match point size criteria");let i=Ke.BufferSourceConverter.toUint8Array(e.x),o=Ke.BufferSourceConverter.toUint8Array(e.y),a=new Uint8Array(n*2+1);return a[0]=4,a.set(i,1),a.set(o,n+1),a}static getSize(e){return Math.ceil(e/8)}static encodeSignature(e,t){let n=this.getSize(t),i=Ke.BufferSourceConverter.toUint8Array(e.r),o=Ke.BufferSourceConverter.toUint8Array(e.s),a=new Uint8Array(n*2);return a.set(this.padStart(i,n)),a.set(this.padStart(o,n),n),a}static decodeSignature(e,t){let n=this.getSize(t),i=Ke.BufferSourceConverter.toUint8Array(e);if(i.length!==n*2)throw new Error("Incorrect size of the signature");let o=i.slice(0,n),a=i.slice(n);return{r:this.trimStart(o),s:this.trimStart(a)}}static trimStart(e){let t=0;for(;t<e.length-1&&e[t]===0;)t++;return t===0?e:e.slice(t,e.length)}static padStart(e,t){if(t===e.length)return e;let n=new Uint8Array(t);return n.set(e,t-e.length),n}};s(ts,"EcUtils");var rs=class{constructor(){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0)}static fromWebCryptoSignature(e){let t=e.byteLength/2,n=ts.decodeSignature(e,t*8),i=new rs;return i.r=Ke.BufferSourceConverter.toArrayBuffer(n.r),i.s=Ke.BufferSourceConverter.toArrayBuffer(n.s),i}toWebCryptoSignature(e){return e!=null||(e=Math.max(this.r.byteLength,this.s.byteLength)*8),ts.encodeSignature(this,e).buffer}};s(rs,"EcDsaSignature");Re([Ge({type:Se.Integer,converter:R0})],rs.prototype,"r",void 0);Re([Ge({type:Se.Integer,converter:R0})],rs.prototype,"s",void 0);var eu=class extends Xi{};s(eu,"OneAsymmetricKey");Re([Ge({context:1,implicit:!0,type:Se.BitString,optional:!0})],eu.prototype,"publicKey",void 0);var ah=s(class{constructor(){this.value=new ArrayBuffer(0)}fromJSON(e){if(!e.d)throw new Error("d: Missing required property");return this.value=Ke.Convert.FromBase64Url(e.d),this}toJSON(){return{d:Ke.Convert.ToBase64Url(this.value)}}},"EdPrivateKey");Re([Ge({type:Se.OctetString})],ah.prototype,"value",void 0);ah=Re([qs({type:Dt.Choice})],ah);var fh=s(class{constructor(e){this.value=new ArrayBuffer(0),e&&(this.value=e)}toJSON(){return{x:Ke.Convert.ToBase64Url(this.value)}}fromJSON(e){if(!("x"in e))throw new Error("x: Missing required property");return this.value=Ke.Convert.FromBase64Url(e.x),this}},"EdPublicKey");Re([Ge({type:Se.BitString})],fh.prototype,"value",void 0);fh=Re([qs({type:Dt.Choice})],fh);var ch=s(class{},"CurvePrivateKey");Re([Ge({type:Se.OctetString}),Vt({type:Ft.String,converter:Jn})],ch.prototype,"d",void 0);ch=Re([qs({type:Dt.Choice})],ch);var lv="1.2.840.10045.3.1.7",uh="1.3.132.0",hv=`${uh}.34`,dv=`${uh}.35`,pv=`${uh}.10`,Pr="1.3.36.3.3.2.8.1.1",mv=`${Pr}.1`,bv=`${Pr}.2`,gv=`${Pr}.3`,yv=`${Pr}.4`,vv=`${Pr}.5`,wv=`${Pr}.6`,xv=`${Pr}.7`,Av=`${Pr}.8`,_v=`${Pr}.9`,Ev=`${Pr}.10`,Sv=`${Pr}.11`,Cv=`${Pr}.12`,Tv=`${Pr}.13`,kv=`${Pr}.14`,cS="1.3.101.110",uS="1.3.101.111",lS="1.3.101.112",hS="1.3.101.113",_e=Object.freeze({__proto__:null,converters:fS,get ObjectIdentifier(){return fu},AlgorithmIdentifier:hi,PrivateKeyInfo:Xi,PublicKeyInfo:lf,RsaPrivateKey:Hr,RsaPublicKey:hf,EcPrivateKey:es,get EcPublicKey(){return df},EcDsaSignature:rs,OneAsymmetricKey:eu,get EdPrivateKey(){return ah},get EdPublicKey(){return fh},get CurvePrivateKey(){return ch},idSecp256r1:lv,idEllipticCurve:uh,idSecp384r1:hv,idSecp521r1:dv,idSecp256k1:pv,idVersionOne:Pr,idBrainpoolP160r1:mv,idBrainpoolP160t1:bv,idBrainpoolP192r1:gv,idBrainpoolP192t1:yv,idBrainpoolP224r1:vv,idBrainpoolP224t1:wv,idBrainpoolP256r1:xv,idBrainpoolP256t1:Av,idBrainpoolP320r1:_v,idBrainpoolP320t1:Ev,idBrainpoolP384r1:Sv,idBrainpoolP384t1:Cv,idBrainpoolP512r1:Tv,idBrainpoolP512t1:kv,idX25519:cS,idX448:uS,idEd25519:lS,idEd448:hS}),at=class{constructor(){}static register(e){let t=new fu;t.value=e.id;let n=zs.serialize(t);this.items.push(be(ne({},e),{raw:n})),this.names.push(e.name)}static find(e){e=e.toUpperCase();for(let t of this.items)if(t.name.toUpperCase()===e||t.id.toUpperCase()===e)return t;return null}static get(e){let t=this.find(e);if(!t)throw new Error(`Unsupported EC named curve '${e}'`);return t}};s(at,"EcCurves");at.items=[];at.names=[];at.register({name:"P-256",id:lv,size:256});at.register({name:"P-384",id:hv,size:384});at.register({name:"P-521",id:dv,size:521});at.register({name:"K-256",id:pv,size:256});at.register({name:"brainpoolP160r1",id:mv,size:160});at.register({name:"brainpoolP160t1",id:bv,size:160});at.register({name:"brainpoolP192r1",id:gv,size:192});at.register({name:"brainpoolP192t1",id:yv,size:192});at.register({name:"brainpoolP224r1",id:vv,size:224});at.register({name:"brainpoolP224t1",id:wv,size:224});at.register({name:"brainpoolP256r1",id:xv,size:256});at.register({name:"brainpoolP256t1",id:Av,size:256});at.register({name:"brainpoolP320r1",id:_v,size:320});at.register({name:"brainpoolP320t1",id:Ev,size:320});at.register({name:"brainpoolP384r1",id:Sv,size:384});at.register({name:"brainpoolP384t1",id:Cv,size:384});at.register({name:"brainpoolP512r1",id:Tv,size:512});at.register({name:"brainpoolP512t1",id:kv,size:512});var tu=class extends Wt{constructor(){super(...arguments),this.name="HMAC",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["sign","verify"]}getDefaultLength(e){switch(e.toUpperCase()){case"SHA-1":case"SHA-256":case"SHA-384":case"SHA-512":return 512;default:throw new Error(`Unknown algorithm name '${e}'`)}}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),"length"in e){if(typeof e.length!="number")throw new TypeError("length: Is not a Number");if(e.length<1)throw new RangeError("length: Number is out of range")}}checkImportParams(e){this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms)}};s(tu,"HmacProvider");var ru=class extends Wt{constructor(){super(...arguments),this.name="PBKDF2",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveBits","deriveKey"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!(e.salt instanceof ArrayBuffer||ArrayBuffer.isView(e.salt)))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"iterations"),typeof e.iterations!="number")throw new TypeError("iterations: Is not a Number");if(e.iterations<1)throw new TypeError("iterations: Is less than 1")}checkImportKey(e,t,n,i,o,...a){if(super.checkImportKey(e,t,n,i,o),i)throw new SyntaxError("extractable: Must be 'false'")}};s(ru,"Pbkdf2Provider");var nu=class extends Wt{constructor(){super(...arguments),this.name="HKDF",this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512"],this.usages=["deriveKey","deriveBits"]}checkAlgorithmParams(e){if(this.checkRequiredProperty(e,"hash"),this.checkHashAlgorithm(e.hash,this.hashAlgorithms),this.checkRequiredProperty(e,"salt"),!Ke.BufferSourceConverter.isBufferSource(e.salt))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'");if(this.checkRequiredProperty(e,"info"),!Ke.BufferSourceConverter.isBufferSource(e.info))throw new TypeError("salt: Is not of type '(ArrayBuffer or ArrayBufferView)'")}checkImportKey(e,t,n,i,o,...a){if(super.checkImportKey(e,t,n,i,o),i)throw new SyntaxError("extractable: Must be 'false'")}};s(nu,"HkdfProvider");var iu=class extends Wt{constructor(){super(...arguments),this.usages=[],this.defaultLength=0}digest(...e){return e[0]=ne({length:this.defaultLength},e[0]),super.digest.apply(this,e)}checkDigest(e,t){super.checkDigest(e,t);let n=e.length||0;if(typeof n!="number")throw new TypeError("length: Is not a Number");if(n<0)throw new TypeError("length: Is negative")}};s(iu,"ShakeProvider");var ou=class extends iu{constructor(){super(...arguments),this.name="shake128",this.defaultLength=16}};s(ou,"Shake128Provider");var su=class extends iu{constructor(){super(...arguments),this.name="shake256",this.defaultLength=32}};s(su,"Shake256Provider");var au=class{get[Symbol.toStringTag](){return"Crypto"}randomUUID(){let e=this.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Ke.Convert.ToHex(e).toLowerCase();return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16)}`}};s(au,"Crypto");var sh=class{constructor(){this.items={}}get(e){return this.items[e.toLowerCase()]||null}set(e){this.items[e.name.toLowerCase()]=e}removeAt(e){let t=this.get(e.toLowerCase());return t&&delete this.items[e],t}has(e){return!!this.get(e)}get length(){return Object.keys(this.items).length}get algorithms(){let e=[];for(let t in this.items){let n=this.items[t];e.push(n.name)}return e.sort()}};s(sh,"ProviderStorage");var Gs=class{constructor(){this.providers=new sh}static isHashedAlgorithm(e){return!!(e&&typeof e=="object"&&"name"in e&&"hash"in e)}get[Symbol.toStringTag](){return"SubtleCrypto"}digest(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"digest");let[t,n,...i]=e,o=this.prepareAlgorithm(t),a=Ke.BufferSourceConverter.toArrayBuffer(n);return yield this.getProvider(o.name).digest(o,a,...i)})}generateKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"generateKey");let[t,n,i,...o]=e,a=this.prepareAlgorithm(t),f=this.getProvider(a.name);return yield f.generateKey(be(ne({},a),{name:f.name}),n,i,...o)})}sign(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"sign");let[t,n,i,...o]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),f=Ke.BufferSourceConverter.toArrayBuffer(i),c=this.getProvider(a.name);return yield c.sign(be(ne({},a),{name:c.name}),n,f,...o)})}verify(...e){return M(this,null,function*(){this.checkRequiredArguments(e,4,"verify");let[t,n,i,o,...a]=e;this.checkCryptoKey(n);let f=this.prepareAlgorithm(t),c=Ke.BufferSourceConverter.toArrayBuffer(o),l=Ke.BufferSourceConverter.toArrayBuffer(i),h=this.getProvider(f.name);return yield h.verify(be(ne({},f),{name:h.name}),n,l,c,...a)})}encrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"encrypt");let[t,n,i,...o]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),f=Ke.BufferSourceConverter.toArrayBuffer(i),c=this.getProvider(a.name);return yield c.encrypt(be(ne({},a),{name:c.name}),n,f,{keyUsage:!0},...o)})}decrypt(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"decrypt");let[t,n,i,...o]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),f=Ke.BufferSourceConverter.toArrayBuffer(i),c=this.getProvider(a.name);return yield c.decrypt(be(ne({},a),{name:c.name}),n,f,{keyUsage:!0},...o)})}deriveBits(...e){return M(this,null,function*(){this.checkRequiredArguments(e,3,"deriveBits");let[t,n,i,...o]=e;this.checkCryptoKey(n);let a=this.prepareAlgorithm(t),f=this.getProvider(a.name);return yield f.deriveBits(be(ne({},a),{name:f.name}),n,i,{keyUsage:!0},...o)})}deriveKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"deriveKey");let[t,n,i,o,a,...f]=e,c=this.prepareAlgorithm(i);this.getProvider(c.name).checkDerivedKeyParams(c);let h=this.prepareAlgorithm(t),d=this.getProvider(h.name);d.checkCryptoKey(n,"deriveKey");let y=yield d.deriveBits(be(ne({},h),{name:d.name}),n,i.length||512,{keyUsage:!1},...f);return this.importKey("raw",y,i,o,a,...f)})}exportKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,2,"exportKey");let[t,n,...i]=e;return this.checkCryptoKey(n),yield this.getProvider(n.algorithm.name).exportKey(t,n,...i)})}importKey(...e){return M(this,null,function*(){this.checkRequiredArguments(e,5,"importKey");let[t,n,i,o,a,...f]=e,c=this.prepareAlgorithm(i),l=this.getProvider(c.name);if(["pkcs8","spki","raw"].indexOf(t)!==-1){let h=Ke.BufferSourceConverter.toArrayBuffer(n);return l.importKey(t,h,be(ne({},c),{name:l.name}),o,a,...f)}else if(!n.kty)throw new TypeError("keyData: Is not JSON");return l.importKey(t,n,be(ne({},c),{name:l.name}),o,a,...f)})}wrapKey(e,t,n,i,...o){return M(this,null,function*(){let a=yield this.exportKey(e,t,...o);if(e==="jwk"){let h=JSON.stringify(a);a=Ke.Convert.FromUtf8String(h)}let f=this.prepareAlgorithm(i),c=Ke.BufferSourceConverter.toArrayBuffer(a),l=this.getProvider(f.name);return l.encrypt(be(ne({},f),{name:l.name}),n,c,{keyUsage:!1},...o)})}unwrapKey(e,t,n,i,o,a,f,...c){return M(this,null,function*(){let l=this.prepareAlgorithm(i),h=Ke.BufferSourceConverter.toArrayBuffer(t),d=this.getProvider(l.name),y=yield d.decrypt(be(ne({},l),{name:d.name}),n,h,{keyUsage:!1},...c);if(e==="jwk")try{y=JSON.parse(Ke.Convert.ToUtf8String(y))}catch(A){let v=new TypeError("wrappedKey: Is not a JSON");throw v.internal=A,v}return this.importKey(e,y,o,a,f,...c)})}checkRequiredArguments(e,t,n){if(e.length<t)throw new TypeError(`Failed to execute '${n}' on 'SubtleCrypto': ${t} arguments required, but only ${e.length} present`)}prepareAlgorithm(e){if(typeof e=="string")return{name:e};if(Gs.isHashedAlgorithm(e)){let t=ne({},e);return t.hash=this.prepareAlgorithm(e.hash),t}return ne({},e)}getProvider(e){let t=this.providers.get(e);if(!t)throw new Qo("Unrecognized name");return t}checkCryptoKey(e){if(!(e instanceof Yi))throw new TypeError("Key is not of type 'CryptoKey'")}};s(Gs,"SubtleCrypto");var bi=ze(require("crypto")),Be=ze(require("crypto")),Nv=ze(require("process"));var An=ze(Ro());var L0={fromJSON:r=>Buffer.from(An.Convert.FromBase64Url(r)),toJSON:r=>An.Convert.ToBase64Url(r)},_n=class extends Yi{constructor(){super(...arguments),this.data=Buffer.alloc(0),this.algorithm={name:""},this.extractable=!1,this.type="secret",this.usages=[],this.kty="oct",this.alg=""}};s(_n,"CryptoKey");Re([Vt({name:"ext",type:Ft.Boolean,optional:!0})],_n.prototype,"extractable",void 0);Re([Vt({name:"key_ops",type:Ft.String,repeated:!0,optional:!0})],_n.prototype,"usages",void 0);Re([Vt({type:Ft.String})],_n.prototype,"kty",void 0);Re([Vt({type:Ft.String,optional:!0})],_n.prototype,"alg",void 0);var cu=class extends _n{constructor(){super(...arguments),this.kty="oct",this.type="secret"}};s(cu,"SymmetricKey");var Zi=class extends _n{};s(Zi,"AsymmetricKey");var Rr=class extends cu{get alg(){switch(this.algorithm.name.toUpperCase()){case"AES-CBC":return`A${this.algorithm.length}CBC`;case"AES-CTR":return`A${this.algorithm.length}CTR`;case"AES-GCM":return`A${this.algorithm.length}GCM`;case"AES-KW":return`A${this.algorithm.length}KW`;case"AES-CMAC":return`A${this.algorithm.length}CMAC`;case"AES-ECB":return`A${this.algorithm.length}ECB`;default:throw new Qo("Unsupported algorithm name")}}set alg(e){}};s(Rr,"AesCryptoKey");Re([Vt({name:"k",converter:L0})],Rr.prototype,"data",void 0);var Ov=new WeakMap;function xe(r){let e=Ov.get(r);if(!e)throw new Oe("Cannot get CryptoKey from secure storage");return e}s(xe,"getCryptoKey");function Le(r){let e=Yi.create(r.algorithm,r.type,r.extractable,r.usages);return Object.freeze(e),Ov.set(e,r),e}s(Le,"setCryptoKey");var Ze=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Rr;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){if(!(t instanceof Rr))throw new Error("key: Is not AesCryptoKey");switch(e.toLowerCase()){case"jwk":return Or.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,o){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Jt.fromJSON(t,{targetSchema:Rr});break;case"raw":a=new Rr,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}switch(a.algorithm=n,a.algorithm.length=a.data.length<<3,a.extractable=i,a.usages=o,a.algorithm.length){case 128:case 192:case 256:break;default:throw new Oe("keyData: Is wrong key length")}return a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"AES-CBC":return this.encryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.encryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.encryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.encryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.encryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof Rr))throw new Error("key: Is not AesCryptoKey");switch(e.name.toUpperCase()){case"AES-CBC":return this.decryptAesCBC(e,t,Buffer.from(n));case"AES-CTR":return this.decryptAesCTR(e,t,Buffer.from(n));case"AES-GCM":return this.decryptAesGCM(e,t,Buffer.from(n));case"AES-KW":return this.decryptAesKW(e,t,Buffer.from(n));case"AES-ECB":return this.decryptAesECB(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptAesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-cbc`,t.data,new Uint8Array(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static encryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ctr`,t.data,Buffer.from(e.counter)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptAesCTR(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ctr`,t.data,new Uint8Array(e.counter)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static encryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-gcm`,t.data,Buffer.from(e.iv),{authTagLength:(e.tagLength||128)>>3});e.additionalData&&i.setAAD(Buffer.from(e.additionalData));let o=i.update(n);return o=Buffer.concat([o,i.final(),i.getAuthTag()]),new Uint8Array(o).buffer})}static decryptAesGCM(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-gcm`,t.data,new Uint8Array(e.iv)),o=(e.tagLength||128)>>3,a=n.slice(0,n.length-o),f=n.slice(n.length-o);e.additionalData&&i.setAAD(Buffer.from(e.additionalData)),i.setAuthTag(f);let c=i.update(a);return c=Buffer.concat([c,i.final()]),new Uint8Array(c).buffer})}static encryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptAesKW(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`id-aes${t.algorithm.length}-wrap`,t.data,this.AES_KW_IV),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static encryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptAesECB(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv(`aes-${t.algorithm.length}-ecb`,t.data,new Uint8Array(0)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}};s(Ze,"AesCrypto");Ze.AES_KW_IV=Buffer.from("A6A6A6A6A6A6A6A6","hex");var lh=class extends Hc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(lh,"AesCbcProvider");var D0=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Mv=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135]),Js=16;function Bv(r){let e=Buffer.alloc(r.length),t=r.length-1;for(let n=0;n<t;n++)e[n]=r[n]<<1,r[n+1]&128&&(e[n]+=1);return e[t]=r[t]<<1,e}s(Bv,"bitShiftLeft");function pf(r,e){let t=Math.min(r.length,e.length),n=Buffer.alloc(t);for(let i=0;i<t;i++)n[i]=r[i]^e[i];return n}s(pf,"xor");function U0(r,e){let t=bi.createCipheriv(`aes${r.length<<3}`,r,D0),n=t.update(e);return t.final(),n}s(U0,"aes");function Iv(r,e){let t=Buffer.alloc(Js),n=e*Js,i=n+Js;return r.copy(t,0,n,i),t}s(Iv,"getMessageBlock");function pS(r,e){let t=Buffer.alloc(Js),n=e*Js,i=r.length;return t.fill(0),r.copy(t,0,n,i),t[i-n]=128,t}s(pS,"getPaddedMessageBlock");function mS(r){let e=U0(r,D0),t=Bv(e);e[0]&128&&(t=pf(t,Mv));let n=Bv(t);return t[0]&128&&(n=pf(n,Mv)),{subkey1:t,subkey2:n}}s(mS,"generateSubkeys");function bS(r,e){let t=mS(r),n=Math.ceil(e.length/Js),i,o;n===0?(n=1,i=!1):i=e.length%Js===0;let a=n-1;i?o=pf(Iv(e,a),t.subkey1):o=pf(pS(e,a),t.subkey2);let f=D0,c;for(let l=0;l<a;l++)c=pf(f,Iv(e,l)),f=U0(r,c);return c=pf(o,f),U0(r,c)}s(bS,"aesCmac");var hh=class extends qc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onSign(e,t,n){return M(this,null,function*(){let i=bS(xe(t).data,Buffer.from(n));return new Uint8Array(i).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let o=yield this.sign(e,t,i);return Buffer.from(n).compare(Buffer.from(o))===0})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(hh,"AesCmacProvider");var dh=class extends zc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(dh,"AesCtrProvider");var ph=class extends Vc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(ph,"AesGcmProvider");var mh=class extends Wc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(mh,"AesKwProvider");var bh=class extends jc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Ze.generateKey({name:this.name,length:e.length},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return Ze.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return Ze.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return Ze.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Ze.importKey(e,t,{name:n.name},i,o);return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Rr))throw new TypeError("key: Is not a AesCryptoKey")}};s(bh,"AesEcbProvider");var mi=class extends cu{get alg(){switch(this.algorithm.name.toUpperCase()){case"DES-CBC":return"DES-CBC";case"DES-EDE3-CBC":return"3DES-CBC";default:throw new Qo("Unsupported algorithm name")}}set alg(e){}};s(mi,"DesCryptoKey");Re([Vt({name:"k",converter:L0})],mi.prototype,"data",void 0);var on=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new mi;return i.algorithm=e,i.extractable=t,i.usages=n,i.data=Be.default.randomBytes(e.length>>3),i})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Or.toJSON(t);case"raw":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}static importKey(e,t,n,i,o){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Jt.fromJSON(t,{targetSchema:mi});break;case"raw":a=new mi,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm=n,a.extractable=i,a.usages=o,a})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"DES-CBC":return this.encryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.encryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){if(!(t instanceof mi))throw new Error("key: Is not DesCryptoKey");switch(e.name.toUpperCase()){case"DES-CBC":return this.decryptDesCBC(e,t,Buffer.from(n));case"DES-EDE3-CBC":return this.decryptDesEDE3CBC(e,t,Buffer.from(n));default:throw new Oe("algorithm: Is not recognized")}})}static encryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-cbc",t.data,new Uint8Array(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptDesCBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-cbc",t.data,new Uint8Array(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static encryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createCipheriv("des-ede3-cbc",t.data,Buffer.from(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}static decryptDesEDE3CBC(e,t,n){return M(this,null,function*(){let i=Be.default.createDecipheriv("des-ede3-cbc",t.data,new Uint8Array(e.iv)),o=i.update(n);return o=Buffer.concat([o,i.final()]),new Uint8Array(o).buffer})}};s(on,"DesCrypto");var gh=class extends af{constructor(){super(...arguments),this.keySizeBits=64,this.ivSize=8,this.name="DES-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield on.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return on.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return on.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return on.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield on.importKey(e,t,{name:this.name,length:this.keySizeBits},i,o);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof mi))throw new TypeError("key: Is not a DesCryptoKey")}};s(gh,"DesCbcProvider");var yh=class extends af{constructor(){super(...arguments),this.keySizeBits=192,this.ivSize=8,this.name="DES-EDE3-CBC"}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield on.generateKey({name:this.name,length:this.keySizeBits},t,n);return Le(i)})}onEncrypt(e,t,n){return M(this,null,function*(){return on.encrypt(e,xe(t),new Uint8Array(n))})}onDecrypt(e,t,n){return M(this,null,function*(){return on.decrypt(e,xe(t),new Uint8Array(n))})}onExportKey(e,t){return M(this,null,function*(){return on.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield on.importKey(e,t,{name:this.name,length:this.keySizeBits},i,o);if(a.data.length!==this.keySizeBits>>3)throw new Oe("keyData: Wrong key size");return Le(a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof mi))throw new TypeError("key: Is not a DesCryptoKey")}};s(yh,"DesEde3CbcProvider");function Pv(r){switch(r.name.toUpperCase()){case"RSA-OAEP":{let e=/(\d+)$/.exec(r.hash.name)[1];return`RSA-OAEP${e!=="1"?`-${e}`:""}`}case"RSASSA-PKCS1-V1_5":return`RS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PSS":return`PS${/(\d+)$/.exec(r.hash.name)[1]}`;case"RSA-PKCS1":return"RS1";default:throw new Oe("algorithm: Is not recognized")}}s(Pv,"getJwkAlgorithm");var Qi=class extends Zi{constructor(){super(...arguments),this.type="private"}getKey(){let e=Je.parse(this.data,_e.PrivateKeyInfo);return Je.parse(e.privateKey,_e.RsaPrivateKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:Pv(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Or.toJSON(e))}fromJSON(e){let t=Jt.fromJSON(e,{targetSchema:_e.RsaPrivateKey}),n=new _e.PrivateKeyInfo;n.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.privateKeyAlgorithm.parameters=null,n.privateKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};s(Qi,"RsaPrivateKey");var eo=class extends Zi{constructor(){super(...arguments),this.type="public"}getKey(){let e=Je.parse(this.data,_e.PublicKeyInfo);return Je.parse(e.publicKey,_e.RsaPublicKey)}toJSON(){let e=this.getKey(),t={kty:"RSA",alg:Pv(this.algorithm),key_ops:this.usages,ext:this.extractable};return Object.assign(t,Or.toJSON(e))}fromJSON(e){let t=Jt.fromJSON(e,{targetSchema:_e.RsaPublicKey}),n=new _e.PublicKeyInfo;n.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",n.publicKeyAlgorithm.parameters=null,n.publicKey=Ye.serialize(t),this.data=Buffer.from(Ye.serialize(n))}};s(eo,"RsaPublicKey");var Kt=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Qi;i.algorithm=e,i.extractable=t,i.usages=n.filter(l=>this.privateKeyUsages.indexOf(l)!==-1);let o=new eo;o.algorithm=e,o.extractable=!0,o.usages=n.filter(l=>this.publicKeyUsages.indexOf(l)!==-1);let a=Buffer.concat([Buffer.alloc(4-e.publicExponent.byteLength,0),Buffer.from(e.publicExponent)]).readInt32BE(0),f=Be.default.generateKeyPairSync("rsa",{modulusLength:e.modulusLength,publicExponent:a,publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=f.privateKey,o.data=f.publicKey,{privateKey:i,publicKey:o}})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Or.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static importKey(e,t,n,i,o){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":if(t.d){let f=Jt.fromJSON(t,{targetSchema:_e.RsaPrivateKey});return this.importPrivateKey(f,n,i,o)}else{let f=Jt.fromJSON(t,{targetSchema:_e.RsaPublicKey});return this.importPublicKey(f,n,i,o)}case"spki":{let a=Je.parse(new Uint8Array(t),_e.PublicKeyInfo),f=Je.parse(a.publicKey,_e.RsaPublicKey);return this.importPublicKey(f,n,i,o)}case"pkcs8":{let a=Je.parse(new Uint8Array(t),_e.PrivateKeyInfo),f=Je.parse(a.privateKey,_e.RsaPrivateKey);return this.importPrivateKey(f,n,i,o)}default:throw new Oe("format: Must be 'jwk', 'pkcs8' or 'spki'")}})}static sign(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.signRsa(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static verify(e,t,n,i){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-PSS":case"RSASSA-PKCS1-V1_5":return this.verifySSA(e,t,i,n);default:throw new Oe("algorithm: Is not recognized")}})}static encrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.encryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static decrypt(e,t,n){return M(this,null,function*(){switch(e.name.toUpperCase()){case"RSA-OAEP":return this.decryptOAEP(e,t,n);default:throw new Oe("algorithm: Is not recognized")}})}static importPrivateKey(e,t,n,i){let o=new _e.PrivateKeyInfo;o.privateKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",o.privateKeyAlgorithm.parameters=null,o.privateKey=Ye.serialize(e);let a=new Qi;return a.data=Buffer.from(Ye.serialize(o)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static importPublicKey(e,t,n,i){let o=new _e.PublicKeyInfo;o.publicKeyAlgorithm.algorithm="1.2.840.113549.1.1.1",o.publicKeyAlgorithm.parameters=null,o.publicKey=Ye.serialize(e);let a=new eo;return a.data=Buffer.from(Ye.serialize(o)),a.algorithm=Object.assign({},t),a.algorithm.publicExponent=new Uint8Array(e.publicExponent),a.algorithm.modulusLength=e.modulus.byteLength<<3,a.extractable=n,a.usages=i,a}static getCryptoAlgorithm(e){switch(e.hash.name.toUpperCase()){case"SHA-1":return"RSA-SHA1";case"SHA-256":return"RSA-SHA256";case"SHA-384":return"RSA-SHA384";case"SHA-512":return"RSA-SHA512";case"SHA3-256":return"RSA-SHA3-256";case"SHA3-384":return"RSA-SHA3-384";case"SHA3-512":return"RSA-SHA3-512";default:throw new Oe("algorithm.hash: Is not recognized")}}static signRsa(e,t,n){let i=this.getCryptoAlgorithm(t.algorithm),o=Be.default.createSign(i);o.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
638
638
|
${t.data.toString("base64")}
|
639
|
-
-----END PRIVATE KEY-----`);let a={key:t.pem};e.name.toUpperCase()==="RSA-PSS"&&(a.padding=Be.default.constants.RSA_PKCS1_PSS_PADDING,a.saltLength=e.saltLength);let
|
639
|
+
-----END PRIVATE KEY-----`);let a={key:t.pem};e.name.toUpperCase()==="RSA-PSS"&&(a.padding=Be.default.constants.RSA_PKCS1_PSS_PADDING,a.saltLength=e.saltLength);let f=o.sign(a);return new Uint8Array(f).buffer}static verifySSA(e,t,n,i){let o=this.getCryptoAlgorithm(t.algorithm),a=Be.default.createVerify(o);a.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
640
640
|
${t.data.toString("base64")}
|
641
|
-
-----END PUBLIC KEY-----`);let
|
641
|
+
-----END PUBLIC KEY-----`);let f={key:t.pem};return e.name.toUpperCase()==="RSA-PSS"&&(f.padding=Be.default.constants.RSA_PKCS1_PSS_PADDING,f.saltLength=e.saltLength),a.verify(f,i)}static encryptOAEP(e,t,n){let i={key:`-----BEGIN PUBLIC KEY-----
|
642
642
|
${t.data.toString("base64")}
|
643
643
|
-----END PUBLIC KEY-----`,padding:Be.default.constants.RSA_PKCS1_OAEP_PADDING};return e.label,new Uint8Array(Be.default.publicEncrypt(i,n)).buffer}static decryptOAEP(e,t,n){let i={key:`-----BEGIN PRIVATE KEY-----
|
644
644
|
${t.data.toString("base64")}
|
645
|
-
-----END PRIVATE KEY-----`,padding:Be.default.constants.RSA_PKCS1_OAEP_PADDING};return e.label,new Uint8Array(Be.default.privateDecrypt(i,n)).buffer}};
|
645
|
+
-----END PRIVATE KEY-----`,padding:Be.default.constants.RSA_PKCS1_OAEP_PADDING};return e.label,new Uint8Array(Be.default.privateDecrypt(i,n)).buffer}};s(Kt,"RsaCrypto");Kt.publicKeyUsages=["verify","encrypt","wrapKey"];Kt.privateKeyUsages=["sign","decrypt","unwrapKey"];var vh=class extends Gc{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kt.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return Kt.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return Kt.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return Kt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Kt.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Qi||n instanceof eo))throw new TypeError("key: Is not RSA CryptoKey")}};s(vh,"RsaSsaProvider");var wh=class extends Jc{constructor(){super(...arguments),this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kt.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return Kt.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return Kt.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return Kt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Kt.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Qi||n instanceof eo))throw new TypeError("key: Is not RSA CryptoKey")}};s(wh,"RsaPssProvider");var lr=class{static size(e){switch(e.name.toUpperCase()){case"SHA-1":return 160;case"SHA-256":case"SHA3-256":return 256;case"SHA-384":case"SHA3-384":return 384;case"SHA-512":case"SHA3-512":return 512;default:throw new Error("Unrecognized name")}}static getAlgorithmName(e){switch(e.name.toUpperCase()){case"SHA-1":return"sha1";case"SHA-256":return"sha256";case"SHA-384":return"sha384";case"SHA-512":return"sha512";case"SHA3-256":return"sha3-256";case"SHA3-384":return"sha3-384";case"SHA3-512":return"sha3-512";default:throw new Error("Unrecognized name")}}static digest(e,t){let n=this.getAlgorithmName(e),i=Be.default.createHash(n).update(Buffer.from(t)).digest();return new Uint8Array(i).buffer}};s(lr,"ShaCrypto");var xh=class extends Yc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kt.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onEncrypt(e,t,n){return M(this,null,function*(){let i=xe(t),o=new Uint8Array(n),a=Math.ceil(i.algorithm.modulusLength>>3),f=lr.size(i.algorithm.hash)>>3,c=o.byteLength,l=a-c-2*f-2;if(c>a-2*f-2)throw new Error("Data too large");let h=new Uint8Array(a),d=h.subarray(1,f+1),y=h.subarray(f+1);y.set(o,f+l+1);let A=Be.default.createHash(i.algorithm.hash.name.replace("-","")).update(pi.BufferSourceConverter.toUint8Array(e.label||new Uint8Array(0))).digest();y.set(A,0),y[f+l]=1,Be.default.randomFillSync(d);let v=this.mgf1(i.algorithm.hash,d,y.length);for(let _=0;_<y.length;_++)y[_]^=v[_];let x=this.mgf1(i.algorithm.hash,y,d.length);for(let _=0;_<d.length;_++)d[_]^=x[_];i.pem||(i.pem=`-----BEGIN PUBLIC KEY-----
|
646
646
|
${i.data.toString("base64")}
|
647
|
-
-----END PUBLIC KEY-----`);let
|
647
|
+
-----END PUBLIC KEY-----`);let L=Be.default.publicEncrypt({key:i.pem,padding:Be.default.constants.RSA_NO_PADDING},Buffer.from(h));return new Uint8Array(L).buffer})}onDecrypt(e,t,n){return M(this,null,function*(){let i=xe(t),o=Math.ceil(i.algorithm.modulusLength>>3),a=lr.size(i.algorithm.hash)>>3;if(n.byteLength!==o)throw new Error("Bad data");i.pem||(i.pem=`-----BEGIN PRIVATE KEY-----
|
648
648
|
${i.data.toString("base64")}
|
649
|
-
-----END PRIVATE KEY-----`);let
|
649
|
+
-----END PRIVATE KEY-----`);let c=Be.default.privateDecrypt({key:i.pem,padding:Be.default.constants.RSA_NO_PADDING},Buffer.from(n)),l=c[0],h=c.subarray(1,a+1),d=c.subarray(a+1);if(l!==0)throw new Error("Decryption failed");let y=this.mgf1(i.algorithm.hash,d,h.length);for(let L=0;L<h.length;L++)h[L]^=y[L];let A=this.mgf1(i.algorithm.hash,h,d.length);for(let L=0;L<d.length;L++)d[L]^=A[L];let v=Be.default.createHash(i.algorithm.hash.name.replace("-","")).update(pi.BufferSourceConverter.toUint8Array(e.label||new Uint8Array(0))).digest();for(let L=0;L<a;L++)if(v[L]!==d[L])throw new Error("Decryption failed");let x=a;for(;x<d.length;x++){let L=d[x];if(L===1)break;if(L!==0)throw new Error("Decryption failed")}if(x===d.length)throw new Error("Decryption failed");return c=d.subarray(x+1),new Uint8Array(c).buffer})}onExportKey(e,t){return M(this,null,function*(){return Kt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Kt.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Qi||n instanceof eo))throw new TypeError("key: Is not RSA CryptoKey")}mgf1(e,t,n=0){let i=lr.size(e)>>3,o=new Uint8Array(n),a=new Uint8Array(4),f=Math.ceil(n/i);for(let c=0;c<f;c++){a[0]=c>>>24,a[1]=c>>>16&255,a[2]=c>>>8&255,a[3]=c&255;let l=o.subarray(c*i),h=Be.default.createHash(e.name.replace("-","")).update(t).update(a).digest();h.length>l.length&&(h=h.subarray(0,l.length)),l.set(h)}return o}};s(xh,"RsaOaepProvider");var Ah=class extends Wt{constructor(){super(...arguments),this.name="RSAES-PKCS1-v1_5",this.usages={publicKey:["encrypt","wrapKey"],privateKey:["decrypt","unwrapKey"]}}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield Kt.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}checkGenerateKeyParams(e){if(this.checkRequiredProperty(e,"publicExponent"),!(e.publicExponent&&e.publicExponent instanceof Uint8Array))throw new TypeError("publicExponent: Missing or not a Uint8Array");let t=An.Convert.ToBase64(e.publicExponent);if(!(t==="Aw=="||t==="AQAB"))throw new TypeError("publicExponent: Must be [3] or [1,0,1]");switch(this.checkRequiredProperty(e,"modulusLength"),e.modulusLength){case 1024:case 2048:case 4096:break;default:throw new TypeError("modulusLength: Must be 1024, 2048, or 4096")}}onEncrypt(e,t,n){return M(this,null,function*(){let i=this.toCryptoOptions(t),o=bi.publicEncrypt(i,new Uint8Array(n));return new Uint8Array(o).buffer})}onDecrypt(e,t,n){return M(this,null,function*(){let i=this.toCryptoOptions(t),o=bi.privateDecrypt(i,new Uint8Array(n));return new Uint8Array(o).buffer})}onExportKey(e,t){return M(this,null,function*(){return Kt.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield Kt.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Qi||n instanceof eo))throw new TypeError("key: Is not RSA CryptoKey")}toCryptoOptions(e){let t=e.type.toUpperCase();return{key:`-----BEGIN ${t} KEY-----
|
650
650
|
${xe(e).data.toString("base64")}
|
651
|
-
-----END ${t} KEY-----`,padding:
|
651
|
+
-----END ${t} KEY-----`,padding:bi.constants.RSA_PKCS1_PADDING}}};s(Ah,"RsaEsProvider");var gS={"1.2.840.10045.3.1.7":"P-256","P-256":"1.2.840.10045.3.1.7","1.3.132.0.34":"P-384","P-384":"1.3.132.0.34","1.3.132.0.35":"P-521","P-521":"1.3.132.0.35","1.3.132.0.10":"K-256","K-256":"1.3.132.0.10",brainpoolP160r1:"1.3.36.3.3.2.8.1.1.1","1.3.36.3.3.2.8.1.1.1":"brainpoolP160r1",brainpoolP160t1:"1.3.36.3.3.2.8.1.1.2","1.3.36.3.3.2.8.1.1.2":"brainpoolP160t1",brainpoolP192r1:"1.3.36.3.3.2.8.1.1.3","1.3.36.3.3.2.8.1.1.3":"brainpoolP192r1",brainpoolP192t1:"1.3.36.3.3.2.8.1.1.4","1.3.36.3.3.2.8.1.1.4":"brainpoolP192t1",brainpoolP224r1:"1.3.36.3.3.2.8.1.1.5","1.3.36.3.3.2.8.1.1.5":"brainpoolP224r1",brainpoolP224t1:"1.3.36.3.3.2.8.1.1.6","1.3.36.3.3.2.8.1.1.6":"brainpoolP224t1",brainpoolP256r1:"1.3.36.3.3.2.8.1.1.7","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1",brainpoolP256t1:"1.3.36.3.3.2.8.1.1.8","1.3.36.3.3.2.8.1.1.8":"brainpoolP256t1",brainpoolP320r1:"1.3.36.3.3.2.8.1.1.9","1.3.36.3.3.2.8.1.1.9":"brainpoolP320r1",brainpoolP320t1:"1.3.36.3.3.2.8.1.1.10","1.3.36.3.3.2.8.1.1.10":"brainpoolP320t1",brainpoolP384r1:"1.3.36.3.3.2.8.1.1.11","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1",brainpoolP384t1:"1.3.36.3.3.2.8.1.1.12","1.3.36.3.3.2.8.1.1.12":"brainpoolP384t1",brainpoolP512r1:"1.3.36.3.3.2.8.1.1.13","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1",brainpoolP512t1:"1.3.36.3.3.2.8.1.1.14","1.3.36.3.3.2.8.1.1.14":"brainpoolP512t1"};function uu(r){let e=gS[r];if(!e)throw new Oe(`Cannot convert WebCrypto named curve '${r}' to OID`);return e}s(uu,"getOidByNamedCurve$1");var Ys=class extends Zi{constructor(){super(...arguments),this.type="private"}getKey(){let e=Je.parse(this.data,_e.PrivateKeyInfo);return Je.parse(e.privateKey,_e.EcPrivateKey)}toJSON(){let e=this.getKey(),t={kty:"EC",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Or.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=new _e.PrivateKeyInfo;t.privateKeyAlgorithm.algorithm="1.2.840.10045.2.1",t.privateKeyAlgorithm.parameters=Ye.serialize(new _e.ObjectIdentifier(uu(e.crv)));let n=Jt.fromJSON(e,{targetSchema:_e.EcPrivateKey});return t.privateKey=Ye.serialize(n),this.data=Buffer.from(Ye.serialize(t)),this}};s(Ys,"EcPrivateKey");var Xs=class extends Zi{constructor(){super(...arguments),this.type="public"}getKey(){let e=Je.parse(this.data,_e.PublicKeyInfo);return new _e.EcPublicKey(e.publicKey)}toJSON(){let e=this.getKey(),t={kty:"EC",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Or.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=Jt.fromJSON(e,{targetSchema:_e.EcPublicKey}),n=new _e.PublicKeyInfo;return n.publicKeyAlgorithm.algorithm="1.2.840.10045.2.1",n.publicKeyAlgorithm.parameters=Ye.serialize(new _e.ObjectIdentifier(uu(e.crv))),n.publicKey=Ye.toASN(t).valueHex,this.data=Buffer.from(Ye.serialize(n)),this}};s(Xs,"EcPublicKey");var _h=class extends Wt{constructor(){super(...arguments),this.name="SHA-1",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(_h,"Sha1Provider");var Eh=class extends Wt{constructor(){super(...arguments),this.name="SHA-256",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(Eh,"Sha256Provider");var Sh=class extends Wt{constructor(){super(...arguments),this.name="SHA-384",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(Sh,"Sha384Provider");var Ch=class extends Wt{constructor(){super(...arguments),this.name="SHA-512",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(Ch,"Sha512Provider");var Th=class extends Wt{constructor(){super(...arguments),this.name="SHA3-256",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(Th,"Sha3256Provider");var kh=class extends Wt{constructor(){super(...arguments),this.name="SHA3-384",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(kh,"Sha3384Provider");var Mh=class extends Wt{constructor(){super(...arguments),this.name="SHA3-512",this.usages=[]}onDigest(e,t){return M(this,null,function*(){return lr.digest(e,t)})}};s(Mh,"Sha3512Provider");var qr=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new Ys;i.algorithm=e,i.extractable=t,i.usages=n.filter(c=>this.privateKeyUsages.indexOf(c)!==-1);let o=new Xs;o.algorithm=e,o.extractable=!0,o.usages=n.filter(c=>this.publicKeyUsages.indexOf(c)!==-1);let a=Be.default.generateKeyPairSync("ec",{namedCurve:this.getOpenSSLNamedCurve(e.namedCurve),publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=a.privateKey,o.data=a.publicKey,{privateKey:i,publicKey:o}})}static sign(e,t,n){return M(this,null,function*(){let i=lr.getAlgorithmName(e.hash),o=Be.default.createSign(i);o.update(Buffer.from(n)),t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
652
652
|
${t.data.toString("base64")}
|
653
|
-
-----END PRIVATE KEY-----`);let a={key:t.pem},
|
653
|
+
-----END PRIVATE KEY-----`);let a={key:t.pem},f=o.sign(a),c=Je.parse(f,_e.EcDsaSignature);return ts.encodeSignature(c,at.get(t.algorithm.namedCurve).size).buffer})}static verify(e,t,n,i){return M(this,null,function*(){let o=lr.getAlgorithmName(e.hash),a=Be.default.createVerify(o);a.update(Buffer.from(i)),t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
654
654
|
${t.data.toString("base64")}
|
655
|
-
-----END PUBLIC KEY-----`);let
|
655
|
+
-----END PUBLIC KEY-----`);let f={key:t.pem},c=new _e.EcDsaSignature,l=at.get(t.algorithm.namedCurve),h=ts.decodeSignature(n,l.size);c.r=An.BufferSourceConverter.toArrayBuffer(h.r),c.s=An.BufferSourceConverter.toArrayBuffer(h.s);let d=Buffer.from(Ye.serialize(c));return a.verify(f,d)})}static deriveBits(e,t,n){return M(this,null,function*(){let i=this.getOpenSSLNamedCurve(t.algorithm.namedCurve),o=Be.default.createECDH(i),a=Je.parse(t.data,_e.PrivateKeyInfo),f=Je.parse(a.privateKey,_e.EcPrivateKey);o.setPrivateKey(Buffer.from(f.privateKey));let c=Je.parse(e.public.data,_e.PublicKeyInfo),l=o.computeSecret(Buffer.from(c.publicKey));return new Uint8Array(l).buffer.slice(0,n>>3)})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Or.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;case"raw":return Je.parse(t.data,_e.PublicKeyInfo).publicKey;default:throw new Oe("format: Must be 'jwk', 'raw', pkcs8' or 'spki'")}})}static importKey(e,t,n,i,o){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":if(t.d){let f=Jt.fromJSON(t,{targetSchema:_e.EcPrivateKey});return this.importPrivateKey(f,n,i,o)}else{let f=Jt.fromJSON(t,{targetSchema:_e.EcPublicKey});return this.importPublicKey(f,n,i,o)}case"raw":{let a=new _e.EcPublicKey(t);return this.importPublicKey(a,n,i,o)}case"spki":{let a=Je.parse(new Uint8Array(t),_e.PublicKeyInfo),f=new _e.EcPublicKey(a.publicKey);return this.assertKeyParameters(a.publicKeyAlgorithm.parameters,n.namedCurve),this.importPublicKey(f,n,i,o)}case"pkcs8":{let a=Je.parse(new Uint8Array(t),_e.PrivateKeyInfo),f=Je.parse(a.privateKey,_e.EcPrivateKey);return this.assertKeyParameters(a.privateKeyAlgorithm.parameters,n.namedCurve),this.importPrivateKey(f,n,i,o)}default:throw new Oe("format: Must be 'jwk', 'raw', 'pkcs8' or 'spki'")}})}static assertKeyParameters(e,t){if(!e)throw new $r("Key info doesn't have required parameters");let n="";try{n=Je.parse(e,_e.ObjectIdentifier).value}catch(i){throw new $r("Cannot read key info parameters")}if(uu(t)!==n)throw new $r("Key info parameter doesn't match to named curve")}static importPrivateKey(e,t,n,i){return M(this,null,function*(){let o=new _e.PrivateKeyInfo;o.privateKeyAlgorithm.algorithm="1.2.840.10045.2.1",o.privateKeyAlgorithm.parameters=Ye.serialize(new _e.ObjectIdentifier(uu(t.namedCurve))),o.privateKey=Ye.serialize(e);let a=new Ys;return a.data=Buffer.from(Ye.serialize(o)),a.algorithm=Object.assign({},t),a.extractable=n,a.usages=i,a})}static importPublicKey(e,t,n,i){return M(this,null,function*(){let o=new _e.PublicKeyInfo;o.publicKeyAlgorithm.algorithm="1.2.840.10045.2.1";let a=uu(t.namedCurve);o.publicKeyAlgorithm.parameters=Ye.serialize(new _e.ObjectIdentifier(a)),o.publicKey=e.value;let f=new Xs;return f.data=Buffer.from(Ye.serialize(o)),f.algorithm=Object.assign({},t),f.extractable=n,f.usages=i,f})}static getOpenSSLNamedCurve(e){switch(e.toUpperCase()){case"P-256":return"prime256v1";case"K-256":return"secp256k1";case"P-384":return"secp384r1";case"P-521":return"secp521r1";default:return e}}};s(qr,"EcCrypto");qr.publicKeyUsages=["verify"];qr.privateKeyUsages=["sign","deriveKey","deriveBits"];var Bh=class extends Xc{constructor(){super(...arguments),this.namedCurves=at.names,this.hashAlgorithms=["SHA-1","SHA-256","SHA-384","SHA-512","shake128","shake256","SHA3-256","SHA3-384","SHA3-512"]}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield qr.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return qr.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return qr.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return qr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield qr.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Ys||n instanceof Xs))throw new TypeError("key: Is not EC CryptoKey")}};s(Bh,"EcdsaProvider");var Ih=class extends uf{constructor(){super(...arguments),this.namedCurves=at.names}onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield qr.generateKey(be(ne({},e),{name:this.name}),t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onExportKey(e,t){return M(this,null,function*(){return qr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield qr.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}checkCryptoKey(e,t){super.checkCryptoKey(e,t);let n=xe(e);if(!(n instanceof Ys||n instanceof Xs))throw new TypeError("key: Is not EC CryptoKey")}onDeriveBits(e,t,n){return M(this,null,function*(){return yield qr.deriveBits(be(ne({},e),{public:xe(e.public)}),xe(t),n)})}};s(Ih,"EcdhProvider");var yS={[_e.idEd448]:"Ed448",ed448:_e.idEd448,[_e.idX448]:"X448",x448:_e.idX448,[_e.idEd25519]:"Ed25519",ed25519:_e.idEd25519,[_e.idX25519]:"X25519",x25519:_e.idX25519};function Rv(r){let e=yS[r.toLowerCase()];if(!e)throw new Oe(`Cannot convert WebCrypto named curve '${r}' to OID`);return e}s(Rv,"getOidByNamedCurve");var lu=class extends Zi{constructor(){super(...arguments),this.type="private"}getKey(){let e=Je.parse(this.data,_e.PrivateKeyInfo);return Je.parse(e.privateKey,_e.CurvePrivateKey)}toJSON(){let e=this.getKey(),t={kty:"OKP",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,Or.toJSON(e))}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");let t=new _e.PrivateKeyInfo;t.privateKeyAlgorithm.algorithm=Rv(e.crv);let n=Jt.fromJSON(e,{targetSchema:_e.CurvePrivateKey});return t.privateKey=Ye.serialize(n),this.data=Buffer.from(Ye.serialize(t)),this}};s(lu,"EdPrivateKey");var hu=class extends Zi{constructor(){super(...arguments),this.type="public"}getKey(){return Je.parse(this.data,_e.PublicKeyInfo).publicKey}toJSON(){let e=this.getKey(),t={kty:"OKP",crv:this.algorithm.namedCurve,key_ops:this.usages,ext:this.extractable};return Object.assign(t,{x:An.Convert.ToBase64Url(e)})}fromJSON(e){if(!e.crv)throw new Oe("Cannot get named curve from JWK. Property 'crv' is required");if(!e.x)throw new Oe("Cannot get property from JWK. Property 'x' is required");let t=new _e.PublicKeyInfo;return t.publicKeyAlgorithm.algorithm=Rv(e.crv),t.publicKey=An.Convert.FromBase64Url(e.x),this.data=Buffer.from(Ye.serialize(t)),this}};s(hu,"EdPublicKey");var zr=class{static generateKey(e,t,n){return M(this,null,function*(){let i=new lu;i.algorithm=e,i.extractable=t,i.usages=n.filter(l=>this.privateKeyUsages.indexOf(l)!==-1);let o=new hu;o.algorithm=e,o.extractable=!0,o.usages=n.filter(l=>this.publicKeyUsages.indexOf(l)!==-1);let a=e.namedCurve.toLowerCase(),f=Be.default.generateKeyPairSync(a,{publicKeyEncoding:{format:"der",type:"spki"},privateKeyEncoding:{format:"der",type:"pkcs8"}});return i.data=f.privateKey,o.data=f.publicKey,{privateKey:i,publicKey:o}})}static sign(e,t,n){return M(this,null,function*(){t.pem||(t.pem=`-----BEGIN PRIVATE KEY-----
|
656
656
|
${t.data.toString("base64")}
|
657
|
-
-----END PRIVATE KEY-----`);let i={key:t.pem},
|
657
|
+
-----END PRIVATE KEY-----`);let i={key:t.pem},o=Be.default.sign(null,Buffer.from(n),i);return pi.BufferSourceConverter.toArrayBuffer(o)})}static verify(e,t,n,i){return M(this,null,function*(){t.pem||(t.pem=`-----BEGIN PUBLIC KEY-----
|
658
658
|
${t.data.toString("base64")}
|
659
|
-
-----END PUBLIC KEY-----`);let s={key:t.pem};return Be.default.verify(null,Buffer.from(i),s,Buffer.from(n))})}static deriveBits(e,t,n){return M(this,null,function*(){let i=Be.default.createPublicKey({key:e.public.data,format:"der",type:"spki"}),s=Be.default.createPrivateKey({key:t.data,format:"der",type:"pkcs8"}),a=Be.default.diffieHellman({publicKey:i,privateKey:s});return new Uint8Array(a).buffer.slice(0,n>>3)})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;case"raw":return We.parse(t.data,Ae.PublicKeyInfo).publicKey;default:throw new Oe("format: Must be 'jwk', 'raw', pkcs8' or 'spki'")}})}static importKey(e,t,n,i,s){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":{let a=t;if(a.d){let c=Vt.fromJSON(t,{targetSchema:Ae.CurvePrivateKey});return this.importPrivateKey(c,n,i,s)}else{if(!a.x)throw new TypeError("keyData: Cannot get required 'x' filed");return this.importPublicKey(yn.Convert.FromBase64Url(a.x),n,i,s)}}case"raw":return this.importPublicKey(t,n,i,s);case"spki":{let a=We.parse(new Uint8Array(t),Ae.PublicKeyInfo);return this.importPublicKey(a.publicKey,n,i,s)}case"pkcs8":{let a=We.parse(new Uint8Array(t),Ae.PrivateKeyInfo),c=We.parse(a.privateKey,Ae.CurvePrivateKey);return this.importPrivateKey(c,n,i,s)}default:throw new Oe("format: Must be 'jwk', 'raw', 'pkcs8' or 'spki'")}})}static importPrivateKey(e,t,n,i){let s=new eu;return s.fromJSON({crv:t.namedCurve,d:yn.Convert.ToBase64Url(e.d)}),s.algorithm=Object.assign({},t),s.extractable=n,s.usages=i,s}static importPublicKey(e,t,n,i){return M(this,null,function*(){let s=new tu;return s.fromJSON({crv:t.namedCurve,x:yn.Convert.ToBase64Url(e)}),s.algorithm=Object.assign({},t),s.extractable=n,s.usages=i,s})}};o($r,"EdCrypto");$r.publicKeyUsages=["verify"];$r.privateKeyUsages=["sign","deriveKey","deriveBits"];var gh=class extends Hf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield $r.generateKey({name:this.name,namedCurve:e.namedCurve.replace(/^ed/i,"Ed")},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return $r.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return $r.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return $r.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield $r.importKey(e,t,be(ne({},n),{name:this.name}),i,s);return Le(a)})}};o(gh,"EdDsaProvider");var yh=class extends Ff{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield $r.generateKey({name:this.name,namedCurve:e.namedCurve.toUpperCase()},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onDeriveBits(e,t,n){return M(this,null,function*(){return yield $r.deriveBits(be(ne({},e),{public:xe(e.public)}),xe(t),n)})}onExportKey(e,t){return M(this,null,function*(){return $r.exportKey(e,xe(t))})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a=yield $r.importKey(e,t,be(ne({},n),{name:this.name}),i,s);return Le(a)})}};o(yh,"EcdhEsProvider");var ru=class extends vn{};o(ru,"PbkdfCryptoKey");var vh=class extends jf{onDeriveBits(e,t,n){return M(this,null,function*(){return new Promise((i,s)=>{let a=ui.BufferSourceConverter.toArrayBuffer(e.salt),c=e.hash.name.replace("-","");Be.default.pbkdf2(xe(t).data,Buffer.from(a),e.iterations,n>>3,c,(f,l)=>{f?s(f):i(new Uint8Array(l).buffer)})})})}onImportKey(e,t,n,i,s){return M(this,null,function*(){if(e==="raw"){let a=new ru;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=!1,a.usages=s,Le(a)}throw new Oe("format: Must be 'raw'")})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof ru))throw new TypeError("key: Is not PBKDF CryptoKey")}};o(vh,"Pbkdf2Provider");var Xs=class extends vn{get alg(){return`HS${this.algorithm.hash.name.toUpperCase().replace("SHA-","")}`}set alg(e){}};o(Xs,"HmacCryptoKey");Re([qt({name:"k",converter:_0})],Xs.prototype,"data",void 0);var wh=class extends zf{onGenerateKey(e,t,n){return M(this,null,function*(){let i=(e.length||this.getDefaultLength(e.hash.name))>>3<<3,s=new Xs;return s.algorithm=be(ne({},e),{length:i,name:this.name}),s.extractable=t,s.usages=n,s.data=Be.default.randomBytes(i>>3),Le(s)})}onSign(e,t,n){return M(this,null,function*(){let i=ar.getAlgorithmName(t.algorithm.hash),s=Be.default.createHmac(i,xe(t).data).update(Buffer.from(n)).digest();return new Uint8Array(s).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let s=ar.getAlgorithmName(t.algorithm.hash);return Be.default.createHmac(s,xe(t).data).update(Buffer.from(i)).digest().compare(Buffer.from(n))===0})}onImportKey(e,t,n,i,s){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Vt.fromJSON(t,{targetSchema:Xs});break;case"raw":a=new Xs,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm={hash:{name:n.hash.name},name:this.name,length:a.data.length<<3},a.extractable=i,a.usages=s,Le(a)})}onExportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Mr.toJSON(xe(t));case"raw":return new Uint8Array(xe(t).data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof Xs))throw new TypeError("key: Is not HMAC CryptoKey")}};o(wh,"HmacProvider");var nu=class extends vn{};o(nu,"HkdfCryptoKey");var xh=class extends Vf{onImportKey(e,t,n,i,s){return M(this,null,function*(){if(e.toLowerCase()!=="raw")throw new Oe("Operation not supported");let a=new nu;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=i,a.usages=s,Le(a)})}onDeriveBits(e,t,n){return M(this,null,function*(){let i=e.hash.name.replace("-",""),s=Be.default.createHash(i).digest().length,a=n/8,c=ui.BufferSourceConverter.toUint8Array(e.info),f=Be.default.createHmac(i,ui.BufferSourceConverter.toUint8Array(e.salt)).update(ui.BufferSourceConverter.toUint8Array(xe(t).data)).digest(),l=[Buffer.alloc(0)],h=Math.ceil(a/s)+1;for(let d=1;d<h;++d)l.push(Be.default.createHmac(i,f).update(Buffer.concat([l[d-1],c,Buffer.from([d])])).digest());return Buffer.concat(l).slice(0,a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof nu))throw new TypeError("key: Is not HKDF CryptoKey")}};o(xh,"HkdfProvider");var iu=class{static digest(e,t){let n=Be.default.createHash(e.name.toLowerCase(),{outputLength:e.length}).update(Buffer.from(t)).digest();return new Uint8Array(n).buffer}};o(iu,"ShakeCrypto");var _h=class extends Jf{onDigest(e,t){return M(this,null,function*(){return iu.digest(e,t)})}};o(_h,"Shake128Provider");var Ah=class extends Wf{onDigest(e,t){return M(this,null,function*(){return iu.digest(e,t)})}};o(Ah,"Shake256Provider");var Eh=class extends Fo{constructor(){var e;super(),this.providers.set(new Yl),this.providers.set(new Zl),this.providers.set(new Ql),this.providers.set(new Xl),this.providers.set(new eh),this.providers.set(new th),this.providers.set(new rh),this.providers.set(new nh),this.providers.set(new ih),this.providers.set(new sh),this.providers.set(new oh),this.providers.set(new ah),this.providers.set(new mh),this.providers.set(new bh),this.providers.set(new ch),this.providers.set(new fh),this.providers.set(new uh),this.providers.set(new lh),this.providers.set(new vh),this.providers.set(new wh),this.providers.set(new xh);let t=(e=/^v(\d+)/.exec(sv.version))===null||e===void 0?void 0:e[1];t&&parseInt(t,10)>=12&&(this.providers.set(new _h),this.providers.set(new Ah));let n=hi.getHashes();n.includes("sha3-256")&&this.providers.set(new hh),n.includes("sha3-384")&&this.providers.set(new dh),n.includes("sha3-512")&&this.providers.set(new ph),t&&parseInt(t,10)>=14&&(this.providers.set(new gh),this.providers.set(new yh))}};o(Eh,"SubtleCrypto");var su=class extends Yf{constructor(){super(...arguments),this.subtle=new Eh}getRandomValues(e){if(!ArrayBuffer.isView(e))throw new TypeError("Failed to execute 'getRandomValues' on 'Crypto': parameter 1 is not of type 'ArrayBufferView'");let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return Be.default.randomFillSync(t),e}};o(su,"Crypto");function IE(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node!="undefined"}o(IE,"isNodejs");var fv;IE()?fv=new su:fv=window.crypto;var PE=o((r,e)=>M(void 0,null,function*(){return ou(r.contents,{plugins:[...r.plugins,e]})}),"addPluginToWallet"),RE=o((r,e)=>M(void 0,null,function*(){return ou([...r.contents,e],r)}),"addToWallet"),UE=o((r,e)=>M(void 0,null,function*(){let t=JSON.parse(JSON.stringify(r.contents)),n=t.find(i=>i.id===e);return ou(t.filter(i=>i.id!==n.id),r)}),"removeFromWallet"),LE=o((r,e)=>Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.bind(r,r)])),"bindMethods"),ou=o((...t)=>M(void 0,[...t],function*(r=[],e={}){let{plugins:n=[]}=e,i=n.reduce((a,c)=>ne(ne({},a),c.pluginMethods),{}),s={contents:[...r],add:function(a){return RE(this,a)},remove:function(a){return UE(this,a)},status:"UNLOCKED",plugins:n,pluginMethods:i,addPlugin:function(a){return PE(this,a)}};return i&&(s.pluginMethods=LE(s,i)),s}),"generateWallet");function DE(r,e){try{var t=r()}catch(n){return e(n)}return t&&t.then?t.then(void 0,e):t}o(DE,"_catch");function KE(){let r=new Map;return function(e,t){try{let i=function(a){if(n)return a;let c=r.get(e.didUrl);return c!==void 0?c:Promise.resolve(t()).then(function(f){var l;return((l=f.didResolutionMetadata)==null?void 0:l.error)!=="notFound"&&r.set(e.didUrl,f),f})};o(i,"_temp2");let n,s=function(){if(e.params&&e.params["no-cache"]==="true")return n=1,Promise.resolve(t())}();return Promise.resolve(s&&s.then?s.then(i):i(s))}catch(n){return Promise.reject(n)}}}o(KE,"inMemoryCache");function $E(r,e){return e()}o($E,"noCache");var FE="(?:%[0-9a-fA-F]{2})",uv=`(?:[a-zA-Z0-9._-]|${FE})`,HE="([a-z0-9]+)",qE=`((?:${uv}*:)*(${uv}+))`,lv="[a-zA-Z0-9_.:%-]",zE=`;${lv}+=${lv}*`,jE=`((${zE})*)`,VE="(/[^#?]*)?",GE="([?][^#]*)?",JE="(#.*)?",WE=new RegExp(`^did:${HE}:${qE}${jE}${VE}${GE}${JE}$`);function E0(r){if(r===""||!r)return null;let e=r.match(WE);if(e){let t={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:r};if(e[4]){let n=e[4].slice(1).split(";");t.params={};for(let i of n){let s=i.split("=");t.params[s[0]]=s[1]}}return e[6]&&(t.path=e[6]),e[7]&&(t.query=e[7].slice(1)),e[8]&&(t.fragment=e[8].slice(1)),t}return null}o(E0,"parse");var Sh={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function YE(r){return function(e,t,n){try{return Promise.resolve(DE(function(){return Promise.resolve(r(e,t,n)).then(function(i){return be(ne({},Sh),{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i})})},function(i){return be(ne({},Sh),{didResolutionMetadata:{error:"notFound",message:i.toString()}})}))}catch(i){return Promise.reject(i)}}}o(YE,"wrapLegacyResolver");var au=class{constructor(e={},t={}){this.registry=void 0,this.cache=void 0,this.registry=e,this.cache=t.cache===!0?KE():t.cache||$E,t.legacyResolvers&&Object.keys(t.legacyResolvers).map(n=>{this.registry[n]||(this.registry[n]=YE(t.legacyResolvers[n]))})}resolve(e,t={}){try{let n=this,i=E0(e);if(i===null)return Promise.resolve(be(ne({},Sh),{didResolutionMetadata:{error:"invalidDid"}}));let s=n.registry[i.method];return s?Promise.resolve(n.cache(i,()=>s(i.did,i,n,t))):Promise.resolve(be(ne({},Sh),{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(n){return Promise.reject(n)}}};o(au,"Resolver");function di(r,e){e||(e=r.reduce((i,s)=>i+s.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}o(di,"concat");Dh();function Rv(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}o(Rv,"createCodec");var Pv=Rv("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),W0=Rv("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),u9=ne({utf8:Pv,"utf-8":Pv,hex:cc.base16,latin1:W0,ascii:W0,binary:W0},cc),Kh=u9;function Gt(r,e="utf8"){let t=Kh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}o(Gt,"fromString");function jt(r,e="utf8"){let t=Kh[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}o(jt,"toString");Dh();var Ym=ze(qv()),p6=ze(rm()),Xm=ze(gw()),pd=ze(ad()),m6=ze(Hw()),Tu=ze(Vw()),Zm=ze(o6()),Qm=ze(wc());function Cn(r){return jt(r,"base64url")}o(Cn,"bytesToBase64url");function zr(r){let e=r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return Gt(e,"base64url")}o(zr,"base64ToBytes");function e1(r){return Gt(r,"base58btc")}o(e1,"base58ToBytes");function Gm(r){let e=r.startsWith("0x")?r.substring(2):r;return Gt(e.toLowerCase(),"base16")}o(Gm,"hexToBytes");function Jm(r){return Cn(Gt(r))}o(Jm,"encodeBase64url");function b6(r){return jt(zr(r))}o(b6,"decodeBase64url");function oa(r){return jt(r,"base16")}o(oa,"bytesToHex");function g6(r){return Gt(r)}o(g6,"stringToBytes");function Ik({r,s:e,recoveryParam:t},n){let i=new Uint8Array(n?65:64);if(i.set(Gt(r,"base16"),0),i.set(Gt(e,"base16"),32),n){if(typeof t=="undefined")throw new Error("Signer did not return a recoveryParam");i[64]=t}return Cn(i)}o(Ik,"toJose");function Ok(r){let e=zr(r);if(e.length<64||e.length>65)throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`);let t=oa(e.slice(0,32)),n=oa(e.slice(32,64)),i=e.length===65?e[64]:void 0;return{r:t,s:n,recoveryParam:i}}o(Ok,"fromJose");function y6(r,e){return di([zr(r),zr(e)])}o(y6,"toSealed");var Pk=/^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/,Rk=/^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/,Uk=/^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;function Lk(r){if(typeof r=="string"){if(Pk.test(r))return Gm(r);if(Rk.test(r))return e1(r);if(Uk.test(r))return zr(r);throw TypeError("bad_key: Invalid private key format")}else{if(r instanceof Uint8Array)return r;throw TypeError("bad_key: Invalid private key format")}}o(Lk,"parseKey");function v6(r){let e=typeof r=="string"?Gt(r):r;return(0,Ym.hash)(e)}o(v6,"sha256");function Dk(r){return new Uint8Array(p6.keccak_256.arrayBuffer(r))}o(Dk,"keccak");function Kk(r){let e=Gt(r.slice(2),"base16");return`0x${jt(Dk(e).slice(-20),"base16")}`}o(Kk,"toEthereumAddress");function Wm(r,e=new Uint8Array(4)){let t=Gt(r.toString(),"base10");return e.set(t,4-t.length),e}o(Wm,"writeUint32BE");var Vm=o(r=>di([Wm(r.length),r]),"lengthAndInput");function w6(r,e,t,n,i){if(e!==256)throw new Error(`Unsupported key length: ${e}`);let s=di([Vm(Gt(t)),Vm(typeof n=="undefined"?new Uint8Array(0):n),Vm(typeof i=="undefined"?new Uint8Array(0):i),Wm(e)]);return(0,Ym.hash)(di([Wm(1),r,s]))}o(w6,"concatKDF");var fD=new Xm.ec("secp256k1");function x6(r){let e=Lk(r);if(e.length!==64)throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${e.length}`);return function(t){try{let n=typeof t=="string"?g6(t):t,i=(0,pd.sign)(e,n);return Promise.resolve(Cn(i))}catch(n){return Promise.reject(n)}}}o(x6,"EdDSASigner");function _6(r){return typeof r=="object"&&"r"in r&&"s"in r}o(_6,"instanceOfEcdsaSignature");function a6(r){return o(function(t,n){try{return Promise.resolve(n(t)).then(function(i){if(_6(i))return Ik(i,r);if(r&&typeof Ok(i).recoveryParam=="undefined")throw new Error("not_supported: ES256K-R not supported when signer doesn't provide a recovery param");return i})}catch(i){return Promise.reject(i)}},"sign")}o(a6,"ES256KSignerAlg");function c6(){return o(function(e,t){try{return Promise.resolve(t(e)).then(function(n){if(_6(n))throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");return n})}catch(n){return Promise.reject(n)}},"sign")}o(c6,"Ed25519SignerAlg");var $k={ES256K:a6(),"ES256K-R":a6(!0),Ed25519:c6(),EdDSA:c6()};function Fk(r){let e=$k[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}o(Fk,"SignerAlg");var t1=new Xm.ec("secp256k1");function dd(r,e=!1){let t=zr(r);if(t.length!==(e?65:64))throw new Error("wrong signature length");let n=oa(t.slice(0,32)),i=oa(t.slice(32,64)),s={r:n,s:i};return e&&(s.recoveryParam=t[64]),s}o(dd,"toSignatureObject");function r1(r){if(r.publicKeyBase58)return e1(r.publicKeyBase58);if(r.publicKeyBase64)return zr(r.publicKeyBase64);if(r.publicKeyHex)return Gm(r.publicKeyHex);if(r.publicKeyJwk&&r.publicKeyJwk.crv==="secp256k1"&&r.publicKeyJwk.x&&r.publicKeyJwk.y)return Gm(t1.keyFromPublic({x:oa(zr(r.publicKeyJwk.x)),y:oa(zr(r.publicKeyJwk.y))}).getPublic("hex"));if(r.publicKeyMultibase){let{base16:e,base58btc:t,base64:n,base64url:i}=cc;return e.decoder.or(t.decoder.or(n.decoder.or(i.decoder))).decode(r.publicKeyMultibase)}return new Uint8Array}o(r1,"extractPublicKeyBytes");function Hk(r,e,t){let n=v6(r),i=dd(e),s=t.filter(({ethereumAddress:f,blockchainAccountId:l})=>typeof f=="undefined"&&typeof l=="undefined"),a=t.filter(({ethereumAddress:f,blockchainAccountId:l})=>typeof f!="undefined"||typeof l!==void 0),c=s.find(f=>{try{let l=r1(f);return t1.keyFromPublic(l).verify(n,i)}catch(l){return!1}});if(!c&&a.length>0&&(c=A6(r,e,a)),!c)throw new Error("invalid_signature: Signature invalid for JWT");return c}o(Hk,"verifyES256K");function A6(r,e,t){let n;if(e.length>86)n=[dd(e,!0)];else{let a=dd(e,!1);n=[be(ne({},a),{recoveryParam:0}),be(ne({},a),{recoveryParam:1})]}let i=o(a=>{let c=v6(r),f=t1.recoverPubKey(c,a,a.recoveryParam),l=f.encode("hex"),h=f.encode("hex",!0),d=Kk(l);return t.find(x=>{var y,_,U;let E=oa(r1(x));return E===l||E===h||((y=x.ethereumAddress)==null?void 0:y.toLowerCase())===d||((_=x.blockchainAccountId)==null||(U=_.split("@eip155"))==null?void 0:U[0].toLowerCase())===d})},"checkSignatureAgainstSigner"),s=n.map(i).filter(a=>typeof a!="undefined");if(s.length===0)throw new Error("invalid_signature: Signature invalid for JWT");return s[0]}o(A6,"verifyRecoverableES256K");function f6(r,e,t){let n=g6(r),i=zr(e),s=t.find(a=>(0,pd.verify)(r1(a),n,i));if(!s)throw new Error("invalid_signature: Signature invalid for JWT");return s}o(f6,"verifyEd25519");var qk={ES256K:Hk,"ES256K-R":A6,Ed25519:f6,EdDSA:f6};function E6(r){let e=qk[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}o(E6,"VerifierAlgorithm");E6.toSignatureObject=dd;var S6=o(function(r,e,t={},n={}){try{t.alg||(t.alg=zk);let i=typeof r=="string"?r:u6(r,n.canonicalize),s=[u6(t,n.canonicalize),i].join("."),a=Fk(t.alg);return Promise.resolve(a(s,e)).then(function(c){return[s,c].join(".")})}catch(i){return Promise.reject(i)}},"createJWS");var zk="ES256K";function u6(r,e=!1){return Jm(e?(0,m6.default)(r):JSON.stringify(r))}o(u6,"encodeSection");function jk(r){let e=r.match(/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(e)return{header:JSON.parse(b6(e[1])),payload:e[2],signature:e[3],data:`${e[1]}.${e[2]}`};throw new Error("invalid_argument: Incorrect format JWS")}o(jk,"decodeJWS");function Vk({header:r,data:e,signature:t},n){return Array.isArray(n)||(n=[n]),E6(r.alg)(e,t,n)}o(Vk,"verifyJWSDecoded");function C6(r,e){let t=jk(r);return Vk(t,e)}o(C6,"verifyJWS");function Gk(r,e,t){for(var n;;){var i=r();if(ho(i)&&(i=i.v),!i)return s;if(i.then){n=0;break}var s=t();if(s&&s.then)if(ho(s))s=s.s;else{n=1;break}if(e){var a=e();if(a&&a.then&&!ho(a)){n=2;break}}}var c=new aa,f=Wt.bind(null,c,2);return(n===0?i.then(h):n===1?s.then(l):a.then(d)).then(void 0,f),c;function l(v){s=v;do{if(e&&(a=e(),a&&a.then&&!ho(a))){a.then(d).then(void 0,f);return}if(i=r(),!i||ho(i)&&!i.v){Wt(c,1,s);return}if(i.then){i.then(h).then(void 0,f);return}s=t(),ho(s)&&(s=s.v)}while(!s||!s.then);s.then(l).then(void 0,f)}o(l,"_resumeAfterBody");function h(v){v?(s=t(),s&&s.then?s.then(l).then(void 0,f):l(s)):Wt(c,1,s)}o(h,"_resumeAfterTest");function d(){(i=r())?i.then?i.then(h).then(void 0,f):h(i):Wt(c,1,s)}o(d,"_resumeAfterUpdate")}o(Gk,"_for");var k6=o(function(r,e){try{let n=function(l){if(c===null)throw new Error("failure: Failed to decrypt");return c};o(n,"_temp5");let t;Yk(r);let i=JSON.parse(b6(r.protected));if(i.enc!==e.enc)throw new Error(`not_supported: Decrypter does not supported: '${i.enc}'`);let s=y6(r.ciphertext,r.tag),a=new Uint8Array(Buffer.from(r.aad?`${r.protected}.${r.aad}`:r.protected)),c=null,f=function(){return i.alg==="dir"&&e.alg==="dir"?Promise.resolve(e.decrypt(s,zr(r.iv),a)).then(function(l){c=l}):function(){if(!r.recipients||r.recipients.length===0)throw new Error("bad_jwe: missing recipients");{let l=0;return Gk(function(){return!c&&l<r.recipients.length},function(){return l++},function(){let h=r.recipients[l];Object.assign(h.header,i);let d=function(){if(h.header.alg===e.alg)return Promise.resolve(e.decrypt(s,zr(r.iv),a,h)).then(function(v){c=v})}();if(d&&d.then)return d.then(function(){})})}}()}();return Promise.resolve(f&&f.then?f.then(n):n(f))}catch(t){return Promise.reject(t)}},"decryptJWE"),l6=typeof Symbol!="undefined"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Wt(r,e,t){if(!r.s){if(t instanceof aa)if(t.s)e&1&&(e=t.s),t=t.v;else{t.o=Wt.bind(null,r,e);return}if(t&&t.then){t.then(Wt.bind(null,r,e),Wt.bind(null,r,2));return}r.s=e,r.v=t;let n=r.o;n&&n(r)}}o(Wt,"_settle");var aa=function(){function r(){}return o(r,"_Pact"),r.prototype.then=function(e,t){let n=new r,i=this.s;if(i){let s=i&1?e:t;if(s){try{Wt(n,1,s(this.v))}catch(a){Wt(n,2,a)}return n}else return this}return this.o=function(s){try{let a=s.v;s.s&1?Wt(n,1,e?e(a):a):t?Wt(n,1,t(a)):Wt(n,2,a)}catch(a){Wt(n,2,a)}},n},r}();function ho(r){return r instanceof aa&&r.s&1}o(ho,"_isSettledPact");function Jk(r,e,t){var n=-1,i,s;function a(c){try{for(;++n<r.length&&(!t||!t());)if(c=e(n),c&&c.then)if(ho(c))c=c.v;else{c.then(a,s||(s=Wt.bind(null,i=new aa,2)));return}i?Wt(i,1,c):i=c}catch(f){Wt(i||(i=new aa),2,f)}}return o(a,"_cycle"),a(),i}o(Jk,"_forTo");function Wk(r,e,t){if(typeof r[l6]=="function"){let h=function(d){try{for(;!(i=n.next()).done&&(!t||!t());)if(d=e(i.value),d&&d.then)if(ho(d))d=d.v;else{d.then(h,a||(a=Wt.bind(null,s=new aa,2)));return}s?Wt(s,1,d):s=d}catch(v){Wt(s||(s=new aa),2,v)}};o(h,"_cycle");var n=r[l6](),i,s,a;if(h(),n.return){var c=o(function(d){try{i.done||n.return()}catch(v){}return d},"_fixup");if(s&&s.then)return s.then(c,function(d){throw c(d)});c()}return s}if(!("length"in r))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<r.length;l++)f.push(r[l]);return Jk(f,function(h){return e(f[h])},t)}o(Wk,"_forOf");function Yk(r){if(!(r.protected&&r.iv&&r.ciphertext&&r.tag))throw new Error("bad_jwe: missing properties");r.recipients&&r.recipients.map(e=>{if(!(e.header&&e.encrypted_key))throw new Error("bad_jwe: malformed recipients")})}o(Yk,"validateJWE");function h6({ciphertext:r,tag:e,iv:t,protectedHeader:n,recipient:i},s){let a={protected:n,iv:Cn(t),ciphertext:Cn(r),tag:Cn(e)};return s&&(a.aad=Cn(s)),i&&(a.recipients=[i]),a}o(h6,"encodeJWE");var T6=o(function(r,e,t={},n){try{if(e[0].alg==="dir"){if(e.length>1)throw new Error('not_supported: Can only do "dir" encryption to one key.');return Promise.resolve(e[0].encrypt(r,t,n)).then(function(i){return h6(i,n)})}else{let i=e[0].enc;if(!e.reduce((f,l)=>f&&l.enc===i,!0))throw new Error("invalid_argument: Incompatible encrypters passed");let s,a,c=Wk(e,function(f){let l=function(){return s?Promise.resolve(f.encryptCek==null?void 0:f.encryptCek(s)).then(function(h){if(h){var d,v;(d=a)==null||(v=d.recipients)==null||v.push(h)}}):Promise.resolve(f.encrypt(r,t,n)).then(function(h){s=h.cek,a=h6(h,n)})}();if(l&&l.then)return l.then(function(){})});return Promise.resolve(c&&c.then?c.then(function(){return a}):a)}}catch(i){return Promise.reject(i)}},"createJWE");var M6=o(function(r,e){try{let t=o(function(i){try{return Promise.resolve(e.resolve(i)).then(function({didResolutionMetadata:s,didDocument:a}){var c;if(s!=null&&s.error||a==null)throw new Error(`resolver_error: Could not resolve ${i}: ${s.error}, ${s.message}`);if(!a.keyAgreement)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);let l=((c=a.keyAgreement)==null?void 0:c.map(h=>typeof h=="string"?[...a.publicKey||[],...a.verificationMethod||[]].find(d=>d.id===h):h).filter(h=>typeof h!="undefined")).filter(h=>h.type==="X25519KeyAgreementKey2019"&&Boolean(h.publicKeyBase58));if(!l.length)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);return l.map(h=>Zk(e1(h.publicKeyBase58),h.id))})}catch(s){return Promise.reject(s)}},"encryptersForDID"),n=r.map(i=>t(i));return Promise.resolve(Promise.all(n)).then(function(i){return[].concat(...i)})}catch(t){return Promise.reject(t)}},"resolveX25519Encrypters");function B6(r){let e=new Zm.XChaCha20Poly1305(r);return(t,n)=>{let i=(0,Qm.randomBytes)(e.nonceLength),s=e.seal(i,t,n);return{ciphertext:s.subarray(0,s.length-e.tagLength),tag:s.subarray(s.length-e.tagLength),iv:i}}}o(B6,"xc20pEncrypter");function Xk(r){let e=o(function(s,a={},c){try{let f=Jm(JSON.stringify(Object.assign({alg:i},a,{enc:n}))),l=new Uint8Array(Buffer.from(c?`${f}.${Cn(c)}`:f));return Promise.resolve(be(ne({},t(s,l)),{protectedHeader:f}))}catch(f){return Promise.reject(f)}},"encrypt"),t=B6(r),n="XC20P",i="dir";return{alg:i,enc:n,encrypt:e}}o(Xk,"xc20pDirEncrypter");function d6(r){let e=o(function(n,i,s){try{return Promise.resolve(t.open(i,n,s))}catch(a){return Promise.reject(a)}},"decrypt"),t=new Zm.XChaCha20Poly1305(r);return{alg:"dir",enc:"XC20P",decrypt:e}}o(d6,"xc20pDirDecrypter");function Zk(r,e){let t=o(function(c,f={},l){try{Object.assign(f,{alg:void 0});let h=(0,Qm.randomBytes)(32);return Promise.resolve(Xk(h).encrypt(c,f,l)).then(function(d){return Promise.resolve(n(h)).then(function(v){return be(ne({},d),{recipient:v,cek:h})})})}catch(h){return Promise.reject(h)}},"encrypt"),n=o(function(c){try{let f=(0,Tu.generateKeyPair)(),l=(0,Tu.sharedKey)(f.secretKey,r),h=w6(l,s,i),d=B6(h)(c),v={encrypted_key:Cn(d.ciphertext),header:{alg:i,iv:Cn(d.iv),tag:Cn(d.tag),epk:{kty:"OKP",crv:a,x:Cn(f.publicKey)}}};return e&&(v.header.kid=e),Promise.resolve(v)}catch(f){return Promise.reject(f)}},"encryptCek"),i="ECDH-ES+XC20PKW",s=256,a="X25519";return{alg:i,enc:"XC20P",encrypt:t,encryptCek:n}}o(Zk,"x25519Encrypter");function Qk(r){if(!(r&&r.epk&&r.iv&&r.tag))throw new Error("bad_jwe: malformed header")}o(Qk,"validateHeader");function N6(r){let e=o(function(s,a,c,f){try{let d=function(){let _=w6(x,n,t),U=y6(f.encrypted_key,f.header.tag);return Promise.resolve(d6(_).decrypt(U,zr(f.header.iv))).then(function(E){return E===null?null:d6(E).decrypt(s,a,c)})};o(d,"_temp4");var l,h;if(Qk((l=f)==null?void 0:l.header),f=f,((h=f.header.epk)==null?void 0:h.crv)!==i||typeof f.header.epk.x=="undefined")return Promise.resolve(null);let v=zr(f.header.epk.x),x,y=function(){if(r instanceof Uint8Array)x=(0,Tu.sharedKey)(r,v);else return Promise.resolve(r(v)).then(function(_){x=_})}();return Promise.resolve(y&&y.then?y.then(d):d(y))}catch(d){return Promise.reject(d)}},"decrypt"),t="ECDH-ES+XC20PKW",n=256,i="X25519";return{alg:t,enc:"XC20P",decrypt:e}}o(N6,"x25519Decrypter");J0();var md=o(({enumerable:r=!0,configurable:e=!1}={})=>({enumerable:r,configurable:e,writable:!1}),"readonly"),n1=o(function*(r,e){if(r!=null&&!(r instanceof Uint8Array))for(let[t,n]of Object.entries(r)){let i=[...e,t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,a]of n.entries()){let c=[...i,s],f=Ie.asCID(a);f?yield[c.join("/"),f]:typeof a=="object"&&(yield*n1(a,c))}else{let s=Ie.asCID(n);s?yield[i.join("/"),s]:yield*n1(n,i)}}},"links"),i1=o(function*(r,e){if(r!=null)for(let[t,n]of Object.entries(r)){let i=[...e,t];if(yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ie.asCID(n))if(Array.isArray(n))for(let[s,a]of n.entries()){let c=[...i,s];yield c.join("/"),typeof a=="object"&&!Ie.asCID(a)&&(yield*i1(a,c))}else yield*i1(n,i)}},"tree"),eT=o((r,e)=>{let t=r;for(let[n,i]of e.entries()){if(t=t[i],t==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(a=>`[${JSON.stringify(a)}]`).join("")}`);let s=Ie.asCID(t);if(s)return{value:s,remaining:e.slice(n+1).join("/")}}return{value:t}},"get"),bd=class{constructor({cid:e,bytes:t,value:n}){if(!e||!t||typeof n=="undefined")throw new Error("Missing required argument");this.cid=e,this.bytes=t,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:md(),bytes:md(),value:md(),asBlock:md()})}links(){return n1(this.value,[])}tree(){return i1(this.value,[])}get(e="/"){return eT(this.value,e.split("/").filter(Boolean))}};o(bd,"Block");var ca=o(n=>M(void 0,[n],function*({value:r,codec:e,hasher:t}){if(typeof r=="undefined")throw new Error('Missing required argument "value"');if(!e||!t)throw new Error("Missing required argument: codec or hasher");let i=e.encode(r),s=yield t.digest(i),a=Ie.create(1,e.code,s);return new bd({value:r,bytes:i,cid:a})}),"encode");Xi();hu();j0();K0();var cs={};Mt(cs,{code:()=>m1,decode:()=>g1,encode:()=>b1,name:()=>UT});var tT=["string","number","bigint","symbol"],rT=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function I6(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(tT.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(nT(r))return"Buffer";let t=iT(r);return t||"Object"}o(I6,"is");function nT(r){return r&&r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer.call(null,r)}o(nT,"isBuffer");function iT(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(rT.includes(e))return e}o(iT,"getObjectType");var ue=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};o(ue,"Type");ue.uint=new ue(0,"uint",!0);ue.negint=new ue(1,"negint",!0);ue.bytes=new ue(2,"bytes",!0);ue.string=new ue(3,"string",!0);ue.array=new ue(4,"array",!1);ue.map=new ue(5,"map",!1);ue.tag=new ue(6,"tag",!1);ue.float=new ue(7,"float",!0);ue.false=new ue(7,"false",!0);ue.true=new ue(7,"true",!0);ue.null=new ue(7,"null",!0);ue.undefined=new ue(7,"undefined",!0);ue.break=new ue(7,"break",!0);var we=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};o(we,"Token");var Sc=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",sT=new TextDecoder,oT=new TextEncoder;function gd(r){return Sc&&globalThis.Buffer.isBuffer(r)}o(gd,"isBuffer");function o1(r){return r instanceof Uint8Array?gd(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}o(o1,"asU8A");var U6=Sc?(r,e,t)=>t-e>64?globalThis.Buffer.from(r.subarray(e,t)).toString("utf8"):P6(r,e,t):(r,e,t)=>t-e>64?sT.decode(r.subarray(e,t)):P6(r,e,t),L6=Sc?r=>r.length>64?globalThis.Buffer.from(r):O6(r):r=>r.length>64?oT.encode(r):O6(r),Ei=o(r=>Uint8Array.from(r),"fromArray"),Cc=Sc?(r,e,t)=>gd(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),D6=Sc?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),o1(globalThis.Buffer.concat(r,e))):(r,e)=>{let t=new Uint8Array(e),n=0;for(let i of r)n+i.length>t.length&&(i=i.subarray(0,t.length-n)),t.set(i,n),n+=i.length;return t},K6=Sc?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r);function $6(r,e){if(gd(r)&&gd(e))return r.compare(e);for(let t=0;t<r.length;t++)if(r[t]!==e[t])return r[t]<e[t]?-1:1;return 0}o($6,"compare");function O6(r,e=1/0){let t,n=r.length,i=null,s=[];for(let a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}o(O6,"utf8ToBytes");function P6(r,e,t){let n=[];for(;e<t;){let i=r[e],s=null,a=i>239?4:i>223?3:i>191?2:1;if(e+a<=t){let c,f,l,h;switch(a){case 1:i<128&&(s=i);break;case 2:c=r[e+1],(c&192)===128&&(h=(i&31)<<6|c&63,h>127&&(s=h));break;case 3:c=r[e+1],f=r[e+2],(c&192)===128&&(f&192)===128&&(h=(i&15)<<12|(c&63)<<6|f&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:c=r[e+1],f=r[e+2],l=r[e+3],(c&192)===128&&(f&192)===128&&(l&192)===128&&(h=(i&15)<<18|(c&63)<<12|(f&63)<<6|l&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),e+=a}return aT(n)}o(P6,"utf8Slice");var R6=4096;function aT(r){let e=r.length;if(e<=R6)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=R6));return t}o(aT,"decodeCodePointsArray");var cT=256,kc=class{constructor(e=cT){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=t.length-(this.maxCursor-this.cursor)-1;t.set(e,i)}else{if(t){let i=t.length-(this.maxCursor-this.cursor)-1;i<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=K6(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Cc(n,0,this.cursor)}else t=D6(this.chunks,this.cursor);return e&&this.reset(),t}};o(kc,"Bl");var De="CBOR decode error:",a1="CBOR encode error:",Mu=[];Mu[23]=1;Mu[24]=2;Mu[25]=3;Mu[26]=5;Mu[27]=9;function as(r,e,t){if(r.length-e<t)throw new Error(`${De} not enough data for type`)}o(as,"assertEnoughData");var er=[24,256,65536,4294967296,BigInt("18446744073709551616")];function nn(r,e,t){as(r,e,1);let n=r[e];if(t.strict===!0&&n<er[0])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(nn,"readUint8");function sn(r,e,t){as(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<er[1])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(sn,"readUint16");function on(r,e,t){as(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<er[2])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}o(on,"readUint32");function an(r,e,t){as(r,e,8);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3],i=r[e+4]*16777216+(r[e+5]<<16)+(r[e+6]<<8)+r[e+7],s=(BigInt(n)<<BigInt(32))+BigInt(i);if(t.strict===!0&&s<er[3])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(t.allowBigInt===!0)return s;throw new Error(`${De} integers outside of the safe integer range are not supported`)}o(an,"readUint64");function F6(r,e,t,n){return new we(ue.uint,nn(r,e+1,n),2)}o(F6,"decodeUint8");function H6(r,e,t,n){return new we(ue.uint,sn(r,e+1,n),3)}o(H6,"decodeUint16");function q6(r,e,t,n){return new we(ue.uint,on(r,e+1,n),5)}o(q6,"decodeUint32");function z6(r,e,t,n){return new we(ue.uint,an(r,e+1,n),9)}o(z6,"decodeUint64");function kn(r,e){return ur(r,0,e.value)}o(kn,"encodeUint");function ur(r,e,t){if(t<er[0]){let n=Number(t);r.push([e|n])}else if(t<er[1]){let n=Number(t);r.push([e|24,n])}else if(t<er[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<er[3]){let n=Number(t);r.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(t);if(n<er[4]){let i=[e|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=s&255,s=s>>8,i[7]=s&255,s=s>>8,i[6]=s&255,s=s>>8,i[5]=s&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,r.push(i)}else throw new Error(`${De} encountered BigInt larger than allowable range`)}}o(ur,"encodeUintValue");kn.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");ur.encodedSize=o(function(e){return e<er[0]?1:e<er[1]?2:e<er[2]?3:e<er[3]?5:9},"encodedSize");kn.compareTokens=o(function(e,t){return e.value<t.value?-1:e.value>t.value?1:0},"compareTokens");function j6(r,e,t,n){return new we(ue.negint,-1-nn(r,e+1,n),2)}o(j6,"decodeNegint8");function V6(r,e,t,n){return new we(ue.negint,-1-sn(r,e+1,n),3)}o(V6,"decodeNegint16");function G6(r,e,t,n){return new we(ue.negint,-1-on(r,e+1,n),5)}o(G6,"decodeNegint32");var c1=BigInt(-1),J6=BigInt(1);function W6(r,e,t,n){let i=an(r,e+1,n);if(typeof i!="bigint"){let s=-1-i;if(s>=Number.MIN_SAFE_INTEGER)return new we(ue.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${De} integers outside of the safe integer range are not supported`);return new we(ue.negint,c1-BigInt(i),9)}o(W6,"decodeNegint64");function yd(r,e){let t=e.value,n=typeof t=="bigint"?t*c1-J6:t*-1-1;ur(r,e.type.majorEncoded,n)}o(yd,"encodeNegint");yd.encodedSize=o(function(e){let t=e.value,n=typeof t=="bigint"?t*c1-J6:t*-1-1;return n<er[0]?1:n<er[1]?2:n<er[2]?3:n<er[3]?5:9},"encodedSize");yd.compareTokens=o(function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},"compareTokens");function Bu(r,e,t,n){as(r,e,t+n);let i=Cc(r,e+t,e+t+n);return new we(ue.bytes,i,t+n)}o(Bu,"toToken");function Y6(r,e,t,n){return Bu(r,e,1,t)}o(Y6,"decodeBytesCompact");function X6(r,e,t,n){return Bu(r,e,2,nn(r,e+1,n))}o(X6,"decodeBytes8");function Z6(r,e,t,n){return Bu(r,e,3,sn(r,e+1,n))}o(Z6,"decodeBytes16");function Q6(r,e,t,n){return Bu(r,e,5,on(r,e+1,n))}o(Q6,"decodeBytes32");function e3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer bytes lengths not supported`);return Bu(r,e,9,i)}o(e3,"decodeBytes64");function vd(r){return r.encodedBytes===void 0&&(r.encodedBytes=r.type===ue.string?L6(r.value):r.value),r.encodedBytes}o(vd,"tokenBytes");function Tc(r,e){let t=vd(e);ur(r,e.type.majorEncoded,t.length),r.push(t)}o(Tc,"encodeBytes");Tc.encodedSize=o(function(e){let t=vd(e);return ur.encodedSize(t.length)+t.length},"encodedSize");Tc.compareTokens=o(function(e,t){return uT(vd(e),vd(t))},"compareTokens");function uT(r,e){return r.length<e.length?-1:r.length>e.length?1:$6(r,e)}o(uT,"compareBytes");function Nu(r,e,t,n,i){let s=t+n;as(r,e,s);let a=new we(ue.string,U6(r,e+t,e+s),s);return i.retainStringBytes===!0&&(a.byteValue=Cc(r,e+t,e+s)),a}o(Nu,"toToken");function t3(r,e,t,n){return Nu(r,e,1,t,n)}o(t3,"decodeStringCompact");function r3(r,e,t,n){return Nu(r,e,2,nn(r,e+1,n),n)}o(r3,"decodeString8");function n3(r,e,t,n){return Nu(r,e,3,sn(r,e+1,n),n)}o(n3,"decodeString16");function i3(r,e,t,n){return Nu(r,e,5,on(r,e+1,n),n)}o(i3,"decodeString32");function s3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer string lengths not supported`);return Nu(r,e,9,i,n)}o(s3,"decodeString64");var o3=Tc;function Mc(r,e,t,n){return new we(ue.array,n,t)}o(Mc,"toToken");function a3(r,e,t,n){return Mc(r,e,1,t)}o(a3,"decodeArrayCompact");function c3(r,e,t,n){return Mc(r,e,2,nn(r,e+1,n))}o(c3,"decodeArray8");function f3(r,e,t,n){return Mc(r,e,3,sn(r,e+1,n))}o(f3,"decodeArray16");function u3(r,e,t,n){return Mc(r,e,5,on(r,e+1,n))}o(u3,"decodeArray32");function l3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer array lengths not supported`);return Mc(r,e,9,i)}o(l3,"decodeArray64");function h3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return Mc(r,e,1,1/0)}o(h3,"decodeArrayIndefinite");function wd(r,e){ur(r,ue.array.majorEncoded,e.value)}o(wd,"encodeArray");wd.compareTokens=kn.compareTokens;wd.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");function Bc(r,e,t,n){return new we(ue.map,n,t)}o(Bc,"toToken");function d3(r,e,t,n){return Bc(r,e,1,t)}o(d3,"decodeMapCompact");function p3(r,e,t,n){return Bc(r,e,2,nn(r,e+1,n))}o(p3,"decodeMap8");function m3(r,e,t,n){return Bc(r,e,3,sn(r,e+1,n))}o(m3,"decodeMap16");function b3(r,e,t,n){return Bc(r,e,5,on(r,e+1,n))}o(b3,"decodeMap32");function g3(r,e,t,n){let i=an(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer map lengths not supported`);return Bc(r,e,9,i)}o(g3,"decodeMap64");function y3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return Bc(r,e,1,1/0)}o(y3,"decodeMapIndefinite");function xd(r,e){ur(r,ue.map.majorEncoded,e.value)}o(xd,"encodeMap");xd.compareTokens=kn.compareTokens;xd.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");function v3(r,e,t,n){return new we(ue.tag,t,1)}o(v3,"decodeTagCompact");function w3(r,e,t,n){return new we(ue.tag,nn(r,e+1,n),2)}o(w3,"decodeTag8");function x3(r,e,t,n){return new we(ue.tag,sn(r,e+1,n),3)}o(x3,"decodeTag16");function _3(r,e,t,n){return new we(ue.tag,on(r,e+1,n),5)}o(_3,"decodeTag32");function A3(r,e,t,n){return new we(ue.tag,an(r,e+1,n),9)}o(A3,"decodeTag64");function _d(r,e){ur(r,ue.tag.majorEncoded,e.value)}o(_d,"encodeTag");_d.compareTokens=kn.compareTokens;_d.encodedSize=o(function(e){return ur.encodedSize(e.value)},"encodedSize");var bT=20,gT=21,yT=22,vT=23;function E3(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${De} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(ue.null,null,1):new we(ue.undefined,void 0,1)}o(E3,"decodeUndefined");function S3(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return new we(ue.break,void 0,1)}o(S3,"decodeBreak");function f1(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${De} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${De} Infinity values are not supported`)}return new we(ue.float,r,e)}o(f1,"createToken");function C3(r,e,t,n){return f1(u1(r,e+1),3,n)}o(C3,"decodeFloat16");function k3(r,e,t,n){return f1(l1(r,e+1),5,n)}o(k3,"decodeFloat32");function T3(r,e,t,n){return f1(I3(r,e+1),9,n)}o(T3,"decodeFloat64");function Ad(r,e,t){let n=e.value;if(n===!1)r.push([ue.float.majorEncoded|bT]);else if(n===!0)r.push([ue.float.majorEncoded|gT]);else if(n===null)r.push([ue.float.majorEncoded|yT]);else if(n===void 0)r.push([ue.float.majorEncoded|vT]);else{let i,s=!1;(!t||t.float64!==!0)&&(B3(n),i=u1(Xn,1),n===i||Number.isNaN(n)?(Xn[0]=249,r.push(Xn.slice(0,3)),s=!0):(N3(n),i=l1(Xn,1),n===i&&(Xn[0]=250,r.push(Xn.slice(0,5)),s=!0))),s||(wT(n),i=I3(Xn,1),Xn[0]=251,r.push(Xn.slice(0,9)))}}o(Ad,"encodeFloat");Ad.encodedSize=o(function(e,t){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!t||t.float64!==!0){B3(n);let i=u1(Xn,1);if(n===i||Number.isNaN(n))return 3;if(N3(n),i=l1(Xn,1),n===i)return 5}return 9},"encodedSize");var M3=new ArrayBuffer(9),Tn=new DataView(M3,1),Xn=new Uint8Array(M3,0);function B3(r){if(r===1/0)Tn.setUint16(0,31744,!1);else if(r===-1/0)Tn.setUint16(0,64512,!1);else if(Number.isNaN(r))Tn.setUint16(0,32256,!1);else{Tn.setFloat32(0,r);let e=Tn.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)Tn.setUint16(0,31744,!1);else if(t===0)Tn.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let i=t-127;i<-24?Tn.setUint16(0,0):i<-14?Tn.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Tn.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}o(B3,"encodeFloat16");function u1(r,e){if(r.length-e<2)throw new Error(`${De} not enough data for float16`);let t=(r[e]<<8)+r[e+1];if(t===31744)return 1/0;if(t===64512)return-1/0;if(t===32256)return NaN;let n=t>>10&31,i=t&1023,s;return n===0?s=i*u0(2,-24):n!==31?s=(i+1024)*u0(2,n-25):s=i===0?1/0:NaN,t&32768?-s:s}o(u1,"readFloat16");function N3(r){Tn.setFloat32(0,r,!1)}o(N3,"encodeFloat32");function l1(r,e){if(r.length-e<4)throw new Error(`${De} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}o(l1,"readFloat32");function wT(r){Tn.setFloat64(0,r,!1)}o(wT,"encodeFloat64");function I3(r,e){if(r.length-e<8)throw new Error(`${De} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}o(I3,"readFloat64");Ad.compareTokens=kn.compareTokens;function Qe(r,e,t){throw new Error(`${De} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}o(Qe,"invalidMinor");function Ed(r){return()=>{throw new Error(`${De} ${r}`)}}o(Ed,"errorer");var ye=[];for(let r=0;r<=23;r++)ye[r]=Qe;ye[24]=F6;ye[25]=H6;ye[26]=q6;ye[27]=z6;ye[28]=Qe;ye[29]=Qe;ye[30]=Qe;ye[31]=Qe;for(let r=32;r<=55;r++)ye[r]=Qe;ye[56]=j6;ye[57]=V6;ye[58]=G6;ye[59]=W6;ye[60]=Qe;ye[61]=Qe;ye[62]=Qe;ye[63]=Qe;for(let r=64;r<=87;r++)ye[r]=Y6;ye[88]=X6;ye[89]=Z6;ye[90]=Q6;ye[91]=e3;ye[92]=Qe;ye[93]=Qe;ye[94]=Qe;ye[95]=Ed("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)ye[r]=t3;ye[120]=r3;ye[121]=n3;ye[122]=i3;ye[123]=s3;ye[124]=Qe;ye[125]=Qe;ye[126]=Qe;ye[127]=Ed("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)ye[r]=a3;ye[152]=c3;ye[153]=f3;ye[154]=u3;ye[155]=l3;ye[156]=Qe;ye[157]=Qe;ye[158]=Qe;ye[159]=h3;for(let r=160;r<=183;r++)ye[r]=d3;ye[184]=p3;ye[185]=m3;ye[186]=b3;ye[187]=g3;ye[188]=Qe;ye[189]=Qe;ye[190]=Qe;ye[191]=y3;for(let r=192;r<=215;r++)ye[r]=v3;ye[216]=w3;ye[217]=x3;ye[218]=_3;ye[219]=A3;ye[220]=Qe;ye[221]=Qe;ye[222]=Qe;ye[223]=Qe;for(let r=224;r<=243;r++)ye[r]=Ed("simple values are not supported");ye[244]=Qe;ye[245]=Qe;ye[246]=Qe;ye[247]=E3;ye[248]=Ed("simple values are not supported");ye[249]=C3;ye[250]=k3;ye[251]=T3;ye[252]=Qe;ye[253]=Qe;ye[254]=Qe;ye[255]=S3;var Zn=[];for(let r=0;r<24;r++)Zn[r]=new we(ue.uint,r,1);for(let r=-1;r>=-24;r--)Zn[31-r]=new we(ue.negint,r,1);Zn[64]=new we(ue.bytes,new Uint8Array(0),1);Zn[96]=new we(ue.string,"",1);Zn[128]=new we(ue.array,0,1);Zn[160]=new we(ue.map,0,1);Zn[244]=new we(ue.false,!1,1);Zn[245]=new we(ue.true,!0,1);Zn[246]=new we(ue.null,null,1);function O3(r){switch(r.type){case ue.false:return Ei([244]);case ue.true:return Ei([245]);case ue.null:return Ei([246]);case ue.bytes:return r.value.length?void 0:Ei([64]);case ue.string:return r.value===""?Ei([96]):void 0;case ue.array:return r.value===0?Ei([128]):void 0;case ue.map:return r.value===0?Ei([160]):void 0;case ue.uint:return r.value<24?Ei([Number(r.value)]):void 0;case ue.negint:if(r.value>=-24)return Ei([31-Number(r.value)])}}o(O3,"quickEncodeToken");var _T={float64:!1,mapSorter:ST,quickEncodeToken:O3};function AT(){let r=[];return r[ue.uint.major]=kn,r[ue.negint.major]=yd,r[ue.bytes.major]=Tc,r[ue.string.major]=o3,r[ue.array.major]=wd,r[ue.map.major]=xd,r[ue.tag.major]=_d,r[ue.float.major]=Ad,r}o(AT,"makeCborEncoders");var P3=AT(),h1=new kc,ua=class{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${a1} object contains circular references`);return new ua(t,e)}};o(ua,"Ref");var po={null:new we(ue.null,null),undefined:new we(ue.undefined,void 0),true:new we(ue.true,!0),false:new we(ue.false,!1),emptyArray:new we(ue.array,0),emptyMap:new we(ue.map,0)},mo={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new we(ue.float,r):r>=0?new we(ue.uint,r):new we(ue.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new we(ue.uint,r):new we(ue.negint,r)},Uint8Array(r,e,t,n){return new we(ue.bytes,r)},string(r,e,t,n){return new we(ue.string,r)},boolean(r,e,t,n){return r?po.true:po.false},null(r,e,t,n){return po.null},undefined(r,e,t,n){return po.undefined},ArrayBuffer(r,e,t,n){return new we(ue.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new we(ue.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[po.emptyArray,new we(ue.break)]:po.emptyArray;n=ua.createCheck(n,r);let i=[],s=0;for(let a of r)i[s++]=Sd(a,t,n);return t.addBreakTokens?[new we(ue.array,r.length),i,new we(ue.break)]:[new we(ue.array,r.length),i]},Object(r,e,t,n){let i=e!=="Object",s=i?r.keys():Object.keys(r),a=i?r.size:s.length;if(!a)return t.addBreakTokens===!0?[po.emptyMap,new we(ue.break)]:po.emptyMap;n=ua.createCheck(n,r);let c=[],f=0;for(let l of s)c[f++]=[Sd(l,t,n),Sd(i?r.get(l):r[l],t,n)];return ET(c,t),t.addBreakTokens?[new we(ue.map,a),c,new we(ue.break)]:[new we(ue.map,a),c]}};mo.Map=mo.Object;mo.Buffer=mo.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))mo[`${r}Array`]=mo.DataView;function Sd(r,e={},t){let n=I6(r),i=e&&e.typeEncoders&&e.typeEncoders[n]||mo[n];if(typeof i=="function"){let a=i(r,n,e,t);if(a!=null)return a}let s=mo[n];if(!s)throw new Error(`${a1} unsupported type: ${n}`);return s(r,n,e,t)}o(Sd,"objectToTokens");function ET(r,e){e.mapSorter&&r.sort(e.mapSorter)}o(ET,"sortMapEntries");function ST(r,e){let t=Array.isArray(r[0])?r[0][0]:r[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(t.type!==n.type)return t.type.compare(n.type);let i=t.type.major,s=P3[i].compareTokens(t,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}o(ST,"mapSorter");function R3(r,e,t,n){if(Array.isArray(e))for(let i of e)R3(r,i,t,n);else t[e.type.major](r,e,n)}o(R3,"tokensToEncoded");function CT(r,e,t){let n=Sd(r,t);if(!Array.isArray(n)&&t.quickEncodeToken){let i=t.quickEncodeToken(n);if(i)return i;let s=e[n.type.major];if(s.encodedSize){let a=s.encodedSize(n,t),c=new kc(a);if(s(c,n,t),c.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return o1(c.chunks[0])}}return h1.reset(),R3(h1,n,e,t),h1.toBytes(!0)}o(CT,"encodeCustom");function d1(r,e){return e=Object.assign({},_T,e),CT(r,P3,e)}o(d1,"encode");var kT={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Cd=class{constructor(e,t={}){this.pos=0,this.data=e,this.options=t}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],t=Zn[e];if(t===void 0){let n=ye[e];if(!n)throw new Error(`${De} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;t=n(this.data,this.pos,i,this.options)}return this.pos+=t.encodedLength,t}};o(Cd,"Tokeniser");var Iu=Symbol.for("DONE"),kd=Symbol.for("BREAK");function TT(r,e,t){let n=[];for(let i=0;i<r.value;i++){let s=Ou(e,t);if(s===kd){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed array`)}if(s===Iu)throw new Error(`${De} found array but not enough entries (got ${i}, expected ${r.value})`);n[i]=s}return n}o(TT,"tokenToArray");function MT(r,e,t){let n=t.useMaps===!0,i=n?void 0:{},s=n?new Map:void 0;for(let a=0;a<r.value;a++){let c=Ou(e,t);if(c===kd){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed map`)}if(c===Iu)throw new Error(`${De} found map but not enough entries (got ${a} [no key], expected ${r.value})`);if(n!==!0&&typeof c!="string")throw new Error(`${De} non-string keys not supported (got ${typeof c})`);let f=Ou(e,t);if(f===Iu)throw new Error(`${De} found map but not enough entries (got ${a} [no value], expected ${r.value})`);n?s.set(c,f):i[c]=f}return n?s:i}o(MT,"tokenToMap");function Ou(r,e){if(r.done())return Iu;let t=r.next();if(t.type===ue.break)return kd;if(t.type.terminal)return t.value;if(t.type===ue.array)return TT(t,r,e);if(t.type===ue.map)return MT(t,r,e);if(t.type===ue.tag){if(e.tags&&typeof e.tags[t.value]=="function"){let n=Ou(r,e);return e.tags[t.value](n)}throw new Error(`${De} tag not supported (${t.value})`)}throw new Error("unsupported")}o(Ou,"tokensToObject");function p1(r,e){if(!(r instanceof Uint8Array))throw new Error(`${De} data to decode must be a Uint8Array`);e=Object.assign({},kT,e);let t=e.tokenizer||new Cd(r,e),n=Ou(t,e);if(n===Iu)throw new Error(`${De} did not find any content to decode`);if(n===kd)throw new Error(`${De} got unexpected break`);if(!t.done())throw new Error(`${De} too many terminals, data makes no sense`);return n}o(p1,"decode");Xi();var U3=42;function NT(r){if(r.asCID!==r)return null;let e=Ie.asCID(r);if(!e)return null;let t=new Uint8Array(e.bytes.byteLength+1);return t.set(e.bytes,1),[new we(ue.tag,U3),new we(ue.bytes,t)]}o(NT,"cidEncoder");function IT(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}o(IT,"undefinedEncoder");function OT(r){if(Number.isNaN(r))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(r===1/0||r===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}o(OT,"numberEncoder");var PT={float64:!0,typeEncoders:{Object:NT,undefined:IT,number:OT}};function RT(r){if(r[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ie.decode(r.subarray(1))}o(RT,"cidDecoder");var L3={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};L3.tags[U3]=RT;var UT="dag-cbor",m1=113,b1=o(r=>d1(r,PT),"encode"),g1=o(r=>p1(r,L3),"decode");var LT=24;function D3(r){return M(this,null,function*(){let e=yield ca({value:r,codec:cs,hasher:Wo});return{cid:e.cid,linkedBlock:e.bytes}})}o(D3,"encodePayload");function DT(r,e=LT){let t=(e-r.length%e)%e,n=new Uint8Array(r.length+t);return n.set(r,0),n}o(DT,"pad");function KT(r){return M(this,null,function*(){return(yield ca({value:r,codec:cs,hasher:Rh})).cid})}o(KT,"encodeIdentityCID");function $T(r){if(r=Ie.asCID(r),r.code!==m1)throw new Error("CID codec must be dag-cbor");if(r.multihash.code!==Rh.code)throw new Error("CID must use identity multihash");return g1(r.multihash.digest)}o($T,"decodeIdentityCID");function K3(r,e){return M(this,null,function*(){return DT((yield KT(r)).bytes,e)})}o(K3,"prepareCleartext");function $3(r){return $T(Ie.decodeFirst(r)[0])}o($3,"decodeCleartext");var F3=Symbol("abortable"),Td=Symbol("aborted");function H3(r,e){if(e.aborted)return Promise.reject(Td);let t,n=new Promise((i,s)=>{t=s});return e.addEventListener("abort",()=>{t(Td)}),Promise.race([r,n])}o(H3,"abortable");var q3=o((r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),"nanoid");var Md="utils_abort_request";var Ir;(function(r){r[r.PARSE_ERROR=-32700]="PARSE_ERROR",r[r.INVALID_REQUEST=-32600]="INVALID_REQUEST",r[r.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",r[r.INVALID_PARAMS=-32602]="INVALID_PARAMS",r[r.INTERNAL_ERROR=-32603]="INTERNAL_ERROR"})(Ir||(Ir={}));var z3={[Ir.PARSE_ERROR]:"Parse error",[Ir.INVALID_REQUEST]:"Invalid request",[Ir.METHOD_NOT_FOUND]:"Method not found",[Ir.INVALID_PARAMS]:"Invalid params",[Ir.INTERNAL_ERROR]:"Internal error"};function FT(r){return-32e3>=r&&r>=-32099}o(FT,"isServerError");function Bd(r){var e;return(e=z3[r.toString()])!=null?e:FT(r)?"Server error":"Application error"}o(Bd,"getErrorMessage");var jr=class extends Error{static fromObject(e){return new jr(e.code,e.message,e.data)}toObject(){return{code:this.code,data:this.data,message:this.message}}constructor(e,t,n){super(),Object.setPrototypeOf(this,jr.prototype),this.code=e,this.data=n,this.message=t!=null?t:Bd(e)}};o(jr,"RPCError");function Pu(r){let e=z3[r];return o(function(n){return new jr(r,e,n)},"createError")}o(Pu,"createErrorFactory");var HT=Pu(Ir.PARSE_ERROR),xK=Pu(Ir.INVALID_REQUEST),_K=Pu(Ir.METHOD_NOT_FOUND),AK=Pu(Ir.INVALID_PARAMS),EK=Pu(Ir.INTERNAL_ERROR);function qT(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(qT,"_checkPrivateRedeclaration");function zT(r,e){return e.get?e.get.call(r):e.value}o(zT,"_classApplyDescriptorGet");function jT(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(jT,"_classApplyDescriptorSet");function j3(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(j3,"_classExtractFieldDescriptor");function y1(r,e){var t=j3(r,e,"get");return zT(r,t)}o(y1,"_classPrivateFieldGet");function VT(r,e,t){qT(r,e),e.set(r,t)}o(VT,"_classPrivateFieldInit");function GT(r,e,t){var n=j3(r,e,"set");return jT(r,n,t),t}o(GT,"_classPrivateFieldSet");var Ru=new WeakMap,Nc=class{get connection(){return y1(this,Ru)}createID(){return q3()}request(e,t=void 0,n={}){let{signal:i}=n;if(i!=null&&i.aborted)return Promise.reject(Td);let s=this.createID(),a=y1(this,Ru).send({jsonrpc:"2.0",id:s,method:e,params:t}).then(c=>{if(c==null)throw new Error("Missing response");if(c.error!=null)throw jr.fromObject(c.error);return c.result});return i==null?a:(i.addEventListener("abort",()=>{this.notify(Md,{id:s})}),H3(a,i))}notify(e,t=void 0){return M(this,null,function*(){yield y1(this,Ru).send({jsonrpc:"2.0",method:e,params:t})})}constructor(e){VT(this,Ru,{writable:!0,value:void 0}),GT(this,Ru,e)}};o(Nc,"RPCClient");function V3(r,e){return{jsonrpc:"2.0",id:r,error:{code:e,message:Bd(e)}}}o(V3,"createErrorResponse");function JT(r,e,t){console.warn("Unhandled handler error",e,t)}o(JT,"fallbackOnHandlerError");function WT(r,e){console.warn("Unhandled invalid message",e)}o(WT,"fallbackOnInvalidMessage");function YT(r,e){console.warn("Unhandled notification",e)}o(YT,"fallbackOnNotification");function G3(r,e={}){var c,f,l;let t=(c=e.onHandlerError)!=null?c:JT,n=(f=e.onInvalidMessage)!=null?f:WT,i=(l=e.onNotification)!=null?l:YT,s={};function a(h,d){var v,x;if(d.method===Md){let y=(v=d.params)==null?void 0:v.id;y!=null&&((x=s[y])==null||x.abort())}else i(h,d)}return o(a,"handleNotification"),o(function(d,v){return M(this,null,function*(){var _,U,E;let x=v.id;if(v.jsonrpc!=="2.0"||v.method==null)return x==null?(n(d,v),null):V3(x,Ir.INVALID_REQUEST);let y=r[v.method];if(y==null)return x==null?(a(d,v),null):V3(x,Ir.METHOD_NOT_FOUND);try{let L;if(x!=null&&y[F3]){let F=new AbortController;s[x]=F,L=y(d,v.params,{signal:F.signal})}else L=y(d,v.params,{});let H=L==null?L:typeof L.then=="function"?yield L:L;return x==null||((_=s[x])==null?void 0:_.signal.aborted)?null:{jsonrpc:"2.0",id:x,result:H}}catch(L){if(x==null||((U=s[x])==null?void 0:U.signal.aborted))return t(d,v,L),null;let H;if(L instanceof jr)H=L.toObject();else{t(d,v,L);let F=(E=L.code)!=null?E:-32e3;H={code:F,message:L.message||Bd(F)}}return{jsonrpc:"2.0",id:x,error:H}}finally{x!=null&&delete s[x]}})},"handleRequest")}o(G3,"createHandler");Xi();var _5=ze(Dx(),1),Ar=ze(da(),1);function k1(){return k1=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},k1.apply(this,arguments)}o(k1,"_extends");var T1={name:"chainId",regex:"[-:a-zA-Z0-9]{5,41}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"}}}},mM={name:"accountId",regex:"[-:a-zA-Z0-9]{7,106}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"},2:{name:"address",regex:"[a-zA-Z0-9]{1,64}"}}}},M1={name:"assetName",regex:"[-:a-zA-Z0-9]{5,73}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,64}"}}}},bM={name:"assetType",regex:"[-:a-zA-Z0-9]{11,115}",parameters:{delimiter:"/",values:{0:T1,1:M1}}},gM={name:"assetId",regex:"[-:a-zA-Z0-9]{13,148}",parameters:{delimiter:"/",values:{0:T1,1:M1,2:{name:"tokenId",regex:"[-a-zA-Z0-9]{1,32}"}}}},$u={"2":T1,"10":mM,"19":{assetName:M1,assetType:bM,assetId:gM}};function Kx(r,e){return r.split(e.parameters.delimiter)}o(Kx,"splitParams");function Fu(r,e){var t=Kx(r,e),n={};return t.forEach(function(i,s){n[e.parameters.values[s].name]=i}),n}o(Fu,"getParams");function Uc(r,e){return Object.values(e.parameters.values).map(function(t){var n=r[t.name];return typeof n=="string"?n:Uc(n,t)}).join(e.parameters.delimiter)}o(Uc,"joinParams");function Hu(r,e){if(!new RegExp(e.regex).test(r))return!1;var t=Kx(r,e);if(t.length!==Object.keys(e.parameters.values).length)return!1;var n=t.map(function(i,s){return new RegExp(e.parameters.values[s].regex).test(i)}).filter(function(i){return!!i});return n.length===t.length}o(Hu,"isValidId");var vo=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}o(r,"ChainId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();vo.spec=$u["2"];var pa=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.address=t.address}o(r,"AccountId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);var i=Fu(n,this.spec),s=i.namespace,a=i.reference,c=i.address,f=new vo({namespace:s,reference:a});return new r({chainId:f,address:c}).toJSON()},"parse"),r.format=o(function(n){var i=new vo(n.chainId),s=k1({},i.toJSON(),{address:n.address});return Uc(s,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),address:this.address}},"toJSON"),r}();pa.spec=$u["10"];var B1=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}o(r,"AssetName"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();B1.spec=$u["19"].assetName;var yM=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.assetName=new B1(t.assetName)}o(r,"AssetType"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName}},"toJSON"),r}();yM.spec=$u["19"].assetType;var vM=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new vo(t.chainId),this.assetName=new B1(t.assetName),this.tokenId=t.tokenId}o(r,"AssetId"),r.parse=o(function(n){if(!Hu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Fu(n,this.spec)).toJSON()},"parse"),r.format=o(function(n){return Uc(n,this.spec)},"format");var e=r.prototype;return e.toString=o(function(){return r.format(this.toJSON())},"toString"),e.toJSON=o(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName.toJSON(),tokenId:this.tokenId}},"toJSON"),r}();vM.spec=$u["19"].assetId;var $x="logger/5.6.0";var Fx=!1,Hx=!1,Ud={debug:1,default:2,info:2,warning:3,error:4,off:5},qx=Ud.default,N1=null;function wM(){try{let r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(t){r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}o(wM,"_checkNormalize");var zx=wM(),I1;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(I1||(I1={}));var ei;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(ei||(ei={}));var jx="0123456789abcdef",He=class{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){let n=e.toLowerCase();Ud[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(qx>Ud[n])&&console.log.apply(console,t)}debug(...e){this._log(He.levels.DEBUG,e)}info(...e){this._log(He.levels.INFO,e)}warn(...e){this._log(He.levels.WARNING,e)}makeError(e,t,n){if(Hx)return this.makeError("censored error",t,{});t||(t=He.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(f=>{let l=n[f];try{if(l instanceof Uint8Array){let h="";for(let d=0;d<l.length;d++)h+=jx[l[d]>>4],h+=jx[l[d]&15];i.push(f+"=Uint8Array(0x"+h+")")}else i.push(f+"="+JSON.stringify(l))}catch(h){i.push(f+"="+JSON.stringify(n[f].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);let s=e,a="";switch(t){case ei.NUMERIC_FAULT:{a="NUMERIC_FAULT";let f=e;switch(f){case"overflow":case"underflow":case"division-by-zero":a+="-"+f;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case ei.CALL_EXCEPTION:case ei.INSUFFICIENT_FUNDS:case ei.MISSING_NEW:case ei.NONCE_EXPIRED:case ei.REPLACEMENT_UNDERPRICED:case ei.TRANSACTION_REPLACED:case ei.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let c=new Error(e);return c.reason=s,c.code=t,Object.keys(n).forEach(function(f){c[f]=n[f]}),c}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,He.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,i){e||this.throwError(t,n,i)}assertArgument(e,t,n,i){e||this.throwArgumentError(t,n,i)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),zx&&this.throwError("platform missing String.prototype.normalize",He.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:zx})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n?n=": "+n:n="",e<t&&this.throwError("missing argument"+n,He.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,He.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",He.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return N1||(N1=new He($x)),N1}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Fx){if(!e)return;this.globalLogger().throwError("error censorship permanent",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Hx=!!e,Fx=!!t}static setLogLevel(e){let t=Ud[e.toLowerCase()];if(t==null){He.globalLogger().warn("invalid log level - "+e);return}qx=t}static from(e){return new He(e)}};o(He,"Logger");He.errors=ei;He.levels=I1;var Vx="bytes/5.6.1";var Kt=new He(Vx);function Jx(r){return!!r.toHexString}o(Jx,"isHexable");function Lc(r){return r.slice||(r.slice=function(){let e=Array.prototype.slice.call(arguments);return Lc(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}o(Lc,"addSlice");function Wx(r){return ti(r)&&!(r.length%2)||P1(r)}o(Wx,"isBytesLike");function Gx(r){return typeof r=="number"&&r==r&&r%1===0}o(Gx,"isInteger");function P1(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!Gx(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){let t=r[e];if(!Gx(t)||t<0||t>=256)return!1}return!0}o(P1,"isBytes");function Ct(r,e){if(e||(e={}),typeof r=="number"){Kt.checkSafeUint53(r,"invalid arrayify value");let t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),Lc(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Jx(r)&&(r=r.toHexString()),ti(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Kt.throwArgumentError("hex data is odd-length","value",r));let n=[];for(let i=0;i<t.length;i+=2)n.push(parseInt(t.substring(i,i+2),16));return Lc(new Uint8Array(n))}return P1(r)?Lc(new Uint8Array(r)):Kt.throwArgumentError("invalid arrayify value","value",r)}o(Ct,"arrayify");function R1(r){let e=r.map(i=>Ct(i)),t=e.reduce((i,s)=>i+s.length,0),n=new Uint8Array(t);return e.reduce((i,s)=>(n.set(s,i),i+s.length),0),Lc(n)}o(R1,"concat");function xM(r,e){r=Ct(r),r.length>e&&Kt.throwArgumentError("value out of range","value",arguments[0]);let t=new Uint8Array(e);return t.set(r,e-r.length),Lc(t)}o(xM,"zeroPad");function ti(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}o(ti,"isHexString");var O1="0123456789abcdef";function xr(r,e){if(e||(e={}),typeof r=="number"){Kt.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=O1[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),Jx(r))return r.toHexString();if(ti(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":Kt.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(P1(r)){let t="0x";for(let n=0;n<r.length;n++){let i=r[n];t+=O1[(i&240)>>4]+O1[i&15]}return t}return Kt.throwArgumentError("invalid hexlify value","value",r)}o(xr,"hexlify");function Ld(r){if(typeof r!="string")r=xr(r);else if(!ti(r)||r.length%2)return null;return(r.length-2)/2}o(Ld,"hexDataLength");function Dd(r,e,t){return typeof r!="string"?r=xr(r):(!ti(r)||r.length%2)&&Kt.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}o(Dd,"hexDataSlice");function wo(r,e){for(typeof r!="string"?r=xr(r):ti(r)||Kt.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&Kt.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}o(wo,"hexZeroPad");function Kd(r){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Wx(r)){let t=Ct(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=xr(t.slice(0,32)),e.s=xr(t.slice(32,64))):t.length===65?(e.r=xr(t.slice(0,32)),e.s=xr(t.slice(32,64)),e.v=t[64]):Kt.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:Kt.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=xr(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){let i=xM(Ct(e._vs),32);e._vs=xr(i);let s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Kt.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),i[0]&=127;let a=xr(i);e.s==null?e.s=a:e.s!==a&&Kt.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?Kt.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Kt.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!ti(e.r)?Kt.throwArgumentError("signature missing or invalid r","signature",r):e.r=wo(e.r,32),e.s==null||!ti(e.s)?Kt.throwArgumentError("signature missing or invalid s","signature",r):e.s=wo(e.s,32);let t=Ct(e.s);t[0]>=128&&Kt.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);let n=xr(t);e._vs&&(ti(e._vs)||Kt.throwArgumentError("signature invalid _vs","signature",r),e._vs=wo(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&Kt.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}o(Kd,"splitSignature");var Xx=ze(_n());var Yx="bignumber/5.6.0";var _M=Xx.default.BN,b$=new He(Yx);function U1(r){return new _M(r,36).toString(16)}o(U1,"_base36To16");var Zx=ze(rm());function Dc(r){return"0x"+Zx.default.keccak_256(Ct(r))}o(Dc,"keccak256");var Qx="address/5.6.0";var qu=new He(Qx);function e5(r){ti(r,20)||qu.throwArgumentError("invalid address","address",r),r=r.toLowerCase();let e=r.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);let n=Ct(Dc(t));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}o(e5,"getChecksumAddress");var SM=9007199254740991;function CM(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}o(CM,"log10");var L1={};for(let r=0;r<10;r++)L1[String(r)]=String(r);for(let r=0;r<26;r++)L1[String.fromCharCode(65+r)]=String(10+r);var t5=Math.floor(CM(SM));function kM(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(n=>L1[n]).join("");for(;e.length>=t5;){let n=e.substring(0,t5);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}o(kM,"ibanChecksum");function r5(r){let e=null;if(typeof r!="string"&&qu.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=e5(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&qu.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==kM(r)&&qu.throwArgumentError("bad icap checksum","address",r),e=U1(r.substring(4));e.length<40;)e="0"+e;e=e5("0x"+e)}else qu.throwArgumentError("invalid address","address",r);return e}o(r5,"getAddress");var n5="properties/5.6.0";var O$=new He(n5);function Kc(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}o(Kc,"defineReadOnly");var i5="strings/5.6.0";var s5=new He(i5),zu;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(zu||(zu={}));var ma;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(ma||(ma={}));function TM(r,e,t,n,i){return s5.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}o(TM,"errorFunc");function o5(r,e,t,n,i){if(r===ma.BAD_PREFIX||r===ma.UNEXPECTED_CONTINUE){let s=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)s++;return s}return r===ma.OVERRUN?t.length-e-1:0}o(o5,"ignoreFunc");function MM(r,e,t,n,i){return r===ma.OVERLONG?(n.push(i),0):(n.push(65533),o5(r,e,t,n,i))}o(MM,"replaceFunc");var BM=Object.freeze({error:TM,ignore:o5,replace:MM});function ju(r,e=zu.current){e!=zu.current&&(s5.checkNormalize(),r=r.normalize(e));let t=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192),t.push(i&63|128);else if((i&64512)==55296){n++;let s=r.charCodeAt(n);if(n>=r.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");let a=65536+((i&1023)<<10)+(s&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return Ct(t)}o(ju,"toUtf8Bytes");var a5=`Ethereum Signed Message:
|
660
|
-
`;function D1(r){return typeof r=="string"&&(r=ju(r)),Dc(R1([ju(a5),ju(String(r.length)),r]))}o(D1,"hashMessage");var Ke=ze(_n()),ki=ze(vu());function $c(r,e,t){return t={path:e,exports:{},require:function(n,i){return NM(n,i==null?t.path:i)}},r(t,t.exports),t.exports}o($c,"createCommonjsModule");function NM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}o(NM,"commonjsRequire");var H1=f5;function f5(r,e){if(!r)throw new Error(e||"Assertion failed")}o(f5,"assert");f5.equal=o(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual");var ri=$c(function(r,e){"use strict";var t=e;function n(a,c){if(Array.isArray(a))return a.slice();if(!a)return[];var f=[];if(typeof a!="string"){for(var l=0;l<a.length;l++)f[l]=a[l]|0;return f}if(c==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var l=0;l<a.length;l+=2)f.push(parseInt(a[l]+a[l+1],16))}else for(var l=0;l<a.length;l++){var h=a.charCodeAt(l),d=h>>8,v=h&255;d?f.push(d,v):f.push(v)}return f}o(n,"toArray"),t.toArray=n;function i(a){return a.length===1?"0"+a:a}o(i,"zero2"),t.zero2=i;function s(a){for(var c="",f=0;f<a.length;f++)c+=i(a[f].toString(16));return c}o(s,"toHex"),t.toHex=s,t.encode=o(function(c,f){return f==="hex"?s(c):c},"encode")}),fn=$c(function(r,e){"use strict";var t=e;t.assert=H1,t.toArray=ri.toArray,t.zero2=ri.zero2,t.toHex=ri.toHex,t.encode=ri.encode;function n(f,l,h){var d=new Array(Math.max(f.bitLength(),h)+1);d.fill(0);for(var v=1<<l+1,x=f.clone(),y=0;y<d.length;y++){var _,U=x.andln(v-1);x.isOdd()?(U>(v>>1)-1?_=(v>>1)-U:_=U,x.isubn(_)):_=0,d[y]=_,x.iushrn(1)}return d}o(n,"getNAF"),t.getNAF=n;function i(f,l){var h=[[],[]];f=f.clone(),l=l.clone();for(var d=0,v=0,x;f.cmpn(-d)>0||l.cmpn(-v)>0;){var y=f.andln(3)+d&3,_=l.andln(3)+v&3;y===3&&(y=-1),_===3&&(_=-1);var U;(y&1)===0?U=0:(x=f.andln(7)+d&7,(x===3||x===5)&&_===2?U=-y:U=y),h[0].push(U);var E;(_&1)===0?E=0:(x=l.andln(7)+v&7,(x===3||x===5)&&y===2?E=-_:E=_),h[1].push(E),2*d===U+1&&(d=1-d),2*v===E+1&&(v=1-v),f.iushrn(1),l.iushrn(1)}return h}o(i,"getJSF"),t.getJSF=i;function s(f,l,h){var d="_"+l;f.prototype[l]=o(function(){return this[d]!==void 0?this[d]:this[d]=h.call(this)},"cachedProperty")}o(s,"cachedProperty"),t.cachedProperty=s;function a(f){return typeof f=="string"?t.toArray(f,"hex"):f}o(a,"parseBytes"),t.parseBytes=a;function c(f){return new Ke.default(f,"hex","le")}o(c,"intFromLE"),t.intFromLE=c}),Hd=fn.getNAF,IM=fn.getJSF,qd=fn.assert;function _o(r,e){this.type=r,this.p=new Ke.default(e.p,16),this.red=e.prime?Ke.default.red(e.prime):Ke.default.mont(this.p),this.zero=new Ke.default(0).toRed(this.red),this.one=new Ke.default(1).toRed(this.red),this.two=new Ke.default(2).toRed(this.red),this.n=e.n&&new Ke.default(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 t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(_o,"BaseCurve");var ba=_o;_o.prototype.point=o(function(){throw new Error("Not implemented")},"point");_o.prototype.validate=o(function(){throw new Error("Not implemented")},"validate");_o.prototype._fixedNafMul=o(function(e,t){qd(e.precomputed);var n=e._getDoubles(),i=Hd(t,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var a=[],c,f;for(c=0;c<i.length;c+=n.step){f=0;for(var l=c+n.step-1;l>=c;l--)f=(f<<1)+i[l];a.push(f)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),v=s;v>0;v--){for(c=0;c<a.length;c++)f=a[c],f===v?d=d.mixedAdd(n.points[c]):f===-v&&(d=d.mixedAdd(n.points[c].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");_o.prototype._wnafMul=o(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var s=i.points,a=Hd(t,n,this._bitLength),c=this.jpoint(null,null,null),f=a.length-1;f>=0;f--){for(var l=0;f>=0&&a[f]===0;f--)l++;if(f>=0&&l++,c=c.dblp(l),f<0)break;var h=a[f];qd(h!==0),e.type==="affine"?h>0?c=c.mixedAdd(s[h-1>>1]):c=c.mixedAdd(s[-h-1>>1].neg()):h>0?c=c.add(s[h-1>>1]):c=c.add(s[-h-1>>1].neg())}return e.type==="affine"?c.toP():c},"_wnafMul");_o.prototype._wnafMulAdd=o(function(e,t,n,i,s){var a=this._wnafT1,c=this._wnafT2,f=this._wnafT3,l=0,h,d,v;for(h=0;h<i;h++){v=t[h];var x=v._getNAFPoints(e);a[h]=x.wnd,c[h]=x.points}for(h=i-1;h>=1;h-=2){var y=h-1,_=h;if(a[y]!==1||a[_]!==1){f[y]=Hd(n[y],a[y],this._bitLength),f[_]=Hd(n[_],a[_],this._bitLength),l=Math.max(f[y].length,l),l=Math.max(f[_].length,l);continue}var U=[t[y],null,null,t[_]];t[y].y.cmp(t[_].y)===0?(U[1]=t[y].add(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg())):t[y].y.cmp(t[_].y.redNeg())===0?(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].add(t[_].neg())):(U[1]=t[y].toJ().mixedAdd(t[_]),U[2]=t[y].toJ().mixedAdd(t[_].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],L=IM(n[y],n[_]);for(l=Math.max(L[0].length,l),f[y]=new Array(l),f[_]=new Array(l),d=0;d<l;d++){var H=L[0][d]|0,F=L[1][d]|0;f[y][d]=E[(H+1)*3+(F+1)],f[_][d]=0,c[y]=U}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var R=!0;for(d=0;d<i;d++)D[d]=f[d][h]|0,D[d]!==0&&(R=!1);if(!R)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?v=c[d][Y-1>>1]:Y<0&&(v=c[d][-Y-1>>1].neg()),v.type==="affine"?j=j.mixedAdd(v):j=j.add(v))}}for(h=0;h<i;h++)c[h]=null;return s?j:j.toP()},"_wnafMulAdd");function Nn(r,e){this.curve=r,this.type=e,this.precomputed=null}o(Nn,"BasePoint");_o.BasePoint=Nn;Nn.prototype.eq=o(function(){throw new Error("Not implemented")},"eq");Nn.prototype.validate=o(function(){return this.curve.validate(this)},"validate");_o.prototype.decodePoint=o(function(e,t){e=fn.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?qd(e[e.length-1]%2===0):e[0]===7&&qd(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");Nn.prototype.encodeCompressed=o(function(e){return this.encode(e,!0)},"encodeCompressed");Nn.prototype._encode=o(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");Nn.prototype.encode=o(function(e,t){return fn.encode(this._encode(t),e)},"encode");Nn.prototype.precompute=o(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");Nn.prototype._hasDoubles=o(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");Nn.prototype._getDoubles=o(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,s=0;s<t;s+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");Nn.prototype._getNAFPoints=o(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),s=1;s<n;s++)t[s]=t[s-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");Nn.prototype._getBeta=o(function(){return null},"_getBeta");Nn.prototype.dblp=o(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp");var q1=$c(function(r){typeof Object.create=="function"?r.exports=o(function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):r.exports=o(function(t,n){if(n){t.super_=n;var i=o(function(){},"TempCtor");i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}},"inherits")}),OM=fn.assert;function In(r){ba.call(this,"short",r),this.a=new Ke.default(r.a,16).toRed(this.red),this.b=new Ke.default(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}o(In,"ShortCurve");q1(In,ba);var PM=In;In.prototype._getEndomorphism=o(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Ke.default(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new Ke.default(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(t))===0?n=s[0]:(n=s[1],OM(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(c){return{a:new Ke.default(c.a,16),b:new Ke.default(c.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");In.prototype._getEndoRoots=o(function(e){var t=e===this.p?this.red:Ke.default.mont(e),n=new Ke.default(2).toRed(t).redInvm(),i=n.redNeg(),s=new Ke.default(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(s).fromRed(),c=i.redSub(s).fromRed();return[a,c]},"_getEndoRoots");In.prototype._getEndoBasis=o(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),s=new Ke.default(1),a=new Ke.default(0),c=new Ke.default(0),f=new Ke.default(1),l,h,d,v,x,y,_,U=0,E,L;n.cmpn(0)!==0;){var H=i.div(n);E=i.sub(H.mul(n)),L=c.sub(H.mul(s));var F=f.sub(H.mul(a));if(!d&&E.cmp(t)<0)l=_.neg(),h=s,d=E.neg(),v=L;else if(d&&++U===2)break;_=E,i=n,n=E,c=s,s=L,f=a,a=F}x=E.neg(),y=L;var j=d.sqr().add(v.sqr()),D=x.sqr().add(y.sqr());return D.cmp(j)>=0&&(x=l,y=h),d.negative&&(d=d.neg(),v=v.neg()),x.negative&&(x=x.neg(),y=y.neg()),[{a:d,b:v},{a:x,b:y}]},"_getEndoBasis");In.prototype._endoSplit=o(function(e){var t=this.endo.basis,n=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),c=s.mul(n.a),f=a.mul(i.a),l=s.mul(n.b),h=a.mul(i.b),d=e.sub(c).sub(f),v=l.add(h).neg();return{k1:d,k2:v}},"_endoSplit");In.prototype.pointFromX=o(function(e,t){e=new Ke.default(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");In.prototype.validate=o(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate");In.prototype._endoWnafMulAdd=o(function(e,t,n){for(var i=this._endoWnafT1,s=this._endoWnafT2,a=0;a<e.length;a++){var c=this._endoSplit(t[a]),f=e[a],l=f._getBeta();c.k1.negative&&(c.k1.ineg(),f=f.neg(!0)),c.k2.negative&&(c.k2.ineg(),l=l.neg(!0)),i[a*2]=f,i[a*2+1]=l,s[a*2]=c.k1,s[a*2+1]=c.k2}for(var h=this._wnafMulAdd(1,i,s,a*2,n),d=0;d<a*2;d++)i[d]=null,s[d]=null;return h},"_endoWnafMulAdd");function rr(r,e,t,n){ba.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Ke.default(e,16),this.y=new Ke.default(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(rr,"Point");q1(rr,ba.BasePoint);In.prototype.point=o(function(e,t,n){return new rr(this,e,t,n)},"point");In.prototype.pointFromJSON=o(function(e,t){return rr.fromJSON(this,e,t)},"pointFromJSON");rr.prototype._getBeta=o(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");rr.prototype.toJSON=o(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]},"toJSON");rr.fromJSON=o(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function s(c){return e.point(c[0],c[1],n)}o(s,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(s))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(s))}},i},"fromJSON");rr.prototype.inspect=o(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");rr.prototype.isInfinity=o(function(){return this.inf},"isInfinity");rr.prototype.add=o(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");rr.prototype.dbl=o(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=s.redSqr().redISub(this.x.redAdd(this.x)),c=s.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,c)},"dbl");rr.prototype.getX=o(function(){return this.x.fromRed()},"getX");rr.prototype.getY=o(function(){return this.y.fromRed()},"getY");rr.prototype.mul=o(function(e){return e=new Ke.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");rr.prototype.mulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)},"mulAdd");rr.prototype.jmulAdd=o(function(e,t,n){var i=[this,t],s=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)},"jmulAdd");rr.prototype.eq=o(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");rr.prototype.neg=o(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=o(function(s){return s.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");rr.prototype.toJ=o(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function hr(r,e,t,n){ba.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Ke.default(0)):(this.x=new Ke.default(e,16),this.y=new Ke.default(t,16),this.z=new Ke.default(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(hr,"JPoint");q1(hr,ba.BasePoint);In.prototype.jpoint=o(function(e,t,n){return new hr(this,e,t,n)},"jpoint");hr.prototype.toP=o(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");hr.prototype.neg=o(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");hr.prototype.add=o(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),c=e.y.redMul(n.redMul(this.z)),f=i.redSub(s),l=a.redSub(c);if(f.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=f.redSqr(),d=h.redMul(f),v=i.redMul(h),x=l.redSqr().redIAdd(d).redISub(v).redISub(v),y=l.redMul(v.redISub(x)).redISub(a.redMul(d)),_=this.z.redMul(e.z).redMul(f);return this.curve.jpoint(x,y,_)},"add");hr.prototype.mixedAdd=o(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),s=this.y,a=e.y.redMul(t).redMul(this.z),c=n.redSub(i),f=s.redSub(a);if(c.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=c.redSqr(),h=l.redMul(c),d=n.redMul(l),v=f.redSqr().redIAdd(h).redISub(d).redISub(d),x=f.redMul(d.redISub(v)).redISub(s.redMul(h)),y=this.z.redMul(c);return this.curve.jpoint(v,x,y)},"mixedAdd");hr.prototype.dblp=o(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,s=this.curve.tinv,a=this.x,c=this.y,f=this.z,l=f.redSqr().redSqr(),h=c.redAdd(c);for(t=0;t<e;t++){var d=a.redSqr(),v=h.redSqr(),x=v.redSqr(),y=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),_=a.redMul(v),U=y.redSqr().redISub(_.redAdd(_)),E=_.redISub(U),L=y.redMul(E);L=L.redIAdd(L).redISub(x);var H=h.redMul(f);t+1<e&&(l=l.redMul(x)),a=U,f=H,h=L}return this.curve.jpoint(a,h.redMul(s),f)},"dblp");hr.prototype.dbl=o(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");hr.prototype._zeroDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i),l=f.redSqr().redISub(c).redISub(c),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),v=this.y.redSqr(),x=v.redSqr(),y=this.x.redAdd(v).redSqr().redISub(d).redISub(x);y=y.redIAdd(y);var _=d.redAdd(d).redIAdd(d),U=_.redSqr(),E=x.redIAdd(x);E=E.redIAdd(E),E=E.redIAdd(E),e=U.redISub(y).redISub(y),t=_.redMul(y.redISub(e)).redISub(E),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");hr.prototype._threeDbl=o(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),s=this.y.redSqr(),a=s.redSqr(),c=this.x.redAdd(s).redSqr().redISub(i).redISub(a);c=c.redIAdd(c);var f=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=f.redSqr().redISub(c).redISub(c);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=f.redMul(c.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),v=this.y.redSqr(),x=this.x.redMul(v),y=this.x.redSub(d).redMul(this.x.redAdd(d));y=y.redAdd(y).redIAdd(y);var _=x.redIAdd(x);_=_.redIAdd(_);var U=_.redAdd(_);e=y.redSqr().redISub(U),n=this.y.redAdd(this.z).redSqr().redISub(v).redISub(d);var E=v.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E),t=y.redMul(_.redISub(e)).redISub(E)}return this.curve.jpoint(e,t,n)},"_threeDbl");hr.prototype._dbl=o(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,s=i.redSqr().redSqr(),a=t.redSqr(),c=n.redSqr(),f=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(s)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(c),d=f.redSqr().redISub(h.redAdd(h)),v=h.redISub(d),x=c.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=f.redMul(v).redISub(x),_=n.redAdd(n).redMul(i);return this.curve.jpoint(d,y,_)},"_dbl");hr.prototype.trpl=o(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),s=e.redAdd(e).redIAdd(e),a=s.redSqr(),c=this.x.redAdd(t).redSqr().redISub(e).redISub(i);c=c.redIAdd(c),c=c.redAdd(c).redIAdd(c),c=c.redISub(a);var f=c.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=s.redIAdd(c).redSqr().redISub(a).redISub(f).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var v=this.x.redMul(f).redISub(d);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.y.redMul(h.redMul(l.redISub(h)).redISub(c.redMul(f)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var y=this.z.redAdd(c).redSqr().redISub(n).redISub(f);return this.curve.jpoint(v,x,y)},"trpl");hr.prototype.mul=o(function(e,t){return e=new Ke.default(e,t),this.curve._wnafMul(this,e)},"mul");hr.prototype.eq=o(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),s=n.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");hr.prototype.eqXToP=o(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),s=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP");hr.prototype.inspect=o(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)+">"},"inspect");hr.prototype.isInfinity=o(function(){return this.z.cmpn(0)===0},"isInfinity");var $d=$c(function(r,e){"use strict";var t=e;t.base=ba,t.short=PM,t.mont=null,t.edwards=null}),Fd=$c(function(r,e){"use strict";var t=e,n=fn.assert;function i(c){c.type==="short"?this.curve=new $d.short(c):c.type==="edwards"?this.curve=new $d.edwards(c):this.curve=new $d.mont(c),this.g=this.curve.g,this.n=this.curve.n,this.hash=c.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(i,"PresetCurve"),t.PresetCurve=i;function s(c,f){Object.defineProperty(t,c,{configurable:!0,enumerable:!0,get:function(){var l=new i(f);return Object.defineProperty(t,c,{configurable:!0,enumerable:!0,value:l}),l}})}o(s,"defineCurve"),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:ki.default.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:ki.default.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:ki.default.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:ki.default.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:ki.default.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:ki.default.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:ki.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch(c){a=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:ki.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function xo(r){if(!(this instanceof xo))return new xo(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=ri.toArray(r.entropy,r.entropyEnc||"hex"),t=ri.toArray(r.nonce,r.nonceEnc||"hex"),n=ri.toArray(r.pers,r.persEnc||"hex");H1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}o(xo,"HmacDRBG");var u5=xo;xo.prototype._init=o(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");xo.prototype._hmac=o(function(){return new ki.default.hmac(this.hash,this.K)},"hmac");xo.prototype._update=o(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");xo.prototype.reseed=o(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=ri.toArray(e,t),n=ri.toArray(n,i),H1(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");xo.prototype.generate=o(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=ri.toArray(n,i||"hex"),this._update(n));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var a=s.slice(0,e);return this._update(n),this._reseed++,ri.encode(a,t)},"generate");var F1=fn.assert;function _r(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}o(_r,"KeyPair");var z1=_r;_r.fromPublic=o(function(e,t,n){return t instanceof _r?t:new _r(e,{pub:t,pubEnc:n})},"fromPublic");_r.fromPrivate=o(function(e,t,n){return t instanceof _r?t:new _r(e,{priv:t,privEnc:n})},"fromPrivate");_r.prototype.validate=o(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");_r.prototype.getPublic=o(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");_r.prototype.getPrivate=o(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");_r.prototype._importPrivate=o(function(e,t){this.priv=new Ke.default(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");_r.prototype._importPublic=o(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?F1(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&F1(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");_r.prototype.derive=o(function(e){return e.validate()||F1(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");_r.prototype.sign=o(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");_r.prototype.verify=o(function(e,t){return this.ec.verify(e,t,this)},"verify");_r.prototype.inspect=o(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect");var RM=fn.assert;function zd(r,e){if(r instanceof zd)return r;this._importDER(r,e)||(RM(r.r&&r.s,"Signature without r or s"),this.r=new Ke.default(r.r,16),this.s=new Ke.default(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}o(zd,"Signature");var jd=zd;function UM(){this.place=0}o(UM,"Position");function K1(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,s=0,a=e.place;s<n;s++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}o(K1,"getLength");function c5(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}o(c5,"rmPadding");zd.prototype._importDER=o(function(e,t){e=fn.toArray(e,t);var n=new UM;if(e[n.place++]!==48)return!1;var i=K1(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var s=K1(e,n);if(s===!1)return!1;var a=e.slice(n.place,s+n.place);if(n.place+=s,e[n.place++]!==2)return!1;var c=K1(e,n);if(c===!1||e.length!==c+n.place)return!1;var f=e.slice(n.place,c+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(f[0]===0)if(f[1]&128)f=f.slice(1);else return!1;return this.r=new Ke.default(a),this.s=new Ke.default(f),this.recoveryParam=null,!0},"_importDER");function $1(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}o($1,"constructLength");zd.prototype.toDER=o(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=c5(t),n=c5(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];$1(i,t.length),i=i.concat(t),i.push(2),$1(i,n.length);var s=i.concat(n),a=[48];return $1(a,s.length),a=a.concat(s),fn.encode(a,e)},"toDER");var LM=o(function(){throw new Error("unsupported")},"rand"),l5=fn.assert;function Bn(r){if(!(this instanceof Bn))return new Bn(r);typeof r=="string"&&(l5(Object.prototype.hasOwnProperty.call(Fd,r),"Unknown curve "+r),r=Fd[r]),r instanceof Fd.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}o(Bn,"EC");var DM=Bn;Bn.prototype.keyPair=o(function(e){return new z1(this,e)},"keyPair");Bn.prototype.keyFromPrivate=o(function(e,t){return z1.fromPrivate(this,e,t)},"keyFromPrivate");Bn.prototype.keyFromPublic=o(function(e,t){return z1.fromPublic(this,e,t)},"keyFromPublic");Bn.prototype.genKeyPair=o(function(e){e||(e={});for(var t=new u5({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||LM(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Ke.default(2));;){var s=new Ke.default(t.generate(n));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair");Bn.prototype._truncateToN=o(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Bn.prototype.sign=o(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Ke.default(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),f=new u5({hash:this.hash,entropy:a,nonce:c,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Ke.default(1)),h=0;;h++){var d=i.k?i.k(h):new Ke.default(f.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var v=this.g.mul(d);if(!v.isInfinity()){var x=v.getX(),y=x.umod(this.n);if(y.cmpn(0)!==0){var _=d.invm(this.n).mul(y.mul(t.getPrivate()).iadd(e));if(_=_.umod(this.n),_.cmpn(0)!==0){var U=(v.getY().isOdd()?1:0)|(x.cmp(y)!==0?2:0);return i.canonical&&_.cmp(this.nh)>0&&(_=this.n.sub(_),U^=1),new jd({r:y,s:_,recoveryParam:U})}}}}}},"sign");Bn.prototype.verify=o(function(e,t,n,i){e=this._truncateToN(new Ke.default(e,16)),n=this.keyFromPublic(n,i),t=new jd(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var c=a.invm(this.n),f=c.mul(e).umod(this.n),l=c.mul(s).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(s)):(h=this.g.mulAdd(f,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(s)===0)},"verify");Bn.prototype.recoverPubKey=function(r,e,t,n){l5((3&t)===t,"The recovery param is more than two bits"),e=new jd(e,n);var i=this.n,s=new Ke.default(r),a=e.r,c=e.s,f=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),f):a=this.curve.pointFromX(a,f);var h=e.r.invm(i),d=i.sub(s).mul(h).umod(i),v=c.mul(h).umod(i);return this.g.mulAdd(d,a,v)};Bn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new jd(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(r,e,i)}catch(a){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var KM=$c(function(r,e){"use strict";var t=e;t.version="6.5.4",t.utils=fn,t.rand=function(){throw new Error("unsupported")},t.curve=$d,t.curves=Fd,t.ec=DM,t.eddsa=null}),h5=KM.ec;var d5="signing-key/5.6.1";var V1=new He(d5),j1=null;function Ti(){return j1||(j1=new h5("secp256k1")),j1}o(Ti,"getCurve");var Vd=class{constructor(e){Kc(this,"curve","secp256k1"),Kc(this,"privateKey",xr(e)),Ld(this.privateKey)!==32&&V1.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=Ti().keyFromPrivate(Ct(this.privateKey));Kc(this,"publicKey","0x"+t.getPublic(!1,"hex")),Kc(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Kc(this,"_isSigningKey",!0)}_addPoint(e){let t=Ti().keyFromPublic(Ct(this.publicKey)),n=Ti().keyFromPublic(Ct(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let t=Ti().keyFromPrivate(Ct(this.privateKey)),n=Ct(e);n.length!==32&&V1.throwArgumentError("bad digest length","digest",e);let i=t.sign(n,{canonical:!0});return Kd({recoveryParam:i.recoveryParam,r:wo("0x"+i.r.toString(16),32),s:wo("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let t=Ti().keyFromPrivate(Ct(this.privateKey)),n=Ti().keyFromPublic(Ct(G1(e)));return wo("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};o(Vd,"SigningKey");function p5(r,e){let t=Kd(e),n={r:Ct(t.r),s:Ct(t.s)};return"0x"+Ti().recoverPubKey(Ct(r),n,t.recoveryParam).encode("hex",!1)}o(p5,"recoverPublicKey");function G1(r,e){let t=Ct(r);if(t.length===32){let n=new Vd(t);return e?"0x"+Ti().keyFromPrivate(t).getPublic(!0,"hex"):n.publicKey}else{if(t.length===33)return e?xr(t):"0x"+Ti().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ti().keyFromPublic(t).getPublic(!0,"hex"):xr(t)}return V1.throwArgumentError("invalid public or private key","key","[REDACTED]")}o(G1,"computePublicKey");var m5="transactions/5.6.0";var dF=new He(m5),b5;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(b5||(b5={}));function g5(r){let e=G1(r);return r5(Dd(Dc(Dd(e,1)),12))}o(g5,"computeAddress");function y5(r,e){return g5(p5(Ct(r),e))}o(y5,"recoverAddress");var v5="wallet/5.6.0";var _F=new He(v5);function w5(r,e){return y5(D1(r),e)}o(w5,"verifyMessage");hu();var $M=`
|
659
|
+
-----END PUBLIC KEY-----`);let o={key:t.pem};return Be.default.verify(null,Buffer.from(i),o,Buffer.from(n))})}static deriveBits(e,t,n){return M(this,null,function*(){let i=Be.default.createPublicKey({key:e.public.data,format:"der",type:"spki"}),o=Be.default.createPrivateKey({key:t.data,format:"der",type:"pkcs8"}),a=Be.default.diffieHellman({publicKey:i,privateKey:o});return new Uint8Array(a).buffer.slice(0,n>>3)})}static exportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Or.toJSON(t);case"pkcs8":case"spki":return new Uint8Array(t.data).buffer;case"raw":return Je.parse(t.data,_e.PublicKeyInfo).publicKey;default:throw new Oe("format: Must be 'jwk', 'raw', pkcs8' or 'spki'")}})}static importKey(e,t,n,i,o){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":{let a=t;if(a.d){let f=Jt.fromJSON(t,{targetSchema:_e.CurvePrivateKey});return this.importPrivateKey(f,n,i,o)}else{if(!a.x)throw new TypeError("keyData: Cannot get required 'x' filed");return this.importPublicKey(An.Convert.FromBase64Url(a.x),n,i,o)}}case"raw":return this.importPublicKey(t,n,i,o);case"spki":{let a=Je.parse(new Uint8Array(t),_e.PublicKeyInfo);return this.importPublicKey(a.publicKey,n,i,o)}case"pkcs8":{let a=Je.parse(new Uint8Array(t),_e.PrivateKeyInfo),f=Je.parse(a.privateKey,_e.CurvePrivateKey);return this.importPrivateKey(f,n,i,o)}default:throw new Oe("format: Must be 'jwk', 'raw', 'pkcs8' or 'spki'")}})}static importPrivateKey(e,t,n,i){let o=new lu;return o.fromJSON({crv:t.namedCurve,d:An.Convert.ToBase64Url(e.d)}),o.algorithm=Object.assign({},t),o.extractable=n,o.usages=i,o}static importPublicKey(e,t,n,i){return M(this,null,function*(){let o=new hu;return o.fromJSON({crv:t.namedCurve,x:An.Convert.ToBase64Url(e)}),o.algorithm=Object.assign({},t),o.extractable=n,o.usages=i,o})}};s(zr,"EdCrypto");zr.publicKeyUsages=["verify"];zr.privateKeyUsages=["sign","deriveKey","deriveBits"];var Nh=class extends Qc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield zr.generateKey({name:this.name,namedCurve:e.namedCurve.replace(/^ed/i,"Ed")},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onSign(e,t,n){return M(this,null,function*(){return zr.sign(e,xe(t),new Uint8Array(n))})}onVerify(e,t,n,i){return M(this,null,function*(){return zr.verify(e,xe(t),new Uint8Array(n),new Uint8Array(i))})}onExportKey(e,t){return M(this,null,function*(){return zr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield zr.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}};s(Nh,"EdDsaProvider");var Oh=class extends Zc{onGenerateKey(e,t,n){return M(this,null,function*(){let i=yield zr.generateKey({name:this.name,namedCurve:e.namedCurve.toUpperCase()},t,n);return{privateKey:Le(i.privateKey),publicKey:Le(i.publicKey)}})}onDeriveBits(e,t,n){return M(this,null,function*(){return yield zr.deriveBits(be(ne({},e),{public:xe(e.public)}),xe(t),n)})}onExportKey(e,t){return M(this,null,function*(){return zr.exportKey(e,xe(t))})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a=yield zr.importKey(e,t,be(ne({},n),{name:this.name}),i,o);return Le(a)})}};s(Oh,"EcdhEsProvider");var du=class extends _n{};s(du,"PbkdfCryptoKey");var Ph=class extends ru{onDeriveBits(e,t,n){return M(this,null,function*(){return new Promise((i,o)=>{let a=pi.BufferSourceConverter.toArrayBuffer(e.salt),f=e.hash.name.replace("-","");Be.default.pbkdf2(xe(t).data,Buffer.from(a),e.iterations,n>>3,f,(c,l)=>{c?o(c):i(new Uint8Array(l).buffer)})})})}onImportKey(e,t,n,i,o){return M(this,null,function*(){if(e==="raw"){let a=new du;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=!1,a.usages=o,Le(a)}throw new Oe("format: Must be 'raw'")})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof du))throw new TypeError("key: Is not PBKDF CryptoKey")}};s(Ph,"Pbkdf2Provider");var ns=class extends _n{get alg(){return`HS${this.algorithm.hash.name.toUpperCase().replace("SHA-","")}`}set alg(e){}};s(ns,"HmacCryptoKey");Re([Vt({name:"k",converter:L0})],ns.prototype,"data",void 0);var Rh=class extends tu{onGenerateKey(e,t,n){return M(this,null,function*(){let i=(e.length||this.getDefaultLength(e.hash.name))>>3<<3,o=new ns;return o.algorithm=be(ne({},e),{length:i,name:this.name}),o.extractable=t,o.usages=n,o.data=Be.default.randomBytes(i>>3),Le(o)})}onSign(e,t,n){return M(this,null,function*(){let i=lr.getAlgorithmName(t.algorithm.hash),o=Be.default.createHmac(i,xe(t).data).update(Buffer.from(n)).digest();return new Uint8Array(o).buffer})}onVerify(e,t,n,i){return M(this,null,function*(){let o=lr.getAlgorithmName(t.algorithm.hash);return Be.default.createHmac(o,xe(t).data).update(Buffer.from(i)).digest().compare(Buffer.from(n))===0})}onImportKey(e,t,n,i,o){return M(this,null,function*(){let a;switch(e.toLowerCase()){case"jwk":a=Jt.fromJSON(t,{targetSchema:ns});break;case"raw":a=new ns,a.data=Buffer.from(t);break;default:throw new Oe("format: Must be 'jwk' or 'raw'")}return a.algorithm={hash:{name:n.hash.name},name:this.name,length:a.data.length<<3},a.extractable=i,a.usages=o,Le(a)})}onExportKey(e,t){return M(this,null,function*(){switch(e.toLowerCase()){case"jwk":return Or.toJSON(xe(t));case"raw":return new Uint8Array(xe(t).data).buffer;default:throw new Oe("format: Must be 'jwk' or 'raw'")}})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof ns))throw new TypeError("key: Is not HMAC CryptoKey")}};s(Rh,"HmacProvider");var pu=class extends _n{};s(pu,"HkdfCryptoKey");var Uh=class extends nu{onImportKey(e,t,n,i,o){return M(this,null,function*(){if(e.toLowerCase()!=="raw")throw new Oe("Operation not supported");let a=new pu;return a.data=Buffer.from(t),a.algorithm={name:this.name},a.extractable=i,a.usages=o,Le(a)})}onDeriveBits(e,t,n){return M(this,null,function*(){let i=e.hash.name.replace("-",""),o=Be.default.createHash(i).digest().length,a=n/8,f=pi.BufferSourceConverter.toUint8Array(e.info),c=Be.default.createHmac(i,pi.BufferSourceConverter.toUint8Array(e.salt)).update(pi.BufferSourceConverter.toUint8Array(xe(t).data)).digest(),l=[Buffer.alloc(0)],h=Math.ceil(a/o)+1;for(let d=1;d<h;++d)l.push(Be.default.createHmac(i,c).update(Buffer.concat([l[d-1],f,Buffer.from([d])])).digest());return Buffer.concat(l).slice(0,a)})}checkCryptoKey(e,t){if(super.checkCryptoKey(e,t),!(xe(e)instanceof pu))throw new TypeError("key: Is not HKDF CryptoKey")}};s(Uh,"HkdfProvider");var mu=class{static digest(e,t){let n=Be.default.createHash(e.name.toLowerCase(),{outputLength:e.length}).update(Buffer.from(t)).digest();return new Uint8Array(n).buffer}};s(mu,"ShakeCrypto");var Lh=class extends ou{onDigest(e,t){return M(this,null,function*(){return mu.digest(e,t)})}};s(Lh,"Shake128Provider");var Dh=class extends su{onDigest(e,t){return M(this,null,function*(){return mu.digest(e,t)})}};s(Dh,"Shake256Provider");var Fh=class extends Gs{constructor(){var e;super(),this.providers.set(new lh),this.providers.set(new dh),this.providers.set(new ph),this.providers.set(new hh),this.providers.set(new mh),this.providers.set(new bh),this.providers.set(new gh),this.providers.set(new yh),this.providers.set(new vh),this.providers.set(new wh),this.providers.set(new xh),this.providers.set(new Ah),this.providers.set(new Bh),this.providers.set(new Ih),this.providers.set(new _h),this.providers.set(new Eh),this.providers.set(new Sh),this.providers.set(new Ch),this.providers.set(new Ph),this.providers.set(new Rh),this.providers.set(new Uh);let t=(e=/^v(\d+)/.exec(Nv.version))===null||e===void 0?void 0:e[1];t&&parseInt(t,10)>=12&&(this.providers.set(new Lh),this.providers.set(new Dh));let n=bi.getHashes();n.includes("sha3-256")&&this.providers.set(new Th),n.includes("sha3-384")&&this.providers.set(new kh),n.includes("sha3-512")&&this.providers.set(new Mh),t&&parseInt(t,10)>=14&&(this.providers.set(new Nh),this.providers.set(new Oh))}};s(Fh,"SubtleCrypto");var bu=class extends au{constructor(){super(...arguments),this.subtle=new Fh}getRandomValues(e){if(!ArrayBuffer.isView(e))throw new TypeError("Failed to execute 'getRandomValues' on 'Crypto': parameter 1 is not of type 'ArrayBufferView'");let t=Buffer.from(e.buffer,e.byteOffset,e.byteLength);return Be.default.randomFillSync(t),e}};s(bu,"Crypto");function vS(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node!="undefined"}s(vS,"isNodejs");var Uv;vS()?Uv=new bu:Uv=window.crypto;var xS=s((r,e)=>M(void 0,null,function*(){return gu(r.contents,{plugins:[...r.plugins,e]})}),"addPluginToWallet"),AS=s((r,e)=>M(void 0,null,function*(){return gu([...r.contents,e],r)}),"addToWallet"),_S=s((r,e)=>M(void 0,null,function*(){let t=JSON.parse(JSON.stringify(r.contents)),n=t.find(i=>i.id===e);return gu(t.filter(i=>i.id!==n.id),r)}),"removeFromWallet"),ES=s((r,e)=>Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n.bind(r,r)])),"bindMethods"),gu=s((...t)=>M(void 0,[...t],function*(r=[],e={}){let{plugins:n=[]}=e,i=n.reduce((a,f)=>ne(ne({},a),f.pluginMethods),{}),o={contents:[...r],add:function(a){return AS(this,a)},remove:function(a){return _S(this,a)},status:"UNLOCKED",plugins:n,pluginMethods:i,addPlugin:function(a){return xS(this,a)}};return i&&(o.pluginMethods=ES(o,i)),o}),"generateWallet");function SS(r,e){try{var t=r()}catch(n){return e(n)}return t&&t.then?t.then(void 0,e):t}s(SS,"_catch");function CS(){let r=new Map;return function(e,t){try{let i=function(a){if(n)return a;let f=r.get(e.didUrl);return f!==void 0?f:Promise.resolve(t()).then(function(c){var l;return((l=c.didResolutionMetadata)==null?void 0:l.error)!=="notFound"&&r.set(e.didUrl,c),c})};s(i,"_temp2");let n,o=function(){if(e.params&&e.params["no-cache"]==="true")return n=1,Promise.resolve(t())}();return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(n){return Promise.reject(n)}}}s(CS,"inMemoryCache");function TS(r,e){return e()}s(TS,"noCache");var kS="(?:%[0-9a-fA-F]{2})",Lv=`(?:[a-zA-Z0-9._-]|${kS})`,MS="([a-z0-9]+)",BS=`((?:${Lv}*:)*(${Lv}+))`,Dv="[a-zA-Z0-9_.:%-]",IS=`;${Dv}+=${Dv}*`,NS=`((${IS})*)`,OS="(/[^#?]*)?",PS="([?][^#]*)?",RS="(#.*)?",US=new RegExp(`^did:${MS}:${BS}${NS}${OS}${PS}${RS}$`);function F0(r){if(r===""||!r)return null;let e=r.match(US);if(e){let t={did:`did:${e[1]}:${e[2]}`,method:e[1],id:e[2],didUrl:r};if(e[4]){let n=e[4].slice(1).split(";");t.params={};for(let i of n){let o=i.split("=");t.params[o[0]]=o[1]}}return e[6]&&(t.path=e[6]),e[7]&&(t.query=e[7].slice(1)),e[8]&&(t.fragment=e[8].slice(1)),t}return null}s(F0,"parse");var Kh={didResolutionMetadata:{},didDocument:null,didDocumentMetadata:{}};function LS(r){return function(e,t,n){try{return Promise.resolve(SS(function(){return Promise.resolve(r(e,t,n)).then(function(i){return be(ne({},Kh),{didResolutionMetadata:{contentType:"application/did+ld+json"},didDocument:i})})},function(i){return be(ne({},Kh),{didResolutionMetadata:{error:"notFound",message:i.toString()}})}))}catch(i){return Promise.reject(i)}}}s(LS,"wrapLegacyResolver");var yu=class{constructor(e={},t={}){this.registry=void 0,this.cache=void 0,this.registry=e,this.cache=t.cache===!0?CS():t.cache||TS,t.legacyResolvers&&Object.keys(t.legacyResolvers).map(n=>{this.registry[n]||(this.registry[n]=LS(t.legacyResolvers[n]))})}resolve(e,t={}){try{let n=this,i=F0(e);if(i===null)return Promise.resolve(be(ne({},Kh),{didResolutionMetadata:{error:"invalidDid"}}));let o=n.registry[i.method];return o?Promise.resolve(n.cache(i,()=>o(i.did,i,n,t))):Promise.resolve(be(ne({},Kh),{didResolutionMetadata:{error:"unsupportedDidMethod"}}))}catch(n){return Promise.reject(n)}}};s(yu,"Resolver");function gi(r,e){e||(e=r.reduce((i,o)=>i+o.length,0));let t=new Uint8Array(e),n=0;for(let i of r)t.set(i,n),n+=i.length;return t}s(gi,"concat");Qh();function fw(r,e,t,n){return{name:r,prefix:e,encoder:{name:r,prefix:e,encode:t},decoder:{decode:n}}}s(fw,"createCodec");var aw=fw("utf8","u",r=>{let e=new TextDecoder("utf8");return"u"+e.decode(r)},r=>new TextEncoder().encode(r.substring(1))),um=fw("ascii","a",r=>{let e="a";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e},r=>{r=r.substring(1);let e=new Uint8Array(r.length);for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e}),X9=ne({utf8:aw,"utf-8":aw,hex:vf.base16,latin1:um,ascii:um,binary:um},vf),ed=X9;function Yt(r,e="utf8"){let t=ed[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.decoder.decode(`${t.prefix}${r}`)}s(Yt,"fromString");function Gt(r,e="utf8"){let t=ed[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return t.encoder.encode(r).substring(1)}s(Gt,"toString");Qh();var l1=ze(bw()),$x=ze(gm()),h1=ze(z2()),Md=ze(Ad()),Hx=ze(mx()),Fu=ze(vx()),d1=ze(Ox()),p1=ze(If());function Bn(r){return Gt(r,"base64url")}s(Bn,"bytesToBase64url");function Gr(r){let e=r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"");return Yt(e,"base64url")}s(Gr,"base64ToBytes");function m1(r){return Yt(r,"base58btc")}s(m1,"base58ToBytes");function f1(r){let e=r.startsWith("0x")?r.substring(2):r;return Yt(e.toLowerCase(),"base16")}s(f1,"hexToBytes");function c1(r){return Bn(Yt(r))}s(c1,"encodeBase64url");function qx(r){return Gt(Gr(r))}s(qx,"decodeBase64url");function da(r){return Gt(r,"base16")}s(da,"bytesToHex");function zx(r){return Yt(r)}s(zx,"stringToBytes");function vk({r,s:e,recoveryParam:t},n){let i=new Uint8Array(n?65:64);if(i.set(Yt(r,"base16"),0),i.set(Yt(e,"base16"),32),n){if(typeof t=="undefined")throw new Error("Signer did not return a recoveryParam");i[64]=t}return Bn(i)}s(vk,"toJose");function wk(r){let e=Gr(r);if(e.length<64||e.length>65)throw new TypeError(`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`);let t=da(e.slice(0,32)),n=da(e.slice(32,64)),i=e.length===65?e[64]:void 0;return{r:t,s:n,recoveryParam:i}}s(wk,"fromJose");function jx(r,e){return gi([Gr(r),Gr(e)])}s(jx,"toSealed");var xk=/^(0x)?([a-fA-F0-9]{64}|[a-fA-F0-9]{128})$/,Ak=/^([1-9A-HJ-NP-Za-km-z]{44}|[1-9A-HJ-NP-Za-km-z]{88})$/,_k=/^([0-9a-zA-Z=\-_+/]{43}|[0-9a-zA-Z=\-_+/]{86})(={0,2})$/;function Ek(r){if(typeof r=="string"){if(xk.test(r))return f1(r);if(Ak.test(r))return m1(r);if(_k.test(r))return Gr(r);throw TypeError("bad_key: Invalid private key format")}else{if(r instanceof Uint8Array)return r;throw TypeError("bad_key: Invalid private key format")}}s(Ek,"parseKey");function Vx(r){let e=typeof r=="string"?Yt(r):r;return(0,l1.hash)(e)}s(Vx,"sha256");function Sk(r){return new Uint8Array($x.keccak_256.arrayBuffer(r))}s(Sk,"keccak");function Ck(r){let e=Yt(r.slice(2),"base16");return`0x${Gt(Sk(e).slice(-20),"base16")}`}s(Ck,"toEthereumAddress");function u1(r,e=new Uint8Array(4)){let t=Yt(r.toString(),"base10");return e.set(t,4-t.length),e}s(u1,"writeUint32BE");var a1=s(r=>gi([u1(r.length),r]),"lengthAndInput");function Wx(r,e,t,n,i){if(e!==256)throw new Error(`Unsupported key length: ${e}`);let o=gi([a1(Yt(t)),a1(typeof n=="undefined"?new Uint8Array(0):n),a1(typeof i=="undefined"?new Uint8Array(0):i),u1(e)]);return(0,l1.hash)(gi([u1(1),r,o]))}s(Wx,"concatKDF");var jF=new h1.ec("secp256k1");function Gx(r){let e=Ek(r);if(e.length!==64)throw new Error(`bad_key: Invalid private key format. Expecting 64 bytes, but got ${e.length}`);return function(t){try{let n=typeof t=="string"?zx(t):t,i=(0,Md.sign)(e,n);return Promise.resolve(Bn(i))}catch(n){return Promise.reject(n)}}}s(Gx,"EdDSASigner");function Jx(r){return typeof r=="object"&&"r"in r&&"s"in r}s(Jx,"instanceOfEcdsaSignature");function Px(r){return s(function(t,n){try{return Promise.resolve(n(t)).then(function(i){if(Jx(i))return vk(i,r);if(r&&typeof wk(i).recoveryParam=="undefined")throw new Error("not_supported: ES256K-R not supported when signer doesn't provide a recovery param");return i})}catch(i){return Promise.reject(i)}},"sign")}s(Px,"ES256KSignerAlg");function Rx(){return s(function(e,t){try{return Promise.resolve(t(e)).then(function(n){if(Jx(n))throw new Error("invalid_config: expected a signer function that returns a string instead of signature object");return n})}catch(n){return Promise.reject(n)}},"sign")}s(Rx,"Ed25519SignerAlg");var Tk={ES256K:Px(),"ES256K-R":Px(!0),Ed25519:Rx(),EdDSA:Rx()};function kk(r){let e=Tk[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}s(kk,"SignerAlg");var b1=new h1.ec("secp256k1");function kd(r,e=!1){let t=Gr(r);if(t.length!==(e?65:64))throw new Error("wrong signature length");let n=da(t.slice(0,32)),i=da(t.slice(32,64)),o={r:n,s:i};return e&&(o.recoveryParam=t[64]),o}s(kd,"toSignatureObject");function g1(r){if(r.publicKeyBase58)return m1(r.publicKeyBase58);if(r.publicKeyBase64)return Gr(r.publicKeyBase64);if(r.publicKeyHex)return f1(r.publicKeyHex);if(r.publicKeyJwk&&r.publicKeyJwk.crv==="secp256k1"&&r.publicKeyJwk.x&&r.publicKeyJwk.y)return f1(b1.keyFromPublic({x:da(Gr(r.publicKeyJwk.x)),y:da(Gr(r.publicKeyJwk.y))}).getPublic("hex"));if(r.publicKeyMultibase){let{base16:e,base58btc:t,base64:n,base64url:i}=vf;return e.decoder.or(t.decoder.or(n.decoder.or(i.decoder))).decode(r.publicKeyMultibase)}return new Uint8Array}s(g1,"extractPublicKeyBytes");function Mk(r,e,t){let n=Vx(r),i=kd(e),o=t.filter(({ethereumAddress:c,blockchainAccountId:l})=>typeof c=="undefined"&&typeof l=="undefined"),a=t.filter(({ethereumAddress:c,blockchainAccountId:l})=>typeof c!="undefined"||typeof l!==void 0),f=o.find(c=>{try{let l=g1(c);return b1.keyFromPublic(l).verify(n,i)}catch(l){return!1}});if(!f&&a.length>0&&(f=Yx(r,e,a)),!f)throw new Error("invalid_signature: Signature invalid for JWT");return f}s(Mk,"verifyES256K");function Yx(r,e,t){let n;if(e.length>86)n=[kd(e,!0)];else{let a=kd(e,!1);n=[be(ne({},a),{recoveryParam:0}),be(ne({},a),{recoveryParam:1})]}let i=s(a=>{let f=Vx(r),c=b1.recoverPubKey(f,a,a.recoveryParam),l=c.encode("hex"),h=c.encode("hex",!0),d=Ck(l);return t.find(A=>{var v,x,L;let _=da(g1(A));return _===l||_===h||((v=A.ethereumAddress)==null?void 0:v.toLowerCase())===d||((x=A.blockchainAccountId)==null||(L=x.split("@eip155"))==null?void 0:L[0].toLowerCase())===d})},"checkSignatureAgainstSigner"),o=n.map(i).filter(a=>typeof a!="undefined");if(o.length===0)throw new Error("invalid_signature: Signature invalid for JWT");return o[0]}s(Yx,"verifyRecoverableES256K");function Ux(r,e,t){let n=zx(r),i=Gr(e),o=t.find(a=>(0,Md.verify)(g1(a),n,i));if(!o)throw new Error("invalid_signature: Signature invalid for JWT");return o}s(Ux,"verifyEd25519");var Bk={ES256K:Mk,"ES256K-R":Yx,Ed25519:Ux,EdDSA:Ux};function Xx(r){let e=Bk[r];if(!e)throw new Error(`not_supported: Unsupported algorithm ${r}`);return e}s(Xx,"VerifierAlgorithm");Xx.toSignatureObject=kd;var Zx=s(function(r,e,t={},n={}){try{t.alg||(t.alg=Ik);let i=typeof r=="string"?r:Lx(r,n.canonicalize),o=[Lx(t,n.canonicalize),i].join("."),a=kk(t.alg);return Promise.resolve(a(o,e)).then(function(f){return[o,f].join(".")})}catch(i){return Promise.reject(i)}},"createJWS");var Ik="ES256K";function Lx(r,e=!1){return c1(e?(0,Hx.default)(r):JSON.stringify(r))}s(Lx,"encodeSection");function Nk(r){let e=r.match(/^([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)\.([a-zA-Z0-9_-]+)$/);if(e)return{header:JSON.parse(qx(e[1])),payload:e[2],signature:e[3],data:`${e[1]}.${e[2]}`};throw new Error("invalid_argument: Incorrect format JWS")}s(Nk,"decodeJWS");function Ok({header:r,data:e,signature:t},n){return Array.isArray(n)||(n=[n]),Xx(r.alg)(e,t,n)}s(Ok,"verifyJWSDecoded");function Qx(r,e){let t=Nk(r);return Ok(t,e)}s(Qx,"verifyJWS");function Pk(r,e,t){for(var n;;){var i=r();if(ys(i)&&(i=i.v),!i)return o;if(i.then){n=0;break}var o=t();if(o&&o.then)if(ys(o))o=o.s;else{n=1;break}if(e){var a=e();if(a&&a.then&&!ys(a)){n=2;break}}}var f=new pa,c=Zt.bind(null,f,2);return(n===0?i.then(h):n===1?o.then(l):a.then(d)).then(void 0,c),f;function l(y){o=y;do{if(e&&(a=e(),a&&a.then&&!ys(a))){a.then(d).then(void 0,c);return}if(i=r(),!i||ys(i)&&!i.v){Zt(f,1,o);return}if(i.then){i.then(h).then(void 0,c);return}o=t(),ys(o)&&(o=o.v)}while(!o||!o.then);o.then(l).then(void 0,c)}s(l,"_resumeAfterBody");function h(y){y?(o=t(),o&&o.then?o.then(l).then(void 0,c):l(o)):Zt(f,1,o)}s(h,"_resumeAfterTest");function d(){(i=r())?i.then?i.then(h).then(void 0,c):h(i):Zt(f,1,o)}s(d,"_resumeAfterUpdate")}s(Pk,"_for");var e6=s(function(r,e){try{let n=function(l){if(f===null)throw new Error("failure: Failed to decrypt");return f};s(n,"_temp5");let t;Lk(r);let i=JSON.parse(qx(r.protected));if(i.enc!==e.enc)throw new Error(`not_supported: Decrypter does not supported: '${i.enc}'`);let o=jx(r.ciphertext,r.tag),a=new Uint8Array(Buffer.from(r.aad?`${r.protected}.${r.aad}`:r.protected)),f=null,c=function(){return i.alg==="dir"&&e.alg==="dir"?Promise.resolve(e.decrypt(o,Gr(r.iv),a)).then(function(l){f=l}):function(){if(!r.recipients||r.recipients.length===0)throw new Error("bad_jwe: missing recipients");{let l=0;return Pk(function(){return!f&&l<r.recipients.length},function(){return l++},function(){let h=r.recipients[l];Object.assign(h.header,i);let d=function(){if(h.header.alg===e.alg)return Promise.resolve(e.decrypt(o,Gr(r.iv),a,h)).then(function(y){f=y})}();if(d&&d.then)return d.then(function(){})})}}()}();return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(t){return Promise.reject(t)}},"decryptJWE"),Dx=typeof Symbol!="undefined"?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Zt(r,e,t){if(!r.s){if(t instanceof pa)if(t.s)e&1&&(e=t.s),t=t.v;else{t.o=Zt.bind(null,r,e);return}if(t&&t.then){t.then(Zt.bind(null,r,e),Zt.bind(null,r,2));return}r.s=e,r.v=t;let n=r.o;n&&n(r)}}s(Zt,"_settle");var pa=function(){function r(){}return s(r,"_Pact"),r.prototype.then=function(e,t){let n=new r,i=this.s;if(i){let o=i&1?e:t;if(o){try{Zt(n,1,o(this.v))}catch(a){Zt(n,2,a)}return n}else return this}return this.o=function(o){try{let a=o.v;o.s&1?Zt(n,1,e?e(a):a):t?Zt(n,1,t(a)):Zt(n,2,a)}catch(a){Zt(n,2,a)}},n},r}();function ys(r){return r instanceof pa&&r.s&1}s(ys,"_isSettledPact");function Rk(r,e,t){var n=-1,i,o;function a(f){try{for(;++n<r.length&&(!t||!t());)if(f=e(n),f&&f.then)if(ys(f))f=f.v;else{f.then(a,o||(o=Zt.bind(null,i=new pa,2)));return}i?Zt(i,1,f):i=f}catch(c){Zt(i||(i=new pa),2,c)}}return s(a,"_cycle"),a(),i}s(Rk,"_forTo");function Uk(r,e,t){if(typeof r[Dx]=="function"){let h=function(d){try{for(;!(i=n.next()).done&&(!t||!t());)if(d=e(i.value),d&&d.then)if(ys(d))d=d.v;else{d.then(h,a||(a=Zt.bind(null,o=new pa,2)));return}o?Zt(o,1,d):o=d}catch(y){Zt(o||(o=new pa),2,y)}};s(h,"_cycle");var n=r[Dx](),i,o,a;if(h(),n.return){var f=s(function(d){try{i.done||n.return()}catch(y){}return d},"_fixup");if(o&&o.then)return o.then(f,function(d){throw f(d)});f()}return o}if(!("length"in r))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<r.length;l++)c.push(r[l]);return Rk(c,function(h){return e(c[h])},t)}s(Uk,"_forOf");function Lk(r){if(!(r.protected&&r.iv&&r.ciphertext&&r.tag))throw new Error("bad_jwe: missing properties");r.recipients&&r.recipients.map(e=>{if(!(e.header&&e.encrypted_key))throw new Error("bad_jwe: malformed recipients")})}s(Lk,"validateJWE");function Fx({ciphertext:r,tag:e,iv:t,protectedHeader:n,recipient:i},o){let a={protected:n,iv:Bn(t),ciphertext:Bn(r),tag:Bn(e)};return o&&(a.aad=Bn(o)),i&&(a.recipients=[i]),a}s(Fx,"encodeJWE");var t6=s(function(r,e,t={},n){try{if(e[0].alg==="dir"){if(e.length>1)throw new Error('not_supported: Can only do "dir" encryption to one key.');return Promise.resolve(e[0].encrypt(r,t,n)).then(function(i){return Fx(i,n)})}else{let i=e[0].enc;if(!e.reduce((c,l)=>c&&l.enc===i,!0))throw new Error("invalid_argument: Incompatible encrypters passed");let o,a,f=Uk(e,function(c){let l=function(){return o?Promise.resolve(c.encryptCek==null?void 0:c.encryptCek(o)).then(function(h){if(h){var d,y;(d=a)==null||(y=d.recipients)==null||y.push(h)}}):Promise.resolve(c.encrypt(r,t,n)).then(function(h){o=h.cek,a=Fx(h,n)})}();if(l&&l.then)return l.then(function(){})});return Promise.resolve(f&&f.then?f.then(function(){return a}):a)}}catch(i){return Promise.reject(i)}},"createJWE");var r6=s(function(r,e){try{let t=s(function(i){try{return Promise.resolve(e.resolve(i)).then(function({didResolutionMetadata:o,didDocument:a}){var f;if(o!=null&&o.error||a==null)throw new Error(`resolver_error: Could not resolve ${i}: ${o.error}, ${o.message}`);if(!a.keyAgreement)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);let l=((f=a.keyAgreement)==null?void 0:f.map(h=>typeof h=="string"?[...a.publicKey||[],...a.verificationMethod||[]].find(d=>d.id===h):h).filter(h=>typeof h!="undefined")).filter(h=>h.type==="X25519KeyAgreementKey2019"&&Boolean(h.publicKeyBase58));if(!l.length)throw new Error(`no_suitable_keys: Could not find x25519 key for ${i}`);return l.map(h=>Fk(m1(h.publicKeyBase58),h.id))})}catch(o){return Promise.reject(o)}},"encryptersForDID"),n=r.map(i=>t(i));return Promise.resolve(Promise.all(n)).then(function(i){return[].concat(...i)})}catch(t){return Promise.reject(t)}},"resolveX25519Encrypters");function n6(r){let e=new d1.XChaCha20Poly1305(r);return(t,n)=>{let i=(0,p1.randomBytes)(e.nonceLength),o=e.seal(i,t,n);return{ciphertext:o.subarray(0,o.length-e.tagLength),tag:o.subarray(o.length-e.tagLength),iv:i}}}s(n6,"xc20pEncrypter");function Dk(r){let e=s(function(o,a={},f){try{let c=c1(JSON.stringify(Object.assign({alg:i},a,{enc:n}))),l=new Uint8Array(Buffer.from(f?`${c}.${Bn(f)}`:c));return Promise.resolve(be(ne({},t(o,l)),{protectedHeader:c}))}catch(c){return Promise.reject(c)}},"encrypt"),t=n6(r),n="XC20P",i="dir";return{alg:i,enc:n,encrypt:e}}s(Dk,"xc20pDirEncrypter");function Kx(r){let e=s(function(n,i,o){try{return Promise.resolve(t.open(i,n,o))}catch(a){return Promise.reject(a)}},"decrypt"),t=new d1.XChaCha20Poly1305(r);return{alg:"dir",enc:"XC20P",decrypt:e}}s(Kx,"xc20pDirDecrypter");function Fk(r,e){let t=s(function(f,c={},l){try{Object.assign(c,{alg:void 0});let h=(0,p1.randomBytes)(32);return Promise.resolve(Dk(h).encrypt(f,c,l)).then(function(d){return Promise.resolve(n(h)).then(function(y){return be(ne({},d),{recipient:y,cek:h})})})}catch(h){return Promise.reject(h)}},"encrypt"),n=s(function(f){try{let c=(0,Fu.generateKeyPair)(),l=(0,Fu.sharedKey)(c.secretKey,r),h=Wx(l,o,i),d=n6(h)(f),y={encrypted_key:Bn(d.ciphertext),header:{alg:i,iv:Bn(d.iv),tag:Bn(d.tag),epk:{kty:"OKP",crv:a,x:Bn(c.publicKey)}}};return e&&(y.header.kid=e),Promise.resolve(y)}catch(c){return Promise.reject(c)}},"encryptCek"),i="ECDH-ES+XC20PKW",o=256,a="X25519";return{alg:i,enc:"XC20P",encrypt:t,encryptCek:n}}s(Fk,"x25519Encrypter");function Kk(r){if(!(r&&r.epk&&r.iv&&r.tag))throw new Error("bad_jwe: malformed header")}s(Kk,"validateHeader");function i6(r){let e=s(function(o,a,f,c){try{let d=function(){let x=Wx(A,n,t),L=jx(c.encrypted_key,c.header.tag);return Promise.resolve(Kx(x).decrypt(L,Gr(c.header.iv))).then(function(_){return _===null?null:Kx(_).decrypt(o,a,f)})};s(d,"_temp4");var l,h;if(Kk((l=c)==null?void 0:l.header),c=c,((h=c.header.epk)==null?void 0:h.crv)!==i||typeof c.header.epk.x=="undefined")return Promise.resolve(null);let y=Gr(c.header.epk.x),A,v=function(){if(r instanceof Uint8Array)A=(0,Fu.sharedKey)(r,y);else return Promise.resolve(r(y)).then(function(x){A=x})}();return Promise.resolve(v&&v.then?v.then(d):d(v))}catch(d){return Promise.reject(d)}},"decrypt"),t="ECDH-ES+XC20PKW",n=256,i="X25519";return{alg:t,enc:"XC20P",decrypt:e}}s(i6,"x25519Decrypter");cm();var Bd=s(({enumerable:r=!0,configurable:e=!1}={})=>({enumerable:r,configurable:e,writable:!1}),"readonly"),y1=s(function*(r,e){if(r!=null&&!(r instanceof Uint8Array))for(let[t,n]of Object.entries(r)){let i=[...e,t];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o],c=Ne.asCID(a);c?yield[f.join("/"),c]:typeof a=="object"&&(yield*y1(a,f))}else{let o=Ne.asCID(n);o?yield[i.join("/"),o]:yield*y1(n,i)}}},"links"),v1=s(function*(r,e){if(r!=null)for(let[t,n]of Object.entries(r)){let i=[...e,t];if(yield i.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ne.asCID(n))if(Array.isArray(n))for(let[o,a]of n.entries()){let f=[...i,o];yield f.join("/"),typeof a=="object"&&!Ne.asCID(a)&&(yield*v1(a,f))}else yield*v1(n,i)}},"tree"),$k=s((r,e)=>{let t=r;for(let[n,i]of e.entries()){if(t=t[i],t==null)throw new Error(`Object has no property at ${e.slice(0,n+1).map(a=>`[${JSON.stringify(a)}]`).join("")}`);let o=Ne.asCID(t);if(o)return{value:o,remaining:e.slice(n+1).join("/")}}return{value:t}},"get"),Id=class{constructor({cid:e,bytes:t,value:n}){if(!e||!t||typeof n=="undefined")throw new Error("Missing required argument");this.cid=e,this.bytes=t,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:Bd(),bytes:Bd(),value:Bd(),asBlock:Bd()})}links(){return y1(this.value,[])}tree(){return v1(this.value,[])}get(e="/"){return $k(this.value,e.split("/").filter(Boolean))}};s(Id,"Block");var ma=s(n=>M(void 0,[n],function*({value:r,codec:e,hasher:t}){if(typeof r=="undefined")throw new Error('Missing required argument "value"');if(!e||!t)throw new Error("Missing required argument: codec or hasher");let i=e.encode(r),o=yield t.digest(i),a=Ne.create(1,e.code,o);return new Id({value:r,bytes:i,cid:a})}),"encode");to();_u();sm();em();var ho={};It(ho,{code:()=>B1,decode:()=>N1,encode:()=>I1,name:()=>_M});var Hk=["string","number","bigint","symbol"],qk=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function o6(r){if(r===null)return"null";if(r===void 0)return"undefined";if(r===!0||r===!1)return"boolean";let e=typeof r;if(Hk.includes(e))return e;if(e==="function")return"Function";if(Array.isArray(r))return"Array";if(zk(r))return"Buffer";let t=jk(r);return t||"Object"}s(o6,"is");function zk(r){return r&&r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer.call(null,r)}s(zk,"isBuffer");function jk(r){let e=Object.prototype.toString.call(r).slice(8,-1);if(qk.includes(e))return e}s(jk,"getObjectType");var ue=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};s(ue,"Type");ue.uint=new ue(0,"uint",!0);ue.negint=new ue(1,"negint",!0);ue.bytes=new ue(2,"bytes",!0);ue.string=new ue(3,"string",!0);ue.array=new ue(4,"array",!1);ue.map=new ue(5,"map",!1);ue.tag=new ue(6,"tag",!1);ue.float=new ue(7,"float",!0);ue.false=new ue(7,"false",!0);ue.true=new ue(7,"true",!0);ue.null=new ue(7,"null",!0);ue.undefined=new ue(7,"undefined",!0);ue.break=new ue(7,"break",!0);var we=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};s(we,"Token");var Uf=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Vk=new TextDecoder,Wk=new TextEncoder;function Nd(r){return Uf&&globalThis.Buffer.isBuffer(r)}s(Nd,"isBuffer");function x1(r){return r instanceof Uint8Array?Nd(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r:Uint8Array.from(r)}s(x1,"asU8A");var c6=Uf?(r,e,t)=>t-e>64?globalThis.Buffer.from(r.subarray(e,t)).toString("utf8"):a6(r,e,t):(r,e,t)=>t-e>64?Vk.decode(r.subarray(e,t)):a6(r,e,t),u6=Uf?r=>r.length>64?globalThis.Buffer.from(r):s6(r):r=>r.length>64?Wk.encode(r):s6(r),ki=s(r=>Uint8Array.from(r),"fromArray"),Lf=Uf?(r,e,t)=>Nd(r)?new Uint8Array(r.subarray(e,t)):r.slice(e,t):(r,e,t)=>r.slice(e,t),l6=Uf?(r,e)=>(r=r.map(t=>t instanceof Uint8Array?t:globalThis.Buffer.from(t)),x1(globalThis.Buffer.concat(r,e))):(r,e)=>{let t=new Uint8Array(e),n=0;for(let i of r)n+i.length>t.length&&(i=i.subarray(0,t.length-n)),t.set(i,n),n+=i.length;return t},h6=Uf?r=>globalThis.Buffer.allocUnsafe(r):r=>new Uint8Array(r);function d6(r,e){if(Nd(r)&&Nd(e))return r.compare(e);for(let t=0;t<r.length;t++)if(r[t]!==e[t])return r[t]<e[t]?-1:1;return 0}s(d6,"compare");function s6(r,e=1/0){let t,n=r.length,i=null,o=[];for(let a=0;a<n;++a){if(t=r.charCodeAt(a),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}s(s6,"utf8ToBytes");function a6(r,e,t){let n=[];for(;e<t;){let i=r[e],o=null,a=i>239?4:i>223?3:i>191?2:1;if(e+a<=t){let f,c,l,h;switch(a){case 1:i<128&&(o=i);break;case 2:f=r[e+1],(f&192)===128&&(h=(i&31)<<6|f&63,h>127&&(o=h));break;case 3:f=r[e+1],c=r[e+2],(f&192)===128&&(c&192)===128&&(h=(i&15)<<12|(f&63)<<6|c&63,h>2047&&(h<55296||h>57343)&&(o=h));break;case 4:f=r[e+1],c=r[e+2],l=r[e+3],(f&192)===128&&(c&192)===128&&(l&192)===128&&(h=(i&15)<<18|(f&63)<<12|(c&63)<<6|l&63,h>65535&&h<1114112&&(o=h))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),e+=a}return Gk(n)}s(a6,"utf8Slice");var f6=4096;function Gk(r){let e=r.length;if(e<=f6)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=f6));return t}s(Gk,"decodeCodePointsArray");var Jk=256,Df=class{constructor(e=Jk){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let i=t.length-(this.maxCursor-this.cursor)-1;t.set(e,i)}else{if(t){let i=t.length-(this.maxCursor-this.cursor)-1;i<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,i),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=h6(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Lf(n,0,this.cursor)}else t=l6(this.chunks,this.cursor);return e&&this.reset(),t}};s(Df,"Bl");var De="CBOR decode error:",A1="CBOR encode error:",Ku=[];Ku[23]=1;Ku[24]=2;Ku[25]=3;Ku[26]=5;Ku[27]=9;function lo(r,e,t){if(r.length-e<t)throw new Error(`${De} not enough data for type`)}s(lo,"assertEnoughData");var ir=[24,256,65536,4294967296,BigInt("18446744073709551616")];function fn(r,e,t){lo(r,e,1);let n=r[e];if(t.strict===!0&&n<ir[0])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}s(fn,"readUint8");function cn(r,e,t){lo(r,e,2);let n=r[e]<<8|r[e+1];if(t.strict===!0&&n<ir[1])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}s(cn,"readUint16");function un(r,e,t){lo(r,e,4);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];if(t.strict===!0&&n<ir[2])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);return n}s(un,"readUint32");function ln(r,e,t){lo(r,e,8);let n=r[e]*16777216+(r[e+1]<<16)+(r[e+2]<<8)+r[e+3],i=r[e+4]*16777216+(r[e+5]<<16)+(r[e+6]<<8)+r[e+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(t.strict===!0&&o<ir[3])throw new Error(`${De} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(t.allowBigInt===!0)return o;throw new Error(`${De} integers outside of the safe integer range are not supported`)}s(ln,"readUint64");function p6(r,e,t,n){return new we(ue.uint,fn(r,e+1,n),2)}s(p6,"decodeUint8");function m6(r,e,t,n){return new we(ue.uint,cn(r,e+1,n),3)}s(m6,"decodeUint16");function b6(r,e,t,n){return new we(ue.uint,un(r,e+1,n),5)}s(b6,"decodeUint32");function g6(r,e,t,n){return new we(ue.uint,ln(r,e+1,n),9)}s(g6,"decodeUint64");function In(r,e){return pr(r,0,e.value)}s(In,"encodeUint");function pr(r,e,t){if(t<ir[0]){let n=Number(t);r.push([e|n])}else if(t<ir[1]){let n=Number(t);r.push([e|24,n])}else if(t<ir[2]){let n=Number(t);r.push([e|25,n>>>8,n&255])}else if(t<ir[3]){let n=Number(t);r.push([e|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(t);if(n<ir[4]){let i=[e|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,r.push(i)}else throw new Error(`${De} encountered BigInt larger than allowable range`)}}s(pr,"encodeUintValue");In.encodedSize=s(function(e){return pr.encodedSize(e.value)},"encodedSize");pr.encodedSize=s(function(e){return e<ir[0]?1:e<ir[1]?2:e<ir[2]?3:e<ir[3]?5:9},"encodedSize");In.compareTokens=s(function(e,t){return e.value<t.value?-1:e.value>t.value?1:0},"compareTokens");function y6(r,e,t,n){return new we(ue.negint,-1-fn(r,e+1,n),2)}s(y6,"decodeNegint8");function v6(r,e,t,n){return new we(ue.negint,-1-cn(r,e+1,n),3)}s(v6,"decodeNegint16");function w6(r,e,t,n){return new we(ue.negint,-1-un(r,e+1,n),5)}s(w6,"decodeNegint32");var _1=BigInt(-1),x6=BigInt(1);function A6(r,e,t,n){let i=ln(r,e+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new we(ue.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${De} integers outside of the safe integer range are not supported`);return new we(ue.negint,_1-BigInt(i),9)}s(A6,"decodeNegint64");function Od(r,e){let t=e.value,n=typeof t=="bigint"?t*_1-x6:t*-1-1;pr(r,e.type.majorEncoded,n)}s(Od,"encodeNegint");Od.encodedSize=s(function(e){let t=e.value,n=typeof t=="bigint"?t*_1-x6:t*-1-1;return n<ir[0]?1:n<ir[1]?2:n<ir[2]?3:n<ir[3]?5:9},"encodedSize");Od.compareTokens=s(function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},"compareTokens");function $u(r,e,t,n){lo(r,e,t+n);let i=Lf(r,e+t,e+t+n);return new we(ue.bytes,i,t+n)}s($u,"toToken");function _6(r,e,t,n){return $u(r,e,1,t)}s(_6,"decodeBytesCompact");function E6(r,e,t,n){return $u(r,e,2,fn(r,e+1,n))}s(E6,"decodeBytes8");function S6(r,e,t,n){return $u(r,e,3,cn(r,e+1,n))}s(S6,"decodeBytes16");function C6(r,e,t,n){return $u(r,e,5,un(r,e+1,n))}s(C6,"decodeBytes32");function T6(r,e,t,n){let i=ln(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer bytes lengths not supported`);return $u(r,e,9,i)}s(T6,"decodeBytes64");function Pd(r){return r.encodedBytes===void 0&&(r.encodedBytes=r.type===ue.string?u6(r.value):r.value),r.encodedBytes}s(Pd,"tokenBytes");function Ff(r,e){let t=Pd(e);pr(r,e.type.majorEncoded,t.length),r.push(t)}s(Ff,"encodeBytes");Ff.encodedSize=s(function(e){let t=Pd(e);return pr.encodedSize(t.length)+t.length},"encodedSize");Ff.compareTokens=s(function(e,t){return Xk(Pd(e),Pd(t))},"compareTokens");function Xk(r,e){return r.length<e.length?-1:r.length>e.length?1:d6(r,e)}s(Xk,"compareBytes");function Hu(r,e,t,n,i){let o=t+n;lo(r,e,o);let a=new we(ue.string,c6(r,e+t,e+o),o);return i.retainStringBytes===!0&&(a.byteValue=Lf(r,e+t,e+o)),a}s(Hu,"toToken");function k6(r,e,t,n){return Hu(r,e,1,t,n)}s(k6,"decodeStringCompact");function M6(r,e,t,n){return Hu(r,e,2,fn(r,e+1,n),n)}s(M6,"decodeString8");function B6(r,e,t,n){return Hu(r,e,3,cn(r,e+1,n),n)}s(B6,"decodeString16");function I6(r,e,t,n){return Hu(r,e,5,un(r,e+1,n),n)}s(I6,"decodeString32");function N6(r,e,t,n){let i=ln(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer string lengths not supported`);return Hu(r,e,9,i,n)}s(N6,"decodeString64");var O6=Ff;function Kf(r,e,t,n){return new we(ue.array,n,t)}s(Kf,"toToken");function P6(r,e,t,n){return Kf(r,e,1,t)}s(P6,"decodeArrayCompact");function R6(r,e,t,n){return Kf(r,e,2,fn(r,e+1,n))}s(R6,"decodeArray8");function U6(r,e,t,n){return Kf(r,e,3,cn(r,e+1,n))}s(U6,"decodeArray16");function L6(r,e,t,n){return Kf(r,e,5,un(r,e+1,n))}s(L6,"decodeArray32");function D6(r,e,t,n){let i=ln(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer array lengths not supported`);return Kf(r,e,9,i)}s(D6,"decodeArray64");function F6(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return Kf(r,e,1,1/0)}s(F6,"decodeArrayIndefinite");function Rd(r,e){pr(r,ue.array.majorEncoded,e.value)}s(Rd,"encodeArray");Rd.compareTokens=In.compareTokens;Rd.encodedSize=s(function(e){return pr.encodedSize(e.value)},"encodedSize");function $f(r,e,t,n){return new we(ue.map,n,t)}s($f,"toToken");function K6(r,e,t,n){return $f(r,e,1,t)}s(K6,"decodeMapCompact");function $6(r,e,t,n){return $f(r,e,2,fn(r,e+1,n))}s($6,"decodeMap8");function H6(r,e,t,n){return $f(r,e,3,cn(r,e+1,n))}s(H6,"decodeMap16");function q6(r,e,t,n){return $f(r,e,5,un(r,e+1,n))}s(q6,"decodeMap32");function z6(r,e,t,n){let i=ln(r,e+1,n);if(typeof i=="bigint")throw new Error(`${De} 64-bit integer map lengths not supported`);return $f(r,e,9,i)}s(z6,"decodeMap64");function j6(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return $f(r,e,1,1/0)}s(j6,"decodeMapIndefinite");function Ud(r,e){pr(r,ue.map.majorEncoded,e.value)}s(Ud,"encodeMap");Ud.compareTokens=In.compareTokens;Ud.encodedSize=s(function(e){return pr.encodedSize(e.value)},"encodedSize");function V6(r,e,t,n){return new we(ue.tag,t,1)}s(V6,"decodeTagCompact");function W6(r,e,t,n){return new we(ue.tag,fn(r,e+1,n),2)}s(W6,"decodeTag8");function G6(r,e,t,n){return new we(ue.tag,cn(r,e+1,n),3)}s(G6,"decodeTag16");function J6(r,e,t,n){return new we(ue.tag,un(r,e+1,n),5)}s(J6,"decodeTag32");function Y6(r,e,t,n){return new we(ue.tag,ln(r,e+1,n),9)}s(Y6,"decodeTag64");function Ld(r,e){pr(r,ue.tag.majorEncoded,e.value)}s(Ld,"encodeTag");Ld.compareTokens=In.compareTokens;Ld.encodedSize=s(function(e){return pr.encodedSize(e.value)},"encodedSize");var nM=20,iM=21,oM=22,sM=23;function X6(r,e,t,n){if(n.allowUndefined===!1)throw new Error(`${De} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(ue.null,null,1):new we(ue.undefined,void 0,1)}s(X6,"decodeUndefined");function Z6(r,e,t,n){if(n.allowIndefinite===!1)throw new Error(`${De} indefinite length items not allowed`);return new we(ue.break,void 0,1)}s(Z6,"decodeBreak");function E1(r,e,t){if(t){if(t.allowNaN===!1&&Number.isNaN(r))throw new Error(`${De} NaN values are not supported`);if(t.allowInfinity===!1&&(r===1/0||r===-1/0))throw new Error(`${De} Infinity values are not supported`)}return new we(ue.float,r,e)}s(E1,"createToken");function Q6(r,e,t,n){return E1(S1(r,e+1),3,n)}s(Q6,"decodeFloat16");function e3(r,e,t,n){return E1(C1(r,e+1),5,n)}s(e3,"decodeFloat32");function t3(r,e,t,n){return E1(o3(r,e+1),9,n)}s(t3,"decodeFloat64");function Dd(r,e,t){let n=e.value;if(n===!1)r.push([ue.float.majorEncoded|nM]);else if(n===!0)r.push([ue.float.majorEncoded|iM]);else if(n===null)r.push([ue.float.majorEncoded|oM]);else if(n===void 0)r.push([ue.float.majorEncoded|sM]);else{let i,o=!1;(!t||t.float64!==!0)&&(n3(n),i=S1(ti,1),n===i||Number.isNaN(n)?(ti[0]=249,r.push(ti.slice(0,3)),o=!0):(i3(n),i=C1(ti,1),n===i&&(ti[0]=250,r.push(ti.slice(0,5)),o=!0))),o||(aM(n),i=o3(ti,1),ti[0]=251,r.push(ti.slice(0,9)))}}s(Dd,"encodeFloat");Dd.encodedSize=s(function(e,t){let n=e.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!t||t.float64!==!0){n3(n);let i=S1(ti,1);if(n===i||Number.isNaN(n))return 3;if(i3(n),i=C1(ti,1),n===i)return 5}return 9},"encodedSize");var r3=new ArrayBuffer(9),Nn=new DataView(r3,1),ti=new Uint8Array(r3,0);function n3(r){if(r===1/0)Nn.setUint16(0,31744,!1);else if(r===-1/0)Nn.setUint16(0,64512,!1);else if(Number.isNaN(r))Nn.setUint16(0,32256,!1);else{Nn.setFloat32(0,r);let e=Nn.getUint32(0),t=(e&2139095040)>>23,n=e&8388607;if(t===255)Nn.setUint16(0,31744,!1);else if(t===0)Nn.setUint16(0,(r&2147483648)>>16|n>>13,!1);else{let i=t-127;i<-24?Nn.setUint16(0,0):i<-14?Nn.setUint16(0,(e&2147483648)>>16|1<<24+i,!1):Nn.setUint16(0,(e&2147483648)>>16|i+15<<10|n>>13,!1)}}}s(n3,"encodeFloat16");function S1(r,e){if(r.length-e<2)throw new Error(`${De} not enough data for float16`);let t=(r[e]<<8)+r[e+1];if(t===31744)return 1/0;if(t===64512)return-1/0;if(t===32256)return NaN;let n=t>>10&31,i=t&1023,o;return n===0?o=i*S0(2,-24):n!==31?o=(i+1024)*S0(2,n-25):o=i===0?1/0:NaN,t&32768?-o:o}s(S1,"readFloat16");function i3(r){Nn.setFloat32(0,r,!1)}s(i3,"encodeFloat32");function C1(r,e){if(r.length-e<4)throw new Error(`${De} not enough data for float32`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,4).getFloat32(0,!1)}s(C1,"readFloat32");function aM(r){Nn.setFloat64(0,r,!1)}s(aM,"encodeFloat64");function o3(r,e){if(r.length-e<8)throw new Error(`${De} not enough data for float64`);let t=(r.byteOffset||0)+e;return new DataView(r.buffer,t,8).getFloat64(0,!1)}s(o3,"readFloat64");Dd.compareTokens=In.compareTokens;function Qe(r,e,t){throw new Error(`${De} encountered invalid minor (${t}) for major ${r[e]>>>5}`)}s(Qe,"invalidMinor");function Fd(r){return()=>{throw new Error(`${De} ${r}`)}}s(Fd,"errorer");var ye=[];for(let r=0;r<=23;r++)ye[r]=Qe;ye[24]=p6;ye[25]=m6;ye[26]=b6;ye[27]=g6;ye[28]=Qe;ye[29]=Qe;ye[30]=Qe;ye[31]=Qe;for(let r=32;r<=55;r++)ye[r]=Qe;ye[56]=y6;ye[57]=v6;ye[58]=w6;ye[59]=A6;ye[60]=Qe;ye[61]=Qe;ye[62]=Qe;ye[63]=Qe;for(let r=64;r<=87;r++)ye[r]=_6;ye[88]=E6;ye[89]=S6;ye[90]=C6;ye[91]=T6;ye[92]=Qe;ye[93]=Qe;ye[94]=Qe;ye[95]=Fd("indefinite length bytes/strings are not supported");for(let r=96;r<=119;r++)ye[r]=k6;ye[120]=M6;ye[121]=B6;ye[122]=I6;ye[123]=N6;ye[124]=Qe;ye[125]=Qe;ye[126]=Qe;ye[127]=Fd("indefinite length bytes/strings are not supported");for(let r=128;r<=151;r++)ye[r]=P6;ye[152]=R6;ye[153]=U6;ye[154]=L6;ye[155]=D6;ye[156]=Qe;ye[157]=Qe;ye[158]=Qe;ye[159]=F6;for(let r=160;r<=183;r++)ye[r]=K6;ye[184]=$6;ye[185]=H6;ye[186]=q6;ye[187]=z6;ye[188]=Qe;ye[189]=Qe;ye[190]=Qe;ye[191]=j6;for(let r=192;r<=215;r++)ye[r]=V6;ye[216]=W6;ye[217]=G6;ye[218]=J6;ye[219]=Y6;ye[220]=Qe;ye[221]=Qe;ye[222]=Qe;ye[223]=Qe;for(let r=224;r<=243;r++)ye[r]=Fd("simple values are not supported");ye[244]=Qe;ye[245]=Qe;ye[246]=Qe;ye[247]=X6;ye[248]=Fd("simple values are not supported");ye[249]=Q6;ye[250]=e3;ye[251]=t3;ye[252]=Qe;ye[253]=Qe;ye[254]=Qe;ye[255]=Z6;var ri=[];for(let r=0;r<24;r++)ri[r]=new we(ue.uint,r,1);for(let r=-1;r>=-24;r--)ri[31-r]=new we(ue.negint,r,1);ri[64]=new we(ue.bytes,new Uint8Array(0),1);ri[96]=new we(ue.string,"",1);ri[128]=new we(ue.array,0,1);ri[160]=new we(ue.map,0,1);ri[244]=new we(ue.false,!1,1);ri[245]=new we(ue.true,!0,1);ri[246]=new we(ue.null,null,1);function s3(r){switch(r.type){case ue.false:return ki([244]);case ue.true:return ki([245]);case ue.null:return ki([246]);case ue.bytes:return r.value.length?void 0:ki([64]);case ue.string:return r.value===""?ki([96]):void 0;case ue.array:return r.value===0?ki([128]):void 0;case ue.map:return r.value===0?ki([160]):void 0;case ue.uint:return r.value<24?ki([Number(r.value)]):void 0;case ue.negint:if(r.value>=-24)return ki([31-Number(r.value)])}}s(s3,"quickEncodeToken");var cM={float64:!1,mapSorter:hM,quickEncodeToken:s3};function uM(){let r=[];return r[ue.uint.major]=In,r[ue.negint.major]=Od,r[ue.bytes.major]=Ff,r[ue.string.major]=O6,r[ue.array.major]=Rd,r[ue.map.major]=Ud,r[ue.tag.major]=Ld,r[ue.float.major]=Dd,r}s(uM,"makeCborEncoders");var a3=uM(),T1=new Df,ga=class{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${A1} object contains circular references`);return new ga(t,e)}};s(ga,"Ref");var vs={null:new we(ue.null,null),undefined:new we(ue.undefined,void 0),true:new we(ue.true,!0),false:new we(ue.false,!1),emptyArray:new we(ue.array,0),emptyMap:new we(ue.map,0)},ws={number(r,e,t,n){return!Number.isInteger(r)||!Number.isSafeInteger(r)?new we(ue.float,r):r>=0?new we(ue.uint,r):new we(ue.negint,r)},bigint(r,e,t,n){return r>=BigInt(0)?new we(ue.uint,r):new we(ue.negint,r)},Uint8Array(r,e,t,n){return new we(ue.bytes,r)},string(r,e,t,n){return new we(ue.string,r)},boolean(r,e,t,n){return r?vs.true:vs.false},null(r,e,t,n){return vs.null},undefined(r,e,t,n){return vs.undefined},ArrayBuffer(r,e,t,n){return new we(ue.bytes,new Uint8Array(r))},DataView(r,e,t,n){return new we(ue.bytes,new Uint8Array(r.buffer,r.byteOffset,r.byteLength))},Array(r,e,t,n){if(!r.length)return t.addBreakTokens===!0?[vs.emptyArray,new we(ue.break)]:vs.emptyArray;n=ga.createCheck(n,r);let i=[],o=0;for(let a of r)i[o++]=Kd(a,t,n);return t.addBreakTokens?[new we(ue.array,r.length),i,new we(ue.break)]:[new we(ue.array,r.length),i]},Object(r,e,t,n){let i=e!=="Object",o=i?r.keys():Object.keys(r),a=i?r.size:o.length;if(!a)return t.addBreakTokens===!0?[vs.emptyMap,new we(ue.break)]:vs.emptyMap;n=ga.createCheck(n,r);let f=[],c=0;for(let l of o)f[c++]=[Kd(l,t,n),Kd(i?r.get(l):r[l],t,n)];return lM(f,t),t.addBreakTokens?[new we(ue.map,a),f,new we(ue.break)]:[new we(ue.map,a),f]}};ws.Map=ws.Object;ws.Buffer=ws.Uint8Array;for(let r of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))ws[`${r}Array`]=ws.DataView;function Kd(r,e={},t){let n=o6(r),i=e&&e.typeEncoders&&e.typeEncoders[n]||ws[n];if(typeof i=="function"){let a=i(r,n,e,t);if(a!=null)return a}let o=ws[n];if(!o)throw new Error(`${A1} unsupported type: ${n}`);return o(r,n,e,t)}s(Kd,"objectToTokens");function lM(r,e){e.mapSorter&&r.sort(e.mapSorter)}s(lM,"sortMapEntries");function hM(r,e){let t=Array.isArray(r[0])?r[0][0]:r[0],n=Array.isArray(e[0])?e[0][0]:e[0];if(t.type!==n.type)return t.type.compare(n.type);let i=t.type.major,o=a3[i].compareTokens(t,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}s(hM,"mapSorter");function f3(r,e,t,n){if(Array.isArray(e))for(let i of e)f3(r,i,t,n);else t[e.type.major](r,e,n)}s(f3,"tokensToEncoded");function dM(r,e,t){let n=Kd(r,t);if(!Array.isArray(n)&&t.quickEncodeToken){let i=t.quickEncodeToken(n);if(i)return i;let o=e[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,t),f=new Df(a);if(o(f,n,t),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return x1(f.chunks[0])}}return T1.reset(),f3(T1,n,e,t),T1.toBytes(!0)}s(dM,"encodeCustom");function k1(r,e){return e=Object.assign({},cM,e),dM(r,a3,e)}s(k1,"encode");var pM={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},$d=class{constructor(e,t={}){this.pos=0,this.data=e,this.options=t}done(){return this.pos>=this.data.length}next(){let e=this.data[this.pos],t=ri[e];if(t===void 0){let n=ye[e];if(!n)throw new Error(`${De} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let i=e&31;t=n(this.data,this.pos,i,this.options)}return this.pos+=t.encodedLength,t}};s($d,"Tokeniser");var qu=Symbol.for("DONE"),Hd=Symbol.for("BREAK");function mM(r,e,t){let n=[];for(let i=0;i<r.value;i++){let o=zu(e,t);if(o===Hd){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed array`)}if(o===qu)throw new Error(`${De} found array but not enough entries (got ${i}, expected ${r.value})`);n[i]=o}return n}s(mM,"tokenToArray");function bM(r,e,t){let n=t.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<r.value;a++){let f=zu(e,t);if(f===Hd){if(r.value===1/0)break;throw new Error(`${De} got unexpected break to lengthed map`)}if(f===qu)throw new Error(`${De} found map but not enough entries (got ${a} [no key], expected ${r.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${De} non-string keys not supported (got ${typeof f})`);let c=zu(e,t);if(c===qu)throw new Error(`${De} found map but not enough entries (got ${a} [no value], expected ${r.value})`);n?o.set(f,c):i[f]=c}return n?o:i}s(bM,"tokenToMap");function zu(r,e){if(r.done())return qu;let t=r.next();if(t.type===ue.break)return Hd;if(t.type.terminal)return t.value;if(t.type===ue.array)return mM(t,r,e);if(t.type===ue.map)return bM(t,r,e);if(t.type===ue.tag){if(e.tags&&typeof e.tags[t.value]=="function"){let n=zu(r,e);return e.tags[t.value](n)}throw new Error(`${De} tag not supported (${t.value})`)}throw new Error("unsupported")}s(zu,"tokensToObject");function M1(r,e){if(!(r instanceof Uint8Array))throw new Error(`${De} data to decode must be a Uint8Array`);e=Object.assign({},pM,e);let t=e.tokenizer||new $d(r,e),n=zu(t,e);if(n===qu)throw new Error(`${De} did not find any content to decode`);if(n===Hd)throw new Error(`${De} got unexpected break`);if(!t.done())throw new Error(`${De} too many terminals, data makes no sense`);return n}s(M1,"decode");to();var c3=42;function yM(r){if(r.asCID!==r)return null;let e=Ne.asCID(r);if(!e)return null;let t=new Uint8Array(e.bytes.byteLength+1);return t.set(e.bytes,1),[new we(ue.tag,c3),new we(ue.bytes,t)]}s(yM,"cidEncoder");function vM(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}s(vM,"undefinedEncoder");function wM(r){if(Number.isNaN(r))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(r===1/0||r===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}s(wM,"numberEncoder");var xM={float64:!0,typeEncoders:{Object:yM,undefined:vM,number:wM}};function AM(r){if(r[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ne.decode(r.subarray(1))}s(AM,"cidDecoder");var u3={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};u3.tags[c3]=AM;var _M="dag-cbor",B1=113,I1=s(r=>k1(r,xM),"encode"),N1=s(r=>M1(r,u3),"decode");var EM=24;function l3(r){return M(this,null,function*(){let e=yield ma({value:r,codec:ho,hasher:ra});return{cid:e.cid,linkedBlock:e.bytes}})}s(l3,"encodePayload");function SM(r,e=EM){let t=(e-r.length%e)%e,n=new Uint8Array(r.length+t);return n.set(r,0),n}s(SM,"pad");function CM(r){return M(this,null,function*(){return(yield ma({value:r,codec:ho,hasher:Yh})).cid})}s(CM,"encodeIdentityCID");function TM(r){if(r=Ne.asCID(r),r.code!==B1)throw new Error("CID codec must be dag-cbor");if(r.multihash.code!==Yh.code)throw new Error("CID must use identity multihash");return N1(r.multihash.digest)}s(TM,"decodeIdentityCID");function h3(r,e){return M(this,null,function*(){return SM((yield CM(r)).bytes,e)})}s(h3,"prepareCleartext");function d3(r){return TM(Ne.decodeFirst(r)[0])}s(d3,"decodeCleartext");var p3=Symbol("abortable"),qd=Symbol("aborted");function m3(r,e){if(e.aborted)return Promise.reject(qd);let t,n=new Promise((i,o)=>{t=o});return e.addEventListener("abort",()=>{t(qd)}),Promise.race([r,n])}s(m3,"abortable");var b3=s((r=21)=>crypto.getRandomValues(new Uint8Array(r)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),""),"nanoid");var zd="utils_abort_request";var Ur;(function(r){r[r.PARSE_ERROR=-32700]="PARSE_ERROR",r[r.INVALID_REQUEST=-32600]="INVALID_REQUEST",r[r.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",r[r.INVALID_PARAMS=-32602]="INVALID_PARAMS",r[r.INTERNAL_ERROR=-32603]="INTERNAL_ERROR"})(Ur||(Ur={}));var g3={[Ur.PARSE_ERROR]:"Parse error",[Ur.INVALID_REQUEST]:"Invalid request",[Ur.METHOD_NOT_FOUND]:"Method not found",[Ur.INVALID_PARAMS]:"Invalid params",[Ur.INTERNAL_ERROR]:"Internal error"};function kM(r){return-32e3>=r&&r>=-32099}s(kM,"isServerError");function jd(r){var e;return(e=g3[r.toString()])!=null?e:kM(r)?"Server error":"Application error"}s(jd,"getErrorMessage");var Jr=class extends Error{static fromObject(e){return new Jr(e.code,e.message,e.data)}toObject(){return{code:this.code,data:this.data,message:this.message}}constructor(e,t,n){super(),Object.setPrototypeOf(this,Jr.prototype),this.code=e,this.data=n,this.message=t!=null?t:jd(e)}};s(Jr,"RPCError");function ju(r){let e=g3[r];return s(function(n){return new Jr(r,e,n)},"createError")}s(ju,"createErrorFactory");var MM=ju(Ur.PARSE_ERROR),n$=ju(Ur.INVALID_REQUEST),i$=ju(Ur.METHOD_NOT_FOUND),o$=ju(Ur.INVALID_PARAMS),s$=ju(Ur.INTERNAL_ERROR);function BM(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(BM,"_checkPrivateRedeclaration");function IM(r,e){return e.get?e.get.call(r):e.value}s(IM,"_classApplyDescriptorGet");function NM(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}s(NM,"_classApplyDescriptorSet");function y3(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}s(y3,"_classExtractFieldDescriptor");function O1(r,e){var t=y3(r,e,"get");return IM(r,t)}s(O1,"_classPrivateFieldGet");function OM(r,e,t){BM(r,e),e.set(r,t)}s(OM,"_classPrivateFieldInit");function PM(r,e,t){var n=y3(r,e,"set");return NM(r,n,t),t}s(PM,"_classPrivateFieldSet");var Vu=new WeakMap,Hf=class{get connection(){return O1(this,Vu)}createID(){return b3()}request(e,t=void 0,n={}){let{signal:i}=n;if(i!=null&&i.aborted)return Promise.reject(qd);let o=this.createID(),a=O1(this,Vu).send({jsonrpc:"2.0",id:o,method:e,params:t}).then(f=>{if(f==null)throw new Error("Missing response");if(f.error!=null)throw Jr.fromObject(f.error);return f.result});return i==null?a:(i.addEventListener("abort",()=>{this.notify(zd,{id:o})}),m3(a,i))}notify(e,t=void 0){return M(this,null,function*(){yield O1(this,Vu).send({jsonrpc:"2.0",method:e,params:t})})}constructor(e){OM(this,Vu,{writable:!0,value:void 0}),PM(this,Vu,e)}};s(Hf,"RPCClient");function v3(r,e){return{jsonrpc:"2.0",id:r,error:{code:e,message:jd(e)}}}s(v3,"createErrorResponse");function RM(r,e,t){console.warn("Unhandled handler error",e,t)}s(RM,"fallbackOnHandlerError");function UM(r,e){console.warn("Unhandled invalid message",e)}s(UM,"fallbackOnInvalidMessage");function LM(r,e){console.warn("Unhandled notification",e)}s(LM,"fallbackOnNotification");function w3(r,e={}){var f,c,l;let t=(f=e.onHandlerError)!=null?f:RM,n=(c=e.onInvalidMessage)!=null?c:UM,i=(l=e.onNotification)!=null?l:LM,o={};function a(h,d){var y,A;if(d.method===zd){let v=(y=d.params)==null?void 0:y.id;v!=null&&((A=o[v])==null||A.abort())}else i(h,d)}return s(a,"handleNotification"),s(function(d,y){return M(this,null,function*(){var x,L,_;let A=y.id;if(y.jsonrpc!=="2.0"||y.method==null)return A==null?(n(d,y),null):v3(A,Ur.INVALID_REQUEST);let v=r[y.method];if(v==null)return A==null?(a(d,y),null):v3(A,Ur.METHOD_NOT_FOUND);try{let R;if(A!=null&&v[p3]){let $=new AbortController;o[A]=$,R=v(d,y.params,{signal:$.signal})}else R=v(d,y.params,{});let H=R==null?R:typeof R.then=="function"?yield R:R;return A==null||((x=o[A])==null?void 0:x.signal.aborted)?null:{jsonrpc:"2.0",id:A,result:H}}catch(R){if(A==null||((L=o[A])==null?void 0:L.signal.aborted))return t(d,y,R),null;let H;if(R instanceof Jr)H=R.toObject();else{t(d,y,R);let $=(_=R.code)!=null?_:-32e3;H={code:$,message:R.message||jd($)}}return{jsonrpc:"2.0",id:A,error:H}}finally{A!=null&&delete o[A]}})},"handleRequest")}s(w3,"createHandler");to();var J5=ze(l5(),1),Tr=ze(wa(),1);function H1(){return H1=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},H1.apply(this,arguments)}s(H1,"_extends");var q1={name:"chainId",regex:"[-:a-zA-Z0-9]{5,41}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"}}}},rB={name:"accountId",regex:"[-:a-zA-Z0-9]{7,106}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,32}"},2:{name:"address",regex:"[a-zA-Z0-9]{1,64}"}}}},z1={name:"assetName",regex:"[-:a-zA-Z0-9]{5,73}",parameters:{delimiter:":",values:{0:{name:"namespace",regex:"[-a-z0-9]{3,8}"},1:{name:"reference",regex:"[-a-zA-Z0-9]{1,64}"}}}},nB={name:"assetType",regex:"[-:a-zA-Z0-9]{11,115}",parameters:{delimiter:"/",values:{0:q1,1:z1}}},iB={name:"assetId",regex:"[-:a-zA-Z0-9]{13,148}",parameters:{delimiter:"/",values:{0:q1,1:z1,2:{name:"tokenId",regex:"[-a-zA-Z0-9]{1,32}"}}}},Xu={"2":q1,"10":rB,"19":{assetName:z1,assetType:nB,assetId:iB}};function h5(r,e){return r.split(e.parameters.delimiter)}s(h5,"splitParams");function Zu(r,e){var t=h5(r,e),n={};return t.forEach(function(i,o){n[e.parameters.values[o].name]=i}),n}s(Zu,"getParams");function Wf(r,e){return Object.values(e.parameters.values).map(function(t){var n=r[t.name];return typeof n=="string"?n:Wf(n,t)}).join(e.parameters.delimiter)}s(Wf,"joinParams");function Qu(r,e){if(!new RegExp(e.regex).test(r))return!1;var t=h5(r,e);if(t.length!==Object.keys(e.parameters.values).length)return!1;var n=t.map(function(i,o){return new RegExp(e.parameters.values[o].regex).test(i)}).filter(function(i){return!!i});return n.length===t.length}s(Qu,"isValidId");var Es=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}s(r,"ChainId"),r.parse=s(function(n){if(!Qu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Zu(n,this.spec)).toJSON()},"parse"),r.format=s(function(n){return Wf(n,this.spec)},"format");var e=r.prototype;return e.toString=s(function(){return r.format(this.toJSON())},"toString"),e.toJSON=s(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();Es.spec=Xu["2"];var xa=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new Es(t.chainId),this.address=t.address}s(r,"AccountId"),r.parse=s(function(n){if(!Qu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);var i=Zu(n,this.spec),o=i.namespace,a=i.reference,f=i.address,c=new Es({namespace:o,reference:a});return new r({chainId:c,address:f}).toJSON()},"parse"),r.format=s(function(n){var i=new Es(n.chainId),o=H1({},i.toJSON(),{address:n.address});return Wf(o,this.spec)},"format");var e=r.prototype;return e.toString=s(function(){return r.format(this.toJSON())},"toString"),e.toJSON=s(function(){return{chainId:this.chainId.toJSON(),address:this.address}},"toJSON"),r}();xa.spec=Xu["10"];var j1=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.namespace=t.namespace,this.reference=t.reference}s(r,"AssetName"),r.parse=s(function(n){if(!Qu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Zu(n,this.spec)).toJSON()},"parse"),r.format=s(function(n){return Wf(n,this.spec)},"format");var e=r.prototype;return e.toString=s(function(){return r.format(this.toJSON())},"toString"),e.toJSON=s(function(){return{namespace:this.namespace,reference:this.reference}},"toJSON"),r}();j1.spec=Xu["19"].assetName;var oB=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new Es(t.chainId),this.assetName=new j1(t.assetName)}s(r,"AssetType"),r.parse=s(function(n){if(!Qu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Zu(n,this.spec)).toJSON()},"parse"),r.format=s(function(n){return Wf(n,this.spec)},"format");var e=r.prototype;return e.toString=s(function(){return r.format(this.toJSON())},"toString"),e.toJSON=s(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName}},"toJSON"),r}();oB.spec=Xu["19"].assetType;var sB=function(){function r(t){typeof t=="string"&&(t=r.parse(t)),this.chainId=new Es(t.chainId),this.assetName=new j1(t.assetName),this.tokenId=t.tokenId}s(r,"AssetId"),r.parse=s(function(n){if(!Qu(n,this.spec))throw new Error("Invalid "+this.spec.name+" provided: "+n);return new r(Zu(n,this.spec)).toJSON()},"parse"),r.format=s(function(n){return Wf(n,this.spec)},"format");var e=r.prototype;return e.toString=s(function(){return r.format(this.toJSON())},"toString"),e.toJSON=s(function(){return{chainId:this.chainId.toJSON(),assetName:this.assetName.toJSON(),tokenId:this.tokenId}},"toJSON"),r}();sB.spec=Xu["19"].assetId;var d5="logger/5.6.0";var p5=!1,m5=!1,Xd={debug:1,default:2,info:2,warning:3,error:4,off:5},b5=Xd.default,V1=null;function aB(){try{let r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(t){r.push(e)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}s(aB,"_checkNormalize");var g5=aB(),W1;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(W1||(W1={}));var ii;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED"})(ii||(ii={}));var y5="0123456789abcdef",He=class{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){let n=e.toLowerCase();Xd[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(b5>Xd[n])&&console.log.apply(console,t)}debug(...e){this._log(He.levels.DEBUG,e)}info(...e){this._log(He.levels.INFO,e)}warn(...e){this._log(He.levels.WARNING,e)}makeError(e,t,n){if(m5)return this.makeError("censored error",t,{});t||(t=He.errors.UNKNOWN_ERROR),n||(n={});let i=[];Object.keys(n).forEach(c=>{let l=n[c];try{if(l instanceof Uint8Array){let h="";for(let d=0;d<l.length;d++)h+=y5[l[d]>>4],h+=y5[l[d]&15];i.push(c+"=Uint8Array(0x"+h+")")}else i.push(c+"="+JSON.stringify(l))}catch(h){i.push(c+"="+JSON.stringify(n[c].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);let o=e,a="";switch(t){case ii.NUMERIC_FAULT:{a="NUMERIC_FAULT";let c=e;switch(c){case"overflow":case"underflow":case"division-by-zero":a+="-"+c;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result";break}break}case ii.CALL_EXCEPTION:case ii.INSUFFICIENT_FUNDS:case ii.MISSING_NEW:case ii.NONCE_EXPIRED:case ii.REPLACEMENT_UNDERPRICED:case ii.TRANSACTION_REPLACED:case ii.UNPREDICTABLE_GAS_LIMIT:a=t;break}a&&(e+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(e+=" ("+i.join(", ")+")");let f=new Error(e);return f.reason=o,f.code=t,Object.keys(n).forEach(function(c){f[c]=n[c]}),f}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,He.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,i){e||this.throwError(t,n,i)}assertArgument(e,t,n,i){e||this.throwArgumentError(t,n,i)}checkNormalize(e){e==null&&(e="platform missing String.prototype.normalize"),g5&&this.throwError("platform missing String.prototype.normalize",He.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:g5})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,He.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n?n=": "+n:n="",e<t&&this.throwError("missing argument"+n,He.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,He.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",He.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",He.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return V1||(V1=new He(d5)),V1}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),p5){if(!e)return;this.globalLogger().throwError("error censorship permanent",He.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}m5=!!e,p5=!!t}static setLogLevel(e){let t=Xd[e.toLowerCase()];if(t==null){He.globalLogger().warn("invalid log level - "+e);return}b5=t}static from(e){return new He(e)}};s(He,"Logger");He.errors=ii;He.levels=W1;var v5="bytes/5.6.1";var $t=new He(v5);function x5(r){return!!r.toHexString}s(x5,"isHexable");function Gf(r){return r.slice||(r.slice=function(){let e=Array.prototype.slice.call(arguments);return Gf(new Uint8Array(Array.prototype.slice.apply(r,e)))}),r}s(Gf,"addSlice");function A5(r){return oi(r)&&!(r.length%2)||J1(r)}s(A5,"isBytesLike");function w5(r){return typeof r=="number"&&r==r&&r%1===0}s(w5,"isInteger");function J1(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!w5(r.length)||r.length<0)return!1;for(let e=0;e<r.length;e++){let t=r[e];if(!w5(t)||t<0||t>=256)return!1}return!0}s(J1,"isBytes");function kt(r,e){if(e||(e={}),typeof r=="number"){$t.checkSafeUint53(r,"invalid arrayify value");let t=[];for(;r;)t.unshift(r&255),r=parseInt(String(r/256));return t.length===0&&t.push(0),Gf(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),x5(r)&&(r=r.toHexString()),oi(r)){let t=r.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":$t.throwArgumentError("hex data is odd-length","value",r));let n=[];for(let i=0;i<t.length;i+=2)n.push(parseInt(t.substring(i,i+2),16));return Gf(new Uint8Array(n))}return J1(r)?Gf(new Uint8Array(r)):$t.throwArgumentError("invalid arrayify value","value",r)}s(kt,"arrayify");function Y1(r){let e=r.map(i=>kt(i)),t=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(t);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Gf(n)}s(Y1,"concat");function fB(r,e){r=kt(r),r.length>e&&$t.throwArgumentError("value out of range","value",arguments[0]);let t=new Uint8Array(e);return t.set(r,e-r.length),Gf(t)}s(fB,"zeroPad");function oi(r,e){return!(typeof r!="string"||!r.match(/^0x[0-9A-Fa-f]*$/)||e&&r.length!==2+2*e)}s(oi,"isHexString");var G1="0123456789abcdef";function Sr(r,e){if(e||(e={}),typeof r=="number"){$t.checkSafeUint53(r,"invalid hexlify value");let t="";for(;r;)t=G1[r&15]+t,r=Math.floor(r/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof r=="bigint")return r=r.toString(16),r.length%2?"0x0"+r:"0x"+r;if(e.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),x5(r))return r.toHexString();if(oi(r))return r.length%2&&(e.hexPad==="left"?r="0x0"+r.substring(2):e.hexPad==="right"?r+="0":$t.throwArgumentError("hex data is odd-length","value",r)),r.toLowerCase();if(J1(r)){let t="0x";for(let n=0;n<r.length;n++){let i=r[n];t+=G1[(i&240)>>4]+G1[i&15]}return t}return $t.throwArgumentError("invalid hexlify value","value",r)}s(Sr,"hexlify");function Zd(r){if(typeof r!="string")r=Sr(r);else if(!oi(r)||r.length%2)return null;return(r.length-2)/2}s(Zd,"hexDataLength");function Qd(r,e,t){return typeof r!="string"?r=Sr(r):(!oi(r)||r.length%2)&&$t.throwArgumentError("invalid hexData","value",r),e=2+2*e,t!=null?"0x"+r.substring(e,2+2*t):"0x"+r.substring(e)}s(Qd,"hexDataSlice");function Ss(r,e){for(typeof r!="string"?r=Sr(r):oi(r)||$t.throwArgumentError("invalid hex string","value",r),r.length>2*e+2&&$t.throwArgumentError("value out of range","value",arguments[1]);r.length<2*e+2;)r="0x0"+r.substring(2);return r}s(Ss,"hexZeroPad");function ep(r){let e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(A5(r)){let t=kt(r);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=Sr(t.slice(0,32)),e.s=Sr(t.slice(32,64))):t.length===65?(e.r=Sr(t.slice(0,32)),e.s=Sr(t.slice(32,64)),e.v=t[64]):$t.throwArgumentError("invalid signature string","signature",r),e.v<27&&(e.v===0||e.v===1?e.v+=27:$t.throwArgumentError("signature invalid v byte","signature",r)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=Sr(t.slice(32,64))}else{if(e.r=r.r,e.s=r.s,e.v=r.v,e.recoveryParam=r.recoveryParam,e._vs=r._vs,e._vs!=null){let i=fB(kt(e._vs),32);e._vs=Sr(i);let o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&$t.throwArgumentError("signature recoveryParam mismatch _vs","signature",r),i[0]&=127;let a=Sr(i);e.s==null?e.s=a:e.s!==a&&$t.throwArgumentError("signature v mismatch _vs","signature",r)}if(e.recoveryParam==null)e.v==null?$t.throwArgumentError("signature missing v and recoveryParam","signature",r):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{let i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&$t.throwArgumentError("signature recoveryParam mismatch v","signature",r)}e.r==null||!oi(e.r)?$t.throwArgumentError("signature missing or invalid r","signature",r):e.r=Ss(e.r,32),e.s==null||!oi(e.s)?$t.throwArgumentError("signature missing or invalid s","signature",r):e.s=Ss(e.s,32);let t=kt(e.s);t[0]>=128&&$t.throwArgumentError("signature s out of range","signature",r),e.recoveryParam&&(t[0]|=128);let n=Sr(t);e._vs&&(oi(e._vs)||$t.throwArgumentError("signature invalid _vs","signature",r),e._vs=Ss(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&$t.throwArgumentError("signature _vs mismatch v and s","signature",r)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}s(ep,"splitSignature");var E5=ze(Cn());var _5="bignumber/5.6.0";var cB=E5.default.BN,Z$=new He(_5);function X1(r){return new cB(r,36).toString(16)}s(X1,"_base36To16");var S5=ze(gm());function Jf(r){return"0x"+S5.default.keccak_256(kt(r))}s(Jf,"keccak256");var C5="address/5.6.0";var el=new He(C5);function T5(r){oi(r,20)||el.throwArgumentError("invalid address","address",r),r=r.toLowerCase();let e=r.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);let n=kt(Jf(t));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}s(T5,"getChecksumAddress");var hB=9007199254740991;function dB(r){return Math.log10?Math.log10(r):Math.log(r)/Math.LN10}s(dB,"log10");var Z1={};for(let r=0;r<10;r++)Z1[String(r)]=String(r);for(let r=0;r<26;r++)Z1[String.fromCharCode(65+r)]=String(10+r);var k5=Math.floor(dB(hB));function pB(r){r=r.toUpperCase(),r=r.substring(4)+r.substring(0,2)+"00";let e=r.split("").map(n=>Z1[n]).join("");for(;e.length>=k5;){let n=e.substring(0,k5);e=parseInt(n,10)%97+e.substring(n.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}s(pB,"ibanChecksum");function M5(r){let e=null;if(typeof r!="string"&&el.throwArgumentError("invalid address","address",r),r.match(/^(0x)?[0-9a-fA-F]{40}$/))r.substring(0,2)!=="0x"&&(r="0x"+r),e=T5(r),r.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==r&&el.throwArgumentError("bad address checksum","address",r);else if(r.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(r.substring(2,4)!==pB(r)&&el.throwArgumentError("bad icap checksum","address",r),e=X1(r.substring(4));e.length<40;)e="0"+e;e=T5("0x"+e)}else el.throwArgumentError("invalid address","address",r);return e}s(M5,"getAddress");var B5="properties/5.6.0";var mH=new He(B5);function Yf(r,e,t){Object.defineProperty(r,e,{enumerable:!0,value:t,writable:!1})}s(Yf,"defineReadOnly");var I5="strings/5.6.0";var N5=new He(I5),tl;(function(r){r.current="",r.NFC="NFC",r.NFD="NFD",r.NFKC="NFKC",r.NFKD="NFKD"})(tl||(tl={}));var Aa;(function(r){r.UNEXPECTED_CONTINUE="unexpected continuation byte",r.BAD_PREFIX="bad codepoint prefix",r.OVERRUN="string overrun",r.MISSING_CONTINUE="missing continuation byte",r.OUT_OF_RANGE="out of UTF-8 range",r.UTF16_SURROGATE="UTF-16 surrogate",r.OVERLONG="overlong representation"})(Aa||(Aa={}));function mB(r,e,t,n,i){return N5.throwArgumentError(`invalid codepoint at offset ${e}; ${r}`,"bytes",t)}s(mB,"errorFunc");function O5(r,e,t,n,i){if(r===Aa.BAD_PREFIX||r===Aa.UNEXPECTED_CONTINUE){let o=0;for(let a=e+1;a<t.length&&t[a]>>6===2;a++)o++;return o}return r===Aa.OVERRUN?t.length-e-1:0}s(O5,"ignoreFunc");function bB(r,e,t,n,i){return r===Aa.OVERLONG?(n.push(i),0):(n.push(65533),O5(r,e,t,n,i))}s(bB,"replaceFunc");var gB=Object.freeze({error:mB,ignore:O5,replace:bB});function rl(r,e=tl.current){e!=tl.current&&(N5.checkNormalize(),r=r.normalize(e));let t=[];for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);if(i<128)t.push(i);else if(i<2048)t.push(i>>6|192),t.push(i&63|128);else if((i&64512)==55296){n++;let o=r.charCodeAt(n);if(n>=r.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");let a=65536+((i&1023)<<10)+(o&1023);t.push(a>>18|240),t.push(a>>12&63|128),t.push(a>>6&63|128),t.push(a&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return kt(t)}s(rl,"toUtf8Bytes");var P5=`Ethereum Signed Message:
|
660
|
+
`;function Q1(r){return typeof r=="string"&&(r=rl(r)),Jf(Y1([rl(P5),rl(String(r.length)),r]))}s(Q1,"hashMessage");var Fe=ze(Cn()),Ii=ze(Bu());function Xf(r,e,t){return t={path:e,exports:{},require:function(n,i){return yB(n,i==null?t.path:i)}},r(t,t.exports),t.exports}s(Xf,"createCommonjsModule");function yB(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}s(yB,"commonjsRequire");var nb=U5;function U5(r,e){if(!r)throw new Error(e||"Assertion failed")}s(U5,"assert");U5.equal=s(function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)},"assertEqual");var si=Xf(function(r,e){"use strict";var t=e;function n(a,f){if(Array.isArray(a))return a.slice();if(!a)return[];var c=[];if(typeof a!="string"){for(var l=0;l<a.length;l++)c[l]=a[l]|0;return c}if(f==="hex"){a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a);for(var l=0;l<a.length;l+=2)c.push(parseInt(a[l]+a[l+1],16))}else for(var l=0;l<a.length;l++){var h=a.charCodeAt(l),d=h>>8,y=h&255;d?c.push(d,y):c.push(y)}return c}s(n,"toArray"),t.toArray=n;function i(a){return a.length===1?"0"+a:a}s(i,"zero2"),t.zero2=i;function o(a){for(var f="",c=0;c<a.length;c++)f+=i(a[c].toString(16));return f}s(o,"toHex"),t.toHex=o,t.encode=s(function(f,c){return c==="hex"?o(f):f},"encode")}),dn=Xf(function(r,e){"use strict";var t=e;t.assert=nb,t.toArray=si.toArray,t.zero2=si.zero2,t.toHex=si.toHex,t.encode=si.encode;function n(c,l,h){var d=new Array(Math.max(c.bitLength(),h)+1);d.fill(0);for(var y=1<<l+1,A=c.clone(),v=0;v<d.length;v++){var x,L=A.andln(y-1);A.isOdd()?(L>(y>>1)-1?x=(y>>1)-L:x=L,A.isubn(x)):x=0,d[v]=x,A.iushrn(1)}return d}s(n,"getNAF"),t.getNAF=n;function i(c,l){var h=[[],[]];c=c.clone(),l=l.clone();for(var d=0,y=0,A;c.cmpn(-d)>0||l.cmpn(-y)>0;){var v=c.andln(3)+d&3,x=l.andln(3)+y&3;v===3&&(v=-1),x===3&&(x=-1);var L;(v&1)===0?L=0:(A=c.andln(7)+d&7,(A===3||A===5)&&x===2?L=-v:L=v),h[0].push(L);var _;(x&1)===0?_=0:(A=l.andln(7)+y&7,(A===3||A===5)&&v===2?_=-x:_=x),h[1].push(_),2*d===L+1&&(d=1-d),2*y===_+1&&(y=1-y),c.iushrn(1),l.iushrn(1)}return h}s(i,"getJSF"),t.getJSF=i;function o(c,l,h){var d="_"+l;c.prototype[l]=s(function(){return this[d]!==void 0?this[d]:this[d]=h.call(this)},"cachedProperty")}s(o,"cachedProperty"),t.cachedProperty=o;function a(c){return typeof c=="string"?t.toArray(c,"hex"):c}s(a,"parseBytes"),t.parseBytes=a;function f(c){return new Fe.default(c,"hex","le")}s(f,"intFromLE"),t.intFromLE=f}),np=dn.getNAF,vB=dn.getJSF,ip=dn.assert;function Ts(r,e){this.type=r,this.p=new Fe.default(e.p,16),this.red=e.prime?Fe.default.red(e.prime):Fe.default.mont(this.p),this.zero=new Fe.default(0).toRed(this.red),this.one=new Fe.default(1).toRed(this.red),this.two=new Fe.default(2).toRed(this.red),this.n=e.n&&new Fe.default(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 t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}s(Ts,"BaseCurve");var _a=Ts;Ts.prototype.point=s(function(){throw new Error("Not implemented")},"point");Ts.prototype.validate=s(function(){throw new Error("Not implemented")},"validate");Ts.prototype._fixedNafMul=s(function(e,t){ip(e.precomputed);var n=e._getDoubles(),i=np(t,1,this._bitLength),o=(1<<n.step+1)-(n.step%2===0?2:1);o/=3;var a=[],f,c;for(f=0;f<i.length;f+=n.step){c=0;for(var l=f+n.step-1;l>=f;l--)c=(c<<1)+i[l];a.push(c)}for(var h=this.jpoint(null,null,null),d=this.jpoint(null,null,null),y=o;y>0;y--){for(f=0;f<a.length;f++)c=a[f],c===y?d=d.mixedAdd(n.points[f]):c===-y&&(d=d.mixedAdd(n.points[f].neg()));h=h.add(d)}return h.toP()},"_fixedNafMul");Ts.prototype._wnafMul=s(function(e,t){var n=4,i=e._getNAFPoints(n);n=i.wnd;for(var o=i.points,a=np(t,n,this._bitLength),f=this.jpoint(null,null,null),c=a.length-1;c>=0;c--){for(var l=0;c>=0&&a[c]===0;c--)l++;if(c>=0&&l++,f=f.dblp(l),c<0)break;var h=a[c];ip(h!==0),e.type==="affine"?h>0?f=f.mixedAdd(o[h-1>>1]):f=f.mixedAdd(o[-h-1>>1].neg()):h>0?f=f.add(o[h-1>>1]):f=f.add(o[-h-1>>1].neg())}return e.type==="affine"?f.toP():f},"_wnafMul");Ts.prototype._wnafMulAdd=s(function(e,t,n,i,o){var a=this._wnafT1,f=this._wnafT2,c=this._wnafT3,l=0,h,d,y;for(h=0;h<i;h++){y=t[h];var A=y._getNAFPoints(e);a[h]=A.wnd,f[h]=A.points}for(h=i-1;h>=1;h-=2){var v=h-1,x=h;if(a[v]!==1||a[x]!==1){c[v]=np(n[v],a[v],this._bitLength),c[x]=np(n[x],a[x],this._bitLength),l=Math.max(c[v].length,l),l=Math.max(c[x].length,l);continue}var L=[t[v],null,null,t[x]];t[v].y.cmp(t[x].y)===0?(L[1]=t[v].add(t[x]),L[2]=t[v].toJ().mixedAdd(t[x].neg())):t[v].y.cmp(t[x].y.redNeg())===0?(L[1]=t[v].toJ().mixedAdd(t[x]),L[2]=t[v].add(t[x].neg())):(L[1]=t[v].toJ().mixedAdd(t[x]),L[2]=t[v].toJ().mixedAdd(t[x].neg()));var _=[-3,-1,-5,-7,0,7,5,1,3],R=vB(n[v],n[x]);for(l=Math.max(R[0].length,l),c[v]=new Array(l),c[x]=new Array(l),d=0;d<l;d++){var H=R[0][d]|0,$=R[1][d]|0;c[v][d]=_[(H+1)*3+($+1)],c[x][d]=0,f[v]=L}}var j=this.jpoint(null,null,null),D=this._wnafT4;for(h=l;h>=0;h--){for(var B=0;h>=0;){var U=!0;for(d=0;d<i;d++)D[d]=c[d][h]|0,D[d]!==0&&(U=!1);if(!U)break;B++,h--}if(h>=0&&B++,j=j.dblp(B),h<0)break;for(d=0;d<i;d++){var Y=D[d];Y!==0&&(Y>0?y=f[d][Y-1>>1]:Y<0&&(y=f[d][-Y-1>>1].neg()),y.type==="affine"?j=j.mixedAdd(y):j=j.add(y))}}for(h=0;h<i;h++)f[h]=null;return o?j:j.toP()},"_wnafMulAdd");function Rn(r,e){this.curve=r,this.type=e,this.precomputed=null}s(Rn,"BasePoint");Ts.BasePoint=Rn;Rn.prototype.eq=s(function(){throw new Error("Not implemented")},"eq");Rn.prototype.validate=s(function(){return this.curve.validate(this)},"validate");Ts.prototype.decodePoint=s(function(e,t){e=dn.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*n){e[0]===6?ip(e[e.length-1]%2===0):e[0]===7&&ip(e[e.length-1]%2===1);var i=this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));return i}else if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw new Error("Unknown point format")},"decodePoint");Rn.prototype.encodeCompressed=s(function(e){return this.encode(e,!0)},"encodeCompressed");Rn.prototype._encode=s(function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},"_encode");Rn.prototype.encode=s(function(e,t){return dn.encode(this._encode(t),e)},"encode");Rn.prototype.precompute=s(function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},"precompute");Rn.prototype._hasDoubles=s(function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},"_hasDoubles");Rn.prototype._getDoubles=s(function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o<t;o+=e){for(var a=0;a<e;a++)i=i.dbl();n.push(i)}return{step:e,points:n}},"_getDoubles");Rn.prototype._getNAFPoints=s(function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,i=n===1?null:this.dbl(),o=1;o<n;o++)t[o]=t[o-1].add(i);return{wnd:e,points:t}},"_getNAFPoints");Rn.prototype._getBeta=s(function(){return null},"_getBeta");Rn.prototype.dblp=s(function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t},"dblp");var ib=Xf(function(r){typeof Object.create=="function"?r.exports=s(function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):r.exports=s(function(t,n){if(n){t.super_=n;var i=s(function(){},"TempCtor");i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}},"inherits")}),wB=dn.assert;function Un(r){_a.call(this,"short",r),this.a=new Fe.default(r.a,16).toRed(this.red),this.b=new Fe.default(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}s(Un,"ShortCurve");ib(Un,_a);var xB=Un;Un.prototype._getEndomorphism=s(function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new Fe.default(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new Fe.default(e.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))===0?n=o[0]:(n=o[1],wB(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var a;return e.basis?a=e.basis.map(function(f){return{a:new Fe.default(f.a,16),b:new Fe.default(f.b,16)}}):a=this._getEndoBasis(n),{beta:t,lambda:n,basis:a}}},"_getEndomorphism");Un.prototype._getEndoRoots=s(function(e){var t=e===this.p?this.red:Fe.default.mont(e),n=new Fe.default(2).toRed(t).redInvm(),i=n.redNeg(),o=new Fe.default(3).toRed(t).redNeg().redSqrt().redMul(n),a=i.redAdd(o).fromRed(),f=i.redSub(o).fromRed();return[a,f]},"_getEndoRoots");Un.prototype._getEndoBasis=s(function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),o=new Fe.default(1),a=new Fe.default(0),f=new Fe.default(0),c=new Fe.default(1),l,h,d,y,A,v,x,L=0,_,R;n.cmpn(0)!==0;){var H=i.div(n);_=i.sub(H.mul(n)),R=f.sub(H.mul(o));var $=c.sub(H.mul(a));if(!d&&_.cmp(t)<0)l=x.neg(),h=o,d=_.neg(),y=R;else if(d&&++L===2)break;x=_,i=n,n=_,f=o,o=R,c=a,a=$}A=_.neg(),v=R;var j=d.sqr().add(y.sqr()),D=A.sqr().add(v.sqr());return D.cmp(j)>=0&&(A=l,v=h),d.negative&&(d=d.neg(),y=y.neg()),A.negative&&(A=A.neg(),v=v.neg()),[{a:d,b:y},{a:A,b:v}]},"_getEndoBasis");Un.prototype._endoSplit=s(function(e){var t=this.endo.basis,n=t[0],i=t[1],o=i.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),f=o.mul(n.a),c=a.mul(i.a),l=o.mul(n.b),h=a.mul(i.b),d=e.sub(f).sub(c),y=l.add(h).neg();return{k1:d,k2:y}},"_endoSplit");Un.prototype.pointFromX=s(function(e,t){e=new Fe.default(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(t&&!o||!t&&o)&&(i=i.redNeg()),this.point(e,i)},"pointFromX");Un.prototype.validate=s(function(e){if(e.inf)return!0;var t=e.x,n=e.y,i=this.a.redMul(t),o=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0},"validate");Un.prototype._endoWnafMulAdd=s(function(e,t,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,a=0;a<e.length;a++){var f=this._endoSplit(t[a]),c=e[a],l=c._getBeta();f.k1.negative&&(f.k1.ineg(),c=c.neg(!0)),f.k2.negative&&(f.k2.ineg(),l=l.neg(!0)),i[a*2]=c,i[a*2+1]=l,o[a*2]=f.k1,o[a*2+1]=f.k2}for(var h=this._wnafMulAdd(1,i,o,a*2,n),d=0;d<a*2;d++)i[d]=null,o[d]=null;return h},"_endoWnafMulAdd");function sr(r,e,t,n){_a.BasePoint.call(this,r,"affine"),e===null&&t===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Fe.default(e,16),this.y=new Fe.default(t,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}s(sr,"Point");ib(sr,_a.BasePoint);Un.prototype.point=s(function(e,t,n){return new sr(this,e,t,n)},"point");Un.prototype.pointFromJSON=s(function(e,t){return sr.fromJSON(this,e,t)},"pointFromJSON");sr.prototype._getBeta=s(function(){if(!!this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,i=s(function(o){return n.point(o.x.redMul(n.endo.beta),o.y)},"endoMul");e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(i)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(i)}}}return t}},"_getBeta");sr.prototype.toJSON=s(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]},"toJSON");sr.fromJSON=s(function(e,t,n){typeof t=="string"&&(t=JSON.parse(t));var i=e.point(t[0],t[1],n);if(!t[2])return i;function o(f){return e.point(f[0],f[1],n)}s(o,"obj2point");var a=t[2];return i.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[i].concat(a.doubles.points.map(o))},naf:a.naf&&{wnd:a.naf.wnd,points:[i].concat(a.naf.points.map(o))}},i},"fromJSON");sr.prototype.inspect=s(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect");sr.prototype.isInfinity=s(function(){return this.inf},"isInfinity");sr.prototype.add=s(function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)},"add");sr.prototype.dbl=s(function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(i),a=o.redSqr().redISub(this.x.redAdd(this.x)),f=o.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,f)},"dbl");sr.prototype.getX=s(function(){return this.x.fromRed()},"getX");sr.prototype.getY=s(function(){return this.y.fromRed()},"getY");sr.prototype.mul=s(function(e){return e=new Fe.default(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},"mul");sr.prototype.mulAdd=s(function(e,t,n){var i=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)},"mulAdd");sr.prototype.jmulAdd=s(function(e,t,n){var i=[this,t],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)},"jmulAdd");sr.prototype.eq=s(function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},"eq");sr.prototype.neg=s(function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=s(function(o){return o.neg()},"negate");t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return t},"neg");sr.prototype.toJ=s(function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},"toJ");function br(r,e,t,n){_a.BasePoint.call(this,r,"jacobian"),e===null&&t===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Fe.default(0)):(this.x=new Fe.default(e,16),this.y=new Fe.default(t,16),this.z=new Fe.default(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}s(br,"JPoint");ib(br,_a.BasePoint);Un.prototype.jpoint=s(function(e,t,n){return new br(this,e,t,n)},"jpoint");br.prototype.toP=s(function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(n,i)},"toP");br.prototype.neg=s(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg");br.prototype.add=s(function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(t),o=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),f=e.y.redMul(n.redMul(this.z)),c=i.redSub(o),l=a.redSub(f);if(c.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=c.redSqr(),d=h.redMul(c),y=i.redMul(h),A=l.redSqr().redIAdd(d).redISub(y).redISub(y),v=l.redMul(y.redISub(A)).redISub(a.redMul(d)),x=this.z.redMul(e.z).redMul(c);return this.curve.jpoint(A,v,x)},"add");br.prototype.mixedAdd=s(function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,i=e.x.redMul(t),o=this.y,a=e.y.redMul(t).redMul(this.z),f=n.redSub(i),c=o.redSub(a);if(f.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var l=f.redSqr(),h=l.redMul(f),d=n.redMul(l),y=c.redSqr().redIAdd(h).redISub(d).redISub(d),A=c.redMul(d.redISub(y)).redISub(o.redMul(h)),v=this.z.redMul(f);return this.curve.jpoint(y,A,v)},"mixedAdd");br.prototype.dblp=s(function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var i=this.curve.a,o=this.curve.tinv,a=this.x,f=this.y,c=this.z,l=c.redSqr().redSqr(),h=f.redAdd(f);for(t=0;t<e;t++){var d=a.redSqr(),y=h.redSqr(),A=y.redSqr(),v=d.redAdd(d).redIAdd(d).redIAdd(i.redMul(l)),x=a.redMul(y),L=v.redSqr().redISub(x.redAdd(x)),_=x.redISub(L),R=v.redMul(_);R=R.redIAdd(R).redISub(A);var H=h.redMul(c);t+1<e&&(l=l.redMul(A)),a=L,c=H,h=R}return this.curve.jpoint(a,h.redMul(o),c)},"dblp");br.prototype.dbl=s(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl");br.prototype._zeroDbl=s(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),f=this.x.redAdd(o).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var c=i.redAdd(i).redIAdd(i),l=c.redSqr().redISub(f).redISub(f),h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),e=l,t=c.redMul(f.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.x.redSqr(),y=this.y.redSqr(),A=y.redSqr(),v=this.x.redAdd(y).redSqr().redISub(d).redISub(A);v=v.redIAdd(v);var x=d.redAdd(d).redIAdd(d),L=x.redSqr(),_=A.redIAdd(A);_=_.redIAdd(_),_=_.redIAdd(_),e=L.redISub(v).redISub(v),t=x.redMul(v.redISub(e)).redISub(_),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},"_zeroDbl");br.prototype._threeDbl=s(function(){var e,t,n;if(this.zOne){var i=this.x.redSqr(),o=this.y.redSqr(),a=o.redSqr(),f=this.x.redAdd(o).redSqr().redISub(i).redISub(a);f=f.redIAdd(f);var c=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),l=c.redSqr().redISub(f).redISub(f);e=l;var h=a.redIAdd(a);h=h.redIAdd(h),h=h.redIAdd(h),t=c.redMul(f.redISub(l)).redISub(h),n=this.y.redAdd(this.y)}else{var d=this.z.redSqr(),y=this.y.redSqr(),A=this.x.redMul(y),v=this.x.redSub(d).redMul(this.x.redAdd(d));v=v.redAdd(v).redIAdd(v);var x=A.redIAdd(A);x=x.redIAdd(x);var L=x.redAdd(x);e=v.redSqr().redISub(L),n=this.y.redAdd(this.z).redSqr().redISub(y).redISub(d);var _=y.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_),t=v.redMul(x.redISub(e)).redISub(_)}return this.curve.jpoint(e,t,n)},"_threeDbl");br.prototype._dbl=s(function(){var e=this.curve.a,t=this.x,n=this.y,i=this.z,o=i.redSqr().redSqr(),a=t.redSqr(),f=n.redSqr(),c=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(o)),l=t.redAdd(t);l=l.redIAdd(l);var h=l.redMul(f),d=c.redSqr().redISub(h.redAdd(h)),y=h.redISub(d),A=f.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var v=c.redMul(y).redISub(A),x=n.redAdd(n).redMul(i);return this.curve.jpoint(d,v,x)},"_dbl");br.prototype.trpl=s(function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),i=t.redSqr(),o=e.redAdd(e).redIAdd(e),a=o.redSqr(),f=this.x.redAdd(t).redSqr().redISub(e).redISub(i);f=f.redIAdd(f),f=f.redAdd(f).redIAdd(f),f=f.redISub(a);var c=f.redSqr(),l=i.redIAdd(i);l=l.redIAdd(l),l=l.redIAdd(l),l=l.redIAdd(l);var h=o.redIAdd(f).redSqr().redISub(a).redISub(c).redISub(l),d=t.redMul(h);d=d.redIAdd(d),d=d.redIAdd(d);var y=this.x.redMul(c).redISub(d);y=y.redIAdd(y),y=y.redIAdd(y);var A=this.y.redMul(h.redMul(l.redISub(h)).redISub(f.redMul(c)));A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A);var v=this.z.redAdd(f).redSqr().redISub(n).redISub(c);return this.curve.jpoint(y,A,v)},"trpl");br.prototype.mul=s(function(e,t){return e=new Fe.default(e,t),this.curve._wnafMul(this,e)},"mul");br.prototype.eq=s(function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var i=t.redMul(this.z),o=n.redMul(e.z);return this.y.redMul(o).redISub(e.y.redMul(i)).cmpn(0)===0},"eq");br.prototype.eqXToP=s(function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var i=e.clone(),o=this.curve.redN.redMul(t);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}},"eqXToP");br.prototype.inspect=s(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)+">"},"inspect");br.prototype.isInfinity=s(function(){return this.z.cmpn(0)===0},"isInfinity");var tp=Xf(function(r,e){"use strict";var t=e;t.base=_a,t.short=xB,t.mont=null,t.edwards=null}),rp=Xf(function(r,e){"use strict";var t=e,n=dn.assert;function i(f){f.type==="short"?this.curve=new tp.short(f):f.type==="edwards"?this.curve=new tp.edwards(f):this.curve=new tp.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}s(i,"PresetCurve"),t.PresetCurve=i;function o(f,c){Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){var l=new i(c);return Object.defineProperty(t,f,{configurable:!0,enumerable:!0,value:l}),l}})}s(o,"defineCurve"),o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ii.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ii.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ii.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ii.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ii.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ii.default.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ii.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var a;try{a=null.crash()}catch(f){a=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ii.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})});function Cs(r){if(!(this instanceof Cs))return new Cs(r);this.hash=r.hash,this.predResist=!!r.predResist,this.outLen=this.hash.outSize,this.minEntropy=r.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=si.toArray(r.entropy,r.entropyEnc||"hex"),t=si.toArray(r.nonce,r.nonceEnc||"hex"),n=si.toArray(r.pers,r.persEnc||"hex");nb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,n)}s(Cs,"HmacDRBG");var L5=Cs;Cs.prototype._init=s(function(e,t,n){var i=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},"init");Cs.prototype._hmac=s(function(){return new Ii.default.hmac(this.hash,this.K)},"hmac");Cs.prototype._update=s(function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},"update");Cs.prototype.reseed=s(function(e,t,n,i){typeof t!="string"&&(i=n,n=t,t=null),e=si.toArray(e,t),n=si.toArray(n,i),nb(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},"reseed");Cs.prototype.generate=s(function(e,t,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=n,n=t,t=null),n&&(n=si.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length<e;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var a=o.slice(0,e);return this._update(n),this._reseed++,si.encode(a,t)},"generate");var rb=dn.assert;function Cr(r,e){this.ec=r,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}s(Cr,"KeyPair");var ob=Cr;Cr.fromPublic=s(function(e,t,n){return t instanceof Cr?t:new Cr(e,{pub:t,pubEnc:n})},"fromPublic");Cr.fromPrivate=s(function(e,t,n){return t instanceof Cr?t:new Cr(e,{priv:t,privEnc:n})},"fromPrivate");Cr.prototype.validate=s(function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate");Cr.prototype.getPublic=s(function(e,t){return typeof e=="string"&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},"getPublic");Cr.prototype.getPrivate=s(function(e){return e==="hex"?this.priv.toString(16,2):this.priv},"getPrivate");Cr.prototype._importPrivate=s(function(e,t){this.priv=new Fe.default(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate");Cr.prototype._importPublic=s(function(e,t){if(e.x||e.y){this.ec.curve.type==="mont"?rb(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&rb(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},"_importPublic");Cr.prototype.derive=s(function(e){return e.validate()||rb(e.validate(),"public point not validated"),e.mul(this.priv).getX()},"derive");Cr.prototype.sign=s(function(e,t,n){return this.ec.sign(e,this,t,n)},"sign");Cr.prototype.verify=s(function(e,t){return this.ec.verify(e,t,this)},"verify");Cr.prototype.inspect=s(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect");var AB=dn.assert;function op(r,e){if(r instanceof op)return r;this._importDER(r,e)||(AB(r.r&&r.s,"Signature without r or s"),this.r=new Fe.default(r.r,16),this.s=new Fe.default(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}s(op,"Signature");var sp=op;function _B(){this.place=0}s(_B,"Position");function eb(r,e){var t=r[e.place++];if(!(t&128))return t;var n=t&15;if(n===0||n>4)return!1;for(var i=0,o=0,a=e.place;o<n;o++,a++)i<<=8,i|=r[a],i>>>=0;return i<=127?!1:(e.place=a,i)}s(eb,"getLength");function R5(r){for(var e=0,t=r.length-1;!r[e]&&!(r[e+1]&128)&&e<t;)e++;return e===0?r:r.slice(e)}s(R5,"rmPadding");op.prototype._importDER=s(function(e,t){e=dn.toArray(e,t);var n=new _B;if(e[n.place++]!==48)return!1;var i=eb(e,n);if(i===!1||i+n.place!==e.length||e[n.place++]!==2)return!1;var o=eb(e,n);if(o===!1)return!1;var a=e.slice(n.place,o+n.place);if(n.place+=o,e[n.place++]!==2)return!1;var f=eb(e,n);if(f===!1||e.length!==f+n.place)return!1;var c=e.slice(n.place,f+n.place);if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;return this.r=new Fe.default(a),this.s=new Fe.default(c),this.recoveryParam=null,!0},"_importDER");function tb(r,e){if(e<128){r.push(e);return}var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(t|128);--t;)r.push(e>>>(t<<3)&255);r.push(e)}s(tb,"constructLength");op.prototype.toDER=s(function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=R5(t),n=R5(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];tb(i,t.length),i=i.concat(t),i.push(2),tb(i,n.length);var o=i.concat(n),a=[48];return tb(a,o.length),a=a.concat(o),dn.encode(a,e)},"toDER");var EB=s(function(){throw new Error("unsupported")},"rand"),D5=dn.assert;function Pn(r){if(!(this instanceof Pn))return new Pn(r);typeof r=="string"&&(D5(Object.prototype.hasOwnProperty.call(rp,r),"Unknown curve "+r),r=rp[r]),r instanceof rp.PresetCurve&&(r={curve:r}),this.curve=r.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=r.curve.g,this.g.precompute(r.curve.n.bitLength()+1),this.hash=r.hash||r.curve.hash}s(Pn,"EC");var SB=Pn;Pn.prototype.keyPair=s(function(e){return new ob(this,e)},"keyPair");Pn.prototype.keyFromPrivate=s(function(e,t){return ob.fromPrivate(this,e,t)},"keyFromPrivate");Pn.prototype.keyFromPublic=s(function(e,t){return ob.fromPublic(this,e,t)},"keyFromPublic");Pn.prototype.genKeyPair=s(function(e){e||(e={});for(var t=new L5({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||EB(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new Fe.default(2));;){var o=new Fe.default(t.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}},"genKeyPair");Pn.prototype._truncateToN=s(function(e,t){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},"_truncateToN");Pn.prototype.sign=s(function(e,t,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Fe.default(e,16));for(var o=this.n.byteLength(),a=t.getPrivate().toArray("be",o),f=e.toArray("be",o),c=new L5({hash:this.hash,entropy:a,nonce:f,pers:i.pers,persEnc:i.persEnc||"utf8"}),l=this.n.sub(new Fe.default(1)),h=0;;h++){var d=i.k?i.k(h):new Fe.default(c.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var y=this.g.mul(d);if(!y.isInfinity()){var A=y.getX(),v=A.umod(this.n);if(v.cmpn(0)!==0){var x=d.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var L=(y.getY().isOdd()?1:0)|(A.cmp(v)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),L^=1),new sp({r:v,s:x,recoveryParam:L})}}}}}},"sign");Pn.prototype.verify=s(function(e,t,n,i){e=this._truncateToN(new Fe.default(e,16)),n=this.keyFromPublic(n,i),t=new sp(t,"hex");var o=t.r,a=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var f=a.invm(this.n),c=f.mul(e).umod(this.n),l=f.mul(o).umod(this.n),h;return this.curve._maxwellTrick?(h=this.g.jmulAdd(c,n.getPublic(),l),h.isInfinity()?!1:h.eqXToP(o)):(h=this.g.mulAdd(c,n.getPublic(),l),h.isInfinity()?!1:h.getX().umod(this.n).cmp(o)===0)},"verify");Pn.prototype.recoverPubKey=function(r,e,t,n){D5((3&t)===t,"The recovery param is more than two bits"),e=new sp(e,n);var i=this.n,o=new Fe.default(r),a=e.r,f=e.s,c=t&1,l=t>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");l?a=this.curve.pointFromX(a.add(this.curve.n),c):a=this.curve.pointFromX(a,c);var h=e.r.invm(i),d=i.sub(o).mul(h).umod(i),y=f.mul(h).umod(i);return this.g.mulAdd(d,a,y)};Pn.prototype.getKeyRecoveryParam=function(r,e,t,n){if(e=new sp(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(r,e,i)}catch(a){continue}if(o.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var CB=Xf(function(r,e){"use strict";var t=e;t.version="6.5.4",t.utils=dn,t.rand=function(){throw new Error("unsupported")},t.curve=tp,t.curves=rp,t.ec=SB,t.eddsa=null}),F5=CB.ec;var K5="signing-key/5.6.1";var ab=new He(K5),sb=null;function Ni(){return sb||(sb=new F5("secp256k1")),sb}s(Ni,"getCurve");var ap=class{constructor(e){Yf(this,"curve","secp256k1"),Yf(this,"privateKey",Sr(e)),Zd(this.privateKey)!==32&&ab.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=Ni().keyFromPrivate(kt(this.privateKey));Yf(this,"publicKey","0x"+t.getPublic(!1,"hex")),Yf(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Yf(this,"_isSigningKey",!0)}_addPoint(e){let t=Ni().keyFromPublic(kt(this.publicKey)),n=Ni().keyFromPublic(kt(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){let t=Ni().keyFromPrivate(kt(this.privateKey)),n=kt(e);n.length!==32&&ab.throwArgumentError("bad digest length","digest",e);let i=t.sign(n,{canonical:!0});return ep({recoveryParam:i.recoveryParam,r:Ss("0x"+i.r.toString(16),32),s:Ss("0x"+i.s.toString(16),32)})}computeSharedSecret(e){let t=Ni().keyFromPrivate(kt(this.privateKey)),n=Ni().keyFromPublic(kt(fb(e)));return Ss("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}};s(ap,"SigningKey");function $5(r,e){let t=ep(e),n={r:kt(t.r),s:kt(t.s)};return"0x"+Ni().recoverPubKey(kt(r),n,t.recoveryParam).encode("hex",!1)}s($5,"recoverPublicKey");function fb(r,e){let t=kt(r);if(t.length===32){let n=new ap(t);return e?"0x"+Ni().keyFromPrivate(t).getPublic(!0,"hex"):n.publicKey}else{if(t.length===33)return e?Sr(t):"0x"+Ni().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ni().keyFromPublic(t).getPublic(!0,"hex"):Sr(t)}return ab.throwArgumentError("invalid public or private key","key","[REDACTED]")}s(fb,"computePublicKey");var H5="transactions/5.6.0";var JH=new He(H5),q5;(function(r){r[r.legacy=0]="legacy",r[r.eip2930=1]="eip2930",r[r.eip1559=2]="eip1559"})(q5||(q5={}));function z5(r){let e=fb(r);return M5(Qd(Jf(Qd(e,1)),12))}s(z5,"computeAddress");function j5(r,e){return z5($5(kt(r),e))}s(j5,"recoverAddress");var V5="wallet/5.6.0";var iq=new He(V5);function W5(r,e){return j5(Q1(r),e)}s(W5,"verifyMessage");_u();var TB=`
|
661
661
|
sign-in-with-ethereum =
|
662
662
|
domain %s" wants you to sign in with your Ethereum account:" LF
|
663
663
|
address LF
|
@@ -804,18 +804,18 @@ LF = %x0A
|
|
804
804
|
DIGIT = %x30-39
|
805
805
|
; 0-9
|
806
806
|
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
807
|
-
`,
|
808
|
-
- `)),Y},"resources");i.ast.callbacks.resources=
|
809
|
-
`),i=`Version: ${this.version}`;this.nonce||(this.nonce=(Math.random()+1).toString(36).substring(4));let
|
810
|
-
`));let
|
807
|
+
`,fp=class{constructor(e){this.domain=void 0,this.address=void 0,this.statement=void 0,this.uri=void 0,this.version=void 0,this.nonce=void 0,this.issuedAt=void 0,this.expirationTime=void 0,this.notBefore=void 0,this.requestId=void 0,this.chainId=void 0,this.resources=void 0;let t=new J5.default(TB);if(t.generate(),t.errors.length)throw console.error(t.errorsToAscii()),console.error(t.linesToAscii()),console.log(t.displayAttributeErrors()),new Error("ABNF grammar has errors");let n=t.toObject(),i=new Tr.default.parser;i.ast=new Tr.default.ast;let o=Tr.default.ids,a=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.domain=Tr.default.utils.charsToString(j,D,B)),Y},"domain");i.ast.callbacks.domain=a;let f=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.address=Tr.default.utils.charsToString(j,D,B)),Y},"address");i.ast.callbacks.address=f;let c=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.statement=Tr.default.utils.charsToString(j,D,B)),Y},"statement");i.ast.callbacks.statement=c;let l=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.uri||(U.uri=Tr.default.utils.charsToString(j,D,B))),Y},"uri");i.ast.callbacks.uri=l;let h=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.version=Tr.default.utils.charsToString(j,D,B)),Y},"version");i.ast.callbacks.version=h;let d=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.chainId=Tr.default.utils.charsToString(j,D,B)),Y},"chainId");i.ast.callbacks["chain-id"]=d;let y=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.nonce=Tr.default.utils.charsToString(j,D,B)),Y},"nonce");i.ast.callbacks.nonce=y;let A=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.issuedAt=Tr.default.utils.charsToString(j,D,B)),Y},"issuedAt");i.ast.callbacks["issued-at"]=A;let v=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.expirationTime=Tr.default.utils.charsToString(j,D,B)),Y},"expirationTime");i.ast.callbacks["expiration-time"]=v;let x=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.notBefore=Tr.default.utils.charsToString(j,D,B)),Y},"notBefore");i.ast.callbacks["not-before"]=x;let L=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.requestId=Tr.default.utils.charsToString(j,D,B)),Y},"requestId");i.ast.callbacks["request-id"]=L;let _=s(function($,j,D,B,U){let Y=o.SEM_OK;return $===o.SEM_PRE&&(U.resources=Tr.default.utils.charsToString(j,D,B).slice(3).split(`
|
808
|
+
- `)),Y},"resources");i.ast.callbacks.resources=_;let R=i.parse(n,"sign-in-with-ethereum",e);if(!R.success)throw new Error(`Invalid message: ${JSON.stringify(R)}`);let H={};i.ast.translate(H);for(let[$,j]of Object.entries(H))this[$]=j}};s(fp,"ParsedMessage");var G5;(function(r){r.INVALID_SIGNATURE="Invalid signature.",r.EXPIRED_MESSAGE="Expired message.",r.MALFORMED_SESSION="Malformed session."})(G5||(G5={}));var cp;(function(r){r.PERSONAL_SIGNATURE="Personal signature"})(cp||(cp={}));var Zf=class{constructor(e){if(this.domain=void 0,this.address=void 0,this.statement=void 0,this.uri=void 0,this.version=void 0,this.nonce=void 0,this.issuedAt=void 0,this.expirationTime=void 0,this.notBefore=void 0,this.requestId=void 0,this.chainId=void 0,this.resources=void 0,this.signature=void 0,this.type=void 0,typeof e=="string"){let t=new fp(e);this.domain=t.domain,this.address=t.address,this.statement=t.statement,this.uri=t.uri,this.version=t.version,this.nonce=t.nonce,this.issuedAt=t.issuedAt,this.expirationTime=t.expirationTime,this.notBefore=t.notBefore,this.requestId=t.requestId,this.chainId=t.chainId,this.resources=t.resources}else Object.assign(this,e)}static fromCacao(e){let t=xa.parse(e.p.iss.replace("did:pkh:","")),n=new Zf({domain:e.p.domain,address:t.address,uri:e.p.aud,version:e.p.version,chainId:new Es(t.chainId).reference});return e.p.statement&&(n.statement=e.p.statement),e.p.nonce&&(n.nonce=e.p.nonce),e.p.iat&&(n.issuedAt=e.p.iat),e.p.exp&&(n.expirationTime=e.p.exp),e.p.nbf&&(n.notBefore=e.p.nbf),e.p.requestId&&(n.requestId=e.p.requestId),e.p.resources&&(n.resources=e.p.resources),e.s&&(e.s.s&&(n.signature=e.s.s),e.s.t==="eip191"&&(n.type=cp.PERSONAL_SIGNATURE)),n}toMessage(){let e=`${this.domain} wants you to sign in with your Ethereum account:`,t=`URI: ${this.uri}`,n=[e,this.address].join(`
|
809
|
+
`),i=`Version: ${this.version}`;this.nonce||(this.nonce=(Math.random()+1).toString(36).substring(4));let o=`Nonce: ${this.nonce}`,a=[t,i,o];if(this.issuedAt=this.issuedAt?this.issuedAt:new Date().toISOString(),a.push(`Issued At: ${this.issuedAt}`),this.expirationTime){let c=`Expiration Time: ${this.expirationTime}`;a.push(c)}this.notBefore&&a.push(`Not Before: ${this.notBefore}`),this.requestId&&a.push(`Request ID: ${this.requestId}`),this.chainId&&a.push(`Chain ID: ${this.chainId}`),this.resources&&a.push(["Resources:",...this.resources.map(c=>`- ${c}`)].join(`
|
810
|
+
`));let f=a.join(`
|
811
811
|
`);return this.statement&&(n=[n,this.statement].join(`
|
812
812
|
|
813
|
-
`)),[n,
|
813
|
+
`)),[n,f].join(`
|
814
814
|
|
815
|
-
`)}signMessage(){let e;switch(this.type){case Jd.PERSONAL_SIGNATURE:{e=this.toMessage();break}default:{e=this.toMessage();break}}return e}};o(Fc,"SiweMessage");var Vu;(function(r){function e(i){let s={h:{t:"eip4361"},p:{domain:i.domain,iat:i.issuedAt,iss:`did:pkh:eip155:${i.chainId}:${i.address}`,aud:i.uri,version:i.version,nonce:i.nonce}};return i.signature&&(s.s={t:"eip191",s:i.signature}),i.notBefore&&(s.p.nbf=i.notBefore),i.expirationTime&&(s.p.exp=i.expirationTime),i.statement&&(s.p.statement=i.statement),i.requestId&&(s.p.requestId=i.requestId),i.resources&&(s.p.resources=i.resources),s}o(e,"fromSiweMessage"),r.fromSiweMessage=e;function t(i,s={}){var a;if(i.h.t==="eip4361"&&((a=i.s)==null?void 0:a.t)==="eip191")return n(i,s);throw new Error("Unsupported CACAO signature type")}o(t,"verify"),r.verify=t;function n(i,s){if(!i.s)throw new Error("CACAO does not have a signature");let a=s.atTime?s.atTime.getTime():Date.now();if(Date.parse(i.p.iat)>a||Date.parse(i.p.nbf)>a)throw new Error("CACAO is not valid yet");if(Date.parse(i.p.exp)<a)throw new Error("CACAO has expired");let c=Fc.fromCacao(i),f=i.s.s,l=w5(c.toMessage(),f),h=pa.parse(i.p.iss.replace("did:pkh:","")).address;if(l.toLowerCase()!==h.toLowerCase())throw new Error("Signature does not belong to issuer")}o(n,"verifyEIP191Signature"),r.verifyEIP191Signature=n})(Vu||(Vu={}));var Gu;(function(r){let e=o(function(t){try{return Promise.resolve(ca({value:t,codec:cs,hasher:Wo}))}catch(n){return Promise.reject(n)}},"fromCacao");r.fromCacao=e})(Gu||(Gu={}));var A5=ze(wc(),1);function E5(){return jt((0,A5.randomBytes)(16),"base64")}o(E5,"randomString");var S5="base64pad",C5="base64url";function k5(r){return jt(r,S5)}o(k5,"encodeBase64");function T5(r){return jt(r,C5)}o(T5,"encodeBase64Url");function M5(r){return Gt(r,S5)}o(M5,"decodeBase64");function Wd(r){return JSON.parse(jt(Gt(r,C5)))}o(Wd,"base64urlToJSON");function B5(r){if(r.signatures.length>1)throw new Error("Cant convert to compact jws");return`${r.signatures[0].protected}.${r.payload}.${r.signatures[0].signature}`}o(B5,"fromDagJWS");function N5(r,e){if(e){let t=e.toISOString().split(".")[0]+"Z";return`${r}?versionTime=${t}`}else return r}o(N5,"didWithTime");function I5(r){return r?Array.isArray(r)?r:[r]:[]}o(I5,"extractControllers");function FM(r){return"registry"in r&&"cache"in r}o(FM,"isResolver");var ga=class{constructor({provider:e,resolver:t={},resolverOptions:n,capability:i,parent:s}={}){if(e!=null&&(this._client=new Nc(e)),i){if(this._capability=i,this._parentId=this._capability.p.iss,s&&this._parentId!==s)throw new Error("Capability issuer and parent not equal")}else s&&(this._parentId=s);this.setResolver(t,n)}get capability(){if(!this._capability)throw new Error("DID has no capability attached");return this._capability}get hasCapability(){return this._capability!=null}get parent(){if(!this._parentId)throw new Error("DID has no parent DID");return this._parentId}get hasParent(){return this._parentId!=null}get id(){if(this._id==null)throw new Error("DID is not authenticated");return this._id}get authenticated(){return this._id!=null}withCapability(e){var t;return new ga({provider:(t=this._client)==null?void 0:t.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Nc(e);else if(this._client.connection!==e)throw new Error("A different provider is already set, create a new DID instance to use another provider")}setResolver(e,t){this._resolver=FM(e)?e:new au(e,t)}authenticate(){return M(this,arguments,function*({provider:e,paths:t=[],aud:n}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let i=E5(),s=yield this._client.request("did_authenticate",{nonce:i,aud:n,paths:t}),{kid:a}=yield this.verifyJWS(s),c=Wd(s.payload);if(!a.includes(c.did))throw new Error("Invalid authencation response, kid mismatch");if(c.nonce!==i)throw new Error("Invalid authencation response, wrong nonce");if(c.aud!==n)throw new Error("Invalid authencation response, wrong aud");if(c.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=c.did,this._id})}createJWS(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");if(this._capability){let s=yield Gu.fromCacao(this._capability),a=Ie.asCID(s.cid);if(!a)throw new Error("Capability CID of the JWS cannot be set to the capability payload cid as they are incompatible");t.protected=t.protected||{},t.protected.cap=`ipfs://${a==null?void 0:a.toString()}`}let{jws:i}=yield this._client.request("did_createJWS",be(ne({did:this._id},t),{payload:e}));return i})}createDagJWS(n){return M(this,arguments,function*(e,t={}){let{cid:i,linkedBlock:s}=yield D3(e),a=T5(i.bytes);Object.assign(t,{linkedBlock:k5(s)});let c=yield this.createJWS(a,t),f=Ie.asCID(i);if(!f)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(c.link=f,this._capability){let l=yield Gu.fromCacao(this._capability);return{jws:c,linkedBlock:s,cacaoBlock:l.bytes}}return{jws:c,linkedBlock:s}})}verifyJWS(n){return M(this,arguments,function*(e,t={}){var h,d,v,x,y,_,U;typeof e!="string"&&(e=B5(e));let i=Wd(e.split(".")[0]).kid;if(!i)throw new Error('No "kid" found in jws');let s=yield this.resolve(i);if(!t.disableTimecheck){let E=(h=s.didDocumentMetadata)==null?void 0:h.nextUpdate;if(E){let H=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,F=new Date(E).valueOf()+H;if(!(t.atTime&&t.atTime.getTime()<F))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${i}`)}let L=(d=s.didDocumentMetadata)==null?void 0:d.updated;if(L&&t.atTime&&t.atTime.getTime()<new Date(L).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${i}`)}let c=(v=s.didDocument)==null?void 0:v.id;if(t.issuer&&t.issuer===((x=t.capability)==null?void 0:x.p.iss)&&c===t.capability.p.aud)Vu.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(t.issuer&&t.issuer!==c){let E=N5(t.issuer,t.atTime),H=(y=(yield this.resolve(E)).didDocument)==null?void 0:y.controller,F=I5(H);if(((_=t.capability)==null?void 0:_.s)&&t.capability.p.aud===c&&F.includes(t.capability.p.iss))Vu.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(!(c?F.includes(c):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${i}`)}let f=((U=s.didDocument)==null?void 0:U.verificationMethod)||[];C6(e,f);let l;try{l=Wd(e.split(".")[1])}catch(E){}return{kid:i,payload:l,didResolutionResult:s}})}createJWE(i,s){return M(this,arguments,function*(e,t,n={}){let a=yield M6(t,this._resolver);return T6(e,a,n.protectedHeader,n.aad)})}createDagJWE(i,s){return M(this,arguments,function*(e,t,n={}){let a=yield K3(e);return this.createJWE(a,t,n)})}decryptJWE(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");let{cleartext:i}=yield this._client.request("did_decryptJWE",be(ne({did:this._id},t),{jwe:e}));return M5(i)})}decryptDagJWE(e){return M(this,null,function*(){let t=yield this.decryptJWE(e);return $3(t)})}resolve(e){return M(this,null,function*(){let t=yield this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:n,message:i}=t.didResolutionMetadata,s=i?`, ${i}`:"";throw new Error(`Failed to resolve ${e}: ${n}${s}`)}return t})}};o(ga,"DID");function Yd(r){var e=0,t=r.length,n=[];if(t%2)throw new Error("invalid hex:"+r);for(;e<t;e+=2)n.push(parseInt(r.substr(e,2),16));return new Uint8Array(n)}o(Yd,"toUint8Array");var iA=ze(S4());var ep=ze(ad(),1);var N4=ze(k4(),1);var iN="base64pad";function T4(r){return JSON.parse((0,N4.default)(r))}o(T4,"toStableObject");function sN(r){let e=new Uint8Array(r.length+2);return e[0]=237,e[1]=1,e.set(r,2),`did:key:z${jt(e,"base58btc")}`}o(sN,"encodeDID");function M4(r){let[e,t,n]=r.split(".");return{payload:t,signatures:[{protected:e,signature:n}]}}o(M4,"toGeneralJWS");var B4=o((i,s,a,...c)=>M(void 0,[i,s,a,...c],function*(r,e,t,n={}){let f=`${e}#${e.split(":")[2]}`,l=x6(t),h=T4(Object.assign(n,{kid:f,alg:"EdDSA"}));return S6(typeof r=="string"?r:T4(r),l,h)}),"sign"),oN={did_authenticate:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){let s=yield B4({did:r,aud:t.aud,nonce:t.nonce,paths:t.paths,exp:Math.floor(Date.now()/1e3)+600},r,e);return M4(s)}),did_createJWS:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){if(t.did.split("#")[0]!==r)throw new jr(4100,`Unknown DID: ${r}`);let a=yield B4(t.payload,r,e,t.protected);return{jws:M4(a)}}),did_decryptJWE:(t,n)=>M(void 0,[t,n],function*({secretKey:r},e){let i=N6((0,ep.convertSecretKeyToX25519)(r));try{let s=yield k6(e.jwe,i);return{cleartext:jt(s,iN)}}catch(s){throw new jr(-32e3,s.message)}})},Yu=class{constructor(e){let{secretKey:t,publicKey:n}=(0,ep.generateKeyPairFromSeed)(e),i=sN(n),s=G3(oN);this._handle=a=>M(this,null,function*(){return yield s({did:i,secretKey:t},a)})}get isDidProvider(){return!0}send(e){return M(this,null,function*(){return yield this._handle(e)})}};o(Yu,"Ed25519Provider");Xi();Nh();var I4={tile:0,"caip10-link":1,model:2,MID:3};function aN(r){let e=I4[r];if(typeof e!="undefined")return e;throw new Error(`No stream type registered for name ${r}`)}o(aN,"codeByName");function cN(r){let e=Object.entries(I4).find(([,t])=>t===r);if(e)return e[0];throw new Error(`No stream type registered for index ${r}`)}o(cN,"nameByCode");var Gr=class{};o(Gr,"StreamType");Gr.nameByCode=cN;Gr.codeByName=aN;var cb=ze(Ju(),1);function un(r){let e,t,n;return typeof r=="object"?(e=r.hashFunction,t=r.expiring,n=r.tags):e=r,(i,s,a)=>{if(a.value!=null)a.value=O4(a.value,e,t,n);else if(a.get!=null)a.get=O4(a.get,e,t,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}o(un,"Memoize");var eb=new Map;function O4(r,e,t=0,n){let i=Symbol("__memoized_map__");return function(...s){let a;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let c=this[i];if(Array.isArray(n))for(let f of n)eb.has(f)?eb.get(f).push(c):eb.set(f,[c]);if(e||s.length>0||t>0){let f;e===!0?f=s.map(d=>d.toString()).join("!"):e?f=e.apply(this,s):f=s[0];let l=`${f}__timestamp`,h=!1;if(t>0)if(!c.has(l))h=!0;else{let d=c.get(l);h=Date.now()-d>t}c.has(f)&&!h?a=c.get(f):(a=r.apply(this,s),c.set(f,a),t>0&&c.set(l,Date.now()))}else{let f=this;c.has(f)?a=c.get(f):(a=r.apply(this,s),c.set(f,a))}return a}}o(O4,"getNewFunction");Xi();var tb=ze(Ju(),1);ac();function Ni(r){let e=tb.default.decode(r),t=tb.default.decode.bytes,n=r.slice(t);return[e,n,t]}o(Ni,"readVarint");function fN(r){return r===0||r===1}o(fN,"isCidVersion");function rb(r){let e=nb(r);if(e instanceof Error)throw e;return e}o(rb,"readCid");function nb(r){let[e,t]=Ni(r);if(!fN(e))return new Error(`Unknown CID version ${e}`);let[n,i]=Ni(t),[,s,a]=Ni(i),[c,,f]=Ni(s),l=i.slice(0,a+f+c),h=i.slice(a+f+c);return[Ie.create(e,n,uu(l)),h]}o(nb,"readCidNoThrow");Xi();Nh();hu();var ib=ze(Ju(),1);var Qu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Pn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},P4=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Xu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qc,Zu;function uN(r){let e=ob(r);if(e instanceof Error)throw e;return e}o(uN,"fromBytes");function ob(r){let[e,t]=Ni(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ni(t),s=nb(i);if(s instanceof Error)return s;let[a,c]=s;return c.length>0?new Error("Invalid StreamID: contains commit"):new Fe(n,a)}o(ob,"fromBytesNoThrow");function lN(r){let e=U4(r);if(e instanceof Error)throw e;return e}o(lN,"fromString");function U4(r){let e=r.replace("ceramic://","").replace("/ceramic/",""),t=e.includes("commit")?e.split("?")[0]:e,n=jo.decode(t);return ob(n)}o(U4,"fromStringNoThrow");var R4=Symbol.for("@ceramicnetwork/streamid/StreamID"),Fe=class{constructor(e,t){if(this._tag=R4,qc.set(this,void 0),Zu.set(this,void 0),!(e||e===0))throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");P4(this,qc,typeof e=="string"?Gr.codeByName(e):e,"f"),P4(this,Zu,typeof t=="string"?Ie.parse(t):t,"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===R4}static fromGenesis(e,t){return M(this,null,function*(){let n=yield ca({value:t,codec:cs,hasher:Wo});return new Fe(e,n.cid)})}get type(){return Xu(this,qc,"f")}get typeName(){return Gr.nameByCode(Xu(this,qc,"f"))}get cid(){return Xu(this,Zu,"f")}get bytes(){let e=ib.default.encode(206),t=ib.default.encode(this.type);return di([e,t,this.cid.bytes])}get baseID(){return new Fe(Xu(this,qc,"f"),Xu(this,Zu,"f"))}equals(e){return Fe.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return jo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(qc=new WeakMap,Zu=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(Fe,"StreamID");Fe.fromBytes=uN;Fe.fromBytesNoThrow=ob;Fe.fromString=lN;Fe.fromStringNoThrow=U4;Qu([un(),Pn("design:type",String),Pn("design:paramtypes",[])],Fe.prototype,"typeName",null);Qu([un(),Pn("design:type",Uint8Array),Pn("design:paramtypes",[])],Fe.prototype,"bytes",null);Qu([un(),Pn("design:type",Fe),Pn("design:paramtypes",[])],Fe.prototype,"baseID",null);Qu([un(),Pn("design:type",Function),Pn("design:paramtypes",[]),Pn("design:returntype",String)],Fe.prototype,"toString",null);Qu([un(),Pn("design:type",Function),Pn("design:paramtypes",[]),Pn("design:returntype",String)],Fe.prototype,"toUrl",null);var jc=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Jr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ab=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ps=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},zc,va,el;function hN(r){let e=fb(r);if(e instanceof Error)throw e;return e}o(hN,"fromBytes");function fb(r){let[e,t]=Ni(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ni(t),s=rb(i);if(s instanceof Error)return s;let[a,c]=s;if(c.length===0)return new Error("No commit information provided");if(c.length===1)return new tt(n,a,c[0]);{let[f]=rb(c);return new tt(n,a,f)}}o(fb,"fromBytesNoThrow");function dN(r){try{return typeof r=="string"?Ie.parse(r):Ie.asCID(r)}catch(e){return}}o(dN,"parseCID");function pN(r,e=null){if(!e)return null;let t=dN(e);if(t)return r.equals(t)?null:t;if(String(e)==="0")return null;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}o(pN,"parseCommit");function mN(r){let e=D4(r);if(e instanceof Error)throw e;return e}o(mN,"fromString");function D4(r){let e=r.replace("ceramic://","").replace("/ceramic/","");if(e.includes("commit")){let t=e.split("?")[1].split("=")[1],n=e.split("?")[0];return K4(Fe.fromString(n),t)}else return fb(jo.decode(e))}o(D4,"fromStringNoThrow");var L4=Symbol.for("@ceramicnetwork/streamid/CommitID");function K4(r,e){return new tt(r.type,r.cid,e)}o(K4,"make");var tt=class{constructor(e,t,n=null){if(this._tag=L4,zc.set(this,void 0),va.set(this,void 0),el.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");ab(this,zc,typeof e=="string"?Gr.codeByName(e):e,"f"),ab(this,va,typeof t=="string"?Ie.parse(t):t,"f"),ab(this,el,pN(ps(this,va,"f"),n),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===L4}get baseID(){return new Fe(ps(this,zc,"f"),ps(this,va,"f"))}get type(){return ps(this,zc,"f")}get typeName(){return Gr.nameByCode(ps(this,zc,"f"))}get cid(){return ps(this,va,"f")}get commit(){return ps(this,el,"f")||ps(this,va,"f")}get bytes(){var i;let e=cb.default.encode(206),t=cb.default.encode(this.type),n=((i=ps(this,el,"f"))==null?void 0:i.bytes)||new Uint8Array([0]);return di([e,t,this.cid.bytes,n])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return jo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(zc=new WeakMap,va=new WeakMap,el=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};o(tt,"CommitID");tt.fromBytes=hN;tt.fromBytesNoThrow=fb;tt.fromString=mN;tt.fromStringNoThrow=D4;tt.make=K4;jc([un(),Jr("design:type",Fe),Jr("design:paramtypes",[])],tt.prototype,"baseID",null);jc([un(),Jr("design:type",String),Jr("design:paramtypes",[])],tt.prototype,"typeName",null);jc([un(),Jr("design:type",Ie),Jr("design:paramtypes",[])],tt.prototype,"commit",null);jc([un(),Jr("design:type",Uint8Array),Jr("design:paramtypes",[])],tt.prototype,"bytes",null);jc([un(),Jr("design:type",Function),Jr("design:paramtypes",[]),Jr("design:returntype",String)],tt.prototype,"toString",null);jc([un(),Jr("design:type",Function),Jr("design:paramtypes",[]),Jr("design:returntype",String)],tt.prototype,"toUrl",null);var ni;(function(r){function e(t){if(Fe.isInstance(t))return t;if(tt.isInstance(t))return t;if(t instanceof Uint8Array){let n=tt.fromBytesNoThrow(t);return n instanceof Error?Fe.fromBytes(t):n}else if(typeof t=="string"){let n=tt.fromStringNoThrow(t);return n instanceof Error?Fe.fromString(t):n}else throw new Error("Can not build CommitID or StreamID")}o(e,"from"),r.from=e})(ni||(ni={}));var $4="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",tp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var ub={};Mt(ub,{JsonPatchError:()=>Ot,_areEquals:()=>nl,applyOperation:()=>wa,applyPatch:()=>cp,applyReducer:()=>wN,deepClone:()=>yN,getValueByPointer:()=>op,validate:()=>H4,validator:()=>ap});var bN=function(){var r=o(function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)},"extendStatics");return function(e,t){r(e,t);function n(){this.constructor=e}o(n,"__"),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),gN=Object.prototype.hasOwnProperty;function np(r,e){return gN.call(r,e)}o(np,"hasOwnProperty");function ip(r){if(Array.isArray(r)){for(var e=new Array(r.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(r);var n=[];for(var i in r)np(r,i)&&n.push(i);return n}o(ip,"_objectKeys");function pr(r){switch(typeof r){case"object":return JSON.parse(JSON.stringify(r));case"undefined":return null;default:return r}}o(pr,"_deepClone");function sp(r){for(var e=0,t=r.length,n;e<t;){if(n=r.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}o(sp,"isInteger");function Ii(r){return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}o(Ii,"escapePathComponent");function tl(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}o(tl,"unescapePathComponent");function rp(r){if(r===void 0)return!0;if(r){if(Array.isArray(r)){for(var e=0,t=r.length;e<t;e++)if(rp(r[e]))return!0}else if(typeof r=="object"){for(var n=ip(r),i=n.length,s=0;s<i;s++)if(rp(r[n[s]]))return!0}}return!1}o(rp,"hasUndefined");function F4(r,e){var t=[r];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i!="undefined"&&t.push(n+": "+i)}return t.join(`
|
816
|
-
`)}
|
815
|
+
`)}signMessage(){let e;switch(this.type){case cp.PERSONAL_SIGNATURE:{e=this.toMessage();break}default:{e=this.toMessage();break}}return e}};s(Zf,"SiweMessage");var nl;(function(r){function e(i){let o={h:{t:"eip4361"},p:{domain:i.domain,iat:i.issuedAt,iss:`did:pkh:eip155:${i.chainId}:${i.address}`,aud:i.uri,version:i.version,nonce:i.nonce}};return i.signature&&(o.s={t:"eip191",s:i.signature}),i.notBefore&&(o.p.nbf=i.notBefore),i.expirationTime&&(o.p.exp=i.expirationTime),i.statement&&(o.p.statement=i.statement),i.requestId&&(o.p.requestId=i.requestId),i.resources&&(o.p.resources=i.resources),o}s(e,"fromSiweMessage"),r.fromSiweMessage=e;function t(i,o={}){var a;if(i.h.t==="eip4361"&&((a=i.s)==null?void 0:a.t)==="eip191")return n(i,o);throw new Error("Unsupported CACAO signature type")}s(t,"verify"),r.verify=t;function n(i,o){if(!i.s)throw new Error("CACAO does not have a signature");let a=o.atTime?o.atTime.getTime():Date.now();if(Date.parse(i.p.iat)>a||Date.parse(i.p.nbf)>a)throw new Error("CACAO is not valid yet");if(Date.parse(i.p.exp)<a)throw new Error("CACAO has expired");let f=Zf.fromCacao(i),c=i.s.s,l=W5(f.toMessage(),c),h=xa.parse(i.p.iss.replace("did:pkh:","")).address;if(l.toLowerCase()!==h.toLowerCase())throw new Error("Signature does not belong to issuer")}s(n,"verifyEIP191Signature"),r.verifyEIP191Signature=n})(nl||(nl={}));var il;(function(r){let e=s(function(t){try{return Promise.resolve(ma({value:t,codec:ho,hasher:ra}))}catch(n){return Promise.reject(n)}},"fromCacao");r.fromCacao=e})(il||(il={}));var Y5=ze(If(),1);function X5(){return Gt((0,Y5.randomBytes)(16),"base64")}s(X5,"randomString");var Z5="base64pad",Q5="base64url";function e4(r){return Gt(r,Z5)}s(e4,"encodeBase64");function t4(r){return Gt(r,Q5)}s(t4,"encodeBase64Url");function r4(r){return Yt(r,Z5)}s(r4,"decodeBase64");function up(r){return JSON.parse(Gt(Yt(r,Q5)))}s(up,"base64urlToJSON");function n4(r){if(r.signatures.length>1)throw new Error("Cant convert to compact jws");return`${r.signatures[0].protected}.${r.payload}.${r.signatures[0].signature}`}s(n4,"fromDagJWS");function i4(r,e){if(e){let t=e.toISOString().split(".")[0]+"Z";return`${r}?versionTime=${t}`}else return r}s(i4,"didWithTime");function o4(r){return r?Array.isArray(r)?r:[r]:[]}s(o4,"extractControllers");function kB(r){return"registry"in r&&"cache"in r}s(kB,"isResolver");var Ea=class{constructor({provider:e,resolver:t={},resolverOptions:n,capability:i,parent:o}={}){if(e!=null&&(this._client=new Hf(e)),i){if(this._capability=i,this._parentId=this._capability.p.iss,o&&this._parentId!==o)throw new Error("Capability issuer and parent not equal")}else o&&(this._parentId=o);this.setResolver(t,n)}get capability(){if(!this._capability)throw new Error("DID has no capability attached");return this._capability}get hasCapability(){return this._capability!=null}get parent(){if(!this._parentId)throw new Error("DID has no parent DID");return this._parentId}get hasParent(){return this._parentId!=null}get id(){if(this._id==null)throw new Error("DID is not authenticated");return this._id}get authenticated(){return this._id!=null}withCapability(e){var t;return new Ea({provider:(t=this._client)==null?void 0:t.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Hf(e);else if(this._client.connection!==e)throw new Error("A different provider is already set, create a new DID instance to use another provider")}setResolver(e,t){this._resolver=kB(e)?e:new yu(e,t)}authenticate(){return M(this,arguments,function*({provider:e,paths:t=[],aud:n}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let i=X5(),o=yield this._client.request("did_authenticate",{nonce:i,aud:n,paths:t}),{kid:a}=yield this.verifyJWS(o),f=up(o.payload);if(!a.includes(f.did))throw new Error("Invalid authencation response, kid mismatch");if(f.nonce!==i)throw new Error("Invalid authencation response, wrong nonce");if(f.aud!==n)throw new Error("Invalid authencation response, wrong aud");if(f.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=f.did,this._id})}createJWS(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");if(this._capability){let o=yield il.fromCacao(this._capability),a=Ne.asCID(o.cid);if(!a)throw new Error("Capability CID of the JWS cannot be set to the capability payload cid as they are incompatible");t.protected=t.protected||{},t.protected.cap=`ipfs://${a==null?void 0:a.toString()}`}let{jws:i}=yield this._client.request("did_createJWS",be(ne({did:this._id},t),{payload:e}));return i})}createDagJWS(n){return M(this,arguments,function*(e,t={}){let{cid:i,linkedBlock:o}=yield l3(e),a=t4(i.bytes);Object.assign(t,{linkedBlock:e4(o)});let f=yield this.createJWS(a,t),c=Ne.asCID(i);if(!c)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(f.link=c,this._capability){let l=yield il.fromCacao(this._capability);return{jws:f,linkedBlock:o,cacaoBlock:l.bytes}}return{jws:f,linkedBlock:o}})}verifyJWS(n){return M(this,arguments,function*(e,t={}){var h,d,y,A,v,x,L;typeof e!="string"&&(e=n4(e));let i=up(e.split(".")[0]).kid;if(!i)throw new Error('No "kid" found in jws');let o=yield this.resolve(i);if(!t.disableTimecheck){let _=(h=o.didDocumentMetadata)==null?void 0:h.nextUpdate;if(_){let H=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,$=new Date(_).valueOf()+H;if(!(t.atTime&&t.atTime.getTime()<$))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${i}`)}let R=(d=o.didDocumentMetadata)==null?void 0:d.updated;if(R&&t.atTime&&t.atTime.getTime()<new Date(R).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${i}`)}let f=(y=o.didDocument)==null?void 0:y.id;if(t.issuer&&t.issuer===((A=t.capability)==null?void 0:A.p.iss)&&f===t.capability.p.aud)nl.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(t.issuer&&t.issuer!==f){let _=i4(t.issuer,t.atTime),H=(v=(yield this.resolve(_)).didDocument)==null?void 0:v.controller,$=o4(H);if(((x=t.capability)==null?void 0:x.s)&&t.capability.p.aud===f&&$.includes(t.capability.p.iss))nl.verify(t.capability,{atTime:t.atTime?t.atTime:void 0});else if(!(f?$.includes(f):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${i}`)}let c=((L=o.didDocument)==null?void 0:L.verificationMethod)||[];Qx(e,c);let l;try{l=up(e.split(".")[1])}catch(_){}return{kid:i,payload:l,didResolutionResult:o}})}createJWE(i,o){return M(this,arguments,function*(e,t,n={}){let a=yield r6(t,this._resolver);return t6(e,a,n.protectedHeader,n.aad)})}createDagJWE(i,o){return M(this,arguments,function*(e,t,n={}){let a=yield h3(e);return this.createJWE(a,t,n)})}decryptJWE(n){return M(this,arguments,function*(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");let{cleartext:i}=yield this._client.request("did_decryptJWE",be(ne({did:this._id},t),{jwe:e}));return r4(i)})}decryptDagJWE(e){return M(this,null,function*(){let t=yield this.decryptJWE(e);return d3(t)})}resolve(e){return M(this,null,function*(){let t=yield this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:n,message:i}=t.didResolutionMetadata,o=i?`, ${i}`:"";throw new Error(`Failed to resolve ${e}: ${n}${o}`)}return t})}};s(Ea,"DID");function lp(r){var e=0,t=r.length,n=[];if(t%2)throw new Error("invalid hex:"+r);for(;e<t;e+=2)n.push(parseInt(r.substr(e,2),16));return new Uint8Array(n)}s(lp,"toUint8Array");var I_=ze(Z4());var mp=ze(Ad(),1);var i8=ze(e8(),1);var jI="base64pad";function t8(r){return JSON.parse((0,i8.default)(r))}s(t8,"toStableObject");function VI(r){let e=new Uint8Array(r.length+2);return e[0]=237,e[1]=1,e.set(r,2),`did:key:z${Gt(e,"base58btc")}`}s(VI,"encodeDID");function r8(r){let[e,t,n]=r.split(".");return{payload:t,signatures:[{protected:e,signature:n}]}}s(r8,"toGeneralJWS");var n8=s((i,o,a,...f)=>M(void 0,[i,o,a,...f],function*(r,e,t,n={}){let c=`${e}#${e.split(":")[2]}`,l=Gx(t),h=t8(Object.assign(n,{kid:c,alg:"EdDSA"}));return Zx(typeof r=="string"?r:t8(r),l,h)}),"sign"),WI={did_authenticate:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){let o=yield n8({did:r,aud:t.aud,nonce:t.nonce,paths:t.paths,exp:Math.floor(Date.now()/1e3)+600},r,e);return r8(o)}),did_createJWS:(n,i)=>M(void 0,[n,i],function*({did:r,secretKey:e},t){if(t.did.split("#")[0]!==r)throw new Jr(4100,`Unknown DID: ${r}`);let a=yield n8(t.payload,r,e,t.protected);return{jws:r8(a)}}),did_decryptJWE:(t,n)=>M(void 0,[t,n],function*({secretKey:r},e){let i=i6((0,mp.convertSecretKeyToX25519)(r));try{let o=yield e6(e.jwe,i);return{cleartext:Gt(o,jI)}}catch(o){throw new Jr(-32e3,o.message)}})},al=class{constructor(e){let{secretKey:t,publicKey:n}=(0,mp.generateKeyPairFromSeed)(e),i=VI(n),o=w3(WI);this._handle=a=>M(this,null,function*(){return yield o({did:i,secretKey:t},a)})}get isDidProvider(){return!0}send(e){return M(this,null,function*(){return yield this._handle(e)})}};s(al,"Ed25519Provider");to();Vh();var o8={tile:0,"caip10-link":1,model:2,MID:3};function GI(r){let e=o8[r];if(typeof e!="undefined")return e;throw new Error(`No stream type registered for name ${r}`)}s(GI,"codeByName");function JI(r){let e=Object.entries(o8).find(([,t])=>t===r);if(e)return e[0];throw new Error(`No stream type registered for index ${r}`)}s(JI,"nameByCode");var Xr=class{};s(Xr,"StreamType");Xr.nameByCode=JI;Xr.codeByName=GI;var _b=ze(ol(),1);function pn(r){let e,t,n;return typeof r=="object"?(e=r.hashFunction,t=r.expiring,n=r.tags):e=r,(i,o,a)=>{if(a.value!=null)a.value=s8(a.value,e,t,n);else if(a.get!=null)a.get=s8(a.get,e,t,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}s(pn,"Memoize");var mb=new Map;function s8(r,e,t=0,n){let i=Symbol("__memoized_map__");return function(...o){let a;this.hasOwnProperty(i)||Object.defineProperty(this,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[i];if(Array.isArray(n))for(let c of n)mb.has(c)?mb.get(c).push(f):mb.set(c,[f]);if(e||o.length>0||t>0){let c;e===!0?c=o.map(d=>d.toString()).join("!"):e?c=e.apply(this,o):c=o[0];let l=`${c}__timestamp`,h=!1;if(t>0)if(!f.has(l))h=!0;else{let d=f.get(l);h=Date.now()-d>t}f.has(c)&&!h?a=f.get(c):(a=r.apply(this,o),f.set(c,a),t>0&&f.set(l,Date.now()))}else{let c=this;f.has(c)?a=f.get(c):(a=r.apply(this,o),f.set(c,a))}return a}}s(s8,"getNewFunction");to();var bb=ze(ol(),1);yf();function Ri(r){let e=bb.default.decode(r),t=bb.default.decode.bytes,n=r.slice(t);return[e,n,t]}s(Ri,"readVarint");function YI(r){return r===0||r===1}s(YI,"isCidVersion");function gb(r){let e=yb(r);if(e instanceof Error)throw e;return e}s(gb,"readCid");function yb(r){let[e,t]=Ri(r);if(!YI(e))return new Error(`Unknown CID version ${e}`);let[n,i]=Ri(t),[,o,a]=Ri(i),[f,,c]=Ri(o),l=i.slice(0,a+c+f),h=i.slice(a+c+f);return[Ne.create(e,n,xu(l)),h]}s(yb,"readCidNoThrow");to();Vh();_u();var vb=ze(ol(),1);var ul=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Dn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},a8=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},fl=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ec,cl;function XI(r){let e=xb(r);if(e instanceof Error)throw e;return e}s(XI,"fromBytes");function xb(r){let[e,t]=Ri(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ri(t),o=yb(i);if(o instanceof Error)return o;let[a,f]=o;return f.length>0?new Error("Invalid StreamID: contains commit"):new $e(n,a)}s(xb,"fromBytesNoThrow");function ZI(r){let e=c8(r);if(e instanceof Error)throw e;return e}s(ZI,"fromString");function c8(r){let e=r.replace("ceramic://","").replace("/ceramic/",""),t=e.includes("commit")?e.split("?")[0]:e,n=Zs.decode(t);return xb(n)}s(c8,"fromStringNoThrow");var f8=Symbol.for("@ceramicnetwork/streamid/StreamID"),$e=class{constructor(e,t){if(this._tag=f8,ec.set(this,void 0),cl.set(this,void 0),!(e||e===0))throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");a8(this,ec,typeof e=="string"?Xr.codeByName(e):e,"f"),a8(this,cl,typeof t=="string"?Ne.parse(t):t,"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===f8}static fromGenesis(e,t){return M(this,null,function*(){let n=yield ma({value:t,codec:ho,hasher:ra});return new $e(e,n.cid)})}get type(){return fl(this,ec,"f")}get typeName(){return Xr.nameByCode(fl(this,ec,"f"))}get cid(){return fl(this,cl,"f")}get bytes(){let e=vb.default.encode(206),t=vb.default.encode(this.type);return gi([e,t,this.cid.bytes])}get baseID(){return new $e(fl(this,ec,"f"),fl(this,cl,"f"))}equals(e){return $e.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return Zs.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(ec=new WeakMap,cl=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};s($e,"StreamID");$e.fromBytes=XI;$e.fromBytesNoThrow=xb;$e.fromString=ZI;$e.fromStringNoThrow=c8;ul([pn(),Dn("design:type",String),Dn("design:paramtypes",[])],$e.prototype,"typeName",null);ul([pn(),Dn("design:type",Uint8Array),Dn("design:paramtypes",[])],$e.prototype,"bytes",null);ul([pn(),Dn("design:type",$e),Dn("design:paramtypes",[])],$e.prototype,"baseID",null);ul([pn(),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",String)],$e.prototype,"toString",null);ul([pn(),Dn("design:type",Function),Dn("design:paramtypes",[]),Dn("design:returntype",String)],$e.prototype,"toUrl",null);var rc=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Zr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ab=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},vo=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},tc,Ca,ll;function QI(r){let e=Eb(r);if(e instanceof Error)throw e;return e}s(QI,"fromBytes");function Eb(r){let[e,t]=Ri(r);if(e!==206)return new Error("fromBytes: invalid streamid, does not include streamid codec");let[n,i]=Ri(t),o=gb(i);if(o instanceof Error)return o;let[a,f]=o;if(f.length===0)return new Error("No commit information provided");if(f.length===1)return new rt(n,a,f[0]);{let[c]=gb(f);return new rt(n,a,c)}}s(Eb,"fromBytesNoThrow");function eN(r){try{return typeof r=="string"?Ne.parse(r):Ne.asCID(r)}catch(e){return}}s(eN,"parseCID");function tN(r,e=null){if(!e)return null;let t=eN(e);if(t)return r.equals(t)?null:t;if(String(e)==="0")return null;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}s(tN,"parseCommit");function rN(r){let e=l8(r);if(e instanceof Error)throw e;return e}s(rN,"fromString");function l8(r){let e=r.replace("ceramic://","").replace("/ceramic/","");if(e.includes("commit")){let t=e.split("?")[1].split("=")[1],n=e.split("?")[0];return h8($e.fromString(n),t)}else return Eb(Zs.decode(e))}s(l8,"fromStringNoThrow");var u8=Symbol.for("@ceramicnetwork/streamid/CommitID");function h8(r,e){return new rt(r.type,r.cid,e)}s(h8,"make");var rt=class{constructor(e,t,n=null){if(this._tag=u8,tc.set(this,void 0),Ca.set(this,void 0),ll.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");Ab(this,tc,typeof e=="string"?Xr.codeByName(e):e,"f"),Ab(this,Ca,typeof t=="string"?Ne.parse(t):t,"f"),Ab(this,ll,tN(vo(this,Ca,"f"),n),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===u8}get baseID(){return new $e(vo(this,tc,"f"),vo(this,Ca,"f"))}get type(){return vo(this,tc,"f")}get typeName(){return Xr.nameByCode(vo(this,tc,"f"))}get cid(){return vo(this,Ca,"f")}get commit(){return vo(this,ll,"f")||vo(this,Ca,"f")}get bytes(){var i;let e=_b.default.encode(206),t=_b.default.encode(this.type),n=((i=vo(this,ll,"f"))==null?void 0:i.bytes)||new Uint8Array([0]);return gi([e,t,this.cid.bytes,n])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return Zs.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(tc=new WeakMap,Ca=new WeakMap,ll=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};s(rt,"CommitID");rt.fromBytes=QI;rt.fromBytesNoThrow=Eb;rt.fromString=rN;rt.fromStringNoThrow=l8;rt.make=h8;rc([pn(),Zr("design:type",$e),Zr("design:paramtypes",[])],rt.prototype,"baseID",null);rc([pn(),Zr("design:type",String),Zr("design:paramtypes",[])],rt.prototype,"typeName",null);rc([pn(),Zr("design:type",Ne),Zr("design:paramtypes",[])],rt.prototype,"commit",null);rc([pn(),Zr("design:type",Uint8Array),Zr("design:paramtypes",[])],rt.prototype,"bytes",null);rc([pn(),Zr("design:type",Function),Zr("design:paramtypes",[]),Zr("design:returntype",String)],rt.prototype,"toString",null);rc([pn(),Zr("design:type",Function),Zr("design:paramtypes",[]),Zr("design:returntype",String)],rt.prototype,"toUrl",null);var ai;(function(r){function e(t){if($e.isInstance(t))return t;if(rt.isInstance(t))return t;if(t instanceof Uint8Array){let n=rt.fromBytesNoThrow(t);return n instanceof Error?$e.fromBytes(t):n}else if(typeof t=="string"){let n=rt.fromStringNoThrow(t);return n instanceof Error?$e.fromString(t):n}else throw new Error("Can not build CommitID or StreamID")}s(e,"from"),r.from=e})(ai||(ai={}));var d8="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",bp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var Sb={};It(Sb,{JsonPatchError:()=>Rt,_areEquals:()=>pl,applyOperation:()=>Ta,applyPatch:()=>_p,applyReducer:()=>aN,deepClone:()=>oN,getValueByPointer:()=>xp,validate:()=>m8,validator:()=>Ap});var nN=function(){var r=s(function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)i.hasOwnProperty(o)&&(n[o]=i[o])},r(e,t)},"extendStatics");return function(e,t){r(e,t);function n(){this.constructor=e}s(n,"__"),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),iN=Object.prototype.hasOwnProperty;function yp(r,e){return iN.call(r,e)}s(yp,"hasOwnProperty");function vp(r){if(Array.isArray(r)){for(var e=new Array(r.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(r);var n=[];for(var i in r)yp(r,i)&&n.push(i);return n}s(vp,"_objectKeys");function yr(r){switch(typeof r){case"object":return JSON.parse(JSON.stringify(r));case"undefined":return null;default:return r}}s(yr,"_deepClone");function wp(r){for(var e=0,t=r.length,n;e<t;){if(n=r.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}s(wp,"isInteger");function Ui(r){return r.indexOf("/")===-1&&r.indexOf("~")===-1?r:r.replace(/~/g,"~0").replace(/\//g,"~1")}s(Ui,"escapePathComponent");function hl(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}s(hl,"unescapePathComponent");function gp(r){if(r===void 0)return!0;if(r){if(Array.isArray(r)){for(var e=0,t=r.length;e<t;e++)if(gp(r[e]))return!0}else if(typeof r=="object"){for(var n=vp(r),i=n.length,o=0;o<i;o++)if(gp(r[n[o]]))return!0}}return!1}s(gp,"hasUndefined");function p8(r,e){var t=[r];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i!="undefined"&&t.push(n+": "+i)}return t.join(`
|
816
|
+
`)}s(p8,"patchErrorMessageFormatter");var dl=function(r){nN(e,r);function e(t,n,i,o,a){var f=this.constructor,c=r.call(this,p8(t,{name:n,index:i,operation:o,tree:a}))||this;return c.name=n,c.index=i,c.operation=o,c.tree=a,Object.setPrototypeOf(c,f.prototype),c.message=p8(t,{name:n,index:i,operation:o,tree:a}),c}return s(e,"PatchError"),e}(Error);var Rt=dl,oN=yr,nc={add:function(r,e,t){return r[e]=this.value,{newDocument:t}},remove:function(r,e,t){var n=r[e];return delete r[e],{newDocument:t,removed:n}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:function(r,e,t){var n=xp(t,this.path);n&&(n=yr(n));var i=Ta(t,{op:"remove",path:this.from}).removed;return Ta(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:n}},copy:function(r,e,t){var n=xp(t,this.from);return Ta(t,{op:"add",path:this.path,value:yr(n)}),{newDocument:t}},test:function(r,e,t){return{newDocument:t,test:pl(r[e],this.value)}},_get:function(r,e,t){return this.value=r[e],{newDocument:t}}},sN={add:function(r,e,t){return wp(e)?r.splice(e,0,this.value):r[e]=this.value,{newDocument:t,index:e}},remove:function(r,e,t){var n=r.splice(e,1);return{newDocument:t,removed:n[0]}},replace:function(r,e,t){var n=r[e];return r[e]=this.value,{newDocument:t,removed:n}},move:nc.move,copy:nc.copy,test:nc.test,_get:nc._get};function xp(r,e){if(e=="")return r;var t={op:"_get",path:e};return Ta(r,t),t.value}s(xp,"getValueByPointer");function Ta(r,e,t,n,i,o){if(t===void 0&&(t=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),o===void 0&&(o=0),t&&(typeof t=="function"?t(e,0,r,e.path):Ap(e,0)),e.path===""){var a={newDocument:r};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=r,a;if(e.op==="move"||e.op==="copy")return a.newDocument=xp(r,e.from),e.op==="move"&&(a.removed=r),a;if(e.op==="test"){if(a.test=pl(r,e.value),a.test===!1)throw new Rt("Test operation failed","TEST_OPERATION_FAILED",o,e,r);return a.newDocument=r,a}else{if(e.op==="remove")return a.removed=r,a.newDocument=null,a;if(e.op==="_get")return e.value=r,a;if(t)throw new Rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,e,r);return a}}else{n||(r=yr(r));var f=e.path||"",c=f.split("/"),l=r,h=1,d=c.length,y=void 0,A=void 0,v=void 0;for(typeof t=="function"?v=t:v=Ap;;){if(A=c[h],A&&A.indexOf("~")!=-1&&(A=hl(A)),i&&(A=="__proto__"||A=="prototype"&&h>0&&c[h-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&y===void 0&&(l[A]===void 0?y=c.slice(0,h).join("/"):h==d-1&&(y=e.path),y!==void 0&&v(e,0,r,y)),h++,Array.isArray(l)){if(A==="-")A=l.length;else{if(t&&!wp(A))throw new Rt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,e,r);wp(A)&&(A=~~A)}if(h>=d){if(t&&e.op==="add"&&A>l.length)throw new Rt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,e,r);var a=sN[e.op].call(e,l,A,r);if(a.test===!1)throw new Rt("Test operation failed","TEST_OPERATION_FAILED",o,e,r);return a}}else if(h>=d){var a=nc[e.op].call(e,l,A,r);if(a.test===!1)throw new Rt("Test operation failed","TEST_OPERATION_FAILED",o,e,r);return a}if(l=l[A],t&&h<d&&(!l||typeof l!="object"))throw new Rt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,e,r)}}}s(Ta,"applyOperation");function _p(r,e,t,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new Rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(r=yr(r));for(var o=new Array(e.length),a=0,f=e.length;a<f;a++)o[a]=Ta(r,e[a],t,!0,i,a),r=o[a].newDocument;return o.newDocument=r,o}s(_p,"applyPatch");function aN(r,e,t){var n=Ta(r,e);if(n.test===!1)throw new Rt("Test operation failed","TEST_OPERATION_FAILED",t,e,r);return n.newDocument}s(aN,"applyReducer");function Ap(r,e,t,n){if(typeof r!="object"||r===null||Array.isArray(r))throw new Rt("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,r,t);if(nc[r.op]){if(typeof r.path!="string")throw new Rt("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,r,t);if(r.path.indexOf("/")!==0&&r.path.length>0)throw new Rt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,r,t);if((r.op==="move"||r.op==="copy")&&typeof r.from!="string")throw new Rt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&r.value===void 0)throw new Rt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,r,t);if((r.op==="add"||r.op==="replace"||r.op==="test")&&gp(r.value))throw new Rt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,r,t);if(t){if(r.op=="add"){var i=r.path.split("/").length,o=n.split("/").length;if(i!==o+1&&i!==o)throw new Rt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,r,t)}else if(r.op==="replace"||r.op==="remove"||r.op==="_get"){if(r.path!==n)throw new Rt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,r,t)}else if(r.op==="move"||r.op==="copy"){var a={op:"_get",path:r.from,value:void 0},f=m8([a],t);if(f&&f.name==="OPERATION_PATH_UNRESOLVABLE")throw new Rt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,r,t)}}}else throw new Rt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,r,t)}s(Ap,"validator");function m8(r,e,t){try{if(!Array.isArray(r))throw new Rt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)_p(yr(e),yr(r),t||!0);else{t=t||Ap;for(var n=0;n<r.length;n++)t(r[n],n,e,void 0)}}catch(i){if(i instanceof Rt)return i;throw i}}s(m8,"validate");function pl(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){var t=Array.isArray(r),n=Array.isArray(e),i,o,a;if(t&&n){if(o=r.length,o!=e.length)return!1;for(i=o;i--!==0;)if(!pl(r[i],e[i]))return!1;return!0}if(t!=n)return!1;var f=Object.keys(r);if(o=f.length,o!==Object.keys(e).length)return!1;for(i=o;i--!==0;)if(!e.hasOwnProperty(f[i]))return!1;for(i=o;i--!==0;)if(a=f[i],!pl(r[a],e[a]))return!1;return!0}return r!==r&&e!==e}s(pl,"_areEquals");var Mb={};It(Mb,{compare:()=>mN,generate:()=>Cb,observe:()=>pN,unobserve:()=>dN});var Tb=new WeakMap,fN=function(){function r(e){this.observers=new Map,this.obj=e}return s(r,"Mirror"),r}(),cN=function(){function r(e,t){this.callback=e,this.observer=t}return s(r,"ObserverInfo"),r}();function uN(r){return Tb.get(r)}s(uN,"getMirror");function lN(r,e){return r.observers.get(e)}s(lN,"getObserverFromMirror");function hN(r,e){r.observers.delete(e.callback)}s(hN,"removeObserverFromMirror");function dN(r,e){e.unobserve()}s(dN,"unobserve");function pN(r,e){var t=[],n,i=uN(r);if(!i)i=new fN(r),Tb.set(r,i);else{var o=lN(i,e);n=o&&o.observer}if(n)return n;if(n={},i.value=yr(r),e){n.callback=e,n.next=null;var a=s(function(){Cb(n)},"dirtyCheck"),f=s(function(){clearTimeout(n.next),n.next=setTimeout(a)},"fastCheck");typeof window!="undefined"&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return n.patches=t,n.object=r,n.unobserve=function(){Cb(n),clearTimeout(n.next),hN(i,n),typeof window!="undefined"&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},i.observers.set(e,new cN(e,n)),n}s(pN,"observe");function Cb(r,e){e===void 0&&(e=!1);var t=Tb.get(r.object);kb(t.value,r.object,r.patches,"",e),r.patches.length&&_p(t.value,r.patches);var n=r.patches;return n.length>0&&(r.patches=[],r.callback&&r.callback(n)),n}s(Cb,"generate");function kb(r,e,t,n,i){if(e!==r){typeof e.toJSON=="function"&&(e=e.toJSON());for(var o=vp(e),a=vp(r),f=!1,c=!1,l=a.length-1;l>=0;l--){var h=a[l],d=r[h];if(yp(e,h)&&!(e[h]===void 0&&d!==void 0&&Array.isArray(e)===!1)){var y=e[h];typeof d=="object"&&d!=null&&typeof y=="object"&&y!=null&&Array.isArray(d)===Array.isArray(y)?kb(d,y,t,n+"/"+Ui(h),i):d!==y&&(f=!0,i&&t.push({op:"test",path:n+"/"+Ui(h),value:yr(d)}),t.push({op:"replace",path:n+"/"+Ui(h),value:yr(y)}))}else Array.isArray(r)===Array.isArray(e)?(i&&t.push({op:"test",path:n+"/"+Ui(h),value:yr(d)}),t.push({op:"remove",path:n+"/"+Ui(h)}),c=!0):(i&&t.push({op:"test",path:n,value:r}),t.push({op:"replace",path:n,value:e}),f=!0)}if(!(!c&&o.length==a.length))for(var l=0;l<o.length;l++){var h=o[l];!yp(r,h)&&e[h]!==void 0&&t.push({op:"add",path:n+"/"+Ui(h),value:yr(e[h])})}}}s(kb,"_generate");function mN(r,e,t){t===void 0&&(t=!1);var n=[];return kb(r,e,n,"",t),n}s(mN,"compare");var b8=Object.assign({},Sb,Mb,{JsonPatchError:dl,deepClone:yr,escapePathComponent:Ui,unescapePathComponent:hl});var GA=ze(If(),1);var kr;(function(r){r[r.PREFER_CACHE=0]="PREFER_CACHE",r[r.SYNC_ALWAYS=1]="SYNC_ALWAYS",r[r.NEVER_SYNC=2]="NEVER_SYNC"})(kr||(kr={}));var Zp=ze(zb(),1);function qe(r){return typeof r=="function"}s(qe,"isFunction");function fc(r){var e=s(function(n){Error.call(n),n.stack=new Error().stack},"_super"),t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}s(fc,"createErrorClass");var Np=fc(function(r){return s(function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
|
817
817
|
`+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
818
|
-
`):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function Ea(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}o(Ea,"arrRemove");var Eo=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return o(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,n,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=Do(a),f=c.next();!f.done;f=c.next()){var l=f.value;l.remove(this)}}catch(_){e={error:_}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if(qe(h))try{h()}catch(_){s=_ instanceof gp?_.errors:[_]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var v=Do(d),x=v.next();!x.done;x=v.next()){var y=x.value;try{N8(y)}catch(_){s=s!=null?s:[],_ instanceof gp?s=Hn(Hn([],Qr(s)),Qr(_.errors)):s.push(_)}}}catch(_){n={error:_}}finally{try{x&&!x.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}}if(s)throw new gp(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)N8(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ea(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Ea(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Bb=Eo.EMPTY;function yp(r){return r instanceof Eo||r&&"closed"in r&&qe(r.remove)&&qe(r.add)&&qe(r.unsubscribe)}o(yp,"isSubscription");function N8(r){qe(r)?r():r.unsubscribe()}o(N8,"execFinalizer");var ii={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Zc={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=Zc.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,Hn([r,e],Qr(t))):setTimeout.apply(void 0,Hn([r,e],Qr(t)))},clearTimeout:function(r){var e=Zc.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function vp(r){Zc.setTimeout(function(){var e=ii.onUnhandledError;if(e)e(r);else throw r})}o(vp,"reportUnhandledError");function Nb(){}o(Nb,"noop");var I8=function(){return Ib("C",void 0,void 0)}();function O8(r){return Ib("E",void 0,r)}o(O8,"errorNotification");function P8(r){return Ib("N",r,void 0)}o(P8,"nextNotification");function Ib(r,e,t){return{kind:r,value:e,error:t}}o(Ib,"createNotification");var Sa=null;function Qc(r){if(ii.useDeprecatedSynchronousErrorHandling){var e=!Sa;if(e&&(Sa={errorThrown:!1,error:null}),r(),e){var t=Sa,n=t.errorThrown,i=t.error;if(Sa=null,n)throw i}}else r()}o(Qc,"errorContext");function R8(r){ii.useDeprecatedSynchronousErrorHandling&&Sa&&(Sa.errorThrown=!0,Sa.error=r)}o(R8,"captureError");var al=function(r){gr(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,yp(t)&&t.add(n)):n.destination=sO,n}return o(e,"Subscriber"),e.create=function(t,n,i){return new xp(t,n,i)},e.prototype.next=function(t){this.isStopped?Pb(P8(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Pb(O8(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Pb(I8,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Eo);var rO=Function.prototype.bind;function Ob(r,e){return rO.call(r,e)}o(Ob,"bind");var nO=function(){function r(e){this.partialObserver=e}return o(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){wp(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){wp(n)}else wp(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){wp(t)}},r}(),xp=function(r){gr(e,r);function e(t,n,i){var s=r.call(this)||this,a;if(qe(t)||!t)a={next:t!=null?t:void 0,error:n!=null?n:void 0,complete:i!=null?i:void 0};else{var c;s&&ii.useDeprecatedNextContext?(c=Object.create(t),c.unsubscribe=function(){return s.unsubscribe()},a={next:t.next&&Ob(t.next,c),error:t.error&&Ob(t.error,c),complete:t.complete&&Ob(t.complete,c)}):a=t}return s.destination=new nO(a),s}return o(e,"SafeSubscriber"),e}(al);function wp(r){ii.useDeprecatedSynchronousErrorHandling?R8(r):vp(r)}o(wp,"handleUnhandledError");function iO(r){throw r}o(iO,"defaultErrorHandler");function Pb(r,e){var t=ii.onStoppedNotification;t&&Zc.setTimeout(function(){return t(r,e)})}o(Pb,"handleStoppedNotification");var sO={closed:!0,next:Nb,error:iO,complete:Nb};var ef=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function tf(r){return r}o(tf,"identity");function U8(r){return r.length===0?tf:r.length===1?r[0]:o(function(t){return r.reduce(function(n,i){return i(n)},t)},"piped")}o(U8,"pipeFromArray");var ct=function(){function r(e){e&&(this._subscribe=e)}return o(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,s=aO(e)?e:new xp(e,t,n);return Qc(function(){var a=i,c=a.operator,f=a.source;s.add(c?c.call(s,f):f?i._subscribe(s):i._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=L8(t),new t(function(i,s){var a=new xp({next:function(c){try{e(c)}catch(f){s(f),a.unsubscribe()}},error:s,complete:i});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[ef]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return U8(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=L8(e),new e(function(n,i){var s;t.subscribe(function(a){return s=a},function(a){return i(a)},function(){return n(s)})})},r.create=function(e){return new r(e)},r}();function L8(r){var e;return(e=r!=null?r:ii.Promise)!==null&&e!==void 0?e:Promise}o(L8,"getPromiseCtor");function oO(r){return r&&qe(r.next)&&qe(r.error)&&qe(r.complete)}o(oO,"isObserver");function aO(r){return r&&r instanceof al||oO(r)&&yp(r)}o(aO,"isSubscriber");function cO(r){return qe(r==null?void 0:r.lift)}o(cO,"hasLift");function nr(r){return function(e){if(cO(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}o(nr,"operate");function ir(r,e,t,n,i){return new fO(r,e,t,n,i)}o(ir,"createOperatorSubscriber");var fO=function(r){gr(e,r);function e(t,n,i,s,a,c){var f=r.call(this,t)||this;return f.onFinalize=a,f.shouldUnsubscribe=c,f._next=n?function(l){try{n(l)}catch(h){t.error(h)}}:r.prototype._next,f._error=s?function(l){try{s(l)}catch(h){t.error(h)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=i?function(){try{i()}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._complete,f}return o(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(al);var D8=Xc(function(r){return o(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Rb=function(r){gr(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return o(e,"Subject"),e.prototype.lift=function(t){var n=new K8(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new D8},e.prototype.next=function(t){var n=this;Qc(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Do(n.currentObservers),c=a.next();!c.done;c=a.next()){var f=c.value;f.next(t)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;Qc(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;Qc(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,s=i.hasError,a=i.isStopped,c=i.observers;return s||a?Bb:(this.currentObservers=null,c.push(t),new Eo(function(){n.currentObservers=null,Ea(c,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n.thrownError,a=n.isStopped;i?t.error(s):a&&t.complete()},e.prototype.asObservable=function(){var t=new ct;return t.source=this,t},e.create=function(t,n){return new K8(t,n)},e}(ct);var K8=function(r){gr(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return o(e,"AnonymousSubject"),e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:Bb},e}(Rb);var Ub=function(r){gr(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return o(e,"BehaviorSubject"),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,s=t._value;if(n)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Rb);var Lb={now:function(){return(Lb.delegate||Date).now()},delegate:void 0};var $8=function(r){gr(e,r);function e(t,n){return r.call(this)||this}return o(e,"Action"),e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e}(Eo);var cl={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=cl.delegate;return i!=null&&i.setInterval?i.setInterval.apply(i,Hn([r,e],Qr(t))):setInterval.apply(void 0,Hn([r,e],Qr(t)))},clearInterval:function(r){var e=cl.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0};var F8=function(r){gr(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return o(e,"AsyncAction"),e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),cl.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;cl.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,s;try{this.work(t)}catch(a){i=!0,s=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ea(s,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}($8);var Db=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return o(r,"Scheduler"),r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=Lb.now,r}();var H8=function(r){gr(e,r);function e(t,n){n===void 0&&(n=Db.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return o(e,"AsyncScheduler"),e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(Db);var uO=new H8(F8),q8=uO;var _p=new ct(function(r){return r.complete()});function Ap(r){return r&&qe(r.schedule)}o(Ap,"isScheduler");function z8(r){return r[r.length-1]}o(z8,"last");function j8(r){return Ap(z8(r))?r.pop():void 0}o(j8,"popScheduler");function V8(r,e){return typeof z8(r)=="number"?r.pop():e}o(V8,"popNumber");var rf=o(function(r){return r&&typeof r.length=="number"&&typeof r!="function"},"isArrayLike");function Ep(r){return qe(r==null?void 0:r.then)}o(Ep,"isPromise");function Sp(r){return qe(r[ef])}o(Sp,"isInteropObservable");function Cp(r){return Symbol.asyncIterator&&qe(r==null?void 0:r[Symbol.asyncIterator])}o(Cp,"isAsyncIterable");function kp(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}o(kp,"createInvalidObservableTypeError");function lO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}o(lO,"getSymbolIterator");var Tp=lO();function Mp(r){return qe(r==null?void 0:r[Tp])}o(Mp,"isIterable");function Bp(r){return Uy(this,arguments,o(function(){var t,n,i,s;return Pl(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Rl(t.read())];case 3:return n=a.sent(),i=n.value,s=n.done,s?[4,Rl(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Rl(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}o(Bp,"readableStreamLikeToAsyncGenerator");function Np(r){return qe(r==null?void 0:r.getReader)}o(Np,"isReadableStreamLike");function Sr(r){if(r instanceof ct)return r;if(r!=null){if(Sp(r))return hO(r);if(rf(r))return dO(r);if(Ep(r))return pO(r);if(Cp(r))return G8(r);if(Mp(r))return mO(r);if(Np(r))return bO(r)}throw kp(r)}o(Sr,"innerFrom");function hO(r){return new ct(function(e){var t=r[ef]();if(qe(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}o(hO,"fromInteropObservable");function dO(r){return new ct(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}o(dO,"fromArrayLike");function pO(r){return new ct(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,vp)})}o(pO,"fromPromise");function mO(r){return new ct(function(e){var t,n;try{for(var i=Do(r),s=i.next();!s.done;s=i.next()){var a=s.value;if(e.next(a),e.closed)return}}catch(c){t={error:c}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}o(mO,"fromIterable");function G8(r){return new ct(function(e){gO(r,e).catch(function(t){return e.error(t)})})}o(G8,"fromAsyncIterable");function bO(r){return G8(Bp(r))}o(bO,"fromReadableStreamLike");function gO(r,e){var t,n,i,s;return Ry(this,void 0,void 0,function(){var a,c;return Pl(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),t=Ly(r),f.label=1;case 1:return[4,t.next()];case 2:if(n=f.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=f.sent(),i={error:c},[3,11];case 6:return f.trys.push([6,,9,10]),n&&!n.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}o(gO,"process");function Rn(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var s=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(s),!i)return s}o(Rn,"executeSchedule");function Ip(r,e){return e===void 0&&(e=0),nr(function(t,n){t.subscribe(ir(n,function(i){return Rn(n,r,function(){return n.next(i)},e)},function(){return Rn(n,r,function(){return n.complete()},e)},function(i){return Rn(n,r,function(){return n.error(i)},e)}))})}o(Ip,"observeOn");function Op(r,e){return e===void 0&&(e=0),nr(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}o(Op,"subscribeOn");function J8(r,e){return Sr(r).pipe(Op(e),Ip(e))}o(J8,"scheduleObservable");function W8(r,e){return Sr(r).pipe(Op(e),Ip(e))}o(W8,"schedulePromise");function Y8(r,e){return new ct(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}o(Y8,"scheduleArray");function X8(r,e){return new ct(function(t){var n;return Rn(t,e,function(){n=r[Tp](),Rn(t,e,function(){var i,s,a;try{i=n.next(),s=i.value,a=i.done}catch(c){t.error(c);return}a?t.complete():t.next(s)},0,!0)}),function(){return qe(n==null?void 0:n.return)&&n.return()}})}o(X8,"scheduleIterable");function Pp(r,e){if(!r)throw new Error("Iterable cannot be null");return new ct(function(t){Rn(t,e,function(){var n=r[Symbol.asyncIterator]();Rn(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}o(Pp,"scheduleAsyncIterable");function Z8(r,e){return Pp(Bp(r),e)}o(Z8,"scheduleReadableStreamLike");function Q8(r,e){if(r!=null){if(Sp(r))return J8(r,e);if(rf(r))return Y8(r,e);if(Ep(r))return W8(r,e);if(Cp(r))return Pp(r,e);if(Mp(r))return X8(r,e);if(Np(r))return Z8(r,e)}throw kp(r)}o(Q8,"scheduled");function e_(r,e){return e?Q8(r,e):Sr(r)}o(e_,"from");var Rp=Xc(function(r){return o(function(){r(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl")});function t_(r){return r instanceof Date&&!isNaN(r)}o(t_,"isValidDate");function Up(r,e){return nr(function(t,n){var i=0;t.subscribe(ir(n,function(s){n.next(r.call(e,s,i++))}))})}o(Up,"map");var yO=Array.isArray;function vO(r,e){return yO(e)?r.apply(void 0,Hn([],Qr(e))):r(e)}o(vO,"callOrApply");function r_(r){return Up(function(e){return vO(r,e)})}o(r_,"mapOneOrManyArgs");function n_(r,e,t,n,i,s,a,c){var f=[],l=0,h=0,d=!1,v=o(function(){d&&!f.length&&!l&&e.complete()},"checkComplete"),x=o(function(_){return l<n?y(_):f.push(_)},"outerNext"),y=o(function(_){s&&e.next(_),l++;var U=!1;Sr(t(_,h++)).subscribe(ir(e,function(E){i==null||i(E),s?x(E):e.next(E)},function(){U=!0},void 0,function(){if(U)try{l--;for(var E=o(function(){var L=f.shift();a?Rn(e,a,function(){return y(L)}):y(L)},"_loop_1");f.length&&l<n;)E();v()}catch(L){e.error(L)}}))},"doInnerSub");return r.subscribe(ir(e,x,function(){d=!0,v()})),function(){c==null||c()}}o(n_,"mergeInternals");function fl(r,e,t){return t===void 0&&(t=1/0),qe(e)?fl(function(n,i){return Up(function(s,a){return e(n,s,i,a)})(Sr(r(n,i)))},t):(typeof e=="number"&&(t=e),nr(function(n,i){return n_(n,i,r,t)}))}o(fl,"mergeMap");function i_(r){return r===void 0&&(r=1/0),fl(tf,r)}o(i_,"mergeAll");var wO=["addListener","removeListener"],xO=["addEventListener","removeEventListener"],_O=["on","off"];function ul(r,e,t,n){if(qe(t)&&(n=t,t=void 0),n)return ul(r,e,t).pipe(r_(n));var i=Qr(SO(r)?xO.map(function(c){return function(f){return r[c](e,f,t)}}):AO(r)?wO.map(s_(r,e)):EO(r)?_O.map(s_(r,e)):[],2),s=i[0],a=i[1];if(!s&&rf(r))return fl(function(c){return ul(c,e,t)})(Sr(r));if(!s)throw new TypeError("Invalid event target");return new ct(function(c){var f=o(function(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];return c.next(1<l.length?l:l[0])},"handler");return s(f),function(){return a(f)}})}o(ul,"fromEvent");function s_(r,e){return function(t){return function(n){return r[t](e,n)}}}o(s_,"toCommonHandlerRegistry");function AO(r){return qe(r.addListener)&&qe(r.removeListener)}o(AO,"isNodeStyleEventEmitter");function EO(r){return qe(r.on)&&qe(r.off)}o(EO,"isJQueryStyleEventEmitter");function SO(r){return qe(r.addEventListener)&&qe(r.removeEventListener)}o(SO,"isEventTarget");function ll(r,e,t){r===void 0&&(r=0),t===void 0&&(t=q8);var n=-1;return e!=null&&(Ap(e)?t=e:n=e),new ct(function(i){var s=t_(r)?+r-t.now():r;s<0&&(s=0);var a=0;return t.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},s)})}o(ll,"timer");function Kb(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=j8(r),n=V8(r,1/0),i=r;return i.length?i.length===1?Sr(i[0]):i_(n)(e_(i,t)):_p}o(Kb,"merge");function o_(r,e){return nr(function(t,n){var i=0;t.subscribe(ir(n,function(s){return r.call(e,s,i++)&&n.next(s)}))})}o(o_,"filter");function a_(r){return nr(function(e,t){var n=!1;e.subscribe(ir(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}o(a_,"defaultIfEmpty");function c_(r){return r<=0?function(){return _p}:nr(function(e,t){var n=0;e.subscribe(ir(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}o(c_,"take");function f_(r){return r===void 0&&(r=CO),nr(function(e,t){var n=!1;e.subscribe(ir(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}o(f_,"throwIfEmpty");function CO(){return new Rp}o(CO,"defaultErrorFactory");function $b(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?o_(function(i,s){return r(i,s,n)}):tf,c_(1),t?a_(e):f_(function(){return new Rp}))}}o($b,"first");var kO={leading:!0,trailing:!1};function Fb(r,e){return e===void 0&&(e=kO),nr(function(t,n){var i=e.leading,s=e.trailing,a=!1,c=null,f=null,l=!1,h=o(function(){f==null||f.unsubscribe(),f=null,s&&(x(),l&&n.complete())},"endThrottling"),d=o(function(){f=null,l&&n.complete()},"cleanupThrottling"),v=o(function(y){return f=Sr(r(y)).subscribe(ir(n,h,d))},"startThrottle"),x=o(function(){if(a){a=!1;var y=c;c=null,n.next(y),!l&&v(y)}},"send");t.subscribe(ir(n,function(y){a=!0,c=y,!(f&&!f.closed)&&(i?x():v(y))},function(){l=!0,!(s&&a&&f&&!f.closed)&&n.complete()}))})}o(Fb,"throttle");var u_;(function(r){r[r.GENESIS=0]="GENESIS",r[r.PARTIAL=1]="PARTIAL",r[r.SIGNED=2]="SIGNED"})(u_||(u_={}));var ka;(function(r){r[r.NOT_REQUESTED=0]="NOT_REQUESTED",r[r.PENDING=1]="PENDING",r[r.PROCESSING=2]="PROCESSING",r[r.ANCHORED=3]="ANCHORED",r[r.FAILED=4]="FAILED"})(ka||(ka={}));var Hb;(function(r){r[r.GENESIS=0]="GENESIS",r[r.SIGNED=1]="SIGNED",r[r.ANCHOR=2]="ANCHOR"})(Hb||(Hb={}));var Ca=class extends ct{constructor(e,t){super(n=>{e.subscribe(n)}),this.state$=e,this._context=t}get id(){return new Fe(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,Lp.default)((n=e==null?void 0:e.metadata)!=null?n:t)}get content(){var n;let{next:e,content:t}=this.state$.value;return(0,Lp.default)((n=e==null?void 0:e.content)!=null?n:t)}get controllers(){return this.metadata.controllers}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return tt.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>tt.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Hb.ANCHOR).map(({cid:e})=>tt.make(this.id,e))}get state(){return(0,Lp.default)(this.state$.value)}sync(){return M(this,arguments,function*(e={}){e=ne({sync:Er.PREFER_CACHE},e);let t=yield this.api.loadStream(this.id,e);this.state$.next(t.state)})}requestAnchor(){return M(this,null,function*(){return this.api.requestAnchor(this.id)})}};o(Ca,"Stream");function Dp(){return r=>{}}o(Dp,"StreamStatic");var y_=ze(d_(),1);var Fp=ze(m_(),1);function b_(){globalThis.AbortController||(globalThis.AbortController=Fp.AbortController),globalThis.AbortSignal||(globalThis.AbortSignal=Fp.AbortSignal)}o(b_,"polyfillAbortController");b_();function g_(r){let e=new AbortController;if(r.length===0)throw Error("Need abort signals to create a merged abort signal");return r.some(t=>t.aborted)?(e.abort(),e.signal):(Kb(...r.map(t=>ul(t,"abort"))).pipe($b()).subscribe(()=>{e.abort()}),e.signal)}o(g_,"mergeAbortSignals");var hl=class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=ll(e).subscribe(()=>{t.abort()})}clear(){var e;(e=this._subscription)==null||e.unsubscribe()}};o(hl,"TimedAbortSignal");var MO=60*1e3*3;function ln(t){return M(this,arguments,function*(r,e={}){e.body&&Object.assign(e,{body:JSON.stringify(e.body),headers:{"Content-Type":"application/json"}});let n=e.timeout||MO,i=new hl(n);e.signal=e.signal?g_([e.signal,i.signal]):i.signal;let s=yield(0,y_.default)(r,e).finally(()=>i.clear());if(!s.ok){let a=yield s.text();throw new Error(`HTTP request to '${r}' failed with status '${s.statusText}': ${a}`)}return s.json()})}o(ln,"fetchJson");var dl=ze(Mb(),1);Xi();function Oi(r){let e=Ie.asCID(r);if(e)return e;if(typeof r=="string")return Ie.parse(r);if(r instanceof Uint8Array)return Ie.decode(r);throw new Error(`${r} cannot be converted to a CID`)}o(Oi,"toCID");var lt=class{static streamIdFromState(e){return new Fe(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,dl.default)(e);return lt.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=jt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=jt(t.cacaoBlock,"base64")),t):(lt.isSignedCommit(e)&&(t.link=t.link.toString()),lt.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),t)}static deserializeCommit(e){let t=(0,dl.default)(e);return lt.isSignedCommitContainer(t)?(t.jws.link=Oi(t.jws.link),t.linkedBlock=Gt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Gt(t.cacaoBlock,"base64")),t):(lt.isSignedCommit(t)&&(t.link=Oi(t.link)),lt.isAnchorCommit(t)&&(t.proof=Oi(t.proof)),t.id&&(t.id=Oi(t.id)),t.prev&&(t.prev=Oi(t.prev)),t)}static serializeState(e){let t=(0,dl.default)(e);return t.log=t.log.map(n=>be(ne({},n),{cid:n.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=ka[t.anchorStatus]),t.anchorScheduledFor!=null&&(t.anchorScheduledFor=new Date(t.anchorScheduledFor).toISOString()),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),t.lastAnchored!=null&&(t.lastAnchored=t.lastAnchored.toString()),t.doctype=Gr.nameByCode(t.type),t}static deserializeState(e){let t=(0,dl.default)(e);t.doctype&&(t.type=Gr.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(i=>be(ne({},i),{cid:Oi(i.cid)})),t.anchorProof&&(t.anchorProof.txHash=Oi(t.anchorProof.txHash),t.anchorProof.root=Oi(t.anchorProof.root));let n=!0;return t.anchorStatus&&(t.anchorStatus=ka[t.anchorStatus],n=t.anchorStatus!==ka.FAILED&&t.anchorStatus!==ka.ANCHORED),t.anchorScheduledFor&&(n?t.anchorScheduledFor=Date.parse(t.anchorScheduledFor):delete t.anchorScheduledFor),t.lastAnchored&&(t.lastAnchored=Oi(t.lastAnchored)),t}static statesEqual(e,t){return JSON.stringify(lt.serializeState(e))===JSON.stringify(lt.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let n in t.log)if(!e.log[n].cid.equals(t.log[n].cid))return!1;return e.anchorStatus==t.anchorStatus}static convertCommitToSignedCommitContainer(e,t){return M(this,null,function*(){if(lt.isSignedCommit(e)){let n=yield t.block.get(e.link);return{jws:e,linkedBlock:n}}return e})}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}};o(lt,"StreamUtils");function v_(r){if(typeof r=="string"&&r.includes("@")){let[e,t]=r.split("@");if(!e||!t)throw new Error("Invalid accountId provided");return new pa({address:e,chainId:t})}return new pa(r)}o(v_,"normalizeAccountId");var pl=class extends Ub{next(e){let t=this.value;lt.statesEqual(t,e)||super.next(e)}};o(pl,"StreamStateSubject");var BO=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},ys,qb={anchor:!0,publish:!0,pin:!0,sync:Er.PREFER_CACHE},NO={sync:Er.PREFER_CACHE},w_={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function zb(r,e){var n;if(typeof(r==null?void 0:r.schema)=="string")try{tt.fromString(r.schema)}catch(i){throw new Error("Schema must be a CommitID")}let t={controllers:r==null?void 0:r.controllers,family:r==null?void 0:r.family,schema:(n=r==null?void 0:r.schema)==null?void 0:n.toString(),tags:r==null?void 0:r.tags};if(e)r!=null&&r.deterministic||(t.unique=jt((0,x_.randomBytes)(12),"base64")),r!=null&&r.forbidControllerChange&&(t.forbidControllerChange=!0);else{if((r==null?void 0:r.deterministic)!==void 0||(r==null?void 0:r.unique)!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if((r==null?void 0:r.forbidControllerChange)!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(t).forEach(i=>t[i]===void 0&&delete t[i]),t}o(zb,"headerFromMetadata");function __(r){return M(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}o(__,"_ensureAuthenticated");function Hp(r,e){return M(this,null,function*(){return yield __(r),r.did.createDagJWS(e)})}o(Hp,"_signDagJWS");function jb(){return M(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}o(jb,"throwReadOnlyError");var hn=ys=o(class extends Ca{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}static create(s,a,c){return M(this,arguments,function*(e,t,n,i={}){i=ne(ne({},qb),i),!(n!=null&&n.deterministic)&&i.syncTimeoutSeconds==null&&(i.syncTimeoutSeconds=0);let f=i.asDID?{did:i.asDID}:e,l=yield ys.makeGenesis(f,t,n);return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,l,i)})}static createFromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){var c;n=ne(ne({},qb),n),((c=t.header)==null?void 0:c.unique)&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=t.data?yield Hp(e,t):t;return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,a,n)})}static deterministic(i,s){return M(this,arguments,function*(e,t,n={}){if(n=ne(ne({},qb),n),t=be(ne({},t),{deterministic:!0}),t.family==null&&t.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=yield ys.makeGenesis(e,null,t);return e.createStreamFromGenesis(ys.STREAM_TYPE_ID,a,n)})}static load(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},NO),n);let a=ni.from(t);if(a.type!=ys.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${ys.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}update(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},w_),n);let a=n.asDID?{did:n.asDID}:this.api,c=yield this.makeCommit(a,e,t),f=yield this.api.applyCommit(this.id,c,n);this.state$.next(f.state)})}patch(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},w_),t);let s={header:zb(this.metadata,!1),data:e,prev:this.tip,id:this.state$.id.cid},a=yield Hp(this.api,s),c=yield this.api.applyCommit(this.id,a,t);this.state$.next(c.state)})}makeReadOnly(){this.update=jb,this.patch=jb,this.sync=jb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}makeCommit(e,t,n){return M(this,null,function*(){var c;let i=zb(n,!1);if(t==null&&(t=this.content),i.controllers&&((c=i.controllers)==null?void 0:c.length)!==1)throw new Error("Exactly one controller must be specified");let s=q4.compare(this.content,t),a={header:i,data:s,prev:this.tip,id:this.state.log[0].cid};return Hp(e,a)})}static makeGenesis(e,t,n){return M(this,null,function*(){var a;if(n||(n={}),!n.controllers||n.controllers.length===0)if(e.did)yield __(e),n.controllers=[e.did.hasParent?e.did.parent:e.did.id];else throw new Error("No controllers specified");if(((a=n.controllers)==null?void 0:a.length)!==1)throw new Error("Exactly one controller must be specified");let i=zb(n,!0);if((n==null?void 0:n.deterministic)&&t)throw new Error("Initial content must be null when creating a deterministic Tile document");if(t==null){let c={header:i};return b1(c),c}return Hp(e,{data:t,header:i})})}},"TileDocument");hn.STREAM_TYPE_NAME="tile";hn.STREAM_TYPE_ID=0;hn=ys=BO([Dp()],hn);var B_=ze(C_(),1);function $O(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o($O,"_checkPrivateRedeclaration");function FO(r,e){return e.get?e.get.call(r):e.value}o(FO,"_classApplyDescriptorGet");function HO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(HO,"_classApplyDescriptorSet");function M_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(M_,"_classExtractFieldDescriptor");function Jb(r,e){var t=M_(r,e,"get");return FO(r,t)}o(Jb,"_classPrivateFieldGet");function k_(r,e,t){$O(r,e),e.set(r,t)}o(k_,"_classPrivateFieldInit");function T_(r,e,t){var n=M_(r,e,"set");return HO(r,n,t),t}o(T_,"_classPrivateFieldSet");function qO(r){return typeof r=="string"||tt.isInstance(r)||Fe.isInstance(r)?{streamId:r}:{streamId:r.streamId,genesis:r.genesis}}o(qO,"keyToQuery");function Wb(r){return typeof r=="string"?ni.from(r).toString():tt.isInstance(r)||Fe.isInstance(r)?r.toString():r.streamId.toString()}o(Wb,"keyToString");function Xb(r){return M(this,null,function*(){let e=yield hn.makeGenesis({},null,be(ne({},r),{deterministic:!0})),t=yield Fe.fromGenesis("tile",e);return{genesis:e,streamId:t}})}o(Xb,"getDeterministicQuery");var zO=o(()=>Promise.resolve([]),"tempBatchLoadFn"),qp=new WeakMap,Yb=new WeakMap,Un=class extends B_.default{cache(e){if(!Jb(this,Yb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}create(e,t,n){return M(this,null,function*(){let i=yield hn.create(Jb(this,qp),e,t,n);return this.cache(i),i})}deterministic(e,t){return M(this,null,function*(){let n=yield Xb(e);try{return yield l0(Un.prototype,this,"load").call(this,n)}catch(i){let s=yield hn.createFromGenesis(Jb(this,qp),n.genesis,t);return this.cache(s),s}})}load(e){return M(this,null,function*(){return yield l0(Un.prototype,this,"load").call(this,e)})}update(e,t,n,i){return M(this,null,function*(){let s=Wb(e);this.clear(s);let a=yield this.load({streamId:s});return yield a.update(t,n,i),a})}constructor(e){super(zO,{cache:!0,cacheKeyFn:Wb,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),k_(this,qp,{writable:!0,value:void 0}),k_(this,Yb,{writable:!0,value:void 0}),this._batchLoadFn=t=>M(this,null,function*(){e.cache||this.clearAll();let n=yield e.ceramic.multiQuery(t.map(qO),e.multiqueryTimeout);return t.map(i=>{let s=Wb(i),a=n[s];return a||new Error(`Failed to load stream: ${s}`)})}),T_(this,qp,e.ceramic),T_(this,Yb,!!e.cache)}};o(Un,"TileLoader");function jO(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(jO,"_checkPrivateRedeclaration");function VO(r,e){return e.get?e.get.call(r):e.value}o(VO,"_classApplyDescriptorGet");function GO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(GO,"_classApplyDescriptorSet");function I_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(I_,"_classExtractFieldDescriptor");function Ta(r,e){var t=I_(r,e,"get");return VO(r,t)}o(Ta,"_classPrivateFieldGet");function N_(r,e,t){jO(r,e),e.set(r,t)}o(N_,"_classPrivateFieldInit");function Zb(r,e,t){var n=I_(r,e,"set");return GO(r,n,t),t}o(Zb,"_classPrivateFieldSet");var sf=new WeakMap,of=new WeakMap,af=class{get aliases(){return Ta(this,sf)}get loader(){return Ta(this,of)}getDefinitionID(e){var t;return(t=Ta(this,sf).definitions[e])!=null?t:null}getSchemaURL(e){var t;return(t=Ta(this,sf).schemas[e])!=null?t:null}getTileID(e){var t;return(t=Ta(this,sf).tiles[e])!=null?t:null}loadTile(e){return M(this,null,function*(){let t=this.getTileID(e);if(t==null)throw new Error(`Tile alias "${e}" is not defined`);return yield Ta(this,of).load(t)})}createTile(i,s){return M(this,arguments,function*(e,t,n={}){let a=this.getSchemaURL(e);if(a==null)throw new Error(`Schema alias "${e}" is not defined`);let h=n,{controller:c}=h,f=kt(h,["controller"]),l={schema:a};return c!=null&&(l.controllers=[c]),yield Ta(this,of).create(t,l,f)})}constructor(e){if(N_(this,sf,{writable:!0,value:void 0}),N_(this,of,{writable:!0,value:void 0}),Zb(this,sf,e.aliases),e.loader!=null)Zb(this,of,e.loader);else{if(e.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Zb(this,of,new Un({ceramic:e.ceramic,cache:e.cache}))}}};o(af,"DataModel");function JO(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(JO,"_checkPrivateRedeclaration");function WO(r,e){return e.get?e.get.call(r):e.value}o(WO,"_classApplyDescriptorGet");function YO(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(YO,"_classApplyDescriptorSet");function O_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(O_,"_classExtractFieldDescriptor");function Pi(r,e){var t=O_(r,e,"get");return WO(r,t)}o(Pi,"_classPrivateFieldGet");function zp(r,e,t){JO(r,e),e.set(r,t)}o(zp,"_classPrivateFieldInit");function jp(r,e,t){var n=O_(r,e,"set");return YO(r,n,t),t}o(jp,"_classPrivateFieldSet");var Vp=new WeakMap,Ma=new WeakMap,Qb=new WeakMap,Gp=new WeakMap,ml=class{_createValuePromise(){jp(this,Qb,new Promise((e,t)=>{jp(this,Gp,{resolve:e,reject:t})}))}change(e){return new Promise((t,n)=>{let i=o(s=>M(this,null,function*(){try{let a=yield e(s);t(),this._next(a)}catch(a){n(a),this._next(s)}}),"run");Pi(this,Ma).push({reject:n,run:i}),Pi(this,Ma).length===1&&this._start()})}changeContent(e){return M(this,null,function*(){let t=o(n=>M(this,null,function*(){return yield n.update(e(n.content),n.metadata),n}),"mutation");return yield this.change(t)})}get(){return M(this,null,function*(){return Pi(this,Ma).length===0?yield Pi(this,Vp).call(this):yield Pi(this,Qb)})}_start(){return M(this,null,function*(){try{let e=yield Pi(this,Vp).call(this);this._next(e)}catch(e){Pi(this,Ma).forEach(t=>{t.reject(e)}),jp(this,Ma,[]),Pi(this,Gp).reject(e),this._createValuePromise()}})}_next(e){let t=Pi(this,Ma).shift();t==null?this._end(e):t.run(e)}_end(e){Pi(this,Gp).resolve(e),this._createValuePromise()}constructor(e){zp(this,Vp,{writable:!0,value:void 0}),zp(this,Ma,{writable:!0,value:[]}),zp(this,Qb,{writable:!0,value:void 0}),zp(this,Gp,{writable:!0,value:void 0}),jp(this,Vp,e),this._createValuePromise()}};o(ml,"TileProxy");var XO=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function ZO(r){return XO.test(r)}o(ZO,"isDIDstring");function QO(r){if(!ZO(r))throw new Error(`Invalid DID: ${r}`)}o(QO,"assertDIDstring");function eg(r){return QO(r),{controllers:[r],family:"IDX"}}o(eg,"getIDXMetadata");function eP(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}o(eP,"_checkPrivateRedeclaration");function tP(r,e){return e.get?e.get.call(r):e.value}o(tP,"_classApplyDescriptorGet");function rP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}o(rP,"_classApplyDescriptorSet");function P_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}o(P_,"_classExtractFieldDescriptor");function $t(r,e){var t=P_(r,e,"get");return tP(r,t)}o($t,"_classPrivateFieldGet");function bl(r,e,t){eP(r,e),e.set(r,t)}o(bl,"_classPrivateFieldInit");function Jp(r,e,t){var n=P_(r,e,"set");return rP(r,n,t),t}o(Jp,"_classPrivateFieldSet");var vs=new WeakMap,Wp=new WeakMap,tg=new WeakMap,Ri=new WeakMap,Yp=new WeakMap,gl=class{get authenticated(){return $t(this,vs).did!=null}get ceramic(){return $t(this,vs)}get id(){if($t(this,Wp)!=null)return $t(this,Wp);if($t(this,vs).did==null)throw new Error("Ceramic instance is not authenticated");return $t(this,vs).did.hasParent?$t(this,vs).did.parent:$t(this,vs).did.id}get loader(){return $t(this,Ri)}get model(){return $t(this,Yp)}has(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return(yield this.getRecordID(n,t))!=null})}get(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return yield this.getRecord(n,t)})}getMultiple(e,t){return M(this,null,function*(){var c,f,l;let n=this.getDefinitionID(e),i=yield Promise.all(t.map(h=>M(this,null,function*(){let{genesis:d,streamId:v}=yield Xb(eg(h));return{genesis:d,streamId:v.toString(),paths:[n]}}))),s=yield $t(this,vs).multiQuery(i),a=[];for(let h of i){let d=(f=(c=s[h.streamId])==null?void 0:c.content)==null?void 0:f[n],v=d?s[Fe.fromString(d).toString()]:null;a.push((l=v==null?void 0:v.content)!=null?l:null)}return a})}set(i,s){return M(this,arguments,function*(e,t,n={}){var l;let a=this.getDefinitionID(e),[c,f]=yield this._setRecordOnly(a,t,n);return c&&(yield this._setReference((l=n.controller)!=null?l:this.id,a,f)),f})}merge(i,s){return M(this,arguments,function*(e,t,n={}){let a=this.getDefinitionID(e),c=yield this.getRecord(a),f=c?ne(ne({},c),t):t;return yield this.setRecord(a,f,n)})}setAll(n){return M(this,arguments,function*(e,t={}){var c;let i=Object.entries(e).map(h=>M(this,[h],function*([f,l]){let d=this.getDefinitionID(f),[v,x]=yield this._setRecordOnly(d,l,t);return[v,d,x]})),a=(yield Promise.all(i)).reduce((f,[l,h,d])=>(l&&(f[h]=d.toUrl()),f),{});return yield this._setReferences((c=t.controller)!=null?c:this.id,a),a})}setDefaults(n){return M(this,arguments,function*(e,t={}){var f,l;let i=(f=yield this.getIndex())!=null?f:{},s=Object.entries(e).map(([h,d])=>[this.getDefinitionID(h),d]).filter(h=>i[h[0]]==null).map(v=>M(this,[v],function*([h,d]){let x=yield this.getDefinition(h),y=yield this._createRecord(x,d,t);return{[h]:y.toUrl()}})),c=(yield Promise.all(s)).reduce((h,d)=>Object.assign(h,d),{});return yield this._setReferences((l=t.controller)!=null?l:this.id,c),c})}remove(n){return M(this,arguments,function*(e,t=this.id){yield this._getIndexProxy(t).changeContent(i=>(i!=null&&delete i[this.getDefinitionID(e)],i))})}getIndex(){return M(this,arguments,function*(e=this.id){let t=this.authenticated&&e===this.id?yield this._getIndexProxy(e).get():yield this._getIDXDoc(e);return t?t.content:null})}iterator(e){let t,n=0;return{[Symbol.asyncIterator](){return this},next:()=>M(this,null,function*(){if(t==null){let c=yield this.getIndex(e);t=Object.entries(c!=null?c:{})}if(n===t.length)return{done:!0,value:null};let[i,s]=t[n++],a=yield $t(this,Ri).load(s);return{done:!1,value:{key:i,id:s,record:a.content}}})}}_createIDXDoc(e){return M(this,null,function*(){return yield $t(this,Ri).deterministic(eg(e))})}_getIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)return null;if(t.metadata.schema!==tp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getOwnIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)yield t.update({},{schema:tp});else if(t.metadata.schema!==tp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getIndexProxy(e){let t=$t(this,tg)[e];return t==null&&(t=new ml(()=>M(this,null,function*(){return yield this._getOwnIDXDoc(e)})),$t(this,tg)[e]=t),t}getDefinitionID(e){var t;return(t=$t(this,Yp).getDefinitionID(e))!=null?t:e}getDefinition(e){return M(this,null,function*(){let t=yield $t(this,Ri).load(e);if(t.metadata.schema!==$4)throw new Error("Invalid document: schema is not Definition");return be(ne({},t.content),{id:t.id})})}getRecordID(e,t){return M(this,null,function*(){var i;let n=yield this.getIndex(t!=null?t:this.id);return(i=n==null?void 0:n[e])!=null?i:null})}getRecordDocument(e,t){return M(this,null,function*(){let n=yield this.getRecordID(e,t);return n?yield $t(this,Ri).load(n):null})}getRecord(e,t){return M(this,null,function*(){let n=yield this.getRecordDocument(e,t);return n?n.content:null})}setRecord(i,s){return M(this,arguments,function*(e,t,n={}){var f;let[a,c]=yield this._setRecordOnly(e,t,n);return a&&(yield this._setReference((f=n.controller)!=null?f:this.id,e,c)),c})}_setRecordOnly(e,t,n){return M(this,null,function*(){var s;let i=yield this.getRecordID(e,(s=n.controller)!=null?s:this.id);if(i==null){let a=yield this.getDefinition(e),c=yield this._createRecord(a,t,n);return[!0,c]}else{let a=yield $t(this,Ri).update(i,t);return[!1,a.id]}})}_createRecord(s,a,c){return M(this,arguments,function*(e,t,{controller:n,pin:i}){let f=yield $t(this,Ri).deterministic({controllers:[n!=null?n:this.id],family:e.id.toString()},{pin:i});return yield f.update(t,{schema:e.schema}),f.id})}_setReference(e,t,n){return M(this,null,function*(){yield this._getIndexProxy(e).changeContent(i=>be(ne({},i),{[t]:n.toUrl()}))})}_setReferences(e,t){return M(this,null,function*(){Object.keys(t).length!==0&&(yield this._getIndexProxy(e).changeContent(n=>ne(ne({},n),t)))})}constructor(e){bl(this,vs,{writable:!0,value:void 0}),bl(this,Wp,{writable:!0,value:void 0}),bl(this,tg,{writable:!0,value:{}}),bl(this,Ri,{writable:!0,value:void 0}),bl(this,Yp,{writable:!0,value:void 0});let{cache:t,ceramic:n,id:i,loader:s,model:a}=e;Jp(this,vs,n),Jp(this,Wp,i),Jp(this,Ri,s!=null?s:new Un({ceramic:n,cache:t})),Jp(this,Yp,a instanceof af?a:new af({loader:$t(this,Ri),aliases:a}))}};o(gl,"DIDDataStore");function rg(r){return typeof r=="string"?Fe.fromString(r):r}o(rg,"typeStreamID");function R_(r,e){return e?r.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):r}o(R_,"combineURLs");var tA=ze(eA(),1),Or=class extends ct{constructor(e,t,n){super(i=>{this.state$.observers.length===0&&(this.periodicSubscription=ll(0,n).pipe(Fb(()=>this._syncState(this.id,{sync:Er.PREFER_CACHE}))).subscribe()),this.state$.subscribe(i).add(()=>{var c;this.state$.observers.length===0&&((c=this.periodicSubscription)==null||c.unsubscribe())})}),this._apiUrl=t,this.state$=new pl(e)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}_syncState(e,t){return M(this,null,function*(){let n=yield Or._load(e,this._apiUrl,t);this.state$.next(lt.deserializeState(n))})}get id(){return new Fe(this.state$.value.type,this.state$.value.log[0].cid)}static createFromGenesis(e,t,n,i,s){return M(this,null,function*(){let{state:a}=yield ln(e+"/streams",{method:"post",body:{type:t,genesis:lt.serializeCommit(n),opts:i}});return new Or(lt.deserializeState(a),e,s)})}static applyCommit(e,t,n,i,s){return M(this,null,function*(){let{state:a}=yield ln(e+"/commits",{method:"post",body:{streamId:t.toString(),commit:lt.serializeCommit(n),opts:i}});return new Or(lt.deserializeState(a),e,s)})}static _load(e,t,n){return M(this,null,function*(){let i=t+"/streams/"+e.toString()+"?"+tA.default.stringify(n),{state:s}=yield ln(i);return s})}static load(e,t,n,i){return M(this,null,function*(){let s=yield Or._load(e,t,i);return new Or(lt.deserializeState(s),t,n)})}static loadStreamCommits(e,t){return M(this,null,function*(){let{commits:n}=yield ln(`${t}/commits/${e}`);return n.map(i=>({cid:i.cid,value:lt.deserializeCommit(i.value)}))})}complete(){this.state$.complete()}};o(Or,"Document");var hP=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var c=r.length-1;c>=0;c--)(a=r[c])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},Ba,sg=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),rA={anchor:!1,publish:!0,pin:!0,sync:Er.PREFER_CACHE},og={anchor:!0,publish:!0,throwOnInvalidCommit:!0},dP={sync:Er.PREFER_CACHE},Na=Ba=o(class extends Ca{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}static fromAccount(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},rA),n);let a=v_(t),c=Ba.makeGenesis(a);return Ba.fromGenesis(e,c,n)})}static fromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){return n=ne(ne({},rA),n),e.createStreamFromGenesis(Ba.STREAM_TYPE_ID,t,n)})}setDid(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},og),n);let a=typeof e=="string"?e.trim():e.id,c=E0(a);if((c==null?void 0:c.did)!==a)throw new Error(`DID is not valid: '${a}'`);let f=yield t.createLink(a);return this.setDidProof(f,n)})}setDidProof(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},og),t);let i=this.makeCommit(e),s=yield this.api.applyCommit(this.id,i,t);this.state$.next(s.state)})}clearDid(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},og),t);let i=yield e.createLink("");return this.setDidProof(i,t)})}static load(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},dP),n);let a=ni.from(t);if(a.type!=Ba.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${Ba.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}static makeGenesis(e){return e.chainId.namespace==="eip155"&&(e.address=e.address.toLowerCase()),{header:{controllers:[`${e.address}@${e.chainId.toString()}`],family:`caip10-${e.chainId.toString()}`}}}makeCommit(e){return{data:e,prev:this.tip,id:this.state$.id.cid}}makeReadOnly(){this.setDidProof=sg,this.setDid=sg,this.sync=sg,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link");Na.STREAM_TYPE_NAME="caip10-link";Na.STREAM_TYPE_ID=1;Na=Ba=hP([Dp()],Na);var yl=class{constructor(e){this._apiUrl=e}add(e,t){return M(this,null,function*(){let n={};t&&(n.force=!0),yield ln(this._apiUrl+`/pins/${e.toString()}`,{method:"post",body:n})})}rm(e,t){return M(this,null,function*(){yield ln(this._apiUrl+`/pins/${e.toString()}`,{method:"delete",body:{opts:t}})})}ls(e){return M(this,null,function*(){let t=this._apiUrl+"/pins";e&&(t+=`/${e.toString()}`);let n=yield ln(t),{pinnedStreamIds:i}=n;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===i.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:i[s++],done:!1})}}}}})}};o(yl,"RemotePinApi");var pP="/api/v0",mP="http://localhost:7007",bP={syncInterval:5e3},gP={anchor:!0,publish:!0,sync:Er.PREFER_CACHE},yP={anchor:!0,publish:!0,sync:Er.PREFER_CACHE},nA={sync:Er.PREFER_CACHE},vl=class{constructor(e=mP,t={}){this._config=ne(ne({},bP),t),this._apiUrl=R_(e,pP),this._streamCache=new Map,this.context={api:this},this.pin=new yl(this._apiUrl),this._streamConstructors={[hn.STREAM_TYPE_ID]:hn,[Na.STREAM_TYPE_ID]:Na}}get did(){return this.context.did}set did(e){this.context.did=e}createStreamFromGenesis(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},yP),n);let a=yield Or.createFromGenesis(this._apiUrl,e,t,n,this._config.syncInterval),c=this._streamCache.get(a.id.toString());return c?(lt.statesEqual(a.state,c.state)||c.next(a.state),this.buildStream(c)):(this._streamCache.set(a.id.toString(),a),this.buildStream(a))})}loadStream(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},nA),t);let i=ni.from(e),s=this._streamCache.get(i.baseID.toString());return s?yield s._syncState(i,t):(s=yield Or.load(i,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(s.id.toString(),s)),this.buildStream(s)})}multiQuery(e,t){return M(this,null,function*(){let n=e.map(s=>be(ne({},s),{streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),i=yield ln(this._apiUrl+"/multiqueries",{method:"post",body:{queries:n,timeout:t}});return Object.entries(i).reduce((s,a)=>{let[c,f]=a,l=lt.deserializeState(f),h=new Or(l,this._apiUrl,this._config.syncInterval);return s[c]=this.buildStream(h),s},{})})}loadStreamCommits(e){let t=rg(e);return Or.loadStreamCommits(t,this._apiUrl)}applyCommit(i,s){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},gP),n);let a=rg(e),c=yield Or.applyCommit(this._apiUrl,a,t,n,this._config.syncInterval),f=this._streamCache.get(a.toString());return f?(f.next(c.state),this.buildStream(c)):(this._streamCache.set(a.toString(),c),this.buildStream(c))})}requestAnchor(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},nA),t);let{anchorStatus:i}=yield ln(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return i})}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}findStreamConstructor(e){let t=this._streamConstructors[e];if(t)return t;throw new Error(`Failed to find constructor for stream ${e}`)}buildStream(e){let t=this.findStreamConstructor(e.state.type);return new t(e,this.context)}setDID(e){return M(this,null,function*(){this.context.did=e})}getSupportedChains(){return M(this,null,function*(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=yield ln(this._apiUrl+"/node/chains");return this._supportedChains=e,e})}close(){return M(this,null,function*(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()})}};o(vl,"CeramicClient");var vP=o((r,e)=>M(void 0,null,function*(){let t=new vl(e),n=ne({},iA.default.getResolver()),i=new ga({resolver:n});t.did=i;let s=r.pluginMethods.getKey(),a=new Yu(Yd(s));return t.did.setProvider(a),yield t.did.authenticate(),t}),"getCeramicClientFromWalletSuite"),Xp=o((s,a)=>M(void 0,[s,a],function*(r,{modelData:e,credentialAlias:t,ceramicEndpoint:n,defaultContentFamily:i}){let c=yield vP(r,n),f=new Un({ceramic:c}),l=new gl({ceramic:c,model:e}),h=o((..._)=>M(void 0,[..._],function*(y=t){return(yield l.get(y))||{credentials:[]}}),"getCredentialsListFromIndex"),d=o((y,_)=>M(void 0,null,function*(){if(!y)throw new Error("record is required");if(!y.id)throw Error("No streamId provided");y.id.indexOf("ceramic://")===-1&&(y.id="ceramic://"+y.id),_||(_=t);let U=yield h(_);return U.credentials.push(ne({storageType:"ceramic"},y)),l.set(_,U)}),"addCredentialStreamIdToIndex"),v=o((E,...L)=>M(void 0,[E,...L],function*(y,_={},U={}){if(!y)throw new Error("content is required");return _.controllers||(_.controllers=[c.did.id]),_.family||(_.family=i),"pin"in U||(U.pin=!0),(yield hn.create(c,y,_,U)).id.toString()}),"publishContentToCeramic"),x=o(y=>M(void 0,null,function*(){var _;return(_=yield f.load(y))==null?void 0:_.content}),"readContentFromCeramic");return{pluginMethods:{getCredentialsListFromIndex:(U,...E)=>M(void 0,[U,...E],function*(y,_=t){return h(_)}),publishContentToCeramic:(y,_)=>M(void 0,null,function*(){return v(_)}),readContentFromCeramic:(y,_)=>M(void 0,null,function*(){return x(_)}),getVerifiableCredentialFromIndex:(y,_)=>M(void 0,null,function*(){var L;let U=yield h(),E=(L=U==null?void 0:U.credentials)==null?void 0:L.find(H=>(H==null?void 0:H.title)===_);return E&&(yield x(E.id))}),getVerifiableCredentialsFromIndex:()=>M(void 0,null,function*(){var U,E;let y=yield h(),_=(E=(U=y==null?void 0:y.credentials)==null?void 0:U.map(L=>L==null?void 0:L.id))!=null?E:[];return Promise.all(_.map(L=>M(void 0,null,function*(){return x(L)})))}),addVerifiableCredentialInIdx:(E,L)=>M(void 0,[E,L],function*(y,{title:_,id:U}){return d({title:_,id:U})})}}}),"getIDXPlugin");var sA=o(r=>M(void 0,null,function*(){let e=JSON.parse(pg(Yd(r.padStart(64,"0")))),t=mg("key",JSON.stringify(e));return{pluginMethods:{getSubjectDid:()=>t,getSubjectKeypair:()=>e,getKey:()=>r}}}),"getDidKeyPlugin");var oA=o(r=>({pluginMethods:{verifyCredential:(e,t)=>M(void 0,null,function*(){let n=yield r.pluginMethods.verifyCredential(t);return t.expirationDate&&(n.checks.push("expiration"),new Date>new Date(t.expirationDate)&&n.errors.push("expiration error: Credential is expired")),n})}}),"ExpirationPlugin");var aA=o((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectKeypair();if(!t)throw new Error("Cannot issue credential: Could not get subject keypair");let n=JSON.stringify(t),i=JSON.stringify({verificationMethod:yield Sl("key",n),proofPurpose:"assertionMethod"});return JSON.parse(yield bg(JSON.stringify(e),i,n))}),"issueCredential");var cA=o(r=>M(void 0,null,function*(){return JSON.parse(yield gg(JSON.stringify(r),"{}"))}),"verifyCredential");var fA=o((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectDid();if(!t)throw new Error("Cannot create presentation: No holder key found");let n=t,i=r.pluginMethods.getSubjectKeypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let s=JSON.stringify(i),a=JSON.stringify({verificationMethod:yield Sl("key",s),proofPurpose:"assertionMethod"}),c=JSON.stringify({"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:n,verifiableCredential:e});return JSON.parse(yield yg(c,a,s))}),"issuePresentation");var uA=o(r=>M(void 0,null,function*(){return JSON.parse(yield vg(JSON.stringify(r),"{}"))}),"verifyPresentation");var ag=o(r=>M(void 0,null,function*(){return{pluginMethods:be(ne({},r.pluginMethods),{issueCredential:aA,verifyCredential:(e,t)=>M(void 0,null,function*(){return cA(t)}),issuePresentation:fA,verifyPresentation:(e,t)=>M(void 0,null,function*(){return uA(t)}),getTestVc:(e,t="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.pluginMethods.getSubjectDid();return{"@context":"https://www.w3.org/2018/credentials/v1",id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:n,issuanceDate:"2020-08-19T21:41:50Z",credentialSubject:{id:t}}}})}}),"getVCPlugin");var wl=(r=>(r.Success="Success",r.Failed="Failed",r.Error="Error",r))(wl||{});var lA=o(r=>e=>M(void 0,null,function*(){let t=yield r.pluginMethods.verifyCredential(e),n=[];return t.errors.forEach(i=>{n.push({status:wl.Failed,check:"hmm",details:i})}),t.warnings.forEach(i=>{n.push({status:wl.Error,check:"hmm",message:i})}),t.checks.forEach(i=>{n.push({status:wl.Success,check:i,message:i==="proof"?"Valid":i})}),n}),"verifyCredential");var hA={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials",ceramicEndpoint:"https://ceramic-node.welibrary.io:7007",defaultContentFamily:"SuperSkills"};var dA=o((i,...s)=>M(void 0,[i,...s],function*(r,{ceramicIdx:e=hA,didkit:t,defaultContents:n=[]}={}){yield Ag(t);let a=yield(yield ou(n)).addPlugin(yield sA(r)),c=yield a.addPlugin(yield ag(a)),f=yield c.addPlugin(yield Xp(c,e)),l=yield f.addPlugin(oA(f));return{_wallet:l,get did(){return l.pluginMethods.getSubjectDid()},get keypair(){return l.pluginMethods.getSubjectKeypair()},issueCredential:l.pluginMethods.issueCredential,verifyCredential:lA(l),issuePresentation:l.pluginMethods.issuePresentation,verifyPresentation:l.pluginMethods.verifyPresentation,getCredential:l.pluginMethods.getVerifiableCredentialFromIndex,getCredentials:l.pluginMethods.getVerifiableCredentialsFromIndex,publishCredential:l.pluginMethods.publishContentToCeramic,addCredential:h=>M(void 0,null,function*(){yield l.pluginMethods.addVerifiableCredentialInIdx(h)}),readFromCeramic:l.pluginMethods.readContentFromCeramic,getTestVc:l.pluginMethods.getTestVc}}),"walletFromKey");
|
818
|
+
`):"",this.name="UnsubscriptionError",this.errors=t},"UnsubscriptionErrorImpl")});function Ia(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}s(Ia,"arrRemove");var Ms=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return s(r,"Subscription"),r.prototype.unsubscribe=function(){var e,t,n,i,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=js(a),c=f.next();!c.done;c=f.next()){var l=c.value;l.remove(this)}}catch(x){e={error:x}}finally{try{c&&!c.done&&(t=f.return)&&t.call(f)}finally{if(e)throw e.error}}else a.remove(this);var h=this.initialTeardown;if(qe(h))try{h()}catch(x){o=x instanceof Np?x.errors:[x]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var y=js(d),A=y.next();!A.done;A=y.next()){var v=A.value;try{iA(v)}catch(x){o=o!=null?o:[],x instanceof Np?o=Vn(Vn([],nn(o)),nn(x.errors)):o.push(x)}}}catch(x){n={error:x}}finally{try{A&&!A.done&&(i=y.return)&&i.call(y)}finally{if(n)throw n.error}}}if(o)throw new Np(o)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)iA(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Ia(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Ia(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var jb=Ms.EMPTY;function Op(r){return r instanceof Ms||r&&"closed"in r&&qe(r.remove)&&qe(r.add)&&qe(r.unsubscribe)}s(Op,"isSubscription");function iA(r){qe(r)?r():r.unsubscribe()}s(iA,"execFinalizer");var fi={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var cc={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=cc.delegate;return i!=null&&i.setTimeout?i.setTimeout.apply(i,Vn([r,e],nn(t))):setTimeout.apply(void 0,Vn([r,e],nn(t)))},clearTimeout:function(r){var e=cc.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function Pp(r){cc.setTimeout(function(){var e=fi.onUnhandledError;if(e)e(r);else throw r})}s(Pp,"reportUnhandledError");function Vb(){}s(Vb,"noop");var oA=function(){return Wb("C",void 0,void 0)}();function sA(r){return Wb("E",void 0,r)}s(sA,"errorNotification");function aA(r){return Wb("N",r,void 0)}s(aA,"nextNotification");function Wb(r,e,t){return{kind:r,value:e,error:t}}s(Wb,"createNotification");var Na=null;function uc(r){if(fi.useDeprecatedSynchronousErrorHandling){var e=!Na;if(e&&(Na={errorThrown:!1,error:null}),r(),e){var t=Na,n=t.errorThrown,i=t.error;if(Na=null,n)throw i}}else r()}s(uc,"errorContext");function fA(r){fi.useDeprecatedSynchronousErrorHandling&&Na&&(Na.errorThrown=!0,Na.error=r)}s(fA,"captureError");var yl=function(r){xr(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Op(t)&&t.add(n)):n.destination=VO,n}return s(e,"Subscriber"),e.create=function(t,n,i){return new Up(t,n,i)},e.prototype.next=function(t){this.isStopped?Jb(aA(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Jb(sA(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Jb(oA,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Ms);var qO=Function.prototype.bind;function Gb(r,e){return qO.call(r,e)}s(Gb,"bind");var zO=function(){function r(e){this.partialObserver=e}return s(r,"ConsumerObserver"),r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){Rp(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){Rp(n)}else Rp(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Rp(t)}},r}(),Up=function(r){xr(e,r);function e(t,n,i){var o=r.call(this)||this,a;if(qe(t)||!t)a={next:t!=null?t:void 0,error:n!=null?n:void 0,complete:i!=null?i:void 0};else{var f;o&&fi.useDeprecatedNextContext?(f=Object.create(t),f.unsubscribe=function(){return o.unsubscribe()},a={next:t.next&&Gb(t.next,f),error:t.error&&Gb(t.error,f),complete:t.complete&&Gb(t.complete,f)}):a=t}return o.destination=new zO(a),o}return s(e,"SafeSubscriber"),e}(yl);function Rp(r){fi.useDeprecatedSynchronousErrorHandling?fA(r):Pp(r)}s(Rp,"handleUnhandledError");function jO(r){throw r}s(jO,"defaultErrorHandler");function Jb(r,e){var t=fi.onStoppedNotification;t&&cc.setTimeout(function(){return t(r,e)})}s(Jb,"handleStoppedNotification");var VO={closed:!0,next:Vb,error:jO,complete:Vb};var lc=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function hc(r){return r}s(hc,"identity");function cA(r){return r.length===0?hc:r.length===1?r[0]:s(function(t){return r.reduce(function(n,i){return i(n)},t)},"piped")}s(cA,"pipeFromArray");var ut=function(){function r(e){e&&(this._subscribe=e)}return s(r,"Observable"),r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,o=GO(e)?e:new Up(e,t,n);return uc(function(){var a=i,f=a.operator,c=a.source;o.add(f?f.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=uA(t),new t(function(i,o){var a=new Up({next:function(f){try{e(f)}catch(c){o(c),a.unsubscribe()}},error:o,complete:i});n.subscribe(a)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[lc]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cA(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=uA(e),new e(function(n,i){var o;t.subscribe(function(a){return o=a},function(a){return i(a)},function(){return n(o)})})},r.create=function(e){return new r(e)},r}();function uA(r){var e;return(e=r!=null?r:fi.Promise)!==null&&e!==void 0?e:Promise}s(uA,"getPromiseCtor");function WO(r){return r&&qe(r.next)&&qe(r.error)&&qe(r.complete)}s(WO,"isObserver");function GO(r){return r&&r instanceof yl||WO(r)&&Op(r)}s(GO,"isSubscriber");function JO(r){return qe(r==null?void 0:r.lift)}s(JO,"hasLift");function ar(r){return function(e){if(JO(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}s(ar,"operate");function fr(r,e,t,n,i){return new YO(r,e,t,n,i)}s(fr,"createOperatorSubscriber");var YO=function(r){xr(e,r);function e(t,n,i,o,a,f){var c=r.call(this,t)||this;return c.onFinalize=a,c.shouldUnsubscribe=f,c._next=n?function(l){try{n(l)}catch(h){t.error(h)}}:r.prototype._next,c._error=o?function(l){try{o(l)}catch(h){t.error(h)}finally{this.unsubscribe()}}:r.prototype._error,c._complete=i?function(){try{i()}catch(l){t.error(l)}finally{this.unsubscribe()}}:r.prototype._complete,c}return s(e,"OperatorSubscriber"),e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(yl);var lA=fc(function(r){return s(function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl")});var Yb=function(r){xr(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return s(e,"Subject"),e.prototype.lift=function(t){var n=new hA(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new lA},e.prototype.next=function(t){var n=this;uc(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=js(n.currentObservers),f=a.next();!f.done;f=a.next()){var c=f.value;c.next(t)}}catch(l){i={error:l}}finally{try{f&&!f.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;uc(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;uc(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=this,o=i.hasError,a=i.isStopped,f=i.observers;return o||a?jb:(this.currentObservers=null,f.push(t),new Ms(function(){n.currentObservers=null,Ia(f,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,o=n.thrownError,a=n.isStopped;i?t.error(o):a&&t.complete()},e.prototype.asObservable=function(){var t=new ut;return t.source=this,t},e.create=function(t,n){return new hA(t,n)},e}(ut);var hA=function(r){xr(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return s(e,"AnonymousSubject"),e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:jb},e}(Yb);var Xb=function(r){xr(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return s(e,"BehaviorSubject"),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,o=t._value;if(n)throw i;return this._throwIfClosed(),o},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(Yb);var Zb={now:function(){return(Zb.delegate||Date).now()},delegate:void 0};var dA=function(r){xr(e,r);function e(t,n){return r.call(this)||this}return s(e,"Action"),e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e}(Ms);var vl={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i=vl.delegate;return i!=null&&i.setInterval?i.setInterval.apply(i,Vn([r,e],nn(t))):setInterval.apply(void 0,Vn([r,e],nn(t)))},clearInterval:function(r){var e=vl.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0};var pA=function(r){xr(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return s(e,"AsyncAction"),e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,o=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(o,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(o,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),vl.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;vl.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,o;try{this.work(t)}catch(a){i=!0,o=a||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Ia(o,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(dA);var Qb=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return s(r,"Scheduler"),r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=Zb.now,r}();var mA=function(r){xr(e,r);function e(t,n){n===void 0&&(n=Qb.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return s(e,"AsyncScheduler"),e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(Qb);var XO=new mA(pA),bA=XO;var Lp=new ut(function(r){return r.complete()});function Dp(r){return r&&qe(r.schedule)}s(Dp,"isScheduler");function gA(r){return r[r.length-1]}s(gA,"last");function yA(r){return Dp(gA(r))?r.pop():void 0}s(yA,"popScheduler");function vA(r,e){return typeof gA(r)=="number"?r.pop():e}s(vA,"popNumber");var dc=s(function(r){return r&&typeof r.length=="number"&&typeof r!="function"},"isArrayLike");function Fp(r){return qe(r==null?void 0:r.then)}s(Fp,"isPromise");function Kp(r){return qe(r[lc])}s(Kp,"isInteropObservable");function $p(r){return Symbol.asyncIterator&&qe(r==null?void 0:r[Symbol.asyncIterator])}s($p,"isAsyncIterable");function Hp(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}s(Hp,"createInvalidObservableTypeError");function ZO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}s(ZO,"getSymbolIterator");var qp=ZO();function zp(r){return qe(r==null?void 0:r[qp])}s(zp,"isIterable");function jp(r){return cv(this,arguments,s(function(){var t,n,i,o;return Jl(this,function(a){switch(a.label){case 0:t=r.getReader(),a.label=1;case 1:a.trys.push([1,,9,10]),a.label=2;case 2:return[4,Yl(t.read())];case 3:return n=a.sent(),i=n.value,o=n.done,o?[4,Yl(void 0)]:[3,5];case 4:return[2,a.sent()];case 5:return[4,Yl(i)];case 6:return[4,a.sent()];case 7:return a.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"))}s(jp,"readableStreamLikeToAsyncGenerator");function Vp(r){return qe(r==null?void 0:r.getReader)}s(Vp,"isReadableStreamLike");function Mr(r){if(r instanceof ut)return r;if(r!=null){if(Kp(r))return QO(r);if(dc(r))return eP(r);if(Fp(r))return tP(r);if($p(r))return wA(r);if(zp(r))return rP(r);if(Vp(r))return nP(r)}throw Hp(r)}s(Mr,"innerFrom");function QO(r){return new ut(function(e){var t=r[lc]();if(qe(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}s(QO,"fromInteropObservable");function eP(r){return new ut(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}s(eP,"fromArrayLike");function tP(r){return new ut(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Pp)})}s(tP,"fromPromise");function rP(r){return new ut(function(e){var t,n;try{for(var i=js(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.next(a),e.closed)return}}catch(f){t={error:f}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}s(rP,"fromIterable");function wA(r){return new ut(function(e){iP(r,e).catch(function(t){return e.error(t)})})}s(wA,"fromAsyncIterable");function nP(r){return wA(jp(r))}s(nP,"fromReadableStreamLike");function iP(r,e){var t,n,i,o;return fv(this,void 0,void 0,function(){var a,f;return Jl(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=uv(r),c.label=1;case 1:return[4,t.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(a=n.value,e.next(a),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return f=c.sent(),i={error:f},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}s(iP,"process");function Fn(r,e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=e.schedule(function(){t(),i?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(o),!i)return o}s(Fn,"executeSchedule");function Wp(r,e){return e===void 0&&(e=0),ar(function(t,n){t.subscribe(fr(n,function(i){return Fn(n,r,function(){return n.next(i)},e)},function(){return Fn(n,r,function(){return n.complete()},e)},function(i){return Fn(n,r,function(){return n.error(i)},e)}))})}s(Wp,"observeOn");function Gp(r,e){return e===void 0&&(e=0),ar(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}s(Gp,"subscribeOn");function xA(r,e){return Mr(r).pipe(Gp(e),Wp(e))}s(xA,"scheduleObservable");function AA(r,e){return Mr(r).pipe(Gp(e),Wp(e))}s(AA,"schedulePromise");function _A(r,e){return new ut(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}s(_A,"scheduleArray");function EA(r,e){return new ut(function(t){var n;return Fn(t,e,function(){n=r[qp](),Fn(t,e,function(){var i,o,a;try{i=n.next(),o=i.value,a=i.done}catch(f){t.error(f);return}a?t.complete():t.next(o)},0,!0)}),function(){return qe(n==null?void 0:n.return)&&n.return()}})}s(EA,"scheduleIterable");function Jp(r,e){if(!r)throw new Error("Iterable cannot be null");return new ut(function(t){Fn(t,e,function(){var n=r[Symbol.asyncIterator]();Fn(t,e,function(){n.next().then(function(i){i.done?t.complete():t.next(i.value)})},0,!0)})})}s(Jp,"scheduleAsyncIterable");function SA(r,e){return Jp(jp(r),e)}s(SA,"scheduleReadableStreamLike");function CA(r,e){if(r!=null){if(Kp(r))return xA(r,e);if(dc(r))return _A(r,e);if(Fp(r))return AA(r,e);if($p(r))return Jp(r,e);if(zp(r))return EA(r,e);if(Vp(r))return SA(r,e)}throw Hp(r)}s(CA,"scheduled");function TA(r,e){return e?CA(r,e):Mr(r)}s(TA,"from");var Yp=fc(function(r){return s(function(){r(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl")});function kA(r){return r instanceof Date&&!isNaN(r)}s(kA,"isValidDate");function Xp(r,e){return ar(function(t,n){var i=0;t.subscribe(fr(n,function(o){n.next(r.call(e,o,i++))}))})}s(Xp,"map");var oP=Array.isArray;function sP(r,e){return oP(e)?r.apply(void 0,Vn([],nn(e))):r(e)}s(sP,"callOrApply");function MA(r){return Xp(function(e){return sP(r,e)})}s(MA,"mapOneOrManyArgs");function BA(r,e,t,n,i,o,a,f){var c=[],l=0,h=0,d=!1,y=s(function(){d&&!c.length&&!l&&e.complete()},"checkComplete"),A=s(function(x){return l<n?v(x):c.push(x)},"outerNext"),v=s(function(x){o&&e.next(x),l++;var L=!1;Mr(t(x,h++)).subscribe(fr(e,function(_){i==null||i(_),o?A(_):e.next(_)},function(){L=!0},void 0,function(){if(L)try{l--;for(var _=s(function(){var R=c.shift();a?Fn(e,a,function(){return v(R)}):v(R)},"_loop_1");c.length&&l<n;)_();y()}catch(R){e.error(R)}}))},"doInnerSub");return r.subscribe(fr(e,A,function(){d=!0,y()})),function(){f==null||f()}}s(BA,"mergeInternals");function wl(r,e,t){return t===void 0&&(t=1/0),qe(e)?wl(function(n,i){return Xp(function(o,a){return e(n,o,i,a)})(Mr(r(n,i)))},t):(typeof e=="number"&&(t=e),ar(function(n,i){return BA(n,i,r,t)}))}s(wl,"mergeMap");function IA(r){return r===void 0&&(r=1/0),wl(hc,r)}s(IA,"mergeAll");var aP=["addListener","removeListener"],fP=["addEventListener","removeEventListener"],cP=["on","off"];function xl(r,e,t,n){if(qe(t)&&(n=t,t=void 0),n)return xl(r,e,t).pipe(MA(n));var i=nn(hP(r)?fP.map(function(f){return function(c){return r[f](e,c,t)}}):uP(r)?aP.map(NA(r,e)):lP(r)?cP.map(NA(r,e)):[],2),o=i[0],a=i[1];if(!o&&dc(r))return wl(function(f){return xl(f,e,t)})(Mr(r));if(!o)throw new TypeError("Invalid event target");return new ut(function(f){var c=s(function(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];return f.next(1<l.length?l:l[0])},"handler");return o(c),function(){return a(c)}})}s(xl,"fromEvent");function NA(r,e){return function(t){return function(n){return r[t](e,n)}}}s(NA,"toCommonHandlerRegistry");function uP(r){return qe(r.addListener)&&qe(r.removeListener)}s(uP,"isNodeStyleEventEmitter");function lP(r){return qe(r.on)&&qe(r.off)}s(lP,"isJQueryStyleEventEmitter");function hP(r){return qe(r.addEventListener)&&qe(r.removeEventListener)}s(hP,"isEventTarget");function Al(r,e,t){r===void 0&&(r=0),t===void 0&&(t=bA);var n=-1;return e!=null&&(Dp(e)?t=e:n=e),new ut(function(i){var o=kA(r)?+r-t.now():r;o<0&&(o=0);var a=0;return t.schedule(function(){i.closed||(i.next(a++),0<=n?this.schedule(void 0,n):i.complete())},o)})}s(Al,"timer");function eg(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=yA(r),n=vA(r,1/0),i=r;return i.length?i.length===1?Mr(i[0]):IA(n)(TA(i,t)):Lp}s(eg,"merge");function OA(r,e){return ar(function(t,n){var i=0;t.subscribe(fr(n,function(o){return r.call(e,o,i++)&&n.next(o)}))})}s(OA,"filter");function PA(r){return ar(function(e,t){var n=!1;e.subscribe(fr(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}s(PA,"defaultIfEmpty");function RA(r){return r<=0?function(){return Lp}:ar(function(e,t){var n=0;e.subscribe(fr(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}s(RA,"take");function UA(r){return r===void 0&&(r=dP),ar(function(e,t){var n=!1;e.subscribe(fr(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}s(UA,"throwIfEmpty");function dP(){return new Yp}s(dP,"defaultErrorFactory");function tg(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?OA(function(i,o){return r(i,o,n)}):hc,RA(1),t?PA(e):UA(function(){return new Yp}))}}s(tg,"first");var pP={leading:!0,trailing:!1};function rg(r,e){return e===void 0&&(e=pP),ar(function(t,n){var i=e.leading,o=e.trailing,a=!1,f=null,c=null,l=!1,h=s(function(){c==null||c.unsubscribe(),c=null,o&&(A(),l&&n.complete())},"endThrottling"),d=s(function(){c=null,l&&n.complete()},"cleanupThrottling"),y=s(function(v){return c=Mr(r(v)).subscribe(fr(n,h,d))},"startThrottle"),A=s(function(){if(a){a=!1;var v=f;f=null,n.next(v),!l&&y(v)}},"send");t.subscribe(fr(n,function(v){a=!0,f=v,!(c&&!c.closed)&&(i?A():y(v))},function(){l=!0,!(o&&a&&c&&!c.closed)&&n.complete()}))})}s(rg,"throttle");var LA;(function(r){r[r.GENESIS=0]="GENESIS",r[r.PARTIAL=1]="PARTIAL",r[r.SIGNED=2]="SIGNED"})(LA||(LA={}));var Pa;(function(r){r[r.NOT_REQUESTED=0]="NOT_REQUESTED",r[r.PENDING=1]="PENDING",r[r.PROCESSING=2]="PROCESSING",r[r.ANCHORED=3]="ANCHORED",r[r.FAILED=4]="FAILED"})(Pa||(Pa={}));var ng;(function(r){r[r.GENESIS=0]="GENESIS",r[r.SIGNED=1]="SIGNED",r[r.ANCHOR=2]="ANCHOR"})(ng||(ng={}));var Oa=class extends ut{constructor(e,t){super(n=>{e.subscribe(n)}),this.state$=e,this._context=t}get id(){return new $e(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get metadata(){var n;let{next:e,metadata:t}=this.state$.value;return(0,Zp.default)((n=e==null?void 0:e.metadata)!=null?n:t)}get content(){var n;let{next:e,content:t}=this.state$.value;return(0,Zp.default)((n=e==null?void 0:e.content)!=null?n:t)}get controllers(){return this.metadata.controllers}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return rt.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>rt.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===ng.ANCHOR).map(({cid:e})=>rt.make(this.id,e))}get state(){return(0,Zp.default)(this.state$.value)}sync(){return M(this,arguments,function*(e={}){e=ne({sync:kr.PREFER_CACHE},e);let t=yield this.api.loadStream(this.id,e);this.state$.next(t.state)})}requestAnchor(){return M(this,null,function*(){return this.api.requestAnchor(this.id)})}};s(Oa,"Stream");function Qp(){return r=>{}}s(Qp,"StreamStatic");var jA=ze(KA(),1);var r0=ze(HA(),1);function qA(){globalThis.AbortController||(globalThis.AbortController=r0.AbortController),globalThis.AbortSignal||(globalThis.AbortSignal=r0.AbortSignal)}s(qA,"polyfillAbortController");qA();function zA(r){let e=new AbortController;if(r.length===0)throw Error("Need abort signals to create a merged abort signal");return r.some(t=>t.aborted)?(e.abort(),e.signal):(eg(...r.map(t=>xl(t,"abort"))).pipe(tg()).subscribe(()=>{e.abort()}),e.signal)}s(zA,"mergeAbortSignals");var _l=class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=Al(e).subscribe(()=>{t.abort()})}clear(){var e;(e=this._subscription)==null||e.unsubscribe()}};s(_l,"TimedAbortSignal");var bP=60*1e3*3;function mn(t){return M(this,arguments,function*(r,e={}){e.body&&Object.assign(e,{body:JSON.stringify(e.body),headers:{"Content-Type":"application/json"}});let n=e.timeout||bP,i=new _l(n);e.signal=e.signal?zA([e.signal,i.signal]):i.signal;let o=yield(0,jA.default)(r,e).finally(()=>i.clear());if(!o.ok){let a=yield o.text();throw new Error(`HTTP request to '${r}' failed with status '${o.statusText}': ${a}`)}return o.json()})}s(mn,"fetchJson");var El=ze(zb(),1);to();function Li(r){let e=Ne.asCID(r);if(e)return e;if(typeof r=="string")return Ne.parse(r);if(r instanceof Uint8Array)return Ne.decode(r);throw new Error(`${r} cannot be converted to a CID`)}s(Li,"toCID");var dt=class{static streamIdFromState(e){return new $e(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,El.default)(e);return dt.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Gt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Gt(t.cacaoBlock,"base64")),t):(dt.isSignedCommit(e)&&(t.link=t.link.toString()),dt.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),t)}static deserializeCommit(e){let t=(0,El.default)(e);return dt.isSignedCommitContainer(t)?(t.jws.link=Li(t.jws.link),t.linkedBlock=Yt(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Yt(t.cacaoBlock,"base64")),t):(dt.isSignedCommit(t)&&(t.link=Li(t.link)),dt.isAnchorCommit(t)&&(t.proof=Li(t.proof)),t.id&&(t.id=Li(t.id)),t.prev&&(t.prev=Li(t.prev)),t)}static serializeState(e){let t=(0,El.default)(e);return t.log=t.log.map(n=>be(ne({},n),{cid:n.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=Pa[t.anchorStatus]),t.anchorScheduledFor!=null&&(t.anchorScheduledFor=new Date(t.anchorScheduledFor).toISOString()),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),t.lastAnchored!=null&&(t.lastAnchored=t.lastAnchored.toString()),t.doctype=Xr.nameByCode(t.type),t}static deserializeState(e){let t=(0,El.default)(e);t.doctype&&(t.type=Xr.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(i=>be(ne({},i),{cid:Li(i.cid)})),t.anchorProof&&(t.anchorProof.txHash=Li(t.anchorProof.txHash),t.anchorProof.root=Li(t.anchorProof.root));let n=!0;return t.anchorStatus&&(t.anchorStatus=Pa[t.anchorStatus],n=t.anchorStatus!==Pa.FAILED&&t.anchorStatus!==Pa.ANCHORED),t.anchorScheduledFor&&(n?t.anchorScheduledFor=Date.parse(t.anchorScheduledFor):delete t.anchorScheduledFor),t.lastAnchored&&(t.lastAnchored=Li(t.lastAnchored)),t}static statesEqual(e,t){return JSON.stringify(dt.serializeState(e))===JSON.stringify(dt.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let n in t.log)if(!e.log[n].cid.equals(t.log[n].cid))return!1;return e.anchorStatus==t.anchorStatus}static convertCommitToSignedCommitContainer(e,t){return M(this,null,function*(){if(dt.isSignedCommit(e)){let n=yield t.block.get(e.link);return{jws:e,linkedBlock:n}}return e})}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}};s(dt,"StreamUtils");function VA(r){if(typeof r=="string"&&r.includes("@")){let[e,t]=r.split("@");if(!e||!t)throw new Error("Invalid accountId provided");return new xa({address:e,chainId:t})}return new xa(r)}s(VA,"normalizeAccountId");var Sl=class extends Xb{next(e){let t=this.value;dt.statesEqual(t,e)||super.next(e)}};s(Sl,"StreamStateSubject");var gP=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_o,ig={anchor:!0,publish:!0,pin:!0,sync:kr.PREFER_CACHE},yP={sync:kr.PREFER_CACHE},WA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function og(r,e){var n;if(typeof(r==null?void 0:r.schema)=="string")try{rt.fromString(r.schema)}catch(i){throw new Error("Schema must be a CommitID")}let t={controllers:r==null?void 0:r.controllers,family:r==null?void 0:r.family,schema:(n=r==null?void 0:r.schema)==null?void 0:n.toString(),tags:r==null?void 0:r.tags};if(e)r!=null&&r.deterministic||(t.unique=Gt((0,GA.randomBytes)(12),"base64")),r!=null&&r.forbidControllerChange&&(t.forbidControllerChange=!0);else{if((r==null?void 0:r.deterministic)!==void 0||(r==null?void 0:r.unique)!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if((r==null?void 0:r.forbidControllerChange)!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(t).forEach(i=>t[i]===void 0&&delete t[i]),t}s(og,"headerFromMetadata");function JA(r){return M(this,null,function*(){if(r.did==null)throw new Error("No DID provided");r.did.authenticated||(yield r.did.authenticate(),r.loggerProvider&&r.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${r.did.id}`))})}s(JA,"_ensureAuthenticated");function n0(r,e){return M(this,null,function*(){return yield JA(r),r.did.createDagJWS(e)})}s(n0,"_signDagJWS");function sg(){return M(this,null,function*(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")})}s(sg,"throwReadOnlyError");var bn=_o=s(class extends Oa{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}static create(o,a,f){return M(this,arguments,function*(e,t,n,i={}){i=ne(ne({},ig),i),!(n!=null&&n.deterministic)&&i.syncTimeoutSeconds==null&&(i.syncTimeoutSeconds=0);let c=i.asDID?{did:i.asDID}:e,l=yield _o.makeGenesis(c,t,n);return e.createStreamFromGenesis(_o.STREAM_TYPE_ID,l,i)})}static createFromGenesis(i,o){return M(this,arguments,function*(e,t,n={}){var f;n=ne(ne({},ig),n),((f=t.header)==null?void 0:f.unique)&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=t.data?yield n0(e,t):t;return e.createStreamFromGenesis(_o.STREAM_TYPE_ID,a,n)})}static deterministic(i,o){return M(this,arguments,function*(e,t,n={}){if(n=ne(ne({},ig),n),t=be(ne({},t),{deterministic:!0}),t.family==null&&t.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=yield _o.makeGenesis(e,null,t);return e.createStreamFromGenesis(_o.STREAM_TYPE_ID,a,n)})}static load(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},yP),n);let a=ai.from(t);if(a.type!=_o.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${_o.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}update(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},WA),n);let a=n.asDID?{did:n.asDID}:this.api,f=yield this.makeCommit(a,e,t),c=yield this.api.applyCommit(this.id,f,n);this.state$.next(c.state)})}patch(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},WA),t);let o={header:og(this.metadata,!1),data:e,prev:this.tip,id:this.state$.id.cid},a=yield n0(this.api,o),f=yield this.api.applyCommit(this.id,a,t);this.state$.next(f.state)})}makeReadOnly(){this.update=sg,this.patch=sg,this.sync=sg,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}makeCommit(e,t,n){return M(this,null,function*(){var f;let i=og(n,!1);if(t==null&&(t=this.content),i.controllers&&((f=i.controllers)==null?void 0:f.length)!==1)throw new Error("Exactly one controller must be specified");let o=b8.compare(this.content,t),a={header:i,data:o,prev:this.tip,id:this.state.log[0].cid};return n0(e,a)})}static makeGenesis(e,t,n){return M(this,null,function*(){var a;if(n||(n={}),!n.controllers||n.controllers.length===0)if(e.did)yield JA(e),n.controllers=[e.did.hasParent?e.did.parent:e.did.id];else throw new Error("No controllers specified");if(((a=n.controllers)==null?void 0:a.length)!==1)throw new Error("Exactly one controller must be specified");let i=og(n,!0);if((n==null?void 0:n.deterministic)&&t)throw new Error("Initial content must be null when creating a deterministic Tile document");if(t==null){let f={header:i};return I1(f),f}return n0(e,{data:t,header:i})})}},"TileDocument");bn.STREAM_TYPE_NAME="tile";bn.STREAM_TYPE_ID=0;bn=_o=gP([Qp()],bn);var n_=ze(QA(),1);function TP(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(TP,"_checkPrivateRedeclaration");function kP(r,e){return e.get?e.get.call(r):e.value}s(kP,"_classApplyDescriptorGet");function MP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}s(MP,"_classApplyDescriptorSet");function r_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}s(r_,"_classExtractFieldDescriptor");function cg(r,e){var t=r_(r,e,"get");return kP(r,t)}s(cg,"_classPrivateFieldGet");function e_(r,e,t){TP(r,e),e.set(r,t)}s(e_,"_classPrivateFieldInit");function t_(r,e,t){var n=r_(r,e,"set");return MP(r,n,t),t}s(t_,"_classPrivateFieldSet");function BP(r){return typeof r=="string"||rt.isInstance(r)||$e.isInstance(r)?{streamId:r}:{streamId:r.streamId,genesis:r.genesis}}s(BP,"keyToQuery");function ug(r){return typeof r=="string"?ai.from(r).toString():rt.isInstance(r)||$e.isInstance(r)?r.toString():r.streamId.toString()}s(ug,"keyToString");function hg(r){return M(this,null,function*(){let e=yield bn.makeGenesis({},null,be(ne({},r),{deterministic:!0})),t=yield $e.fromGenesis("tile",e);return{genesis:e,streamId:t}})}s(hg,"getDeterministicQuery");var IP=s(()=>Promise.resolve([]),"tempBatchLoadFn"),i0=new WeakMap,lg=new WeakMap,Kn=class extends n_.default{cache(e){if(!cg(this,lg))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}create(e,t,n){return M(this,null,function*(){let i=yield bn.create(cg(this,i0),e,t,n);return this.cache(i),i})}deterministic(e,t){return M(this,null,function*(){let n=yield hg(e);try{return yield C0(Kn.prototype,this,"load").call(this,n)}catch(i){let o=yield bn.createFromGenesis(cg(this,i0),n.genesis,t);return this.cache(o),o}})}load(e){return M(this,null,function*(){return yield C0(Kn.prototype,this,"load").call(this,e)})}update(e,t,n,i){return M(this,null,function*(){let o=ug(e);this.clear(o);let a=yield this.load({streamId:o});return yield a.update(t,n,i),a})}constructor(e){super(IP,{cache:!0,cacheKeyFn:ug,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),e_(this,i0,{writable:!0,value:void 0}),e_(this,lg,{writable:!0,value:void 0}),this._batchLoadFn=t=>M(this,null,function*(){e.cache||this.clearAll();let n=yield e.ceramic.multiQuery(t.map(BP),e.multiqueryTimeout);return t.map(i=>{let o=ug(i),a=n[o];return a||new Error(`Failed to load stream: ${o}`)})}),t_(this,i0,e.ceramic),t_(this,lg,!!e.cache)}};s(Kn,"TileLoader");function NP(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(NP,"_checkPrivateRedeclaration");function OP(r,e){return e.get?e.get.call(r):e.value}s(OP,"_classApplyDescriptorGet");function PP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}s(PP,"_classApplyDescriptorSet");function o_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}s(o_,"_classExtractFieldDescriptor");function Ra(r,e){var t=o_(r,e,"get");return OP(r,t)}s(Ra,"_classPrivateFieldGet");function i_(r,e,t){NP(r,e),e.set(r,t)}s(i_,"_classPrivateFieldInit");function dg(r,e,t){var n=o_(r,e,"set");return PP(r,n,t),t}s(dg,"_classPrivateFieldSet");var mc=new WeakMap,bc=new WeakMap,gc=class{get aliases(){return Ra(this,mc)}get loader(){return Ra(this,bc)}getDefinitionID(e){var t;return(t=Ra(this,mc).definitions[e])!=null?t:null}getSchemaURL(e){var t;return(t=Ra(this,mc).schemas[e])!=null?t:null}getTileID(e){var t;return(t=Ra(this,mc).tiles[e])!=null?t:null}loadTile(e){return M(this,null,function*(){let t=this.getTileID(e);if(t==null)throw new Error(`Tile alias "${e}" is not defined`);return yield Ra(this,bc).load(t)})}createTile(i,o){return M(this,arguments,function*(e,t,n={}){let a=this.getSchemaURL(e);if(a==null)throw new Error(`Schema alias "${e}" is not defined`);let h=n,{controller:f}=h,c=Mt(h,["controller"]),l={schema:a};return f!=null&&(l.controllers=[f]),yield Ra(this,bc).create(t,l,c)})}constructor(e){if(i_(this,mc,{writable:!0,value:void 0}),i_(this,bc,{writable:!0,value:void 0}),dg(this,mc,e.aliases),e.loader!=null)dg(this,bc,e.loader);else{if(e.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");dg(this,bc,new Kn({ceramic:e.ceramic,cache:e.cache}))}}};s(gc,"DataModel");function RP(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}s(RP,"_checkPrivateRedeclaration");function UP(r,e){return e.get?e.get.call(r):e.value}s(UP,"_classApplyDescriptorGet");function LP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}s(LP,"_classApplyDescriptorSet");function s_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}s(s_,"_classExtractFieldDescriptor");function Di(r,e){var t=s_(r,e,"get");return UP(r,t)}s(Di,"_classPrivateFieldGet");function o0(r,e,t){RP(r,e),e.set(r,t)}s(o0,"_classPrivateFieldInit");function s0(r,e,t){var n=s_(r,e,"set");return LP(r,n,t),t}s(s0,"_classPrivateFieldSet");var a0=new WeakMap,Ua=new WeakMap,pg=new WeakMap,f0=new WeakMap,Cl=class{_createValuePromise(){s0(this,pg,new Promise((e,t)=>{s0(this,f0,{resolve:e,reject:t})}))}change(e){return new Promise((t,n)=>{let i=s(o=>M(this,null,function*(){try{let a=yield e(o);t(),this._next(a)}catch(a){n(a),this._next(o)}}),"run");Di(this,Ua).push({reject:n,run:i}),Di(this,Ua).length===1&&this._start()})}changeContent(e){return M(this,null,function*(){let t=s(n=>M(this,null,function*(){return yield n.update(e(n.content),n.metadata),n}),"mutation");return yield this.change(t)})}get(){return M(this,null,function*(){return Di(this,Ua).length===0?yield Di(this,a0).call(this):yield Di(this,pg)})}_start(){return M(this,null,function*(){try{let e=yield Di(this,a0).call(this);this._next(e)}catch(e){Di(this,Ua).forEach(t=>{t.reject(e)}),s0(this,Ua,[]),Di(this,f0).reject(e),this._createValuePromise()}})}_next(e){let t=Di(this,Ua).shift();t==null?this._end(e):t.run(e)}_end(e){Di(this,f0).resolve(e),this._createValuePromise()}constructor(e){o0(this,a0,{writable:!0,value:void 0}),o0(this,Ua,{writable:!0,value:[]}),o0(this,pg,{writable:!0,value:void 0}),o0(this,f0,{writable:!0,value:void 0}),s0(this,a0,e),this._createValuePromise()}};s(Cl,"TileProxy");var DP=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function FP(r){return DP.test(r)}s(FP,"isDIDstring");function KP(r){if(!FP(r))throw new Error(`Invalid DID: ${r}`)}s(KP,"assertDIDstring");function mg(r){return KP(r),{controllers:[r],family:"IDX"}}s(mg,"getIDXMetadata");function $P(r,e){if(e.has(r))throw new TypeError("Cannot initialize the same private elements twice on an object")}s($P,"_checkPrivateRedeclaration");function HP(r,e){return e.get?e.get.call(r):e.value}s(HP,"_classApplyDescriptorGet");function qP(r,e,t){if(e.set)e.set.call(r,t);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=t}}s(qP,"_classApplyDescriptorSet");function a_(r,e,t){if(!e.has(r))throw new TypeError("attempted to "+t+" private field on non-instance");return e.get(r)}s(a_,"_classExtractFieldDescriptor");function Ht(r,e){var t=a_(r,e,"get");return HP(r,t)}s(Ht,"_classPrivateFieldGet");function Tl(r,e,t){$P(r,e),e.set(r,t)}s(Tl,"_classPrivateFieldInit");function c0(r,e,t){var n=a_(r,e,"set");return qP(r,n,t),t}s(c0,"_classPrivateFieldSet");var Eo=new WeakMap,u0=new WeakMap,bg=new WeakMap,Fi=new WeakMap,l0=new WeakMap,kl=class{get authenticated(){return Ht(this,Eo).did!=null}get ceramic(){return Ht(this,Eo)}get id(){if(Ht(this,u0)!=null)return Ht(this,u0);if(Ht(this,Eo).did==null)throw new Error("Ceramic instance is not authenticated");return Ht(this,Eo).did.hasParent?Ht(this,Eo).did.parent:Ht(this,Eo).did.id}get loader(){return Ht(this,Fi)}get model(){return Ht(this,l0)}has(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return(yield this.getRecordID(n,t))!=null})}get(e,t){return M(this,null,function*(){let n=this.getDefinitionID(e);return yield this.getRecord(n,t)})}getMultiple(e,t){return M(this,null,function*(){var f,c,l;let n=this.getDefinitionID(e),i=yield Promise.all(t.map(h=>M(this,null,function*(){let{genesis:d,streamId:y}=yield hg(mg(h));return{genesis:d,streamId:y.toString(),paths:[n]}}))),o=yield Ht(this,Eo).multiQuery(i),a=[];for(let h of i){let d=(c=(f=o[h.streamId])==null?void 0:f.content)==null?void 0:c[n],y=d?o[$e.fromString(d).toString()]:null;a.push((l=y==null?void 0:y.content)!=null?l:null)}return a})}set(i,o){return M(this,arguments,function*(e,t,n={}){var l;let a=this.getDefinitionID(e),[f,c]=yield this._setRecordOnly(a,t,n);return f&&(yield this._setReference((l=n.controller)!=null?l:this.id,a,c)),c})}merge(i,o){return M(this,arguments,function*(e,t,n={}){let a=this.getDefinitionID(e),f=yield this.getRecord(a),c=f?ne(ne({},f),t):t;return yield this.setRecord(a,c,n)})}setAll(n){return M(this,arguments,function*(e,t={}){var f;let i=Object.entries(e).map(h=>M(this,[h],function*([c,l]){let d=this.getDefinitionID(c),[y,A]=yield this._setRecordOnly(d,l,t);return[y,d,A]})),a=(yield Promise.all(i)).reduce((c,[l,h,d])=>(l&&(c[h]=d.toUrl()),c),{});return yield this._setReferences((f=t.controller)!=null?f:this.id,a),a})}setDefaults(n){return M(this,arguments,function*(e,t={}){var c,l;let i=(c=yield this.getIndex())!=null?c:{},o=Object.entries(e).map(([h,d])=>[this.getDefinitionID(h),d]).filter(h=>i[h[0]]==null).map(y=>M(this,[y],function*([h,d]){let A=yield this.getDefinition(h),v=yield this._createRecord(A,d,t);return{[h]:v.toUrl()}})),f=(yield Promise.all(o)).reduce((h,d)=>Object.assign(h,d),{});return yield this._setReferences((l=t.controller)!=null?l:this.id,f),f})}remove(n){return M(this,arguments,function*(e,t=this.id){yield this._getIndexProxy(t).changeContent(i=>(i!=null&&delete i[this.getDefinitionID(e)],i))})}getIndex(){return M(this,arguments,function*(e=this.id){let t=this.authenticated&&e===this.id?yield this._getIndexProxy(e).get():yield this._getIDXDoc(e);return t?t.content:null})}iterator(e){let t,n=0;return{[Symbol.asyncIterator](){return this},next:()=>M(this,null,function*(){if(t==null){let f=yield this.getIndex(e);t=Object.entries(f!=null?f:{})}if(n===t.length)return{done:!0,value:null};let[i,o]=t[n++],a=yield Ht(this,Fi).load(o);return{done:!1,value:{key:i,id:o,record:a.content}}})}}_createIDXDoc(e){return M(this,null,function*(){return yield Ht(this,Fi).deterministic(mg(e))})}_getIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)return null;if(t.metadata.schema!==bp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getOwnIDXDoc(e){return M(this,null,function*(){let t=yield this._createIDXDoc(e);if(t.content==null||t.metadata.schema==null)yield t.update({},{schema:bp});else if(t.metadata.schema!==bp)throw new Error("Invalid document: schema is not IdentityIndex");return t})}_getIndexProxy(e){let t=Ht(this,bg)[e];return t==null&&(t=new Cl(()=>M(this,null,function*(){return yield this._getOwnIDXDoc(e)})),Ht(this,bg)[e]=t),t}getDefinitionID(e){var t;return(t=Ht(this,l0).getDefinitionID(e))!=null?t:e}getDefinition(e){return M(this,null,function*(){let t=yield Ht(this,Fi).load(e);if(t.metadata.schema!==d8)throw new Error("Invalid document: schema is not Definition");return be(ne({},t.content),{id:t.id})})}getRecordID(e,t){return M(this,null,function*(){var i;let n=yield this.getIndex(t!=null?t:this.id);return(i=n==null?void 0:n[e])!=null?i:null})}getRecordDocument(e,t){return M(this,null,function*(){let n=yield this.getRecordID(e,t);return n?yield Ht(this,Fi).load(n):null})}getRecord(e,t){return M(this,null,function*(){let n=yield this.getRecordDocument(e,t);return n?n.content:null})}setRecord(i,o){return M(this,arguments,function*(e,t,n={}){var c;let[a,f]=yield this._setRecordOnly(e,t,n);return a&&(yield this._setReference((c=n.controller)!=null?c:this.id,e,f)),f})}_setRecordOnly(e,t,n){return M(this,null,function*(){var o;let i=yield this.getRecordID(e,(o=n.controller)!=null?o:this.id);if(i==null){let a=yield this.getDefinition(e),f=yield this._createRecord(a,t,n);return[!0,f]}else{let a=yield Ht(this,Fi).update(i,t);return[!1,a.id]}})}_createRecord(o,a,f){return M(this,arguments,function*(e,t,{controller:n,pin:i}){let c=yield Ht(this,Fi).deterministic({controllers:[n!=null?n:this.id],family:e.id.toString()},{pin:i});return yield c.update(t,{schema:e.schema}),c.id})}_setReference(e,t,n){return M(this,null,function*(){yield this._getIndexProxy(e).changeContent(i=>be(ne({},i),{[t]:n.toUrl()}))})}_setReferences(e,t){return M(this,null,function*(){Object.keys(t).length!==0&&(yield this._getIndexProxy(e).changeContent(n=>ne(ne({},n),t)))})}constructor(e){Tl(this,Eo,{writable:!0,value:void 0}),Tl(this,u0,{writable:!0,value:void 0}),Tl(this,bg,{writable:!0,value:{}}),Tl(this,Fi,{writable:!0,value:void 0}),Tl(this,l0,{writable:!0,value:void 0});let{cache:t,ceramic:n,id:i,loader:o,model:a}=e;c0(this,Eo,n),c0(this,u0,i),c0(this,Fi,o!=null?o:new Kn({ceramic:n,cache:t})),c0(this,l0,a instanceof gc?a:new gc({loader:Ht(this,Fi),aliases:a}))}};s(kl,"DIDDataStore");function gg(r){return typeof r=="string"?$e.fromString(r):r}s(gg,"typeStreamID");function f_(r,e){return e?r.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):r}s(f_,"combineURLs");var k_=ze(T_(),1),Lr=class extends ut{constructor(e,t,n){super(i=>{this.state$.observers.length===0&&(this.periodicSubscription=Al(0,n).pipe(rg(()=>this._syncState(this.id,{sync:kr.PREFER_CACHE}))).subscribe()),this.state$.subscribe(i).add(()=>{var f;this.state$.observers.length===0&&((f=this.periodicSubscription)==null||f.unsubscribe())})}),this._apiUrl=t,this.state$=new Sl(e)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}_syncState(e,t){return M(this,null,function*(){let n=yield Lr._load(e,this._apiUrl,t);this.state$.next(dt.deserializeState(n))})}get id(){return new $e(this.state$.value.type,this.state$.value.log[0].cid)}static createFromGenesis(e,t,n,i,o){return M(this,null,function*(){let{state:a}=yield mn(e+"/streams",{method:"post",body:{type:t,genesis:dt.serializeCommit(n),opts:i}});return new Lr(dt.deserializeState(a),e,o)})}static applyCommit(e,t,n,i,o){return M(this,null,function*(){let{state:a}=yield mn(e+"/commits",{method:"post",body:{streamId:t.toString(),commit:dt.serializeCommit(n),opts:i}});return new Lr(dt.deserializeState(a),e,o)})}static _load(e,t,n){return M(this,null,function*(){let i=t+"/streams/"+e.toString()+"?"+k_.default.stringify(n),{state:o}=yield mn(i);return o})}static load(e,t,n,i){return M(this,null,function*(){let o=yield Lr._load(e,t,i);return new Lr(dt.deserializeState(o),t,n)})}static loadStreamCommits(e,t){return M(this,null,function*(){let{commits:n}=yield mn(`${t}/commits/${e}`);return n.map(i=>({cid:i.cid,value:dt.deserializeCommit(i.value)}))})}complete(){this.state$.complete()}};s(Lr,"Document");var QP=function(r,e,t,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,n);else for(var f=r.length-1;f>=0;f--)(a=r[f])&&(o=(i<3?a(o):i>3?a(e,t,o):a(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},La,wg=s(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),M_={anchor:!1,publish:!0,pin:!0,sync:kr.PREFER_CACHE},xg={anchor:!0,publish:!0,throwOnInvalidCommit:!0},eR={sync:kr.PREFER_CACHE},Da=La=s(class extends Oa{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}static fromAccount(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},M_),n);let a=VA(t),f=La.makeGenesis(a);return La.fromGenesis(e,f,n)})}static fromGenesis(i,o){return M(this,arguments,function*(e,t,n={}){return n=ne(ne({},M_),n),e.createStreamFromGenesis(La.STREAM_TYPE_ID,t,n)})}setDid(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},xg),n);let a=typeof e=="string"?e.trim():e.id,f=F0(a);if((f==null?void 0:f.did)!==a)throw new Error(`DID is not valid: '${a}'`);let c=yield t.createLink(a);return this.setDidProof(c,n)})}setDidProof(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},xg),t);let i=this.makeCommit(e),o=yield this.api.applyCommit(this.id,i,t);this.state$.next(o.state)})}clearDid(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},xg),t);let i=yield e.createLink("");return this.setDidProof(i,t)})}static load(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},eR),n);let a=ai.from(t);if(a.type!=La.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${La.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return e.loadStream(a,n)})}static makeGenesis(e){return e.chainId.namespace==="eip155"&&(e.address=e.address.toLowerCase()),{header:{controllers:[`${e.address}@${e.chainId.toString()}`],family:`caip10-${e.chainId.toString()}`}}}makeCommit(e){return{data:e,prev:this.tip,id:this.state$.id.cid}}makeReadOnly(){this.setDidProof=wg,this.setDid=wg,this.sync=wg,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link");Da.STREAM_TYPE_NAME="caip10-link";Da.STREAM_TYPE_ID=1;Da=La=QP([Qp()],Da);var Ml=class{constructor(e){this._apiUrl=e}add(e,t){return M(this,null,function*(){let n={};t&&(n.force=!0),yield mn(this._apiUrl+`/pins/${e.toString()}`,{method:"post",body:n})})}rm(e,t){return M(this,null,function*(){yield mn(this._apiUrl+`/pins/${e.toString()}`,{method:"delete",body:{opts:t}})})}ls(e){return M(this,null,function*(){let t=this._apiUrl+"/pins";e&&(t+=`/${e.toString()}`);let n=yield mn(t),{pinnedStreamIds:i}=n;return{[Symbol.asyncIterator](){let o=0;return{next(){return o===i.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:i[o++],done:!1})}}}}})}};s(Ml,"RemotePinApi");var tR="/api/v0",rR="http://localhost:7007",nR={syncInterval:5e3},iR={anchor:!0,publish:!0,sync:kr.PREFER_CACHE},oR={anchor:!0,publish:!0,sync:kr.PREFER_CACHE},B_={sync:kr.PREFER_CACHE},Bl=class{constructor(e=rR,t={}){this._config=ne(ne({},nR),t),this._apiUrl=f_(e,tR),this._streamCache=new Map,this.context={api:this},this.pin=new Ml(this._apiUrl),this._streamConstructors={[bn.STREAM_TYPE_ID]:bn,[Da.STREAM_TYPE_ID]:Da}}get did(){return this.context.did}set did(e){this.context.did=e}createStreamFromGenesis(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},oR),n);let a=yield Lr.createFromGenesis(this._apiUrl,e,t,n,this._config.syncInterval),f=this._streamCache.get(a.id.toString());return f?(dt.statesEqual(a.state,f.state)||f.next(a.state),this.buildStream(f)):(this._streamCache.set(a.id.toString(),a),this.buildStream(a))})}loadStream(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},B_),t);let i=ai.from(e),o=this._streamCache.get(i.baseID.toString());return o?yield o._syncState(i,t):(o=yield Lr.load(i,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(o.id.toString(),o)),this.buildStream(o)})}multiQuery(e,t){return M(this,null,function*(){let n=e.map(o=>be(ne({},o),{streamId:typeof o.streamId=="string"?o.streamId:o.streamId.toString()})),i=yield mn(this._apiUrl+"/multiqueries",{method:"post",body:{queries:n,timeout:t}});return Object.entries(i).reduce((o,a)=>{let[f,c]=a,l=dt.deserializeState(c),h=new Lr(l,this._apiUrl,this._config.syncInterval);return o[f]=this.buildStream(h),o},{})})}loadStreamCommits(e){let t=gg(e);return Lr.loadStreamCommits(t,this._apiUrl)}applyCommit(i,o){return M(this,arguments,function*(e,t,n={}){n=ne(ne({},iR),n);let a=gg(e),f=yield Lr.applyCommit(this._apiUrl,a,t,n,this._config.syncInterval),c=this._streamCache.get(a.toString());return c?(c.next(f.state),this.buildStream(f)):(this._streamCache.set(a.toString(),f),this.buildStream(f))})}requestAnchor(n){return M(this,arguments,function*(e,t={}){t=ne(ne({},B_),t);let{anchorStatus:i}=yield mn(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return i})}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}findStreamConstructor(e){let t=this._streamConstructors[e];if(t)return t;throw new Error(`Failed to find constructor for stream ${e}`)}buildStream(e){let t=this.findStreamConstructor(e.state.type);return new t(e,this.context)}setDID(e){return M(this,null,function*(){this.context.did=e})}getSupportedChains(){return M(this,null,function*(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=yield mn(this._apiUrl+"/node/chains");return this._supportedChains=e,e})}close(){return M(this,null,function*(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()})}};s(Bl,"CeramicClient");var sR=s((r,e)=>M(void 0,null,function*(){let t=new Bl(e),n=ne({},I_.default.getResolver()),i=new Ea({resolver:n});t.did=i;let o=r.pluginMethods.getKey(),a=new al(lp(o));return t.did.setProvider(a),yield t.did.authenticate(),t}),"getCeramicClientFromWalletSuite"),h0=s((o,a)=>M(void 0,[o,a],function*(r,{modelData:e,credentialAlias:t,ceramicEndpoint:n,defaultContentFamily:i}){let f=yield sR(r,n),c=new Kn({ceramic:f}),l=new kl({ceramic:f,model:e}),h=s((...x)=>M(void 0,[...x],function*(v=t){return(yield l.get(v))||{credentials:[]}}),"getCredentialsListFromIndex"),d=s((v,x)=>M(void 0,null,function*(){if(!v)throw new Error("record is required");if(!v.id)throw Error("No streamId provided");v.id.indexOf("ceramic://")===-1&&(v.id="ceramic://"+v.id),x||(x=t);let L=yield h(x);return L.credentials.push(ne({storageType:"ceramic"},v)),l.set(x,L)}),"addCredentialStreamIdToIndex"),y=s((_,...R)=>M(void 0,[_,...R],function*(v,x={},L={}){if(!v)throw new Error("content is required");return x.controllers||(x.controllers=[f.did.id]),x.family||(x.family=i),"pin"in L||(L.pin=!0),(yield bn.create(f,v,x,L)).id.toString()}),"publishContentToCeramic"),A=s(v=>M(void 0,null,function*(){var x;return(x=yield c.load(v))==null?void 0:x.content}),"readContentFromCeramic");return{pluginMethods:{getCredentialsListFromIndex:(L,..._)=>M(void 0,[L,..._],function*(v,x=t){return h(x)}),publishContentToCeramic:(v,x)=>M(void 0,null,function*(){return y(x)}),readContentFromCeramic:(v,x)=>M(void 0,null,function*(){return A(x)}),getVerifiableCredentialFromIndex:(v,x)=>M(void 0,null,function*(){var R;let L=yield h(),_=(R=L==null?void 0:L.credentials)==null?void 0:R.find(H=>(H==null?void 0:H.title)===x);return _&&(yield A(_.id))}),getVerifiableCredentialsFromIndex:()=>M(void 0,null,function*(){var L,_;let v=yield h(),x=(_=(L=v==null?void 0:v.credentials)==null?void 0:L.map(R=>R==null?void 0:R.id))!=null?_:[];return Promise.all(x.map(R=>M(void 0,null,function*(){return A(R)})))}),addVerifiableCredentialInIdx:(_,R)=>M(void 0,[_,R],function*(v,{title:x,id:L}){return d({title:x,id:L})})}}}),"getIDXPlugin");var N_=s(r=>M(void 0,null,function*(){let e=JSON.parse($g(lp(r.padStart(64,"0")))),t=Hg("key",JSON.stringify(e));return{pluginMethods:{getSubjectDid:()=>t,getSubjectKeypair:()=>e,getKey:()=>r.padStart(64,"0")}}}),"getDidKeyPlugin");var O_=s(r=>({pluginMethods:{verifyCredential:(e,t)=>M(void 0,null,function*(){let n=yield r.pluginMethods.verifyCredential(t);return t.expirationDate&&new Date>new Date(t.expirationDate)?n.errors.push("expiration error: Credential is expired"):n.checks.push("expiration"),n})}}),"ExpirationPlugin");var P_=s((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectKeypair();if(!t)throw new Error("Cannot issue credential: Could not get subject keypair");let n=JSON.stringify(t),i=JSON.stringify({verificationMethod:yield Kl("key",n),proofPurpose:"assertionMethod"});return JSON.parse(yield qg(JSON.stringify(e),i,n))}),"issueCredential");var R_=s(r=>M(void 0,null,function*(){return JSON.parse(yield zg(JSON.stringify(r),"{}"))}),"verifyCredential");var U_=s((r,e)=>M(void 0,null,function*(){let t=r.pluginMethods.getSubjectDid();if(!t)throw new Error("Cannot create presentation: No holder key found");let n=t,i=r.pluginMethods.getSubjectKeypair();if(!i)throw new Error("Cannot issue credential: Could not get subject keypair");let o=JSON.stringify(i),a=JSON.stringify({verificationMethod:yield Kl("key",o),proofPurpose:"assertionMethod"}),f=JSON.stringify({"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:n,verifiableCredential:e});return JSON.parse(yield jg(f,a,o))}),"issuePresentation");var L_=s(r=>M(void 0,null,function*(){return JSON.parse(yield Vg(JSON.stringify(r),"{}"))}),"verifyPresentation");var Ag=s(r=>M(void 0,null,function*(){return{pluginMethods:be(ne({},r.pluginMethods),{issueCredential:P_,verifyCredential:(e,t)=>M(void 0,null,function*(){return R_(t)}),issuePresentation:U_,verifyPresentation:(e,t)=>M(void 0,null,function*(){return L_(t)}),getTestVc:(e,t="did:example:d23dd687a7dc6787646f2eb98d0")=>{let n=e.pluginMethods.getSubjectDid();return{"@context":"https://www.w3.org/2018/credentials/v1",id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:n,issuanceDate:"2020-08-19T21:41:50Z",credentialSubject:{id:t}}}})}}),"getVCPlugin");var Il=(r=>(r.Success="Success",r.Failed="Failed",r.Error="Error",r))(Il||{});function Qt(r){if(r===null||r===!0||r===!1)return NaN;var e=Number(r);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}s(Qt,"toInteger");function nt(r,e){if(e.length<r)throw new TypeError(r+" argument"+(r>1?"s":"")+" required, but only "+e.length+" present")}s(nt,"requiredArgs");function zt(r){nt(1,arguments);var e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new Date(r.getTime()):typeof r=="number"||e==="[object Number]"?new Date(r):((typeof r=="string"||e==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}s(zt,"toDate");function _g(r,e){nt(2,arguments);var t=zt(r).getTime(),n=Qt(e);return new Date(t+n)}s(_g,"addMilliseconds");function Eg(r){var e=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return e.setUTCFullYear(r.getFullYear()),r.getTime()-e.getTime()}s(Eg,"getTimezoneOffsetInMilliseconds");function Sg(r){return nt(1,arguments),r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}s(Sg,"isDate");function Cg(r){if(nt(1,arguments),!Sg(r)&&typeof r!="number")return!1;var e=zt(r);return!isNaN(Number(e))}s(Cg,"isValid");var aR={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},fR=s(function(r,e,t){var n,i=aR[r];return typeof i=="string"?n=i:e===1?n=i.one:n=i.other.replace("{{count}}",e.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n},"formatDistance"),D_=fR;function Nl(r){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.width?String(e.width):r.defaultWidth,n=r.formats[t]||r.formats[r.defaultWidth];return n}}s(Nl,"buildFormatLongFn");var cR={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},uR={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},lR={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},hR={date:Nl({formats:cR,defaultWidth:"full"}),time:Nl({formats:uR,defaultWidth:"full"}),dateTime:Nl({formats:lR,defaultWidth:"full"})},F_=hR;var dR={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pR=s(function(r,e,t,n){return dR[r]},"formatRelative"),K_=pR;function Fa(r){return function(e,t){var n=t||{},i=n.context?String(n.context):"standalone",o;if(i==="formatting"&&r.formattingValues){var a=r.defaultFormattingWidth||r.defaultWidth,f=n.width?String(n.width):a;o=r.formattingValues[f]||r.formattingValues[a]}else{var c=r.defaultWidth,l=n.width?String(n.width):r.defaultWidth;o=r.values[l]||r.values[c]}var h=r.argumentCallback?r.argumentCallback(e):e;return o[h]}}s(Fa,"buildLocalizeFn");var mR={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},bR={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},gR={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},yR={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},vR={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},wR={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},xR=s(function(r,e){var t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},"ordinalNumber"),AR={ordinalNumber:xR,era:Fa({values:mR,defaultWidth:"wide"}),quarter:Fa({values:bR,defaultWidth:"wide",argumentCallback:function(r){return r-1}}),month:Fa({values:gR,defaultWidth:"wide"}),day:Fa({values:yR,defaultWidth:"wide"}),dayPeriod:Fa({values:vR,defaultWidth:"wide",formattingValues:wR,defaultFormattingWidth:"wide"})},$_=AR;function Ka(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,i=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],o=e.match(i);if(!o)return null;var a=o[0],f=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],c=Array.isArray(f)?ER(f,function(d){return d.test(a)}):_R(f,function(d){return d.test(a)}),l;l=r.valueCallback?r.valueCallback(c):c,l=t.valueCallback?t.valueCallback(l):l;var h=e.slice(a.length);return{value:l,rest:h}}}s(Ka,"buildMatchFn");function _R(r,e){for(var t in r)if(r.hasOwnProperty(t)&&e(r[t]))return t}s(_R,"findKey");function ER(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return t}s(ER,"findIndex");function Tg(r){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.match(r.matchPattern);if(!n)return null;var i=n[0],o=e.match(r.parsePattern);if(!o)return null;var a=r.valueCallback?r.valueCallback(o[0]):o[0];a=t.valueCallback?t.valueCallback(a):a;var f=e.slice(i.length);return{value:a,rest:f}}}s(Tg,"buildMatchPatternFn");var SR=/^(\d+)(th|st|nd|rd)?/i,CR=/\d+/i,TR={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kR={any:[/^b/i,/^(a|c)/i]},MR={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},BR={any:[/1/i,/2/i,/3/i,/4/i]},IR={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},NR={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},OR={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},PR={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},RR={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},UR={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},LR={ordinalNumber:Tg({matchPattern:SR,parsePattern:CR,valueCallback:function(r){return parseInt(r,10)}}),era:Ka({matchPatterns:TR,defaultMatchWidth:"wide",parsePatterns:kR,defaultParseWidth:"any"}),quarter:Ka({matchPatterns:MR,defaultMatchWidth:"wide",parsePatterns:BR,defaultParseWidth:"any",valueCallback:function(r){return r+1}}),month:Ka({matchPatterns:IR,defaultMatchWidth:"wide",parsePatterns:NR,defaultParseWidth:"any"}),day:Ka({matchPatterns:OR,defaultMatchWidth:"wide",parsePatterns:PR,defaultParseWidth:"any"}),dayPeriod:Ka({matchPatterns:RR,defaultMatchWidth:"any",parsePatterns:UR,defaultParseWidth:"any"})},H_=LR;var DR={code:"en-US",formatDistance:D_,formatLong:F_,formatRelative:K_,localize:$_,match:H_,options:{weekStartsOn:0,firstWeekContainsDate:1}},q_=DR;function kg(r,e){nt(2,arguments);var t=Qt(e);return _g(r,-t)}s(kg,"subMilliseconds");var FR=864e5;function Mg(r){nt(1,arguments);var e=zt(r),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),i=t-n;return Math.floor(i/FR)+1}s(Mg,"getUTCDayOfYear");function Bs(r){nt(1,arguments);var e=1,t=zt(r),n=t.getUTCDay(),i=(n<e?7:0)+n-e;return t.setUTCDate(t.getUTCDate()-i),t.setUTCHours(0,0,0,0),t}s(Bs,"startOfUTCISOWeek");function Ol(r){nt(1,arguments);var e=zt(r),t=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var i=Bs(n),o=new Date(0);o.setUTCFullYear(t,0,4),o.setUTCHours(0,0,0,0);var a=Bs(o);return e.getTime()>=i.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}s(Ol,"getUTCISOWeekYear");function Bg(r){nt(1,arguments);var e=Ol(r),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var n=Bs(t);return n}s(Bg,"startOfUTCISOWeekYear");var KR=6048e5;function Ig(r){nt(1,arguments);var e=zt(r),t=Bs(e).getTime()-Bg(e).getTime();return Math.round(t/KR)+1}s(Ig,"getUTCISOWeek");function Is(r,e){nt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.weekStartsOn,o=i==null?0:Qt(i),a=t.weekStartsOn==null?o:Qt(t.weekStartsOn);if(!(a>=0&&a<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=zt(r),c=f.getUTCDay(),l=(c<a?7:0)+c-a;return f.setUTCDate(f.getUTCDate()-l),f.setUTCHours(0,0,0,0),f}s(Is,"startOfUTCWeek");function Pl(r,e){nt(1,arguments);var t=zt(r),n=t.getUTCFullYear(),i=e||{},o=i.locale,a=o&&o.options&&o.options.firstWeekContainsDate,f=a==null?1:Qt(a),c=i.firstWeekContainsDate==null?f:Qt(i.firstWeekContainsDate);if(!(c>=1&&c<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var l=new Date(0);l.setUTCFullYear(n+1,0,c),l.setUTCHours(0,0,0,0);var h=Is(l,e),d=new Date(0);d.setUTCFullYear(n,0,c),d.setUTCHours(0,0,0,0);var y=Is(d,e);return t.getTime()>=h.getTime()?n+1:t.getTime()>=y.getTime()?n:n-1}s(Pl,"getUTCWeekYear");function Ng(r,e){nt(1,arguments);var t=e||{},n=t.locale,i=n&&n.options&&n.options.firstWeekContainsDate,o=i==null?1:Qt(i),a=t.firstWeekContainsDate==null?o:Qt(t.firstWeekContainsDate),f=Pl(r,e),c=new Date(0);c.setUTCFullYear(f,0,a),c.setUTCHours(0,0,0,0);var l=Is(c,e);return l}s(Ng,"startOfUTCWeekYear");var $R=6048e5;function Og(r,e){nt(1,arguments);var t=zt(r),n=Is(t,e).getTime()-Ng(t,e).getTime();return Math.round(n/$R)+1}s(Og,"getUTCWeek");function et(r,e){for(var t=r<0?"-":"",n=Math.abs(r).toString();n.length<e;)n="0"+n;return t+n}s(et,"addLeadingZeros");var HR={y:function(r,e){var t=r.getUTCFullYear(),n=t>0?t:1-t;return et(e==="yy"?n%100:n,e.length)},M:function(r,e){var t=r.getUTCMonth();return e==="M"?String(t+1):et(t+1,2)},d:function(r,e){return et(r.getUTCDate(),e.length)},a:function(r,e){var t=r.getUTCHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h:function(r,e){return et(r.getUTCHours()%12||12,e.length)},H:function(r,e){return et(r.getUTCHours(),e.length)},m:function(r,e){return et(r.getUTCMinutes(),e.length)},s:function(r,e){return et(r.getUTCSeconds(),e.length)},S:function(r,e){var t=e.length,n=r.getUTCMilliseconds(),i=Math.floor(n*Math.pow(10,t-3));return et(i,e.length)}},Co=HR;var yc={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},qR={G:function(r,e,t){var n=r.getUTCFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){var n=r.getUTCFullYear(),i=n>0?n:1-n;return t.ordinalNumber(i,{unit:"year"})}return Co.y(r,e)},Y:function(r,e,t,n){var i=Pl(r,n),o=i>0?i:1-i;if(e==="YY"){var a=o%100;return et(a,2)}return e==="Yo"?t.ordinalNumber(o,{unit:"year"}):et(o,e.length)},R:function(r,e){var t=Ol(r);return et(t,e.length)},u:function(r,e){var t=r.getUTCFullYear();return et(t,e.length)},Q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return et(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){var n=Math.ceil((r.getUTCMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return et(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){var n=r.getUTCMonth();switch(e){case"M":case"MM":return Co.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){var n=r.getUTCMonth();switch(e){case"L":return String(n+1);case"LL":return et(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){var i=Og(r,n);return e==="wo"?t.ordinalNumber(i,{unit:"week"}):et(i,e.length)},I:function(r,e,t){var n=Ig(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):et(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getUTCDate(),{unit:"date"}):Co.d(r,e)},D:function(r,e,t){var n=Mg(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):et(n,e.length)},E:function(r,e,t){var n=r.getUTCDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){var i=r.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return et(o,2);case"eo":return t.ordinalNumber(o,{unit:"day"});case"eee":return t.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(i,{width:"short",context:"formatting"});case"eeee":default:return t.day(i,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){var i=r.getUTCDay(),o=(i-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return et(o,e.length);case"co":return t.ordinalNumber(o,{unit:"day"});case"ccc":return t.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(i,{width:"narrow",context:"standalone"});case"cccccc":return t.day(i,{width:"short",context:"standalone"});case"cccc":default:return t.day(i,{width:"wide",context:"standalone"})}},i:function(r,e,t){var n=r.getUTCDay(),i=n===0?7:n;switch(e){case"i":return String(i);case"ii":return et(i,e.length);case"io":return t.ordinalNumber(i,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){var n=r.getUTCHours(),i=n/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(r,e,t){var n=r.getUTCHours(),i;switch(n===12?i=yc.noon:n===0?i=yc.midnight:i=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(r,e,t){var n=r.getUTCHours(),i;switch(n>=17?i=yc.evening:n>=12?i=yc.afternoon:n>=4?i=yc.morning:i=yc.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){var n=r.getUTCHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return Co.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getUTCHours(),{unit:"hour"}):Co.H(r,e)},K:function(r,e,t){var n=r.getUTCHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):et(n,e.length)},k:function(r,e,t){var n=r.getUTCHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):et(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getUTCMinutes(),{unit:"minute"}):Co.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getUTCSeconds(),{unit:"second"}):Co.s(r,e)},S:function(r,e){return Co.S(r,e)},X:function(r,e,t,n){var i=n._originalDate||r,o=i.getTimezoneOffset();if(o===0)return"Z";switch(e){case"X":return j_(o);case"XXXX":case"XX":return $a(o);case"XXXXX":case"XXX":default:return $a(o,":")}},x:function(r,e,t,n){var i=n._originalDate||r,o=i.getTimezoneOffset();switch(e){case"x":return j_(o);case"xxxx":case"xx":return $a(o);case"xxxxx":case"xxx":default:return $a(o,":")}},O:function(r,e,t,n){var i=n._originalDate||r,o=i.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+z_(o,":");case"OOOO":default:return"GMT"+$a(o,":")}},z:function(r,e,t,n){var i=n._originalDate||r,o=i.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+z_(o,":");case"zzzz":default:return"GMT"+$a(o,":")}},t:function(r,e,t,n){var i=n._originalDate||r,o=Math.floor(i.getTime()/1e3);return et(o,e.length)},T:function(r,e,t,n){var i=n._originalDate||r,o=i.getTime();return et(o,e.length)}};function z_(r,e){var t=r>0?"-":"+",n=Math.abs(r),i=Math.floor(n/60),o=n%60;if(o===0)return t+String(i);var a=e||"";return t+String(i)+a+et(o,2)}s(z_,"formatTimezoneShort");function j_(r,e){if(r%60===0){var t=r>0?"-":"+";return t+et(Math.abs(r)/60,2)}return $a(r,e)}s(j_,"formatTimezoneWithOptionalMinutes");function $a(r,e){var t=e||"",n=r>0?"-":"+",i=Math.abs(r),o=et(Math.floor(i/60),2),a=et(i%60,2);return n+o+t+a}s($a,"formatTimezone");var V_=qR;function W_(r,e){switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}}s(W_,"dateLongFormatter");function G_(r,e){switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}}s(G_,"timeLongFormatter");function zR(r,e){var t=r.match(/(P+)(p+)?/)||[],n=t[1],i=t[2];if(!i)return W_(r,e);var o;switch(n){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;case"PPPP":default:o=e.dateTime({width:"full"});break}return o.replace("{{date}}",W_(n,e)).replace("{{time}}",G_(i,e))}s(zR,"dateTimeLongFormatter");var jR={p:G_,P:zR},J_=jR;var VR=["D","DD"],WR=["YY","YYYY"];function Y_(r){return VR.indexOf(r)!==-1}s(Y_,"isProtectedDayOfYearToken");function X_(r){return WR.indexOf(r)!==-1}s(X_,"isProtectedWeekYearToken");function Pg(r,e,t){if(r==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(r==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"))}s(Pg,"throwProtectedError");var GR=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,JR=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,YR=/^'([^]*?)'?$/,XR=/''/g,ZR=/[a-zA-Z]/;function Rl(r,e,t){nt(2,arguments);var n=String(e),i=t||{},o=i.locale||q_,a=o.options&&o.options.firstWeekContainsDate,f=a==null?1:Qt(a),c=i.firstWeekContainsDate==null?f:Qt(i.firstWeekContainsDate);if(!(c>=1&&c<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var l=o.options&&o.options.weekStartsOn,h=l==null?0:Qt(l),d=i.weekStartsOn==null?h:Qt(i.weekStartsOn);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!o.localize)throw new RangeError("locale must contain localize property");if(!o.formatLong)throw new RangeError("locale must contain formatLong property");var y=zt(r);if(!Cg(y))throw new RangeError("Invalid time value");var A=Eg(y),v=kg(y,A),x={firstWeekContainsDate:c,weekStartsOn:d,locale:o,_originalDate:y},L=n.match(JR).map(function(_){var R=_[0];if(R==="p"||R==="P"){var H=J_[R];return H(_,o.formatLong,x)}return _}).join("").match(GR).map(function(_){if(_==="''")return"'";var R=_[0];if(R==="'")return QR(_);var H=V_[R];if(H)return!i.useAdditionalWeekYearTokens&&X_(_)&&Pg(_,e,r),!i.useAdditionalDayOfYearTokens&&Y_(_)&&Pg(_,e,r),H(v,_,o.localize,x);if(R.match(ZR))throw new RangeError("Format string contains an unescaped latin alphabet character `"+R+"`");return _}).join("");return L}s(Rl,"format");function QR(r){return r.match(YR)[1].replace(XR,"'")}s(QR,"cleanEscapedString");var eU=s((r,e)=>r.startsWith("expiration")?e.expirationDate?`Invalid \u2022 Expired ${Rl(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Invalid \u2022 Expired":r,"transformErrorMessage"),tU=s((r,e)=>({proof:"Valid",expiration:e.expirationDate?`Valid \u2022 Expires ${Rl(new Date(e.expirationDate),"dd MMM yyyy").toUpperCase()}`:"Valid \u2022 Does Not Expire"})[r]||r,"transformCheckMessage"),Z_=s(r=>e=>M(void 0,null,function*(){let t=yield r.pluginMethods.verifyCredential(e),n=[];return t.errors.forEach(i=>{n.push({status:Il.Failed,check:"hmm",details:eU(i,e)})}),t.warnings.forEach(i=>{n.push({status:Il.Error,check:"hmm",message:i})}),t.checks.forEach(i=>{n.push({status:Il.Success,check:i,message:tU(i,e)})}),n}),"verifyCredential");var Q_={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials",ceramicEndpoint:"https://ceramic-node.welibrary.io:7007",defaultContentFamily:"SuperSkills"};var eE=s((i,...o)=>M(void 0,[i,...o],function*(r,{ceramicIdx:e=Q_,didkit:t,defaultContents:n=[]}={}){yield Yg(t);let a=yield(yield gu(n)).addPlugin(yield N_(r)),f=yield a.addPlugin(yield Ag(a)),c=yield f.addPlugin(yield h0(f,e)),l=yield c.addPlugin(O_(c));return{_wallet:l,get did(){return l.pluginMethods.getSubjectDid()},get keypair(){return l.pluginMethods.getSubjectKeypair()},issueCredential:l.pluginMethods.issueCredential,verifyCredential:Z_(l),issuePresentation:l.pluginMethods.issuePresentation,verifyPresentation:l.pluginMethods.verifyPresentation,getCredential:l.pluginMethods.getVerifiableCredentialFromIndex,getCredentials:l.pluginMethods.getVerifiableCredentialsFromIndex,publishCredential:l.pluginMethods.publishContentToCeramic,addCredential:h=>M(void 0,null,function*(){yield l.pluginMethods.addVerifiableCredentialInIdx(h)}),readFromCeramic:l.pluginMethods.readContentFromCeramic,getTestVc:l.pluginMethods.getTestVc}}),"walletFromKey");
|
819
819
|
/*!
|
820
820
|
* Copyright (c) 2014, GMO GlobalSign
|
821
821
|
* Copyright (c) 2015-2022, Peculiar Ventures
|